/// <summary> /// 搜索订单数据 /// </summary> /// <param name="ordno"></param> /// <param name="debegin"></param> /// <param name="deEnd"></param> /// <param name="ordStatus"></param> /// <returns></returns> public List <Tab_Order4Total> GetOrds(int pgIdx = 1, string ordno = "", DateTime?debegin = null, DateTime?deEnd = null, string ordStatus = "", int pgSize = 10) { bool bTotalCount = true; SqlParameter prmWhr = new SqlParameter("@strWhere", string.Empty); var prmDoCount = new SqlParameter("@doCount", bTotalCount); SqlParameter[] prms = new SqlParameter[] { new SqlParameter("@tblName", "Tab_Order4Total"), new SqlParameter("@strGetFields", "*"), new SqlParameter("@fldName", "DateCreated"), new SqlParameter("@PageSize", pgSize), new SqlParameter("@PageIndex", pgIdx), prmDoCount, new SqlParameter("@OrderType", true),//降序 prmWhr }; string whr = "UserIdx_Fx=" + LoginUser.Idx.ToString(); if (!string.IsNullOrEmpty(ordno)) { whr += " and OrderNo='" + ordno.Replace("'", "''") + "'"; } if (!string.IsNullOrEmpty(ordStatus)) { whr += " and OrderStatus=" + ordStatus; } if (null != debegin) { whr += " and DateCreated>='" + debegin.Value.ToString("yyyy-MM-dd HH:mm:ss") + "'"; } if (null != deEnd) { whr += " and DateCreated<='" + deEnd.Value.ToString("yyyy-MM-dd HH:mm:ss") + "'"; } prmWhr.SqlValue = whr; var totalPgCount = Int32.Parse(SqlHelper.ExecuteScalar(CommandType.StoredProcedure, "P_Y_Pagination", prms).ToString()); prmDoCount.SqlValue = false; var ds = SqlHelper.ExecuteDataset(CommandType.StoredProcedure, "P_Y_Pagination", prms); if (null == ds || ds.Tables == null || ds.Tables.Count < 1) { return(null); } return(Tab_Order4Total.ToModel(ds.Tables[0], totalPgCount)); }
protected void Page_Load(object sender, EventArgs e) { VerfiyAdmin.CheckVIPUserLogin(this); UserAvaPoint = VerfiyAdmin.LoginUser.AvailablePoints; if (!IsPostBack) { var Id = 0; var idx = Request["Id"]; if (string.IsNullOrEmpty(idx) || !Int32.TryParse(idx, out Id)) { return; } var et = new Tab_Order4Total().Get(Id.ToString()); if (null == et) { return; } lblOrdNo.Text = et.OrderNo; var usr = VerfiyAdmin.LoginUser; if (null == usr) { return; } lblMail.Text = usr.UserEmail; var counter = new Tab_Order1Counter().Get(et.CounterIdx.ToString()); if (null == counter) { return; } lblCounterName.Text = counter.CounterName; lblCounterPhone.Text = counter.CounterPhone; lblAddr.Text = counter.CounterAddr; } //子订单数据获取应该从库中来 //柜台 }
protected void Page_Load(object sender, EventArgs e) { VerfiyAdmin.CheckVIPUserLogin(this); UserAvaPoint = VerfiyAdmin.LoginUser.AvailablePoints; if (!IsPostBack) { var usr = VerfiyAdmin.LoginUser; if (null == usr) { return; } lblAddr.Text = usr.Address; lblRealName.Text = usr.RealName; lblProv.Text = usr.Province; lblCity.Text = usr.City; lblMail.Text = usr.UserEmail; lblMobile.Text = usr.MobilePhone; lblPostCode.Text = usr.ZipCode; } else//提交 { //1.检查积分兑换商品是否超出积分了 //2.保存相关数据至订单主从表中 //3.扣减当前会员可用积分 var gifts = VerfiyAdmin.GetGiftCart(); if (null == gifts || gifts.Count < 1) { return; } var payforPoint = gifts.Sum(k => k.GiftCount * k.PerGiftData.NeedPoint); //得到总共兑换礼品需要消耗的积分总数 var counterIdx = Request["counterIdx"]; //柜台 int ctridx = -1; bool b = Int32.TryParse(counterIdx, out ctridx); if (string.IsNullOrEmpty(counterIdx) || !b) //柜台未选择 { Cmn.Js.ShowAlert("你还没有选择兑换礼品的柜台!"); return; } var usr = VerfiyAdmin.LoginUser; if (null == usr) { return; } if (usr.AvailablePoints - payforPoint <= 0)//积分不足 { Cmn.Js.ShowAlert("你的可用积分不足以兑换所有礼品!"); return; } var OrdNo = VerfiyAdmin.GenGiftOrderNo();//订单号 var OrdIdx = new Tab_Order4Total().AddNew(new Tab_Order4Total { OrderNo = OrdNo, OrderStatus = string.Empty, CounterNo = string.Empty, //柜台号 CounterIdx = Int32.Parse(counterIdx), //柜台IDX DateCreated = DateTime.Now, SourcesData = SourcesDataSTR, TotalPoints = payforPoint, UserIdx_Fx = usr.Idx }); var subOrd = new Tab_Order3Detail(); //创建子订单数据 foreach (var item in gifts) { subOrd.AddNew(new Tab_Order3Detail { CreatedDate = DateTime.Now, GiftCount = item.GiftCount, GiftIdx_Fx = item.GiftIdx, NeedPoint = item.PerGiftData.NeedPoint, OrdersIdx_Fx = OrdIdx, OrderStatus = string.Empty, OrderUUID = Guid.NewGuid(), SourcesData = SourcesDataSTR, CounterIdx_Fx = counterIdx,//柜台IDX }); } //扣减当前会员可用积分 SqlHelper.ExecuteNonQuery(CommandType.Text, Sql_UpdateUsrPoint, new SqlParameter("@prm", payforPoint), new SqlParameter("@idx", VerfiyAdmin.LoginUser.Idx)); Session[VerfiyAdmin.LoginUserKey] = new Tab_UserCommunity().Get(VerfiyAdmin.LoginUser.Idx.ToString()); //发送邮件 VerfiyAdmin.SendGiftOrderMail(OrdNo); Response.Redirect("fexchange_success.aspx?Id=" + OrdIdx.ToString()); } }