public static BG_Department GetBG_DepartmentByDepID(int depID)
        {
            string sql = "SELECT * FROM BG_Department WHERE DepID = @DepID";

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

                if (dt.Rows.Count > 0)
                {
                    BG_Department bG_Department = new BG_Department();

                    bG_Department.DepID   = dt.Rows[0]["DepID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["DepID"];
                    bG_Department.DepLev  = dt.Rows[0]["DepLev"] == DBNull.Value ? 0 : (int)dt.Rows[0]["DepLev"];
                    bG_Department.FaDepID = dt.Rows[0]["FaDepID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["FaDepID"];
                    bG_Department.DepCode = dt.Rows[0]["DepCode"] == DBNull.Value ? "" : (string)dt.Rows[0]["DepCode"];
                    bG_Department.DepName = dt.Rows[0]["DepName"] == DBNull.Value ? "" : (string)dt.Rows[0]["DepName"];
                    bG_Department.DepQua  = dt.Rows[0]["DepQua"] == DBNull.Value ? "" : (string)dt.Rows[0]["DepQua"];
                    bG_Department.DepSta  = dt.Rows[0]["DepSta"] == DBNull.Value ? "" : (string)dt.Rows[0]["DepSta"];
                    bG_Department.DepRem  = dt.Rows[0]["DepRem"] == DBNull.Value ? "" : (string)dt.Rows[0]["DepRem"];

                    return(bG_Department);
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                throw e;
            }
        }
        public static BG_ReimAppendix GetBG_ReimAppendixByRADID(int rADID)
        {
            string sql = "SELECT * FROM BG_ReimAppendix WHERE RADID = @RADID";

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

                if (dt.Rows.Count > 0)
                {
                    BG_ReimAppendix bG_ReimAppendix = new BG_ReimAppendix();

                    bG_ReimAppendix.RADID     = dt.Rows[0]["RADID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["RADID"];
                    bG_ReimAppendix.ARID      = dt.Rows[0]["ARID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["ARID"];
                    bG_ReimAppendix.ARType    = dt.Rows[0]["ARType"] == DBNull.Value ? "" : (string)dt.Rows[0]["ARType"];
                    bG_ReimAppendix.ARName    = dt.Rows[0]["ARName"] == DBNull.Value ? "" : (string)dt.Rows[0]["ARName"];
                    bG_ReimAppendix.ARContent = dt.Rows[0]["ARContent"] == DBNull.Value ? "" : (string)dt.Rows[0]["ARContent"];
                    bG_ReimAppendix.ARTime    = dt.Rows[0]["ARTime"] == DBNull.Value ? DateTime.MinValue : (DateTime)dt.Rows[0]["ARTime"];

                    return(bG_ReimAppendix);
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                throw e;
            }
        }
Ejemplo n.º 3
0
        public static BG_DataRecord GetBG_DataRecordByDRID(int dRID)
        {
            string sql = "SELECT * FROM BG_DataRecord WHERE DRID = @DRID";

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

                if (dt.Rows.Count > 0)
                {
                    BG_DataRecord bG_DataRecord = new BG_DataRecord();

                    bG_DataRecord.DRID     = dt.Rows[0]["DRID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["DRID"];
                    bG_DataRecord.DRType   = dt.Rows[0]["DRType"] == DBNull.Value ? "" : (string)dt.Rows[0]["DRType"];
                    bG_DataRecord.DRTime   = dt.Rows[0]["DRTime"] == DBNull.Value ? DateTime.MinValue : (DateTime)dt.Rows[0]["DRTime"];
                    bG_DataRecord.DRName   = dt.Rows[0]["DRName"] == DBNull.Value ? "" : (string)dt.Rows[0]["DRName"];
                    bG_DataRecord.IsBackUp = dt.Rows[0]["IsBackUp"] == DBNull.Value ? "" : (string)dt.Rows[0]["IsBackUp"];

                    return(bG_DataRecord);
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                throw e;
            }
        }
Ejemplo n.º 4
0
        public static BG_BudItemHis GetBG_BudItemHisByBudHisID(int budHisID)
        {
            string sql = "SELECT * FROM BG_BudItemHis WHERE BudHisID = @BudHisID";

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

                if (dt.Rows.Count > 0)
                {
                    BG_BudItemHis bG_BudItemHis = new BG_BudItemHis();

                    bG_BudItemHis.BudHisID        = dt.Rows[0]["BudHisID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["BudHisID"];
                    bG_BudItemHis.BudID           = dt.Rows[0]["BudID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["BudID"];
                    bG_BudItemHis.BIProType       = dt.Rows[0]["BIProType"] == DBNull.Value ? "" : (string)dt.Rows[0]["BIProType"];
                    bG_BudItemHis.BIFunSub        = dt.Rows[0]["BIFunSub"] == DBNull.Value ? "" : (string)dt.Rows[0]["BIFunSub"];
                    bG_BudItemHis.BICode          = dt.Rows[0]["BICode"] == DBNull.Value ? "" : (string)dt.Rows[0]["BICode"];
                    bG_BudItemHis.PPID            = dt.Rows[0]["PPID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["PPID"];
                    bG_BudItemHis.PIID            = dt.Rows[0]["PIID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["PIID"];
                    bG_BudItemHis.BIPlanHz        = dt.Rows[0]["BIPlanHz"] == DBNull.Value ? "" : (string)dt.Rows[0]["BIPlanHz"];
                    bG_BudItemHis.BIStaTime       = dt.Rows[0]["BIStaTime"] == DBNull.Value ? DateTime.MinValue : (DateTime)dt.Rows[0]["BIStaTime"];
                    bG_BudItemHis.BIEndTime       = dt.Rows[0]["BIEndTime"] == DBNull.Value ? DateTime.MinValue : (DateTime)dt.Rows[0]["BIEndTime"];
                    bG_BudItemHis.BICharger       = dt.Rows[0]["BICharger"] == DBNull.Value ? "" : (string)dt.Rows[0]["BICharger"];
                    bG_BudItemHis.BIAttr          = dt.Rows[0]["BIAttr"] == DBNull.Value ? "" : (string)dt.Rows[0]["BIAttr"];
                    bG_BudItemHis.BIAppReaCon     = dt.Rows[0]["BIAppReaCon"] == DBNull.Value ? "" : (string)dt.Rows[0]["BIAppReaCon"];
                    bG_BudItemHis.BIExpGistExp    = dt.Rows[0]["BIExpGistExp"] == DBNull.Value ? "" : (string)dt.Rows[0]["BIExpGistExp"];
                    bG_BudItemHis.BILongGoal      = dt.Rows[0]["BILongGoal"] == DBNull.Value ? "" : (string)dt.Rows[0]["BILongGoal"];
                    bG_BudItemHis.BIYearGoal      = dt.Rows[0]["BIYearGoal"] == DBNull.Value ? "" : (string)dt.Rows[0]["BIYearGoal"];
                    bG_BudItemHis.BIMon           = dt.Rows[0]["BIMon"] == DBNull.Value ? 0 : (decimal)dt.Rows[0]["BIMon"];
                    bG_BudItemHis.BIAppConMon     = dt.Rows[0]["BIAppConMon"] == DBNull.Value ? 0 : (decimal)dt.Rows[0]["BIAppConMon"];
                    bG_BudItemHis.BIMonSou        = dt.Rows[0]["BIMonSou"] == DBNull.Value ? "" : (string)dt.Rows[0]["BIMonSou"];
                    bG_BudItemHis.BIFinAllo       = dt.Rows[0]["BIFinAllo"] == DBNull.Value ? 0 : (decimal)dt.Rows[0]["BIFinAllo"];
                    bG_BudItemHis.BILastYearCarry = dt.Rows[0]["BILastYearCarry"] == DBNull.Value ? 0 : (decimal)dt.Rows[0]["BILastYearCarry"];
                    bG_BudItemHis.BIOthFun        = dt.Rows[0]["BIOthFun"] == DBNull.Value ? 0 : (decimal)dt.Rows[0]["BIOthFun"];
                    bG_BudItemHis.BIOthExpProb    = dt.Rows[0]["BIOthExpProb"] == DBNull.Value ? "" : (string)dt.Rows[0]["BIOthExpProb"];
                    bG_BudItemHis.BIBudSta        = dt.Rows[0]["BIBudSta"] == DBNull.Value ? "" : (string)dt.Rows[0]["BIBudSta"];
                    bG_BudItemHis.BudSta          = dt.Rows[0]["BudSta"] == DBNull.Value ? "" : (string)dt.Rows[0]["BudSta"];
                    bG_BudItemHis.BICause         = dt.Rows[0]["BICause"] == DBNull.Value ? "" : (string)dt.Rows[0]["BICause"];
                    bG_BudItemHis.DepID           = dt.Rows[0]["DepID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["DepID"];
                    bG_BudItemHis.BIProName       = dt.Rows[0]["BIProName"] == DBNull.Value ? "" : (string)dt.Rows[0]["BIProName"];
                    bG_BudItemHis.BIReportTime    = dt.Rows[0]["BIReportTime"] == DBNull.Value ? DateTime.MinValue : (DateTime)dt.Rows[0]["BIReportTime"];
                    bG_BudItemHis.BIConNum        = dt.Rows[0]["BIConNum"] == DBNull.Value ? 0 : (decimal)dt.Rows[0]["BIConNum"];
                    bG_BudItemHis.BIProDescrip    = dt.Rows[0]["BIProDescrip"] == DBNull.Value ? "" : (string)dt.Rows[0]["BIProDescrip"];
                    bG_BudItemHis.BIProCategory   = dt.Rows[0]["BIProCategory"] == DBNull.Value ? "" : (string)dt.Rows[0]["BIProCategory"];
                    bG_BudItemHis.BIYear          = dt.Rows[0]["BIYear"] == DBNull.Value ? 0 : (int)dt.Rows[0]["BIYear"];

                    return(bG_BudItemHis);
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                throw e;
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 根据部门ID查询一条记录
        /// </summary>
        /// <param name="depid">部门ID</param>
        /// <returns>BGDepartment</returns>
        public static BG_Department GetDepBydepid(string depid)
        {
            BG_Department dep = new BG_Department();

            try
            {
                string sqlStr = "select * from BG_Department where DepID='{0}'";
                sqlStr = string.Format(sqlStr, depid);
                DataTable dt = DBUnity.AdapterToTab(sqlStr);
                if (dt.Rows.Count > 0)
                {
                    dep.DepID   = (int)dt.Rows[0]["DepID"];
                    dep.DepLev  = (int)dt.Rows[0]["DepLev"];
                    dep.FaDepID = (int)dt.Rows[0]["FaDepID"];
                    dep.DepCode = dt.Rows[0]["DepCode"].ToString();
                    dep.DepName = dt.Rows[0]["DepName"].ToString();
                    dep.DepQua  = dt.Rows[0]["DepQua"].ToString();
                    dep.DepSta  = dt.Rows[0]["DepSta"].ToString();
                    dep.DepRem  = dt.Rows[0]["DepRem"].ToString();
                }
            }
            catch (Exception ex)
            {
                dep = new BG_Department();
                Log.WriteLog(ex.Message, "BGDepartmentService--GetDepBydepid");
            }
            return(dep);
        }
Ejemplo n.º 6
0
        public static BG_OutlayCK GetBG_OutlayCKByOAID(int oAID)
        {
            string sql = "SELECT * FROM BG_OutlayCK WHERE OAID = @OAID";

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

                if (dt.Rows.Count > 0)
                {
                    BG_OutlayCK bG_OutlayCK = new BG_OutlayCK();

                    bG_OutlayCK.OAID     = dt.Rows[0]["OAID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["OAID"];
                    bG_OutlayCK.PIID     = dt.Rows[0]["PIID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["PIID"];
                    bG_OutlayCK.PPID     = dt.Rows[0]["PPID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["PPID"];
                    bG_OutlayCK.DepID    = dt.Rows[0]["DepID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["DepID"];
                    bG_OutlayCK.OACkMon  = dt.Rows[0]["OACkMon"] == DBNull.Value ? 0 : (decimal)dt.Rows[0]["OACkMon"];
                    bG_OutlayCK.OATime   = dt.Rows[0]["OATime"] == DBNull.Value ? DateTime.MinValue : (DateTime)dt.Rows[0]["OATime"];
                    bG_OutlayCK.OACkType = dt.Rows[0]["OACkType"] == DBNull.Value ? "" : (string)dt.Rows[0]["OACkType"];

                    return(bG_OutlayCK);
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                throw e;
            }
        }
Ejemplo n.º 7
0
        public static BG_Supplementary GetBG_SupplementaryBySuppID(int suppID)
        {
            string sql = "SELECT * FROM BG_Supplementary WHERE SuppID = @SuppID";

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

                if (dt.Rows.Count > 0)
                {
                    BG_Supplementary bG_Supplementary = new BG_Supplementary();

                    bG_Supplementary.SuppID  = dt.Rows[0]["SuppID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["SuppID"];
                    bG_Supplementary.SuppMon = dt.Rows[0]["SuppMon"] == DBNull.Value ? 0 : (decimal)dt.Rows[0]["SuppMon"];
                    bG_Supplementary.Year    = dt.Rows[0]["Year"] == DBNull.Value ? 0 : (int)dt.Rows[0]["Year"];

                    return(bG_Supplementary);
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                throw e;
            }
        }
        public static BG_MonPayPlanRemark GetBG_MonPayPlanRemarkByPRID(int pRID)
        {
            string sql = "SELECT * FROM BG_MonPayPlanRemark WHERE PRID = @PRID";

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

                if (dt.Rows.Count > 0)
                {
                    BG_MonPayPlanRemark bG_MonPayPlanRemark = new BG_MonPayPlanRemark();

                    bG_MonPayPlanRemark.PRID    = dt.Rows[0]["PRID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["PRID"];
                    bG_MonPayPlanRemark.DeptID  = dt.Rows[0]["DeptID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["DeptID"];
                    bG_MonPayPlanRemark.MATime  = dt.Rows[0]["MATime"] == DBNull.Value ? DateTime.MinValue : (DateTime)dt.Rows[0]["MATime"];
                    bG_MonPayPlanRemark.MASta   = dt.Rows[0]["MASta"] == DBNull.Value ? "" : (string)dt.Rows[0]["MASta"];
                    bG_MonPayPlanRemark.MACause = dt.Rows[0]["MACause"] == DBNull.Value ? "" : (string)dt.Rows[0]["MACause"];
                    bG_MonPayPlanRemark.MAUser  = dt.Rows[0]["MAUser"] == DBNull.Value ? "" : (string)dt.Rows[0]["MAUser"];
                    bG_MonPayPlanRemark.MATimes = dt.Rows[0]["MATimes"] == DBNull.Value ? 0 : (int)dt.Rows[0]["MATimes"];

                    return(bG_MonPayPlanRemark);
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                throw e;
            }
        }
        public static BG_PayProject GetBG_PayProjectByPPID(int pPID)
        {
            string sql = "SELECT * FROM BG_PayProject WHERE PPID = @PPID";

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

                if (dt.Rows.Count > 0)
                {
                    BG_PayProject bG_PayProject = new BG_PayProject();

                    bG_PayProject.PPID       = dt.Rows[0]["PPID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["PPID"];
                    bG_PayProject.PayPrjName = dt.Rows[0]["PayPrjName"] == DBNull.Value ? "" : (string)dt.Rows[0]["PayPrjName"];
                    bG_PayProject.PIID       = dt.Rows[0]["PIID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["PIID"];

                    return(bG_PayProject);
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                throw e;
            }
        }
        public static BG_IncomeAna GetBG_IncomeAnaByIAID(int iAID)
        {
            string sql = "SELECT * FROM BG_IncomeAna WHERE IAID = @IAID";

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

                if (dt.Rows.Count > 0)
                {
                    BG_IncomeAna bG_IncomeAna = new BG_IncomeAna();

                    bG_IncomeAna.IAID     = dt.Rows[0]["IAID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["IAID"];
                    bG_IncomeAna.EIID     = dt.Rows[0]["EIID"] == DBNull.Value ? "" : (string)dt.Rows[0]["EIID"];
                    bG_IncomeAna.DepID    = dt.Rows[0]["DepID"] == DBNull.Value ? "" : (string)dt.Rows[0]["DepID"];
                    bG_IncomeAna.IABudMon = dt.Rows[0]["IABudMon"] == DBNull.Value ? 0 : (decimal)dt.Rows[0]["IABudMon"];
                    bG_IncomeAna.IAAudMon = dt.Rows[0]["IAAudMon"] == DBNull.Value ? 0 : (decimal)dt.Rows[0]["IAAudMon"];
                    bG_IncomeAna.IACkMon  = dt.Rows[0]["IACkMon"] == DBNull.Value ? 0 : (decimal)dt.Rows[0]["IACkMon"];
                    bG_IncomeAna.IAYear   = dt.Rows[0]["IAYear"] == DBNull.Value ? 0 : (int)dt.Rows[0]["IAYear"];

                    return(bG_IncomeAna);
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                throw e;
            }
        }
        public static BG_EstimatesAllocation GetBG_EstimatesAllocationByBEAID(int bEAID)
        {
            string sql = "SELECT * FROM BG_EstimatesAllocation WHERE BEAID = @BEAID";

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

                if (dt.Rows.Count > 0)
                {
                    BG_EstimatesAllocation bG_EstimatesAllocation = new BG_EstimatesAllocation();

                    bG_EstimatesAllocation.BEAID   = dt.Rows[0]["BEAID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["BEAID"];
                    bG_EstimatesAllocation.DepID   = dt.Rows[0]["DepID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["DepID"];
                    bG_EstimatesAllocation.PIID    = dt.Rows[0]["PIID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["PIID"];
                    bG_EstimatesAllocation.BEAMon  = dt.Rows[0]["BEAMon"] == DBNull.Value ? 0 : (decimal)dt.Rows[0]["BEAMon"];
                    bG_EstimatesAllocation.BEAYear = dt.Rows[0]["BEAYear"] == DBNull.Value ? 0 : (int)dt.Rows[0]["BEAYear"];

                    return(bG_EstimatesAllocation);
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                throw e;
            }
        }
        public static BG_PreviewData GetBG_PreviewDataByPSID(int pSID)
        {
            string sql = "SELECT * FROM BG_PreviewData WHERE PSID = @PSID";

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

                if (dt.Rows.Count > 0)
                {
                    BG_PreviewData bG_PreviewData = new BG_PreviewData();

                    bG_PreviewData.PSID            = dt.Rows[0]["PSID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["PSID"];
                    bG_PreviewData.PSType1         = dt.Rows[0]["PSType1"] == DBNull.Value ? "" : (string)dt.Rows[0]["PSType1"];
                    bG_PreviewData.PSType2         = dt.Rows[0]["PSType2"] == DBNull.Value ? "" : (string)dt.Rows[0]["PSType2"];
                    bG_PreviewData.PSName          = dt.Rows[0]["PSName"] == DBNull.Value ? "" : (string)dt.Rows[0]["PSName"];
                    bG_PreviewData.PDBaseData      = dt.Rows[0]["PDBaseData"] == DBNull.Value ? 0 : (decimal)dt.Rows[0]["PDBaseData"];
                    bG_PreviewData.PDBaseLYData    = dt.Rows[0]["PDBaseLYData"] == DBNull.Value ? 0 : (decimal)dt.Rows[0]["PDBaseLYData"];
                    bG_PreviewData.PDProjectData   = dt.Rows[0]["PDProjectData"] == DBNull.Value ? 0 : (decimal)dt.Rows[0]["PDProjectData"];
                    bG_PreviewData.PDProjectLYData = dt.Rows[0]["PDProjectLYData"] == DBNull.Value ? 0 : (decimal)dt.Rows[0]["PDProjectLYData"];

                    return(bG_PreviewData);
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                throw e;
            }
        }
Ejemplo n.º 13
0
        public static BG_PayIncome GetBG_PayIncomeByPIID(int pIID)
        {
            string sql = "SELECT * FROM BG_PayIncome WHERE PIID = @PIID";

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

                if (dt.Rows.Count > 0)
                {
                    BG_PayIncome bG_PayIncome = new BG_PayIncome();

                    bG_PayIncome.PIID           = dt.Rows[0]["PIID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["PIID"];
                    bG_PayIncome.PIEcoSubCoding = dt.Rows[0]["PIEcoSubCoding"] == DBNull.Value ? "" : (string)dt.Rows[0]["PIEcoSubCoding"];
                    bG_PayIncome.PIEcoSubLev    = dt.Rows[0]["PIEcoSubLev"] == DBNull.Value ? 0 : (int)dt.Rows[0]["PIEcoSubLev"];
                    bG_PayIncome.PIEcoSubParID  = dt.Rows[0]["PIEcoSubParID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["PIEcoSubParID"];
                    bG_PayIncome.PIEcoSubName   = dt.Rows[0]["PIEcoSubName"] == DBNull.Value ? "" : (string)dt.Rows[0]["PIEcoSubName"];
                    bG_PayIncome.PIType         = dt.Rows[0]["PIType"] == DBNull.Value ? "" : (string)dt.Rows[0]["PIType"];
                    bG_PayIncome.ISSign         = dt.Rows[0]["ISSign"] == DBNull.Value ? 0 : (int)dt.Rows[0]["ISSign"];

                    return(bG_PayIncome);
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                throw e;
            }
        }
Ejemplo n.º 14
0
        public static BG_ProPay GetBG_ProPayByProPID(int proPID)
        {
            string sql = "SELECT * FROM BG_ProPay WHERE ProPID = @ProPID";

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

                if (dt.Rows.Count > 0)
                {
                    BG_ProPay bG_ProPay = new BG_ProPay();

                    bG_ProPay.ProPID   = dt.Rows[0]["ProPID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["ProPID"];
                    bG_ProPay.DepID    = dt.Rows[0]["DepID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["DepID"];
                    bG_ProPay.ProPYear = dt.Rows[0]["ProPYear"] == DBNull.Value ? DateTime.MinValue : (DateTime)dt.Rows[0]["ProPYear"];
                    bG_ProPay.PPID     = dt.Rows[0]["PPID"] == DBNull.Value ? "" : (string)dt.Rows[0]["PPID"];
                    bG_ProPay.ProPA0M  = dt.Rows[0]["ProPA0M"] == DBNull.Value ? 0 : (decimal)dt.Rows[0]["ProPA0M"];

                    return(bG_ProPay);
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                throw e;
            }
        }
Ejemplo n.º 15
0
        public static BG_PrjJonSub GetBG_PrjJonSubByPSID(int pSID)
        {
            string sql = "SELECT * FROM BG_PrjJonSub WHERE PSID = @PSID";

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

                if (dt.Rows.Count > 0)
                {
                    BG_PrjJonSub bG_PrjJonSub = new BG_PrjJonSub();

                    bG_PrjJonSub.PSID = dt.Rows[0]["PSID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["PSID"];
                    bG_PrjJonSub.PPID = dt.Rows[0]["PPID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["PPID"];
                    bG_PrjJonSub.PIID = dt.Rows[0]["PIID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["PIID"];

                    return(bG_PrjJonSub);
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                throw e;
            }
        }
Ejemplo n.º 16
0
        public static BG_BudControl GetBG_BudControlByBCID(int bCID)
        {
            string sql = "SELECT * FROM BG_BudControl WHERE BCID = @BCID";

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

                if (dt.Rows.Count > 0)
                {
                    BG_BudControl bG_BudControl = new BG_BudControl();

                    bG_BudControl.BCID     = dt.Rows[0]["BCID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["BCID"];
                    bG_BudControl.BCName   = dt.Rows[0]["BCName"] == DBNull.Value ? "" : (string)dt.Rows[0]["BCName"];
                    bG_BudControl.BCType   = dt.Rows[0]["BCType"] == DBNull.Value ? "" : (string)dt.Rows[0]["BCType"];
                    bG_BudControl.BCMon    = dt.Rows[0]["BCMon"] == DBNull.Value ? 0 : (decimal)dt.Rows[0]["BCMon"];
                    bG_BudControl.BCAdjust = dt.Rows[0]["BCAdjust"] == DBNull.Value ? 0 : (decimal)dt.Rows[0]["BCAdjust"];

                    return(bG_BudControl);
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                throw e;
            }
        }
Ejemplo n.º 17
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;
            }
        }
Ejemplo n.º 18
0
        public static BG_MonPayPlan GetBG_MonPayPlanByCPID(int cPID)
        {
            string sql = "SELECT * FROM BG_MonPayPlan WHERE CPID = @CPID";

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

                if (dt.Rows.Count > 0)
                {
                    BG_MonPayPlan bG_MonPayPlan = new BG_MonPayPlan();

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

                    return(bG_MonPayPlan);
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                throw e;
            }
        }
Ejemplo n.º 19
0
        public static BG_Policy GetBG_PolicyByPLID(int pLID)
        {
            string sql = "SELECT * FROM BG_Policy WHERE PLID = @PLID";

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

                if (dt.Rows.Count > 0)
                {
                    BG_Policy bG_Policy = new BG_Policy();

                    bG_Policy.PLID     = dt.Rows[0]["PLID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["PLID"];
                    bG_Policy.PTitle   = dt.Rows[0]["PTitle"] == DBNull.Value ? "" : (string)dt.Rows[0]["PTitle"];
                    bG_Policy.PContent = dt.Rows[0]["PContent"] == DBNull.Value ? "" : (string)dt.Rows[0]["PContent"];
                    bG_Policy.PTime    = dt.Rows[0]["PTime"] == DBNull.Value ? DateTime.MinValue : (DateTime)dt.Rows[0]["PTime"];
                    bG_Policy.PFrom    = dt.Rows[0]["PFrom"] == DBNull.Value ? "" : (string)dt.Rows[0]["PFrom"];
                    bG_Policy.POrder   = dt.Rows[0]["POrder"] == DBNull.Value ? 0 : (int)dt.Rows[0]["POrder"];
                    bG_Policy.PType    = dt.Rows[0]["PType"] == DBNull.Value ? "" : (string)dt.Rows[0]["PType"];
                    bG_Policy.PStatus  = dt.Rows[0]["PStatus"] == DBNull.Value ? "" : (string)dt.Rows[0]["PStatus"];

                    return(bG_Policy);
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                throw e;
            }
        }
        public static BG_IncomeGather GetBG_IncomeGatherByIGID(int iGID)
        {
            string sql = "SELECT * FROM BG_IncomeGather WHERE IGID = @IGID";

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

                if (dt.Rows.Count > 0)
                {
                    BG_IncomeGather bG_IncomeGather = new BG_IncomeGather();

                    bG_IncomeGather.IGID    = dt.Rows[0]["IGID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["IGID"];
                    bG_IncomeGather.DepID   = dt.Rows[0]["DepID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["DepID"];
                    bG_IncomeGather.IcoMon  = dt.Rows[0]["IcoMon"] == DBNull.Value ? 0 : (decimal)dt.Rows[0]["IcoMon"];
                    bG_IncomeGather.IcoType = dt.Rows[0]["IcoType"] == DBNull.Value ? "" : (string)dt.Rows[0]["IcoType"];
                    bG_IncomeGather.IcoYear = dt.Rows[0]["IcoYear"] == DBNull.Value ? 0 : (int)dt.Rows[0]["IcoYear"];

                    return(bG_IncomeGather);
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                throw e;
            }
        }
        public static BG_EcoIncome GetBG_EcoIncomeByEIID(int eIID)
        {
            string sql = "SELECT * FROM BG_EcoIncome WHERE EIID = @EIID";

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

                if (dt.Rows.Count > 0)
                {
                    BG_EcoIncome bG_EcoIncome = new BG_EcoIncome();

                    bG_EcoIncome.EIID     = dt.Rows[0]["EIID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["EIID"];
                    bG_EcoIncome.EICoding = dt.Rows[0]["EICoding"] == DBNull.Value ? "" : (string)dt.Rows[0]["EICoding"];
                    bG_EcoIncome.EILev    = dt.Rows[0]["EILev"] == DBNull.Value ? "" : (string)dt.Rows[0]["EILev"];
                    bG_EcoIncome.EIParID  = dt.Rows[0]["EIParID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["EIParID"];
                    bG_EcoIncome.EIName   = dt.Rows[0]["EIName"] == DBNull.Value ? "" : (string)dt.Rows[0]["EIName"];

                    return(bG_EcoIncome);
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                throw e;
            }
        }
Ejemplo n.º 22
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;
            }
        }
Ejemplo n.º 23
0
        public static BG_UserPurview GetBG_UserPurviewByUPID(int uPID)
        {
            string sql = "SELECT * FROM BG_UserPurview WHERE UPID = @UPID";

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

                if (dt.Rows.Count > 0)
                {
                    BG_UserPurview bG_UserPurview = new BG_UserPurview();

                    bG_UserPurview.UPID   = dt.Rows[0]["UPID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["UPID"];
                    bG_UserPurview.UPName = dt.Rows[0]["UPName"] == DBNull.Value ? "" : (string)dt.Rows[0]["UPName"];
                    bG_UserPurview.Remark = dt.Rows[0]["Remark"] == DBNull.Value ? "" : (string)dt.Rows[0]["Remark"];

                    return(bG_UserPurview);
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                throw e;
            }
        }
        public static BG_BudAppendix GetBG_BudAppendixByAPID(int aPID)
        {
            string sql = "SELECT * FROM BG_BudAppendix WHERE APID = @APID";

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

                if (dt.Rows.Count > 0)
                {
                    BG_BudAppendix bG_BudAppendix = new BG_BudAppendix();

                    bG_BudAppendix.APID   = dt.Rows[0]["APID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["APID"];
                    bG_BudAppendix.BudID  = dt.Rows[0]["BudID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["BudID"];
                    bG_BudAppendix.APPath = dt.Rows[0]["APPath"] == DBNull.Value ? "" : (string)dt.Rows[0]["APPath"];
                    bG_BudAppendix.ApName = dt.Rows[0]["ApName"] == DBNull.Value ? "" : (string)dt.Rows[0]["ApName"];
                    bG_BudAppendix.ApTime = dt.Rows[0]["ApTime"] == DBNull.Value ? DateTime.MinValue : (DateTime)dt.Rows[0]["ApTime"];

                    return(bG_BudAppendix);
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                throw e;
            }
        }
Ejemplo n.º 25
0
        public static BG_ChangePwd GetBG_ChangePwdByPwdID(int pwdID)
        {
            string sql = "SELECT * FROM BG_ChangePwd WHERE PwdID = @PwdID";

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

                if (dt.Rows.Count > 0)
                {
                    BG_ChangePwd bG_ChangePwd = new BG_ChangePwd();

                    bG_ChangePwd.PwdID    = dt.Rows[0]["PwdID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["PwdID"];
                    bG_ChangePwd.UserID   = dt.Rows[0]["UserID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["UserID"];
                    bG_ChangePwd.OldPwd   = dt.Rows[0]["OldPwd"] == DBNull.Value ? "" : (string)dt.Rows[0]["OldPwd"];
                    bG_ChangePwd.NewPwd   = dt.Rows[0]["NewPwd"] == DBNull.Value ? "" : (string)dt.Rows[0]["NewPwd"];
                    bG_ChangePwd.CrTime   = dt.Rows[0]["CrTime"] == DBNull.Value ? DateTime.MinValue : (DateTime)dt.Rows[0]["CrTime"];
                    bG_ChangePwd.UserName = dt.Rows[0]["UserName"] == DBNull.Value ? "" : (string)dt.Rows[0]["UserName"];
                    bG_ChangePwd.DepName  = dt.Rows[0]["DepName"] == DBNull.Value ? "" : (string)dt.Rows[0]["DepName"];

                    return(bG_ChangePwd);
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                throw e;
            }
        }
Ejemplo n.º 26
0
        public static BG_MonPayPlanA GetBG_MonPayPlanAByCAID(int cAID)
        {
            string sql = "SELECT * FROM BG_MonPayPlanA WHERE CAID = @CAID";

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

                if (dt.Rows.Count > 0)
                {
                    BG_MonPayPlanA bG_MonPayPlanA = new BG_MonPayPlanA();

                    bG_MonPayPlanA.CAID       = dt.Rows[0]["CAID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["CAID"];
                    bG_MonPayPlanA.CPID       = dt.Rows[0]["CPID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["CPID"];
                    bG_MonPayPlanA.MABasicExp = dt.Rows[0]["MABasicExp"] == DBNull.Value ? 0 : (decimal)dt.Rows[0]["MABasicExp"];
                    bG_MonPayPlanA.MAProExp   = dt.Rows[0]["MAProExp"] == DBNull.Value ? 0 : (decimal)dt.Rows[0]["MAProExp"];
                    bG_MonPayPlanA.MATotal    = dt.Rows[0]["MATotal"] == DBNull.Value ? 0 : (decimal)dt.Rows[0]["MATotal"];
                    bG_MonPayPlanA.MATime     = dt.Rows[0]["MATime"] == DBNull.Value ? DateTime.MinValue : (DateTime)dt.Rows[0]["MATime"];
                    bG_MonPayPlanA.MAFunding  = dt.Rows[0]["MAFunding"] == DBNull.Value ? 0 : (decimal)dt.Rows[0]["MAFunding"];

                    return(bG_MonPayPlanA);
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                throw e;
            }
        }
        public static BG_IncomeCK GetBG_IncomeCKByIKID(int iKID)
        {
            string sql = "SELECT * FROM BG_IncomeCK WHERE IKID = @IKID";

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

                if (dt.Rows.Count > 0)
                {
                    BG_IncomeCK bG_IncomeCK = new BG_IncomeCK();

                    bG_IncomeCK.IKID    = dt.Rows[0]["IKID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["IKID"];
                    bG_IncomeCK.EIID    = dt.Rows[0]["EIID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["EIID"];
                    bG_IncomeCK.DepID   = dt.Rows[0]["DepID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["DepID"];
                    bG_IncomeCK.IACkMon = dt.Rows[0]["IACkMon"] == DBNull.Value ? 0 : (decimal)dt.Rows[0]["IACkMon"];
                    bG_IncomeCK.IATime  = dt.Rows[0]["IATime"] == DBNull.Value ? DateTime.MinValue : (DateTime)dt.Rows[0]["IATime"];

                    return(bG_IncomeCK);
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                throw e;
            }
        }
Ejemplo n.º 28
0
        public static BG_PreviewDevide GetBG_PreviewDevideByPDID(int pDID)
        {
            string sql = "SELECT * FROM BG_PreviewDevide WHERE PDID = @PDID";

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

                if (dt.Rows.Count > 0)
                {
                    BG_PreviewDevide bG_PreviewDevide = new BG_PreviewDevide();

                    bG_PreviewDevide.PDID   = dt.Rows[0]["PDID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["PDID"];
                    bG_PreviewDevide.DepID  = dt.Rows[0]["DepID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["DepID"];
                    bG_PreviewDevide.PSID   = dt.Rows[0]["PSID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["PSID"];
                    bG_PreviewDevide.DevMon = dt.Rows[0]["DevMon"] == DBNull.Value ? 0 : (decimal)dt.Rows[0]["DevMon"];

                    return(bG_PreviewDevide);
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                throw e;
            }
        }
        public static BG_Caliber GetBG_CaliberByCaliberID(int caliberID)
        {
            string sql = "SELECT * FROM BG_Caliber WHERE CaliberID = @CaliberID";

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

                if (dt.Rows.Count > 0)
                {
                    BG_Caliber bG_Caliber = new BG_Caliber();

                    bG_Caliber.CaliberID   = dt.Rows[0]["CaliberID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["CaliberID"];
                    bG_Caliber.CaliberName = dt.Rows[0]["CaliberName"] == DBNull.Value ? "" : (string)dt.Rows[0]["CaliberName"];
                    bG_Caliber.ParentID    = dt.Rows[0]["ParentID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["ParentID"];
                    bG_Caliber.CbLever     = dt.Rows[0]["CbLever"] == DBNull.Value ? 0 : (int)dt.Rows[0]["CbLever"];
                    return(bG_Caliber);
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                throw e;
            }
        }
        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;
            }
        }