protected void btn_Save_Click(object sender, EventArgs e) { int companyid = Convert.ToInt32(drp_company.SelectedValue); OrderEntity od = new OrderEntity(); od.Amount = Math.Round(Convert.ToDecimal(hd_TotalAmount.Value),2, MidpointRounding.AwayFromZero); //支付总价 od.CompanyId = companyid; //采购商ID od.StandardAmount = od.Amount; //汇总总价 od.CustomerId = logic.sysAdmin.AdminID; //用户ID,电话订单就代表录入者ID od.FireightFee = Convert.ToDecimal(txt_fireightFee.Value); //运费 od.Note = txt_Note.Text; //备注 od.OrderNo = ""; //传空值,存储过程自动得到订单编号 od.Source = "3"; //订单来源:1、网站订单;2、电话订单;3.补单 od.Taxfee = Convert.ToDecimal(txt_taxfee.Value); //税费 od.Status = "4"; //订单状态:“1”:已提交;“2”备货中;“3”已发货;“4”交易成功;“5”交易关闭; od.ReceiveDt = Convert.ToDateTime(DateTime.Now.AddDays(1).ToShortDateString()).AddHours(Convert.ToInt32(ddl_receiveTime.SelectedValue)); //收货时间 string[] splitstr = { "," }; string[] str_vpros = hd_proScope.Value.Split(splitstr, StringSplitOptions.RemoveEmptyEntries); od.TypeCount = str_vpros.Length / 6; int orderid = logic.order.insert(od); // businessNature string businessNature = logic.company.getById(companyid).BusinessNature; logic.order.updateStatusDate(orderid,od.ReceiveDt); //修改订单状态时间为订单配送时间 for (int i = 0; i < str_vpros.Length; i += 6) { int proid = Convert.ToInt32(str_vpros[i]); //商品ID OrderItemEntity _oritem = new OrderItemEntity(); _oritem.CustomerId = logic.sysAdmin.AdminID; _oritem.ProductId = proid; _oritem.BusinessNature = businessNature; decimal sellerPrice = Convert.ToDecimal(str_vpros[i + 2]); //decimal price = logic.product.getBuyerPrice(Convert.ToInt32(drp_company.SelectedValue), sellerPrice, proid); decimal price = Convert.ToDecimal(str_vpros[i + 5]); _oritem.Price = price; //商品价格 _oritem.Quantity = Convert.ToDecimal(str_vpros[i + 3]); //数量 _oritem.InitQuantity = Convert.ToDecimal(str_vpros[i + 3]); //实际数量 _oritem.Note = str_vpros[i + 4] == "0" ? "" : str_vpros[i + 4]; //备注 _oritem.OrderId = orderid; ProductEntity pro = logic.product.getById(proid); _oritem.SellerId = 43; //供应商ID _oritem.SellerPrice = sellerPrice; //供应价格 _oritem.Unit = pro.Unit; //单位 logic.orderItem.insert(_oritem); } Library.Script.ClientMsgUrl("订单保存成功!", "orderList.aspx"); }
// 生成订单数据 protected void btn_Save_Click(object sender, EventArgs e) { int companyid = Convert.ToInt32(drp_company.SelectedValue); OrderEntity od = new OrderEntity(); od.Amount = Convert.ToDecimal(hd_TotalAmount.Value); //支付总价 od.CompanyId = companyid; //采购商ID od.StandardAmount = od.Amount; //汇总总价 od.CustomerId = logic.sysAdmin.AdminID; //用户ID,电话订单就代表录入者ID od.FireightFee = Convert.ToDecimal(txt_fireightFee.Value); //运费 od.Note = txt_Note.Text; //备注 od.OrderNo = ""; //传空值,存储过程自动得到订单编号 od.Source = "2"; //订单来源:1、网站订单;2、电话订单 od.Taxfee = Convert.ToDecimal(txt_taxfee.Value); //税费 od.Status = "1"; //订单状态:“1”:已提交;“2”备货中;“3”已发货;“4”交易成功;“5”交易关闭; //string time = ddl_receiveTime.SelectedValue.Substring(ddl_receiveTime.SelectedValue.IndexOf("-") + 1, ddl_receiveTime.SelectedValue.Length - (ddl_receiveTime.SelectedValue.IndexOf("-") + 1)); //od.ReceiveDt = Convert.ToDateTime(ext_receiveDt.Value).AddHours(Convert.ToInt32(time.Substring(0,time.IndexOf(":")))); //收货时间 string timeRange = ddl_receiveTime.SelectedItem.Text; int hour = Convert.ToInt32(timeRange.Substring(timeRange.IndexOf("-") + 1, timeRange.Length - (timeRange.IndexOf("-") + 4))); od.ReceiveDt = Convert.ToDateTime(ext_receiveDt.Value).AddHours(hour); //收货时间 string[] splitstr = { "," }; string[] str_vpros = hd_proScope.Value.Split(splitstr, StringSplitOptions.RemoveEmptyEntries); od.TypeCount = str_vpros.Length / 5; int orderid = logic.order.insert(od); for (int i = 0; i < str_vpros.Length; i += 5) { int proid = Convert.ToInt32(str_vpros[i]); //商品ID OrderItemEntity _oritem = new OrderItemEntity(); _oritem.CustomerId = logic.sysAdmin.AdminID; _oritem.ProductId = proid; _oritem.Price = Convert.ToDecimal(str_vpros[i + 2]); //商品价格 _oritem.Quantity = Convert.ToDecimal(str_vpros[i + 3]); //数量 _oritem.InitQuantity = Convert.ToDecimal(str_vpros[i + 3]); //实际数量 _oritem.Note = str_vpros[i + 4] == "0" ? "" : str_vpros[i + 4]; //备注 _oritem.OrderId = orderid; PriceEntity pr = logic.price.getByProduct(proid,companyid); _oritem.SellerId = pr.CompanyId; //供应商ID _oritem.SellerPrice = pr.SellerPrice; //供应价格 _oritem.Unit = pr.Unit; //单位 logic.orderItem.insert(_oritem); } Library.Script.ClientMsgUrl("订单保存成功!", "orderList.aspx"); }
protected void btn_Save_Click(object sender, EventArgs e) { OrderEntity Dynamicorder = logic.order.getDynamicById(id); StringBuilder where = new StringBuilder(); where.Append("1=1"); where.AppendFormat(" AND orderId={0}", id); DataSet ds = logic.order.selectDynamicOrderItem(where.ToString(), "productId desc", AspNetPager1.PageSize, AspNetPager1.CurrentPageIndex); DataTable dt = ds.Tables[1]; int errorno = 0; decimal amount = 0; for (int i = 0; i < dt.Rows.Count; i++) { if (dt.Rows[i]["nowprice"].ToString() != "") { amount = amount + Convert.ToDecimal(Convert.ToDouble(dt.Rows[i]["nowprice"].ToString()) * Convert.ToDouble(dt.Rows[i]["quantity"].ToString())); } else { errorno++; logic.orderItem.updateDynamicOrderItem(Convert.ToInt32(dt.Rows[i]["orderId"].ToString()), Convert.ToInt32(dt.Rows[i]["productId"].ToString()), dt.Rows[i]["businessnature"].ToString()); } } OrderEntity order = Dynamicorder; order.Amount = Math.Round(amount,2, MidpointRounding.AwayFromZero); order.StandardAmount = order.Amount; order.OrderNo = ""; order.Status = "1"; int OrderId = logic.order.insertWithDynamicOrder(order); string OrderNo = logic.order.getById(OrderId).OrderNo; int adminId = logic.sysAdmin.AdminID; logic.order.updateDynamicOrder(id, OrderNo, adminId); for (int i = 0; i < dt.Rows.Count; i++) { if (dt.Rows[i]["nowprice"].ToString() != "") { OrderItemEntity oi = new OrderItemEntity(); oi = new OrderItemEntity(); oi.CustomerId = Convert.ToInt32(dt.Rows[i]["customerId"].ToString()); oi.SellerId = Convert.ToInt32(dt.Rows[i]["sellerId"].ToString()); oi.ProductId = Convert.ToInt32(dt.Rows[i]["productId"].ToString()); oi.Price = Convert.ToDecimal(dt.Rows[i]["nowprice"].ToString()); oi.SellerPrice = Convert.ToDecimal(dt.Rows[i]["sellerPrice"].ToString()); oi.Unit = dt.Rows[i]["unit"].ToString(); oi.Quantity = Convert.ToDecimal(dt.Rows[i]["quantity"].ToString()); oi.Note = dt.Rows[i]["note"].ToString(); oi.OrderId = OrderId; oi.InitQuantity = oi.Quantity; oi.BusinessNature = dt.Rows[i]["businessNature"].ToString(); logic.orderItem.insert(oi); } } Response.Redirect("DynamicOrderList.aspx"); }
//添加商品 protected void lbn_AddOrderItem_Click(object sender, EventArgs e) { for (int i = 0; i < rpt_Products.Items.Count; i++) //循环Repeater { RepeaterItem row = rpt_Products.Items[i]; HiddenField hidproId = row.FindControl("hid_productId") as HiddenField; Label lblproName = row.FindControl("lbl_proName") as Label; TextBox lblsellerPrice = row.FindControl("txt_Price") as TextBox; //供应价 TextBox txtBuyPrice = row.FindControl("txt_BuyPrice") as TextBox; //购买价格 TextBox txtQuantity = row.FindControl("txtQuantity") as TextBox; TextBox txtnote = row.FindControl("txtNote") as TextBox; TextBox txtUnit = row.FindControl("lbl_unit") as TextBox; CheckBox cbxSelect = row.FindControl("cbx_isSelect") as CheckBox; if (cbxSelect.Checked) //找到选择的商品加入数据库 { OrderItemEntity oi = new OrderItemEntity(); oi.CustomerId = Convert.ToInt32(hd_customerid.Value); oi.Note = txtnote.Text; ; oi.OrderId = Convert.ToInt32(hd_orderid.Value); oi.Price = Convert.ToDecimal(txtBuyPrice.Text); oi.ProductId = Convert.ToInt32(hidproId.Value); oi.Quantity = Convert.ToDecimal(txtQuantity.Text); oi.InitQuantity = oi.Quantity; oi.SellerId = 146; oi.SellerPrice = Convert.ToDecimal(lblsellerPrice.Text.Trim()); oi.Unit = logic.product.getById(oi.ProductId).Unit; logic.orderItem.update(oi); } } int orderid = Convert.ToInt32(hd_orderid.Value); rptBind(); getDetails(orderid); }
public static void insertDynamicOrderItem(OrderItemEntity _orderItem) { OrderItem.insertDynamicOrderItem(_orderItem); }
protected void lbn_AddOrderItem_Click(object sender, EventArgs e) { for (int i = 0; i < rpt_Products.Items.Count; i++) //循环Repeater { RepeaterItem row = rpt_Products.Items[i]; HiddenField hidproId = row.FindControl("hid_productId") as HiddenField; HiddenField hidsellerId = row.FindControl("hid_sellerId") as HiddenField; HiddenField hidsellerPrice = row.FindControl("hid_sellerPrice") as HiddenField; Label lblprice = row.FindControl("lbl_price") as Label; HiddenField lblnature = row.FindControl("hidNature") as HiddenField; TextBox txtQuantity = row.FindControl("txtQuantity") as TextBox; TextBox txtnote = row.FindControl("txtNote") as TextBox; CheckBox cbxUser = row.FindControl("cbx_isUser") as CheckBox; if (cbxUser.Checked) //找到选择的商品加入数据库 { OrderItemEntity oi = new OrderItemEntity(); oi.CustomerId = logic.order.getDynamicById(id).CustomerId; oi.Note = txtnote.Text; ; oi.OrderId = id; oi.Price = Convert.ToDecimal(lblprice.Text); oi.ProductId = Convert.ToInt32(hidproId.Value); oi.Quantity = Convert.ToDecimal(txtQuantity.Text); oi.InitQuantity = oi.Quantity; oi.BusinessNature = lblnature.Value; PriceEntity pr = logic.price.getByProduct(oi.ProductId, lblnature.Value); oi.SellerId = pr.CompanyId; oi.SellerPrice = pr.SellerPrice; oi.Unit = pr.Unit; logic.orderItem.insertDynamicOrderItem(oi); } } logic.order.updateDynamiceOrderByOrderId(id, logic.sysAdmin.AdminID); rptBind(); getDetails(id); rtpDobind(id); dynamicorder_details.Show(); }
public static void insert(OrderItemEntity _orderItem) { OrderItem.insert(_orderItem); }
public static void update(OrderItemEntity _orderItem) { OrderItem.update(_orderItem); }
// 固定报价商品添加 protected void lbn_AddWeeklyOrderItem_Click(object sender,EventArgs e) { TextBox txtNote = null; TextBox txtQuantity = null; HiddenField hid_bpid = null; Label lbl_price = null; Label lbl_unit = null; foreach (RepeaterItem item in rpt_WeeklyProducts.Items) { if (item.ItemType== ListItemType.AlternatingItem || item.ItemType== ListItemType.Item) { CheckBox chk = item.FindControl("cbx_isSelect") as CheckBox; if (chk!=null && chk.Checked) { txtNote = item.FindControl("txtNote") as TextBox; txtQuantity = item.FindControl("txtQuantity") as TextBox; hid_bpid = item.FindControl("hid_bpid") as HiddenField; lbl_price = item.FindControl("lbl_price") as Label; lbl_unit = item.FindControl("lbl_unit") as Label; OrderItemEntity oi = new OrderItemEntity(); oi.CustomerId = Convert.ToInt32(hd_customerid.Value); oi.Note = txtNote.Text; oi.OrderId = Convert.ToInt32(hd_orderid.Value); oi.Price = Convert.ToDecimal(lbl_price.Text); oi.Quantity = Convert.ToDecimal(txtQuantity.Text); oi.InitQuantity = oi.Quantity; oi.BusinessNature = chk.Attributes["businessNature"]; BuyerFixedPricePeriodItemEntity bfpEnt = logic.buyerFixedPricePeriodItem.getBybpId(Convert.ToInt32(hid_bpid.Value)); oi.ProductId = bfpEnt.ProductId; oi.SellerId = bfpEnt.SellerId; oi.SellerPrice = bfpEnt.SellerPrice; oi.Unit = lbl_unit.Text.Trim(); logic.orderItem.update(oi); } } } int orderid = Convert.ToInt32(hd_orderid.Value); rptBind(); getDetails(orderid); }
//添加商品 protected void lbn_AddOrderItem_Click(object sender, EventArgs e) { foreach (RepeaterItem row in rpt_Products.Items) { if (row.ItemType == ListItemType.AlternatingItem || row.ItemType == ListItemType.Item) { CheckBox cbxUser = row.FindControl("cbx_isUser") as CheckBox; TextBox txtQuantity = row.FindControl("txtQuantity") as TextBox; TextBox txtnote = row.FindControl("txtNote") as TextBox; if (cbxUser.Checked) { OrderItemEntity oi = new OrderItemEntity(); oi.CustomerId = Convert.ToInt32(hd_customerid.Value); oi.Note = txtnote.Text; oi.OrderId = Convert.ToInt32(hd_orderid.Value); oi.Price = Convert.ToDecimal(cbxUser.Attributes["price"]); oi.ProductId = Convert.ToInt32(cbxUser.Attributes["productId"]); oi.Quantity = Convert.ToDecimal(txtQuantity.Text); oi.InitQuantity = oi.Quantity; oi.BusinessNature = cbxUser.Attributes["businessNature"]; PriceEntity pr = logic.price.getByProduct(oi.ProductId, oi.BusinessNature); oi.SellerId = pr.CompanyId; oi.SellerPrice = pr.SellerPrice; oi.Unit = pr.Unit; logic.orderItem.update(oi); } } } int orderid = Convert.ToInt32(hd_orderid.Value); rptBind(); getDetails(orderid); }
//添加商品 protected void lbn_AddOrderItem_Click(object sender, EventArgs e) { int companyId = 0; int.TryParse(hd_companyid.Value, out companyId); // businessNature string businessNature = "1"; DAL.CompanyEntity companyEntity = logic.company.getById(companyId); if (companyEntity!=null) { businessNature = companyEntity.BusinessNature; } for (int i = 0; i < rpt_Products.Items.Count; i++) //循环Repeater { RepeaterItem row = rpt_Products.Items[i]; HiddenField hidproId = row.FindControl("hid_productId") as HiddenField; Label lblproName = row.FindControl("lbl_proName") as Label; TextBox lblsellerPrice = row.FindControl("txt_Price") as TextBox; //供应价 TextBox txtBuyPrice = row.FindControl("txt_BuyPrice") as TextBox; //购买价格 TextBox txtQuantity = row.FindControl("txtQuantity") as TextBox; TextBox txtnote = row.FindControl("txtNote") as TextBox; TextBox txtUnit = row.FindControl("lbl_unit") as TextBox; CheckBox cbxSelect = row.FindControl("cbx_isSelect") as CheckBox; DropDownList ddl = row.FindControl("ddl") as DropDownList; if (cbxSelect.Checked) //找到选择的商品加入数据库 { OrderItemEntity oi = new OrderItemEntity(); oi.CustomerId = Convert.ToInt32(hd_customerid.Value); oi.Note = txtnote.Text; ; oi.OrderId = Convert.ToInt32(hd_orderid.Value); oi.Price = Convert.ToDecimal(txtBuyPrice.Text); oi.ProductId = Convert.ToInt32(hidproId.Value); oi.Quantity = Convert.ToDecimal(txtQuantity.Text); oi.InitQuantity = oi.Quantity; int sellerid = Convert.ToInt32(ddl.SelectedValue); oi.SellerId = sellerid; oi.SellerPrice = Convert.ToDecimal(lblsellerPrice.Text.Trim()); oi.Unit = logic.product.getById(oi.ProductId).Unit; oi.BusinessNature = businessNature; logic.orderItem.update(oi); } } int orderid = Convert.ToInt32(hd_orderid.Value); rptBind(); getDetails(orderid); }