Exemplo n.º 1
0
        public LookupsDTO GetLookupByLookupCode(string code, Enums.Culture culture)
        {
            using (UnitOfWork uow = new UnitOfWork())
            {
                var repo   = uow.Lookups;
                var lookup = repo.GetLookupValueAndIDByCode(code);
                if (culture == Enums.Culture.Arabic)
                {
                    lookup = new LookupsDTO()
                    {
                        Id    = lookup.Id,
                        Value = lookup.ValueAr
                    };
                }
                else
                {
                    lookup = new LookupsDTO()
                    {
                        Id    = lookup.Id,
                        Value = lookup.ValueEn
                    };
                }
                if (lookup == null)
                {
                    throw new BusinessException("Lookup does not exist", Constants.ErrorsCodes.LookupDoesNotExist);
                }

                return(lookup);
            }
        }
        public List <UserDDLDTO> GetAccountDDL(Enums.Culture cul)
        {
            using (UnitOfWork uow = new UnitOfWork())
            {
                try
                {
                    var Departments = uow.Users.GetAccountDDL();

                    if (Departments != null)
                    {
                        if (cul == Enums.Culture.Arabic)
                        {
                            foreach (var i in Departments)
                            {
                                i.Value   = i.ValueAr;
                                i.ValueAr = i.ValueAr;
                            }
                        }
                        else
                        {
                            foreach (var i in Departments)
                            {
                                i.Value   = i.Value;
                                i.ValueAr = i.Value;
                            }
                        }


                        return(Departments);
                    }
                    else
                    {
                        return(null);
                    }
                }
                catch (Exception ex)
                {
                    ex.Data.Add("GetDepartments", "An error occurred while trying to create GetDepartments Record - BLL");
                    uow.Rollback();
                    return(null);
                }
            }
        }
Exemplo n.º 3
0
        public IEnumerable <LookupsDTO> GetLookupsByLookupCategoryCode(string lookupCategoryCode, Enums.Culture cul)
        {
            if (cul == 0)
            {
                cul = Enums.Culture.Arabic;
            }
            int language = (int)Enums.CultureID.Ar;

            if (cul == Enums.Culture.Arabic)
            {
                language = (int)Enums.CultureID.Ar;
            }
            else
            {
                language = (int)Enums.CultureID.En;
            }
            var repository = _uow.LookupCategory;
            var data       = (from cat in _db.LookupCategories
                              join look in _db.Lookups on cat.Id equals look.CategoryId
                              join looCul in _db.LookupCultures on look.Id equals looCul.LookupID
                              join culture in _db.Cultures on looCul.CultureID equals culture.CultureID
                              where culture.CultureID == language && cat.FixedCode == lookupCategoryCode
                              select new LookupsDTO
            {
                Value = looCul.Value,
                Id = looCul.LookupID,
                LookupCode = looCul.Lookup.LookupCode,
            }).ToList();

            if (data == null)
            {
                return(null);
            }
            return(data);
        }
Exemplo n.º 4
0
 public IEnumerable <LookupsDTO> GetLookupsByLookupCategoryCode(string lookupCategoryCode, Enums.Culture cul)
 {
     using (UnitOfWork uow = new UnitOfWork())
     {
         var repo   = uow.LookupCategory;
         var lookup = repo.GetLookupsByLookupCategoryCode(lookupCategoryCode, cul);
         if (lookup == null)
         {
             throw new BusinessException("Lookup does not exist", Constants.ErrorsCodes.LookupDoesNotExist);
         }
         else
         {
             return(lookup);
         }
     }
 }
 public IEnumerable <LookupsDTO> GetLookupsByLookupCategoryCode(string lookupCategoryCode, Enums.Culture cul)
 {
     using (UnitOfWork uow = new UnitOfWork())
     {
         var repo   = uow.LookupCategory;
         var lookup = repo.GetLookupsByLookupCategoryCode(lookupCategoryCode, cul);
         if (lookup == null)
         {
             return(null);
         }
         else
         {
             return(lookup);
         }
     }
 }