protected void Page_Load(object sender, EventArgs e) { if (!base.IsPostBack) { DataTable dataTable = new DataTable(); if (string.Compare(this.action, "Add", true) == 0) { this.InintAddState(); this.modifyStockAction = "add"; dataTable = this.purchaseStock.GetPurchaseStockByContractId(this.contractId, false); DataColumn dataColumn = new DataColumn("ModifyStockId", typeof(string)); dataColumn.DefaultValue = string.Empty; dataTable.Columns.Add(dataColumn); this.hfldBudModifyId.Value = Guid.NewGuid().ToString(); } else { this.InitUpdateState(); this.modifyStockAction = "edit"; dataTable = this.purchaseStock.GetModifyStockByContractId(this.contractId, this.modifyId); ConPayoutModifyService conPayoutModifyService = new ConPayoutModifyService(); ConPayoutModify byId = conPayoutModifyService.GetById(this.modifyId); if (byId != null && !string.IsNullOrEmpty(byId.BudModifyId)) { this.hfldBudModifyId.Value = byId.BudModifyId; } else { this.hfldBudModifyId.Value = Guid.NewGuid().ToString(); } this.InitBudTask(); } this.ViewState["modifyStockAction"] = this.modifyStockAction; this.ViewState["resource"] = dataTable; this.DataBindPurchaseplanStock(); string conPurchasePcode = this.purchase.GetConPurchasePcode(this.contractId); if (string.IsNullOrEmpty(conPurchasePcode)) { this.divPurchase.Style.Add("display", "none"); } this.FileLink1.MID = 1902; this.FileLink1.FID = this.hfldModifyId.Value; this.FileLink1.Type = 1; this.hfldIsWBSRelevance.Value = ConfigurationManager.AppSettings["IsWBSRelevance"]; List <BudModifyTask> list = ( from mt in this.modifyTaskSer where mt.ModifyId == this.hfldBudModifyId.Value select mt).ToList <BudModifyTask>(); if (this.hfldIsWBSRelevance.Value == "1") { foreach (BudModifyTask current in list) { this.BindModifyTaskRes(current.ModifyTaskId); } } } }
protected void btnSave_Click(object sender, EventArgs e) { if (string.Compare(this.action, "Add", true) == 0) { this.AddContractModify(); ConPayoutModifyService conPayoutModifyService = new ConPayoutModifyService(); ConPayoutModify byId = conPayoutModifyService.GetById(this.hfldModifyId.Value); byId.BudModifyId = this.hfldBudModifyId.Value; conPayoutModifyService.Update(byId); } else { if (string.Compare(this.action, "Update", true) == 0) { this.UpdateContractModify(); } } this.UpdateModifyTask(); }
public void CommitEvent(object key) { BudModifyService service = new BudModifyService(); BudTaskService service2 = new BudTaskService(); BudModifyTaskService service3 = new BudModifyTaskService(); BudTaskResourceService service4 = new BudTaskResourceService(); ConPayoutModifyService service5 = new ConPayoutModifyService(); string modifyId = key.ToString(); BudModify budmodify = (from r in service where r.ModifyId == modifyId select r).FirstOrDefault <BudModify>(); ConPayoutModify item = (from r in service5 where r.BudModifyId == modifyId select r).FirstOrDefault <ConPayoutModify>(); if (item != null) { item.FlowState = 1; service5.Update(item); } using (List <BudModifyTask> .Enumerator enumerator = (from p in service3 where p.ModifyId == budmodify.ModifyId select p).ToList <BudModifyTask>().GetEnumerator()) { BudModifyTask taskx; while (enumerator.MoveNext()) { taskx = enumerator.Current; cn.justwin.Domain.Entities.BudTask task = (from p in service2 where p.TaskId == taskx.TaskId select p).FirstOrDefault <cn.justwin.Domain.Entities.BudTask>(); if ((task != null) && (budmodify.Flowstate == 1)) { if (taskx.ModifyType == 0) { task.IsValid = true; service2.Update(task); service3.UpdateTotal2(taskx.ModifyTaskId); } if ((task.ModifyId != task.ModifyId) || (taskx.ModifyType == 1)) { task.ModifyId = task.ModifyId; if (!task.Total2.HasValue) { task.Total2 = 0; } if (!task.Quantity.HasValue) { task.Quantity = 0; } task.Total2 = new decimal?(Convert.ToDecimal(task.Total2) + Convert.ToDecimal(task.Total2)); task.Quantity = new decimal?(Convert.ToDecimal(task.Quantity) + Convert.ToDecimal(task.Quantity)); if (task.Quantity != 0M) { task.UnitPrice = task.Total2 / task.Quantity; } service2.Update(task); service3.UpdateTotal2(taskx.ModifyTaskId); } } } } if (ConfigHelper.Get("BudgetRequireDiff") != "0") { string str2 = ConfigHelper.Get("IsWBSRelevance"); BudModify byId = service.GetById(key.ToString()); service2.DeleteYearMonthByPrj(byId.PrjId); IList <cn.justwin.Domain.Entities.BudTask> byProject = service2.GetByProject(byId.PrjId, 0x3e7); IList <int> years = service2.GetYears(byId.PrjId); if (years != null) { foreach (int num in years) { IList <cn.justwin.Domain.Entities.BudTask> yearTask = service2.GetYearTask(byProject, num); foreach (cn.justwin.Domain.Entities.BudTask task2 in yearTask) { service2.Add(task2); } foreach (int num2 in service2.GetMonths(yearTask, num)) { foreach (cn.justwin.Domain.Entities.BudTask task3 in service2.GetMonthTasks(yearTask, num, num2)) { service2.Add(task3); } } } if (str2 == "1") { service4.AddTaskResource(byId.PrjId); } } } }
protected void Page_Load(object sender, EventArgs e) { if (!base.IsPostBack) { this.hfldIsWBSRelevance.Value = this.isWBSRelevance; List <BudModifyTask> list = new List <BudModifyTask>(); DataTable dataTable = new DataTable(); if (string.Compare(this.action, "Add", true) == 0) { this.InintAddState(); this.modifyStockAction = "add"; dataTable = this.purchaseStock.GetPurchaseStockByContractId(this.contractId, false); DataColumn dataColumn = new DataColumn("ModifyStockId", typeof(string)); dataColumn.DefaultValue = string.Empty; dataTable.Columns.Add(dataColumn); this.hfldBudModifyId.Value = Guid.NewGuid().ToString(); } else { this.InitUpdateState(); this.modifyStockAction = "edit"; dataTable = this.purchaseStock.GetModifyStockByContractId(this.contractId, this.modifyId); ConPayoutModifyService conPayoutModifyService = new ConPayoutModifyService(); ConPayoutModify byId = conPayoutModifyService.GetById(this.modifyId); if (byId != null && !string.IsNullOrEmpty(byId.BudModifyId)) { this.hfldBudModifyId.Value = byId.BudModifyId; } else { this.hfldBudModifyId.Value = Guid.NewGuid().ToString(); } this.hfldModifyId.Value = this.modifyId; list = ( from mt in this.modifyTaskSer where mt.ModifyId == this.hfldBudModifyId.Value select mt).ToList <BudModifyTask>(); this.hfldAllModifyTaskJson.Value = JsonNetWrap.SerializeObject(list); } this.ViewState["modifyStockAction"] = this.modifyStockAction; this.ViewState["resource"] = dataTable; this.DataBindPurchaseplanStock(); string conPurchasePcode = this.purchase.GetConPurchasePcode(this.contractId); if (string.IsNullOrEmpty(conPurchasePcode)) { this.divPurchase.Style.Add("display", "none"); } this.FileLink1.MID = 1902; this.FileLink1.FID = this.hfldModifyId.Value; this.FileLink1.Type = 1; this.BindGv(list); if (this.hfldIsWBSRelevance.Value == "1") { using (List <BudModifyTask> .Enumerator enumerator = list.GetEnumerator()) { while (enumerator.MoveNext()) { BudModifyTask current = enumerator.Current; this.BindModifyTaskRes(current.ModifyTaskId); } return; } } base.Request.Cookies.Remove(this.hfldModifyId.Value); List <BudModifyTaskRes> t = ( from mtss in this.modifyTaskResSer where mtss.ModifyId == this.hfldModifyId.Value select mtss).ToList <BudModifyTaskRes>(); string value = JsonHelper.JsonSerializer <List <BudModifyTaskRes> >(t); HttpCookie httpCookie = new HttpCookie(this.hfldModifyId.Value); httpCookie.Value = value; base.Response.Cookies.Add(httpCookie); } }
protected void btnSave_Click(object sender, EventArgs e) { int count = ( from modify in this.modifySer where modify.PrjId == this.hdnProjectCode.Value.Trim() && modify.ModifyCode == this.txtModifyCode.Text.Trim() select modify).ToList <BudModify>().Count; if (string.Compare(this.action, "Add", true) == 0) { if (count > 0) { base.RegisterScript("top.ui.show('此编码已经存在!');"); return; } this.AddContractModify(); ConPayoutModifyService conPayoutModifyService = new ConPayoutModifyService(); ConPayoutModify byId = conPayoutModifyService.GetById(this.hfldModifyId.Value); byId.BudModifyId = this.hfldBudModifyId.Value; conPayoutModifyService.Update(byId); try { BudModify model = this.GetModel(null); this.modifySer.Add(model); this.SaveModifyTask(); this.SaveTask(); if (this.hfldIsWBSRelevance.Value == "0") { this.SaveModifyTaskResByModifyId(this.hfldModifyId.Value); } base.RegisterScript("top.ui.tabSuccess({ parentName: 'ModifyEdit' });"); return; } catch { base.RegisterScript("top.ui.show('添加失败!');"); return; } } if (string.Compare(this.action, "Update", true) == 0) { this.UpdateContractModify(); BudModify byId2 = this.modifySer.GetById(this.hfldBudModifyId.Value); if (byId2 != null && byId2.ModifyCode != this.txtModifyCode.Text.Trim() && count > 0) { base.RegisterScript("top.ui.show('此编码已经存在!');"); return; } try { this.modifySer.Update(this.GetModel(byId2)); this.modifyTaskSer.DelModifyTask(this.hfldBudModifyId.Value); this.SaveModifyTask(); this.SaveTask(); if (this.hfldIsWBSRelevance.Value == "0") { this.SaveModifyTaskResByModifyId(this.hfldBudModifyId.Value); } base.RegisterScript("top.ui.tabSuccess({ parentName: 'ModifyEdit'});"); } catch { base.RegisterScript("top.ui.show('编辑失败!');"); } } }