public async Task <ResultListDto> GetAllAttachmentsAsync(AttachmentFilterDto attachmentDto)
        {
            var attachmentFilter = _mapper.Map <AttachmentFilter>(attachmentDto);

            var fileList = await _uploadService.GetFilesAsync(attachmentFilter);

            List <Attachment> attachments = (List <Attachment>)fileList.Results;

            List <AttachmentDto> attachmentDtos = new List <AttachmentDto>();

            attachments?.ForEach(x =>
            {
                AttachmentDto dto = new AttachmentDto();
                dto = _mapper.Map <AttachmentDto>(x);
                dto.AttachmentType = _mapper.Map <KeyValueDto>(x.AttachmentType);
                attachmentDtos.Add(dto);
            });

            ResultListDto finalResult = new ResultListDto()
            {
                MaxPageRows = fileList.MaxPageRows,
                TotalRows   = fileList.TotalRows,
                Results     = attachmentDtos,
            };

            return(finalResult);
        }
Ejemplo n.º 2
0
        public async Task <ResultListDto> GetBranchesAsync(BranchFilterDto branchFilterDto)
        {
            if (branchFilterDto != null && branchFilterDto.UserBranchDto != null)
            {
                UserBranches userBranches = new UserBranches();
                userBranches = _mapper.Map <UserBranches>(branchFilterDto.UserBranchDto);
                if (branchFilterDto.Branches == null || branchFilterDto.Branches.Count == 0)
                {
                    branchFilterDto.Branches = await _branchService.GetBranchesForFiltersAsync(userBranches);
                }
            }
            var branchFilter = _mapper.Map <BranchFilter>(branchFilterDto);

            var branchList = await _branchService.GetBranchesAsync(branchFilter);

            var branchDtoList = _mapper.Map <IEnumerable <BranchDto> >(branchList.Results);

            ResultListDto finalResult = new ResultListDto()
            {
                MaxPageRows = branchList.MaxPageRows,
                TotalRows   = branchList.TotalRows,
                Results     = branchDtoList
            };

            return(finalResult);
        }
Ejemplo n.º 3
0
        public async Task <ResultListDto> GetEducationLevels()
        {
            var glItemtypelist = await customerAppService.GetEducationLevels();

            var resultlistdto = new ResultListDto {
                Results = glItemtypelist
            };

            return(resultlistdto);
        }
Ejemplo n.º 4
0
        public async Task <ResultListDto> GetSkills()
        {
            var skillList = await customerAppService.GetSkills();

            var resultlistdto = new ResultListDto {
                Results = skillList
            };

            return(resultlistdto);
        }
Ejemplo n.º 5
0
        public async Task <ResultListDto> GetMilitaryServiceStatus()
        {
            var glItemtypelist = await customerAppService.GetMilitaryServiceStatus();

            var resultlistdto = new ResultListDto {
                Results = glItemtypelist
            };

            return(resultlistdto);
        }
Ejemplo n.º 6
0
        public async Task <ResultListDto> GetVillageAsync(int cityId)
        {
            IEnumerable <KeyValueDto> zoneListdto = await _zoneAppService.GetVillages(cityId);

            var resultlistdto = new ResultListDto {
                Results = zoneListdto
            };

            return(resultlistdto);
        }
Ejemplo n.º 7
0
        public async Task <ResultListDto> GetCitiesAsync(int provinceId)
        {
            IEnumerable <KeyValueDto> zoneListdto = await _zoneAppService.GetCities(provinceId);

            var resultlistdto = new ResultListDto {
                Results = zoneListdto
            };

            return(resultlistdto);
        }
Ejemplo n.º 8
0
        public async Task <ResultListDto> GetAllCityAsync()
        {
            IEnumerable <ZoneDto> zoneListdto = await _zoneAppService.GetAllCity();

            var resultlistdto = new ResultListDto {
                Results = zoneListdto
            };

            return(resultlistdto);
        }
        public async Task <ResultListDto> GetRolesAsync()
        {
            IEnumerable <RoleDto> roleListdto = await roleAppService.GetRolesAsync();

            var resultList = new ResultListDto {
                Results = roleListdto, TotalRows = 100, MaxPageRows = 20
            };

            return(resultList);
        }
        public async Task <ResultListDto> GetUserRolesAsync(int userID, int branchID)
        {
            var userRolesList = await _userService.GetUserRolesAsync(userID, branchID);

            var userRolesDtoList = _mapper.Map <IEnumerable <UserBranchRoleDto> >(userRolesList);
            var resultListdto    = new ResultListDto {
                Results = userRolesDtoList, TotalRows = userRolesDtoList.Count()
            };

            return(resultListdto);
        }
Ejemplo n.º 11
0
        public async Task <ResultListDto> GetBranchesBaseOnRoleAsync(BranchFilterDto branchFilterDto)
        {
            List <int>    branchList    = new List <int>();
            ResultListDto resultListDto = new ResultListDto();

            var userRoles = await _userService.GetUserRolesAsync(branchFilterDto.UserBranchDto.BranchId, branchFilterDto.UserBranchDto.UserId);

            foreach (var item in userRoles)
            {
                if (item.RoleId == ConstRoles.Admin)
                {
                    var branchFilter = _mapper.Map <BranchFilter>(branchFilterDto);
                    var resultdto    = await _branchService.GetBranchesAsync(branchFilter);

                    resultListDto = _mapper.Map <ResultListDto>(resultdto);
                    return(resultListDto);
                }
                else if (item.RoleId == ConstRoles.User)
                {
                    var branches = await _branchService.GetUserBranches(branchFilterDto.UserBranchDto.UserId);

                    resultListDto.Results = branches;
                    return(resultListDto);
                }
                else if (item.RoleId == ConstRoles.SuperViser)
                {
                    var branch = await _branchService.GetBranchAsync(branchFilterDto.UserBranchDto.BranchId);

                    var zone = await _zoneService.GetZoneInfoByZoneIDAsync(branch.ZoneID);

                    resultListDto.Results = await _zoneService.GetProvinceBranchesByProvinceCode(zone.OSTANCode);

                    return(resultListDto);
                }
                //else if (item.RoleId == ConstRoles.Customer)
                //{
                //    //var customer = await _customerAppService.GetCustomerByUserIDAsync(branchFilterDto.UserBranchDto.UserId);
                //    //((DepositFilterDto)branchFilterDto).CustomerHeadSerial = customer.Serial;
                //}
                //else
                //{
                //    branchList.Add(branchFilterDto.UserBranchDto.BranchId);
                //    return branchList;
                //}
            }
            resultListDto.Results = await _branchService.GetBranchAsync(branchFilterDto.UserBranchDto.BranchId);

            resultListDto.ServerErrors = null;
            return(resultListDto);
        }
        public async Task <ResultListDto> GetCustomersAsync()
        {
            var customerList = await _customerService.GetCustomersAsync();

            var           customerDtoList = _mapper.Map <IEnumerable <CustomerHeadDto> >(customerList);
            ResultListDto finalResult     = new ResultListDto()
            {
                MaxPageRows = 50,
                TotalRows   = 100,
                Results     = customerDtoList
            };

            return(finalResult);
        }
        public async Task <ResultListDto> getUnSeenUserMessages(int userID)
        {
            ResultListDto resultListDto = new ResultListDto();

            var result = await notificationService.GetUnSeenUserMessagesAsync(userID);

            var messagess = mapper.Map <List <MessageDto> >(result);

            resultListDto.TotalRows = messagess.Count();

            resultListDto.Results      = messagess;
            resultListDto.ServerErrors = null;
            return(resultListDto);
        }
Ejemplo n.º 14
0
        public async Task <ResultListDto> GetBranchListAsync(BranchFilterDto branchFilterDto)
        {
            var branchFilter = _mapper.Map <BranchFilter>(branchFilterDto);
            var branchList   = await _branchService.GetBranchListAsync(branchFilter);

            var           branchDtoList = _mapper.Map <IEnumerable <BranchDto> >(branchList.Results);
            ResultListDto finalResult   = new ResultListDto()
            {
                MaxPageRows = branchList.MaxPageRows,
                TotalRows   = branchList.TotalRows,
                Results     = branchDtoList
            };

            return(finalResult);
        }
        public async Task <ResultListDto> GetAllAttachmentTypesAsync(int categoryID)
        {
            var fileList = await _uploadService.GetAttachmentTypesAsync(categoryID);

            var fileDtoDtoList = _mapper.Map <IEnumerable <KeyValueDto> >(fileList.Results);


            ResultListDto finalResult = new ResultListDto()
            {
                MaxPageRows = fileList.MaxPageRows,
                TotalRows   = fileList.TotalRows,
                Results     = fileDtoDtoList,
            };

            return(finalResult);
        }
        public async Task <ResultListDto> GetConsultantsAsync(ConsultantFilterDto consultantFilterDto)
        {
            var consultantFilter = _mapper.Map <ConsultantFilter>(consultantFilterDto);
            var consultList      = await consultService.GetConsultantsAsync(consultantFilter);

            var consults = _mapper.Map <IEnumerable <ConsultantDto> >(consultList.entities);

            ResultListDto finalResult = new ResultListDto()
            {
                MaxPageRows = consultList.MaxPageRows,
                TotalRows   = 10,
                //TotalRows = consultList.TotalRows,
                Results = consults
            };

            return(finalResult);
        }
        public async Task <ResultListDto> GetAllBranchCustomerHeadsAsync(CustomerFilterDto customerFilter)
        {
            //var userBranches = _mapper.Map<UserBranches>(customerFilterDto.UserBranchDto);

            //var customerFilter = _mapper.Map<CustomerFilter>(customerFilterDto);

            var customerFilterr = _mapper.Map <CustomerFilter>(customerFilter);

            var customerList = await _customerService.GetAllBranchCustomerHeadsAsync(customerFilterr);

            var customerDtoList = _mapper.Map <List <KeyValueDto> >(customerList.Results);


            ResultListDto finalResult = new ResultListDto()
            {
                MaxPageRows = customerList.MaxPageRows,
                TotalRows   = customerList.TotalRows,
                Results     = customerDtoList
            };

            return(finalResult);
        }
        public async Task <ResultListDto> GetUsersAsync(UserFilterDto userFilterDto)
        {
            var userBranch = _mapper.Map <UserBranches>(userFilterDto.UserBranchDto);

            if (userFilterDto.Branches == null || userFilterDto.Branches.Count == 0)
            {
                userFilterDto.Branches = await _branchService.GetBranchesForFiltersAsync(userBranch);
            }

            var userFilter = _mapper.Map <UserFilter>(userFilterDto);
            var userList   = await _userService.GetUsersAsync(userFilter);

            var           userDtoList = _mapper.Map <IEnumerable <UserDto> >(userList.Results);
            ResultListDto finalResult = new ResultListDto()
            {
                MaxPageRows = userList.MaxPageRows,
                TotalRows   = userList.TotalRows,
                Results     = userDtoList
            };

            return(finalResult);
        }
        public async Task <ResultListDto> GetCustomersByFilterAsync(CustomerFilterDto customerFilterDto)
        {
            var userBranches = _mapper.Map <UserBranches>(customerFilterDto.UserBranchDto);

            if (customerFilterDto.Branches == null || customerFilterDto.Branches.Count == 0)
            {
                customerFilterDto.Branches = await _branchService.GetBranchesForFiltersAsync(userBranches);
            }

            var customerFilter = _mapper.Map <CustomerFilter>(customerFilterDto);
            var customerList   = await _customerService.GetCustomersByFilterAsync(customerFilter);

            var customerDtoList = _mapper.Map <List <CustomerHeadDto> >(customerList.Results);

            customerDtoList.ForEach(x =>
            {
                x.CustomerDetails.ForEach(d =>
                {
                    if (d.CustomerDetailTypeID == ConstCustomerDetailsTypes.Mobile)
                    {
                        x.MobileCustomerDetail = d;
                    }

                    if (d.CustomerDetailTypeID == ConstCustomerDetailsTypes.HomePhone)
                    {
                        x.HomePhoneCustomerDetail = d;
                    }

                    if (d.CustomerDetailTypeID == ConstCustomerDetailsTypes.HomeAddress)
                    {
                        x.HomeAddressCustomerDetail = d;
                    }

                    if (d.CustomerDetailTypeID == ConstCustomerDetailsTypes.WorkPhone)
                    {
                        x.WorkPhoneCustomerDetail = d;
                    }

                    if (d.CustomerDetailTypeID == ConstCustomerDetailsTypes.WorkAddress)
                    {
                        x.WorkAddressCustomerDetail = d;
                    }

                    //if (d.CustomerDetailTypeID == ConstCustomerDetailsTypes.CertificateImage)
                    //    x.CertificateImageCustomerDetail = d;

                    //if (d.CustomerDetailTypeID == ConstCustomerDetailsTypes.PersonalImage)
                    //    x.PersonalImageCustomerDetail = d;

                    //if (d.CustomerDetailTypeID == ConstCustomerDetailsTypes.SignatureImage)
                    //    x.SignatureImageCustomerDetail = d;
                });

                x.CustomerDetails = new List <CustomerDetailDto>();
            });

            foreach (var item in customerDtoList)
            {
                foreach (var item2 in item.CustomerSkills)
                {
                    item.Skills.Add(item2.SkillID);
                }
            }

            ResultListDto finalResult = new ResultListDto()
            {
                MaxPageRows = customerList.MaxPageRows,
                TotalRows   = customerList.TotalRows,
                Results     = customerDtoList
            };

            return(finalResult);
        }
Ejemplo n.º 20
0
        public async Task <ResultListDto> GetAllBranchCustomerHeadsAsync(CustomerFilterDto customerFilterDto)
        {
            ResultListDto branchListdto = await customerAppService.GetAllBranchCustomerHeadsAsync(customerFilterDto);

            return(branchListdto);
        }
Ejemplo n.º 21
0
        public async Task <ResultListDto> GetCustomersByFilter([FromBody] CustomerFilterDto customerFilterDto = null)
        {
            ResultListDto branchListdto = await customerAppService.GetCustomersByFilterAsync(customerFilterDto);

            return(branchListdto);
        }
Ejemplo n.º 22
0
        public async Task <ResultListDto> GetCustomersAsync()
        {
            ResultListDto customerListDto = await customerAppService.GetCustomersAsync();

            return(customerListDto);
        }
        public async Task <ResultListDto> GetConsultantsAsync([FromBody] ConsultantFilterDto consultantFilterDto = null)
        {
            ResultListDto consultantList = await consultAppService.GetConsultantsAsync(consultantFilterDto);

            return(consultantList);
        }
        public async Task <ResultListDto> GetUsersAsync([FromBody] UserFilterDto userFilterDto = null)
        {
            ResultListDto userListdto = await userAppService.GetUsersAsync(userFilterDto);

            return(userListdto);
        }
Ejemplo n.º 25
0
        public async Task <ResultListDto> GetBranchListAsync([FromBody] BranchFilterDto branchFilterDto = null)
        {
            ResultListDto branchListdto = await branchAppService.GetBranchListAsync(branchFilterDto);

            return(branchListdto);
        }