Пример #1
0
        public List <CompanyBeans> getAllCompany(string sql, Dictionary <string, string> parameters)
        {
            List <CompanyBeans> companyDataSource = new List <CompanyBeans>();

            try
            {
                DataTable companyResult = new ConnectionManager().select(sql, parameters);
                for (int i = 0; i < companyResult.Rows.Count; i++)
                {
                    CompanyBeans compBean = new CompanyBeans();
                    compBean.id          = int.Parse(companyResult.Rows[i]["id"].ToString());
                    compBean.cmp_code    = companyResult.Rows[i]["cmp_code"].ToString();
                    compBean.cmp_nme     = companyResult.Rows[i]["cmp_nme"].ToString();
                    compBean.cmp_lng_nme = companyResult.Rows[i]["cmp_lng_nme"].ToString();
                    compBean.address     = companyResult.Rows[i]["address"].ToString();
                    compBean.telephone   = companyResult.Rows[i]["telephone"].ToString();
                    compBean.mobile      = companyResult.Rows[i]["mobile"].ToString();
                    companyDataSource.Add(compBean);
                }
            }
            catch (Exception ex)
            {
                myLog.Error(ex);
            }
            return(companyDataSource);
        }
Пример #2
0
        public CompanyBeans getCompanyByID(int id)
        {
            CompanyBeans companyDataSource = new CompanyBeans();

            try
            {
                string sql = " select * from pos.tcompany where id=@ID";
                Dictionary <string, string> parameter = new   Dictionary <string, string>();
                parameter.Add("@ID", id + "");
                List <CompanyBeans> result = getAllCompany(sql, parameter);
                companyDataSource = result[0];
            }
            catch (Exception ex)
            {
                myLog.Error(ex);
            }
            return(companyDataSource);
        }