Exemplo n.º 1
0
        public override EntityDtos <CityVillageDto> FindByQueryCommand(IRepositoryLocator locator, Query query)
        {
            Criterion criteriaBaseCVIdNotNull = new Criterion(Constants.BASECVID, null, CriteriaOperator.IsNotNullOrZero);
            Criterion criteriaCAId            = new Criterion(Constants.CAID, query.CAId, CriteriaOperator.Equal);

            Query query1 = new Query();

            query1.Add(criteriaCAId);
            query1.Add(criteriaBaseCVIdNotNull);
            IQueryable <CityVillage> caCVListWithBaseCVId = locator.GetRepository <CityVillage>().FindBy(query1);

            IQueryable <CityVillage> CityVillageList = locator.GetRepository <CityVillage>().FindBy(query);
            //CityVillageList = CityVillageList.Except(caCVListWithBaseCVId);

            var itemIds = caCVListWithBaseCVId.Select(x => x.BaseCityVillageId).ToArray();

            CityVillageList = CityVillageList.Where(x => !itemIds.Contains(x.CityVillageId));

            IList <CityVillageDto> allDto = new List <CityVillageDto>();

            foreach (CityVillage entity in CityVillageList)
            {
                allDto.Add(EntityToEntityDto(entity));
            }
            var result = new EntityDtos <CityVillageDto> {
                Entities = allDto
            };

            result.TotalRecords = locator.GetRepository <CityVillage>().GetCount(query);
            if (result.TotalRecords == 0)
            {
                Container.RequestContext.Notifier.AddWarning(BusinessWarningEnum.Default, "No records were found");
            }
            return(result);
        }
Exemplo n.º 2
0
        public ActionResult StateListGridView()
        {
            statesMasterService = new StateServiceClient();
            EntityDtos <StateDto> stateDto = statesMasterService.FindAll();

            ViewData["StateList"] = stateDto.Entities;
            return(PartialView("StateListGridView", ViewData["StateList"]));
        }
Exemplo n.º 3
0
        private IList <ClientDto> GetClientList()
        {
            ClientServiceClient client = new ClientServiceClient();
            Query     query            = new Query();
            Criterion crActive         = new Criterion("IsActive", true, CriteriaOperator.Equal);

            query.Add(crActive);
            EntityDtos <ClientDto> clientDtos = client.FindByQuery(query, false);

            client.Close();
            return(clientDtos.Entities);
        }
Exemplo n.º 4
0
        private EntityDtos <TEntityDto> FindAllCommand(IRepositoryLocator locator)
        {
            IQueryable <TEntity> all = locator.GetRepository <TEntity>().FindAll();
            var result = new EntityDtos <TEntityDto> {
                Entities = Mapper.Map <IQueryable <TEntity>, List <TEntityDto> >(all)
            };

            if (result.Entities.Count() == 0)
            {
                Container.RequestContext.Notifier.AddWarning(BusinessWarningEnum.Default, "No Users were found");
            }
            return(result);
        }
Exemplo n.º 5
0
        public virtual void GetBankId()
        {
            Query     query    = new Query();
            Criterion bankname = new Criterion(Constants.BANKNAME, "Kotak Mahindra Bank", CriteriaOperator.Equal);

            CurrentUserInstance.UserOfClient.CAId = 1;
            Criterion caid = new Criterion(Constants.CAID, CurrentUserInstance.UserOfClient.CAId, CriteriaOperator.Equal);

            query.Add(bankname);
            query.Add(caid);
            query.QueryOperator = QueryOperator.And;
            EntityDtos <BankDto> bankdetails = BankService.FindByQuery(query);
            int bankid = bankdetails.Entities[0].BankId;
        }
Exemplo n.º 6
0
        private List <ZoneDto> GetZoneList()
        {
            ZonesMasterClient = new ZoneServiceClient();
            UserDto   currentUserDto = (UserDto)Session[Constants.SKCURRENTUSER];
            Query     query          = new Query();
            Criterion criteriaCAId   = new Criterion(Constants.CAID, Helper.GetCAIdOfUser(currentUserDto), CriteriaOperator.Equal);

            query.Add(criteriaCAId);
            query.QueryOperator = QueryOperator.And;
            EntityDtos <ZoneDto> zonedtos = ZonesMasterClient.FindByQuery(query);

            ZonesMasterClient.Close();
            return(zonedtos.Entities.ToList());
        }
Exemplo n.º 7
0
        private EntityDtos <TEntityDto> FindByCommand(IRepositoryLocator locator, Query query, int pageIndex, int recordsPerPage)
        {
            IQueryable <TEntity> all    = locator.GetRepository <TEntity>().FindBy(query, pageIndex, recordsPerPage);
            IList <TEntityDto>   allDto = new List <TEntityDto>();

            foreach (TEntity entity in all)
            {
                allDto.Add(EntityToEntityDto(entity));
            }
            var result = new EntityDtos <TEntityDto> {
                Entities = allDto
            };

            result.TotalRecords = locator.GetRepository <TEntity>().GetCount(query);
            if (result.TotalRecords == 0)
            {
                Container.RequestContext.Notifier.AddWarning(BusinessWarningEnum.Default, "No records were found");
            }
            return(result);
        }
Exemplo n.º 8
0
        private EntityDtos <TEntityDto> FindAllCommand(IRepositoryLocator locator)
        {
            IQueryable <TEntity> all    = locator.GetRepository <TEntity>().FindAll();
            IList <TEntityDto>   allDto = new List <TEntityDto>();

            PopulateChildObjects = false;
            foreach (TEntity entity in all)
            {
                allDto.Add(EntityToEntityDto(entity));
            }
            var result = new EntityDtos <TEntityDto> {
                Entities = allDto
            };

            result.TotalRecords = result.Entities.Count();
            if (result.TotalRecords == 0)
            {
                Container.RequestContext.Notifier.AddWarning(BusinessWarningEnum.Default, "No Records were found");
            }
            return(result);
        }
Exemplo n.º 9
0
 public ActionResult StateList()
 {
     try
     {
         statesMasterService = new StateServiceClient();
         EntityDtos <StateDto> stateDto = statesMasterService.FindAll();
         ViewData["StateList"] = stateDto.Entities;
     }
     catch (Exception ex)
     {
         return(View("ErrorPage"));
     }
     finally
     {
         if (statesMasterService != null)
         {
             statesMasterService.Close();
         }
     }
     return(View("StateList", ViewData["StateList"]));
 }
Exemplo n.º 10
0
        public List <ClientDto> GetCAList()
        {
            ClientServiceClient client = new ClientServiceClient();
            //UserDto CurrentUser = (UserDto)Session[Constants.SKCURRENTUSER];
            Query     query    = new Query();
            Criterion crActive = new Criterion("IsActive", true, CriteriaOperator.Equal);

            query.Add(crActive);
            EntityDtos <ClientDto> clientDtos = client.FindByQuery(query, false);

            //var caDtos = client.FindAll();
            List <ClientDto> caList = clientDtos.Entities.ToList();

            caList.Insert(0, new ClientDto
            {
                CAId            = 0,
                CompanyName     = "[Select]",
                DisplayClientId = ""
            });
            client.Close();
            return(caList);
        }