/// <summary> /// 删除发货单方法 /// </summary> /// <param name="storeId"></param> /// <returns></returns> public static Boolean DelGoodsOrder(string storeOrderID) { Boolean temp = true; string connString = DBHelper.connString; SqlTransaction tr = null; SqlConnection conn = new SqlConnection(connString); conn.Open(); tr = conn.BeginTransaction(); try { BLL.CommonClass.ChangeLogs cl_h_info = new BLL.CommonClass.ChangeLogs("StoreOrder", "storeOrderID"); cl_h_info.AddRecordtran(tr, storeOrderID); cl_h_info.DeletedIntoLogstran(tr, BLL.CommonClass.ChangeCategory.Order, storeOrderID, BLL.CommonClass.ENUM_USERTYPE.Company); StockDAL.DelGoodsOrder(tr, OrderDetailDAL.GetOrderDetail(storeOrderID), StoreOrderDAL.GetStoreIdByOrderId(storeOrderID)); //还原店库存 OrderDetailDAL.DelOrderDetailItem(tr, storeOrderID); //明细表删除失败回滚 StoreOrderDAL.DelStoreOrder(storeOrderID, tr); //订单表删除失败回滚 tr.Commit(); } catch { temp = false; tr.Rollback(); } finally { // tr.Connection.Close(); tr.Dispose(); conn.Close(); } return(temp); }
/// <summary>构造函数 /// /// </summary> /// <param name="orderMaster">orderMaster</param> /// <param name="lstOrderMaster">lstOrderMaster</param> /// <param name="lstOrderDetail">lstOrderDetail</param> public FrmMasterDetailDemoDialog(OrderMaster orderMaster, List <OrderMaster> lstOrderMaster, List <OrderDetail> lstOrderDetail) { InitializeComponent(); #region 明细表列表绑定字段 this.olvColumn5.AspectGetter = delegate(object x) { return(((OrderDetail)x).DetailId); }; this.olvColumn6.AspectGetter = delegate(object x) { return(((OrderDetail)x).OrderId); }; this.olvColumn7.AspectGetter = delegate(object x) { return(((OrderDetail)x).Customer); }; this.olvColumn8.AspectGetter = delegate(object x) { return(((OrderDetail)x).ProductName); }; this.olvColumn9.AspectGetter = delegate(object x) { return(((OrderDetail)x).Amount); }; this.olvColumn10.AspectGetter = delegate(object x) { return(((OrderDetail)x).SumMoney); }; this.olvColumn11.AspectGetter = delegate(object x) { return(GetDetailStatus(((OrderDetail)x).Status)); }; #endregion this.m_orderMasterDAL = new OrderMasterDAL(); this.m_orderDetailDAL = new OrderDetailDAL(); this.m_orderMaster = orderMaster; this.m_lstOrderMaster = lstOrderMaster; this.m_lstOrderDetail = lstOrderDetail; //修改 if (orderMaster != null) { m_orderMaster = orderMaster; DisplayData(m_orderMaster); if (m_lstOrderDetail != null && m_lstOrderDetail.Count > 0) { objListViewDetail.SetObjects(m_lstOrderDetail); objListViewDetail.Refresh(); objListViewDetail.SelectedIndex = 0; } } Command_Click(orderMaster == null ? cmdNew : cmdEdit, null); }
/// <summary>构造函数 /// /// </summary> public FrmMasterDetailDemo() { InitializeComponent(); cboFilterType.SelectedIndex = 2; m_orderMasterDAL = new OrderMasterDAL(); m_orderDetailDAL = new OrderDetailDAL(); m_lstOrderMaster = new List <OrderMaster>(); DoInitData(); DoInitMasterGridSource(); DoInitDetailGridSource(); #region 主表列表绑定字段 this.olvColumn1.AspectGetter = x => ((OrderMaster)x).OrderId; this.olvColumn2.AspectGetter = delegate(object x) { return(((OrderMaster)x).OrderNumber); }; this.olvColumn3.AspectGetter = delegate(object x) { return(GetMasterStatus(((OrderMaster)x).Status)); }; this.olvColumn4.AspectGetter = delegate(object x) { return(((OrderMaster)x).CreateDate); }; #endregion #region 明细表列表绑定字段 this.olvColumn5.AspectGetter = delegate(object x) { return(((OrderDetail)x).DetailId); }; this.olvColumn6.AspectGetter = delegate(object x) { return(((OrderDetail)x).OrderId); }; this.olvColumn7.AspectGetter = delegate(object x) { return(((OrderDetail)x).Customer); }; this.olvColumn8.AspectGetter = delegate(object x) { return(((OrderDetail)x).ProductName); }; this.olvColumn9.AspectGetter = delegate(object x) { return(((OrderDetail)x).Amount); }; this.olvColumn10.AspectGetter = delegate(object x) { return(((OrderDetail)x).SumMoney); }; this.olvColumn11.AspectGetter = delegate(object x) { return(GetDetailStatus(((OrderDetail)x).Status)); }; #endregion }
/// <summary>构造函数 /// /// </summary> public FrmOrderMasterMasterDetailQuery() { InitializeComponent(); cboFilterType.SelectedIndex = 2; m_OrderMasterDAL = new OrderMasterDAL(); m_OrderDetailDAL = new OrderDetailDAL(); m_lstOrderMaster = new List <OrderMaster>(); DoInitData(); DoInitMasterGridSource(); DoInitDetailGridSource(); #region 主表列表绑定字段 this.gridmrzOrderId.AspectGetter = x => ((OrderMaster)x).OrderId; this.gridmrzOrderNumber.AspectGetter = x => ((OrderMaster)x).OrderNumber; this.gridmrzStatus.AspectGetter = delegate(object x) { return(GetMasterStatus(((OrderMaster)x).Status)); }; this.gridmrzCreateDate.AspectGetter = x => ((OrderMaster)x).CreateDate; #endregion #region 明细表列表绑定字段 this.gridDetailmrzDetailId.AspectGetter = x => ((OrderDetail)x).DetailId; this.gridDetailmrzOrderId.AspectGetter = x => ((OrderDetail)x).OrderId; this.gridDetailmrzCustomer.AspectGetter = x => ((OrderDetail)x).Customer; this.gridDetailmrzProductName.AspectGetter = x => ((OrderDetail)x).ProductName; this.gridDetailmrzAmount.AspectGetter = x => ((OrderDetail)x).Amount; this.gridDetailmrzSumMoney.AspectGetter = x => ((OrderDetail)x).SumMoney; this.gridDetailmrzStatus.AspectGetter = delegate(object x) { return(GetDetailStatus(((OrderDetail)x).Status)); }; #endregion }
public static void Deserialize() { try { OrderDetailDAL.Deserialize(); } catch (Exception) { throw; } }
/// <summary> /// Invokes Serialize method of DAL. /// </summary> public void Serialize() { try { OrderDetailDAL.Serialize(); } catch (Exception) { throw; } }
/// <summary> ///Invokes Deserialize method of DAL. /// </summary> public void Deserialize() { try { OrderDetailDAL.Deserialize(); } catch (System.Exception) { throw; } }
public ActionResult Payment(string shipName, string mobile, string address, string email) { var order = new Order(); order.CreatedDate = DateTime.Now; order.ShipAddress = address; order.ShipMobile = mobile; order.ShipName = shipName; order.ShipEmail = email; try { var orderDAL = OrderDAL.createOrderDAL(); var orderDetailDAL = OrderDetailDAL.createOrderDetailDAL(); var id = orderDAL.Insert(order); //var id = new OrderDAL.Insert(order); var cart = (List <CartItem>)Session[CartSession]; //var detailDao = new DAL.OrderDetailDAL(); decimal total = 0; foreach (var item in cart) { var orderDetail = new OrderDetail(); orderDetail.ProductId = item.SanPham.Id; orderDetail.OrderId = id; orderDetail.Price = item.SanPham.Price; orderDetail.Quantity = item.Quantity; orderDetailDAL.Insert(orderDetail); total += (item.SanPham.Price.GetValueOrDefault(0) * item.Quantity); } string content = System.IO.File.ReadAllText(Server.MapPath("~/assets/client/template/neworder.html")); content = content.Replace("{{CustomerName}}", shipName); content = content.Replace("{{Phone}}", mobile); content = content.Replace("{{Email}}", email); content = content.Replace("{{Address}}", address); content = content.Replace("{{Total}}", total.ToString("N0")); var toEmail = email; new MailHelper().SendMail(email, "Đơn hàng mới từ OnlineShopLaptop", content); new MailHelper().SendMail(toEmail, "Đơn hàng mới từ OnlineShopLaptop", content); } catch (Exception ex) { //ghi log Console.WriteLine(ex.ToString()); return(RedirectToAction("Failed")); } return(RedirectToAction("Success")); }
public Order GetOrderById(int orderId) { List <OrderDetailDAL> orderDetails = new List <OrderDetailDAL>(); using (SqlConnection conn = new SqlConnection(connString))// rôle const el sna3tha { conn.Open(); SqlCommand cmd = new SqlCommand("GetOrderById", conn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(new SqlParameter("@orderId", orderId)); using (SqlDataReader rdr = cmd.ExecuteReader()) while (rdr.Read()) // wa9tech nesta3wl while w wa9tech lo5rin { OrderDetailDAL detailDAL = new OrderDetailDAL(); detailDAL.OrderDate = (DateTime)rdr["OrderDate"]; detailDAL.OrderId = (int)rdr["OrderId"]; detailDAL.UserId = (int)rdr["UserId"]; detailDAL.Price = (double)rdr["Price"]; detailDAL.OrderDate = (DateTime)rdr["OrderDate"]; detailDAL.DeliveryDate = (DateTime)rdr["DeliveryDate"]; detailDAL.OrderTypeId = (int)rdr["OrderTypeId"]; detailDAL.ShippingModeId = (int)rdr["ShippingModeId"]; detailDAL.ShippingAdressId = (int)rdr["ShippingAdressId"]; detailDAL.BillingAdressId = (int)rdr["BillingAdressId"]; detailDAL.Sh_City = (string)rdr["Sh_City"]; detailDAL.Sh_Country = (string)rdr["Sh_Country"]; //detailDAL.Sh_IsDefault = (bool?)rdr["Sh_IsDefault"]; detailDAL.Sh_Number = (int)rdr["Sh_Number"]; detailDAL.Sh_Street = (string)rdr["Sh_Street"]; detailDAL.Sh_ZipCode = (int)rdr["Sh_ZipCode"]; detailDAL.Bi_City = (string)rdr["Bi_City"]; detailDAL.Bi_Country = (string)rdr["Bi_Country"]; // detailDAL.Bi_IsDefault = (bool?)rdr["Bi_IsDefault"]; detailDAL.Bi_Number = (int)rdr["Bi_Number"]; detailDAL.Bi_Street = (string)rdr["Bi_Street"]; detailDAL.Bi_ZipCode = (int)rdr["Bi_ZipCode"]; detailDAL.ArticleId = (int)rdr["ArticleId"]; detailDAL.Amount = (int)rdr["Amount"]; detailDAL.CreditCardId = (int?)rdr["CreditCardId"]; detailDAL.Label = (string)rdr["Label"]; detailDAL.ExpirtionDate = (DateTime)rdr["ExpirtionDate"]; detailDAL.SecurityCode = (int)rdr["SecurityCode"]; detailDAL.CreditCardNumbr = (string)rdr["CardNumber"]; orderDetails.Add(detailDAL); } } Order order = OrderDetailDAL.ToDomain(orderDetails); return(order); }
public ActionResult Order() { if (Session[CommonConstants.USER_SESSION] == null || Session[CommonConstants.CART_SESSION].ToString() == "") { return(RedirectToAction("Login", "User")); } if (Session[CommonConstants.CART_SESSION] == null) { return(Redirect("/")); } var user = Session[CommonConstants.USER_SESSION] as UserLogin; var cart = Session[CommonConstants.CART_SESSION] as List <Cart>; var order = new Order { UserID = user.UserID }; if (OrderDAL.InsertOrder(order) > 0) { OrderDetail orderDetail = null; int result = 0; for (int i = 0; i < cart.Count; i++) { orderDetail = new OrderDetail { OrderID = order.ID, BookID = cart[i].BookID, Quantity = cart[i].Quantity, Price = cart[i].Price, TotalPrice = cart[i].Total }; result = OrderDetailDAL.InsertOrderDetail(orderDetail); } if (result > 0) { Session[CommonConstants.CART_SESSION] = null; return(Redirect("/")); } } ; return(Redirect("/")); }
public ActionResult Edit(OrderDetailModel orderDetailModel) { if (ModelState.IsValid) { var orderDetail = new OrderDetail { OrderID = orderDetailModel.OrderID, BookID = orderDetailModel.BookID, Quantity = orderDetailModel.Quantity, Price = orderDetailModel.Price, TotalPrice = orderDetailModel.TotalPrice }; if (OrderDetailDAL.UpdateOrderDetail(orderDetail) > 0) { return(RedirectToAction("Index")); } else { ModelState.AddModelError("", "Cập nhật chi tiết đơn hàng không thành công"); } } return(View(orderDetailModel)); }
/// <summary>构造函数 /// /// </summary> /// <param name="modelMaster">modelMaster</param> /// <param name="lstOrderMaster">lstOrderMaster</param> /// <param name="lstOrderDetail">lstOrderDetail</param> public FrmOrderMasterMasterDetailDialog(OrderMaster modelMaster, List <OrderMaster> lstOrderMaster, List <OrderDetail> lstOrderDetail, DataSet dsDetailGridSource) { InitializeComponent(); DoInitMasterData(); DoInitDetailData(); #region 明细表列表绑定字段 this.gridDetailmrzDetailId.AspectGetter = x => ((OrderDetail)x).DetailId; this.gridDetailmrzOrderId.AspectGetter = x => ((OrderDetail)x).OrderId; this.gridDetailmrzCustomer.AspectGetter = x => ((OrderDetail)x).Customer; this.gridDetailmrzProductName.AspectGetter = x => ((OrderDetail)x).ProductName; this.gridDetailmrzAmount.AspectGetter = x => ((OrderDetail)x).Amount; this.gridDetailmrzSumMoney.AspectGetter = x => ((OrderDetail)x).SumMoney; this.gridDetailmrzStatus.AspectGetter = delegate(object x) { return(GetDetailStatus(((OrderDetail)x).Status)); }; #endregion this.m_OrderMasterDAL = new OrderMasterDAL(); this.m_OrderDetailDAL = new OrderDetailDAL(); this.m_OrderMaster = modelMaster; this.m_lstOrderMaster = lstOrderMaster; this.m_lstOrderDetail = lstOrderDetail; this.m_dsDetailGridSource = dsDetailGridSource; //修改 if (modelMaster != null) { m_OrderMaster = modelMaster; DisplayData(m_OrderMaster); if (m_lstOrderDetail != null && m_lstOrderDetail.Count > 0) { objListViewDetail.SetObjects(m_lstOrderDetail); objListViewDetail.Refresh(); objListViewDetail.SelectedIndex = 0; } } Command_Click(modelMaster == null ? cmdNew : cmdEdit, null); }
public static DataTable GetOrderGoodY(string StoreOrderID) { return(OrderDetailDAL.GetOrderGoodY(StoreOrderID)); }
public static async void CancelRetailerOrder() { List <OrderDetail> matchingOrder = new List <OrderDetail>();//list maintains the order details of the order which user wishes to cancel try { using (IRetailerBL retailerBL = new RetailerBL()) { //gives the current retailer Retailer retailer = await retailerBL.GetRetailerByEmailBL(CommonData.CurrentUser.Email); using (IOrderBL orderDAL = new OrderBL()) { //list of orders ordered by the retailer List <Order> RetailerOrderList = await orderDAL.GetOrdersByRetailerID(retailer.RetailerID); Console.WriteLine("Enter the order number which you want to cancel"); int orderToBeCancelled = int.Parse(Console.ReadLine());//user input of order which he has to cancel foreach (Order order in RetailerOrderList) { using (IOrderDetailBL orderDetailBL = new OrderDetailBL()) { //getting the order details of required order to be cancelled List <OrderDetail> RetailerOrderDetails = await orderDetailBL.GetOrderDetailsByOrderIDBL(order.OrderId); matchingOrder = RetailerOrderDetails.FindAll( (item) => { return(item.OrderSerial == orderToBeCancelled); } ); break; } } if (matchingOrder.Count != 0) { OrderDetailDAL orderDetaildal = new OrderDetailDAL(); //cancel order if order not delivered if (!orderDetaildal.UpdateOrderDeliveredStatusDAL(matchingOrder[0].OrderId)) { int serial = 0; Console.WriteLine("Products in the order are "); foreach (OrderDetail orderDetail in matchingOrder) { //displaying order details with the products ordered serial++; Console.WriteLine("#\tProductID \t ProductQuantityOrdered"); Console.WriteLine($"{ serial}\t{ orderDetail.ProductID}\t{ orderDetail.ProductQuantityOrdered}"); } Console.WriteLine("Enter The Product to be Cancelled"); int y = int.Parse(Console.ReadLine()); Console.WriteLine("Enter The Product Quantity to be Cancelled"); int quantityToBeCancelled = int.Parse(Console.ReadLine()); if (matchingOrder[y - 1].ProductQuantityOrdered >= quantityToBeCancelled) { //updating order quantity and revenue matchingOrder[y - 1].ProductQuantityOrdered -= quantityToBeCancelled; matchingOrder[y - 1].TotalAmount -= matchingOrder[y - 1].ProductPrice * quantityToBeCancelled; OrderDetailDAL orderDetailDAL = new OrderDetailDAL(); orderDetailDAL.UpdateOrderDetailsDAL(matchingOrder[y - 1]); Console.WriteLine("Product Cancelled Succesfully"); } else { Console.WriteLine("PRODUCT QUANTITY EXCEEDED"); } } else { Console.WriteLine("Order Can't be cancelled as it is delivered"); } } } } } catch (Exception) { throw; } }
/// <summary> /// 查看对应订单的明细 /// </summary> /// <param name="ID">店铺编号</param> /// <returns>返回对应明细</returns> public static IList <OrderDetailModel> GetOrderDetailList(string ID) { //OrderDetailDAL server = new OrderDetailDAL(); return(OrderDetailDAL.GetOrderDetailByStoreId(ID)); }
/// <summary> /// 获取标示码 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Loadmk() { string billid = ViewState["billid"].ToString(); int dotype = Convert.ToInt32(ViewState["dotype"]); int roletype = Convert.ToInt32(ViewState["roletype"]); double currency = AjaxClass.GetCurrency(int.Parse(Session["Default_Currency"] == null ? bzCurrency.ToString() : Session["Default_Currency"].ToString())); string ip = Request.UserHostAddress.ToString(); string remark = ""; MemberOrderModel memberorder = null; DataTable ordergoodstable = null; DataTable ordergoodstable1 = null; double ordertmoney = 0; if (roletype == 1) //会员订单 { if (dotype == 1) { memberorder = MemberOrderDAL.GetMemberOrder(billid); ordertmoney = Convert.ToDouble(memberorder.TotalMoney); } } else if (roletype == 2) //店铺 { if (dotype == 1) { ordergoodstable = OrderDetailDAL.Getordergoodstablebyorderid1(billid); ordergoodstable1 = OrderDetailDAL.Getordergoodstablebyorderid2(billid); if (ordergoodstable != null && ordergoodstable.Rows.Count > 0) { ordertmoney = Convert.ToDouble(ordergoodstable.Rows[0]["totalmoney"]); } else { if (ordergoodstable1 != null && ordergoodstable1.Rows.Count > 0) { ordertmoney = Convert.ToDouble(ordergoodstable1.Rows[0]["totalmoney"]); } } } } string biaoshi = ""; if (dotype == 1) //订单支付生成尾数 { remark = loginnumber + "汇款支付订单" + billid; int c = 1; //数据库中1代表会员 0代表店铺 if (roletype == 2) { c = 0; } string rmid = RemittancesDAL.GetAddnewRemattice(loginnumber, ordertmoney, ip, billid, remark, c); ViewState["remid"] = rmid; DataTable dt = DBHelper.ExecuteDataTable("select totalrmbmoney ,totalmoney from remtemp where remittancesid='" + rmid + "'"); if (dt != null && dt.Rows.Count > 0) { // biaoshi = Convert.ToDouble(dt.Rows[0]["totalrmbmoney"]).ToString("f2"); biaoshi = Convert.ToDouble(dt.Rows[0]["totalmoney"]).ToString("#0.00"); } } else if (dotype == 2) //汇款充值生成尾数 { RemittancesDAL.GetAddnewRetmp(loginnumber, billid, ip, remark, roletype); DataTable dt = DBHelper.ExecuteDataTable("select totalrmbmoney ,totalmoney from remtemp where remittancesid='" + billid + "'"); //查找出标识 if (dt != null && dt.Rows.Count > 0) { //biaoshi = Convert.ToDouble(dt.Rows[0]["totalrmbmoney"]).ToString("f2"); biaoshi = Convert.ToDouble(dt.Rows[0]["totalmoney"]).ToString("#0.00"); } } if (biaoshi != "" && biaoshi.ToString().IndexOf('.') > 0) { DataTable dt = new DataTable(); if (dotype == 1) { remark = loginnumber + "汇款支付订单" + billid; int c = 1; //数据库中1代表会员 0代表店铺 if (roletype == 2) { c = 0; } string rmid = RemittancesDAL.GetAddnewRemattice(loginnumber, ordertmoney, ip, billid, remark, c); ViewState["remid"] = rmid; dt = DBHelper.ExecuteDataTable("select totalrmbmoney ,totalmoney from remtemp where remittancesid='" + rmid + "'"); } else if (dotype == 2) { RemittancesDAL.GetAddnewRetmp(loginnumber, billid, ip, remark, roletype); dt = DBHelper.ExecuteDataTable("select totalrmbmoney ,totalmoney from remtemp where remittancesid='" + billid + "'"); //查找出标识 } string bb = (double.Parse(biaoshi) * currency).ToString(); //lblpartmoney.Text = (bb).Substring(0, (bb).IndexOf('.')); //string chart = bb.Substring(bb.IndexOf('.') + 1); this.lblmoneyre.Text = (double.Parse(bb)).ToString(); this.lblrmb.Text = double.Parse(lbltotalmoney.Text).ToString("#0.00"); //lblchat.Text = (double.Parse(chart) ).ToString(); ; //lbljiao.Text = chart.Substring(0, 1); //lblfen.Text = chart.Substring(1); } }
public void LoadData1() { double currency = AjaxClass.GetCurrency(int.Parse(Session["Default_Currency"] == null ? bzCurrency.ToString() : Session["Default_Currency"].ToString())); string billid = ViewState["billid"].ToString(); int dotype = Convert.ToInt32(ViewState["dotype"]); int roletype = Convert.ToInt32(ViewState["roletype"]); this.lblorderid.Text = billid; MemberOrderModel memberorder = null; DataTable ordergoodstable = null; DataTable dtcb = null; //查询会员汇入银行 string paymentnumber = ""; //被支付订单(汇款单)所属会员编号 double totalmoney = 0; // 被支付订单(汇款单)总金额 if (dotype == 1) //订单支付 { lbltype.Text = GetTran("000907", "订单支付"); lblot.Text = GetTran("000079", "订单号"); } else if (dotype == 2)//充值 { div_1.Style.Add("display", "none"); div_2.Style.Add("display", "none"); div_5.Style.Add("display", "none"); div_6.Style.Add("display", "none"); lbltype.Text = GetTran("007451", "订单支付"); lblot.Text = GetTran("005854", "汇款单号"); ViewState["remid"] = billid; RemittancesModel remittance = RemittancesDAL.GetRemitByHuidan(billid); paymentnumber = remittance.RemitNumber.ToString(); //被支付订单(汇款单)所属会员编号 totalmoney = Convert.ToDouble(remittance.RemitMoney) * currency; // 被支付订单(汇款单)总金额 } if (roletype == 1) //会员 { //隐藏店铺操作 div_6.Style.Add("display", "none"); div_5.Style.Add("display", "none"); if (Session["Member"] != null) { loginnumber = Session["Member"].ToString(); } else if (Session["Store"] != null) { loginnumber = Session["Store"].ToString(); //店铺支付会员订单 div_1.Style.Add("display", "none"); div_2.Style.Add("display", "none"); div_3.Style.Add("display", "none"); div_4.Style.Add("display", "none"); div_6.Style.Add("display", "none"); div_5.Style.Add("display", ""); } if (dotype == 1) //订单支付 { if (MemberOrderDAL.Getvalidteiscanpay(billid, loginnumber)) //限制订单必须有订货所属店铺中心支付) { ClientScript.RegisterStartupScript(this.GetType(), "", "<script> alert('" + GetTran("007452", "该订单不属于您的协助或推荐报单,不能完成支付") + "'); window.location.href='../Logout.aspx'; </script>"); return; } memberorder = MemberOrderDAL.GetMemberOrder(billid); if (loginnumber == "") { loginnumber = memberorder.Number; } else { ViewState["odnumber"] = memberorder.Number; } if (memberorder.Number == loginnumber)//如果是自己支付自己的订单则不需要确认收到款 { div_sure.Visible = false; rdombsuregetmoney.Visible = false; } if (memberorder == null) { ClientScript.RegisterStartupScript(this.GetType(), "", "<script> window.location.href='payerror.aspx?ef=" + EncryKey.Encrypt("1").ToLower() + "';</script>"); return; } if (memberorder.DefrayState == 1) { ClientScript.RegisterStartupScript(this.GetType(), "", "<script>window.location.href='payerror.aspx?ef=" + EncryKey.Encrypt("2").ToLower() + "';</script>"); return; } paymentnumber = memberorder.Number.ToString(); //被支付订单(汇款单)所属会员编号 totalmoney = Convert.ToDouble(memberorder.TotalMoney); // 被支付订单(汇款单)总金额 } dtcb = CompanyBankDAL.getdtcompanybankbynumber(loginnumber, 1); } else if (roletype == 2) //店铺 { //隐藏店铺操作 div_2.Style.Add("display", "none"); div_1.Style.Add("display", "none"); div_5.Style.Add("display", "none"); loginnumber = Session["Store"].ToString(); dtcb = CompanyBankDAL.getdtcompanybankbynumber(loginnumber, 2); if (dotype == 1) //订单操作 { ordergoodstable = OrderDetailDAL.Getordergoodstablebyorderid(billid); if (ordergoodstable != null && ordergoodstable.Rows.Count > 0) { if (ordergoodstable.Rows[0]["IsCheckOut"].ToString() == "Y") { ClientScript.RegisterStartupScript(this.GetType(), "", "<script>window.location.href='payerror.aspx?ef=" + EncryKey.Encrypt("2").ToLower() + "';</script>"); return; } } else { ClientScript.RegisterStartupScript(this.GetType(), "", "<script> window.location.href='payerror.aspx?ef=" + EncryKey.Encrypt("1").ToLower() + "';</script>"); return; } //paymentnumber = ordergoodstable.Rows[0]["storeid"].ToString();//被支付订单(汇款单)所属会员编号 totalmoney = Convert.ToDouble(ordergoodstable.Rows[0]["totalmoney"]);// 被支付订单(汇款单)总金额 } } lblstoreid1.Text = loginnumber; lblstoreID2.Text = loginnumber; lblordernumber.Text = loginnumber; lbltotalmoney.Text = totalmoney.ToString("0.00"); lblordertmoney.Text = totalmoney.ToString("0.00"); ViewState["tm"] = totalmoney; string cardstr = ""; int i = 1; if (dtcb != null && dtcb.Rows.Count > 0) { foreach (DataRow item in dtcb.Rows) { cardstr += " <div id='bank" + i.ToString() + "' > " + GetTran("001243", "开户行") + ": " + item["Bank"].ToString() + "<br/> " + GetTran("007506", "账") + " " + GetTran("007453", "号") + ": " + getsplit(item["BankBook"].ToString()) + "<br/> " + GetTran("000086", "开户名") + ": " + item["Bankname"].ToString() + "</div>"; i++; } this.cardlist.InnerHtml = cardstr;//绑定银行信息 } }
/// <summary> /// 根据订单号查询订单详细表 /// </summary> /// <param name="OID"></param> /// <returns></returns> public static List <OrderDetails> getOrderDetailByOID(string OID) { return(OrderDetailDAL.getOrderDetailByOID(OID)); }
public OrderDetailBLL() { _orderDetailDAL = new OrderDetailDAL(); }
public OrderDetailBLL() { dal = new OrderDetailDAL(); }
/// <summary> /// 获取订单明细 /// </summary> /// <param name="orderid"></param> /// <returns></returns> public static IList <OrderDetailModel> GetOrderGoodsDetail(string orderid) { return(OrderDetailDAL.GetOrderGoodsDetail(orderid)); }
public PaymentBLL() { orderDAL = new OrderDAL(); orderDetailDAL = new OrderDetailDAL(); }
/// <summary> /// 根据新的要货编号获得老订单号 /// </summary> /// <param name="fahuoOrder">要货单号</param> /// <returns></returns> public static DataTable GetOrderGoodsNoteTable(string fahuoOrder) { return(OrderDetailDAL.GetOrderGoodsNoteTable(fahuoOrder)); }
/// <summary> /// 查看订单详细 /// </summary> /// <param name="storeOrderID"></param> /// <returns></returns> public static IList <OrderDetailModel> GetOrderDetailListByStoreId(string storeId) { return(OrderDetailDAL.GetOrderDetailByStoreId(storeId)); }
public OrderDetailBO() { orderdetailDAL = new OrderDetailDAL(); }
public ActionResult Index() { var orderDetails = OrderDetailDAL.GetOrderDetails(); return(View(orderDetails)); }
/// <summary> /// 确认订单按钮 /// </summary> /// <param name="storeId"></param> /// <returns></returns> public Boolean OrderSubmit(string storeId, List <OrderDetailModel> orderDetails, OrderGoodsMedel storeItem, bool IsEdit) { using (SqlConnection conn = new SqlConnection(DBHelper.connString)) { conn.Open(); SqlTransaction tr = conn.BeginTransaction();//开启事务 try { if (IsEdit) //如果是修改订单,先删除原来的订单并还原原来的信息 { BLL.CommonClass.ChangeLogs cl_h_info = new BLL.CommonClass.ChangeLogs("OrderGoods", "OrderGoodsID"); //实例日志类 cl_h_info.AddRecordtran(tr, storeItem.OrderGoodsID); //添加日志,修改前记录原来数据 StoreOrderDAL.DelStoreOrderItemProc(tr, storeItem.OrderGoodsID); //StockDAL.DelStoreOrder(tr, OrderDetailDAL.GetOrderGoodsDetail(storeItem.StoreorderId), storeItem.StoreId);//还原店库存 //OrderDetailDAL.DelOrderGoodsDetail(tr, storeItem.StoreorderId);//明细表删除失败回滚 //StoreOrderDAL.DelOrderGoods(storeItem.StoreorderId, tr); //订单表删除失败回滚 cl_h_info.AddRecordtran(tr, storeItem.OrderGoodsID); //添加日志,修改后记录原来数据 cl_h_info.ModifiedIntoLogstran(tr, BLL.CommonClass.ChangeCategory.store10, storeItem.OrderGoodsID, BLL.CommonClass.ENUM_USERTYPE.objecttype2); //插入日志 } //插入订单 if (new StoreOrderDAL().AddOrderGoods(storeItem, tr)) { //订单表插入成功插入明细表 foreach (OrderDetailModel orderDetailItem in orderDetails) { if (!OrderDetailDAL.AddOrderGoodsDetail(tr, orderDetailItem, storeItem.OrderGoodsID)) { tr.Rollback(); return(false); } } //修改库存信息(预订数量) foreach (OrderDetailModel orderDetailItem in orderDetails) { if (!StockDAL.UpdStockHasOrderCount(tr, storeItem.StoreId, orderDetailItem.ProductId, orderDetailItem.Quantity)) { tr.Rollback(); return(false); } } tr.Commit();//插入订单信息完成 } else {//订单插入失败回滚数据 tr.Rollback(); return(false); } } catch { //订单插入失败回滚数据 tr.Rollback(); return(false); } finally { conn.Close(); } } return(true); }
/// <summary> /// 确认订单按钮 /// </summary> /// <returns></returns> public Boolean CheckOutStoreOrder(IList <StoreOrderModel> orders, string storeid) { using (SqlConnection conn = new SqlConnection(DBHelper.connString)) { conn.Open(); //打开连接 SqlTransaction tr = conn.BeginTransaction(); //开启事务 try { decimal ordermoney = 0; decimal turnmoney = 0; string orderids = ""; foreach (StoreOrderModel order in orders) { if (!StoreOrderDAL.GetIsCheckOut(tr, order.StoreorderId)) //判断该订单是否已经支付 { if (StoreOrderDAL.UpdateOrderGoodsState(tr, order.StoreorderId)) //更改订单成已支付状态 { orderids += order.StoreorderId + ";"; if (order.OrderType == 0) { ordermoney += order.TotalMoney; } else if (order.OrderType == 1) { turnmoney += order.TotalMoney; } if (!StockDAL.UpdateInWayCount(tr, OrderDetailDAL.GetOrderGoodsDetail(order.StoreorderId), storeid))//跟新店库存,添加在途数量,去除预定数量 { tr.Rollback(); return(false); } if (!LogicProductInventoryDAL.UpdateToatlOut(tr, CommonDataBLL.GetNewOrderDetail(OrderDetailDAL.GetOrderGoodsDetail(order.StoreorderId))))//更新公司 逻辑库存 { tr.Rollback(); return(false); } } else { tr.Rollback(); return(false); } } } //添加对账单 D_AccountBLL.AddAccount(storeid, Convert.ToDouble(ordermoney), D_AccountSftype.StoreType, D_AccountKmtype.StoreOrderout, DirectionEnum.AccountReduced, "店铺【" + storeid + "】在线订货,订货款扣除额,订单号为【" + orderids + "】", tr); //跟新店货款 if (!StoreInfoDAL.UpdateSomeMoney(tr, ordermoney, turnmoney, storeid)) { tr.Rollback(); return(false); } tr.Commit(); } catch { tr.Rollback(); return(false); } finally { conn.Close(); } } return(true); }
public OrderBLL() { orderDAL = new OrderDAL(); orderDetailDAL = new OrderDetailDAL(); }
/// <summary> /// 我要发货,订单生成 /// </summary> /// <param name="storeId">店铺编号</param> /// <param name="orderDetails">发货单明细</param> /// <param name="storeItem">发货单信息</param> /// <returns></returns> public Boolean ApplyGoodsSubmit(StoreOrderModel storeorder, string orders) { string orderId = OrderGoodsBLL.GetNewOrderID(); int maxqishu = CommonDataBLL.GetMaxqishu(); //总金额,积分,数量,重量 decimal totalmoney = 0; decimal totalpv = 0; int totalQuantity = 0; decimal totalWeight = 0; string remark = ""; //保存合并后订单明细 IList <OrderDetailModel> orderDetails = new List <OrderDetailModel>(); //获取要合并的订单列表 IList <OrderGoodsMedel> storeorders = StoreOrderDAL.GetOrderGoodsByOrders(orders); //遍历要合并的订单列表 foreach (OrderGoodsMedel order in storeorders) { //获取要合并的订单列表明细并且进行遍历 foreach (OrderDetailModel detail in OrderDetailDAL.GetGoodsDetailModelList(order.OrderGoodsID)) { //判断是否已经有了该产品 int ct = 0; //遍历合并后的订单列表,是否有和要合并的订单重复的产品 foreach (OrderDetailModel orderdetail in orderDetails) { if (orderdetail.ProductId == detail.ProductId) { orderdetail.Quantity += detail.Quantity; ct++;//有重复的累加 } } //没有重复添加新的明细 if (ct == 0) { //生成一条订单明细 OrderDetailModel detailNew = new OrderDetailModel(); detailNew.StoreorderId = orderId; detailNew.ProductId = detail.ProductId; detailNew.Quantity = detail.Quantity; detailNew.Price = detail.Price; detailNew.Pv = detail.Pv; detailNew.StoreId = detail.StoreId; detailNew.ProductName = detail.ProductName; detailNew.ExpectNum = maxqishu; //添加订单明细,到订单明细列表 orderDetails.Add(detailNew); } } //累加总金额,总积分,数量 totalmoney += order.TotalMoney; totalpv += order.TotalPv; totalQuantity += order.GoodsQuantity; totalWeight += order.Weight; remark += order.OrderGoodsID + ";"; } //保存合并后订单 StoreOrderModel storeItem = new StoreOrderModel(); storeItem.StoreId = storeorder.StoreId; //店铺ID storeItem.StoreorderId = orderId; //订单号 storeItem.TotalMoney = totalmoney; //订单总金额 storeItem.TotalPv = totalpv; //订单总积分 storeItem.InceptAddress = storeorder.InceptAddress; //收货人地址 storeItem.InceptPerson = storeorder.InceptPerson; //收货人姓名 storeItem.PostalCode = storeorder.PostalCode; //收货人邮编 storeItem.Telephone = storeorder.Telephone; //收货人电话 storeItem.OrderDatetime = DateTime.Now.ToUniversalTime(); //订单时间 storeItem.ExpectNum = CommonDataBLL.GetMaxqishu(); //获取期数 storeItem.TotalCommision = 0; //手续费 storeItem.GoodsQuantity = totalQuantity; //货物件数 storeItem.Carriage = 0; //运费 storeItem.Weight = totalWeight; //重量 storeItem.City.Country = storeorder.City.Country; //国家 storeItem.City.Province = storeorder.City.Province; //省份 storeItem.City.City = storeorder.City.City; //城市 storeItem.City.Xian = storeorder.City.Xian; storeItem.IscheckOut = "Y"; //是否支付 storeItem.IsAuditing = "Y"; storeItem.SendWay = storeorder.SendWay; storeItem.OperateIP = System.Web.HttpContext.Current.Request.UserHostAddress; //用户IP storeItem.Description = remark; //描述 storeItem.ConsignmentDatetime = DateTime.Now.ToUniversalTime(); //申请发货日期 storeItem.OrderType = storeorder.OrderType; using (SqlConnection conn = new SqlConnection(DBHelper.connString)) { conn.Open(); SqlTransaction tr = conn.BeginTransaction();//开启事务 try { //插入订单 if (new StoreOrderDAL().AddStoreOrder(storeItem, tr)) { //DBHelper.ExecuteNonQuery(tr, "insert into ApplygoodsTb select '" + storeItem.Description + "',1"); //订单表插入成功插入明细表 foreach (OrderDetailModel orderDetailItem in orderDetails) { if (!OrderDetailDAL.AddOrderDetail(tr, orderDetailItem, storeItem.StoreorderId)) { tr.Rollback(); return(false); } } //修改库存信息 foreach (OrderDetailModel orderDetailItem in orderDetails) { if (!StockDAL.UpdStockSendTotalNumber(tr, storeItem.StoreId, orderDetailItem.ProductId, orderDetailItem.Quantity)) { tr.Rollback(); return(false); } } //更新订单发货状态 StoreOrderDAL.UpdateDeliveryFlag(orders, orderId); //if (storeItem.SendType == 2) //{ // string strSql = @"Update memberorder Set sendType = 2 Where OrderId in (Select OutStorageOrderID from OrderGoods where storeorderid in (" + orders + "))"; // DBHelper.ExecuteNonQuery(tr, strSql, null, CommandType.Text); //} tr.Commit();//插入订单信息完成 } else {//订单插入失败回滚数据 tr.Rollback(); return(false); } } catch { //订单插入失败回滚数据 tr.Rollback(); return(false); } finally { conn.Close(); } } return(true); }