Example #1
0
        public List <MAS_DEPARTMENT> ListDepartmentByComCode(string CompanyNo)
        {
            IDbConnection         conn = null;
            List <MAS_DEPARTMENT> ret  = new List <MAS_DEPARTMENT>();

            try
            {
                //SET CONNECTION
                conn = ConnectionFactory.GetConnection();
                conn.ConnectionString = ConfigurationManager.GetConfiguration().DbConnectionString;

                //OPEN CONNECTION
                conn.Open();

                Mas_CompanyBL bl = new Mas_CompanyBL(conn);
                ret = bl.ListDeprtmentByCompany(CompanyNo);
            }
            catch (Exception ex)
            {
                logger.Error(ex.Message);
                logger.Error(ex.StackTrace);
            }
            finally
            {
                if (conn != null)
                {
                    if (conn.State == ConnectionState.Open)
                    {
                        conn.Close();
                    }
                    conn.Dispose();
                }
            }

            return(ret);
        }
Example #2
0
        public MAS_COMPANY GetMasCompanyByID(string CompanyNo)
        {
            IDbConnection conn = null;
            MAS_COMPANY   ret  = new MAS_COMPANY();

            try
            {
                //SET CONNECTION
                conn = ConnectionFactory.GetConnection();
                conn.ConnectionString = ConfigurationManager.GetConfiguration().DbConnectionString;

                //OPEN CONNECTION
                conn.Open();

                Mas_CompanyBL bl = new Mas_CompanyBL(conn);
                ret = bl.GetCompanyByID(CompanyNo);
            }
            catch (Exception ex)
            {
                logger.Error(ex.Message);
                logger.Error(ex.StackTrace);
            }
            finally
            {
                if (conn != null)
                {
                    if (conn.State == ConnectionState.Open)
                    {
                        conn.Close();
                    }
                    conn.Dispose();
                }
            }

            return(ret);
        }