public static BG_BudgetConCell AddBG_BudgetConCell(BG_BudgetConCell bG_BudgetConCell)
        {
            string sql =
                "INSERT BG_BudgetConCell (PIID, BCCName, BCCStan, BCCUseSta)" +
                "VALUES (@PIID, @BCCName, @BCCStan, @BCCUseSta)";

            sql += " ; SELECT @@IDENTITY";

            try
            {
                SqlParameter[] para = new SqlParameter[]
                {
                    new SqlParameter("@PIID", bG_BudgetConCell.PIID),
                    new SqlParameter("@BCCName", bG_BudgetConCell.BCCName),
                    new SqlParameter("@BCCStan", bG_BudgetConCell.BCCStan),
                    new SqlParameter("@BCCUseSta", bG_BudgetConCell.BCCUseSta)
                };

                string IdStr = DBUnity.ExecuteScalar(CommandType.Text, sql, para);
                int    newId = Convert.ToInt32(IdStr);
                return(GetBG_BudgetConCellByBCCID(newId));
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                throw e;
            }
        }
Exemplo n.º 2
0
        public static bool AddSingleBudgetConCell(BG_BudgetConCell cell)
        {
            //添加单条记录
//
            bool flag = false;

            try
            {
                string         sqlstr = @"insert into BG_BudgetConCell(PIID,BCCName,BCCStan,BCCUseSta)
               values(@PIID,@BCCName,@BCCStan,@BCCUseSta)";
                SqlParameter[] Pars   = new SqlParameter[] {
                    new SqlParameter("@PIID", cell.PIID),
                    new SqlParameter("@BCCName", cell.BCCName),
                    new SqlParameter("@BCCStan", cell.BCCStan),
                    new SqlParameter("@BCCUseSta", cell.BCCUseSta)
                };
                flag = DBUnity.ExecuteNonQuery(CommandType.Text, sqlstr, Pars) > 0;
            }
            catch (Exception ex)
            {
                flag = false;
                Log.WriteLog(ex.Message, "BGBudgetConCellService--AddSingleBudgetConCell");
            }
            return(flag);
        }
        public static BG_BudgetConCell GetBG_BudgetConCellByBCCID(int bCCID)
        {
            string sql = "SELECT * FROM BG_BudgetConCell WHERE BCCID = @BCCID";

            try
            {
                SqlParameter para = new SqlParameter("@BCCID", bCCID);
                DataTable    dt   = DBUnity.AdapterToTab(sql, para);

                if (dt.Rows.Count > 0)
                {
                    BG_BudgetConCell bG_BudgetConCell = new BG_BudgetConCell();

                    bG_BudgetConCell.BCCID     = dt.Rows[0]["BCCID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["BCCID"];
                    bG_BudgetConCell.PIID      = dt.Rows[0]["PIID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["PIID"];
                    bG_BudgetConCell.BCCName   = dt.Rows[0]["BCCName"] == DBNull.Value ? "" : (string)dt.Rows[0]["BCCName"];
                    bG_BudgetConCell.BCCStan   = dt.Rows[0]["BCCStan"] == DBNull.Value ? 0 : (decimal)dt.Rows[0]["BCCStan"];
                    bG_BudgetConCell.BCCUseSta = dt.Rows[0]["BCCUseSta"] == DBNull.Value ? "" : (string)dt.Rows[0]["BCCUseSta"];

                    return(bG_BudgetConCell);
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                throw e;
            }
        }
        public static bool ModifyBG_BudgetConCell(BG_BudgetConCell bG_BudgetConCell)
        {
            string sql =
                "UPDATE BG_BudgetConCell " +
                "SET " +
                "PIID = @PIID, " +
                "BCCName = @BCCName, " +
                "BCCStan = @BCCStan, " +
                "BCCUseSta = @BCCUseSta " +
                "WHERE BCCID = @BCCID";


            try
            {
                SqlParameter[] para = new SqlParameter[]
                {
                    new SqlParameter("@BCCID", bG_BudgetConCell.BCCID),
                    new SqlParameter("@PIID", bG_BudgetConCell.PIID),
                    new SqlParameter("@BCCName", bG_BudgetConCell.BCCName),
                    new SqlParameter("@BCCStan", bG_BudgetConCell.BCCStan),
                    new SqlParameter("@BCCUseSta", bG_BudgetConCell.BCCUseSta)
                };

                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;
            }
        }
 public static bool ModifyBG_BudgetConCell(BG_BudgetConCell bG_BudgetConCell)
 {
     return(BG_BudgetConCellService.ModifyBG_BudgetConCell(bG_BudgetConCell));
 }
 public static bool DeleteBG_BudgetConCell(BG_BudgetConCell bG_BudgetConCell)
 {
     return(BG_BudgetConCellService.DeleteBG_BudgetConCell(bG_BudgetConCell));
 }
 public static BG_BudgetConCell AddBG_BudgetConCell(BG_BudgetConCell bG_BudgetConCell)
 {
     return(BG_BudgetConCellService.AddBG_BudgetConCell(bG_BudgetConCell));
 }
Exemplo n.º 8
0
    protected void btnMod_Click(object sender, EventArgs e)
    {
        //添加-->
        BG_BudgetConCell        cell = null;
        List <BG_BudgetConCell> list = new List <BG_BudgetConCell>();

        int piidInt = common.IntSafeConvert(piid);

        if (ckA.Checked)
        {
            //启用
            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)
        {
            //启用
            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)
        {
            //启用
            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)
        {
            //启用
            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)
        {
            //启用
            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)
        {
            //启用
            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);
        }

        bool flag = BGBudgetConCellManager.UpdateBantch(list, piid);

        if (flag)
        {
            Response.Redirect("BudProjectList.aspx", true);
        }
    }
    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);
    }
 public static bool DeleteBG_BudgetConCell(BG_BudgetConCell bG_BudgetConCell)
 {
     return(DeleteBG_BudgetConCellByBCCID(bG_BudgetConCell.BCCID));
 }
 /// <summary>
 /// 单项添加
 /// </summary>
 /// <param name="cell">Cell</param>
 /// <returns></returns>
 public static bool AddSingleBudgetConCell(BG_BudgetConCell cell)
 {
     return(BGBudgetConCellService.AddSingleBudgetConCell(cell));
 }