public OrderGoodsMedel GetOrderModel(string orderId, MemberOrderModel mOrder, SqlTransaction tran, decimal totalMoney, decimal totalPv) { //获取订单信息 OrderGoodsMedel item = new OrderGoodsMedel(); item.StoreId = mOrder.StoreId; //店铺ID item.OrderGoodsID = orderId; //订单号 item.TotalMoney = Convert.ToDecimal(totalMoney); //订单总金额 item.TotalPv = Convert.ToDecimal(totalPv); //订单总积分 item.InceptAddress = mOrder.ConAddress; //收货人地址 item.InceptPerson = mOrder.Consignee; //收货人姓名 item.PostalCode = mOrder.ConZipCode; //收货人邮编 item.Telephone = mOrder.ConTelPhone; //收货人电话 item.OrderDatetime = DateTime.Now.ToUniversalTime(); //订单时间 item.ExpectNum = CommonDataBLL.GetMaxqishu(); //获取期数 item.TotalCommision = 0; //手续费 item.GoodsQuantity = 0; //货物件数 item.Carriage = 0; //运费 item.Weight = 0; //重要 item.City.Country = mOrder.ConCity.Country; //国家 item.City.Province = mOrder.ConCity.Province; //省份 item.City.City = mOrder.ConCity.City; //城市 item.IscheckOut = "Y"; //是否支付 item.OperateIP = System.Web.HttpContext.Current.Request.UserHostAddress; //用户IP item.OrderType = 0; //订单类型 item.SendWay = mOrder.SendWay; item.Description = "会员【" + mOrder.Number + "】报单!"; return(item); }
public static MemberOrderModel GetMemberOrder(string orderId) { MemberOrderModel model = null; string sql = "select InvestJB,PriceJB ,Number,OrderId,StoreId,TotalMoney,TotalPv,CarryMoney,OrderExpectNum,PayExpectNum,IsAgain,Error,Remark,DefrayState," + "Consignee,CCPCCode ,ConZipCode,ConTelPhone,ConMobilPhone," + "ConPost,DefrayType,PayMoney,PayCurrency,StandardCurrency,StandardcurrencyMoney," + "OperateIp,OperateNum,RemittancesId,ElectronicaccountId,OrderType,IsreceiVables,PaymentMoney,ReceivablesDate, conaddress,lackproductmoney,sendway,isnull(city.country,'') country,isnull(city.province,'') province,isnull(city.city,'') city,isnull(city.xian,'') xian from MemberOrder left join city on memberorder.CCPCCode=city.CPCCode where orderId= @orderId"; SqlParameter para = new SqlParameter("@orderId", orderId); SqlDataReader dr = DBHelper.ExecuteReader(sql, para, CommandType.Text); if (dr.Read()) { model = new MemberOrderModel(); model.Number = dr["Number"].ToString(); model.OrderId = dr["OrderId"].ToString(); model.StoreId = dr["StoreId"].ToString(); model.TotalMoney = Convert.ToDecimal(dr["TotalMoney"]); model.TotalPv = Convert.ToDecimal(dr["TotalPv"]); model.CarryMoney = Convert.ToDecimal(dr["CarryMoney"]); model.OrderExpect = Convert.ToInt32(dr["OrderExpectNum"]); model.PayExpect = Convert.ToInt32(dr["PayExpectNum"]); model.IsAgain = Convert.ToInt32(dr["IsAgain"]); model.Err = dr["Error"].ToString(); model.Remark = dr["Remark"].ToString(); model.DefrayState = Convert.ToInt32(dr["DefrayState"]); model.Consignee = dr["Consignee"].ToString(); model.CCPCCode = dr["CCPCCode"].ToString(); model.ConZipCode = dr["ConZipCode"].ToString(); model.ConTelPhone = dr["ConTelPhone"].ToString(); model.ConMobilPhone = dr["ConMobilPhone"].ToString(); model.ConPost = dr["ConPost"].ToString(); model.DefrayType = Convert.ToInt32(dr["DefrayType"]); //model.IsRetail = dr.GetInt32(19); //model.DeclareMoney = dr.GetDecimal(20); model.PayMoney = Convert.ToDecimal(dr["PayMoney"]); model.PayCurrency = Convert.ToInt32(dr["PayCurrency"]); model.StandardCurrency = Convert.ToInt32(dr["StandardCurrency"]); model.StandardcurrencyMoney = Convert.ToDecimal(dr["StandardcurrencyMoney"]); model.OperateIp = dr["OperateIp"].ToString(); model.OperateNumber = dr["OperateNum"].ToString(); //model.Type = dr.GetInt32(27); model.RemittancesId = dr["RemittancesId"].ToString(); model.ElectronicaccountId = dr["ElectronicaccountId"].ToString(); model.OrderType = Convert.ToInt32(dr["OrderType"]); model.IsreceiVables = Convert.ToInt32(dr["IsreceiVables"]); model.PaymentMoney = Convert.ToDecimal(dr["PaymentMoney"]); model.ReceivablesDate = Convert.ToDateTime(dr["ReceivablesDate"]); model.ConAddress = dr["ConAddress"].ToString(); model.LackProductMoney = Convert.ToDecimal(dr["LackProductMoney"]); model.SendWay = Convert.ToInt32(dr["SendWay"]); model.ConCity.Country = dr["country"].ToString(); model.ConCity.Province = dr["province"].ToString(); model.ConCity.City = dr["City"].ToString(); model.ConCity.Xian = dr["Xian"].ToString(); model.InvestJB = Convert.ToDecimal((dr["InvestJB"] == DBNull.Value ? 0 : dr["InvestJB"])); model.PriceJB = Convert.ToDecimal((dr["PriceJB"] == DBNull.Value ? 0 : dr["PriceJB"])); } dr.Close(); return(model); }
/// <summary> /// 编辑基本信息 /// </summary> public void editxtBasic() { txtEnumber.Visible = false; txtEname.Visible = true; txtEnickname.Visible = true; txtEstore.Visible = true; txtEIdtype.Visible = true; txtEsex.Visible = true; txtEbirthday.Visible = true; txtEidnumber.Visible = true; CountryCityPCode1.Visible = true; txtEaddress.Visible = true; txtEcode.Visible = true; txtEmethod.Visible = true; txtEcurrency.Visible = true; labenc.Visible = true; lblEnumber.Visible = true; lblEname.Visible = false; lblEnickname.Visible = false; lblEstore.Visible = false; lblEIdtype.Visible = false; lblEsex.Visible = false; lblEbirthday.Visible = false; lblEidnumber.Visible = false; lblEaddress.Visible = false; lblEcode.Visible = false; lblEmethod.Visible = false; lblEcurrency.Visible = false; //tbephoto.Visible = true; //默认的会员编号是 MemberInfoModel model = MemInfoEditBLL.getMemberInfo(ViewState["membernumberE"].ToString()); MemberOrderModel order = MemberOrderBLL.GetMemberOrder(model.OrderID); //绑定证件类型 bindidtype(); Translations(); txtEnumber.Text = model.Number; txtEname.Text = Encryption.Encryption.GetDecipherName(model.Name); txtEnickname.Text = model.PetName; txtEstore.Text = model.StoreID; try { txtEIdtype.SelectedValue = model.PaperType.PaperTypeCode.Trim(); } catch (Exception exe1) { txtEIdtype.SelectedValue = "P000"; } txtEsex.SelectedIndex = model.Sex == 0 ? 1 : 0; txtEbirthday.Text = model.Birthday.ToString("yyyy-MM-dd"); txtEidnumber.Text = Encryption.Encryption.GetDecipherNumber(model.PaperNumber.ToString().Trim()); CountryCityPCode1.SelectCountry(model.City.Country, model.City.Province, model.City.City, model.City.Xian); txtEaddress.Text = Encryption.Encryption.GetDecipherAddress(model.Address.ToString().Trim());; txtEcode.Text = model.PostalCode.ToString(); lblEbankname.Text = Encryption.Encryption.GetDecipherName(model.BankBook); }
/// <summary> /// 删除复消单 /// </summary> public string DelOredrAgain(string orderId, double totalPv, string number, int except, string storeId) { double totalMoney = AddOrderDataDAL.GetTotalMoneyByOrderId(orderId); MemberOrderModel order = MemberOrderDAL.GetMemberOrder(orderId); string info = null; using (SqlConnection conn = new SqlConnection(DAL.DBHelper.connString)) { conn.Open(); SqlTransaction tran = conn.BeginTransaction(); try { BLL.CommonClass.ChangeLogs cl_h_info = new BLL.CommonClass.ChangeLogs("memberorder", "orderid"); //实例日志类 cl_h_info.AddRecordtran(tran, orderId); //添加日志,修改前记录原来数据 //如果该订单不存在 if (!BrowsememberordersDAL.CheckOrderIdExists(orderId)) { info = BLL.Translation.Translate("001661", "抱歉,该订单不存在!"); tran.Rollback(); conn.Close(); return(info); } if (order.DefrayState == 1) { if (totalMoney > 0) { D_AccountBLL.AddAccount(storeId, totalMoney, D_AccountSftype.StoreType, D_AccountKmtype.OrderDelete, DirectionEnum.AccountsIncreased, "会员【" + number + "】报单删除现金扣添加,订单号为【" + orderId + "】", tran); if (order.DefrayType == 2) { IsElecPay(tran, order); D_AccountBLL.AddAccount(order.Number, Convert.ToDouble(order.TotalMoney), D_AccountSftype.MemberType, D_AccountKmtype.OrderUpdateIn, DirectionEnum.AccountsIncreased, "会员【" + order.Number + "】报单删除现金扣添加,订单号为【" + order.OrderId + "】", tran); D_AccountBLL.AddAccount(order.StoreId, Convert.ToDouble(order.TotalMoney), D_AccountSftype.StoreType, D_AccountKmtype.OrderUpdateOut, DirectionEnum.AccountReduced, "会员【" + order.Number + "】报单删除现金添加扣,订单号为【" + order.OrderId + "】", tran, true); } } int result = addOrderDataDAL.Js_delfuxiao(number, totalPv, except, 1, tran); } //删除复消单 addOrderDataDAL.Del_Horder(tran, orderId, storeId, CommonDataBLL.OperateBh, CommonDataBLL.OperateIP); cl_h_info.DeletedIntoLogstran(tran, BLL.CommonClass.ChangeCategory.store1, orderId, BLL.CommonClass.ENUM_USERTYPE.objecttype5);//插入日志 tran.Commit(); } catch { info = BLL.Translation.Translate("000417", "删除失败!"); tran.Rollback(); } finally { conn.Close(); conn.Dispose(); } } return(info); }
/// <summary> /// 修改时绑定信息 /// </summary> private void EditBind() { this.Txtbh.Enabled = false; this.rdPayType.Enabled = false; this.dzpanel.Visible = false; string OrderId = GetOrderId(); //绑定产品树 ProductTree myTree = new ProductTree(); myTree.Orderid = OrderId; this.menuLabel.Text = myTree.getEditMenu10Again(GetStoreId(), GetOrderId()); //绑定产品信息 UptTree(OrderId); //绑定订单信息 this.Txtbh.Enabled = false;//修改时会员编号不能修改 MemberOrderModel mo = MemberOrderAgainBLL.GetMemberOrderByOrderId(OrderId); this.Txtbh.Text = mo.Number; this.Txtxm.Text = Encryption.Encryption.GetDecipherName(mo.Consignee); this.Txtyb.Text = mo.ConZipCode; this.Email.Text = mo.ConPost; this.Txtjtdh.Text = Encryption.Encryption.GetDecipherTele(mo.ConTelPhone); this.Txtyddh.Text = Encryption.Encryption.GetDecipherTele(mo.ConMobilPhone); this.CountryCity1.SelectCountry(mo.ConCity.Country, mo.ConCity.Province, mo.ConCity.City, mo.ConCity.Xian); this.Txtdz.Text = Encryption.Encryption.GetDecipherAddress(mo.ConAddress); this.rdPayType.SelectedValue = mo.DefrayType.ToString(); this.Txtbz.Text = mo.Remark; if (mo.DefrayState.ToString() == "1") { this.rdPayType.Enabled = false; } if (this.rdPayType.SelectedValue == "2") { this.dzpanel.Visible = true; this.txtdzbh.Text = mo.ElectronicaccountId; } this.DropCurrency.SelectedValue = mo.PayCurrency.ToString();//支付币种 DDLSendType.SelectedValue = mo.SendWay.ToString(); this.TxtStore.Text = GetStoreId(); GetBindAddress(); string addess = mo.ConCity.Country + " " + mo.ConCity.Province + " " + mo.ConCity.City + " " + mo.ConCity.Xian + " " + mo.ConAddress; this.rbtAddress.SelectedValue = addess; }
public void BindOldOrder(string orderid) { MemberOrderModel model = MemberOrderBLL.GetMemberOrder(orderid); Session["LUOrder"] = model.Number + "," + model.OrderType; Session["OrderType"] = model.OrderType; MemberInfoModel infomodel = MemberInfoDAL.getMemberInfo(model.Number); infomodel.StoreID = model.StoreId; Session["fxMemberModel"] = infomodel; Session["EditOrderID"] = orderid; DAL.DBHelper.ExecuteNonQuery("delete from MemShopCart where memBh='" + model.Number + "' and mType=" + Session["UserType"].ToString()); DBHelper.ExecuteNonQuery("insert into MemShopCart select productid,quantity,number," + Session["UserType"].ToString() + ",getutcdate()," + model.OrderType + " from MemberDetails where orderid='" + orderid + "'"); }
/// <summary> /// 会员自由注册记录到MemberOrder和MemberDetails /// </summary> /// <param name="model">用户注册定单</param> /// <param name="list">用户注册定单列表</param> /// <returns></returns> public static bool AddOrder(MemberOrderModel model, IList <MemberDetailsModel> list) { bool state = false; int record = 0; using (SqlConnection conn = new SqlConnection(DAL.DBHelper.connString)) { //打开连接 conn.Open(); SqlTransaction tran = conn.BeginTransaction(); try { record += new AddFreeOrderDAL().AddOrder(model, tran); foreach (MemberDetailsModel item in list) { record += new AddOrderDataDAL().insert_MemberOrderDetails(model, item, tran); } if (record == 0) { tran.Rollback(); conn.Close(); } else { //更信结算表,注意此时保单时未确认的所以flag为0 new AddOrderDataDAL().Js_addfuxiao(model.Number, Convert.ToDouble(model.TotalMoney), model.OrderExpect, 0, tran); state = true; tran.Commit(); } } catch { tran.Rollback(); } finally { conn.Close(); } } return(state); }
/// <summary> /// 电子货币支付 /// </summary> public void IsElecPay(SqlTransaction tran, MemberOrderModel memberOrderModel) { //支付期数 memberOrderModel.PayExpect = CommonClass.CommonDataBLL.getMaxqishu(); //生成汇款单号 memberOrderModel.RemittancesId = Model.Other.MYDateTime.ToYYMMDDHHmmssString(); //支付状态改为1 memberOrderModel.DefrayState = 1; //电子货币支付时,记录已经支付的金额 new DAL.AddOrderDataDAL().Upd_ECTPay(tran, memberOrderModel.ElectronicaccountId, Convert.ToDouble(memberOrderModel.TotalMoney) * -1); //电子货币支付,则在店汇款中插入记录,最后两个参数需要更改, new DAL.AddOrderDataDAL().AddDataTORemittances1(tran, memberOrderModel); //更新店铺的汇款 new DAL.AddOrderDataDAL().Add_Remittances(tran, Convert.ToDouble(memberOrderModel.TotalMoney) * -1, memberOrderModel.StoreId); }
/// <summary> /// 得到支付货币转换总金额 /// </summary> /// <param name="name">当前货币名称</param> /// <param name="zf_huilv">该货币汇率</param> /// <param name="storeId">店ID</param> /// <param name="zongjing">总计</param> /// <param name="BzMoney">当前金额通过该店汇率得到的金额</param> /// <param name="BzHb">标准货币</param> /// <param name="zfHbId"></param> /// <returns>汇率表对应当前货币的ID</returns> public decimal GetBzMoney(string name, decimal zf_huilv, MemberOrderModel mo) { int BzHb = 0; decimal BzMoney = 0; decimal D_huilv = 0; decimal zfMoney = 0; String sql = "select id from currency where name=@num"; SqlParameter spa = new SqlParameter("@num", SqlDbType.NVarChar, 20); spa.Value = name; mo.PayCurrency = Convert.ToInt32(DBHelper.ExecuteScalar(sql, spa, CommandType.Text)); BzHb = Convert.ToInt32(DBHelper.ExecuteScalar("select distinct StandardMoney from currency")); sql = "select a.Rate from currency a,storeInfo b where a.id=b.currency and b.storeid=@num"; spa = new SqlParameter("@num", SqlDbType.NVarChar, 50); spa.Value = mo.StoreId; D_huilv = Convert.ToDecimal(DBHelper.ExecuteScalar(sql, spa, CommandType.Text)); BzMoney = Convert.ToDecimal((Convert.ToDecimal(mo.TotalMoney) * D_huilv).ToString("0.0000")); zfMoney = Convert.ToDecimal((Convert.ToDecimal(BzMoney / zf_huilv)).ToString("0.0000")); mo.TotalMoney = Convert.ToDecimal(Convert.ToDecimal(mo.TotalMoney) * D_huilv); return(zfMoney); }
public void BindDate() { if (Request.QueryString["orderid"] != null) { string orderid = Request.QueryString["orderid"]; MemberOrderModel mo = MemberOrderDAL.GetMemberOrder(orderid); MemberInfoModel mi = MemberInfoDAL.getMemberInfo(mo.Number); lblxjnumber.Text = mo.Number; lblname.Text = mi.PetName; lblphonenum.Text = mi.MobileTele; //txtplacement.Text = mi.Placement; hiddirect.Value = mi.Direct; txtDirect.Text = mi.Direct; hidorderid.Value = orderid; decimal nowpc = Common.GetnowPrice(); decimal jf = mo.TotalMoney / nowpc * 0.8m; lblkcjb.Text = jf.ToString("0.0000"); decimal bdb = mo.TotalMoney * 0.2m; lblttmoney.Text = bdb.ToString("0.00"); } }
/// <summary> /// 执行存储过程UP_MemberOrder_ADD /// </summary> /// <param name="model"></param> /// <returns>返回成功与否</returns> public int AddOrder(MemberOrderModel model, SqlTransaction tran) { SqlParameter[] para = { new SqlParameter("@Number", model.Number), new SqlParameter("@OrderID", model.OrderId), new SqlParameter("@StoreID", model.StoreId), new SqlParameter("@TotalMoney", model.TotalMoney), new SqlParameter("@TotalPv", model.TotalPv), new SqlParameter("@PayExpect", model.PayExpect), new SqlParameter("@OrderExpect", model.OrderExpect), new SqlParameter("@IsAgain", model.IsAgain), new SqlParameter("@OrderDate", model.OrderDate), new SqlParameter("@Err", model.Err), new SqlParameter("@Remark", model.Remark), new SqlParameter("@DefrayState", model.DefrayState), new SqlParameter("@PayCurrency", model.PayCurrency), new SqlParameter("@PayMoney", model.PayMoney), new SqlParameter("@StandardCurrency", model.StandardCurrency), new SqlParameter("@StandardCurrencyMoney", model.StandardcurrencyMoney), new SqlParameter("@OperateIP", model.OperateIp), new SqlParameter("@OperateNumber", model.OperateNumber), new SqlParameter("@DefrayType", model.DefrayType), new SqlParameter("@CarryMoney", model.CarryMoney), //new SqlParameter("@RemittancesId",model.RemittancesId), //new SqlParameter("@ElectronicAccountId",model.ElectronicaccountId), new SqlParameter("@ordertype", model.OrderType), new SqlParameter("@CCPCCode", CommonDataDAL.GetCPCCode(model.ConCity)), new SqlParameter("@ConAddress", model.ConAddress), new SqlParameter("@ConTelphone", model.ConTelPhone), new SqlParameter("@ConMobilPhone", model.ConMobilPhone), new SqlParameter("@ConPost", model.ConPost), new SqlParameter("@Consignee", model.Consignee), new SqlParameter("@ConZipCode", model.ConZipCode), new SqlParameter("@ElectronicaccountId", model.ElectronicaccountId) }; return(DBHelper.ExecuteNonQuery(tran, "UP_MemberOrder_ADD2", para, CommandType.StoredProcedure)); }
public static void Insert_OrderGoods(IList <MemberDetailsModel> list, MemberOrderModel memberOrderModel, SqlTransaction tran) { //报单生成订单 int count = 0; decimal totalMoney = 0; decimal totalPv = 0; foreach (MemberDetailsModel mDetails in list) { if (mDetails.NotEnoughProduct > 0) { totalMoney += mDetails.NotEnoughProduct * mDetails.Price; totalPv += mDetails.NotEnoughProduct * mDetails.Pv; count++; } } if (count > 0) { string StoreorderId = ""; StoreorderId = BLL.Logistics.OrderGoodsBLL.GetNewOrderID(); OrderGoodsMedel storeItem = new BLL.Registration_declarations.AddOrderBLL().GetOrderModel(StoreorderId, memberOrderModel, tran, totalMoney, totalPv); new BLL.Registration_declarations.AddOrderBLL().OrderSubmit(memberOrderModel.OrderId.ToString(), list, storeItem, tran); } }
/// <summary> /// 确定按钮事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void go_Click(object sender, EventArgs e) { //验证店铺编号 if (TxtStore.Text == "" || TxtStore.Text == null) { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "click", "alert('" + GetTran("006026", "店铺编号不能为空!") + "');", true); return; } //获取用户选择商品的总钱和总积分 IList <MemberDetailsModel> choseProList = AddMemberDetails(); decimal SumMoney = Convert.ToDecimal(ViewState["TotalMoney"]); //Convert.ToDecimal(new RegistermemberBLL().getZongJing(choseProList)); decimal SumPv = Convert.ToDecimal(ViewState["TotalPv"]); //Convert.ToDecimal(new RegistermemberBLL().getZongPv(choseProList)); string orderID = MemberOrderAgainBLL.GetOrderInfo(IsEdit(), GetOrderId()); //获取报单号 MemberOrderModel momberorder = AddOrdrer(orderID, SumMoney, SumPv); //验证店铺是否存在 if (!MemberOrderAgainBLL.CheckStore(TxtStore.Text)) { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "click", "alert('" + GetTran("006027", "店铺编号不存在!") + "');", true); return; } //需要修改session取得期数,需要修改 if (!new RegistermemberBLL().IsMaxQiShu(CommonDataBLL.getMaxqishu())) { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "click", "alert('" + GetTran("001543", "只可对最大期数据进行操作") + "');", true); return; } //得到用户选择商品总金额和总积分 if (choseProList.Count == 0) { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "click", "alert('" + GetTran("001550", "对不起,您还没有输入订货数量信息!") + "');", true); return; } if (Convert.ToBoolean(ViewState["StateCount"])) { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "click", "alert('" + GetTran("007039", "对不起,您选择了停售产品,并且超出了店铺库存数量!") + "');", true); return; } if (panel2.Visible) { //验证国家省份城市是否选择 if (CountryCity1.Country == "" || CountryCity1.Province == "" || CountryCity1.City == "")//|| CountryCity1.Country == "请选择" || CountryCity1.Province == "请选择" || CountryCity1.City == "请选择") { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "click", "alert('" + GetTran("001548", "对不起,请选择国家省份城市!") + "');", true); return; } } if (panel2.Visible) { //详细地址不能为空 if (Txtdz.Text == "") { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "click", "alert('" + GetTran("006933", "对不起,请填写详细地址!") + "');", true); return; } } double notEnoughmoney = new RegistermemberBLL().CheckMoneyIsEnough(choseProList, GetStoreId(), orderID); //不足货物的钱 momberorder.LackProductMoney = Convert.ToDecimal(MemberOrderAgainBLL.GetBzMoney(GetStoreId(), notEnoughmoney));//获得标准币种 //添加订单,跟新会员业绩,和该店库存报单的费用 if (MemberOrderAgainBLL.AddOrderData(IsEdit(), momberorder, choseProList)) { if (!IsEdit()) { double totalmoney = Convert.ToDouble(SumMoney); double totalcomm = 0; double zongMoney = totalmoney + totalcomm; ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "click", "var formobj=document.createElement('form');" + "formobj.action='../payserver/chosepay.aspx?blif=" + EncryKey.GetEncryptstr(momberorder.OrderId, 1, 1) + "';" + "formobj.method='post';formobj.target='_blank';document.body.appendChild(formobj); formobj.submit();location.href='MemberOrder.aspx';", true); //购物车的session if (Session["proList"] != null) { Session.Remove("proList"); } } else { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "click", "alert('" + GetTran("000222", "修改成功!") + "');location.href='membertrade.aspx';", true); } } else { if (!IsEdit()) { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "click", "alert('" + GetTran("001557", "报单失败!") + "');", true); } else { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "click", "alert('" + GetTran("000225", "修改失败!") + "');", true); } } }
/// <summary> /// MemberOrderModel类对象赋值 /// </summary> /// <returns></returns> public MemberOrderModel AddOrdrer(string orderId, decimal totalMoney, decimal totalPv) { MemberOrderModel mo = new MemberOrderModel(); mo.Number = this.Txtbh.Text; mo.OrderId = orderId; mo.StoreId = GetStoreId(); mo.TotalMoney = Convert.ToDecimal(MemberOrderAgainBLL.GetBzMoney(GetStoreId(), Convert.ToDouble(totalMoney)));//获得标准币种 mo.TotalPv = totalPv; mo.OrderExpect = CommonDataBLL.getMaxqishu(); mo.PayExpect = CommonDataBLL.getMaxqishu(); mo.IsAgain = 1; mo.OrderDate = DateTime.Now; mo.Err = ""; mo.Remark = this.Txtbz.Text; mo.DefrayState = 1; mo.PayCurrency = Convert.ToInt32(DropCurrency.SelectedValue); mo.PayMoney = Convert.ToDecimal(MemberOrderAgainBLL.GetBzMoney(GetStoreId(), Convert.ToDouble(totalMoney)) / MemberOrderAgainBLL.GetBzHl(mo.PayCurrency)); mo.StandardCurrency = MemberOrderAgainBLL.GetBzTypeId(GetStoreId()); mo.StandardcurrencyMoney = totalMoney; mo.OperateIp = CommonDataBLL.OperateIP; mo.OperateNumber = GetStoreId(); mo.DefrayType = Convert.ToInt32(this.rdPayType.SelectedValue); mo.CarryMoney = 0; mo.RemittancesId = ""; mo.ElectronicaccountId = this.txtdzbh.Text.Trim(); mo.OrderType = 1; if (panel2.Visible) { mo.ConCity.Country = this.CountryCity1.Country; mo.ConCity.Province = this.CountryCity1.Province; mo.ConCity.City = this.CountryCity1.City; mo.ConAddress = Encryption.Encryption.GetEncryptionAddress(this.Txtdz.Text); } else { string addressRbt = this.rbtAddress.SelectedItem.Text.Trim(); string gas523 = this.rbtAddress.SelectedValue; string[] addr = addressRbt.Split(' '); mo.ConCity.Country = addr[0].ToString(); mo.ConCity.Province = addr[1].ToString(); mo.ConCity.City = addr[2].ToString(); mo.ConAddress = Encryption.Encryption.GetEncryptionAddress(addr[3].ToString()); } mo.ConTelPhone = Encryption.Encryption.GetEncryptionTele(this.Txtjtdh.Text.Trim()); mo.ConMobilPhone = Encryption.Encryption.GetEncryptionTele(this.Txtyddh.Text.Trim()); mo.ConPost = this.Email.Text.Trim(); mo.Consignee = Encryption.Encryption.GetEncryptionName(Txtxm.Text.Trim()); mo.ConZipCode = this.Txtyb.Text.Trim(); mo.SendWay = Convert.ToInt32(DDLSendType.SelectedValue); //如果已经支付的报单 if (IsEdit()) { MemberOrderModel moOld = MemberOrderAgainBLL.GetMemberOrderByOrderId(orderId); mo.OrderDate = moOld.OrderDate; mo.OrderExpect = moOld.OrderExpect; mo.PayExpect = moOld.PayExpect; mo.DefrayState = moOld.DefrayState; mo.IsAgain = moOld.IsAgain; mo.OrderType = moOld.OrderType; } return(mo); }
/// <summary> /// 确定按钮事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void go_Click(object sender, EventArgs e) { //获取用户选择商品的总钱和总积分 IList <MemberDetailsModel> choseProList = AddMemberDetails(); decimal SumMoney = Convert.ToDecimal(ViewState["TotalMoney"]); // Convert.ToDecimal(new RegistermemberBLL().getZongJing(choseProList)); decimal SumPv = Convert.ToDecimal(ViewState["TotalPv"]); // Convert.ToDecimal(new RegistermemberBLL().getZongPv(choseProList)); string orderID = MemberOrderAgainBLL.GetOrderInfo(IsEdit(), GetOrderId()); //获取报单号 MemberOrderModel momberorder = AddOrdrer(orderID, SumMoney, SumPv); //需要修改session取得期数,需要修改 if (!new RegistermemberBLL().IsMaxQiShu(CommonDataBLL.getMaxqishu())) { ScriptManager.RegisterClientScriptBlock(UpdatePanel1, this.GetType(), "click", "alert('" + GetTran("001543", "只可对最大期数据进行操作") + "');", true); return; } //编号不能为空 if (Txtbh.Text == "") { ScriptManager.RegisterClientScriptBlock(UpdatePanel1, this.GetType(), "click", "alert('" + GetTran("001547", "编号不能为空!") + "');", true); return; } if (panel2.Visible) { //验证国家省份城市是否选择 if (CountryCity1.Country == "" || CountryCity1.Province == "" || CountryCity1.City == "")//|| CountryCity1.Country == "请选择" || CountryCity1.Province == "请选择" || CountryCity1.City == "请选择") { ScriptManager.RegisterClientScriptBlock(UpdatePanel1, this.GetType(), "click", "alert('" + GetTran("001548", "对不起,请选择国家省份城市!") + "');", true); return; } } if (panel2.Visible) { //详细地址不能为空 if (Txtdz.Text == "") { ScriptManager.RegisterClientScriptBlock(UpdatePanel1, this.GetType(), "click", "alert('" + GetTran("006933", "对不起,请填写详细地址!") + "');", true); return; } } //编号是否存在 if (new MemberOrderAgainBLL().CheckNuberIsExist(this.Txtbh.Text.Trim()) <= 0) { ScriptManager.RegisterClientScriptBlock(UpdatePanel1, this.GetType(), "click", "alert('" + GetTran("001549", "对不起,该编号不存在!") + "');", true); return; } //得到用户选择商品总金额和总积分 if (choseProList.Count == 0) { ScriptManager.RegisterClientScriptBlock(UpdatePanel1, this.GetType(), "click", "alert('" + GetTran("001550", "对不起,您还没有输入订货数量信息!") + "');", true); return; } if (Convert.ToBoolean(ViewState["StateCount"])) { ScriptManager.RegisterClientScriptBlock(UpdatePanel1, this.GetType(), "click", "alert('" + GetTran("007039", "对不起,您选择了停售产品,并且超出了店铺库存数量!") + "');", true); return; } //电子钱包密码是否正确 if (this.rdPayType.SelectedValue.ToString() == "2") { //用户编号不能为空 if (txtdzbh.Text == "") { ScriptManager.RegisterClientScriptBlock(UpdatePanel1, this.GetType(), "click", "alert('" + GetTran("001551", "对不起,您输入的用户编号!") + "');", true); return; } //电子账户密码不能为空 if (txtdzbh.Text == "") { ScriptManager.RegisterClientScriptBlock(UpdatePanel1, this.GetType(), "click", "alert('" + GetTran("001552", "对不起,您输入的电子账户密码!") + "');", true); return; } //验证电子账户密码 if (!MemberOrderAgainBLL.CheckEctPassWord(txtdzbh.Text, Encryption.Encryption.GetEncryptionPwd(txtdzbh.Text, txtdzmima.Text))) { ScriptManager.RegisterClientScriptBlock(UpdatePanel1, this.GetType(), "click", "alert('" + GetTran("001554", "对不起,您输入的电子账户密码不正确!") + "');", true); return; } } //分析购物条件 double PrevMoney = 0; double StoreLeftMoney = 0; bool judge = true; double notEnoughmoney = new RegistermemberBLL().CheckMoneyIsEnough(choseProList, GetStoreId(), GetOrderId()); string checkResult = MemberOrderAgainBLL.CheckOption(IsEdit(), notEnoughmoney, orderID, GetStoreId(), choseProList, this.rdPayType.SelectedValue.ToString(), out StoreLeftMoney, out PrevMoney, out judge); if (checkResult != null) { ScriptManager.RegisterClientScriptBlock(UpdatePanel1, this.GetType(), "click", checkResult, true); return; } //检查公司逻辑库存 IList <MemberDetailsModel> porList = CommonDataBLL.GetNewOrderDetail1(choseProList); for (int i = 0; i < porList.Count; i++) { int left = BLL.CommonClass.CommonDataBLL.GetLeftLogicProductInventory(Convert.ToInt32(porList[i].ProductId)); if (left < choseProList[i].Quantity) { ScriptManager.RegisterClientScriptBlock(UpdatePanel1, this.GetType(), "click", "alert('" + GetTran("005967", "对不起,公司库存不够") + "!" + porList[i].ProductName + GetTran("005970", "库存数只有") + ":" + left + "');", true); return; } } //电子钱包是否足够 if (this.rdPayType.SelectedValue == "2") { //需要修改 double elcMoney = Convert.ToDouble(CommonDataBLL.EctBalance(this.txtdzbh.Text.Trim())); //如果电子金额少于用户订单总额 if (elcMoney < Convert.ToDouble(momberorder.TotalMoney)) { ScriptManager.RegisterClientScriptBlock(UpdatePanel1, this.GetType(), "click", "alert('" + GetTran("001528", "用户") + this.txtdzbh.Text + GetTran("001529", "的电子钱包不够本次报单!") + "');", true); return; } } //不足货物的钱 momberorder.LackProductMoney = Convert.ToDecimal(MemberOrderAgainBLL.GetBzMoney(GetStoreId(), notEnoughmoney));//获得标准币种 //添加订单,跟新会员业绩,和该店库存报单的费用 if (MemberOrderAgainBLL.AddOrderData(IsEdit(), momberorder, choseProList)) { if (!IsEdit()) { ScriptManager.RegisterClientScriptBlock(UpdatePanel1, this.GetType(), "click", "alert('" + GetTran("001556", "报单成功!") + "');location.href='MemberOrderAgain.aspx';", true); } else { ScriptManager.RegisterClientScriptBlock(UpdatePanel1, this.GetType(), "click", "alert('" + GetTran("000222", "修改成功!") + "');location.href='BrowseMemberOrders.aspx';", true); } } else { if (!IsEdit()) { ScriptManager.RegisterClientScriptBlock(UpdatePanel1, this.GetType(), "click", "alert('" + GetTran("001557", "报单失败!") + "');", true); } else { ScriptManager.RegisterClientScriptBlock(UpdatePanel1, this.GetType(), "click", "alert('" + GetTran("000225", "修改失败!") + "');", true); } } }
public static string UpdateMemberOrder(string OrderId, IList <MemberDetailsModel> list, MemberOrderModel memberOrderModel, string StoreID) { SqlConnection conn = new SqlConnection(DBHelper.connString); MemberOrderModel order = MemberOrderBLL.GetMemberOrder(memberOrderModel.OrderId); SqlTransaction tran = null; try { conn.Open(); tran = conn.BeginTransaction(); SqlCommand cmd = new SqlCommand(); cmd.Transaction = tran; cmd.Connection = conn; DataTable dhpv = DBHelper.ExecuteDataTable(tran, "select totalpv,LackProductMoney from MemberOrder where OrderID='" + OrderId + "'"); if (memberOrderModel.PayExpect != -1 && memberOrderModel.DefrayState == 1) { if (Convert.ToDecimal(dhpv.Rows[0]["totalpv"]) != memberOrderModel.TotalPv) { //修改后需重新结算 cmd.CommandText = "update config set jsflag='0' where ExpectNum>='" + memberOrderModel.PayExpect + "'"; cmd.CommandType = CommandType.Text; cmd.ExecuteNonQuery(); } } if (memberOrderModel.DefrayState == 1) { decimal oldlackproductmoney = Convert.ToDecimal(dhpv.Rows[0]["LackProductMoney"]); if (memberOrderModel.LackProductMoney != oldlackproductmoney) { D_AccountBLL.AddAccount(StoreID, Convert.ToDouble(oldlackproductmoney), D_AccountSftype.StoreType, D_AccountKmtype.OrderUpdateIn, DirectionEnum.AccountsIncreased, "店铺[" + StoreID + "]修改订单[" + order.OrderId + "]退回钱[" + oldlackproductmoney + "]", tran); //D_AccountBLL.AddAccount(StoreID, Convert.ToDouble(memberOrderModel.LackProductMoney), D_AccountSftype.StoreType, D_AccountKmtype.OrderUpdateOut, DirectionEnum.AccountReduced, "店铺[" + StoreID + "]修改订单[" + memberOrderModel.OrderId + "]扣除钱[" + memberOrderModel.LackProductMoney + "]", tran); if (order.DefrayType == 2) { new MemberOrderBLL().IsElecPay(tran, order); D_AccountBLL.AddAccount(order.Number, Convert.ToDouble(order.LackProductMoney), D_AccountSftype.MemberType, D_AccountKmtype.OrderUpdateIn, DirectionEnum.AccountsIncreased, "会员【" + order.Number + "】报单修改现金扣添加,订单号为【" + order.OrderId + "】", tran); D_AccountBLL.AddAccount(order.StoreId, Convert.ToDouble(order.LackProductMoney), D_AccountSftype.StoreType, D_AccountKmtype.OrderUpdateOut, DirectionEnum.AccountReduced, "会员【" + order.Number + "】报单修改现金添加扣,订单号为【" + order.OrderId + "】", tran, true); } } } int res = 0; SqlParameter[] del_parm = { new SqlParameter("@OrderID", OrderId), new SqlParameter("@StoreID", StoreID), new SqlParameter("@Type", 1), new SqlParameter("@res", res), new SqlParameter("@opnum", memberOrderModel.OperateNumber), new SqlParameter("@opip", memberOrderModel.OperateIp), }; BLL.CommonClass.ChangeLogs cl_h_info = new BLL.CommonClass.ChangeLogs("MemberOrder", "ltrim(rtrim(OrderID))"); cl_h_info.AddRecordtran(tran, OrderId); BLL.CommonClass.ChangeLogs cl_h_info1 = new BLL.CommonClass.ChangeLogs("MemberDetails", "ltrim(rtrim(OrderID))"); cl_h_info1.AddRecordtran(tran, OrderId); DBHelper.ExecuteNonQuery(tran, "Delete_H_Order", del_parm, CommandType.StoredProcedure); if (Convert.ToInt32(del_parm[3].Value) == 0) { //添加订单 new AddOrderBLL().SaveHOrder(tran, list, memberOrderModel); cl_h_info.AddRecordtran(tran, OrderId); cl_h_info1.AddRecordtran(tran, OrderId); if (Convert.ToInt32(DAL.DBHelper.ExecuteScalar(tran, "select count(1) from MemberDetails where OrderId='" + OrderId + "'", CommandType.Text)) > 0) { cl_h_info.ModifiedIntoLogstran(tran, ChangeCategory.Order, OrderId, ENUM_USERTYPE.objecttype5); cl_h_info1.ModifiedIntoLogstran(tran, ChangeCategory.Order, OrderId, ENUM_USERTYPE.objecttype5); } tran.Commit(); return("1"); } else { tran.Rollback(); return("-2"); } } catch (Exception ee) { tran.Rollback(); return("-2"); } finally { conn.Close(); conn.Dispose(); } }
protected void gv_browOrder_RowCommand(object sender, GridViewCommandEventArgs e) { string[] args = e.CommandArgument.ToString().Split(':'); if (args.Length != 7) { ScriptHelper.SetAlert(Page, "数据异常"); return; } string orderId = args[0];//报单ID MemberOrderModel mOrderModel = new MemberOrderModel(); MemberInfoModel mInfoModel = null; if (args[5].Trim() == "1") { MemberOrderAgainBLL memberOrderAgainBLL = new MemberOrderAgainBLL(); memberOrderAgainBLL.WriterDataToPage(mOrderModel, args[6], args[0]); } else { mInfoModel = new MemberInfoModel(); AddOrderBLL AddOrderBLL = new AddOrderBLL(); AddOrderBLL.GetDataFormInfoAndOrder(args[1], int.Parse(args[4]), args[6], mInfoModel, mOrderModel); } if (mOrderModel == null) { ScriptHelper.SetAlert(Page, "当前报单已经不存在."); return; } string number = args[1]; string defrayname = args[2]; string payStatus = args[3]; string orderExpectNum = args[4]; string isagain = args[5].ToString(); string storeId = args[6].ToString(); string SqlCon = System.Configuration.ConfigurationManager.ConnectionStrings["connString"].ConnectionString; //如果是修改 if (e.CommandName == "M") { // Permissions.CheckManagePermission(Model.Other.EnumCompanyPermission.BalanceBrowseMemberOrdersEdit); if (payStatus == "0") { //对未支付报单 if (isagain == "0") //未确认注册修改 { //Response.Redirect("RegisterMember.aspx?mode=edit&orderId=" + orderId + "&flag=0&number=" + number + "&StoreID=" + storeId); Response.Redirect("../RegisterUpdate1.aspx?OrderID=" + orderId + "&Number=" + number + "&CssType=3&storeId=" + storeId); } else if (isagain == "1") //未确认复销修改 { Response.Redirect("MemberOrderAgain.aspx?mode=edit&orderId=" + orderId + "&ordertype=" + mOrderModel.OrderType + "&flag=0&number=" + number + "&StoreID=" + storeId); // Response.Redirect("../RegisterUpdate1.aspx?OrderID=" + orderId + "&Number=" + number + "&CssType=3&storeId=" + storeId); } else { return; } } else if (payStatus == "1" && defrayname == "1") { //对已支付报单 if (isagain == "0") //已确认注册修改 { if (mOrderModel.OrderType == 4) { //Response.Redirect("RegisterMember1.aspx?mode=edit&orderId=" + orderId + "&flag=1&number=" + number + "&StoreID=" + storeId + "&except=" + orderExpectNum); Response.Redirect("../RegisterUpdate1.aspx?OrderID=" + orderId + "&Number=" + number + "&CssType=3&storeId=" + storeId + "&tp=1"); } else { //Server.Transfer("RegisterMember.aspx?mode=edit&orderId=" + orderId + "&flag=1&number=" + number + "&StoreID=" + storeId+"&ExceptOld=true"); Response.Redirect("../RegisterUpdate1.aspx?OrderID=" + orderId + "&Number=" + number + "&CssType=3&storeId=" + storeId); } } else if (isagain == "1") //已确认复销修改 { Response.Redirect("MemberOrderAgain.aspx?mode=edit&orderId=" + orderId + "&ordertype=" + mOrderModel.OrderType + "&flag=1&number=" + number + "&StoreID=" + storeId); //Response.Redirect("../RegisterUpdate1.aspx?OrderID=" + orderId + "&Number=" + number + "&CssType=3&storeId=" + storeId); } else { return; } } } }
protected void gv_browOrder_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "P") { string orderid = e.CommandArgument.ToString(); string num = ""; double ttmoney = 0; DataTable dt = DBHelper.ExecuteDataTable("select number,TotalMoney from memberorder where orderid='" + orderid + "'"); if (dt != null && dt.Rows.Count > 0) { DataRow dr = dt.Rows[0]; num = dr["number"].ToString(); ttmoney = Convert.ToDouble(dr["TotalMoney"]); double nep = Convert.ToDouble(DBHelper.ExecuteScalar(" select CoinnewPrice from CoinPlant where CoinIndex = 'CoinE' ")); double nedde = (ttmoney * 0.05) / nep; int choselv = 1; double eblace = Convert.ToDouble(DBHelper.ExecuteScalar("select pointEin -pointEout as r from memberinfo where number='" + num + "'")); if (nedde > eblace) { ScriptHelper.SetAlert(Page, "火星币账户余额不足,不能完成协助支付!"); // btnSearch_Click(null, null); return; } int rr = MemberOrderDAL.PayOrder(num, orderid, 0, 0, 0, nedde, choselv, "USDT账户支付订单,支付中断,后台协助支付"); if (rr == 1) { int ee = MemberOrderDAL.payOrderEcoin(num, orderid, nedde, "E币支付激活,激活成功!"); if (ee == 1) { ScriptHelper.SetAlert(Page, "协助支付成功"); } btnSearch_Click(null, null); return; } else { ScriptHelper.SetAlert(Page, "协助支付失败!"); btnSearch_Click(null, null); return; } } else { ClientScript.RegisterStartupScript(this.GetType(), "", "<script>showsuc('订单不存在!');</script>", false); btnSearch_Click(null, null); return; } } string[] args = e.CommandArgument.ToString().Split(':'); //if (args.Length != 7) //{ // ScriptHelper.SetAlert(Page, this.GetTran("001089", "数据异常")); // return; //} string orderId = args[0];//报单ID MemberOrderModel mOrderModel = new MemberOrderModel(); MemberInfoModel mInfoModel = null; if (args[5].Trim() == "1") { MemberOrderAgainBLL memberOrderAgainBLL = new MemberOrderAgainBLL(); memberOrderAgainBLL.WriterDataToPage(mOrderModel, args[6], args[0]); } else { mInfoModel = new MemberInfoModel(); AddOrderBLL AddOrderBLL = new AddOrderBLL(); AddOrderBLL.GetDataFormInfoAndOrder(args[1], int.Parse(args[4]), args[6], mInfoModel, mOrderModel); } if (mOrderModel == null) { ScriptHelper.SetAlert(Page, this.GetTran("001784", "当前报单已经不存在")); return; } string number = args[1]; string defrayname = args[2]; string payStatus = args[3]; string orderExpectNum = args[4]; string isagain = args[5].ToString(); string storeId = args[6].ToString(); string SqlCon = DAL.DBHelper.connString; if (e.CommandName == "OK") { int selectIndex = ((GridViewRow)((LinkButton)e.CommandSource).NamingContainer).RowIndex; Permissions.CheckManagePermission(Model.Other.EnumCompanyPermission.BalanceBrowseMemberOrdersEdit); if (payStatus == "0") { if (mOrderModel.IsAgain == 0) { string info = MemberOrderAgainBLL.AuditingOrder((sender as LinkButton).CommandArgument.ToString()); if (info == "") { ScriptHelper.SetAlert(Page, "支付成功!"); btnSearch_Click(null, null); } else { ScriptHelper.SetAlert(Page, info); } } else if (mOrderModel.IsAgain == 1) { string info = MemberOrderAgainBLL.AuditingOrder((sender as LinkButton).CommandArgument.ToString()); if (info == "") { ScriptHelper.SetAlert(Page, "支付成功!"); btnSearch_Click(null, null); } else { ScriptHelper.SetAlert(Page, info); } } else { ScriptHelper.SetAlert(Page, this.GetTran("001786", "当前报单是否复销类型不正确.")); return; } } else { ScriptHelper.SetAlert(Page, this.GetTran("001789", "已经确认过的报单单不可再确认.")); return; } btnSearch_Click(null, null); } else if (e.CommandName == "M") { if (payStatus == "0") { Response.Redirect("../RegisterUpdate1.aspx?OrderID=" + orderId + "&Number=" + number + "&CssType=3&storeId=" + storeId); //对未支付报单 if (isagain == "0") //未确认注册修改 { Response.Redirect("../RegisterUpdate1.aspx?OrderID=" + orderId + "&Number=" + number + "&CssType=3&storeId=" + storeId); } else if (isagain == "1") //未确认复销修改 { Response.Redirect("MemberOrderAgain.aspx?mode=edit&orderId=" + orderId + "&ordertype=" + mOrderModel.OrderType + "&flag=0&number=" + number + "&StoreID=" + storeId); } else { return; } } else { ScriptHelper.SetAlert(Page, this.GetTran("000000", "无法对已支付的报单进行修改!")); } } else if (e.CommandName == "D") { //if (payStatus == "0") //{ if (isagain == "0") { Application.Lock(); //注册报单删除 string result = bll.DelMembersDeclaration(number, mInfoModel.ExpectNum, orderId, mOrderModel.StoreId, Convert.ToDouble(mOrderModel.LackProductMoney)); //返回null标识没有产生错误 Application.UnLock(); if (result == null) { result = this.GetTran("000008", "删除成功"); } ScriptHelper.SetAlert(Page, result); } else if (isagain == "1") { Application.Lock(); string result = viewFuXiaoBLL.DelOredrAgain(orderId, double.Parse(mOrderModel.TotalPv.ToString()), number, mOrderModel.OrderExpect, mOrderModel.StoreId); Application.UnLock(); if (result == null) { result = this.GetTran("000008", "删除成功"); } ScriptHelper.SetAlert(Page, result); } btnSearch_Click(null, null); //} //else //{ // // ScriptHelper.SetAlert(Page, this.GetTran("000000", "无法删除已支付的报单!")); //} //btnSearch_Click(null, null); } else if (e.CommandName == "E") { if (payStatus == "1") { string sql = @"UPDATE memberorder SET isSend = 1 WHERE OrderID = @orderId"; SqlParameter[] para = { new SqlParameter("@orderId", orderId) }; int idd = DBHelper.ExecuteNonQuery(sql, para, CommandType.Text); if (idd == 1) { ScriptHelper.SetAlert(Page, "发货成功!"); } else { ScriptHelper.SetAlert(Page, "发货失败!"); } } else { ScriptHelper.SetAlert(Page, this.GetTran("000000", "未付款的报单没法发货!")); } btnSearch_Click(null, null); } }
/// <summary> /// 如果是修改则把数据填充到页面上 /// </summary> /// <param name="memberOrderModel">memberOrderModel类对象</param> /// <param name="storeID">店id</param> /// <param name="orderID">订单Id</param> public void WriterDataToPage(MemberOrderModel memberOrderModel, string storeID, string orderID) { addOrderDataDAL.WriterDataToPage(memberOrderModel, storeID, orderID); }
public static string AuditingOrder(string orderid) { string error = ""; //返回错误信息 MemberOrderModel mo = MemberOrderDAL.GetMemberOrder(orderid); //获取报单信息 List <MemberDetailsModel> list = ViewFuXiaoBLL.GetDetails(mo.OrderId); //获取订单明细 //判断报单是否支付 if (mo.DefrayState != 0) { return(BLL.Translation.Translate("000987", "报单不可重复确认"));// "报单不可重复确认!"; } //验证店铺钱是否够支付保单 double notEnoughmoney = new RegistermemberBLL().CheckMoneyIsEnough(list, mo.StoreId); double storeLeftMoney = new StoreDataDAL().GetLeftRegisterMemberMoney(mo.StoreId); if (storeLeftMoney < notEnoughmoney) { return(BLL.Translation.Translate("006018", "对不起,您的报单额不足!"));// "报单不可重复确认!"; } //更改--报单信息 mo.RemittancesId = MYDateTime.ToYYMMDDHHmmssString(); mo.DefrayState = 1; mo.PayExpect = CommonDataBLL.getMaxqishu(); //double notEnoughmoney = new RegistermemberBLL().CheckMoneyIsEnough(list, mo.StoreId); IList <MemberDetailsModel> listnew = CommonDataBLL.GetNewOrderDetail1(list); for (int i = 0; i < list.Count; i++) { int left = BLL.CommonClass.CommonDataBLL.GetLeftLogicProductInventory(Convert.ToInt32(listnew[i].ProductId)); if (left < listnew[i].Quantity) { return(BLL.Translation.Translate("005967", "对不起,公司库存不够") + "!" + listnew[i].ProductName + BLL.Translation.Translate("005970", "库存数只有") + ":" + left); } } //转化汇率 notEnoughmoney = new RegistermemberBLL().ChangeNotEnoughMoney(mo.StoreId, notEnoughmoney); double EnoughProductMoney = Convert.ToDouble(new RegistermemberBLL().getEnoughProductMoney(list, mo.StoreId)); mo.EnoughProductMoney = Convert.ToInt32(EnoughProductMoney); mo.LackProductMoney = Convert.ToInt32(notEnoughmoney); //拆分组合产品 IList <MemberDetailsModel> md = BLL.CommonClass.CommonDataBLL.GetNewOrderDetail1(list); System.Web.HttpContext.Current.Application.UnLock(); System.Web.HttpContext.Current.Application.Lock(); using (SqlConnection conn = new SqlConnection(DBHelper.connString)) { conn.Open(); SqlTransaction tran = conn.BeginTransaction(); try { //更新会员订单信息 if (!CommonDataBLL.ConfirmMembersOrder(tran, mo.OrderId, mo.PayExpect, mo.EnoughProductMoney, mo.LackProductMoney)) { tran.Rollback(); System.Web.HttpContext.Current.Application.UnLock(); return(BLL.Translation.Translate("000993", "确认失败")); } //更新店铺库存 foreach (MemberDetailsModel memberDetailsModel in list) { //循环根据订单明细跟新库存 int result = ViewFuXiaoBLL.UptStock(tran, memberDetailsModel.StoreId, memberDetailsModel.ProductId, memberDetailsModel.Quantity, memberDetailsModel.NotEnoughProduct); //如果该店铺无盖商品记录,则在店库存表中加记录 if (result <= 0) { new BrowseMemberOrdersBLL().updateStore2(memberDetailsModel, tran); } if (memberDetailsModel.NotEnoughProduct > 0) { if (!CommonDataBLL.ConfirmMembersDetails(tran, memberDetailsModel.ProductId, mo.OrderId, memberDetailsModel.NotEnoughProduct)) { tran.Rollback(); System.Web.HttpContext.Current.Application.UnLock(); return(BLL.Translation.Translate("000993", "确认失败")); } } } //处理公司逻辑库存 int sd = new DAL.AddOrderDataDAL().updateStoreL(tran, md); //报单生成订单 Insert_OrderGoods(list, mo, tran); if (mo.DefrayType == 1) { if (Convert.ToDouble(mo.LackProductMoney) > 0) { //记录对账单明细 BLL.Logistics.D_AccountBLL.AddAccount(mo.StoreId, Convert.ToDouble(mo.LackProductMoney), D_AccountSftype.StoreType, D_AccountKmtype.Declarations, DirectionEnum.AccountReduced, "会员【" + mo.Number + "】报单现金扣除额,订单号为【" + mo.OrderId + "】", tran); } } if (mo.DefrayType == 2) { //记录对账单明细 BLL.Logistics.D_AccountBLL.AddAccount(mo.ElectronicaccountId, Convert.ToDouble(mo.TotalMoney), D_AccountSftype.MemberType, D_AccountKmtype.Declarations, DirectionEnum.AccountReduced, "会员【" + mo.Number + "】用会员【" + mo.ElectronicaccountId + "】电子货币报单,订单号为【" + mo.OrderId + "】", tran); BLL.Logistics.D_AccountBLL.AddAccount(mo.StoreId, Convert.ToDouble(mo.TotalMoney), D_AccountSftype.StoreType, D_AccountKmtype.Declarations, DirectionEnum.AccountsIncreased, "会员【" + mo.Number + "】用会员【" + mo.ElectronicaccountId + "】电子货币报单转入,订单号为【" + mo.OrderId + "】", tran); if (Convert.ToDouble(mo.LackProductMoney) > 0) { BLL.Logistics.D_AccountBLL.AddAccount(mo.StoreId, Convert.ToDouble(mo.LackProductMoney), D_AccountSftype.StoreType, D_AccountKmtype.Declarations, DirectionEnum.AccountReduced, "会员【" + mo.Number + "】报单现金扣除额,订单号为【" + mo.OrderId + "】", tran); } //更新电子账户余额 AddOrderDataDAL.UpdateECTPay(tran, mo.ElectronicaccountId, mo.LackProductMoney); //更新店铺汇款 new AddOrderDataDAL().Add_Remittances(tran, Convert.ToDouble(mo.LackProductMoney), mo.StoreId); //插入汇款信息 new AddOrderDataDAL().AddDataTORemittances(tran, mo); } //更新店铺报单款 new AddOrderDataDAL().updateStore3(mo.StoreId, tran, Convert.ToDouble(mo.LackProductMoney)); //判断是否是注册的会员 if (mo.IsAgain == 0) { //获取会员信息 MemberInfoModel mi = MemberOrderDAL.GetMemberInfo(orderid, tran); //更新会员业绩,会员进入网络图 new AddOrderDataDAL().Upt_UpdateNew1(mi, tran); //激活会员 int resultActive = new GroupRegisterBLL().uptIsActive(mi.Number, tran); } //实时更新会员级别 CommonDataBLL.SetMemberLevel(tran, mo.Number, mo.OrderId); //提交事务 tran.Commit(); } catch (Exception ex) { string sga = ex.Message; error = BLL.Translation.Translate("000993", "确认失败");// "确认失败!"; tran.Rollback(); } finally { conn.Close(); conn.Dispose(); System.Web.HttpContext.Current.Application.UnLock(); } } return(error); }
/// <summary> /// 修改首次报单时读取信息 /// </summary> /// <param name="Number">会员编号</param> /// <param name="OrderExpectNum">最大期数</param> /// <param name="storId">店编号</param> /// <param name="memberInfoModel">MemberInfoModel类对象</param> /// <param name="memberOrderModel">MemberOrderMode类对象</param> public void GetDataFormInfoAndOrder(string Number, int OrderExpectNum, MemberInfoModel memberInfoModel, MemberOrderModel memberOrderModel) { //调用数据层对象 addOrderDataDAL.GetDataFormInfoAndOrder(Number, OrderExpectNum, memberInfoModel, memberOrderModel); }
//-----------------------------显示 /// <summary> /// 查看基本信息 /// </summary> public void SelLblBasic() { lblEnumber.Visible = true; //会员编号 lblEname.Visible = true; //真实姓名 lblEnickname.Visible = true; //会员昵称 lblEstore.Visible = true; //购物店铺 lblEIdtype.Visible = true; //证件类型 lblEsex.Visible = true; //会员性别 lblEbirthday.Visible = true; //出生日期 lblEidnumber.Visible = true; //证件编号 lblEaddress.Visible = true; //联系地址 lblEcode.Visible = true; //邮政编码 lblEmethod.Visible = true; //运货方式 lblEcurrency.Visible = true; //支付币种 labenc.Visible = false; txtEnumber.Visible = false; txtEname.Visible = false; txtEnickname.Visible = false; txtEstore.Visible = false; txtEIdtype.Visible = false; txtEsex.Visible = false; txtEbirthday.Visible = false; txtEidnumber.Visible = false; CountryCityPCode1.Visible = false; txtEaddress.Visible = false; txtEcode.Visible = false; txtEmethod.Visible = false; txtEcurrency.Visible = false; this.lblEbankname.Text = this.lblEname.Text; //tbephoto.Visible = false; //默认的会员编号是 MemberInfoModel model = MemInfoEditBLL.getMemberInfo(ViewState["membernumberE"].ToString()); MemberOrderModel order = MemberOrderBLL.GetMemberOrder(model.OrderID); if (!string.IsNullOrEmpty(model.PhotoPath)) { //string mappath = Server.MapPath(model.PhotoPath); this.imgE.ImageUrl = "~/" + model.PhotoPath; } else { //string mappath = Server.MapPath("pht.GIF"); //this.imgE.ImageUrl = mappath; this.imgE.ImageUrl = "~/images/pht.GIF"; } lblEnumber.Text = model.Number; lblEname.Text = Encryption.Encryption.GetDecipherName(model.Name); lblEnickname.Text = model.PetName; lblEstore.Text = model.StoreID; lblEIdtype.Text = string.IsNullOrEmpty(model.PaperType.PaperType) ? GetTran("000221", "无") : model.PaperType.PaperType; lblEsex.Text = model.Sex == 0 ? GetTran("000095", "女") : GetTran("000094", "男"); lblEbirthday.Text = model.Birthday.ToString("yyyy-MM-dd"); lblEidnumber.Text = Encryption.Encryption.GetDecipherNumber(model.PaperNumber.ToString().Trim()); lblEaddress.Text = model.City.Country + " " + model.City.Province + " " + model.City.City + " " + model.City.Xian + " " + Encryption.Encryption.GetDecipherAddress(model.Address.Trim()); lblEcode.Text = model.PostalCode.ToString(); lblEbankname.Text = Encryption.Encryption.GetDecipherName(model.BankBook); ViewState["Ephtot"] = model.PhotoPath; }
protected void btnEditProduct_Click(object sender, EventArgs e) { if (CountryCity2.CheckFill() == false) { ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('请选择地址!')</script>"); return; } if (Txtdz.Text.Trim() == "") { ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('请填写地址!')</script>"); return; } string OrderId = Request.QueryString["OrderID"].ToString(); string bianhao = Request.QueryString["Number"].ToString(); SqlDataReader hydr = DAL.DBHelper.ExecuteReader("select PayCurrency,DefrayType from MemberOrder where orderid='" + OrderId + "'"); string fukuanMode = ""; int bizhong = 0; if (hydr.Read()) { fukuanMode = hydr["DefrayType"].ToString(); bizhong = Convert.ToInt32(hydr["PayCurrency"]); hydr.Close(); } else { ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('订单不存在')</script>"); return; } string error = ""; //获取用户选择商品的集合 IList <MemberDetailsModel> choseProList = AddMemberDetails(); if (choseProList == null) { ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('" + this.GetTran("000294", "抱歉!购货数量必须输入数字!") + "');</script>", false); return; } if (choseProList.Count == 0 && Request.QueryString["tp"] == "-1") { ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('" + this.GetTran("000296", "抱歉!您还没有选择商品!") + "');</script>", false); return; } if (Convert.ToBoolean(ViewState["StateCount"])) { ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('" + GetTran("007039", "对不起,您选择了停售产品,并且超出了店铺库存数量!") + "');</script>", false); return; } //获得总的购货金额和pv double TotalMoney = registermemberBLL.getZongJing(choseProList); double SumPv = registermemberBLL.getZongPv(choseProList); double bottonLine = new BLL.Registration_declarations.AddOrderBLL().GetBottomLine(); double ce = TotalMoney - bottonLine; if (ce < 0) { ScriptHelper.SetAlert(Page, "报单金额必须大于" + bottonLine.ToString()); return; } //无货总金额 double notEnoughmoney = registermemberBLL.CheckMoneyIsEnough(choseProList, GetStoreID(), OrderId); //if (Ddzf.SelectedValue != "2") //{ // if (notEnoughmoney > Convert.ToDouble(ViewState["dpm"])) // { // ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('店铺报单额不够!')</script>"); // return; // } //} if (this.Ddzf.SelectedValue.ToString() == "2") { string elcNumber = this.txtdzbh.Text.Trim().ToLower(); string elcPassword = Encryption.Encryption.GetEncryptionPwd(this.txtdzmima.Text, elcNumber); string CheckEctResult = registermemberBLL.CheckEctPassWord(this.Ddzf.SelectedValue, elcNumber, elcPassword); if (CheckEctResult != null) { ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('" + CheckEctResult + "');</script>", false); return; } //需要修改 double elcMoney = Convert.ToDouble(CommonDataBLL.EctBalance(txtdzbh.Text.Trim())); //如果电子金额少于用户订单总额 if (elcMoney < Convert.ToDouble(TotalMoney)) { ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('" + GetTran("001528", "用户") + this.txtdzbh.Text.Trim() + GetTran("001529", "的电子钱包不够本次报单!") + "');</script>", false); return; } } //有货总金额 double EnoughProductMoney = 0.00;//Convert.ToDouble(registermemberBLL.getEnoughProductMoney(choseProList, GetStoreID())); int qs = BLL.CommonClass.CommonDataBLL.getMaxqishu(); List <MemberDetailsModel> lmdm = new List <MemberDetailsModel>(); lmdm = (List <MemberDetailsModel>)choseProList; if (Session["mim"] != null) { MemberInfoModel mim = (MemberInfoModel)Session["mim"]; MemberOrderModel mom = new MemberOrderModel(); mom.Number = bianhao; mom.OrderId = OrderId; mom.StoreId = GetStoreID(); mom.TotalMoney = Convert.ToDecimal(MemberOrderAgainBLL.GetBzMoney(GetStoreID(), Convert.ToDouble(TotalMoney)));// Convert.ToDecimal(TotalMoney); mom.TotalPv = Convert.ToDecimal(SumPv); DataTable dtoinfo = RegistermemberBLL.Getmominfoofmember(OrderId); if (dtoinfo != null && dtoinfo.Rows.Count > 0) { mom.CarryMoney = Convert.ToDecimal(dtoinfo.Rows[0]["CarryMoney"]); mom.OrderExpect = Convert.ToInt32(dtoinfo.Rows[0]["OrderExpectNum"]); mom.PayExpect = Convert.ToInt32(dtoinfo.Rows[0]["PayExpectNum"]); mom.Err = ""; mom.IsAgain = Convert.ToInt32(dtoinfo.Rows[0]["IsAgain"]); mom.OrderDate = Convert.ToDateTime(dtoinfo.Rows[0]["OrderDate"]); //DateTime.Now; mom.Remark = ""; mom.DefrayState = Convert.ToInt32(dtoinfo.Rows[0]["DefrayState"]); mom.Consignee = dtoinfo.Rows[0]["Consignee"].ToString(); mom.RemittancesId = dtoinfo.Rows[0]["RemittancesId"].ToString(); mom.ElectronicaccountId = dtoinfo.Rows[0]["ElectronicaccountId"].ToString(); mom.OrderType = Convert.ToInt32(dtoinfo.Rows[0]["OrderType"]); mom.IsreceiVables = Convert.ToInt32(dtoinfo.Rows[0]["DefrayState"]); } CityModel cm = new CityModel(); cm.Country = CountryCity2.Country; cm.Province = CountryCity2.Province; cm.City = CountryCity2.City; cm.Xian = CountryCity2.Xian; mom.ConCity = cm; mom.CCPCCode = mim.CPCCode; mom.ConAddress = Encryption.Encryption.GetEncryptionAddress(Txtdz.Text.Trim()); mom.ConZipCode = mim.PostalCode; mom.ConTelPhone = mim.HomeTele; mom.ConMobilPhone = mim.MobileTele; mom.ConPost = mim.Email; mom.DefrayType = Convert.ToInt32(Ddzf.SelectedValue); mom.DefrayType = Convert.ToInt32(ViewState["DefrayType"]); mom.PayMoney = Convert.ToDecimal(MemberOrderAgainBLL.GetBzMoney(GetStoreID(), Convert.ToDouble(TotalMoney)) / MemberOrderAgainBLL.GetBzHl(Convert.ToInt32(DropCurrency.SelectedValue)));//Convert.ToDecimal(TotalMoney); mom.PayCurrency = Convert.ToInt32(DropCurrency.SelectedValue); mom.StandardCurrency = MemberOrderAgainBLL.GetBzTypeId(GetStoreID()); mom.StandardcurrencyMoney = Convert.ToDecimal(TotalMoney); mom.OperateIp = Request.UserHostAddress; mom.OperateNumber = GetStoreID(); mom.SendType = Convert.ToInt32(ddth.SelectedValue); if (mom.DefrayState == 0) { mom.PaymentMoney = 0; } else { mom.PaymentMoney = Convert.ToDecimal(MemberOrderAgainBLL.GetBzMoney(GetStoreID(), Convert.ToDouble(TotalMoney)) / MemberOrderAgainBLL.GetBzHl(Convert.ToInt32(DropCurrency.SelectedValue))); } mom.ReceivablesDate = Convert.ToDateTime(DBHelper.ExecuteScalar("select ReceivablesDate from MemberOrder where OrderID='" + OrderId + "'")); //DateTime.Now; mom.EnoughProductMoney = Convert.ToDecimal(EnoughProductMoney); mom.LackProductMoney = Convert.ToDecimal(MemberOrderAgainBLL.GetBzMoney(GetStoreID(), Convert.ToDouble(notEnoughmoney))); //获得标准币种Convert.ToDecimal(notEnoughmoney); mom.SendWay = Convert.ToInt32(DDLSendType.SelectedValue); if (Ddzf.SelectedValue == "2") { mom.ElectronicaccountId = this.txtdzbh.Text.Trim(); } if (mom.OperateNumber.Trim().Length == 0) { if (Session["Company"] != null) { mom.OperateNumber = "管理员:" + Session["Company"].ToString(); } } string aa = MemberOrderBLL.UpdateMemberOrder(OrderId, lmdm, mom, GetStoreID()); if (aa == "1") { ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('修改成功');window.location.href=window.location.href+'&date='+new Date().getTime()</script>"); } else { ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('修改失败')</script>"); } } else { ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('登录超时,请重新登录');window.location.href='index.aspx'</script>"); } }
//报单调用的类 public void SaveHOrder(SqlTransaction tran, IList <MemberDetailsModel> list, MemberOrderModel memberOrderModel) { RegistermemberBLL RegistermemberBLL = new RegistermemberBLL(); //添加对账单 if (memberOrderModel.DefrayType == 2) { BLL.Logistics.D_AccountBLL.AddAccount(memberOrderModel.ElectronicaccountId, Convert.ToDouble(memberOrderModel.TotalMoney), D_AccountSftype.MemberType, D_AccountKmtype.Declarations, DirectionEnum.AccountReduced, "会员【" + memberOrderModel.Number + "】用会员【" + memberOrderModel.ElectronicaccountId + "】电子货币报单,订单号为【" + memberOrderModel.OrderId + "】", tran); BLL.Logistics.D_AccountBLL.AddAccount(memberOrderModel.StoreId, Convert.ToDouble(memberOrderModel.TotalMoney), D_AccountSftype.StoreType, D_AccountKmtype.AccountTransfer, DirectionEnum.AccountsIncreased, "会员【" + memberOrderModel.Number + "】用会员【" + memberOrderModel.ElectronicaccountId + "】电子货币报单转入,订单号为【" + memberOrderModel.OrderId + "】", tran); // 电子帐户支付 IsElecPay(tran, memberOrderModel); } AddOrderDataDAL addOrderDataDAL = new AddOrderDataDAL(); //插入memberOrder表 addOrderDataDAL.INSERT_H_Order(memberOrderModel, tran); foreach (Model.MemberDetailsModel mDetails in list) { //插入订单明细 addOrderDataDAL.insert_MemberOrderDetails(memberOrderModel, mDetails, tran); //未支付报单不算库存 if (memberOrderModel.DefrayState == 1) { //更新减去店库存 int result = 0; result = addOrderDataDAL.updateStore(memberOrderModel.StoreId, mDetails, tran); ////添加该类型的记录,用负数表示 if (result <= 0) { addOrderDataDAL.updateStore2(memberOrderModel.StoreId, mDetails, tran); } } } if (memberOrderModel.DefrayState == 1) { //报单生成订单 int count = 0; decimal totalMoney = 0; decimal totalPv = 0; foreach (MemberDetailsModel mDetails in list) { if (mDetails.NotEnoughProduct > 0) { totalMoney += mDetails.NotEnoughProduct * mDetails.Price; totalPv += mDetails.NotEnoughProduct * mDetails.Pv; count++; } } if (count > 0) { string orderId = ""; orderId = BLL.Logistics.OrderGoodsBLL.GetNewOrderID(); //自动为店铺生成要货申请单 OrderGoodsMedel storeItem = GetOrderModel(orderId, memberOrderModel, tran, totalMoney, totalPv); //插入要货申请单明细 OrderSubmit(memberOrderModel.OrderId.ToString(), list, storeItem, tran); } int sd = addOrderDataDAL.updateStoreL(tran, memberOrderModel.OrderId); //添加对账单 if (memberOrderModel.DefrayType == 1 || memberOrderModel.DefrayType == 2) { if (Convert.ToDouble(memberOrderModel.LackProductMoney) > 0) { BLL.Logistics.D_AccountBLL.AddAccount(memberOrderModel.StoreId, Convert.ToDouble(memberOrderModel.LackProductMoney), D_AccountSftype.StoreType, D_AccountKmtype.Declarations, DirectionEnum.AccountReduced, "会员【" + memberOrderModel.Number + "】报单现金扣除额,订单号为【" + memberOrderModel.OrderId + "】", tran); } } //增加该店铺的总报单的费用(累计) addOrderDataDAL.updateStore3(memberOrderModel.StoreId, tran, Convert.ToDouble(memberOrderModel.LackProductMoney)); } }
/// <summary> /// 审核支付报单 /// </summary> /// <param name="orderid"> 报单编号 </param> /// <returns>是否审核成功</returns> public static string AuditingOrder(string orderid) { string error = ""; //返回错误信息 MemberOrderModel mo = MemberOrderDAL.GetMemberOrder(orderid); //获取报单信息 //判断报单是否支付 if (mo.DefrayState != 0) { return("报单不可重复确认!"); } //获得店铺不足货时可以报单的金额 if (mo.DefrayType == 2) { double emoney = new AddOrderDataDAL().HaveMoney(mo.ElectronicaccountId); if (Convert.ToDouble(mo.TotalMoney) > emoney) { return("电子账户余额不足,不能确认!"); } } //更改--报单信息 mo.RemittancesId = MYDateTime.ToYYMMDDHHmmssString(); mo.DefrayState = 1; mo.PayExpect = CommonDataBLL.getMaxqishu(); List <MemberDetailsModel> list = ViewFuXiaoBLL.GetDetails(mo.OrderId);//获取订单明细 using (SqlConnection conn = new SqlConnection(DBHelper.connString)) { conn.Open(); SqlTransaction tran = conn.BeginTransaction(); try { //更新会员订单信息 CommonDataBLL.ConfirmMembersOrder(tran, mo.OrderId, mo.PayExpect); //更新店铺库存 foreach (MemberDetailsModel memberDetailsModel in list) {//循环根据订单明细跟新库存 int result = ViewFuXiaoBLL.UptStock(tran, memberDetailsModel.StoreId, memberDetailsModel.ProductId, memberDetailsModel.Quantity, memberDetailsModel.NotEnoughProduct); //如果该店铺无盖商品记录,则在店库存表中加记录 if (result <= 0) { new BrowseMemberOrdersBLL().updateStore2(memberDetailsModel, tran); } } //更新店铺报单款 new AddOrderDataDAL().updateStore3(mo.StoreId, tran, Convert.ToDouble(mo.TotalMoney)); if (mo.DefrayType == 2) { //更新电子账户余额 AddOrderDataDAL.UpdateECTPay(tran, mo.ElectronicaccountId, mo.TotalMoney); //更新店铺汇款 new AddOrderDataDAL().Add_Remittances(tran, Convert.ToDouble(mo.TotalMoney), mo.StoreId); //插入汇款信息 new AddOrderDataDAL().AddDataTORemittances(tran, mo); } //更新会员业绩 new AddOrderDataDAL().Js_addfuxiao(mo.Number, Convert.ToDouble(mo.TotalPv), mo.PayExpect, mo.DefrayType, tran);//添加网络业绩 //插入订货单 AddOrderGoods(list, tran, mo); //提交事务 tran.Commit(); } catch { error = "确认失败!"; tran.Rollback(); } finally { conn.Close(); } } return(error); }
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="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); } }
/// <summary> /// 添加订单信息 /// </summary> /// <param name="mode"></param> /// <param name="memberOrderModel"></param> /// <param name="totalPv"></param> /// <param name="except"></param> /// <param name="memberDetailsModel"></param> /// <param name="storeInfoModel"></param> public static bool AddOrderData(bool isEdit, MemberOrderModel memberOrderModel, IList <MemberDetailsModel> list) { bool state = false; using (SqlConnection conn = new SqlConnection(DBHelper.connString)) { conn.Open(); SqlTransaction tran = conn.BeginTransaction(); try { //如果是编辑 if (isEdit) { BLL.CommonClass.ChangeLogs cl_h_info = new BLL.CommonClass.ChangeLogs("memberorder", "orderid"); //实例日志类 cl_h_info.AddRecordtran(tran, memberOrderModel.OrderId); //添加日志,修改前记录原来数据 MemberOrderModel order = MemberOrderBLL.GetMemberOrder(memberOrderModel.OrderId); if (order.LackProductMoney > 0) { D_AccountBLL.AddAccount(order.StoreId, Convert.ToDouble(order.LackProductMoney), D_AccountSftype.StoreType, D_AccountKmtype.OrderUpdateIn, DirectionEnum.AccountsIncreased, "会员【" + order.Number + "】报单修改现金扣添加,订单号为【" + order.OrderId + "】", tran); if (order.DefrayType == 2) { new Registration_declarations.MemberOrderAgainBLL().IsElecPay(tran, order); D_AccountBLL.AddAccount(order.Number, Convert.ToDouble(order.LackProductMoney), D_AccountSftype.MemberType, D_AccountKmtype.OrderUpdateIn, DirectionEnum.AccountsIncreased, "会员【" + order.Number + "】报单修改现金扣添加,订单号为【" + order.OrderId + "】", tran); D_AccountBLL.AddAccount(order.StoreId, Convert.ToDouble(order.LackProductMoney), D_AccountSftype.StoreType, D_AccountKmtype.OrderUpdateOut, DirectionEnum.AccountReduced, "会员【" + order.Number + "】报单修改现金添加扣,订单号为【" + order.OrderId + "】", tran, true); } } int delResult = new AddOrderDataDAL().Del_Horder(tran, memberOrderModel.OrderId, memberOrderModel.StoreId, CommonDataBLL.OperateBh, CommonDataBLL.OperateIP); if (memberOrderModel.DefrayState == 1)//店铺复消减去业绩 { int js_delfuxiao_Result = new AddOrderDataDAL().Js_delfuxiao(memberOrderModel.Number, Convert.ToDouble(memberOrderModel.TotalPv), memberOrderModel.PayExpect, memberOrderModel.DefrayState, tran); } cl_h_info.ModifiedIntoLogstran(tran, ChangeCategory.Order, memberOrderModel.OrderId, ENUM_USERTYPE.objecttype5);//插入日志 } //添加订单 new AddOrderBLL().SaveHOrder(tran, list, memberOrderModel); //顾客购物业绩上传(注意支付money要改) if (memberOrderModel.DefrayState == 1) { new AddOrderDataDAL().Js_addfuxiao(memberOrderModel.Number, Convert.ToDouble(memberOrderModel.TotalPv), memberOrderModel.PayExpect, memberOrderModel.DefrayState, tran); CommonDataBLL.SetMemberLevel(tran, memberOrderModel.Number, memberOrderModel.OrderId); } state = true; tran.Commit(); } catch { tran.Rollback(); } finally { conn.Close(); conn.Dispose(); } } return(state); }
/// <summary> /// 删除报单信息 /// </summary> /// <param name="strId">报单编号</param> /// <param name="maxExcept">当前期数</param> /// <returns></returns> public string DelMembersDeclaration(string number, int maxExcept, string orderId, string storeId, double lackproductmoney) { OrderDAL orderDAL = new OrderDAL(); string info = null; MemberOrderModel order = MemberOrderDAL.GetMemberOrder(orderId); BLL.CommonClass.ChangeLogs cl_h_info = new BLL.CommonClass.ChangeLogs("memberinfo", "number"); //申明日志对象 BLL.CommonClass.ChangeLogs cl_h_order = new BLL.CommonClass.ChangeLogs("MemberOrder", "orderId"); //申明日志对象 using (SqlConnection conn = new SqlConnection(DBHelper.connString)) { conn.Open(); SqlTransaction tran = conn.BeginTransaction(); try { //判断会员下是否有安置 //全球统一可以删除有下级的会员,如果有两个下级则注销,有一个下级则紧缩 info = new AddOrderBLL().GetHavePlace(number, tran); if (info != null) { tran.Rollback(); conn.Close(); return(info); } ////判断会员下是否有推荐 info = new AddOrderBLL().GetHaveDirect(number, tran); if (info != null) { tran.Rollback(); conn.Close(); return(info); } int cnt = new AddOrderBLL().GetHaveStore(number, tran); if (cnt > 0) { info = this.GetTran("007097", "抱歉!该会员已经注册店铺,不可以删除!");// "抱歉!该会员有重复消费请先删除重复消费!"; tran.Rollback(); conn.Close(); return(info); } //判断该会员是否有复效单 int result = browsememberordersDAL.GetHasOrderAgain(number); if (result > 0) { info = this.GetTran("000976", "抱歉!该会员有重复消费请先删除重复消费!");// "抱歉!该会员有重复消费请先删除重复消费!"; tran.Rollback(); conn.Close(); return(info); } else { string electronicaccountid = order.ElectronicaccountId;; int defrayState = order.DefrayState; int defrayType = order.DefrayType; //if (defrayState == 1) //{ // if (lackproductmoney > 0) // { // int deliveryflag = BLL.Logistics.D_AccountBLL.GetDeliveryflag(orderId, tran); // if (deliveryflag == 0) // { // if (defrayType == 2) // { // IsElecPay(tran, order); // BLL.Logistics.D_AccountBLL.AddAccount(storeId, lackproductmoney, D_AccountSftype.StoreType, D_AccountKmtype.OrderDelete, DirectionEnum.AccountsIncreased, "会员【" + number + "】报单删除现金返还,订单号为【" + orderId + "】", tran); // BLL.Logistics.D_AccountBLL.AddAccount(electronicaccountid, lackproductmoney, D_AccountSftype.MemberType, D_AccountKmtype.OrderDelete, DirectionEnum.AccountsIncreased, "会员【" + number + "】报单删除现金返还,订单号为【" + orderId + "】", tran); // } // else if (defrayType == 1) // { // BLL.Logistics.D_AccountBLL.AddAccount(storeId, lackproductmoney, D_AccountSftype.StoreType, D_AccountKmtype.OrderDelete, DirectionEnum.AccountsIncreased, "会员【" + number + "】报单删除现金扣添加,订单号为【" + orderId + "】", tran); // } // } // } //} // cl_h_info.DeletedIntoLogstran(tran, CommonClass.ChangeCategory.Order, storeId, BLL.CommonClass.ENUM_USERTYPE.objecttype5); browsememberordersDAL.DelNew(number, maxExcept, tran); //添加日志 cl_h_info.AddRecordtran(tran, number); cl_h_order.AddRecordtran(tran, orderId); cl_h_order.DeletedIntoLogstran(tran, CommonClass.ChangeCategory.Order, storeId, BLL.CommonClass.ENUM_USERTYPE.objecttype5); addOrderDataDAL.Del_Horder(tran, orderId, storeId, CommonDataBLL.OperateBh, CommonDataBLL.OperateIP); ///删除后,把推荐或安置是他的err赋上值 int checkResult = addOrderDataDAL.Check_WhenDelete(tran, number); } tran.Commit(); } catch (Exception ext) { info = this.GetTran("000985", "抱歉!系统异常");// "抱歉!系统异常"; tran.Rollback(); conn.Close(); return(info); } finally { conn.Close(); conn.Dispose(); } } return(info); }
/// <summary> /// 删除会员复销信息 /// </summary> /// <param name="strId">报单编号</param> /// <returns></returns> public string DelMembersDeclaration(string orderId, double totalPv, string number, int except, string storeId, double lackproductmoney) { string info = null; MemberOrderModel order = MemberOrderDAL.GetMemberOrder(orderId); using (SqlConnection conn = new SqlConnection(DAL.DBHelper.connString)) { conn.Open(); SqlTransaction tran = conn.BeginTransaction(); #region 处理组合商品库存 /* * List<MemberDetailsModel> groupItemList2 = new AddOrderBLL().GetDetails(orderId); * List<OrderProduct3> oldSmallItem = new List<OrderProduct3>(); * for (int i = 0; i < groupItemList2.Count; i++) * { * if (groupItemList2[i].IsGroupItem != "") * { * oldSmallItem = new AddMemberInfomDAL().GetSamllItemList(groupItemList2[i].ProductId.ToString()); * for (int j = 0; j < oldSmallItem.Count; j++) * { * int hasOnly = new AddOrderDataDAL().SmallItemIsOnlyInGroup(oldSmallItem[j].Id, orderId); * if (hasOnly <= 0) * { * oldSmallItem[j].Count *= groupItemList2[i].Quantity; * int never = new AddOrderDataDAL().updateStore10(storeId, oldSmallItem[j], tran); * if (never <= 0) * { * tran.Rollback(); * conn.Close(); * conn.Dispose(); * info = BLL.Translation.Translate("001730", "抱歉!系统异常!"); * return info; * } * } * * } * } * }*/ #endregion //如果该订单不存在 if (!BrowsememberordersDAL.CheckOrderIdExists(tran, orderId)) { info = BLL.Translation.Translate("001661", "抱歉,该订单不存在!"); tran.Rollback(); conn.Close(); conn.Dispose(); return(info); } //删除复消单 if (order.DefrayState == 1) { if (lackproductmoney > 0) { D_AccountBLL.AddAccount(storeId, lackproductmoney, D_AccountSftype.StoreType, D_AccountKmtype.OrderDelete, DirectionEnum.AccountsIncreased, "会员【" + number + "】报单删除现金返还,订单号为【" + orderId + "】", tran); } } else if (order.DefrayState == 2) { string electronicaccountid = order.ElectronicaccountId;; if (lackproductmoney > 0) { IsElecPay(tran, order); D_AccountBLL.AddAccount(storeId, lackproductmoney, D_AccountSftype.StoreType, D_AccountKmtype.OrderDelete, DirectionEnum.AccountsIncreased, "会员【" + number + "】报单删除现金返还,订单号为【" + orderId + "】", tran); D_AccountBLL.AddAccount(electronicaccountid, lackproductmoney, D_AccountSftype.MemberType, D_AccountKmtype.OrderDelete, DirectionEnum.AccountsIncreased, "会员【" + number + "】报单删除现金返还,订单号为【" + orderId + "】", tran); } } if (order.DefrayState == 1) { int result = new AddOrderDataDAL().Js_delfuxiao(number, totalPv, except, order.DefrayState, tran); } try { new AddOrderDataDAL().Del_Horder(tran, orderId, storeId, CommonDataBLL.OperateBh, CommonDataBLL.OperateIP); tran.Commit(); } catch (Exception) { tran.Rollback(); info = BLL.Translation.Translate("001730", "抱歉!系统异常!"); } finally { conn.Close(); conn.Dispose(); } } return(info); }