コード例 #1
0
        public static BG_Amount AddBG_Amount(BG_Amount bG_Amount)
        {
            string sql =
                "INSERT BG_Amount (BGAMMon, BGAMIncome, BGAMYear, DepID, CBID)" +
                "VALUES (@BGAMMon, @BGAMIncome, @BGAMYear, @DepID, @CBID)";

            sql += " ; SELECT @@IDENTITY";

            try
            {
                SqlParameter[] para = new SqlParameter[]
                {
                    new SqlParameter("@BGAMMon", bG_Amount.BGAMMon),
                    new SqlParameter("@BGAMIncome", bG_Amount.BGAMIncome),
                    new SqlParameter("@BGAMYear", bG_Amount.BGAMYear),
                    new SqlParameter("@DepID", bG_Amount.DepID),
                    new SqlParameter("@CBID", bG_Amount.CBID)
                };

                string IdStr = DBUnity.ExecuteScalar(CommandType.Text, sql, para);
                int    newId = Convert.ToInt32(IdStr);
                return(GetBG_AmountByBGAMID(newId));
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                throw e;
            }
        }
コード例 #2
0
    public void Edit2(int id, string name, object BGAMID, string oldValue, string newValue, object customer)
    {
        int       deptid  = DepID;
        string    message = " {0}<br /><b>原收入经费:</b> {1}<br /><b>更改收入经费:</b> {2}";
        bool      flag    = false;
        BG_Amount ma      = new BG_Amount();

        ma = BG_AmountLogic.GetBG_AmountByYear(id, common.IntSafeConvert(cmbyear.SelectedItem.Value), deptid);
        if (ma == null)
        {
            ma            = new BG_Amount();
            ma.BGAMIncome = ParToDecimal.ParToDel(newValue);
            ma.DepID      = deptid;
            ma.BGAMYear   = common.IntSafeConvert(cmbyear.SelectedItem.Value);
            ma.CBID       = id;
            flag          = BG_AmountManager.AddBG_Amount(ma).BGAMID > 0;
        }
        else
        {
            ma.BGAMIncome = ParToDecimal.ParToDel(newValue);
            flag          = BG_AmountManager.ModifyBG_Amount(ma);
        }
        if (flag)
        {
            X.Msg.Notify(new NotificationConfig()
            {
                Title = "消息提示",
                Html  = string.Format(message, common.IntSafeConvert(cmbyear.SelectedItem.Value) - 1 + "年" + "口径:" + name.Split('、')[1], oldValue, newValue),
                Width = 250
            }).Show();
        }
    }
コード例 #3
0
        public static BG_Amount GetBG_AmountByBGAMID(int bGAMID)
        {
            string sql = "SELECT * FROM BG_Amount WHERE BGAMID = @BGAMID";

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

                if (dt.Rows.Count > 0)
                {
                    BG_Amount bG_Amount = new BG_Amount();

                    bG_Amount.BGAMID     = dt.Rows[0]["BGAMID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["BGAMID"];
                    bG_Amount.BGAMMon    = dt.Rows[0]["BGAMMon"] == DBNull.Value ? 0 : (decimal)dt.Rows[0]["BGAMMon"];
                    bG_Amount.BGAMIncome = dt.Rows[0]["BGAMIncome"] == DBNull.Value ? 0 : (decimal)dt.Rows[0]["BGAMIncome"];
                    bG_Amount.BGAMYear   = dt.Rows[0]["BGAMYear"] == DBNull.Value ? 0 : (int)dt.Rows[0]["BGAMYear"];
                    bG_Amount.DepID      = dt.Rows[0]["DepID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["DepID"];
                    bG_Amount.CBID       = dt.Rows[0]["CBID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["CBID"];

                    return(bG_Amount);
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                throw e;
            }
        }
コード例 #4
0
    public void Edit(int id, string name, object BGAMID, string oldValue, string newValue, object customer)
    {
        int deptid = DepID;

        if (UserLimStr == "审核员")
        {
            deptid = common.IntSafeConvert(cmbdept.SelectedItem.Value);
            editnum.Disable(true);
        }
        string    message = " {0}<br /><b>原支出经费:</b> {1}<br /><b>更改支出经费:</b> {2}";
        bool      flag    = false;
        BG_Amount ma      = new BG_Amount();

        ma = BG_AmountLogic.GetBG_AmountByYear(id, common.IntSafeConvert(cmbyear.SelectedItem.Value), deptid);
        if (ma == null)
        {
            ma          = new BG_Amount();
            ma.BGAMMon  = ParToDecimal.ParToDel(newValue);
            ma.DepID    = deptid;
            ma.BGAMYear = common.IntSafeConvert(cmbyear.SelectedItem.Value);
            ma.CBID     = id;
            flag        = BG_AmountManager.AddBG_Amount(ma).BGAMID > 0;
        }
        else
        {
            ma.BGAMMon = ParToDecimal.ParToDel(newValue);
            flag       = BG_AmountManager.ModifyBG_Amount(ma);
        }
        if (flag)
        {
            X.Msg.Notify(new NotificationConfig()
            {
                Title = "消息提示",
                Html  = string.Format(message, common.IntSafeConvert(cmbyear.SelectedItem.Value) + "年" + "口径:" + name.Split('、')[1], oldValue, newValue),
                Width = 250
            }).Show();
        }
        // Send Message...


        //this.GridPanel1.GetStore().GetById(id).Commit();
    }
コード例 #5
0
        public static bool ModifyBG_Amount(BG_Amount bG_Amount)
        {
            string sql =
                "UPDATE BG_Amount " +
                "SET " +
                "BGAMMon = @BGAMMon, " +
                "BGAMIncome = @BGAMIncome, " +
                "BGAMYear = @BGAMYear, " +
                "DepID = @DepID, " +
                "CBID = @CBID " +
                "WHERE BGAMID = @BGAMID";


            try
            {
                SqlParameter[] para = new SqlParameter[]
                {
                    new SqlParameter("@BGAMID", bG_Amount.BGAMID),
                    new SqlParameter("@BGAMMon", bG_Amount.BGAMMon),
                    new SqlParameter("@BGAMIncome", bG_Amount.BGAMIncome),
                    new SqlParameter("@BGAMYear", bG_Amount.BGAMYear),
                    new SqlParameter("@DepID", bG_Amount.DepID),
                    new SqlParameter("@CBID", bG_Amount.CBID)
                };

                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;
            }
        }
コード例 #6
0
        public static BG_Amount GetBG_AmountByYear(int CBID, int Year, int depid)
        {
            string sql = string.Format("select * from  BG_Amount where CBID=@CBID and BGAMYear=@BGAMYear and DepID=@DepID", CBID, Year, depid);

            try
            {
                SqlParameter[] para = new SqlParameter[]
                {
                    new SqlParameter("@BGAMYear", Year),
                    new SqlParameter("@CBID", CBID),
                    new SqlParameter("@DepID", depid)
                };
                DataTable dt = DBUnity.AdapterToTab(sql, para);

                if (dt.Rows.Count > 0)
                {
                    BG_Amount bG_Amount = new BG_Amount();

                    bG_Amount.BGAMID   = dt.Rows[0]["BGAMID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["BGAMID"];
                    bG_Amount.BGAMMon  = dt.Rows[0]["BGAMMon"] == DBNull.Value ? 0 : (decimal)dt.Rows[0]["BGAMMon"];
                    bG_Amount.BGAMYear = dt.Rows[0]["BGAMYear"] == DBNull.Value ? 0 : (int)dt.Rows[0]["BGAMYear"];
                    bG_Amount.DepID    = dt.Rows[0]["DepID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["DepID"];
                    bG_Amount.CBID     = dt.Rows[0]["CBID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["CBID"];

                    return(bG_Amount);
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                throw e;
            }
        }
コード例 #7
0
 public static bool DeleteBG_Amount(BG_Amount bG_Amount)
 {
     return(DeleteBG_AmountByBGAMID(bG_Amount.BGAMID));
 }
コード例 #8
0
 public static bool ModifyBG_Amount(BG_Amount bG_Amount)
 {
     return(BG_AmountService.ModifyBG_Amount(bG_Amount));
 }
コード例 #9
0
 public static bool DeleteBG_Amount(BG_Amount bG_Amount)
 {
     return(BG_AmountService.DeleteBG_Amount(bG_Amount));
 }
コード例 #10
0
 public static BG_Amount AddBG_Amount(BG_Amount bG_Amount)
 {
     return(BG_AmountService.AddBG_Amount(bG_Amount));
 }