protected void btnSave_ServerClick(object sender, System.EventArgs e) { try { System.Collections.Generic.List <TaskResource> list = new System.Collections.Generic.List <TaskResource>(); cn.justwin.Domain.BudTask budTask = null; if (this.hfldIsWBSRelevance.Value == "1") { budTask = cn.justwin.Domain.BudTask.GetById(this.taskId); budTask.Resources = list; } for (int i = 0; i < this.gvResource.Rows.Count; i++) { cn.justwin.Domain.Resource byId = cn.justwin.Domain.Resource.GetById(this.gvResource.DataKeys[i].Values[0].ToString()); decimal quantity = System.Convert.ToDecimal(((TextBox)this.gvResource.Rows[i].FindControl("txtNumber")).Text); decimal price = System.Convert.ToDecimal(((TextBox)this.gvResource.Rows[i].FindControl("txtPrice")).Text); decimal num = System.Convert.ToDecimal(((TextBox)this.gvResource.Rows[i].FindControl("txtLoss")).Text); if (this.hfldIsWBSRelevance.Value == "1") { budTask.AddResource(byId, quantity, price, num, "save"); } else { list.Add(new TaskResource { Resource = byId, Quantity = quantity, Price = price, PrjGuid = this.prjId, Versions = System.Convert.ToInt32(this.hfldVersion.Value.Trim()), InputDate = new System.DateTime?(System.DateTime.Now), InputUser = PageHelper.QueryUser(this, base.UserCode), LossCoefficient = new decimal?(num) }); } } if (this.hfldIsWBSRelevance.Value == "1") { budTask.InputUser = PageHelper.QueryUser(this, base.UserCode); budTask.InputDate = System.DateTime.Now; cn.justwin.Domain.BudTask.AddResource(budTask); BudTaskService budTaskService = new BudTaskService(); budTaskService.UpdateTotal2(this.taskId); } else { TaskResource.AddResource(list, this.prjId, System.Convert.ToInt32(this.hfldVersion.Value)); } base.RegisterScript("top.ui.tabSuccess({ parentName: '_ResourceDeploy' });"); } catch (System.Exception) { } }