//修改订单信息和订单细目中的商品数量 protected void btn_Save_Click(object sender, EventArgs e) { int orderid = Convert.ToInt32(hd_orderid.Value); OrderEntity _order = new OrderEntity(); _order.Orderid = orderid; _order.StandardAmount = Math.Round(Convert.ToDecimal(lbl_StandardAmount.Text),2, MidpointRounding.AwayFromZero); //汇总总价 _order.Amount = Convert.ToDecimal(lbl_StandardAmount.Text); _order.FireightFee = 0; _order.Taxfee = 0; _order.Status = ddl_Status.SelectedValue; //订单状态 _order.ServiceNote = txt_serviceNote.Text; //客服备注 string timeRange = ddl_receiveTime.SelectedItem.Text; int hour = Convert.ToInt32(timeRange.Substring(timeRange.IndexOf("-") + 1, timeRange.Length - (timeRange.IndexOf("-") + 4))); _order.ReceiveDt = Convert.ToDateTime(ext_receiveDt.Value).AddHours(hour); //收货时间 _order.CloseReason = txt_closeReason.Text; //交易关闭 _order.AdminId = logic.sysAdmin.AdminID; //操作者ID for (int i = 0; i < rpt_OrderItems.Items.Count; i++) //修改商品细目表 { RepeaterItem row = rpt_OrderItems.Items[i]; HiddenField hid = row.FindControl("hid_oiId") as HiddenField; TextBox txt = row.FindControl("txtQuantity") as TextBox; TextBox txtNote = row.FindControl("txtCustomerNote") as TextBox; int oiid = Convert.ToInt32(hid.Value); decimal quantity = Convert.ToDecimal(txt.Text); logic.orderItem.updateQuantity(oiid, quantity, txtNote.Text); //根据细目ID 和 商品数量 修改 } logic.order.update(_order); Library.Script.ClientMsg("修改成功!"); rptBind(); //getDetails(orderid); }
public static OrderEntity getById(int orderid) { DataRow dr = DbHelper.ExecuteDataRow("p_Order_getById", orderid); OrderEntity _order = new OrderEntity(); if (dr != null) { _order.Orderid = orderid; _order.Source = dr["Source"].ToString(); _order.OrderNo = dr["OrderNo"].ToString(); _order.CustomerId =Convert.ToInt32( dr["CustomerId"]); _order.Amount = Convert.ToDecimal(dr["Amount"]); _order.StandardAmount = Convert.ToDecimal(dr["StandardAmount"]); _order.TypeCount = Convert.ToInt32(dr["typecount"]); _order.FireightFee = Convert.ToDecimal(dr["FireightFee"]); _order.Taxfee = Convert.ToDecimal(dr["Taxfee"]); _order.Status = dr["Status"].ToString(); _order.Note = dr["Note"].ToString(); _order.ServiceNote = dr["ServiceNote"].ToString(); _order.OrderDt=Convert.ToDateTime(dr["OrderDt"]); _order.ReceiveDt = Convert.ToDateTime(dr["ReceiveDt"]); if (dr["UpdateStatusdt"] != DBNull.Value) _order.UpdateStatusdt=Convert.ToDateTime(dr["UpdateStatusdt"]); _order.CloseReason =dr["CloseReason"].ToString(); _order.RbNo=dr["RbNo"].ToString(); if (dr["AdminId"] != DBNull.Value) _order.AdminId=Convert.ToInt32(dr["AdminId"]); _order.CompanyId=Convert.ToInt32(dr["CompanyId"]); } return _order; }
/// <summary> /// 提交周价订单 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btn_Save_Click(object sender, EventArgs e) { // 日志记录 log4net.ILog logger = log4net.LogManager.GetLogger("ApplicationFileAppender");//读取log4net的配置文件 logger.Info("周价订单信息:" + hd_proScope.Value); // 订单细目 List<OrderItemEntity> orderItems = JsonConvert.DeserializeObject<List<OrderItemEntity>>(hd_proScope.Value); if (orderItems.Count > 0) { // 计算订单总价 decimal serverTotalAmount = 0m; orderItems.ForEach(x => serverTotalAmount += x.Quantity * x.Price); serverTotalAmount = Math.Round(serverTotalAmount,2, MidpointRounding.AwayFromZero); decimal clientHotalAmount = 0m; decimal.TryParse(hd_TotalAmount.Value, out clientHotalAmount); int companyid = Convert.ToInt32(drp_company.SelectedValue); OrderEntity od = new OrderEntity(); od.Amount = serverTotalAmount; od.CompanyId = companyid; od.StandardAmount = od.Amount; od.CustomerId = logic.sysAdmin.AdminID; od.FireightFee = Convert.ToDecimal(txt_fireightFee.Value); od.Note = txt_Note.Text; od.OrderNo = ""; od.Source = "4"; //订单来源:1、网站订单;2、电话订单;3.补单;4、周价补单 od.Taxfee = Convert.ToDecimal(txt_taxfee.Value); od.Status = "1"; od.ReceiveDt = Convert.ToDateTime(DateTime.Now.AddDays(1).ToShortDateString()).AddHours(Convert.ToInt32(ddl_receiveTime.SelectedValue)); od.TypeCount = orderItems.Count; int orderid = logic.order.insert(od); // businessNature string businessNature = logic.company.getById(companyid).BusinessNature; foreach (OrderItemEntity orderItem in orderItems) { orderItem.CustomerId = logic.sysAdmin.AdminID; orderItem.OrderId = orderid; orderItem.InitQuantity = orderItem.Quantity; orderItem.BusinessNature = businessNature; logic.orderItem.insert(orderItem); } Library.Script.ClientMsgUrl("订单保存成功!", "sennightOrderList.aspx"); } else { Library.Script.ClientMsg("订单数据无效!"); return; } }
protected void btn_UpdateStatus_Click(object sender, EventArgs e) { int orderid = Convert.ToInt32(hd_orderid.Value); OrderEntity _order = new OrderEntity(); _order.Orderid = orderid; _order.Status = ddl_Status.SelectedValue; logic.order.updateStatus(_order); Library.Script.ClientMsg("修改状态成功!"); rptBind(); }
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"); }
public static OrderEntity getByDynamicOrderId(int orderid) { DataRow dr = DbHelper.ExecuteDataRow("p_DynamicOrder_getById", orderid); OrderEntity _order = new OrderEntity(); if (dr != null) { _order.Orderid = orderid; _order.Amount = Convert.ToDecimal(dr["amount"]); _order.Status = dr["status"].ToString(); _order.StatusName = dr["orderStatus"].ToString(); _order.Note = dr["note"].ToString(); _order.ReceiveDt = Convert.ToDateTime(dr["receiveDt"].ToString()); _order.CompanyId = Convert.ToInt32(dr["companyid"].ToString()); } return _order; }
// 生成订单数据 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"); }
public static OrderEntity getDynamicById(int orderid) { DataRow dr = DbHelper.ExecuteDataRow("p_DynamicOrder_selectByOrderId", orderid); OrderEntity order = new OrderEntity(); if (dr != null) { order.Source = dr["Source"].ToString(); order.CustomerId = Convert.ToInt32(dr["CustomerId"]); order.TypeCount = Convert.ToInt32(dr["typecount"]); order.FireightFee = Convert.ToDecimal(dr["FireightFee"]); order.Taxfee = Convert.ToDecimal(dr["Taxfee"]); order.Note = dr["Note"].ToString(); order.ServiceNote = dr["ServiceNote"].ToString(); order.OrderDt = Convert.ToDateTime(dr["OrderDt"]); order.ReceiveDt = Convert.ToDateTime(dr["ReceiveDt"]); order.CloseReason = dr["CloseReason"].ToString(); order.RbNo = dr["RbNo"].ToString(); order.CompanyId = Convert.ToInt32(dr["CompanyId"]); } return order; }
public static int insertWithDynamicOrder(OrderEntity order) { return Convert.ToInt32(DbHelper.ExecuteScalar("p_Order_insertWithDynamicOrder", order.Source, order.OrderNo, order.CustomerId, order.Amount, order.StandardAmount, order.TypeCount, order.FireightFee, order.Taxfee, order.Status, order.Note, order.OrderDt, order.ReceiveDt, order.CompanyId )); }
protected void lbtn_Submit_Click(object sender, EventArgs e) { try { List<DAL.OrderItemEntity> listPro = JsonConvert.DeserializeObject<List<DAL.OrderItemEntity>>(this.hd_loadval.Value); //得到商品的细目 if (listPro.Count > 0) { int userid = logic.customer.userId; int companyid = logic.customer.companyId; OrderEntity od = new OrderEntity(); //od.Amount = Convert.ToDecimal(hd_amount.Value); decimal totalAmount = 0m; listPro.ForEach(item => totalAmount += item.Price * item.Quantity); od.Amount = Math.Round(totalAmount, 2, MidpointRounding.AwayFromZero);//默认为MidpointRounding.ToEven(银行家舍入)算法,四舍六入五取偶 //if (!string.IsNullOrEmpty(ddlMutilCompany.SelectedValue)) //{ // od.CompanyId = Convert.ToInt32(ddlMutilCompany.SelectedValue); //} //else //{ // od.CompanyId = companyid; //} od.CompanyId = companyid; od.StandardAmount = od.Amount; od.CustomerId = userid; od.FireightFee = Convert.ToDecimal(0); //运费 od.Note = txt_orderNote.Value; od.OrderNo = ""; //传空值,存储过程自动得到订单编号 od.Source = "1"; od.Taxfee = Convert.ToDecimal(0); //发票 od.Status = "1"; //订单状态:“1”:已提交;“2”备货中;“3”已发货;“4”交易成功;“5”交易关闭;"6" 未生成 string hour = hd_psTime.Value; string time = hour.Substring(hour.IndexOf("-") + 1, hour.Length - (hour.IndexOf("-") + 1)); od.ReceiveDt = Convert.ToDateTime(ddl_receiveDt.SelectedValue + " " + time); //收货时间 od.TypeCount = listPro.Count; TimeSpan dt = Convert.ToDateTime(ddl_receiveDt.SelectedValue)-DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")); int day = dt.Days; bool ctype = hd_companyType.Value == "1" ? true : false; if (day > 1 && ctype == false) //配送日期大于一,并且企业类型不为一周报价企业 { od.Status = "6"; int orderId = logic.order.insertDynamicOrder(od); try { foreach (DAL.OrderItemEntity oi in listPro) { if (oi.SellerId == 0 && oi.SellerPrice == 0) { log4net.ILog logger = log4net.LogManager.GetLogger("ApplicationFileAppender"); logger.Info(string.Format("数据丢失:{0}", hd_SelPros.Value)); PriceEntity pr = logic.price.getByProduct(oi.ProductId, oi.BusinessNature); oi.SellerId = pr.CompanyId; oi.SellerPrice = pr.SellerPrice; } oi.CustomerId = userid; oi.InitQuantity = oi.Quantity; oi.OrderId = orderId; logic.orderItem.insertDynamicOrderItem(oi); } } catch(Exception ex) { #region 日志跟踪 if (System.Configuration.ConfigurationManager.AppSettings["EnabledErrorReport"] == "1") { log4net.ILog logger = log4net.LogManager.GetLogger("ApplicationFileAppender");//读取log4net的配置文件 logger.Info(string.Format("错误详细信息:{0},商品信息:{1}", ex.StackTrace, hd_SelPros.Value)); ScriptManager.RegisterStartupScript(this, this.GetType(), "keyToS", "alert('订单数据失效,请联系客服!');", true); } #endregion } hd_orderid.Value = orderId.ToString(); lbl_orderno.Text = "(临时订单号)" + orderId.ToString(); ScriptManager.RegisterStartupScript(this, this.GetType(), "key", "orderSuccess();", true); } else { int orderid = logic.order.insert(od); try { foreach (DAL.OrderItemEntity oi in listPro) { if (oi.SellerId == 0 && oi.SellerPrice == 0) { log4net.ILog logger = log4net.LogManager.GetLogger("ApplicationFileAppender");//读取log4net的配置文件 logger.Info(string.Format("数据丢失:{0}", hd_SelPros.Value)); PriceEntity pr = logic.price.getByProduct(oi.ProductId, oi.BusinessNature); oi.SellerId = pr.CompanyId; oi.SellerPrice = pr.SellerPrice; } oi.CustomerId = userid; oi.InitQuantity = oi.Quantity; oi.OrderId = orderid; logic.orderItem.insert(oi); } } catch (Exception ex) { #region 日志跟踪 if (System.Configuration.ConfigurationManager.AppSettings["EnabledErrorReport"] == "1") { log4net.ILog logger = log4net.LogManager.GetLogger("ApplicationFileAppender");//读取log4net的配置文件 logger.Info(string.Format("错误详细信息:{0},商品信息:{1}", ex.StackTrace, hd_SelPros.Value)); ScriptManager.RegisterStartupScript(this, this.GetType(), "keyToS", "alert('订单数据失效,请联系客服!');", true); } #endregion } hd_orderid.Value = orderid.ToString(); lbl_orderno.Text = logic.order.getById(orderid).OrderNo; ScriptManager.RegisterStartupScript(this, this.GetType(), "key", "orderSuccess();", true); } } else { } } catch { ScriptManager.RegisterStartupScript(this, this.GetType(), "skey", "alert('订单数据失效,请联系客服!');", true); return; } }
public static void updateDynamicOrderByService(OrderEntity order) { DbHelper.ExecuteNonQuery("p_DynamicOrder_updateByService", order.Orderid, order.ReceiveDt, order.ServiceNote); }
public static void update(OrderEntity _order) { DbHelper.ExecuteNonQuery("p_Order_update",_order.Orderid,_order.Amount,_order.FireightFee,_order.Taxfee, _order.Status,_order.ServiceNote,_order.ReceiveDt,_order.CloseReason,_order.AdminId,_order.CompanyId); }
protected void btn_UpdateOrder_Click(object sender, EventArgs e) { TimeSpan ts = Convert.ToDateTime(ext_receiveDt.Value) - Convert.ToDateTime(DateTime.Now.ToShortDateString()); int day = ts.Days; if (day>0) { OrderEntity _order = new OrderEntity(); _order.Orderid = id; _order.ServiceNote = txt_serviceNote.Text; string timeRange = ddl_receiveTime.SelectedItem.Text; int hour = Convert.ToInt32(timeRange.Substring(timeRange.IndexOf("-") + 1, timeRange.Length - (timeRange.IndexOf("-") + 4))); _order.ReceiveDt = Convert.ToDateTime(ext_receiveDt.Value).AddHours(hour); _order.AdminId = logic.sysAdmin.AdminID; logic.order.updateDynamicOrderByService(_order); logic.order.updateDynamiceOrderByOrderId(id, _order.AdminId); if (day >= 2) { Library.Script.ClientMsg("修改成功!"); } else { Library.Script.ClientMsg("您选择的时间为明天,请点击“生成正式订单”按钮生成正式订单!"); btn_Save.Visible = true; } //Coolite.Ext.Web.Ext.Msg.Alert("提示", "修改成功!"); rptBind(); getDetails(id); rtpDobind(id); dynamicorder_details.Show(); } else { Library.Script.ClientMsg("收货时间必须在明天以后(包括明天)!"); rptBind(); getDetails(id); rtpDobind(id); dynamicorder_details.Show(); } }
protected void btn_Save_Click(object sender, EventArgs e) { DateTime start=Convert.ToDateTime(ViewState["start"]); DateTime end =Convert.ToDateTime(ViewState["end"]); int companyId = Convert.ToInt32(drp_company.SelectedValue); bool isfpPrice = logic.company.getById(companyId).EnabledWeeklyPrice; //收货日期在价格周期中添加订单,否则日期选错,商品重新添加 if ( isfpPrice==true) { if (ext_receiveDt.SelectedDate <= start || ext_receiveDt.SelectedDate >= end) { Library.Script.ClientMsg("对不起,此收货日期的商品价格不对,你确认【收货日期】是否正确,确认收货日期之后再重新添加商品!"); return; } } // 日志记录 log4net.ILog logger = log4net.LogManager.GetLogger("ApplicationFileAppender");//读取log4net的配置文件 logger.Info("电话订单信息:" + hd_proScope.Value); // 订单细目 List<OrderItemEntity> orderItems = JsonConvert.DeserializeObject<List<OrderItemEntity>>(hd_proScope.Value); if (orderItems.Count > 0) { // 计算订单总价 decimal serverTotalAmount = 0m; orderItems.ForEach(x => serverTotalAmount += x.Quantity * x.Price); serverTotalAmount = Math.Round(serverTotalAmount, 2, MidpointRounding.AwayFromZero); int companyid = Convert.ToInt32(drp_company.SelectedValue); OrderEntity od = new OrderEntity(); od.Amount = serverTotalAmount; //支付总价 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); //收货时间 od.TypeCount = orderItems.Count; TimeSpan ts = Convert.ToDateTime(ext_receiveDt.SelectedDate.ToShortDateString()) - DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")); int day = ts.Days; if (day > 1 && isfpPrice == false) { od.Status = "6"; int orderid = logic.order.insertDynamicOrder(od); foreach (OrderItemEntity orderItem in orderItems) { orderItem.CustomerId = logic.sysAdmin.AdminID; orderItem.OrderId = orderid; orderItem.InitQuantity = orderItem.Quantity; PriceEntity pr = logic.price.getByProduct(orderItem.ProductId, orderItem.BusinessNature); orderItem.SellerId = pr.CompanyId; //供应商ID orderItem.SellerPrice = pr.SellerPrice; //供应价格 logic.orderItem.insertDynamicOrderItem(orderItem); } } else { int orderid = logic.order.insert(od); foreach (OrderItemEntity orderItem in orderItems) { orderItem.CustomerId = logic.sysAdmin.AdminID; orderItem.OrderId = orderid; orderItem.InitQuantity = orderItem.Quantity; PriceEntity pr = logic.price.getByProduct(orderItem.ProductId, orderItem.BusinessNature); orderItem.SellerId = pr.CompanyId; //供应商ID orderItem.SellerPrice = pr.SellerPrice; //供应价格 logic.orderItem.insert(orderItem); } } Library.Script.ClientMsgUrl("订单保存成功!", "orderList.aspx"); } else { Library.Script.ClientMsg("订单数据无效!"); return; } }
//修改订单信息和订单细目中的商品数量 protected void btn_Save_Click(object sender, EventArgs e) { int orderid = Convert.ToInt32(hd_orderid.Value); OrderEntity orderEnt = logic.order.getById(orderid); //如果是固定价格采购商的订单,判断收货日期 if (logic.company.getById(orderEnt.CompanyId).EnabledWeeklyPrice) { //订单中的收货日期是否正确(不能超过当前周期,如果超过当前周期则商品价格不一样,需要重下订单!) if (!logic.buyerFixedPricePeriod.isValidReceiveDt(orderid, ext_receiveDt.SelectedDate)) { Library.Script.ClientMsg("对不起,收货日期不在当前周期内,请重新选择!"); return; } } if (ddl_Status.SelectedValue == "4" || ddl_Status.SelectedValue == "3") { if (logic.orderItem.isNotquoted(orderid)) { Library.Script.ClientMsg("对不起,该订单中有时价商品还未报价,不能提交订单!"); return; } } OrderEntity _order = new OrderEntity(); if (!string.IsNullOrEmpty(ddlCompanyGroup.SelectedValue)) { _order.CompanyId = Convert.ToInt32(ddlCompanyGroup.SelectedValue); } else { _order.CompanyId = Convert.ToInt32(hd_companyid.Value); } _order.Orderid = orderid; decimal standardAmount = 0m; decimal.TryParse(lbl_StandardAmount.Text,out standardAmount); _order.StandardAmount = Math.Round(standardAmount,2, MidpointRounding.AwayFromZero); //汇总总价 //_order.Amount = Convert.ToDecimal(txt_Amount.Value); //支付总价暂为不可修改 _order.Amount = standardAmount; _order.FireightFee = 0; _order.Taxfee =0; _order.Status = ddl_Status.SelectedValue; //订单状态 _order.ServiceNote = txt_serviceNote.Text; //客服备注 //_order.ReceiveDt = Convert.ToDateTime(ext_receiveDt.Value).AddHours(Convert.ToInt32(ddl_receiveTime.SelectedValue)); //收货时间 string timeRange = ddl_receiveTime.SelectedItem.Text; int hour = Convert.ToInt32(timeRange.Substring(timeRange.IndexOf("-") + 1, timeRange.Length - (timeRange.IndexOf("-") + 4))); _order.ReceiveDt = Convert.ToDateTime(ext_receiveDt.Value).AddHours(hour); //收货时间 _order.CloseReason = txt_closeReason.Text; //交易关闭 _order.AdminId = logic.sysAdmin.AdminID; //操作者ID for (int i = 0; i < rpt_OrderItems.Items.Count; i++) //修改商品细目表 { RepeaterItem row = rpt_OrderItems.Items[i]; HiddenField hid = row.FindControl("hid_oiId") as HiddenField; TextBox txt = row.FindControl("txtQuantity") as TextBox; TextBox txtNote = row.FindControl("txtCustomerNote") as TextBox; int oiid = Convert.ToInt32(hid.Value); decimal quantity = Convert.ToDecimal(txt.Text); logic.orderItem.updateQuantity(oiid, quantity, txtNote.Text); //根据细目ID 和 商品数量 修改 } OrderStatusHistoryEntity _Ostatus = new OrderStatusHistoryEntity(); _Ostatus.OrderId = orderid; _Ostatus.Status = _order.Status; _Ostatus.AdminId = _order.AdminId; _Ostatus.Remarks = txt_closeReason.Text.Trim(); _Ostatus.ReceivDt = _order.ReceiveDt; _Ostatus.Note = _order.ServiceNote; logic.orderStatusHistory.OrderStatusHistoryInsert(_Ostatus, true); logic.order.update(_order); Library.Script.ClientMsg("修改成功!"); rptBind(); //getDetails(orderid); }
protected void btn_UpdateStatus_Click(object sender, EventArgs e) { int orderid = Convert.ToInt32(hd_orderid.Value); if (ddl_Status.SelectedValue == "4" || ddl_Status.SelectedValue=="3") { if (logic.orderItem.isNotquoted(orderid)) { Library.Script.ClientMsg("对不起,该订单中有时价商品还未报价,不能提交订单!"); return; } } OrderEntity _order = new OrderEntity(); _order.Orderid = orderid; _order.Status = ddl_Status.SelectedValue; _order.AdminId = logic.sysAdmin.AdminID; OrderStatusHistoryEntity _Ostatus = new OrderStatusHistoryEntity(); _Ostatus.OrderId = orderid; _Ostatus.Status = _order.Status; _Ostatus.AdminId = _order.AdminId; _Ostatus.Remarks = txt_closeReason.Text.Trim(); _Ostatus.ReceivDt =DateTime.Now; _Ostatus.Note = txt_serviceNote.Text; logic.orderStatusHistory.OrderStatusHistoryInsert(_Ostatus, false); logic.order.updateStatus(_order); Library.Script.ClientMsg("修改状态成功!"); rptBind(); }
public static void updateStatus(OrderEntity _order) { DbHelper.ExecuteNonQuery("dbo.p_Order_updateStatus", _order.Orderid, _order.Status,_order.AdminId); }