public static BG_BudgetCon AddBG_BudgetCon(BG_BudgetCon bG_BudgetCon) { string sql = "INSERT BG_BudgetCon (YNUse, BCRemark)" + "VALUES (@YNUse, @BCRemark)"; sql += " ; SELECT @@IDENTITY"; try { SqlParameter[] para = new SqlParameter[] { new SqlParameter("@YNUse", bG_BudgetCon.YNUse), new SqlParameter("@BCRemark", bG_BudgetCon.BCRemark) }; string IdStr = DBUnity.ExecuteScalar(CommandType.Text, sql, para); int newId = Convert.ToInt32(IdStr); return GetBG_BudgetConByPIID(newId); } catch (Exception e) { Console.WriteLine(e.Message); throw e; } }
public static BG_BudgetCon GetBG_BudgetConByPIID(int pIID) { string sql = "SELECT * FROM BG_BudgetCon WHERE PIID = @PIID"; try { SqlParameter para = new SqlParameter("@PIID", pIID); DataTable dt = DBUnity.AdapterToTab(sql, para); if(dt.Rows.Count > 0) { BG_BudgetCon bG_BudgetCon = new BG_BudgetCon(); bG_BudgetCon.PIID = dt.Rows[0]["PIID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["PIID"]; bG_BudgetCon.YNUse = dt.Rows[0]["YNUse"] == DBNull.Value ? "" : (string)dt.Rows[0]["YNUse"]; bG_BudgetCon.BCRemark = dt.Rows[0]["BCRemark"] == DBNull.Value ? "" : (string)dt.Rows[0]["BCRemark"]; return bG_BudgetCon; } else { return null; } } catch (Exception e) { Console.WriteLine(e.Message); throw e; } }
public static bool DeleteBG_BudgetCon(BG_BudgetCon bG_BudgetCon) { return DeleteBG_BudgetConByPIID( bG_BudgetCon.PIID ); }
public static bool ModifyBG_BudgetCon(BG_BudgetCon bG_BudgetCon) { string sql = "UPDATE BG_BudgetCon " + "SET " + "YNUse = @YNUse, " + "BCRemark = @BCRemark " + "WHERE PIID = @PIID"; try { SqlParameter[] para = new SqlParameter[] { new SqlParameter("@PIID", bG_BudgetCon.PIID), new SqlParameter("@YNUse", bG_BudgetCon.YNUse), new SqlParameter("@BCRemark", bG_BudgetCon.BCRemark) }; 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> /// 更改预算项目控制记录状态(启用/禁用) /// </summary> /// <param name="piid">BGBudgetCon</param> /// <returns>bool</returns> public static bool UpdBudgetConSta(BG_BudgetCon bc) { return BGBudgetConService.UpdBudgetConSta(bc); }
protected void btnAdd_Click(object sender, EventArgs e) { //添加--> string piid = ddlPayIncome.SelectedItem.Value; int piidInt = common.IntSafeConvert(piid); BG_BudgetConCell cell = null; List<BG_BudgetConCell> list = new List<BG_BudgetConCell>(); if (ckA.Checked) { //A启用 cell = new BG_BudgetConCell(); cell.PIID = piidInt; cell.BCCName = common.RemoveUnsafeHtml(tbA.Text.Trim()); cell.BCCStan = ParseUtil.ToDecimal(tbCtrA.Text.Trim(), 0); cell.BCCUseSta = "启用"; list.Add(cell); } if (ckB.Checked) { //B启用 cell = new BG_BudgetConCell(); cell.PIID = piidInt; cell.BCCName = common.RemoveUnsafeHtml(tbB.Text .Trim ()); cell.BCCStan = ParseUtil.ToDecimal(tbCtrB .Text .Trim (),0); cell.BCCUseSta = "启用"; list.Add(cell); } if (ckC.Checked) { //C启用 cell = new BG_BudgetConCell(); cell.PIID = piidInt; cell.BCCName = common.RemoveUnsafeHtml(tbC.Text.Trim()); cell.BCCStan = ParseUtil.ToDecimal(tbCtrC.Text.Trim(), 0); cell.BCCUseSta = "启用"; list.Add(cell); } if (ckD.Checked) { //D启用 cell = new BG_BudgetConCell(); cell.PIID = piidInt; cell.BCCName = common.RemoveUnsafeHtml(tbD.Text.Trim()); cell.BCCStan = ParseUtil.ToDecimal(tbCtrD.Text.Trim(), 0); cell.BCCUseSta = "启用"; list.Add(cell); } if (ckE.Checked) { //E启用 cell = new BG_BudgetConCell(); cell.PIID = piidInt; cell.BCCName = common.RemoveUnsafeHtml(tbE.Text.Trim()); cell.BCCStan = ParseUtil.ToDecimal(tbCtrE.Text.Trim(), 0); cell.BCCUseSta = "启用"; list.Add(cell); } if (ckF.Checked) { //F启用 cell = new BG_BudgetConCell(); cell.PIID = piidInt; cell.BCCName = common.RemoveUnsafeHtml(tbF.Text.Trim()); cell.BCCStan = ParseUtil.ToDecimal(tbCtrF.Text.Trim(), 0); cell.BCCUseSta = "启用"; list.Add(cell); } //添加项目预算控制记录 BG_BudgetCon bgBudget = new BG_BudgetCon(); bgBudget.PIID = piidInt; bgBudget.YNUse = "启用"; bgBudget.BCRemark = "备注"; BGBudgetConManager.AddBudgetCon(bgBudget); //批量添加项目预算控制单元记录 BGBudgetConCellManager.AddBudgetConCell(list); Response.Redirect("BudProjectList.aspx", true); }
/// <summary> /// 修改预算项目控制记录 /// </summary> /// <param name="piid">BGBudgetCon</param> /// <returns>bool</returns> public static bool UpdBudgetCon(BG_BudgetCon piid) { return BGBudgetConService.UpdBudgetCon(piid); }
/// <summary> /// 添加一条预算项目控制记录 /// </summary> /// <param name="piid">一条预算项目控制记录</param> /// <returns>bool</returns> public static bool AddBudgetCon(BG_BudgetCon bg) { return BGBudgetConService.AddBudgetCon(bg); }
public static bool ModifyBG_BudgetCon(BG_BudgetCon bG_BudgetCon) { return BG_BudgetConService.ModifyBG_BudgetCon(bG_BudgetCon); }
public static bool DeleteBG_BudgetCon(BG_BudgetCon bG_BudgetCon) { return BG_BudgetConService.DeleteBG_BudgetCon(bG_BudgetCon); }
public static BG_BudgetCon AddBG_BudgetCon(BG_BudgetCon bG_BudgetCon) { return BG_BudgetConService.AddBG_BudgetCon(bG_BudgetCon); }