Example #1
0
        public static BG_IncomeCPay AddBG_IncomeCPay(BG_IncomeCPay bG_IncomeCPay)
        {
            string sql =
                "INSERT BG_IncomeCPay (DepID, InComeSouce, InComeMon, ICPTime)" +
                "VALUES (@DepID, @InComeSouce, @InComeMon, @ICPTime)";

            sql += " ; SELECT @@IDENTITY";

            try
            {
                SqlParameter[] para = new SqlParameter[]
                {
                    new SqlParameter("@DepID", bG_IncomeCPay.DepID),
                    new SqlParameter("@InComeSouce", bG_IncomeCPay.InComeSouce),
                    new SqlParameter("@InComeMon", bG_IncomeCPay.InComeMon),
                    new SqlParameter("@ICPTime", bG_IncomeCPay.ICPTime)
                };

                string IdStr = DBUnity.ExecuteScalar(CommandType.Text, sql, para);
                int    newId = Convert.ToInt32(IdStr);
                return(GetBG_IncomeCPayByICPID(newId));
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                throw e;
            }
        }
Example #2
0
        public static BG_IncomeCPay GetBG_IncomeCPayByICPID(int iCPID)
        {
            string sql = "SELECT * FROM BG_IncomeCPay WHERE ICPID = @ICPID";

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

                if (dt.Rows.Count > 0)
                {
                    BG_IncomeCPay bG_IncomeCPay = new BG_IncomeCPay();

                    bG_IncomeCPay.ICPID       = dt.Rows[0]["ICPID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["ICPID"];
                    bG_IncomeCPay.DepID       = dt.Rows[0]["DepID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["DepID"];
                    bG_IncomeCPay.InComeSouce = dt.Rows[0]["InComeSouce"] == DBNull.Value ? "" : (string)dt.Rows[0]["InComeSouce"];
                    bG_IncomeCPay.InComeMon   = dt.Rows[0]["InComeMon"] == DBNull.Value ? 0 : (decimal)dt.Rows[0]["InComeMon"];
                    bG_IncomeCPay.ICPTime     = dt.Rows[0]["ICPTime"] == DBNull.Value ? DateTime.MinValue : (DateTime)dt.Rows[0]["ICPTime"];

                    return(bG_IncomeCPay);
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                throw e;
            }
        }
Example #3
0
    public void Edit(int id, string InComeSouce, string DepName, string oldValue, string newValue, int DepID)
    {
        string        message      = "";
        BG_IncomeCPay bgIncomeCPay = BG_IncomeCPayManager.GetBG_IncomeCPayByICPID(id);

        if (bgIncomeCPay != null)
        {
            message = "<b>部门</b> {0}<br /><b>资金来源</b> {1}<br /><b>原金额:</b> {2}<br /><b>设置金额:</b> {3}";
            //            bgIncomeCPay.DepID = DepID;
            //            bgIncomeCPay.ICPTime= Convert.ToDateTime(CurrentYear+"-" +cmbmon.SelectedItem.Text+"-01");
            bgIncomeCPay.InComeMon = ParseUtil.ToDecimal(newValue, 0);
            //            bgIncomeCPay.InComeSouce = InComeSouce;
            BG_IncomeCPayManager.ModifyBG_IncomeCPay(bgIncomeCPay);
        }
        else
        {
            message                  = "<b>部门</b> {0}<br /><b>资金来源</b> {1}<br /><b>原金额:</b> {2}<br /><b>更改金额:</b> {3}";
            bgIncomeCPay             = new BG_IncomeCPay();
            bgIncomeCPay.DepID       = common.IntSafeConvert(cmbdept.SelectedItem.Value);
            bgIncomeCPay.ICPTime     = Convert.ToDateTime(CurrentYear + "-" + cmbmon.SelectedItem.Text + "-01");
            bgIncomeCPay.InComeMon   = ParseUtil.ToDecimal(newValue, 0);
            bgIncomeCPay.InComeSouce = InComeSouce;
            BG_IncomeCPayManager.AddBG_IncomeCPay(bgIncomeCPay);
        }
        // Send Message...
        X.Msg.Notify(new NotificationConfig()
        {
            Title = "收入金额:",
            Html  = string.Format(message, DepName, InComeSouce, oldValue, newValue),
            Width = 250
        }).Show();
    }
Example #4
0
        public static bool ModifyBG_IncomeCPay(BG_IncomeCPay bG_IncomeCPay)
        {
            string sql =
                "UPDATE BG_IncomeCPay " +
                "SET " +
                "DepID = @DepID, " +
                "InComeSouce = @InComeSouce, " +
                "InComeMon = @InComeMon, " +
                "ICPTime = @ICPTime " +
                "WHERE ICPID = @ICPID";


            try
            {
                SqlParameter[] para = new SqlParameter[]
                {
                    new SqlParameter("@ICPID", bG_IncomeCPay.ICPID),
                    new SqlParameter("@DepID", bG_IncomeCPay.DepID),
                    new SqlParameter("@InComeSouce", bG_IncomeCPay.InComeSouce),
                    new SqlParameter("@InComeMon", bG_IncomeCPay.InComeMon),
                    new SqlParameter("@ICPTime", bG_IncomeCPay.ICPTime)
                };

                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;
            }
        }
Example #5
0
 public static bool DeleteBG_IncomeCPay(BG_IncomeCPay bG_IncomeCPay)
 {
     return(DeleteBG_IncomeCPayByICPID(bG_IncomeCPay.ICPID));
 }
 public static bool ModifyBG_IncomeCPay(BG_IncomeCPay bG_IncomeCPay)
 {
     return(BG_IncomeCPayService.ModifyBG_IncomeCPay(bG_IncomeCPay));
 }
 public static bool DeleteBG_IncomeCPay(BG_IncomeCPay bG_IncomeCPay)
 {
     return(BG_IncomeCPayService.DeleteBG_IncomeCPay(bG_IncomeCPay));
 }
 public static BG_IncomeCPay AddBG_IncomeCPay(BG_IncomeCPay bG_IncomeCPay)
 {
     return(BG_IncomeCPayService.AddBG_IncomeCPay(bG_IncomeCPay));
 }