本文整理汇总了C#中PDT_ProductBLL.Update方法的典型用法代码示例。如果您正苦于以下问题:C# PDT_ProductBLL.Update方法的具体用法?C# PDT_ProductBLL.Update怎么用?C# PDT_ProductBLL.Update使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PDT_ProductBLL
的用法示例。
在下文中一共展示了PDT_ProductBLL.Update方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: bt_AddDetail_Click
protected void bt_AddDetail_Click(object sender, EventArgs e)
{
if ((int)ViewState["ID"] == 0) return;
PBM_OrderBLL _bll = new PBM_OrderBLL((int)ViewState["ID"]);
if (ViewState["Details"] == null) return;
ListTable<PBM_OrderDetail> Details = (ListTable<PBM_OrderDetail>)ViewState["Details"];
int product = 0;
int.TryParse(select_Product.SelectValue, out product);
//int.TryParse(RadComboBox1.SelectedValue, out product);
if (product != 0)
{
PDT_ProductBLL productbll = new PDT_ProductBLL(product, true);
if (productbll.Model == null) return;
if (productbll.Model.ConvertFactor == 0)
{
productbll.Model.ConvertFactor = 1;
productbll.Update();
}
int quantity = 0;
decimal price = 0;
int.TryParse(tbx_Quantity.Text, out quantity);
decimal.TryParse(tbx_Price.Text, out price);
if (ddl_Unit.SelectedValue == "T")
{
//整件单位
quantity = quantity * productbll.Model.ConvertFactor;
price = price / productbll.Model.ConvertFactor;
}
if (quantity == 0)
{
MessageBox.Show(this, "请填写数量!");
return;
}
PBM_OrderDetail d = null;
if (ViewState["SelectedDetail"] != null)
{
d = (PBM_OrderDetail)ViewState["SelectedDetail"];
}
else
{
d = new PBM_OrderDetail();
d.OrderID = (int)ViewState["ID"];
if (Details.GetListItem().Count == 0)
d.ID = 1;
else
d.ID = Details.GetListItem().Max(p => p.ID) + 1;
}
d.Product = product;
d.Price = price; //实际销售价
d.DiscountRate = 1; //默认全价
d.ConvertFactor = productbll.Model.ConvertFactor;
d.BookQuantity = quantity;
d.ConfirmQuantity = quantity;
d.DeliveredQuantity = 0;
d.SalesMode = int.Parse(ddl_SalesMode.SelectedValue);
if (d.SalesMode == 2)
{ d.Price = 0; }
if (ViewState["SelectedDetail"] != null)
{
Details.Update(d);
ViewState["SelectedDetail"] = null;
bt_AddDetail.Text = "新 增";
gv_List.SelectedIndex = -1;
}
else
{
Details.Add(d);
}
tbx_Quantity.Text = "0";
BindGrid();
}
}
示例2: bt_AddDetail_Click
protected void bt_AddDetail_Click(object sender, EventArgs e)
{
if ((int)ViewState["ID"] == 0) return;
PBM_DeliveryBLL _bll = new PBM_DeliveryBLL((int)ViewState["ID"]);
if (ViewState["Details"] == null) return;
ListTable<PBM_DeliveryDetail> Details = (ListTable<PBM_DeliveryDetail>)ViewState["Details"];
int product = 0;
int.TryParse(select_Product.SelectValue, out product);
//int.TryParse(RadComboBox1.SelectedValue, out product);
if (product != 0)
{
PDT_ProductBLL productbll = new PDT_ProductBLL(product, true);
if (productbll.Model == null) return;
if (productbll.Model.ConvertFactor == 0)
{
productbll.Model.ConvertFactor = 1;
productbll.Update();
}
int quantity = 0;
decimal price = 0;
int.TryParse(tbx_Quantity.Text, out quantity);
decimal.TryParse(tbx_Price.Text, out price);
if (ddl_Unit.SelectedValue == "T")
{
//整件单位
quantity = quantity * productbll.Model.ConvertFactor;
price = price / productbll.Model.ConvertFactor;
}
if (quantity == 0)
{
MessageBox.Show(this, "请填写数量!");
return;
}
if ((int)ViewState["Classify"] != 2)
{
#region 销售时判断库存数量是否够退货
int inv_quantity = INV_InventoryBLL.GetProductQuantity((int)ViewState["WareHouse"], product, ddl_LotNumber.SelectedValue);
if (quantity > inv_quantity)
{
MessageBox.Show(this, "库存不足,不可销售出库!");
return;
}
#endregion
}
INV_Inventory inv = INV_InventoryBLL.GetInventoryByProductAndLotNumber((int)ViewState["WareHouse"],
product, ddl_LotNumber.SelectedValue);
if (inv == null)
{
MessageBox.Show(this, "请正确选择销售批号!");
return;
}
PBM_DeliveryDetail d = null;
if (ViewState["SelectedDetail"] != null)
{
d = (PBM_DeliveryDetail)ViewState["SelectedDetail"];
}
else
{
d = new PBM_DeliveryDetail();
d.DeliveryID = (int)ViewState["ID"];
if (Details.GetListItem().Count == 0)
d.ID = 1;
else
d.ID = Details.GetListItem().Max(p => p.ID) + 1;
}
d.Product = product;
d.LotNumber = ddl_LotNumber.SelectedValue;
d.CostPrice = inv.Price; //成本价取当前库存表的价格
d.Price = price; //实际销售价
d.ConvertFactor = productbll.Model.ConvertFactor;
d.DiscountRate = 1; //默认全价
d.DeliveryQuantity = quantity;
d.SignInQuantity = d.DeliveryQuantity;
d.LostQuantity = 0;
d.BadQuantity = 0;
d.SalesMode = 1;
if (d.SalesMode == 2)
{ d.Price = 0; }
if (ViewState["SelectedDetail"] != null)
{
Details.Update(d);
//_bll.UpdateDetail(d);
ViewState["SelectedDetail"] = null;
bt_AddDetail.Text = "新 增";
gv_List.SelectedIndex = -1;
}
else
//.........这里部分代码省略.........
示例3: bt_AddDetail_Click
protected void bt_AddDetail_Click(object sender, EventArgs e)
{
if ((int)ViewState["ID"] == 0) return;
PBM_DeliveryBLL _bll = new PBM_DeliveryBLL((int)ViewState["ID"]);
if (ViewState["Details"] == null) return;
ListTable<PBM_DeliveryDetail> Details = (ListTable<PBM_DeliveryDetail>)ViewState["Details"];
int product = 0;
int.TryParse(select_Product.SelectValue, out product);
//int.TryParse(RadComboBox1.SelectedValue, out product);
if (product != 0)
{
PDT_ProductBLL productbll = new PDT_ProductBLL(product, true);
if (productbll.Model == null) return;
if (productbll.Model.ConvertFactor == 0)
{
productbll.Model.ConvertFactor = 1;
productbll.Update();
}
string lotnumber = "";
int quantity = 0;
decimal price = 0;
DateTime producedate = new DateTime(1900, 1, 1);
int.TryParse(tbx_Quantity.Text, out quantity);
decimal.TryParse(tbx_Price.Text, out price);
DateTime.TryParse(tbx_ProductDate.Text, out producedate);
if (producedate.Year < 1900) producedate = new DateTime(1900, 1, 1);
if (ddl_Unit.SelectedValue == "T")
{
//整件单位
quantity = quantity * productbll.Model.ConvertFactor;
price = price / productbll.Model.ConvertFactor;
}
if (quantity == 0)
{
//MessageBox.Show(this, "请选择采购数量!");
return;
}
lotnumber = rbl_ln.SelectedValue == "N" ? tbx_LotNumber.Text : ddl_LotNumber.SelectedValue;
if (lotnumber == "" && producedate.Year > 1900) lotnumber = producedate.ToString("yyyyMMdd");
if ((int)ViewState["Classify"] == 12)
{
#region 判断库存数量是否够退货
int inv_quantity = INV_InventoryBLL.GetProductQuantity((int)ViewState["WareHouse"], product, lotnumber);
if (quantity > inv_quantity)
{
MessageBox.Show(this, "库存不足,不可采购退货!");
return;
}
#endregion
}
PBM_DeliveryDetail d = null;
if (ViewState["SelectedDetail"] != null)
{
d = (PBM_DeliveryDetail)ViewState["SelectedDetail"];
}
else
{
d = new PBM_DeliveryDetail();
d.DeliveryID = (int)ViewState["ID"];
if (Details.GetListItem().Count == 0)
d.ID = 1;
else
d.ID = Details.GetListItem().Max(p => p.ID) + 1;
}
decimal discountrate = 100;
decimal.TryParse(tbx_DiscountRate.Text, out discountrate);
d.Product = product;
d.LotNumber = lotnumber;
d.ProductDate = producedate.Year < 1900 ? new DateTime(1900, 1, 1) : producedate;
d.CostPrice = price;
d.Price = d.CostPrice;
d.DiscountRate = discountrate / 100; //默认100为全价
d.ConvertFactor = productbll.Model.ConvertFactor;
d.DeliveryQuantity = quantity;
d.SignInQuantity = d.DeliveryQuantity;
d.LostQuantity = 0;
d.BadQuantity = 0;
d.SalesMode = int.Parse(ddl_SalesMode.SelectedValue);
if (d.SalesMode == 2) { d.Price = 0; } //赠送模式采购价自动设为0
if (ViewState["SelectedDetail"] != null)
{
Details.Update(d);
ViewState["SelectedDetail"] = null;
bt_AddDetail.Text = "新 增";
gv_List.SelectedIndex = -1;
}
//.........这里部分代码省略.........