/// <summary> /// 设置页面gv_ProductList控件中,调整金额是否只读 /// </summary> protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { #region 判断传入参数是否为SheetCode if (Request.QueryString["SheetCode"] != null) { string code = Request.QueryString["SheetCode"]; IList <ORD_OrderApply> list = ORD_OrderApplyBLL.GetModelList("SheetCode='" + code + "'"); if (list.Count > 0) { Response.Redirect("OrderProductApplyDetail.aspx?ID=" + list[0].ID.ToString()); } else { Response.Redirect("OrderApplyList.aspx"); } } #endregion ViewState["ID"] = Request.QueryString["ID"] == null ? 0 : int.Parse(Request.QueryString["ID"]); ViewState["Product"] = 0; #region 创建空的列表 ListTable <ORD_OrderApplyDetail> _details = new ListTable <ORD_OrderApplyDetail>(new ORD_OrderApplyBLL((int)ViewState["ID"]).Items, "Product"); ViewState["Details"] = _details; #endregion if ((int)ViewState["ID"] != 0) { BindData(); } Header.Attributes["WebPageSubCode"] = "Type=" + ViewState["Type"].ToString(); } }
protected void bt_Submit_Click(object sender, EventArgs e) { if (!Save()) { return; } if ((int)ViewState["ID"] != 0) { ORD_OrderApplyBLL bll = new ORD_OrderApplyBLL((int)ViewState["ID"]); Session["SubmitOrderApplyID"] = (int)ViewState["ID"]; if (bll.Model.State > 1) { Response.Redirect("OrderApplyList.aspx"); } if (bll.Items.Count == 0) { MessageBox.ShowAndRedirect(this, "对不起,定单申请明细不能为空!", "OrderApplyDetail3.aspx?ID=" + ViewState["ID"].ToString()); return; } if (bll.Model.AccountMonth < AC_AccountMonthBLL.GetCurrentMonth()) { MessageBox.Show(this, "对不起,该订单申请月份已不是当前月份,已不可提交,请删除该单后重新申请赠品!"); return; } decimal totalcost = bll.Items.Sum(m => m.BookQuantity * m.Price); if (bll.Model.Type == 2) { //促销品申请 #region 判断预算额度余额是否够申请 ORD_ApplyPublish publish = new ORD_ApplyPublishBLL(bll.Model.PublishID).Model; int productbrand = 0, giftclassify = 0; int.TryParse(publish["ProductBrand"], out productbrand); int.TryParse(publish["GiftClassify"], out giftclassify); decimal _budgetbalance = FNA_BudgetBLL.GetUsableAmount(bll.Model.AccountMonth, bll.Model.OrganizeCity, publish.FeeType); decimal _productbalance = ORD_GiftApplyAmountBLL.GetBalanceAmount(bll.Model.AccountMonth, bll.Model.Client, productbrand, giftclassify); decimal _balance = _productbalance; //2012-3-27 暂时限定赠品额度,不限定预算 //decimal _balance = (_budgetbalance > _productbalance ? _productbalance : _budgetbalance); string[] nolimitbrand = Addr_OrganizeCityParamBLL.GetValueByType(1, 24).Replace(" ", "").Split(new char[] { ',', ',', ';', ';' }); if (_balance < totalcost && !nolimitbrand.Contains(publish["ProductBrand"])) { if (bll.Model["GiftClassify"] == "2" && _balance > 0 && ORD_OrderApplyBLL.GetModelList("Client=" + bll.Model.Client.ToString() + " AND AccountMonth=" + bll.Model.AccountMonth.ToString() + " AND State IN (2,3) AND MCS_SYS.dbo.UF_Spilt(ExtPropertys,'|',5)=" + bll.Model["ProductBrand"] + " AND MCS_SYS.dbo.UF_Spilt(ExtPropertys,'|',7)=" + bll.Model["GiftClassify"]).Count == 0) { //判断是否可以申请最低金额赠品1件 decimal MinApplyAmount = 0, MaxApplyAmount = 0; ORD_ApplyPublishBLL _publishbll = new ORD_ApplyPublishBLL(bll.Model.PublishID); _publishbll.GetMinApplyAmount(out MinApplyAmount, out MaxApplyAmount); if (_balance > 0 && _balance < MinApplyAmount) { if (bll.Items.Count > 1) { MessageBox.Show(this, "对不起,您当前的可申请余额不足,仅能申请最多1件赠品"); return; } else { int applyproduct = bll.Items[0].Product; ORD_ApplyPublishDetail applydetail = _publishbll.Items.FirstOrDefault(p => p.Product == applyproduct); if (applydetail != null && applydetail.MinQuantity < bll.Items[0].BookQuantity) { MessageBox.Show(this, "对不起,您当前的可申请余额不足,仅能申请最多1件赠品"); return; } } } else { MessageBox.ShowAndRedirect(this, "对不起,您当前的可申请余额[" + _balance.ToString("0.##") + "]不够申请这些品项!", "OrderApplyDetail3.aspx?ID=" + ViewState["ID"].ToString()); return; } } else { MessageBox.ShowAndRedirect(this, "对不起,您当前的可申请余额[" + _balance.ToString("0.##") + "]不够申请这些品项!", "OrderApplyDetail3.aspx?ID=" + ViewState["ID"].ToString()); return; } } #endregion #region 发起工作流 NameValueCollection dataobjects = new NameValueCollection(); dataobjects.Add("ID", ViewState["ID"].ToString()); dataobjects.Add("OrganizeCity", bll.Model.OrganizeCity.ToString()); dataobjects.Add("AccountMonth", bll.Model.AccountMonth.ToString()); dataobjects.Add("FeeType", publish.FeeType.ToString()); dataobjects.Add("ProductBrand", publish["ProductBrand"]); dataobjects.Add("GiftClassify", publish["GiftClassify"]); dataobjects.Add("TotalFee", totalcost.ToString()); int TaskID = EWF_TaskBLL.NewTask("CuXiaoPin_Apply", (int)Session["UserID"], "促销品申请申请流程", "~/SubModule/Logistics/Order/OrderApplyDetail3.aspx?ID=" + ViewState["ID"].ToString() + "&Type=2", dataobjects); new EWF_TaskBLL(TaskID).Start(); #endregion bll.Submit((int)Session["UserID"], TaskID); Response.Redirect("~/SubModule/EWF/TaskDetail.aspx?TaskID=" + TaskID.ToString()); } else { //产品申请申请 bll.Submit((int)Session["UserID"], 0); Response.Redirect("OrderApplyList.aspx"); } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { #region 判断传入参数是否为SheetCode if (Request.QueryString["SheetCode"] != null) { string code = Request.QueryString["SheetCode"]; IList <ORD_OrderApply> list = ORD_OrderApplyBLL.GetModelList("SheetCode='" + code + "'"); if (list.Count > 0) { Response.Redirect("OrderProductApplyDetail.aspx?ID=" + list[0].ID.ToString()); } else { Response.Redirect("OrderApplyList.aspx"); } } #endregion ViewState["ID"] = Request.QueryString["ID"] == null ? 0 : int.Parse(Request.QueryString["ID"]); BindDropDown(); ViewState["Product"] = 0; #region 创建空的列表 ListTable <ORD_OrderApplyDetail> _details = new ListTable <ORD_OrderApplyDetail>(new ORD_OrderApplyBLL((int)ViewState["ID"]).Items, "Product"); ViewState["Details"] = _details; #endregion if (Session["LogisticsOrderApplyDetail"] != null && (int)ViewState["ID"] == 0) { #region 新费用申请时,初始化申请信 ORD_OrderCartBLL cart = (ORD_OrderCartBLL)Session["LogisticsOrderApplyDetail"]; ORD_OrderApply model = new ORD_OrderApply(); if (cart.Client != 0) { model.OrganizeCity = new CM_ClientBLL(cart.Client).Model.OrganizeCity; model.Client = cart.Client; } model.InsertStaff = (int)Session["UserID"]; model.InsertTime = DateTime.Now; model["IsSpecial"] = cart.IsSpecial.ToString(); model.Type = cart.Type; ViewState["Type"] = cart.Type; model["ProductBrand"] = cart.Brand.ToString(); model["ProductType"] = cart.OrderType.ToString(); if (cart.OrderType != 1) { priceEnable = true; } model.AccountMonth = AC_AccountMonthBLL.GetCurrentMonth(); ORD_OrderLimitFactorBLL limitbll = new ORD_OrderLimitFactorBLL(); ViewState["Limit"] = limitbll.GetLimitInfo(Convert.ToInt32(model.AccountMonth), cart.Client); bt_Submit.Visible = false; foreach (ORD_OrderCart item in cart.Items) { ORD_OrderApplyDetail _detailmodel = new ORD_OrderApplyDetail(); _detailmodel.Price = item.Price; _detailmodel.Product = item.Product; _detailmodel.BookQuantity = item.BookQuantity; _details.Add(_detailmodel); } ViewState["Details"] = _details; pn_OrderApply.BindData(model); BindGrid(); #endregion } else { BindData(); } Header.Attributes["WebPageSubCode"] = "Type=" + ViewState["Type"].ToString(); } }