private void SaveInModifyTask() { foreach (GridViewRow gridViewRow in this.gvInTask.Rows) { BudModifyTask budModifyTask = new BudModifyTask(); string value = ((HiddenField)gridViewRow.FindControl("hfldInModifyTaskId")).Value; string value2 = ((HiddenField)gridViewRow.FindControl("hfldInTaskId")).Value; if (!string.IsNullOrEmpty(value)) { budModifyTask.ModifyTaskId = value; budModifyTask.ModifyId = this.hfldModifyId.Value; budModifyTask.TaskId = value2; budModifyTask.ParentId = this.GetParentId(value2); budModifyTask.ModifyTaskCode = ((TextBox)gridViewRow.FindControl("txtInTaskName")).Text; budModifyTask.ModifyTaskContent = ((TextBox)gridViewRow.FindControl("txtInTaskContent")).Text; budModifyTask.Unit = ((TextBox)gridViewRow.FindControl("txtInUnit")).Text; budModifyTask.Quantity = System.Convert.ToDecimal(((TextBox)gridViewRow.FindControl("txtInQuantity")).Text); budModifyTask.UnitPrice = System.Convert.ToDecimal(((TextBox)gridViewRow.FindControl("txtInUnitPrice")).Text); budModifyTask.Total = System.Convert.ToDecimal(((TextBox)gridViewRow.FindControl("txtInTotal")).Text); budModifyTask.Total2 = new decimal?(budModifyTask.Quantity * budModifyTask.UnitPrice); budModifyTask.Note = ((TextBox)gridViewRow.FindControl("txtInNote")).Text; budModifyTask.ModifyType = new int?(1); budModifyTask.FeatureDescription = ((TextBox)gridViewRow.FindControl("txtInDescription")).Text; budModifyTask.PrjId2 = this.prjId; string value3 = ((HiddenField)gridViewRow.FindControl("hfldInTaskType")).Value; budModifyTask.OrderNumber = this.GetModifyOrderNumber(value3, value2); this.modifyTaskSer.Add(budModifyTask); if (this.hfldIsWBSRelevance.Value == "1") { this.SaveModifyTaskRes(budModifyTask.ModifyTaskId); this.modifyTaskSer.UpdateTotal2(budModifyTask.ModifyTaskId); } } } }
private void InitEidtModifyTask(string modifyTaskJson) { BudModifyTask budModifyTask = JsonNetWrap.DeserializeObject <BudModifyTask>(modifyTaskJson); if (budModifyTask != null) { if (this.type == "edit") { this.ModifyType.Attributes.Add("disabled", "disabled"); } this.ModifyType.SelectedIndex = budModifyTask.ModifyType.Value; this.txtTaskName.Value = this.GetTaskCode(budModifyTask); this.txtTaskCode.Text = budModifyTask.ModifyTaskCode; this.txtModifyTaskName.Text = budModifyTask.ModifyTaskContent; this.txtUnit.Text = budModifyTask.Unit; this.txtQuantity.Value = budModifyTask.Quantity.ToString(); this.txtUnitPrice.Value = budModifyTask.UnitPrice.ToString(); this.txtTotal.Value = budModifyTask.Total.ToString(); this.txtStartDate.Value = budModifyTask.StartDate.ToString(); this.txtEndDate.Text = budModifyTask.EndDate.ToString(); this.txtNode.Text = budModifyTask.Note; if (budModifyTask.ModifyType.Value == 0) { this.hfldOriginalTaskId.Value = budModifyTask.ParentId; return; } this.hfldOriginalTaskId.Value = budModifyTask.TaskId; } }
protected void Page_Load(object sender, System.EventArgs e) { if (!base.IsPostBack) { this.hfldIsWBSRelevance.Value = this.isWBSRelevance; System.Collections.Generic.List <BudModifyTask> list = new System.Collections.Generic.List <BudModifyTask>(); System.Collections.Generic.List <BudModifyTask> list2 = new System.Collections.Generic.List <BudModifyTask>(); if (this.action == "Add") { this.hfldModifyId.Value = System.Guid.NewGuid().ToString(); } else { this.hfldModifyId.Value = this.id; list = ( from mt in this.modifyTaskSer where mt.ModifyId == this.hfldModifyId.Value && mt.ModifyType.Value == 0 select mt).ToList <BudModifyTask>(); list2 = ( from mt in this.modifyTaskSer where mt.ModifyId == this.hfldModifyId.Value && mt.ModifyType.Value == 1 select mt).ToList <BudModifyTask>(); this.BindModifyInfo(); decimal d = 0m; d += list.Sum((BudModifyTask omt) => omt.Total); d += list2.Sum((BudModifyTask imt) => imt.Total); this.txtBudAmount.Value = d.ToString("0.000"); } this.BindGv(list, list2); if (this.hfldIsWBSRelevance.Value == "1") { foreach (BudModifyTask current in list) { this.BindModifyTaskRes(current.ModifyTaskId); } using (System.Collections.Generic.List <BudModifyTask> .Enumerator enumerator2 = list2.GetEnumerator()) { while (enumerator2.MoveNext()) { BudModifyTask current2 = enumerator2.Current; this.BindModifyTaskRes(current2.ModifyTaskId); } goto IL_444; } } base.Request.Cookies.Remove(this.hfldModifyId.Value); System.Collections.Generic.List <BudModifyTaskRes> t = ( from mtss in this.modifyTaskResSer where mtss.ModifyId == this.hfldModifyId.Value select mtss).ToList <BudModifyTaskRes>(); string value = JsonHelper.JsonSerializer <System.Collections.Generic.List <BudModifyTaskRes> >(t); HttpCookie httpCookie = new HttpCookie(this.hfldModifyId.Value); httpCookie.Value = value; base.Response.Cookies.Add(httpCookie); IL_444: this.hfldPrjId.Value = this.prjId; this.uploadModify.RecordCode = this.hfldModifyId.Value; } }
protected void btnAddIn_Click(object sender, System.EventArgs e) { System.Collections.Generic.List <BudModifyTask> outModifyTaskGV = this.GetOutModifyTaskGV(); System.Collections.Generic.List <BudModifyTask> inModifyTaskGV = this.GetInModifyTaskGV(); BudModifyTask inEmptyModifyTask = this.GetInEmptyModifyTask(); inModifyTaskGV.Add(inEmptyModifyTask); this.BindGv(outModifyTaskGV, inModifyTaskGV); base.RegisterScript("clickWBSType('in')"); }
private void UpdateModifyTask() { HttpCookie httpCookie = base.Request.Cookies[this.hfldEditModifyTaskId.Value]; List <BudModifyTaskRes> list = new List <BudModifyTaskRes>(); if (httpCookie != null) { string value = httpCookie.Value; if (!string.IsNullOrEmpty(value)) { list = JsonConvert.DeserializeObject <List <BudModifyTaskRes> >(value); } } decimal num = 0m; foreach (BudModifyTaskRes current in list) { num += current.ResourcePrice * current.ResourceQuantity; } BudModifyTask budModifyTask = ( from r in this.modifyTaskSer where r.ModifyTaskId == this.hfldEditModifyTaskId.Value select r).FirstOrDefault <BudModifyTask>(); List <BudModifyTask> list2 = JsonNetWrap.DeserializeObject <List <BudModifyTask> >(this.hfldAllModifyTaskJson.Value); for (int i = 0; i < list2.Count; i++) { if (list2[i].ModifyTaskId == this.hfldEditModifyTaskId.Value) { list2[i].Total = num; list2[i].Total2 = new decimal?(num); if (list2[i].Quantity != 0m) { list2[i].UnitPrice = num / Convert.ToDecimal(list2[i].Quantity); } } } this.modifyTaskSer.DelByModifyTaskId(this.hfldEditModifyTaskId.Value); foreach (BudModifyTask current2 in list2) { if (current2.ModifyTaskId == this.hfldEditModifyTaskId.Value) { this.modifyTaskSer.Add(current2); this.SaveModifyTaskRes(this.hfldEditModifyTaskId.Value); this.modifyTaskSer.UpdateTotal2(current2.ModifyTaskId); } } if (!list2.Contains(budModifyTask) && budModifyTask != null) { this.modifyTaskSer.Delete(budModifyTask); } this.gvBudget.DataSource = list2; this.gvBudget.DataBind(); }
private void SaveModifyTask() { List <BudModifyTask> modifyTaskGV = this.GetModifyTaskGV(); for (int i = 0; i < this.gvBudget.Rows.Count; i++) { BudModifyTask budModifyTask = new BudModifyTask(); string value = ((HiddenField)this.gvBudget.Rows[i].FindControl("hfldModifyTaskId")).Value; string value2 = ((HiddenField)this.gvBudget.Rows[i].FindControl("hfldTaskId")).Value; if (!string.IsNullOrEmpty(value)) { budModifyTask.ModifyTaskId = value; budModifyTask.ModifyId = this.hfldBudModifyId.Value; budModifyTask.ModifyTaskCode = ((Label)this.gvBudget.Rows[i].FindControl("lblModifyTaskCode")).Text; budModifyTask.ModifyTaskContent = ((Label)this.gvBudget.Rows[i].FindControl("lblModifyTaskContent")).Text; budModifyTask.Unit = ((Label)this.gvBudget.Rows[i].FindControl("lblUnit")).Text; budModifyTask.Quantity = Convert.ToDecimal(((Label)this.gvBudget.Rows[i].FindControl("lblQuantity")).Text); budModifyTask.UnitPrice = Convert.ToDecimal(((Label)this.gvBudget.Rows[i].FindControl("lblUnitPrice")).Text); budModifyTask.Total = Convert.ToDecimal(((Label)this.gvBudget.Rows[i].FindControl("lblTotal")).Text); string text = ((Label)this.gvBudget.Rows[i].FindControl("lblModifyType")).Text; string value3 = ((HiddenField)this.gvBudget.Rows[i].FindControl("hfldParentId")).Value; string orderNumber = modifyTaskGV[i].OrderNumber; budModifyTask.OrderNumber = this.GetModifyOrderNumber(orderNumber, value3); if (text == "清单内") { budModifyTask.TaskId = value2; budModifyTask.Total2 = new decimal?(budModifyTask.Quantity * budModifyTask.UnitPrice); budModifyTask.ModifyType = new int?(1); budModifyTask.ParentId = this.GetParentId(value2); } else { budModifyTask.TaskId = value3 + "-" + budModifyTask.OrderNumber; budModifyTask.ModifyType = new int?(0); budModifyTask.ParentId = value3; } budModifyTask.EndDate = modifyTaskGV[i].EndDate; budModifyTask.StartDate = modifyTaskGV[i].StartDate; budModifyTask.ConstructionPeriod = modifyTaskGV[i].ConstructionPeriod; budModifyTask.FeatureDescription = modifyTaskGV[i].FeatureDescription; budModifyTask.Total2 = new decimal?(0m); budModifyTask.PrjId2 = this.hdnProjectCode.Value; budModifyTask.Note = modifyTaskGV[i].Note; budModifyTask.ContractId = this.contractId; this.modifyTaskSer.Add(budModifyTask); if (this.hfldIsWBSRelevance.Value == "1") { this.SaveModifyTaskRes(budModifyTask.ModifyTaskId); } } } }
private void SaveOutModifyTask() { foreach (GridViewRow gridViewRow in this.gvOutTask.Rows) { BudModifyTask budModifyTask = new BudModifyTask(); string value = ((HiddenField)gridViewRow.FindControl("hfldOutTaskId")).Value; if (!string.IsNullOrEmpty(value)) { budModifyTask.ModifyTaskId = ((HiddenField)gridViewRow.FindControl("hfldOutModifyTaskId")).Value; budModifyTask.ModifyId = this.hfldModifyId.Value; budModifyTask.TaskId = value; budModifyTask.ParentId = value; budModifyTask.ModifyTaskCode = ((TextBox)gridViewRow.FindControl("txtOutTaskCode")).Text; budModifyTask.ModifyTaskContent = ((TextBox)gridViewRow.FindControl("txtOutTaskContent")).Text; budModifyTask.Unit = ((TextBox)gridViewRow.FindControl("txtOutUnit")).Text; budModifyTask.Quantity = System.Convert.ToDecimal(((TextBox)gridViewRow.FindControl("txtOutQuantity")).Text); budModifyTask.UnitPrice = System.Convert.ToDecimal(((TextBox)gridViewRow.FindControl("txtOutUnitPrice")).Text); budModifyTask.Total = System.Convert.ToDecimal(((TextBox)gridViewRow.FindControl("txtOutTotal")).Text); string value2 = ((TextBox)gridViewRow.FindControl("txtOutStartDate")).Text.ToString(); if (!string.IsNullOrEmpty(value2)) { budModifyTask.StartDate = new System.DateTime?(System.Convert.ToDateTime(value2)); } string value3 = ((TextBox)gridViewRow.FindControl("txtOutEndDate")).Text.ToString(); if (!string.IsNullOrEmpty(value3)) { budModifyTask.EndDate = new System.DateTime?(System.Convert.ToDateTime(value3)); } string text = ((TextBox)gridViewRow.FindControl("txtOutConstructionPeriod")).Text; if (!string.IsNullOrEmpty(text)) { budModifyTask.ConstructionPeriod = new int?(System.Convert.ToInt32(text)); } string value4 = ((HiddenField)gridViewRow.FindControl("hfldOutTaskType")).Value; budModifyTask.Note = ((TextBox)gridViewRow.FindControl("txtOutNote")).Text; budModifyTask.ModifyType = new int?(0); budModifyTask.OrderNumber = this.GetModifyOrderNumber(value4, value); budModifyTask.FeatureDescription = ((TextBox)gridViewRow.FindControl("txtOutDescription")).Text; budModifyTask.PrjId2 = this.prjId; this.modifyTaskSer.Add(budModifyTask); if (this.hfldIsWBSRelevance.Value == "1") { this.SaveModifyTaskRes(budModifyTask.ModifyTaskId); this.modifyTaskSer.UpdateTotal2(budModifyTask.ModifyTaskId); } } } }
private List <BudTaskResource> GetAllRes(string prjId, int version) { List <BudTaskResource> list = (from taskRes in this join task in this.tSer on taskRes.TaskId equals task.TaskId where (task.PrjId == prjId) && (task.TaskType == "") select taskRes).ToList <BudTaskResource>(); BudModifyTaskResService service = new BudModifyTaskResService(); BudModifyTaskService service2 = new BudModifyTaskService(); BudModifyService service3 = new BudModifyService(); using (List <BudModifyTaskRes> .Enumerator enumerator = (from mtr in service join mt in service2 on mtr.ModifyTaskId equals mt.ModifyTaskId join m in service3 on mt.ModifyId equals m.ModifyId where (m.PrjId == prjId) && (m.Flowstate == 1) select mtr).ToList <BudModifyTaskRes>().GetEnumerator()) { BudModifyTaskRes modifyTaskRes; while (enumerator.MoveNext()) { modifyTaskRes = enumerator.Current; BudModify byId = service3.GetById(modifyTaskRes.ModifyId); BudModifyTask task = (from mts in service2 where mts.ModifyTaskId == modifyTaskRes.ModifyTaskId select mts).FirstOrDefault <BudModifyTask>(); BudTaskResource item = new BudTaskResource { TaskResourceId = modifyTaskRes.ModifyTaskResId }; if (task.ModifyType == 0) { item.TaskId = modifyTaskRes.ModifyTaskId; } else { item.TaskId = task.TaskId; } item.ResourceId = modifyTaskRes.ResourceId; item.ResourceQuantity = new decimal?(modifyTaskRes.ResourceQuantity); item.ResourcePrice = new decimal?(modifyTaskRes.ResourcePrice); item.InputDate = DateTime.Now; item.InputUser = byId.InputUser; item.PrjGuid = prjId; item.Versions = new int?(version); list.Add(item); } } return(list); }
protected string GetTaskCode(BudModifyTask mt) { BudTask byId; if (mt.ModifyType.Value == 0) { byId = this.tSer.GetById(mt.ParentId); } else { byId = this.tSer.GetById(mt.TaskId); } if (byId != null) { return(byId.TaskCode); } return(string.Empty); }
protected string GetTaskCode(string taskId) { string result = string.Empty; cn.justwin.Domain.BudTask byId = cn.justwin.Domain.BudTask.GetById(taskId); if (byId != null) { result = byId.Code; } else { BudModifyTask byId2 = this.modifyTaskSer.GetById(taskId); if (byId2 != null) { result = byId2.ModifyTaskCode; } } return(result); }
private System.Collections.Generic.List <BudModifyTask> GetOutModifyTaskGV() { System.Collections.Generic.List <BudModifyTask> list = new System.Collections.Generic.List <BudModifyTask>(); foreach (GridViewRow gridViewRow in this.gvOutTask.Rows) { BudModifyTask budModifyTask = new BudModifyTask(); budModifyTask.ModifyTaskId = ((HiddenField)gridViewRow.FindControl("hfldOutModifyTaskId")).Value; budModifyTask.ModifyId = this.hfldModifyId.Value; budModifyTask.TaskId = ((HiddenField)gridViewRow.FindControl("hfldOutTaskId")).Value; budModifyTask.ModifyTaskCode = ((TextBox)gridViewRow.FindControl("txtOutTaskCode")).Text; budModifyTask.ModifyTaskContent = ((TextBox)gridViewRow.FindControl("txtOutTaskContent")).Text; budModifyTask.Unit = ((TextBox)gridViewRow.FindControl("txtOutUnit")).Text; budModifyTask.Quantity = System.Convert.ToDecimal(((TextBox)gridViewRow.FindControl("txtOutQuantity")).Text); budModifyTask.UnitPrice = System.Convert.ToDecimal(((TextBox)gridViewRow.FindControl("txtOutUnitPrice")).Text); budModifyTask.Total = System.Convert.ToDecimal(((TextBox)gridViewRow.FindControl("txtOutTotal")).Text); string value = ((TextBox)gridViewRow.FindControl("txtOutStartDate")).Text.ToString(); if (!string.IsNullOrEmpty(value)) { budModifyTask.StartDate = new System.DateTime?(System.Convert.ToDateTime(value)); } string value2 = ((TextBox)gridViewRow.FindControl("txtOutEndDate")).Text.ToString(); if (!string.IsNullOrEmpty(value2)) { budModifyTask.EndDate = new System.DateTime?(System.Convert.ToDateTime(value2)); } string text = ((TextBox)gridViewRow.FindControl("txtOutConstructionPeriod")).Text; if (!string.IsNullOrEmpty(text)) { budModifyTask.ConstructionPeriod = new int?(System.Convert.ToInt32(text)); } budModifyTask.OrderNumber = ((HiddenField)gridViewRow.FindControl("hfldOutTaskType")).Value; budModifyTask.Note = ((TextBox)gridViewRow.FindControl("txtOutNote")).Text; budModifyTask.ModifyType = new int?(0); budModifyTask.FeatureDescription = ((TextBox)gridViewRow.FindControl("txtOutDescription")).Text; list.Add(budModifyTask); } return(list); }
public void SetResQuantityByConsQuantity(decimal quantity) { cn.justwin.Domain.BudTask byId = cn.justwin.Domain.BudTask.GetById(this.taskId); decimal num = 0M; if (byId == null) { BudModifyTask task2 = this.budModifyTaskSer.GetById(this.taskId); if ((task2 != null) && (task2.Quantity != 0M)) { num = quantity / task2.Quantity; } } else if (byId.Quantity != 0M) { num = quantity / byId.Quantity; } using (pm2Entities entities = new pm2Entities()) { List <BudModifyTaskRes> first = (from mt in this.budModifyTaskSer join m in this.budModifySer on mt.ModifyId equals m.ModifyId into m join mtr in this.budModifyTaskResSer on mt.ModifyTaskId equals mtr.ModifyTaskId into mtr where (mt.TaskId == this.taskId) && (m.Flowstate == 1) select mtr).ToList <BudModifyTaskRes>(); List <BudModifyTaskRes> second = (from mt in this.budModifyTaskSer join m in this.budModifySer on mt.ModifyId equals m.ModifyId into m join mtr in this.budModifyTaskResSer on mt.ModifyTaskId equals mtr.ModifyTaskId into mtr where (mt.ModifyTaskId == this.taskId) && (m.Flowstate == 1) select mtr).ToList <BudModifyTaskRes>(); first = first.Union <BudModifyTaskRes>(second).ToList <BudModifyTaskRes>(); if (byId != null) { using (IEnumerator <TaskResource> enumerator = byId.Resources.GetEnumerator()) { System.Func <BudModifyTaskRes, bool> predicate = null; TaskResource item; while (enumerator.MoveNext()) { item = enumerator.Current; decimal num2 = 0M; num2 = item.Quantity; if (predicate == null) { predicate = list => list.ResourceId == item.Resource.Id; } foreach (BudModifyTaskRes res in first.Where <BudModifyTaskRes>(predicate).ToList <BudModifyTaskRes>()) { if (item != null) { num2 += res.ResourceQuantity; first.Remove(res); } } for (int i = 0; i < this.ResourceList.Count; i++) { string resourceId = this.resourceList[i].ResourceId; if (resourceId == item.Resource.Id) { Bud_ConsTaskRes res2 = (from ctr in entities.Bud_ConsTaskRes where (ctr.Res_Resource.ResourceId == resourceId) && (ctr.Bud_ConsTask.ConsTaskId == this.Id) select ctr).FirstOrDefault <Bud_ConsTaskRes>(); if (res2 != null) { if (num > 1M) { res2.Quantity = num2; res2.AccountingQuantity = new decimal?(num2); } else { res2.Quantity = num * num2; res2.AccountingQuantity = new decimal?(num * num2); } } } } } } } using (List <string> .Enumerator enumerator3 = this.budModifyTaskResSer.GetModifyTasResIds(first).GetEnumerator()) { System.Func <BudModifyTaskRes, bool> func2 = null; string resId; while (enumerator3.MoveNext()) { resId = enumerator3.Current; decimal num4 = 0M; if (func2 == null) { func2 = list => list.ResourceId == resId; } foreach (BudModifyTaskRes res3 in first.Where <BudModifyTaskRes>(func2).ToList <BudModifyTaskRes>()) { num4 += res3.ResourceQuantity; first.Remove(res3); } for (int j = 0; j < this.ResourceList.Count; j++) { string resourceId = this.resourceList[j].ResourceId; if (resourceId == resId) { Bud_ConsTaskRes res4 = (from ctr in entities.Bud_ConsTaskRes where (ctr.Res_Resource.ResourceId == resourceId) && (ctr.Bud_ConsTask.ConsTaskId == this.Id) select ctr).FirstOrDefault <Bud_ConsTaskRes>(); if (res4 != null) { if (num > 1M) { res4.Quantity = num4; res4.AccountingQuantity = new decimal?(num4); } else { res4.Quantity = num * num4; res4.AccountingQuantity = new decimal?(num * num4); } } } } } } entities.SaveChanges(); } }
private void AddInModify() { BudModifyTask budModifyTask = new BudModifyTask(); budModifyTask.ModifyTaskId = this.hfldModifyTaskId.Value; budModifyTask.ModifyId = this.modifyId; budModifyTask.TaskId = this.hfldOriginalTaskId.Value; budModifyTask.ModifyTaskCode = this.GetTaskCode(this.hfldOriginalTaskId.Value); budModifyTask.ModifyTaskContent = this.txtModifyTaskName.Text.Trim(); budModifyTask.Unit = this.txtUnit.Text.Trim(); if (!string.IsNullOrEmpty(this.txtQuantity.Value.Trim())) { budModifyTask.Quantity = Convert.ToDecimal(this.txtQuantity.Value.Trim()); } else { budModifyTask.Quantity = 0m; } if (!string.IsNullOrEmpty(this.txtUnitPrice.Value.Trim())) { budModifyTask.UnitPrice = Convert.ToDecimal(this.txtUnitPrice.Value.Trim()); } else { budModifyTask.UnitPrice = 0m; } if (!string.IsNullOrEmpty(this.txtTotal.Value.Trim())) { budModifyTask.Total = Convert.ToDecimal(this.txtTotal.Value.Trim()); } else { budModifyTask.Total = 0m; } if (!string.IsNullOrEmpty(this.txtStartDate.Value.Trim())) { budModifyTask.StartDate = new DateTime?(Convert.ToDateTime(this.txtStartDate.Value.Trim())); } else { budModifyTask.StartDate = null; } if (!string.IsNullOrEmpty(this.txtEndDate.Text.Trim())) { budModifyTask.EndDate = new DateTime?(Convert.ToDateTime(this.txtEndDate.Text.Trim())); } else { budModifyTask.EndDate = null; } if (this.type == "edit") { string value = base.Request.Cookies["modifyTaskJson"].Value; string json = HttpUtility.UrlDecode(value); BudModifyTask budModifyTask2 = JsonNetWrap.DeserializeObject <BudModifyTask>(json); budModifyTask.OrderNumber = budModifyTask2.OrderNumber; } else { budModifyTask.OrderNumber = this.tSer.GetNextChildOrderNumber(this.hfldOriginalTaskId.Value); } budModifyTask.Note = this.txtNode.Text.Trim(); budModifyTask.ModifyType = new int?(1); if (!string.IsNullOrEmpty(this.txtConstructPeriod.Text.Trim())) { budModifyTask.ConstructionPeriod = new int?(Convert.ToInt32(this.txtConstructPeriod.Text.Trim())); } budModifyTask.FeatureDescription = string.Empty; budModifyTask.ParentId = this.hfldOriginalTaskId.Value; budModifyTask.PrjId2 = this.prjId; budModifyTask.ContractId = this.contractId; budModifyTask.Total2 = new decimal?(budModifyTask.UnitPrice * budModifyTask.Quantity); this.hfldTaskJson.Value = JsonNetWrap.SerializeObject(budModifyTask); base.RegisterScript("save();"); }
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); } }
private void SaveTask() { List <BudModifyTask> list = ( from r in this.modifyTaskSer where r.ModifyId == this.hfldBudModifyId.Value select r).ToList <BudModifyTask>(); for (int i = 0; i < this.gvBudget.Rows.Count; i++) { string taskId = list[i].TaskId; cn.justwin.Domain.Entities.BudTask budTask = ( from p in this.budTaskSer where p.TaskId == taskId && p.ModifyId == this.hfldBudModifyId.Value select p).FirstOrDefault <cn.justwin.Domain.Entities.BudTask>(); BudModifyTask budModifyTask = ( from p in this.modifyTaskSer where p.TaskId == taskId select p).FirstOrDefault <BudModifyTask>(); if (budTask != null) { budTask.Total2 = new decimal?(Convert.ToDecimal(((Label)this.gvBudget.Rows[i].FindControl("lblTotal")).Text)); budTask.Quantity = new decimal?(Convert.ToDecimal(((Label)this.gvBudget.Rows[i].FindControl("lblQuantity")).Text)); budTask.UnitPrice = new decimal?(Convert.ToDecimal(((Label)this.gvBudget.Rows[i].FindControl("lblUnitPrice")).Text)); this.budTaskSer.Update(budTask); } if (budTask == null && budModifyTask.ModifyType == 0) { budTask = new cn.justwin.Domain.Entities.BudTask(); budTask.ModifyId = this.hfldBudModifyId.Value; budTask.TaskId = taskId; budTask.TaskCode = ((Label)this.gvBudget.Rows[i].FindControl("lblModifyTaskCode")).Text; budTask.TaskName = ((Label)this.gvBudget.Rows[i].FindControl("lblModifyTaskContent")).Text; budTask.Unit = ((Label)this.gvBudget.Rows[i].FindControl("lblUnit")).Text; budTask.Quantity = new decimal?(Convert.ToDecimal(((Label)this.gvBudget.Rows[i].FindControl("lblQuantity")).Text)); budTask.UnitPrice = new decimal?(Convert.ToDecimal(((Label)this.gvBudget.Rows[i].FindControl("lblUnitPrice")).Text)); budTask.Total2 = new decimal?(Convert.ToDecimal(((Label)this.gvBudget.Rows[i].FindControl("lblTotal")).Text)); string text = ((Label)this.gvBudget.Rows[i].FindControl("lblModifyType")).Text; string value = ((HiddenField)this.gvBudget.Rows[i].FindControl("hfldParentId")).Value; budTask.ParentId = value; if (text == "清单内") { budTask.ModifyType = "1"; } else { budTask.ModifyType = "0"; } budTask.PrjId = this.hdnProjectCode.Value; budTask.StartDate = list[i].StartDate; budTask.EndDate = list[i].EndDate; budTask.ConstructionPeriod = list[i].ConstructionPeriod; budTask.FeatureDescription = list[i].FeatureDescription; budTask.Note = ((Label)this.gvBudget.Rows[i].FindControl("hlinkShowNote")).Text; budTask.OrderNumber = list[i].OrderNumber; budTask.InputUser = PageHelper.QueryUser(this, base.UserCode); budTask.InputDate = DateTime.Now; budTask.TaskType = string.Empty; budTask.Version = new int?(1); budTask.ContractId = this.contractId; budTask.IsValid = new bool?(false); this.budTaskSer.Add(budTask); } } }
protected void btnDelete_Click(object sender, EventArgs e) { List <string> listFromJson = JsonHelper.GetListFromJson(this.hfldModifyId.Value); foreach (string modifyId in listFromJson) { ConPayoutModify payOutModify = ( from r in this.payOutSer where r.ModifyID == modifyId select r).FirstOrDefault <ConPayoutModify>(); BudModify budModify = ( from r in this.modifySer where r.ModifyId == payOutModify.BudModifyId select r).FirstOrDefault <BudModify>(); if (budModify != null) { List <BudTask> list = ( from r in this.budTaskSer where r.ModifyId == budModify.ModifyId select r).ToList <BudTask>(); foreach (BudTask model in list) { BudModifyTask budModifyTask = ( from r in this.budModifyTaskSer where r.TaskId == model.TaskId select r).FirstOrDefault <BudModifyTask>(); if (budModifyTask.ModifyType == 0) { this.budTaskSer.Delete(model); this.budModifyTaskSer.UpdateTotal2(budModifyTask.ModifyTaskId); this.budModifyTaskSer.Delete(budModifyTask); } else { model.ModifyId = budModifyTask.ModifyId; model.Total2 -= budModifyTask.Total2; model.Quantity -= budModifyTask.Quantity; if (model.Quantity != 0m) { model.UnitPrice = model.Total2 / model.Quantity; } this.budTaskSer.Update(model); this.budModifyTaskSer.UpdateTotal2(budModifyTask.ModifyTaskId); this.budModifyTaskSer.Delete(budModifyTask); } } this.modifySer.Delete(budModify); } } try { //foreach (string current in listFromJson) //{ // SelfEventAction.SuperDelete(current, "Con_Payout_Modify", "FlowState"); //} this.payoutModify.Delete(listFromJson); base.RegisterScript("window.location = window.location;"); } catch (Exception) { base.RegisterScript("alert('系统提示:\\n\\n删除失败!');"); } }