private void HandleOrder(int id) { ShowShop.BLL.Order.Orders ordersbll = new ShowShop.BLL.Order.Orders(); ShowShop.Model.Order.Orders ordersModel = ordersbll.GetModel(id); if (ordersModel != null) { ShowShop.BLL.Order.OrderProduct orderProductbll = new ShowShop.BLL.Order.OrderProduct(); DataTable orderProductDT = orderProductbll.GetListOrderProduct(id.ToString()); ShowShop.BLL.Member.MemberAccount memberaccountbll = new ShowShop.BLL.Member.MemberAccount(); ShowShop.Model.Member.MemberAccount memberaccounModel = memberaccountbll.GetModel(ordersModel.UserId); // ShowShop.BLL.Product.ProductSpecification spebll = new ShowShop.BLL.Product.ProductSpecification(); decimal DonateIntegral = 0; if (orderProductDT.Rows.Count > 0) { ShowShop.BLL.Product.ProductInfo productinfoBll = new ShowShop.BLL.Product.ProductInfo(); for (int i = 0; i < orderProductDT.Rows.Count; i++) { ShowShop.Model.Product.ProductInfo productInfoModel = productinfoBll.GetModel(Convert.ToInt32(orderProductDT.Rows[i]["ProId"].ToString())); if (productInfoModel != null) { // DonateIntegral += Convert.ToDecimal(productInfoModel.pro_DonateIntegral); // productinfoBll.Amend(productInfoModel.pro_ID, "pro_SaleNum", productInfoModel.pro_SaleNum + Convert.ToInt32(orderProductDT.Rows[i]["ProNum"].ToString())); if (!string.IsNullOrEmpty(orderProductDT.Rows[i]["Specification"].ToString())) { // List<ShowShop.Model.Product.ProductSpecification> spcList = spebll.GetSpecification(" and ProductId=" + orderProductDT.Rows[i]["ProId"].ToString() + " and Specifications='" + orderProductDT.Rows[i]["Specification"].ToString() + "'"); // if (spcList.Count > 0) // { // spebll.Amend(spcList[0].Id, "ProductStock", Convert.ToInt32(spcList[0].ProductStock) - Convert.ToInt32(orderProductDT.Rows[i]["ProNum"].ToString())); // } } else { //if (Convert.ToInt32(productInfoModel.pro_Stock) >= Convert.ToInt32(orderProductDT.Rows[i]["ProNum"].ToString())) { // productinfoBll.Amend(productInfoModel.pro_ID, "pro_Stock", Convert.ToInt32(productInfoModel.pro_Stock) - Convert.ToInt32(orderProductDT.Rows[i]["ProNum"].ToString())); } } } } //购买商品赠送积分 if (memberaccounModel != null) { if (DonateIntegral > 0) { if (memberaccountbll.Amend(memberaccounModel.UID, "Points", memberaccounModel.Points + DonateIntegral) > 0) { ShowShop.BLL.Member.Integral integralBll = new ShowShop.BLL.Member.Integral(); ShowShop.Model.Member.Integral integral = new ShowShop.Model.Member.Integral(); integral.Userid = memberaccounModel.UID; integral.OrderId = ordersModel.OrderId; integral.IntegralClass = 1; integral.IntegralNum = memberaccounModel.Points + DonateIntegral; integral.GainDate = Convert.ToDateTime(System.DateTime.Now); integral.NoteDate = Convert.ToDateTime(System.DateTime.Now); integral.NoteName = "系统"; integral.Remark = "购买商品后赠送的积分"; integral.IntegralStatus = 0; integral.Origin = "订单"; integralBll.Add(integral); } } } } } }
protected void lbtnSave_Click(object sender, EventArgs e) { ShowShop.BLL.Member.MemberAccount memberBll = new ShowShop.BLL.Member.MemberAccount(); ShowShop.BLL.Order.Orders orderBll = new ShowShop.BLL.Order.Orders(); ShowShop.Model.Order.Orders orderModel = orderBll.GetModel(this.lblOrderId.Text); decimal memberCapital = 0; ShowShop.Model.Admin.AdminInfo adminInfo = (ShowShop.Model.Admin.AdminInfo)ShowShop.Common.AdministrorManager.Get(); if (!memberBll.Exists(this.txtTransferName.Text.Trim())) { this.ltlMsg.Text = "过户失败,不存在用户:" + this.txtTransferName.Text.Trim(); this.pnlMsg.Visible = true; this.pnlMsg.CssClass = "actionErr"; return; } ShowShop.BLL.Order.OrderTransfer bll = new ShowShop.BLL.Order.OrderTransfer(); ShowShop.Model.Order.OrderTransfer model = new ShowShop.Model.Order.OrderTransfer(); model.OrderId = this.lblOrderId.Text; model.UserName = this.lblUserName.Text; model.TransferName = this.txtTransferName.Text; model.PoundAge = Convert.ToDecimal(this.txtPoundAge.Text); model.Remark = this.txtRemark.Text; model.NoteDate = DateTime.Now; model.NoteName = adminInfo.AdminName; model.UpTime = DateTime.Now; #region 计算用户余额 是否能支付过户费 if (this.rabPoundPay.SelectedValue == "0") //订单当前所有者 支付手续费 { ShowShop.Model.Member.MemberAccount memberModel = memberBll.GetModel(this.lblUserId.Text.Trim()); if (memberModel.Capital > Convert.ToDecimal(this.txtPoundAge.Text)) { memberCapital = Convert.ToDecimal(memberModel.Capital - Convert.ToDecimal(this.txtPoundAge.Text)); } else { this.ltlMsg.Text = "过户失败," + this.lblUserId.Text.Trim() + " 资金余额不足"; this.pnlMsg.Visible = true; this.pnlMsg.CssClass = "actionErr"; return; } //更改用户资金状况 memberBll.Amend(memberModel.UID, "Capital", memberCapital); model.PoundAgePayMentPerson = this.lblUserId.Text; } else //过户对象 { ShowShop.Model.Member.MemberAccount memberModel = memberBll.GetModel(this.txtTransferName.Text.Trim()); if (memberModel.Capital > Convert.ToDecimal(this.txtPoundAge.Text)) { memberCapital = Convert.ToDecimal(memberModel.Capital - Convert.ToDecimal(this.txtPoundAge.Text)); } else { this.ltlMsg.Text = "过户失败," + this.txtTransferName.Text.Trim() + " 资金余额不足"; this.pnlMsg.Visible = true; this.pnlMsg.CssClass = "actionErr"; return; } //更改用户资金状况 memberBll.Amend(memberModel.UID, "Capital", memberCapital); model.PoundAgePayMentPerson = this.txtTransferName.Text; } #endregion try { //把原订单所属用户改为现在的用户 orderModel.UserId = this.txtTransferName.Text.Trim(); orderBll.Update(orderModel); bll.Add(model); this.ltlMsg.Text = "操作成功,已保存该信息"; this.pnlMsg.Visible = true; this.pnlMsg.CssClass = "actionOk"; } catch { this.ltlMsg.Text = "操作失败!"; this.pnlMsg.Visible = true; this.pnlMsg.CssClass = "actionErr"; } finally { bll = null; model = null; } }
protected void lbtnSave_Click(object sender, EventArgs e) { /*修改人:YM *修改时间:2009-12-17 *判断订单是否是会员订单及用户是否存在 */ if (this.lblUserName.Text.Trim() == "") { this.ltlMsg.Text = "操作失败!您所支付的订单可能是非会员生成的订单."; this.pnlMsg.Visible = true; this.pnlMsg.CssClass = "actionErr"; return; } ShowShop.Model.Admin.AdminInfo adminInfo = (ShowShop.Model.Admin.AdminInfo)ShowShop.Common.AdministrorManager.Get(); ShowShop.BLL.Member.MemberAccount memberBll = new ShowShop.BLL.Member.MemberAccount(); ShowShop.Model.Member.MemberAccount memberModel = memberBll.GetModel(this.lblUserName.Text); if (memberModel == null) { this.ltlMsg.Text = "操作失败!该会员不存在."; this.pnlMsg.Visible = true; this.pnlMsg.CssClass = "actionErr"; return; } #region 订单预付款资金 ShowShop.Model.Order.PrepayMoney preModel = new ShowShop.Model.Order.PrepayMoney(); ShowShop.BLL.Order.PrepayMoney preBll = new ShowShop.BLL.Order.PrepayMoney(); preModel.OrderId = this.lblOrderId.Text; preModel.UserName = this.lblUserName.Text; preModel.PayoutMoney = Convert.ToDecimal(this.txtPayoutMoney.Text.Trim()); preModel.Remark = this.txtRemark.Text; preModel.BosomNote = this.txtBosomNote.Text; preModel.NoteDate = DateTime.Now; preModel.NoteName = adminInfo.AdminName; #endregion #region 用户交易明细 ShowShop.Model.Member.UserinAndExp userModel = new ShowShop.Model.Member.UserinAndExp(); ShowShop.BLL.Member.UserinAndExp userBll = new ShowShop.BLL.Member.UserinAndExp(); //资金的明细 userModel.UID = memberModel.UID; userModel.AdsumMoneyDate = Convert.ToDateTime(this.txtAdsumMoneyDate.Text); userModel.AdsumMoney = Convert.ToDecimal(this.txtPayoutMoney.Text); userModel.PresentCoupons = 0; userModel.RemitMode = 2; userModel.RemitBank = string.Empty; userModel.Remark = this.txtRemark.Text; userModel.FormMode = string.Empty; //通知方式 userModel.BosomNote = this.txtBosomNote.Text; userModel.NoteDate = DateTime.Now; userModel.NoteName = adminInfo.AdminName; userModel.InComeandExpState = 1; userModel.State = 0; userModel.UserId = this.lblUserName.Text; #endregion #region 订单状态 ShowShop.BLL.Order.Orders orderBll = new ShowShop.BLL.Order.Orders(); ShowShop.Model.Order.Orders orderModel = orderBll.GetModel(this.lblOrderId.Text); #endregion ShowShop.BLL.Member.MemberAccount mabll = new ShowShop.BLL.Member.MemberAccount(); ShowShop.Model.Member.MemberAccount mamodel = mabll.GetModel(this.lblUserName.Text); try { //已付款+此次汇款的总和 decimal payTotail = Convert.ToDecimal(this.GetPayed(this.lblOrderId.Text)) + Convert.ToDecimal(this.txtPayoutMoney.Text.Trim()); #region 如果有多余的钱 if (payTotail > Convert.ToDecimal(orderModel.FactPrice)) { ChangeHope.WebPage.BasePage.PageError("输入的金额大于了订单总额!", "order_bank_pay.aspx?OrderId=" + orderModel.Id); return; } #endregion #region 查询用户金额 操作用户金额 if (mamodel != null) { decimal Price = decimal.Parse(mamodel.Capital.ToString()); if (Convert.ToDecimal(this.txtPayoutMoney.Text) > Price) { ChangeHope.WebPage.BasePage.PageError("用户余额不足!", "order_bank_pay.aspx?OrderId=" + orderModel.Id); return; } mabll.Amend(mamodel.UID, "Capital", (Convert.ToDecimal(mamodel.Capital.ToString()) - Convert.ToDecimal(this.txtPayoutMoney.Text))); } #endregion preBll.Add(preModel); userBll.Add(userModel); #region 操作付款状态 订单状态 int OrderId = ChangeHope.WebPage.PageRequest.GetQueryInt("OrderId"); if (payTotail >= Convert.ToDecimal(orderModel.FactPrice)) { if (OrderId > 0) { orderBll.Amend(OrderId, "OrderStatus", ShowShop.Common.OrdersStatusEnum.OrderStatu.未结清.GetHashCode()); orderBll.Amend(OrderId, "PaymentStatus", ShowShop.Common.OrdersStatusEnum.PaymentStatu.已经付清.GetHashCode()); orderBll.Amend(OrderId, "OgisticsStatus", ShowShop.Common.OrdersStatusEnum.OgisticsStatus.配送中.GetHashCode()); } } else { if (OrderId > 0) { orderBll.Amend(OrderId, "OrderStatus", ShowShop.Common.OrdersStatusEnum.OrderStatu.未结清.GetHashCode()); orderBll.Amend(OrderId, "PaymentStatus", ShowShop.Common.OrdersStatusEnum.PaymentStatu.未付清.GetHashCode()); } } #endregion ChangeHope.WebPage.BasePage.PageRight("已保存该信息", "order_bank_pay.aspx?OrderId=" + orderModel.Id); } catch { this.ltlMsg.Text = "操作失败!"; this.pnlMsg.Visible = true; this.pnlMsg.CssClass = "actionErr"; } finally { adminInfo = null; preModel = null; preBll = null; orderBll = null; orderModel = null; GC.Collect(); } }
protected void lbSave_Click(object sender, EventArgs e) { if (ViewState["to"] == null) { this.ltlMsg.Text = "请选择您要移动到的目标会员组"; this.pnlMsg.Visible = true; this.pnlMsg.CssClass = "actionErr"; return; } ShowShop.BLL.Member.MemberAccount bll = new ShowShop.BLL.Member.MemberAccount(); List<ShowShop.Model.Member.MemberAccount> model = new List<ShowShop.Model.Member.MemberAccount>(); if (rabtnUser.Checked) { if (txtUserName.Text.Trim().Length != 0) { string uid = this.txtUserName.Text.Trim(); if (uid.EndsWith(",")) { uid = uid.Substring(0, uid.LastIndexOf(',')); } //进行拆分 给每个字段加上单引号 string[] arrUid = uid.Split(','); uid = string.Empty; for (int i = 0; i < arrUid.Length; i++) { uid += "'" + arrUid[i] + "'" + ","; } if (uid.EndsWith(",")) { uid = uid.Substring(0, uid.LastIndexOf(',')); } model = bll.GetAll(" UserId in(" + uid + ")"); for (int i = 0; i < model.Count; i++) { bll.Amend(Convert.ToInt32(model[i].UID), "UserGroup", this.lbxTo.SelectedValue); } this.ltlMsg.Text = "操作成功!"; this.pnlMsg.Visible = true; this.pnlMsg.CssClass = "actionOk"; } else { this.ltlMsg.Text = "请输入您要移动的用户"; this.pnlMsg.Visible = true; this.pnlMsg.CssClass = "actionErr"; return; } } //按会员组 批量移动 else if (rabtnGroup.Checked) { if (ViewState["from"] == null) { this.ltlMsg.Text = "请选择您要移动的会员组"; this.pnlMsg.Visible = true; this.pnlMsg.CssClass = "actionErr"; return; } bll.UpdateGroup(this.lbxFrom.SelectedValue, this.lbxTo.SelectedValue); this.ltlMsg.Text = "操作成功!"; this.pnlMsg.Visible = true; this.pnlMsg.CssClass = "actionOk"; } }