private DataTable GetSourceTable() { BLL.BiddingDtl cBiddingDtl = new BLL.BiddingDtl(); cBiddingDtl.BiddingCode = this.ApplicationCode; cBiddingDtl.flag = "1"; DataTable dt = cBiddingDtl.GetBiddingDtls(); foreach (DataGridItem dgItem in dgListEdit.Items) { if (dt.Select("BiddingDtlCode=" + dgItem.Cells[0].Text).Length == 0) { DataRow dr = dt.NewRow(); dr["BiddingDtlCode"] = dgItem.Cells[0].Text; dr["Title"] = ((TextBox)dgItem.FindControl("txtTitle")).Text; dr["Remark"] = ((TextBox)dgItem.FindControl("txtRemark")).Text; dr["Money"] = ((WebNumericEdit)dgItem.FindControl("TxtTemMoney")).Value; //增加特殊需求 string companyName = System.Configuration.ConfigurationManager.AppSettings["PMName"].ToString().ToLower(); switch (companyName) { case "gaokepm": dr["OtherMoney"] = System.Convert.ToDecimal(((WebNumericEdit)dgItem.FindControl("TxtOtherMoney")).Value); break; default: dr["OtherMoney"] = 0; break; } RmsPM.Web.UserControls.InputCostBudgetDtl cb = ((RmsPM.Web.UserControls.InputCostBudgetDtl)dgItem.FindControl("Inputcostbudgetdtl1")); dr["CostCode"] = cb.CostCode; dr["CostBudgetSetCode"] = cb.CostBudgetSetCode; dr["PBSCode"] = cb.PBSCode; dr["PBSType"] = cb.PBSType; dr["BiddingCode"] = this.ApplicationCode; dt.Rows.Add(dr); } } foreach (DataRow dr in dt.Select()) { if (this.CheckDtlCode(dr["BiddingDtlCode"].ToString(), this.ViewState["DeleteItems"].ToString())) { dt.Rows.Remove(dr); } } return(dt); }
/// **************************************************************************** /// <summary> /// 提交数据 /// </summary> /// <param name="flag">是否修改(true为修改,false为新增)</param> /// **************************************************************************** private void _SubmitData(bool flag) { BLL.BiddingDtl bd = new BLL.BiddingDtl(); bd.BiddingCode = this.ApplicationCode; bd.flag = "1"; EntityData entity = bd.GetBiddingDtlEntity(); foreach (DataRow dr in entity.CurrentTable.Rows) { dr["Flag"] = "0"; } bd.SubmitDtlEntity(entity); decimal TeamMoneyTemp = 0; foreach (DataGridItem dgItem in dgListEdit.Items) { BLL.BiddingDtl cBiddingDtl = new BLL.BiddingDtl(); cBiddingDtl.BiddingDtlCode = dgItem.Cells[0].Text; cBiddingDtl.Title = ((TextBox)dgItem.FindControl("txtTitle")).Text; cBiddingDtl.remark = ((TextBox)dgItem.FindControl("txtRemark")).Text; cBiddingDtl.Money = ((WebNumericEdit)dgItem.FindControl("TxtTemMoney")).Value.ToString(); //增加特殊需求 string companyName = System.Configuration.ConfigurationManager.AppSettings["PMName"].ToString().ToLower(); switch (companyName) { case "gaokepm": cBiddingDtl.OtherMoney = ((WebNumericEdit)dgItem.FindControl("TxtOtherMoney")).Value.ToString(); break; default: cBiddingDtl.OtherMoney = "0"; break; } RmsPM.Web.UserControls.InputCostBudgetDtl cb = ((RmsPM.Web.UserControls.InputCostBudgetDtl)dgItem.FindControl("Inputcostbudgetdtl1")); cBiddingDtl.CostCode = cb.CostCode; cBiddingDtl.CostBudgetSetCode = cb.CostBudgetSetCode; cBiddingDtl.PBSCode = cb.PBSCode; cBiddingDtl.PBSType = cb.PBSType; cBiddingDtl.flag = "1"; if (flag) { cBiddingDtl.BiddingCode = this.ApplicationCode; cBiddingDtl.BiddingDtlSubmit(); } else { cBiddingDtl.BiddingCode = this.ApplicationCode; cBiddingDtl.BiddingDtlAdd(); } TeamMoneyTemp += decimal.Parse(((WebNumericEdit)dgItem.FindControl("TxtTemMoney")).Value.ToString()); } BLL.Bidding b = new BLL.Bidding(); b.BiddingCode = this.ApplicationCode; b.Money = TeamMoneyTemp.ToString(); b.BiddingSubmit(); this.TeamMoney = TeamMoneyTemp.ToString(); }