/// <summary>
        /// 添加一条报销单据
        /// </summary>
        /// <param name="arid">报销单据</param>
        /// <returns>bool</returns>
        public static bool AddARID(BG_ReimDocuments arid)
        {
            bool falg = false;

            try
            {
                string         sqlStr = @"insert into BG_ReimDocuments(ARID,RDType,RDCont,RDTime)values(@ARID,@RDType,@RDCont,@RDTime)";
                SqlParameter[] Pars   = new SqlParameter[] {
                    new SqlParameter("@ARID", arid.ARID),
                    new SqlParameter("@RDType", arid.RDType),
                    new SqlParameter("@RDCont", arid.RDCont),
                    new SqlParameter("@RDTime", arid.RDTime)
                };
                falg = DBUnity.ExecuteNonQuery(CommandType.Text, sqlStr, Pars) > 0;
            }
            catch (Exception ex)
            {
                falg = false;
                Log.WriteLog(ex.Message, "BudgetSys.DAL.BGReimDocumentsService.AddARID");
            }
            return(falg);
        }
Ejemplo n.º 2
0
        public static bool ModifyBG_ProvBudItems(BG_ProvBudItems bG_ProvBudItems)
        {
            string sql =
                "UPDATE BG_ProvBudItems " +
                "SET " +
                "PBType = @PBType, " +
                "PBMon = @PBMon, " +
                "PBYear = @PBYear, " +
                "DepID = @DepID " +
                "WHERE PBID = @PBID";


            try
            {
                SqlParameter[] para = new SqlParameter[]
                {
                    new SqlParameter("@PBID", bG_ProvBudItems.PBID),
                    new SqlParameter("@PBType", bG_ProvBudItems.PBType),
                    new SqlParameter("@PBMon", bG_ProvBudItems.PBMon),
                    new SqlParameter("@PBYear", bG_ProvBudItems.PBYear),
                    new SqlParameter("@DepID", bG_ProvBudItems.DepID)
                };

                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;
            }
        }
        internal static DataTable GetApplyReimburByDepID(int DepID, int year)
        {
            DataTable dt = new DataTable();

            try
            {
                string sqlStr = string.Format("select * from BG_BudItems where DepID={0} and BIYear={1} order by BudID desc", DepID, year);

                if (DepID == 0)
                {
                    sqlStr = string.Format("select * from BG_BudItems order by BudID desc");
                }

                dt = DBUnity.AdapterToTab(sqlStr);
            }
            catch (Exception ex)
            {
                dt = new DataTable();
                Log.WriteLog(ex.Message, "BGBudItemsService--GetApplyReimburByDepID");
            }
            return(dt);
        }
        public static bool ModifyBG_Quota(BG_Quota bG_Quota)
        {
            string sql =
                "UPDATE BG_Quota " +
                "SET " +
                "PIID = @PIID, " +
                "Money = @Money, " +
                "Qtime = @Qtime, " +
                "DepID = @DepID " +
                "WHERE QtID = @QtID";


            try
            {
                SqlParameter[] para = new SqlParameter[]
                {
                    new SqlParameter("@QtID", bG_Quota.QtID),
                    new SqlParameter("@PIID", bG_Quota.PIID),
                    new SqlParameter("@Money", bG_Quota.Money),
                    new SqlParameter("@Qtime", bG_Quota.Qtime),
                    new SqlParameter("@DepID", bG_Quota.DepID)
                };

                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;
            }
        }
Ejemplo n.º 5
0
        public static bool ModifyBG_FixedAssets(BG_FixedAssets bG_FixedAssets)
        {
            string sql =
                "UPDATE BG_FixedAssets " +
                "SET " +
                "FACode = @FACode, " +
                "FAMon = @FAMon, " +
                "FAYear = @FAYear, " +
                "FAMonth = @FAMonth " +
                "WHERE FAID = @FAID";


            try
            {
                SqlParameter[] para = new SqlParameter[]
                {
                    new SqlParameter("@FAID", bG_FixedAssets.FAID),
                    new SqlParameter("@FACode", bG_FixedAssets.FACode),
                    new SqlParameter("@FAMon", bG_FixedAssets.FAMon),
                    new SqlParameter("@FAYear", bG_FixedAssets.FAYear),
                    new SqlParameter("@FAMonth", bG_FixedAssets.FAMonth)
                };

                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_ReimDocuments(BG_ReimDocuments bG_ReimDocuments)
        {
            string sql =
                "UPDATE BG_ReimDocuments " +
                "SET " +
                "ARID = @ARID, " +
                "RDType = @RDType, " +
                "RDCont = @RDCont, " +
                "RDTime = @RDTime " +
                "WHERE RDID = @RDID";


            try
            {
                SqlParameter[] para = new SqlParameter[]
                {
                    new SqlParameter("@RDID", bG_ReimDocuments.RDID),
                    new SqlParameter("@ARID", bG_ReimDocuments.ARID),
                    new SqlParameter("@RDType", bG_ReimDocuments.RDType),
                    new SqlParameter("@RDCont", bG_ReimDocuments.RDCont),
                    new SqlParameter("@RDTime", bG_ReimDocuments.RDTime)
                };

                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;
            }
        }
Ejemplo n.º 7
0
        public static BG_ProBasiPerPayTwo GetBG_ProBasiPerPayTwoByPTID(int pTID)
        {
            string sql = "SELECT * FROM BG_ProBasiPerPayTwo WHERE PTID = @PTID";

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

                if (dt.Rows.Count > 0)
                {
                    BG_ProBasiPerPayTwo bG_ProBasiPerPayTwo = new BG_ProBasiPerPayTwo();

                    bG_ProBasiPerPayTwo.PTID           = dt.Rows[0]["PTID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["PTID"];
                    bG_ProBasiPerPayTwo.DepID          = dt.Rows[0]["DepID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["DepID"];
                    bG_ProBasiPerPayTwo.PTYear         = dt.Rows[0]["PTYear"] == DBNull.Value ? DateTime.MinValue : (DateTime)dt.Rows[0]["PTYear"];
                    bG_ProBasiPerPayTwo.RetiredPerP    = dt.Rows[0]["RetiredPerP"] == DBNull.Value ? 0 : (decimal)dt.Rows[0]["RetiredPerP"];
                    bG_ProBasiPerPayTwo.RetiredPubP    = dt.Rows[0]["RetiredPubP"] == DBNull.Value ? 0 : (decimal)dt.Rows[0]["RetiredPubP"];
                    bG_ProBasiPerPayTwo.RetirementPerP = dt.Rows[0]["RetirementPerP"] == DBNull.Value ? 0 : (decimal)dt.Rows[0]["RetirementPerP"];
                    bG_ProBasiPerPayTwo.RetirementPubP = dt.Rows[0]["RetirementPubP"] == DBNull.Value ? 0 : (decimal)dt.Rows[0]["RetirementPubP"];
                    bG_ProBasiPerPayTwo.PTHF           = dt.Rows[0]["PTHF"] == DBNull.Value ? 0 : (decimal)dt.Rows[0]["PTHF"];
                    bG_ProBasiPerPayTwo.PTME           = dt.Rows[0]["PTME"] == DBNull.Value ? 0 : (decimal)dt.Rows[0]["PTME"];
                    bG_ProBasiPerPayTwo.PTOther        = dt.Rows[0]["PTOther"] == DBNull.Value ? 0 : (decimal)dt.Rows[0]["PTOther"];
                    bG_ProBasiPerPayTwo.PTTitol        = dt.Rows[0]["PTTitol"] == DBNull.Value ? 0 : (decimal)dt.Rows[0]["PTTitol"];

                    return(bG_ProBasiPerPayTwo);
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                throw e;
            }
        }
Ejemplo n.º 8
0
        /// <summary>
        /// 添加一条附件信息
        /// </summary>
        /// <param name="radid">附件</param>
        /// <returns>bool</returns>
        public static bool AddAccessories(BG_ReimAppendix radid)
        {
            bool falg = false;

            try
            {
                string sqlStr = @"insert into BG_ReimAppendix(ARID,ARType,ARName,ARContent,ARTime) 
            values(@ARID,@ARType,@ARName,@ARContent,@ARTime)";

                SqlParameter[] Pars = new SqlParameter[] {
                    new SqlParameter("@ARID", radid.ARID),
                    new SqlParameter("@ARType", radid.ARType),
                    new SqlParameter("@ARName", radid.ARName),
                    new SqlParameter("@ARContent", radid.ARContent),
                    new SqlParameter("@ARTime", radid.ARTime)
                };
                falg = DBUnity.ExecuteNonQuery(CommandType.Text, sqlStr, Pars) > 0;
            }
            catch
            {
            }
            return(falg);
        }
Ejemplo n.º 9
0
        /// <summary>
        /// 修改指定报销附件信息
        /// </summary>
        /// <param name="radid">附件信息</param>
        /// <returns>bool</returns>
        public static bool UpdAccessories(BG_ReimAppendix radid)
        {
            bool flag = false;

            try
            {
                string         sqlStr = @"update  BG_ReimAppendix set ARID=@ARID,ARType=@ARType,ARName=@ARName,ARContent=@ARContent,ARTime=@ARTime  where RADID = @RADID";
                SqlParameter[] Pars   = new SqlParameter[] {
                    new SqlParameter("@RADID", radid.RADID),
                    new SqlParameter("@ARID", radid.ARID),
                    new SqlParameter("@ARType", radid.ARType),
                    new SqlParameter("@ARName", radid.ARName),
                    new SqlParameter("@ARContent", radid.ARContent),
                    new SqlParameter("@ARTime", radid.ARTime)
                };
                flag = DBUnity.ExecuteNonQuery(CommandType.Text, sqlStr, Pars) > 0;
            }
            catch
            {
            }

            return(flag);
        }
        /// <summary>
        /// 修改指定报销单据
        /// </summary>
        /// <param name="arid">报销单据</param>
        /// <returns>bool</returns>
        public static bool UpdReimDocuments(BG_ReimDocuments arid)
        {
            bool flag = false;

            try
            {
                string         sqlStr = @"update BG_ReimDocuments set RDType=@RDType,RDCont=@RDCont,RDTime=@RDTime  where ARID=@ARID";
                SqlParameter[] Pars   = new SqlParameter[] {
                    new SqlParameter("@ARID", arid.ARID),
                    new SqlParameter("@RDType", arid.RDType),
                    new SqlParameter("@RDCont", arid.RDCont),
                    new SqlParameter("@RDTime", arid.RDTime)
                };
                flag = DBUnity.ExecuteNonQuery(CommandType.Text, sqlStr, Pars) > 0;
            }
            catch (Exception ex)
            {
                flag = false;
                Log.WriteLog(ex.Message, "BudgetSys.DAL.BGReimDocumentsService.UpdReimDocuments");
            }

            return(flag);
        }
        /// <summary>
        ///显示退回原因
        /// </summary>
        /// <param name="arid">申请表ID</param>
        /// <param name="arliststa">申请表状态</param>
        /// <returns>bool</returns>
        public static bool UpdApplication(string status, string txt, string idStrs)
        {
            bool flag = false;

            try
            {
                string sqlStr = "update  BG_ApplyReimbur set ARListSta='{0}', ARReason='{1}' where ARID in ({2})";
                //SqlParameter[] Pars = new SqlParameter[]{
                //        new SqlParameter("@ARID",arid),
                //        new SqlParameter("@ARListSta",arliststa),
                //        };

                sqlStr = string.Format(sqlStr, status, txt, idStrs);
                flag   = DBUnity.ExecuteNonQuery(CommandType.Text, sqlStr, null) > 0;
            }
            catch (Exception ex)
            {
                flag = false;
                Log.WriteLog(ex.Message, "BudgetSys.DAL.BGApplyReimburService.UpdApplication");
            }

            return(flag);
        }
Ejemplo n.º 12
0
        public static bool ModifyBG_SysSetting(BG_SysSetting bG_SysSetting)
        {
            string sql =
                "UPDATE BG_SysSetting " +
                "SET " +
                "SysName = @SysName, " +
                "DefaultYear = @DefaultYear, " +
                "PepNum = @PepNum " +
                "WHERE SSID = @SSID";


            try
            {
                SqlParameter[] para = new SqlParameter[]
                {
                    new SqlParameter("@SSID", bG_SysSetting.SSID),
                    new SqlParameter("@SysName", bG_SysSetting.SysName),
                    new SqlParameter("@DefaultYear", bG_SysSetting.DefaultYear),
                    new SqlParameter("@PepNum", bG_SysSetting.PepNum)
                };

                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;
            }
        }
Ejemplo n.º 13
0
        public static bool ModifyBG_Mon(BG_Mon bG_Mon)
        {
            string sql =
                "UPDATE BG_Mon " +
                "SET " +
                "BGMon = @BGMon, " +
                "BGYear = @BGYear, " +
                "IsEditMon = @IsEditMon " +
                "WHERE BGID = @BGID";


            try
            {
                SqlParameter[] para = new SqlParameter[]
                {
                    new SqlParameter("@BGID", bG_Mon.BGID),
                    new SqlParameter("@BGMon", bG_Mon.BGMon),
                    new SqlParameter("@BGYear", bG_Mon.BGYear),
                    new SqlParameter("@IsEditMon", bG_Mon.IsEditMon)
                };

                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 BG_PayWelExpen GetBG_PayWelExpenByPWEID(int pWEID)
        {
            string sql = "SELECT * FROM BG_PayWelExpen WHERE PWEID = @PWEID";

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

                if (dt.Rows.Count > 0)
                {
                    BG_PayWelExpen bG_PayWelExpen = new BG_PayWelExpen();

                    bG_PayWelExpen.PWEID       = dt.Rows[0]["PWEID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["PWEID"];
                    bG_PayWelExpen.PWEYear     = dt.Rows[0]["PWEYear"] == DBNull.Value ? 0 : (int)dt.Rows[0]["PWEYear"];
                    bG_PayWelExpen.DepID       = dt.Rows[0]["DepID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["DepID"];
                    bG_PayWelExpen.PWESubTotal = dt.Rows[0]["PWESubTotal"] == DBNull.Value ? 0 : (decimal)dt.Rows[0]["PWESubTotal"];
                    bG_PayWelExpen.PWEBasWage  = dt.Rows[0]["PWEBasWage"] == DBNull.Value ? 0 : (decimal)dt.Rows[0]["PWEBasWage"];
                    bG_PayWelExpen.PWEAlloSub  = dt.Rows[0]["PWEAlloSub"] == DBNull.Value ? 0 : (decimal)dt.Rows[0]["PWEAlloSub"];
                    bG_PayWelExpen.PWEPrize    = dt.Rows[0]["PWEPrize"] == DBNull.Value ? 0 : (decimal)dt.Rows[0]["PWEPrize"];
                    bG_PayWelExpen.PWEPerWage  = dt.Rows[0]["PWEPerWage"] == DBNull.Value ? 0 : (decimal)dt.Rows[0]["PWEPerWage"];
                    bG_PayWelExpen.PWESafePay  = dt.Rows[0]["PWESafePay"] == DBNull.Value ? 0 : (decimal)dt.Rows[0]["PWESafePay"];
                    bG_PayWelExpen.PWEOth      = dt.Rows[0]["PWEOth"] == DBNull.Value ? 0 : (decimal)dt.Rows[0]["PWEOth"];

                    return(bG_PayWelExpen);
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                throw e;
            }
        }
        public static BG_OutlayAna GetBG_OutlayAnaByOAID(int oAID)
        {
            string sql = "SELECT * FROM BG_OutlayAna WHERE OAID = @OAID";

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

                if (dt.Rows.Count > 0)
                {
                    BG_OutlayAna bG_OutlayAna = new BG_OutlayAna();

                    bG_OutlayAna.OAID     = dt.Rows[0]["OAID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["OAID"];
                    bG_OutlayAna.PIID     = dt.Rows[0]["PIID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["PIID"];
                    bG_OutlayAna.PPID     = dt.Rows[0]["PPID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["PPID"];
                    bG_OutlayAna.DepID    = dt.Rows[0]["DepID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["DepID"];
                    bG_OutlayAna.OABudMon = dt.Rows[0]["OABudMon"] == DBNull.Value ? 0 : (decimal)dt.Rows[0]["OABudMon"];
                    bG_OutlayAna.OAAudMon = dt.Rows[0]["OAAudMon"] == DBNull.Value ? 0 : (decimal)dt.Rows[0]["OAAudMon"];
                    bG_OutlayAna.OACkMon  = dt.Rows[0]["OACkMon"] == DBNull.Value ? 0 : (decimal)dt.Rows[0]["OACkMon"];
                    bG_OutlayAna.OAType   = dt.Rows[0]["OAType"] == DBNull.Value ? "" : (string)dt.Rows[0]["OAType"];
                    bG_OutlayAna.OAYear   = dt.Rows[0]["OAYear"] == DBNull.Value ? 0 : (int)dt.Rows[0]["OAYear"];
                    bG_OutlayAna.Mark     = dt.Rows[0]["Mark"] == DBNull.Value ? "" : (string)dt.Rows[0]["Mark"];

                    return(bG_OutlayAna);
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                throw e;
            }
        }
        public static BG_PayWelSupply AddBG_PayWelSupply(BG_PayWelSupply bG_PayWelSupply)
        {
            string sql =
                "INSERT BG_PayWelSupply (GSEYear, DepID, GSETotal, OffSubTot, OffPerPart, OffPubPart, EbbSubTot, EbbPerPart, EbbPubPart, GSEHouPro, GSEMedChar, LifeAllo, GSEOther)" +
                "VALUES (@GSEYear, @DepID, @GSETotal, @OffSubTot, @OffPerPart, @OffPubPart, @EbbSubTot, @EbbPerPart, @EbbPubPart, @GSEHouPro, @GSEMedChar, @LifeAllo, @GSEOther)";

            sql += " ; SELECT @@IDENTITY";

            try
            {
                SqlParameter[] para = new SqlParameter[]
                {
                    new SqlParameter("@GSEYear", bG_PayWelSupply.GSEYear),
                    new SqlParameter("@DepID", bG_PayWelSupply.DepID),
                    new SqlParameter("@GSETotal", bG_PayWelSupply.GSETotal),
                    new SqlParameter("@OffSubTot", bG_PayWelSupply.OffSubTot),
                    new SqlParameter("@OffPerPart", bG_PayWelSupply.OffPerPart),
                    new SqlParameter("@OffPubPart", bG_PayWelSupply.OffPubPart),
                    new SqlParameter("@EbbSubTot", bG_PayWelSupply.EbbSubTot),
                    new SqlParameter("@EbbPerPart", bG_PayWelSupply.EbbPerPart),
                    new SqlParameter("@EbbPubPart", bG_PayWelSupply.EbbPubPart),
                    new SqlParameter("@GSEHouPro", bG_PayWelSupply.GSEHouPro),
                    new SqlParameter("@GSEMedChar", bG_PayWelSupply.GSEMedChar),
                    new SqlParameter("@LifeAllo", bG_PayWelSupply.LifeAllo),
                    new SqlParameter("@GSEOther", bG_PayWelSupply.GSEOther)
                };

                string IdStr = DBUnity.ExecuteScalar(CommandType.Text, sql, para);
                int    newId = Convert.ToInt32(IdStr);
                return(GetBG_PayWelSupplyByGSEID(newId));
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                throw e;
            }
        }
Ejemplo n.º 17
0
        public static BG_MonPayPlan_His GetBG_MonPayPlan_HisByMPPHis(int mPPHis)
        {
            string sql = "SELECT * FROM BG_MonPayPlan_His WHERE MPPHis = @MPPHis";

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

                if (dt.Rows.Count > 0)
                {
                    BG_MonPayPlan_His bG_MonPayPlan_His = new BG_MonPayPlan_His();

                    bG_MonPayPlan_His.MPPHis            = dt.Rows[0]["MPPHis"] == DBNull.Value ? 0 : (int)dt.Rows[0]["MPPHis"];
                    bG_MonPayPlan_His.PIID              = dt.Rows[0]["PIID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["PIID"];
                    bG_MonPayPlan_His.MPFunding         = dt.Rows[0]["MPFunding"] == DBNull.Value ? 0 : (decimal)dt.Rows[0]["MPFunding"];
                    bG_MonPayPlan_His.DeptID            = dt.Rows[0]["DeptID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["DeptID"];
                    bG_MonPayPlan_His.MPTime            = dt.Rows[0]["MPTime"] == DBNull.Value ? DateTime.MinValue : (DateTime)dt.Rows[0]["MPTime"];
                    bG_MonPayPlan_His.MPRemark          = dt.Rows[0]["MPRemark"] == DBNull.Value ? "" : (string)dt.Rows[0]["MPRemark"];
                    bG_MonPayPlan_His.CPID              = dt.Rows[0]["CPID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["CPID"];
                    bG_MonPayPlan_His.MPPHisTime        = dt.Rows[0]["MPPHisTime"] == DBNull.Value ? DateTime.MinValue : (DateTime)dt.Rows[0]["MPPHisTime"];
                    bG_MonPayPlan_His.MPFundingAdd      = dt.Rows[0]["MPFundingAdd"] == DBNull.Value ? 0 : (decimal)dt.Rows[0]["MPFundingAdd"];
                    bG_MonPayPlan_His.MPFundingAddTimes = dt.Rows[0]["MPFundingAddTimes"] == DBNull.Value ? 0 : (int)dt.Rows[0]["MPFundingAddTimes"];

                    return(bG_MonPayPlan_His);
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                throw e;
            }
        }
        public static BG_ProBasiPerPayOne GetBG_ProBasiPerPayOneByPOID(int pOID)
        {
            string sql = "SELECT * FROM BG_ProBasiPerPayOne WHERE POID = @POID";

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

                if (dt.Rows.Count > 0)
                {
                    BG_ProBasiPerPayOne bG_ProBasiPerPayOne = new BG_ProBasiPerPayOne();

                    bG_ProBasiPerPayOne.POID    = dt.Rows[0]["POID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["POID"];
                    bG_ProBasiPerPayOne.DepID   = dt.Rows[0]["DepID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["DepID"];
                    bG_ProBasiPerPayOne.POYear  = dt.Rows[0]["POYear"] == DBNull.Value ? DateTime.MinValue : (DateTime)dt.Rows[0]["POYear"];
                    bG_ProBasiPerPayOne.POBS    = dt.Rows[0]["POBS"] == DBNull.Value ? 0 : (decimal)dt.Rows[0]["POBS"];
                    bG_ProBasiPerPayOne.POAS    = dt.Rows[0]["POAS"] == DBNull.Value ? 0 : (decimal)dt.Rows[0]["POAS"];
                    bG_ProBasiPerPayOne.POBonus = dt.Rows[0]["POBonus"] == DBNull.Value ? 0 : (decimal)dt.Rows[0]["POBonus"];
                    bG_ProBasiPerPayOne.POPS    = dt.Rows[0]["POPS"] == DBNull.Value ? 0 : (decimal)dt.Rows[0]["POPS"];
                    bG_ProBasiPerPayOne.POSE    = dt.Rows[0]["POSE"] == DBNull.Value ? 0 : (decimal)dt.Rows[0]["POSE"];
                    bG_ProBasiPerPayOne.POOther = dt.Rows[0]["POOther"] == DBNull.Value ? 0 : (decimal)dt.Rows[0]["POOther"];
                    bG_ProBasiPerPayOne.POTitol = dt.Rows[0]["POTitol"] == DBNull.Value ? 0 : (decimal)dt.Rows[0]["POTitol"];

                    return(bG_ProBasiPerPayOne);
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                throw e;
            }
        }
Ejemplo n.º 19
0
        public static bool ModifyBG_PreviewDevide(BG_PreviewDevide bG_PreviewDevide)
        {
            string sql =
                "UPDATE BG_PreviewDevide " +
                "SET " +
                "DepID = @DepID, " +
                "PSID = @PSID, " +
                "DevMon = @DevMon " +
                "WHERE PDID = @PDID";


            try
            {
                SqlParameter[] para = new SqlParameter[]
                {
                    new SqlParameter("@PDID", bG_PreviewDevide.PDID),
                    new SqlParameter("@DepID", bG_PreviewDevide.DepID),
                    new SqlParameter("@PSID", bG_PreviewDevide.PSID),
                    new SqlParameter("@DevMon", bG_PreviewDevide.DevMon)
                };

                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 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;
            }
        }
        /// <summary>
        /// 添加预算项目附件信息
        /// </summary>
        /// <returns>bool</returns>
        public static bool AddBudAppendix(BG_BudAppendix BudAppendix)
        {
            bool flag = false;

            try
            {
                string sqlStr = @"insert into BG_BudAppendix(BudID,APPath,ApName,ApTime) 
                values(@BudID,@APPath,@ApName,@ApTime)";

                SqlParameter[] Pars = new SqlParameter[] {
                    new SqlParameter("@BudID", BudAppendix.BudID),
                    new SqlParameter("@APPath", BudAppendix.APPath),
                    new SqlParameter("@ApName", BudAppendix.ApName),
                    new SqlParameter("@ApTime", BudAppendix.ApTime)
                };
                flag = DBUnity.ExecuteNonQuery(CommandType.Text, sqlStr, Pars) > 0;
            }
            catch (Exception ex)
            {
                flag = false;
                Log.WriteLog(ex.Message, "BGBudAppendixService--AddBudAppendix");
            }
            return(flag);
        }
        public static bool ModifyBG_Caliber(BG_Caliber bG_Caliber)
        {
            string sql =
                "UPDATE BG_Caliber " +
                "SET " +
                "CaliberName = @CaliberName, " +
                "ParentID = @ParentID ," + "CbLever = @CbLever " +
                "WHERE CaliberID = @CaliberID";


            try
            {
                SqlParameter[] para = new SqlParameter[]
                {
                    new SqlParameter("@CaliberID", bG_Caliber.CaliberID),
                    new SqlParameter("@CaliberName", bG_Caliber.CaliberName),
                    new SqlParameter("@ParentID", bG_Caliber.ParentID),
                    new SqlParameter("@CbLever", bG_Caliber.CbLever)
                };

                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;
            }
        }
Ejemplo n.º 23
0
        /// <summary>
        /// 查询指定BudID的所有历史操作轨迹
        /// </summary>
        /// <param name="budid"></param>
        /// <returns></returns>
        public static DataTable GetDtBIHisByBudid(int budid, int PageSize, int pageIndex, out int RecordCount)
        {
            DataTable dt = null;

            RecordCount = 0;
            string sqlStr = "select * from BG_BudItemHis";
            string filter = " where BudID ={0} order by BudID asc";

            filter  = string.Format(filter, budid);
            sqlStr += filter;
            try
            {
                string sql_bc   = "select count(*) from BG_BudItemHis  where BudID = " + budid.ToString();
                string CountStr = DBUnity.ExecuteScalar(CommandType.Text, sql_bc, null);
                RecordCount = common.IntSafeConvert(CountStr);
                dt          = DBUnity.GetAspNetPager(sqlStr, pageIndex, PageSize);
            }
            catch (Exception ex)
            {
                dt = new DataTable();
                Log.WriteLog(ex.Message, "BG_BudItemHisService--GetDtBIHisByBudid");
            }
            return(dt);
        }
        /// <summary>
        /// 查询指定部门下所有预算信息
        /// </summary>
        /// <param name="arid">预算信息</param>
        /// <returns>BGUser</returns>
        public static DataTable GetApplyReimburByDepIDPager(int DepID, int pageIndex, int PageSize, out int RecordCount)
        {
            DataTable dt = new DataTable();

            RecordCount = 0;
            try
            {
                string sqlStr    = string.Format("select * from BG_BudItems where DepID={0} order by BudID desc", DepID);
                string sqlRecord = string.Format("select count(*) from BG_BudItems where DepID={0} ", DepID);
                if (DepID == 0)
                {
                    sqlStr    = string.Format("select * from BG_BudItems order by BudID desc");
                    sqlRecord = string.Format("select count(*) from BG_BudItems");
                }
                RecordCount = common.IntSafeConvert(DBUnity.ExecuteScalar(CommandType.Text, sqlRecord, null));
                dt          = DBUnity.GetAspNetPager(sqlStr, pageIndex, PageSize);
            }
            catch (Exception ex)
            {
                dt = new DataTable();
                Log.WriteLog(ex.Message, "BGBudItemsService--GetApplyReimburByDepID");
            }
            return(dt);
        }
Ejemplo n.º 25
0
        /// <summary>
        /// 查询一条指定附件信息
        /// </summary>
        /// <param name="arid">附件信息ID</param>
        /// <returns>BG_ReimAppendix</returns>
        public static BG_ReimAppendix GetAcc(string arid)
        {
            BG_ReimAppendix rm = new BG_ReimAppendix();

            try
            {
                string sqlStr = "select * from BG_ReimAppendix where ARID={0} ";
                sqlStr = string.Format(sqlStr, arid);
                DataTable dt = DBUnity.AdapterToTab(sqlStr);
                if (dt.Rows.Count > 0)
                {
                    rm.RADID     = common.IntSafeConvert(dt.Rows[0]["RADID"]);
                    rm.ARID      = common.IntSafeConvert(dt.Rows[0]["ARID"]);
                    rm.ARType    = dt.Rows[0]["ARType"].ToString();
                    rm.ARTime    = DateTime.Parse(dt.Rows[0]["ARTime"].ToString());
                    rm.ARContent = dt.Rows[0]["ARContent"].ToString();
                }
            }
            catch
            {
            }

            return(rm);
        }
        public static BG_MonPayPlan_Attach GetBG_MonPayPlan_AttachByCPAID(int cPAID)
        {
            string sql = "SELECT * FROM BG_MonPayPlan_Attach WHERE CPAID = @CPAID";

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

                if (dt.Rows.Count > 0)
                {
                    BG_MonPayPlan_Attach bG_MonPayPlan_Attach = new BG_MonPayPlan_Attach();

                    bG_MonPayPlan_Attach.CPAID        = dt.Rows[0]["CPAID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["CPAID"];
                    bG_MonPayPlan_Attach.PIID         = dt.Rows[0]["PIID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["PIID"];
                    bG_MonPayPlan_Attach.MPFunding    = dt.Rows[0]["MPFunding"] == DBNull.Value ? 0 : (decimal)dt.Rows[0]["MPFunding"];
                    bG_MonPayPlan_Attach.DeptID       = dt.Rows[0]["DeptID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["DeptID"];
                    bG_MonPayPlan_Attach.MPTime       = dt.Rows[0]["MPTime"] == DBNull.Value ? DateTime.MinValue : (DateTime)dt.Rows[0]["MPTime"];
                    bG_MonPayPlan_Attach.MPRemark     = dt.Rows[0]["MPRemark"] == DBNull.Value ? "" : (string)dt.Rows[0]["MPRemark"];
                    bG_MonPayPlan_Attach.MPFundingAdd = dt.Rows[0]["MPFundingAdd"] == DBNull.Value ? 0 : (decimal)dt.Rows[0]["MPFundingAdd"];
                    bG_MonPayPlan_Attach.CPATimes     = dt.Rows[0]["CPATimes"] == DBNull.Value ? 0 : (int)dt.Rows[0]["CPATimes"];
                    bG_MonPayPlan_Attach.CPID         = dt.Rows[0]["CPID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["CPID"];

                    return(bG_MonPayPlan_Attach);
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                throw e;
            }
        }
Ejemplo n.º 27
0
        public static BG_User AddBG_User(BG_User bG_User)
        {
            string sql =
                "INSERT BG_User (UserName, UserNum, UserIDNum, UserPwd, UserLim, UserSta, DepID, UserRem, IsVIP, UserDescription, IsLogin, ApplyRem)" +
                "VALUES (@UserName, @UserNum, @UserIDNum, @UserPwd, @UserLim, @UserSta, @DepID, @UserRem, @IsVIP, @UserDescription, @IsLogin, @ApplyRem)";

            sql += " ; SELECT @@IDENTITY";

            try
            {
                SqlParameter[] para = new SqlParameter[]
                {
                    new SqlParameter("@UserName", bG_User.UserName),
                    new SqlParameter("@UserNum", bG_User.UserNum),
                    new SqlParameter("@UserIDNum", bG_User.UserIDNum),
                    new SqlParameter("@UserPwd", bG_User.UserPwd),
                    new SqlParameter("@UserLim", bG_User.UserLim),
                    new SqlParameter("@UserSta", bG_User.UserSta),
                    new SqlParameter("@DepID", bG_User.DepID),
                    new SqlParameter("@UserRem", bG_User.UserRem),
                    new SqlParameter("@IsVIP", bG_User.IsVIP),
                    new SqlParameter("@UserDescription", bG_User.UserDescription),
                    new SqlParameter("@IsLogin", bG_User.IsLogin),
                    new SqlParameter("@ApplyRem", bG_User.ApplyRem)
                };

                string IdStr = DBUnity.ExecuteScalar(CommandType.Text, sql, para);
                int    newId = Convert.ToInt32(IdStr);
                return(GetBG_UserByUserID(newId));
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                throw e;
            }
        }
        /// <summary>
        /// 修改指定预算项目附件信息
        /// </summary>
        /// <param name="BudAppendix">BGBudAppendix</param>
        /// <returns>bool</returns>
        public static bool UpdBudAppendix(BG_BudAppendix BudAppendix)
        {
            bool flag = false;

            try
            {
                string         sqlStr = @"update from BG_BudAppendix set APID = @APID,BudID=@BudID,APPath=@APPath,
            ApName=@ApName,ApTime=@ApTime where APID = @APID";
                SqlParameter[] Pars   = new SqlParameter[] {
                    new SqlParameter("@APID", BudAppendix.APID),
                    new SqlParameter("@BudID", BudAppendix.BudID),
                    new SqlParameter("@APPath", BudAppendix.APPath),
                    new SqlParameter("@ApName", BudAppendix.ApName),
                    new SqlParameter("@ApTime", BudAppendix.ApTime)
                };
                flag = DBUnity.ExecuteNonQuery(CommandType.Text, sqlStr, Pars) > 0;
            }
            catch (Exception ex)
            {
                flag = false;
                Log.WriteLog(ex.Message, "BGBudAppendixService--UpdBudAppendix");
            }
            return(flag);
        }
Ejemplo n.º 29
0
        public static BG_BudgetAllocationHis AddBG_BudgetAllocationHis(BG_BudgetAllocationHis bG_BudgetAllocationHis)
        {
            string sql =
                "INSERT BG_BudgetAllocationHis (BAAID, DepID, PIID, AddBAAMon, AddSuppMon, UserOp, Crtime, OldBAAMon, OldSuppMon, NewBAAMon, NewSuppMon, DepName)" +
                "VALUES (@BAAID, @DepID, @PIID, @AddBAAMon, @AddSuppMon, @UserOp, @Crtime, @OldBAAMon, @OldSuppMon, @NewBAAMon, @NewSuppMon, @DepName)";

            sql += " ; SELECT @@IDENTITY";

            try
            {
                SqlParameter[] para = new SqlParameter[]
                {
                    new SqlParameter("@BAAID", bG_BudgetAllocationHis.BAAID),
                    new SqlParameter("@DepID", bG_BudgetAllocationHis.DepID),
                    new SqlParameter("@PIID", bG_BudgetAllocationHis.PIID),
                    new SqlParameter("@AddBAAMon", bG_BudgetAllocationHis.AddBAAMon),
                    new SqlParameter("@AddSuppMon", bG_BudgetAllocationHis.AddSuppMon),
                    new SqlParameter("@UserOp", bG_BudgetAllocationHis.UserOp),
                    new SqlParameter("@Crtime", bG_BudgetAllocationHis.Crtime),
                    new SqlParameter("@OldBAAMon", bG_BudgetAllocationHis.OldBAAMon),
                    new SqlParameter("@OldSuppMon", bG_BudgetAllocationHis.OldSuppMon),
                    new SqlParameter("@NewBAAMon", bG_BudgetAllocationHis.NewBAAMon),
                    new SqlParameter("@NewSuppMon", bG_BudgetAllocationHis.NewSuppMon),
                    new SqlParameter("@DepName", bG_BudgetAllocationHis.DepName)
                };

                string IdStr = DBUnity.ExecuteScalar(CommandType.Text, sql, para);
                int    newId = Convert.ToInt32(IdStr);
                return(GetBG_BudgetAllocationHisByBAAHisID(newId));
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                throw e;
            }
        }
        public static bool ModifyBG_BudItems(BG_BudItems bG_BudItems)
        {
            string sql =
                "UPDATE BG_BudItems " +
                "SET " +
                "BIProType = @BIProType, " +
                "BIFunSub = @BIFunSub, " +
                "BICode = @BICode, " +
                "PPID = @PPID, " +
                "PIID = @PIID, " +
                "BIPlanHz = @BIPlanHz, " +
                "BIStaTime = @BIStaTime, " +
                "BIEndTime = @BIEndTime, " +
                "BICharger = @BICharger, " +
                "BIAttr = @BIAttr, " +
                "BIAppReaCon = @BIAppReaCon, " +
                "BIExpGistExp = @BIExpGistExp, " +
                "BILongGoal = @BILongGoal, " +
                "BIYearGoal = @BIYearGoal, " +
                "BIMon = @BIMon, " +
                "BIAppConMon = @BIAppConMon, " +
                "BIMonSou = @BIMonSou, " +
                "BIFinAllo = @BIFinAllo, " +
                "BILastYearCarry = @BILastYearCarry, " +
                "BIOthFun = @BIOthFun, " +
                "BIOthExpProb = @BIOthExpProb, " +
                "BIBudSta = @BIBudSta, " +
                "BudSta = @BudSta, " +
                "BICause = @BICause, " +
                "DepID = @DepID, " +
                "BIProName = @BIProName, " +
                "BIReportTime = @BIReportTime, " +
                "BIConNum = @BIConNum, " +
                "BIProDescrip = @BIProDescrip, " +
                "BIProCategory = @BIProCategory, " +
                "BIYear = @BIYear " +
                "WHERE BudID = @BudID";


            try
            {
                SqlParameter[] para = new SqlParameter[]
                {
                    new SqlParameter("@BudID", bG_BudItems.BudID),
                    new SqlParameter("@BIProType", bG_BudItems.BIProType),
                    new SqlParameter("@BIFunSub", bG_BudItems.BIFunSub),
                    new SqlParameter("@BICode", bG_BudItems.BICode),
                    new SqlParameter("@PPID", bG_BudItems.PPID),
                    new SqlParameter("@PIID", bG_BudItems.PIID),
                    new SqlParameter("@BIPlanHz", bG_BudItems.BIPlanHz),
                    new SqlParameter("@BIStaTime", bG_BudItems.BIStaTime),
                    new SqlParameter("@BIEndTime", bG_BudItems.BIEndTime),
                    new SqlParameter("@BICharger", bG_BudItems.BICharger),
                    new SqlParameter("@BIAttr", bG_BudItems.BIAttr),
                    new SqlParameter("@BIAppReaCon", bG_BudItems.BIAppReaCon),
                    new SqlParameter("@BIExpGistExp", bG_BudItems.BIExpGistExp),
                    new SqlParameter("@BILongGoal", bG_BudItems.BILongGoal),
                    new SqlParameter("@BIYearGoal", bG_BudItems.BIYearGoal),
                    new SqlParameter("@BIMon", bG_BudItems.BIMon),
                    new SqlParameter("@BIAppConMon", bG_BudItems.BIAppConMon),
                    new SqlParameter("@BIMonSou", bG_BudItems.BIMonSou),
                    new SqlParameter("@BIFinAllo", bG_BudItems.BIFinAllo),
                    new SqlParameter("@BILastYearCarry", bG_BudItems.BILastYearCarry),
                    new SqlParameter("@BIOthFun", bG_BudItems.BIOthFun),
                    new SqlParameter("@BIOthExpProb", bG_BudItems.BIOthExpProb),
                    new SqlParameter("@BIBudSta", bG_BudItems.BIBudSta),
                    new SqlParameter("@BudSta", bG_BudItems.BudSta),
                    new SqlParameter("@BICause", bG_BudItems.BICause),
                    new SqlParameter("@DepID", bG_BudItems.DepID),
                    new SqlParameter("@BIProName", bG_BudItems.BIProName),
                    new SqlParameter("@BIReportTime", bG_BudItems.BIReportTime),
                    new SqlParameter("@BIConNum", bG_BudItems.BIConNum),
                    new SqlParameter("@BIProDescrip", bG_BudItems.BIProDescrip),
                    new SqlParameter("@BIProCategory", bG_BudItems.BIProCategory),
                    new SqlParameter("@BIYear", bG_BudItems.BIYear)
                };

                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;
            }
        }