Пример #1
0
 private void BindBranch()
 {
     using (COMPANY_BO objT24_COMPANY_BO = new COMPANY_BO())
     {
         List <COMPANY> lstData = objT24_COMPANY_BO.GetAll().ToList();
         foreach (COMPANY item in lstData)
         {
             cboBranch.Items.Add(new ListItem(item.COMPANY_CODE + "-" + item.COMPANY_NAME, item.COMPANY_CODE));
         }
         cboBranch.Items.Insert(0, new ListItem("--Chọn chi nhánh--", string.Empty));
         if (Session[Commons.Constant.DAO_CODE] != null)
         {
             cboBranch.ClearSelection();
             using (DAO_COMPANY_BO objDAO_COMPANY_BO = new DAO_COMPANY_BO())
             {
                 List <DAO_COMPANY> lstDaoCompany = objDAO_COMPANY_BO.GetByDAO_CODE(Session[Commons.Constant.DAO_CODE].ToString()).ToList();
                 if (lstDaoCompany != null)
                 {
                     foreach (DAO_COMPANY item in lstDaoCompany)
                     {
                         if (item.DAO_CODE == Session[Commons.Constant.DAO_CODE].ToString() && !string.IsNullOrEmpty(item.COMPANY_CODE.Trim()))
                         {
                             if (cboBranch.Items.FindByValue(item.COMPANY_CODE) != null)
                             {
                                 cboBranch.Items.FindByValue(item.COMPANY_CODE).Selected = true;
                             }
                             break;
                         }
                     }
                 }
             }
         }
     }
 }
Пример #2
0
 private void BindBranch()
 {
     using (COMPANY_BO objT24_COMPANY_BO = new COMPANY_BO())
     {
         List <COMPANY> lstData = objT24_COMPANY_BO.GetAll().ToList();
         foreach (COMPANY item in lstData)
         {
             cboBranch.Items.Add(new ListItem(item.COMPANY_CODE + "-" + item.COMPANY_NAME, item.COMPANY_CODE));
         }
         cboBranch.Items.Insert(0, new ListItem("--Chọn chi nhánh--", string.Empty));
         if (Session[Promotion.Commons.Constant.DAO_CODE] != null)
         {
             cboBranch.ClearSelection();
             if (cboBranch.Items.FindByValue(Session[Promotion.Commons.Constant.DAO_CODE].ToString()) != null)
             {
                 cboBranch.Items.FindByValue(Session[Promotion.Commons.Constant.DAO_CODE].ToString()).Selected = true;
             }
         }
         using (Promotion.DataModel.User_BO objUser_BO = new Promotion.DataModel.User_BO())
         {
             Promotion.DataModel.User objUser = objUser_BO.GetByUserName(Session[Promotion.Commons.Constant.USERNAME].ToString());
             if (objUser != null && objUser.Permisions != null)
             {
                 bool hasPer = false;
                 foreach (Promotion.DataModel.Permision item in objUser.Permisions)
                 {
                     if (item != null && item.Permision1 == Constant.PERMISION_ADMIN)
                     {
                         hasPer = true;
                         break;
                     }
                 }
                 if (hasPer)
                 {
                     cboBranch.Enabled = true;
                 }
             }
         }
     }
 }