/// <summary> /// 添加一条【预算项目费用】记录 BG_BudCostPro /// </summary> /// <param name="bcp">BGBudCostPro</param> /// <returns>bool</returns> public static bool AddBGBudCostPro(BG_BudCostPro bcp) { bool flag = false; try { string sqlStr = @"insert into BG_BudCostPro(BudID,BCPCurrYear,PIID,BCPTotal,BCPSubtFinAllo,BCPSubtExp,BCInExpenses,BCOutFunding,BCPRemark)values (@BudID,@BCPCurrYear,@PIID,@BCPTotal,@BCPSubtFinAllo,@BCPSubtExp,@BCInExpenses,@BCOutFunding,@BCPRemark)"; SqlParameter[] Pars = new SqlParameter[]{ new SqlParameter("@BudID",bcp.BudID), new SqlParameter("@BCPCurrYear",bcp.BCPCurrYear), new SqlParameter("@PIID",bcp.PIID), new SqlParameter("@BCPTotal",bcp.BCPTotal), new SqlParameter("@BCPSubtFinAllo",bcp.BCPSubtFinAllo), new SqlParameter("@BCPSubtExp",bcp.BCPSubtExp), new SqlParameter("@BCInExpenses",bcp.BCInExpenses), new SqlParameter("@BCOutFunding",bcp.BCOutFunding), new SqlParameter("@BCPRemark",bcp.BCPRemark) }; flag = DBUnity.ExecuteNonQuery(CommandType.Text, sqlStr, Pars) > 0; } catch (Exception ex) { flag = false; Log.WriteLog(ex.Message, "BGBudCostProService--AddBGBudCostPro"); } return flag; }
public static BG_BudCostPro AddBG_BudCostPro(BG_BudCostPro bG_BudCostPro) { string sql = "INSERT BG_BudCostPro (BudID, BCPCurrYear, PIID, BCPTotal, BCPSubtFinAllo, BCPSubtExp, BCInExpenses, BCOutFunding, BCPRemark)" + "VALUES (@BudID, @BCPCurrYear, @PIID, @BCPTotal, @BCPSubtFinAllo, @BCPSubtExp, @BCInExpenses, @BCOutFunding, @BCPRemark)"; sql += " ; SELECT @@IDENTITY"; try { SqlParameter[] para = new SqlParameter[] { new SqlParameter("@BudID", bG_BudCostPro.BudID), new SqlParameter("@BCPCurrYear", bG_BudCostPro.BCPCurrYear), new SqlParameter("@PIID", bG_BudCostPro.PIID), new SqlParameter("@BCPTotal", bG_BudCostPro.BCPTotal), new SqlParameter("@BCPSubtFinAllo", bG_BudCostPro.BCPSubtFinAllo), new SqlParameter("@BCPSubtExp", bG_BudCostPro.BCPSubtExp), new SqlParameter("@BCInExpenses", bG_BudCostPro.BCInExpenses), new SqlParameter("@BCOutFunding", bG_BudCostPro.BCOutFunding), new SqlParameter("@BCPRemark", bG_BudCostPro.BCPRemark) }; string IdStr = DBUnity.ExecuteScalar(CommandType.Text, sql, para); int newId = Convert.ToInt32(IdStr); return GetBG_BudCostProByCostID(newId); } catch (Exception e) { Console.WriteLine(e.Message); throw e; } }
protected void btnUpd_Click(object sender, EventArgs e) { int bid = common.IntSafeConvert(Hidbuid.Value); BG_BudItems bi = BGBudItemsManager.GetBudItemsByBudid(bid); bi.BIAppReaCon = txtBIAppReaCon.Text.Trim(); bi.BIAttr = ddlProProper.SelectedValue; bi.BIBudSta = ""; //Session[Constant.UserName].ToString(); bi.BudSta = "未提交"; bi.BICharger = txtBICharger.Text.Trim(); //bi.BICode =txtItemNumber.Text.Trim(); bi.BIEndTime = DateTime.Parse(txtBIEndTime.Text.Trim()); bi.BIExpGistExp = txtBIExpGistExp.Text.Trim(); bi.BIFunSub = ddlFunSub.SelectedValue; bi.BILongGoal = txtBILongGoal.Text.Trim(); bi.BIOthExpProb = txtBIOthExpProb.Text.Trim(); bi.BIPlanHz = ddlBIPlanHz.SelectedValue; bi.BIProType = ddlPayProType.SelectedItem.Text; bi.BIStaTime = DateTime.Parse(txtBIStaTime.Text.Trim()); bi.BIYearGoal = txtBIYearGoal.Text.Trim(); bi.PPID = common.IntSafeConvert(ddlPayProType.SelectedValue); bi.BIProName = txtProName.Text.Trim(); bi.BIReportTime = ParseUtil.ToDateTime(txtBITime.Text.Trim(),DateTime.Now); // bi.BIConNum = 0; bi.BIProDescrip = txtProDesc.Text.Trim(); bi.BIProCategory = ddlProType.SelectedValue; decimal bimon = ParseUtil.ToDecimal(HidMonTotal.Value, 0); //GetBIMon(coll.GetValues("txt4")); bi.BIMon = bimon; int buid = bi.BudID; int depid = bi.DepID; int bcn =(int)ParseUtil.ToDecimal(txtBudConNumber.Text,0); if (bcn != 0) { decimal bunconnum = bi.BIConNum; if (bunconnum < bimon) { lblShowResult.Text = "*预算金额超标!"; return; } } if (BGBudItemsManager.UpdBudItems(bi)) { string idStrs = BGBudCostProManager.GetDelIdsStr(buid); bool delFlag = BGBudCostProManager.DelBCPByIdStrs(idStrs); if (delFlag) { NameValueCollection coll = Request.Form; string selectVal = HidSelectVal.Value.TrimEnd(','); string[] arrs = selectVal.Split(','); string[] txt1 = coll.GetValues("txt1"); //行号 string[] txt2 = coll.GetValues("txt2"); //当前年度 string[] txt3 = arrs; //经济科目 string[] txt4 = coll.GetValues("txt4"); //总计 string[] txt5 = coll.GetValues("txt5"); //小计(财政拨款) string[] txt6 = coll.GetValues("txt6"); //小计(经费) string[] txt7 = coll.GetValues("txt7"); //内部开支(经费) string[] txt8 = coll.GetValues("txt8"); //外部拨款(经费) int rowCount = common.IntSafeConvert(HidRowCount.Value); bool flag = false; if (rowCount > 0) { for (int j = 0; j < rowCount; j++) { BG_BudCostPro bcp = new BG_BudCostPro(); bcp.BudID = buid; bcp.BCPCurrYear =common.IntSafeConvert(txt2[j]); bcp.BCPRemark = ""; bcp.PIID = common.IntSafeConvert(txt3[j]); bcp.BCPTotal = ParseUtil.ToDecimal(txt4[j],0); bcp.BCPSubtFinAllo = ParseUtil.ToDecimal(txt5[j],0); bcp.BCPSubtExp = ParseUtil.ToDecimal(txt6[j],0); bcp.BCInExpenses = ParseUtil.ToDecimal(txt7[j],0); bcp.BCOutFunding = ParseUtil.ToDecimal(txt8[j],0); flag = BGBudCostProManager.AddBGBudCostPro(bcp); } } if (flag) { txtBind(buid); repPayProjectBind(buid); lblShowResult.Text = "修改成功"; //string PostUrl = "BudgetEditList.aspx?depid=" + depid; // Response.Write("<script language='javascript'>alert('修改成功!');window.location.href='" + PostUrl + "';</script>"); } else { lblShowResult.Text = "操作失败、请检查数据后重试"; } } else { lblShowResult.Text = "操作失败、请检查数据后重试"; } } else { lblShowResult.Text = "操作失败、请检查数据后重试"; } }
public static bool DeleteBG_BudCostPro(BG_BudCostPro bG_BudCostPro) { return DeleteBG_BudCostProByCostID( bG_BudCostPro.CostID ); }
public static BG_BudCostPro GetBG_BudCostProByCostID(int costID) { string sql = "SELECT * FROM BG_BudCostPro WHERE CostID = @CostID"; try { SqlParameter para = new SqlParameter("@CostID", costID); DataTable dt = DBUnity.AdapterToTab(sql, para); if(dt.Rows.Count > 0) { BG_BudCostPro bG_BudCostPro = new BG_BudCostPro(); bG_BudCostPro.CostID = dt.Rows[0]["CostID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["CostID"]; bG_BudCostPro.BudID = dt.Rows[0]["BudID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["BudID"]; bG_BudCostPro.BCPCurrYear = dt.Rows[0]["BCPCurrYear"] == DBNull.Value ? 0 : (int)dt.Rows[0]["BCPCurrYear"]; bG_BudCostPro.PIID = dt.Rows[0]["PIID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["PIID"]; bG_BudCostPro.BCPTotal = dt.Rows[0]["BCPTotal"] == DBNull.Value ? 0 : (decimal)dt.Rows[0]["BCPTotal"]; bG_BudCostPro.BCPSubtFinAllo = dt.Rows[0]["BCPSubtFinAllo"] == DBNull.Value ? 0 : (decimal)dt.Rows[0]["BCPSubtFinAllo"]; bG_BudCostPro.BCPSubtExp = dt.Rows[0]["BCPSubtExp"] == DBNull.Value ? 0 : (decimal)dt.Rows[0]["BCPSubtExp"]; bG_BudCostPro.BCInExpenses = dt.Rows[0]["BCInExpenses"] == DBNull.Value ? 0 : (decimal)dt.Rows[0]["BCInExpenses"]; bG_BudCostPro.BCOutFunding = dt.Rows[0]["BCOutFunding"] == DBNull.Value ? 0 : (decimal)dt.Rows[0]["BCOutFunding"]; bG_BudCostPro.BCPRemark = dt.Rows[0]["BCPRemark"] == DBNull.Value ? "" : (string)dt.Rows[0]["BCPRemark"]; return bG_BudCostPro; } else { return null; } } catch (Exception e) { Console.WriteLine(e.Message); throw e; } }
public static bool ModifyBG_BudCostPro(BG_BudCostPro bG_BudCostPro) { string sql = "UPDATE BG_BudCostPro " + "SET " + "BudID = @BudID, " + "BCPCurrYear = @BCPCurrYear, " + "PIID = @PIID, " + "BCPTotal = @BCPTotal, " + "BCPSubtFinAllo = @BCPSubtFinAllo, " + "BCPSubtExp = @BCPSubtExp, " + "BCInExpenses = @BCInExpenses, " + "BCOutFunding = @BCOutFunding, " + "BCPRemark = @BCPRemark " + "WHERE CostID = @CostID"; try { SqlParameter[] para = new SqlParameter[] { new SqlParameter("@CostID", bG_BudCostPro.CostID), new SqlParameter("@BudID", bG_BudCostPro.BudID), new SqlParameter("@BCPCurrYear", bG_BudCostPro.BCPCurrYear), new SqlParameter("@PIID", bG_BudCostPro.PIID), new SqlParameter("@BCPTotal", bG_BudCostPro.BCPTotal), new SqlParameter("@BCPSubtFinAllo", bG_BudCostPro.BCPSubtFinAllo), new SqlParameter("@BCPSubtExp", bG_BudCostPro.BCPSubtExp), new SqlParameter("@BCInExpenses", bG_BudCostPro.BCInExpenses), new SqlParameter("@BCOutFunding", bG_BudCostPro.BCOutFunding), new SqlParameter("@BCPRemark", bG_BudCostPro.BCPRemark) }; int t = DBUnity.ExecuteNonQuery(CommandType.Text, sql, para); if(t>0) { return true; } else { return false; } } catch (Exception e) { Console.WriteLine(e.Message); throw e; } }
/// <summary> /// 添加一条【预算项目费用】记录 BG_BudCostPro /// </summary> /// <param name="bcp">BGBudCostPro</param> /// <returns>bool</returns> public static bool AddBGBudCostPro(BG_BudCostPro bcp) { return BGBudCostProService.AddBGBudCostPro(bcp); }
protected void btnSure_Click(object sender, EventArgs e) { BG_BudItems bi = new BG_BudItems(); bi.BIAppConMon = 0;// decimal.Parse(txtBudConNumber.Text.Trim());审批控制金额,应该是预算控制数 bi.BIAppReaCon = txtBIAppReaCon.Text.Trim(); bi.BIAttr = ddlProProper.SelectedValue; bi.BIBudSta = "等下对接"; //Session[Constant.UserName].ToString(); bi.BICause = "";//退回原因 bi.BICharger = txtBICharger.Text.Trim(); bi.BICode = txtItemNumber.Text.Trim(); //项目编号 bi.BIEndTime = DateTime.Parse(txtBIEndTime.Text.Trim()); bi.BIExpGistExp = txtBIExpGistExp.Text.Trim(); bi.BIFinAllo = 0;// decimal.Parse(txtBudConNumber.Text.Trim());财政拨款 bi.BIFunSub = ddlFunSub.Text.Trim(); bi.BILastYearCarry = 0;// decimal.Parse(txtBudConNumber.Text.Trim());上年结账 bi.BILongGoal = txtBILongGoal.Text.Trim(); bi.BIMon = common.IntSafeConvert(HidMonTotal.Value); //GetBIMon(coll.GetValues("txt4")); bi.BIMonSou = "";//资金来源 bi.BIOthExpProb = txtBIOthExpProb.Text.Trim(); bi.BIOthFun = 0;// decimal.Parse(txtBudConNumber.Text.Trim());其他资金 bi.BIPlanHz = ddlBIPlanHz.SelectedValue; //项目频度 bi.BIProType = ddlPayProType.SelectedItem.Text; bi.BIStaTime = DateTime.Parse(txtBIStaTime.Text.Trim()); bi.BIYearGoal = txtBIYearGoal.Text.Trim(); bi.PPID = common.IntSafeConvert(ddlPayProType.SelectedValue);// bi.BudSta = "未提交";// bi.PIID = BG_PayProjectManager.GetBG_PayProjectByPPID(bi.PPID).PIID; //common.IntSafeConvert(ddlFunSub.SelectedValue);//yj bi.BIProName = txtProName.Text.Trim(); bi.BIReportTime = ParseUtil.ToDateTime(txtBITime.Text.Trim(), DateTime.Now); bi.BIConNum = 0;//预算控制数 bi.BIProDescrip = txtProDesc.Text.Trim(); bi.DepID = common.IntSafeConvert(HidDepid.Value); bi.BIProCategory = ddlProType.SelectedItem.Text; bi.BIYear = common.IntSafeConvert(txtyear.Text); int buid = BG_BudItemsManager.AddBG_BudItems(bi).BudID;//yj if (buid > 0) { BG_BudItemHis hisbi = new BG_BudItemHis(); hisbi.BudID = buid; hisbi.BIAppConMon = 0;// decimal.Parse(txtBudConNumber.Text.Trim());审批控制金额,应该是预算控制数 hisbi.BIAppReaCon = txtBIAppReaCon.Text.Trim(); hisbi.BIAttr = ddlProProper.SelectedValue; hisbi.BIBudSta = "等下对接"; //Session[Constant.UserName].ToString(); hisbi.BICause = "";//退回原因 hisbi.BICharger = txtBICharger.Text.Trim(); hisbi.BICode = txtItemNumber.Text.Trim(); //项目编号 hisbi.BIEndTime = DateTime.Parse(txtBIEndTime.Text.Trim()); hisbi.BIExpGistExp = txtBIExpGistExp.Text.Trim(); hisbi.BIFinAllo = 0;// decimal.Parse(txtBudConNumber.Text.Trim());财政拨款 hisbi.BIFunSub = ddlFunSub.Text.Trim(); hisbi.BILastYearCarry = 0;// decimal.Parse(txtBudConNumber.Text.Trim());上年结账 hisbi.BILongGoal = txtBILongGoal.Text.Trim(); hisbi.BIMon = common.IntSafeConvert(HidMonTotal.Value); //GetBIMon(coll.GetValues("txt4")); hisbi.BIMonSou = "";//资金来源 hisbi.BIOthExpProb = txtBIOthExpProb.Text.Trim(); hisbi.BIOthFun = 0;// decimal.Parse(txtBudConNumber.Text.Trim());其他资金 hisbi.BIPlanHz = ddlBIPlanHz.SelectedValue; //项目频度 hisbi.BIProType = ddlPayProType.SelectedItem.Text; hisbi.BIStaTime = DateTime.Parse(txtBIStaTime.Text.Trim()); hisbi.BIYearGoal = txtBIYearGoal.Text.Trim(); hisbi.PPID = common.IntSafeConvert(ddlPayProType.SelectedValue);// hisbi.BudSta = "未提交";// hisbi.PIID = BG_PayProjectManager.GetBG_PayProjectByPPID(bi.PPID).PIID; //common.IntSafeConvert(ddlFunSub.SelectedValue);//yj hisbi.BIProName = txtProName.Text.Trim(); hisbi.BIReportTime = ParseUtil.ToDateTime(txtBITime.Text.Trim(), DateTime.Now); hisbi.BIConNum = 0;//预算控制数 hisbi.BIProDescrip = txtProDesc.Text.Trim(); hisbi.DepID = common.IntSafeConvert(HidDepid.Value); hisbi.BIProCategory = ddlProType.SelectedItem.Text; hisbi.BIYear = common.IntSafeConvert(txtyear.Text); int flaid= BG_BudItemHisManager.AddBG_BudItemHis(hisbi).BudHisID; NameValueCollection coll = Request.Form; string[] txt1 = coll.GetValues("txt1"); //行号 string[] txt2 = coll.GetValues("txt2"); //当前年度 string[] txt3 = coll.GetValues("ddlIncome"); //经济科目 string[] txt4 = coll.GetValues("txt4"); //总计 string[] txt5 = coll.GetValues("txt5"); //小计(财政拨款) string[] txt6 = coll.GetValues("txt6"); //小计(经费) string[] txt7 = coll.GetValues("txt7"); //内部开支(经费) string[] txt8 = coll.GetValues("txt8"); //外部拨款(经费) int rowCount = common.IntSafeConvert(HidRowCount.Value); bool flag = false; if (rowCount > 0 && flaid>0) { for (int j = 0; j < rowCount; j++) { BG_BudCostPro bcp = new BG_BudCostPro(); bcp.BudID = buid; bcp.BCPCurrYear = common.IntSafeConvert(txt2[j]); bcp.BCPRemark = ""; DataTable dtpiid = BG_PayIncomeLogic.GetBG_PayIncomeByname(txt3[j]); int piid = common.IntSafeConvert(dtpiid.Rows[0]["PIID"]); bcp.PIID = piid; bcp.BCPTotal = ParseUtil.ToDecimal(txt4[j], 0); bcp.BCPSubtFinAllo = ParseUtil.ToDecimal(txt5[j], 0); bcp.BCPSubtExp = ParseUtil.ToDecimal(txt6[j], 0); bcp.BCInExpenses = ParseUtil.ToDecimal(txt7[j], 0); bcp.BCOutFunding = ParseUtil.ToDecimal(txt8[j], 0); flag = BGBudCostProManager.AddBGBudCostPro(bcp);//yj } } if (flag) { lblShowResult.Text = "添加成功"; //BGBudItemHisManage.InsertBudItemHis(bi); string PostUrl = "BudgetEditList.aspx?depid=" + HidDepid.Value; string PostUrl1 = "BudgetEditAddPage.aspx?depid=" + HidDepid.Value; Response.Write("<script language='javascript'>if(confirm('是否继续添加?')){window.location.href='" + PostUrl1 + "';}else{window.location.href='" + PostUrl + "';}</script>"); } else { lblShowResult.Text = "操作失败、请检查数据后重试"; } } else { lblShowResult.Text = "操作失败、请检查数据后重试"; } }
public static bool ModifyBG_BudCostPro(BG_BudCostPro bG_BudCostPro) { return BG_BudCostProService.ModifyBG_BudCostPro(bG_BudCostPro); }
public static bool DeleteBG_BudCostPro(BG_BudCostPro bG_BudCostPro) { return BG_BudCostProService.DeleteBG_BudCostPro(bG_BudCostPro); }
public static BG_BudCostPro AddBG_BudCostPro(BG_BudCostPro bG_BudCostPro) { return BG_BudCostProService.AddBG_BudCostPro(bG_BudCostPro); }