public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; string r = context.Request.Form["Allot"]; if (string.IsNullOrEmpty(r)) { context.Response.Write("分配信息不能为空"); context.Response.End(); } string memo = context.Request.Form["memo"]; int corpId = 0; if (string.IsNullOrEmpty(context.Request.Form["cid"]) || !int.TryParse(context.Request.Form["cid"], out corpId) || corpId <= 0) { context.Response.Write("公司信息错误"); context.Response.End(); } int blocId = 0; if (string.IsNullOrEmpty(context.Request.Form["blocId"]) || !int.TryParse(context.Request.Form["blocId"], out blocId) || blocId <= 0) { context.Response.Write("集团信息错误"); context.Response.End(); } int curId = 0; if (string.IsNullOrEmpty(context.Request.Form["curId"]) || !int.TryParse(context.Request.Form["curId"], out curId) || curId <= 0) { context.Response.Write("币种信息错误"); context.Response.End(); } bool isShare = false; if (string.IsNullOrEmpty(context.Request.Form["isShare"]) || !bool.TryParse(context.Request.Form["isShare"], out isShare)) { context.Response.Write("是否共享信息错误"); context.Response.End(); } NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser; NFMT.Common.ResultModel result = new NFMT.Common.ResultModel(); try { System.Web.Script.Serialization.JavaScriptSerializer serializer = new System.Web.Script.Serialization.JavaScriptSerializer(); List<AllotInfo> allotInfos = serializer.Deserialize<List<AllotInfo>>(r); if (allotInfos == null) { context.Response.Write("分配信息错误"); context.Response.End(); } NFMT.Funds.Model.ReceivableAllot allot = new NFMT.Funds.Model.ReceivableAllot(); allot.AllotDesc = memo; allot.AllotStatus = NFMT.Common.StatusEnum.已录入; allot.AllotTime = DateTime.Now; allot.CurrencyId = curId; allot.EmpId = user.EmpId; NFMT.Funds.Model.CorpReceivable corpRec = new NFMT.Funds.Model.CorpReceivable(); corpRec.BlocId = blocId; corpRec.CorpId = corpId; corpRec.IsShare = isShare; List<NFMT.Funds.Model.RecAllotDetail> details = new List<NFMT.Funds.Model.RecAllotDetail>(); foreach (AllotInfo info in allotInfos) { NFMT.Funds.Model.RecAllotDetail detail = new NFMT.Funds.Model.RecAllotDetail(); detail.AllotBala = info.CanAllotBala; detail.DetailStatus = NFMT.Common.StatusEnum.已生效; detail.RecId = info.ReceivableId; details.Add(detail); } NFMT.Funds.BLL.ReceivableAllotBLL bll = new NFMT.Funds.BLL.ReceivableAllotBLL(); result = bll.CreateCorp(user, allot, details, corpRec); } catch (Exception e) { result.Message = e.Message; } if (result.ResultStatus == 0) result.Message = "分配成功"; context.Response.Write(result.Message); context.Response.End(); }
protected void Page_Load(object sender, EventArgs e) { NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser; string redirectUrl = string.Format("{0}Funds/ReceivableCorpList.aspx", NFMT.Common.DefaultValue.NftmSiteName); System.Web.Script.Serialization.JavaScriptSerializer serializer = new System.Web.Script.Serialization.JavaScriptSerializer(); if (!IsPostBack) { this.navigation1.Routes.Add("公司收款分配", redirectUrl); this.navigation1.Routes.Add("公司收款分配修改", string.Empty); int receivableAllotId = 0; if (string.IsNullOrEmpty(Request.QueryString["id"]) || !int.TryParse(Request.QueryString["id"], out receivableAllotId) || receivableAllotId <= 0) Response.Redirect(redirectUrl); NFMT.Common.ResultModel result = new NFMT.Common.ResultModel(); //获取分配 NFMT.Funds.BLL.ReceivableAllotBLL allotBLL = new NFMT.Funds.BLL.ReceivableAllotBLL(); result = allotBLL.Get(user, receivableAllotId); if (result.ResultStatus != 0) Response.Redirect(redirectUrl); NFMT.Funds.Model.ReceivableAllot recAllot = result.ReturnValue as NFMT.Funds.Model.ReceivableAllot; if (recAllot == null || recAllot.ReceivableAllotId <= 0) Response.Redirect(redirectUrl); this.curRecAllot = recAllot; this.currencyId = recAllot.CurrencyId; //获取分配明细列表 NFMT.Funds.BLL.RecAllotDetailBLL recAllotDetailBLL = new NFMT.Funds.BLL.RecAllotDetailBLL(); result = recAllotDetailBLL.Load(user, recAllot.ReceivableAllotId); if (result.ResultStatus != 0) Response.Redirect(redirectUrl); List<NFMT.Funds.Model.RecAllotDetail> details = result.ReturnValue as List<NFMT.Funds.Model.RecAllotDetail>; if (details == null) Response.Redirect(redirectUrl); foreach (NFMT.Funds.Model.RecAllotDetail d in details) { if (details.IndexOf(d) != 0) { this.curRids += ","; this.curDids += ","; } this.curRids += d.RecId.ToString(); this.curDids += d.DetailId.ToString(); } //获取分配公司明细列表 NFMT.Funds.BLL.CorpReceivableBLL corpReceivalbleBLL = new NFMT.Funds.BLL.CorpReceivableBLL(); result = corpReceivalbleBLL.Load(user, recAllot.ReceivableAllotId); if (result.ResultStatus != 0) Response.Redirect(redirectUrl); List<NFMT.Funds.Model.CorpReceivable> corpDetails = result.ReturnValue as List<NFMT.Funds.Model.CorpReceivable>; if (corpDetails == null) Response.Redirect(redirectUrl); //公司信息 if (corpDetails.Count == 0) Response.Redirect(redirectUrl); NFMT.Funds.Model.CorpReceivable corpDetail = corpDetails[0]; NFMT.User.Model.Corporation corp = NFMT.User.UserProvider.Corporations.FirstOrDefault(temp => temp.CorpId == corpDetail.CorpId); if (corp != null && corp.CorpId > 0) { this.spanBlocId.InnerHtml = corp.BlocName; this.spanCorpCode.InnerHtml = corp.CorpCode; this.spanCorpName.InnerHtml = corp.CorpName; this.spanTaxPlayer.InnerHtml = corp.TaxPayerId; this.spanCorpAddress.InnerHtml = corp.CorpAddress; this.spanCorpTel.InnerHtml = corp.CorpTel; this.spanCorpFax.InnerHtml = corp.CorpFax; this.spanCorpZip.InnerHtml = corp.CorpZip; this.curCorp = corp; } this.isShare = corpDetail.IsShare; result = corpReceivalbleBLL.GetRowsDetail(user, receivableAllotId,NFMT.Common.StatusEnum.已作废); if (result.ResultStatus != 0) Response.Redirect(redirectUrl); System.Data.DataTable dt = result.ReturnValue as System.Data.DataTable; this.curJsonStr = Newtonsoft.Json.JsonConvert.SerializeObject(dt); string json = serializer.Serialize(recAllot); this.hidModel.Value = json; } }