private decimal GetGiftAmountBalance() { decimal giftamountbalance = 0; int month = 0, city = 0, feetype = 0, client = 0, productbrand = 0, giftclassify = 0; feetype = (int)ViewState["GiftFeeType"]; int.TryParse(ddl_ApplyMonth.SelectedValue, out month); int.TryParse(tr_OrganizeCity.SelectValue, out city); int.TryParse(select_Client.SelectValue, out client); int.TryParse(ddl_Brand.SelectedValue, out productbrand); int.TryParse(rbl_GiftClassify.SelectedValue, out giftclassify); IList <ORD_GiftApplyAmount> giftamounts = ORD_GiftApplyAmountBLL.GetModelList( string.Format("AccountMonth={0} AND Client={1} AND Brand={2} AND Classify={3}", month, client, productbrand, giftclassify)); if (giftamounts.Count > 0) { decimal budget = FNA_BudgetBLL.GetUsableAmount(month, city, feetype, false); decimal balance = giftamounts[0].BalanceAmount; giftamountbalance = budget > balance ? balance : budget; } lb_GiftAmountBalance.Text = giftamountbalance.ToString("0.0#"); return(giftamountbalance); }
private void BindBudgetInfo(int city, int month, int client, int feetype, int productbrand, int giftclassify) { decimal totalbudget = FNA_BudgetBLL.GetUsableAmount(month, city, feetype, false); lb_TotalBudget.Text = totalbudget.ToString("0.##"); IList <ORD_GiftApplyAmount> giftamounts = ORD_GiftApplyAmountBLL.GetModelList( string.Format("AccountMonth={0} AND Client={1} AND Brand={2} AND Classify={3}", month, client, productbrand, giftclassify)); ViewState["SalesVolume"] = 0m; if (giftamounts.Count > 0) { decimal available = giftamounts[0].AvailableAmount + giftamounts[0].PreBalance - giftamounts[0].DeductibleAmount;; decimal balance = giftamounts[0].BalanceAmount; ViewState["SalesVolume"] = giftamounts[0].SalesVolume; lb_AvailableAmount.Text = available.ToString("0.##"); lb_BalanceAmount.Text = balance.ToString("0.##"); //2012-3-27 暂时只取赠品额度,不取预算 //lb_BalanceAmount.Text = (totalbudget > balance ? balance : totalbudget).ToString("0.##"); } else { lb_AvailableAmount.Text = "0"; lb_BalanceAmount.Text = "0"; } hl_ViewBudget.NavigateUrl = "~/SubModule/FNA/Budget/BudgetBalance.aspx?OrganizeCity=" + city.ToString(); }
private void BindBudgetInfo(int city, int month, int client, int feetype, int productbrand, int giftclassify, int receiver) { lb_OrganizeCityName.Text = TreeTableBLL.GetFullPathName("MCS_SYS.dbo.Addr_OrganizeCity", city); lb_ClientName.Text = client == 0 ? "" : new CM_ClientBLL(client).Model.FullName; lb_Receiver.Text = (receiver == 0 || receiver == null) ? "" : new CM_ClientBLL(receiver).Model.FullName; decimal totalbudget = FNA_BudgetBLL.GetUsableAmount(month, city, feetype, false); lb_TotalBudget.Text = totalbudget.ToString("0.##"); IList <ORD_GiftApplyAmount> giftamounts = ORD_GiftApplyAmountBLL.GetModelList( string.Format("AccountMonth={0} AND Client={1} AND Brand={2} AND Classify={3}", month, client, productbrand, giftclassify)); if (giftamounts.Count > 0) { decimal available = giftamounts[0].AvailableAmount + giftamounts[0].PreBalance - giftamounts[0].DeductibleAmount; decimal balance = giftamounts[0].BalanceAmount; ViewState["SalesVolume"] = giftamounts[0].SalesVolume; lb_AvailableAmount.Text = available.ToString("0.##"); lb_BalanceAmount.Text = balance.ToString("0.##"); //2012-3-27 暂时只取赠品额度,不取预算 //lb_BalanceAmount.Text = (totalbudget > balance ? balance : totalbudget).ToString("0.##"); } else { lb_AvailableAmount.Text = "0"; lb_BalanceAmount.Text = "0"; } hl_ViewBudget.NavigateUrl = "~/SubModule/FNA/Budget/BudgetBalance.aspx?OrganizeCity=" + city.ToString(); }
private decimal GetGiftAmountBalance() { int id = (int)ViewState["ID"]; FNA_FeeApply apply = new FNA_FeeApplyBLL(id).Model; if (apply == null) { return(0); } decimal giftamountbalance = 0; IList <ORD_GiftApplyAmount> giftamounts = ORD_GiftApplyAmountBLL.GetModelList( string.Format("AccountMonth={0} AND Client={1} AND Brand={2} AND Classify={3}", apply.AccountMonth, apply.Client, apply.ProductBrand, (int)ViewState["GiftFeeClassify"])); if (giftamounts.Count > 0) { decimal budget = decimal.Parse(lb_BudgetBalance.Text); decimal balance = giftamounts[0].BalanceAmount; giftamountbalance = budget > balance ? balance : budget; } lb_GiftAmountBalance.Visible = true; lb_GiftAmountBalance.Text = string.Format("赠品费用可申请额度:{0:0.##}元", giftamountbalance); if (pn_FeeApply.FindControl("FNA_FeeApply_Client") != null) { ((MCSSelectControl)pn_FeeApply.FindControl("FNA_FeeApply_Client")).Enabled = false; } return(giftamountbalance); }
private void BindData() { ORD_GiftApplyAmountBLL amount = new ORD_GiftApplyAmountBLL((int)ViewState["ID"]); gv_List.DataSource = amount.GetChangeHistory(); gv_List.BindGrid(); }
private void BindData() { ORD_GiftApplyAmountBLL applyamount = new ORD_GiftApplyAmountBLL((int)ViewState["ID"]); if (applyamount.Model == null) { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "message", "<script language='javascript'>window.close();</script>", false); } pn_Detail.BindData(applyamount.Model); }
protected void bt_Save_Click(object sender, EventArgs e) { ORD_GiftApplyAmountBLL applyamount = new ORD_GiftApplyAmountBLL((int)ViewState["ID"]); pn_Detail.GetData(applyamount.Model); applyamount.Model.BalanceAmount = decimal.Parse(lbl_BalanceAmount.Text); applyamount.Model["AdjustAmount"] = "0"; applyamount.Model.UpdateStaff = (int)Session["UserID"]; applyamount.Update(); Session["SuccessFlag"] = true; ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "message", "<script language='javascript'>window.close();</script>", false); }
protected void txt_AdjustAmount_TextChanged(object sender, EventArgs e) { ORD_GiftApplyAmountBLL applyamount = new ORD_GiftApplyAmountBLL((int)ViewState["ID"]); decimal adjustAmount = 0; if (decimal.TryParse(txt_AdjustAmount.Text.Trim(), out adjustAmount) && applyamount.Model.SalesVolume > 0) { //txt_FeeRate.Text = Math.Round((applyamount.Model.AvailableAmount + adjustAmount) / applyamount.Model.SalesVolume * 100, 3).ToString("0.###"); } if (lbl_BalanceAmount != null) lbl_BalanceAmount.Text = (applyamount.Model.AvailableAmount + adjustAmount + applyamount.Model.PreBalance - applyamount.Model.AppliedAmount - applyamount.Model.DeductibleAmount).ToString("0.###"); if (txt_AvailableAmount != null) txt_AvailableAmount.Text = (applyamount.Model.AvailableAmount + adjustAmount).ToString("0.###"); }
private void BindGrid() { int organizecity, accoutmonth; int.TryParse(tr_OrganizeCity.SelectValue, out organizecity); int.TryParse(ddl_Month.SelectedValue, out accoutmonth); DataTable dtSummary = ORD_GiftApplyAmountBLL.GetUsedInfo(accoutmonth, organizecity); if (dtSummary.Rows.Count == 0) { gv_List.DataBind(); return; } dtSummary = MatrixTable.Matrix(dtSummary, new string[] { "大区", "省区", "办事处", "代码", "经销商ID", "客户全称" }, new string[] { "ORD_GiftApplyAmount_Brand", "Classify" }, new string[] { "实际销量", "赠品费率%", "本月实销生成可申请额度", "上月余额", "赠品抵扣额", "已申请赠品额度", "还可申请赠品额度" }, false, false); dtSummary.Columns.Add("N.合计→-→含赠品抵扣额费率%"); dtSummary.Columns["N.合计→-→含赠品抵扣额费率%"].SetOrdinal(dtSummary.Columns.Count - 6); foreach (DataRow row in dtSummary.Rows) { if ((decimal)row["N.合计→-→实际销量"] != 0) { row["N.合计→-→含赠品抵扣额费率%"] = (((decimal)row["N.合计→-→已申请赠品额度"] + (decimal)row["N.合计→-→赠品抵扣额"]) / (decimal)row["N.合计→-→实际销量"]).ToString("0.00%"); } else { row["N.合计→-→含赠品抵扣额费率%"] = 0; } } gv_List.DataSource = dtSummary; gv_List.DataBind(); if (dtSummary.Columns.Count >= 24) { gv_List.Width = new Unit(dtSummary.Columns.Count * 55); } else { gv_List.Width = new Unit(100, UnitType.Percentage); } MatrixTable.GridViewMatric(gv_List); }
protected void txt_AdjustAmount_TextChanged(object sender, EventArgs e) { ORD_GiftApplyAmountBLL applyamount = new ORD_GiftApplyAmountBLL((int)ViewState["ID"]); decimal adjustAmount = 0; if (decimal.TryParse(txt_AdjustAmount.Text.Trim(), out adjustAmount) && applyamount.Model.SalesVolume > 0) { //txt_FeeRate.Text = Math.Round((applyamount.Model.AvailableAmount + adjustAmount) / applyamount.Model.SalesVolume * 100, 3).ToString("0.###"); } if (lbl_BalanceAmount != null) { lbl_BalanceAmount.Text = (applyamount.Model.AvailableAmount + adjustAmount + applyamount.Model.PreBalance - applyamount.Model.AppliedAmount - applyamount.Model.DeductibleAmount).ToString("0.###"); } if (txt_AvailableAmount != null) { txt_AvailableAmount.Text = (applyamount.Model.AvailableAmount + adjustAmount).ToString("0.###"); } }
private void LoadGiftApplyAmount() { int month = 0; int client = 0; int.TryParse(ddl_AccountMonth.SelectedValue, out month); int.TryParse(select_Client.SelectValue, out client); if (month > 0 && client > 0) { IList <ORD_GiftApplyAmount> lists = ORD_GiftApplyAmountBLL.GetModelList(string.Format("AccountMonth={0} AND Client={1}", month, client)); if (lists.Count == 0) { ORD_GiftApplyAmountBLL.ComputAvailableAmount(month, client); } int pulishid = 0; int brand = 0; int giftclassify = 0; int.TryParse(ddl_Publish.SelectedValue, out pulishid); if (pulishid > 0) { ORD_ApplyPublishBLL publish = new ORD_ApplyPublishBLL(pulishid); int.TryParse(publish.Model["ProductBrand"], out brand); int.TryParse(publish.Model["GiftClassify"], out giftclassify); lists = ORD_GiftApplyAmountBLL.GetModelList(string.Format("AccountMonth={0} AND Client={1} AND Brand={2} AND Classify={3}", month, client, brand, giftclassify)); if (lists.Count > 0) { lb_GiftApplyAmount.Text = string.Format("销量:{0:0.#元},赠品费率:{1:0.###%},赠品总额度:{2:0.#元}, 赠品额度余额:{3:0.#元}", lists[0].SalesVolume, lists[0].FeeRate, lists[0].AvailableAmount + lists[0].PreBalance - lists[0].DeductibleAmount, lists[0].BalanceAmount); } else { string[] nolimitbrand = Addr_OrganizeCityParamBLL.GetValueByType(1, 24).Replace(" ", "").Split(new char[] { ',', ',', ';', ';' }); lb_GiftApplyAmount.Text = nolimitbrand.Contains(publish.Model["ProductBrand"])?"本品类不限制申请额度":"上月无销量!"; } } } }
private void threadStartImport(BackgroundWorker worker, DoWorkEventArgs e) { bool bFind = false; StringBuilder _xhs_success = new StringBuilder("");//成功导入的记录序号(用于定期批量更新导入标志) string XH = ""; int ClientID = 0, AccountMonth = 0, Brand = 0, Classify = 0,DIClassify=0; decimal PreBalance, DeductibleAmount; try { lb_Count.Text = dt_Amount.Rows.Count.ToString(); for (int i = 0; i < dt_Amount.Rows.Count; i++) { worker.ReportProgress((i + 1) * 100 / this.dt_Amount.Rows.Count, i); if (worker.CancellationPending) { e.Cancel = true; break; } XH = dt_Amount.Rows[i]["序号"].ToString(); IList<CM_Client> _cmlist = CM_ClientBLL.GetModelList("Code='" + dt_Amount.Rows[i]["经销商代码"].ToString() + "' AND ActiveFlag=1 AND ApproveFlag=1"); if (_cmlist.Count == 1) { DIClassify = int.Parse(_cmlist[0]["DIClassify"]); ClientID =DIClassify==3?_cmlist[0].Supplier: _cmlist[0].ID;//经销商为子户头时,取主户头 } else { UpdateImportFlag(i, "导入失败,经销商代码不正确"); continue; } if (dt_Amount.Rows[i]["品牌"].ToString()!= "") { IList<PDT_Brand> _listbrand = PDT_BrandBLL.GetModelList("Name='" + dt_Amount.Rows[i]["品牌"].ToString()+"'"); if (_listbrand.Count == 0) { UpdateImportFlag(i, "导入失败,该品牌不存在"); continue; } else { Brand = _listbrand[0].ID; } } if (dt_Amount.Rows[i]["会计月"].ToString() != "") { IList<AC_AccountMonth> _monthlist = AC_AccountMonthBLL.GetModelList("Name='" + dt_Amount.Rows[i]["会计月"].ToString() + "'"); if (_monthlist.Count == 0) { UpdateImportFlag(i, "导入失败,会计月填写错误"); continue; } else { AccountMonth = _monthlist[0].ID; } } foreach (Dictionary_Data item in DictionaryBLL.Dictionary_Data_GetAlllList("Type IN (SELECT ID FROM MCS_SYS.dbo.Dictionary_Type WHERE TableName='ORD_GiftClassify')")) { if (item.Name == dt_Amount.Rows[i]["有导无导标志"].ToString().Trim()) { Classify = int.Parse(item.Code); bFind = true; break; } } if (!bFind) { UpdateImportFlag(i, "导入失败,有导无导标志错误!"); continue; } IList<ORD_GiftApplyAmount> _listamount = ORD_GiftApplyAmountBLL.GetModelList("AccountMonth=" + AccountMonth.ToString() + " AND Client=" + ClientID.ToString() + " AND Brand=" + Brand.ToString() + " AND Classify=" + Classify.ToString()); if (_listamount.Count == 0) { UpdateImportFlag(i, "导入失败,没有找到符合该条件的赠品余额记录。"); continue; } if (ORD_GiftApplyAmountBLL.GetModelList("AccountMonth=" + (AccountMonth + 1).ToString() + " AND Client=" + ClientID.ToString() + " AND Brand=" + Brand.ToString() + " AND Classify=" + Classify.ToString()).Count > 0) { UpdateImportFlag(i, "导入失败,不能更新历史记录。"); continue; } ORD_GiftApplyAmountBLL _bll = new ORD_GiftApplyAmountBLL(_listamount[0].ID); #region 记录需更新费用 decimal.TryParse(dt_Amount.Rows[i]["赠品抵扣额"].ToString().Trim(), out DeductibleAmount); if (decimal.TryParse(dt_Amount.Rows[i]["上月余额"].ToString().Trim(), out PreBalance)) { if (DIClassify == 1) { _bll.Model.PreBalance = PreBalance; } else { _bll.Model.PreBalance += PreBalance; } } _bll.Model.DeductibleAmount += DeductibleAmount; _bll.Model.BalanceAmount = _bll.Model.AvailableAmount + _bll.Model.PreBalance - _bll.Model.AppliedAmount - _bll.Model.DeductibleAmount; _bll.Update(); dt_Amount.Rows[i]["导入标志"] = "导入成功"; _xhs_success.Append(XH + ","); #endregion } UpdateSuccess(_xhs_success.ToString()); } catch (System.Exception err) { UpdateSuccess(_xhs_success.ToString()); MessageBox.Show(err.Source + "~r~n" + err.StackTrace, err.Message); } return; }
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"); } } }
private void threadStartImport(BackgroundWorker worker, DoWorkEventArgs e) { bool bFind = false; StringBuilder _xhs_success = new StringBuilder("");//成功导入的记录序号(用于定期批量更新导入标志) string XH = ""; int ClientID = 0, AccountMonth = 0, Brand = 0, Classify = 0, DIClassify = 0; decimal PreBalance, DeductibleAmount; try { lb_Count.Text = dt_Amount.Rows.Count.ToString(); for (int i = 0; i < dt_Amount.Rows.Count; i++) { worker.ReportProgress((i + 1) * 100 / this.dt_Amount.Rows.Count, i); if (worker.CancellationPending) { e.Cancel = true; break; } XH = dt_Amount.Rows[i]["序号"].ToString(); IList <CM_Client> _cmlist = CM_ClientBLL.GetModelList("Code='" + dt_Amount.Rows[i]["经销商代码"].ToString() + "' AND ActiveFlag=1 AND ApproveFlag=1"); if (_cmlist.Count == 1) { DIClassify = int.Parse(_cmlist[0]["DIClassify"]); ClientID = DIClassify == 3?_cmlist[0].Supplier: _cmlist[0].ID;//经销商为子户头时,取主户头 } else { UpdateImportFlag(i, "导入失败,经销商代码不正确"); continue; } if (dt_Amount.Rows[i]["品牌"].ToString() != "") { IList <PDT_Brand> _listbrand = PDT_BrandBLL.GetModelList("Name='" + dt_Amount.Rows[i]["品牌"].ToString() + "'"); if (_listbrand.Count == 0) { UpdateImportFlag(i, "导入失败,该品牌不存在"); continue; } else { Brand = _listbrand[0].ID; } } if (dt_Amount.Rows[i]["会计月"].ToString() != "") { IList <AC_AccountMonth> _monthlist = AC_AccountMonthBLL.GetModelList("Name='" + dt_Amount.Rows[i]["会计月"].ToString() + "'"); if (_monthlist.Count == 0) { UpdateImportFlag(i, "导入失败,会计月填写错误"); continue; } else { AccountMonth = _monthlist[0].ID; } } foreach (Dictionary_Data item in DictionaryBLL.Dictionary_Data_GetAlllList("Type IN (SELECT ID FROM MCS_SYS.dbo.Dictionary_Type WHERE TableName='ORD_GiftClassify')")) { if (item.Name == dt_Amount.Rows[i]["有导无导标志"].ToString().Trim()) { Classify = int.Parse(item.Code); bFind = true; break; } } if (!bFind) { UpdateImportFlag(i, "导入失败,有导无导标志错误!"); continue; } IList <ORD_GiftApplyAmount> _listamount = ORD_GiftApplyAmountBLL.GetModelList("AccountMonth=" + AccountMonth.ToString() + " AND Client=" + ClientID.ToString() + " AND Brand=" + Brand.ToString() + " AND Classify=" + Classify.ToString()); if (_listamount.Count == 0) { UpdateImportFlag(i, "导入失败,没有找到符合该条件的赠品余额记录。"); continue; } if (ORD_GiftApplyAmountBLL.GetModelList("AccountMonth=" + (AccountMonth + 1).ToString() + " AND Client=" + ClientID.ToString() + " AND Brand=" + Brand.ToString() + " AND Classify=" + Classify.ToString()).Count > 0) { UpdateImportFlag(i, "导入失败,不能更新历史记录。"); continue; } ORD_GiftApplyAmountBLL _bll = new ORD_GiftApplyAmountBLL(_listamount[0].ID); #region 记录需更新费用 decimal.TryParse(dt_Amount.Rows[i]["赠品抵扣额"].ToString().Trim(), out DeductibleAmount); if (decimal.TryParse(dt_Amount.Rows[i]["上月余额"].ToString().Trim(), out PreBalance)) { if (DIClassify == 1) { _bll.Model.PreBalance = PreBalance; } else { _bll.Model.PreBalance += PreBalance; } } _bll.Model.DeductibleAmount += DeductibleAmount; _bll.Model.BalanceAmount = _bll.Model.AvailableAmount + _bll.Model.PreBalance - _bll.Model.AppliedAmount - _bll.Model.DeductibleAmount; _bll.Update(); dt_Amount.Rows[i]["导入标志"] = "导入成功"; _xhs_success.Append(XH + ","); #endregion } UpdateSuccess(_xhs_success.ToString()); } catch (System.Exception err) { UpdateSuccess(_xhs_success.ToString()); MessageBox.Show(err.Source + "~r~n" + err.StackTrace, err.Message); } return; }
private void BindData() { ORD_GiftApplyAmountBLL applyamount = new ORD_GiftApplyAmountBLL((int)ViewState["ID"]); if (applyamount.Model == null) ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "message", "<script language='javascript'>window.close();</script>", false); pn_Detail.BindData(applyamount.Model); }