Exemplo n.º 1
0
        public IHttpActionResult GetAllServiceRepositories(
            [FromBody] BaseReportFilter <ReportFilter> filter)
        {
            var res = new ApiPagedCollectionResponse <ServiceRepositoryDto>
            {
                Result = new List <ServiceRepositoryDto>()
            };

            try
            {
                var repo = AuthorizeProvider.GetAllServiceRepositories(filter);
                repo = SetKendoFilter(filter, repo);


                res = new ApiPagedCollectionResponse <ServiceRepositoryDto>
                {
                    Result = repo,

                    Message      = ((int)RuleExceptionCodeCommon.ValidResult).ToString(),
                    TotalRecords = repo.Count
                };
            }

            catch (Exception ex)
            {
                Logger.ErrorException(ex.Message, ex);
                res.Message = BusinessRuleHelper.GetExceptionCode(ex).ToString();
            }

            return(Json(res));
        }
Exemplo n.º 2
0
        public IHttpActionResult GetPageTypeEnum()
        {
            ApiPagedCollectionResponse <EnumResponseDto> res;

            try
            {
                var pageType = Enum.GetValues(typeof(PageType)).Cast <PageType>();

                var lsDtos = pageType.Select(trType => new EnumResponseDto
                {
                    Code  = ((int)trType).SafeString(),
                    Title = trType.SafeString()
                }).ToList();

                res = new ApiPagedCollectionResponse <EnumResponseDto>
                {
                    Result       = lsDtos,
                    TotalRecords = lsDtos.Count,
                    Message      = MessageResultEnum.OperationSuccessFullyDone.GetEnumDescription()
                };
            }
            catch (Exception ex)
            {
                Logger.ErrorException(ex.Message, ex);
                res = new ApiPagedCollectionResponse <EnumResponseDto>
                {
                    Message   = MessageResultEnum.OperationFailed.GetEnumDescription(),
                    BRuleCode = BusinessRuleHelper.GetExceptionCode(ex)
                };
                return(Json(res));
            }
            return(Json(res));
        }
Exemplo n.º 3
0
        public IHttpActionResult GetAllPageAccessBasedOnRoles(
            [FromBody] BaseReportFilter <ReportFilter> filter)
        {
            var res = new ApiPagedCollectionResponse <FlatServiceAccess>
            {
            };

            try
            {
                var data = AuthorizeProvider.GetAllPageAccessBasedOnRoles(Applications.IranMarketerFund);

                res = new ApiPagedCollectionResponse <FlatServiceAccess>
                {
                    Message      = (RuleExceptionCodeCommon.ValidResult).GetEnumDescription(),
                    BRuleCode    = (int)RuleExceptionCodeCommon.ValidResult,
                    Result       = data,
                    TotalRecords = data.Count
                };
            }
            catch (Exception ex)
            {
                Logger.ErrorException(ex.Message, ex);
                res.Message   = BusinessRuleHelper.GetException(ex);
                res.BRuleCode = BusinessRuleHelper.GetExceptionCode(ex);
            }
            return(Json(res));
        }
Exemplo n.º 4
0
        public IHttpActionResult GetRegisteredUsers(string text = "")
        {
            ApiPagedCollectionResponse <object> res;

            try
            {
                var lst = new List <ApplicationUserDTO>();

                lst = AuthorizeProvider.GetUsers(text);

                var final =
                    lst.Select(
                        x =>
                        new
                {
                    x.UserName,
                    x.DisplayName,
                    x.DisplayNameEn,
                    x.DisplayNameFa,
                    x.Email,
                    x.IsAdmin,
                    x.IsCustomizedAccess,
                    x.PhoneNumber,
                    x.Status
                }).ToList();

                res = new ApiPagedCollectionResponse <object>
                {
                    Message = ((int)RuleExceptionCodeCommon.ValidResult).ToString(),
                    Result  = new List <object> {
                        final.OrderBy(x => x.UserName)
                    },
                    TotalRecords = final.Count
                };
            }
            catch (Exception ex)
            {
                Logger.ErrorException(ex.Message, ex);
                res = new ApiPagedCollectionResponse <object>
                {
                    Message = BusinessRuleHelper.GetExceptionCode(ex).ToString()
                };
            }

            return(Json(res));
        }
Exemplo n.º 5
0
        public IHttpActionResult GetPersonalityRoleEnums()
        {
            ApiPagedCollectionResponse <EnumResponseDto> res;

            try
            {
                var personalityRoles = new List <PersonalityRole>()
                {
                    PersonalityRole.Auditor,
                    PersonalityRole.Customer,
                    PersonalityRole.Custodian,
                    PersonalityRole.Guarantor,
                    PersonalityRole.LiquidityGuarantor,
                    PersonalityRole.Manager,
                    PersonalityRole.MarketMakar,
                    PersonalityRole.ProfitGuarantor
                };

                var lsDtos = personalityRoles.Select(trType => new EnumResponseDto
                {
                    Code  = ((int)trType).SafeString(),
                    Title = trType.SafeString()
                }).ToList();

                res = new ApiPagedCollectionResponse <EnumResponseDto>
                {
                    Result       = lsDtos,
                    TotalRecords = lsDtos.Count,
                    Message      = MessageResultEnum.OperationSuccessFullyDone.GetEnumDescription()
                };
            }
            catch (Exception ex)
            {
                Logger.ErrorException(ex.Message, ex);
                res = new ApiPagedCollectionResponse <EnumResponseDto>
                {
                    Message = MessageResultEnum.OperationFailed.GetEnumDescription()
                };
                return(Json(res));
            }
            return(Json(res));
        }
Exemplo n.º 6
0
        public IHttpActionResult GetJobTitleEnum()
        {
            ApiPagedCollectionResponse <EnumResponseDto> res;

            try
            {
                var jobTitles = new List <JobTitle>()
                {
                    JobTitle.Unknown,
                    JobTitle.Employee,
                    JobTitle.SelfEmployed,
                    JobTitle.Worker,
                    JobTitle.Retired,
                    JobTitle.HouseWife
                };

                var lsDtos = jobTitles.Select(trType => new EnumResponseDto
                {
                    Code  = ((int)trType).SafeString(),
                    Title = trType.GetEnumDescription().SafeString()
                }).ToList();

                res = new ApiPagedCollectionResponse <EnumResponseDto>
                {
                    Result       = lsDtos,
                    TotalRecords = lsDtos.Count,
                    Message      = MessageResultEnum.OperationSuccessFullyDone.GetEnumDescription()
                };
            }
            catch (Exception ex)
            {
                Logger.ErrorException(ex.Message, ex);
                res = new ApiPagedCollectionResponse <EnumResponseDto>
                {
                    Message = MessageResultEnum.OperationFailed.GetEnumDescription()
                };
                return(Json(res));
            }
            return(Json(res));
        }
Exemplo n.º 7
0
        public IHttpActionResult GetJobPositionEnum()
        {
            ApiPagedCollectionResponse <EnumResponseDto> res;

            try
            {
                var jobPositions = new List <JobPosition>()
                {
                    JobPosition.Unknown,
                    JobPosition.Expert,
                    JobPosition.MasterExpert,
                    JobPosition.Manager,
                    JobPosition.CEO,
                    JobPosition.MemberOfTheBoard
                };

                var lsDtos = jobPositions.Select(trType => new EnumResponseDto
                {
                    Code  = ((int)trType).SafeString(),
                    Title = trType.GetEnumDescription().SafeString()
                }).ToList();

                res = new ApiPagedCollectionResponse <EnumResponseDto>
                {
                    Result       = lsDtos,
                    TotalRecords = lsDtos.Count,
                    Message      = MessageResultEnum.OperationSuccessFullyDone.GetEnumDescription()
                };
            }
            catch (Exception ex)
            {
                Logger.ErrorException(ex.Message, ex);
                res = new ApiPagedCollectionResponse <EnumResponseDto>
                {
                    Message = MessageResultEnum.OperationFailed.GetEnumDescription()
                };
                return(Json(res));
            }
            return(Json(res));
        }
Exemplo n.º 8
0
        public IHttpActionResult GetEducationDegreeEnum()
        {
            ApiPagedCollectionResponse <EnumResponseDto> res;

            try
            {
                var degrees = new List <EducationDegree>()
                {
                    EducationDegree.Unknown,
                    EducationDegree.UnderDiploma,
                    EducationDegree.Diploma,
                    EducationDegree.BachelorDegree,
                    EducationDegree.MasterDegree,
                    EducationDegree.PhD,
                };

                var lsDtos = degrees.Select(trType => new EnumResponseDto
                {
                    Code  = ((int)trType).SafeString(),
                    Title = trType.GetEnumDescription().SafeString()
                }).ToList();

                res = new ApiPagedCollectionResponse <EnumResponseDto>
                {
                    Result       = lsDtos,
                    TotalRecords = lsDtos.Count,
                    Message      = MessageResultEnum.OperationSuccessFullyDone.GetEnumDescription()
                };
            }
            catch (Exception ex)
            {
                Logger.ErrorException(ex.Message, ex);
                res = new ApiPagedCollectionResponse <EnumResponseDto>
                {
                    Message = MessageResultEnum.OperationFailed.GetEnumDescription()
                };
                return(Json(res));
            }
            return(Json(res));
        }
Exemplo n.º 9
0
        public IHttpActionResult AddServiceRepository(
            [FromBody] BaseReportFilter <ServiceRepositoryDto> filter)
        {
            var res = new ApiPagedCollectionResponse <ServiceRepositoryDto>
            {
            };

            try
            {
                AuthorizeProvider.AddServiceRepository(filter);
                res = new ApiPagedCollectionResponse <ServiceRepositoryDto>
                {
                    Message = ((int)RuleExceptionCodeCommon.ValidResult).ToString(),
                };
            }
            catch (Exception ex)
            {
                Logger.ErrorException(ex.Message, ex);
                res.Message = BusinessRuleHelper.GetExceptionCode(ex).ToString();
            }
            return(Json(res));
        }
Exemplo n.º 10
0
        public IHttpActionResult GetBankAccountTypeEnum()
        {
            ApiPagedCollectionResponse <EnumResponseDto> res;

            try
            {
                var accountTypes = new List <BankAccountType>()
                {
                    BankAccountType.ShortTermDepositAccount,
                    BankAccountType.LongTermDepositAccount,
                    BankAccountType.CurrentAccount,
                    BankAccountType.DebitAccount
                };

                var lsDtos = accountTypes.Select(trType => new EnumResponseDto
                {
                    Code  = ((int)trType).SafeString(),
                    Title = trType.GetEnumDescription().SafeString()
                }).ToList();

                res = new ApiPagedCollectionResponse <EnumResponseDto>
                {
                    Result       = lsDtos,
                    TotalRecords = lsDtos.Count,
                    Message      = MessageResultEnum.OperationSuccessFullyDone.GetEnumDescription()
                };
            }
            catch (Exception ex)
            {
                Logger.ErrorException(ex.Message, ex);
                res = new ApiPagedCollectionResponse <EnumResponseDto>
                {
                    Message = MessageResultEnum.OperationFailed.GetEnumDescription()
                };
                return(Json(res));
            }
            return(Json(res));
        }
Exemplo n.º 11
0
        public IHttpActionResult GetBranchTypeEnum()
        {
            ApiPagedCollectionResponse <EnumResponseDto> res;

            try
            {
                var branchTypes = new List <BranchType>()
                {
                    BranchType.Bank,
                    BranchType.Broker,
                    BranchType.InvestmentBank,
                    BranchType.Virtual
                };

                var lsDtos = branchTypes.Select(trType => new EnumResponseDto
                {
                    Code  = ((int)trType).SafeString(),
                    Title = trType.GetEnumDescription().SafeString()
                }).ToList();

                res = new ApiPagedCollectionResponse <EnumResponseDto>
                {
                    Result       = lsDtos,
                    TotalRecords = lsDtos.Count,
                    Message      = MessageResultEnum.OperationSuccessFullyDone.GetEnumDescription()
                };
            }
            catch (Exception ex)
            {
                Logger.ErrorException(ex.Message, ex);
                res = new ApiPagedCollectionResponse <EnumResponseDto>
                {
                    Message = MessageResultEnum.OperationFailed.GetEnumDescription()
                };
                return(Json(res));
            }
            return(Json(res));
        }
Exemplo n.º 12
0
        public IHttpActionResult GetGenderEnum()
        {
            ApiPagedCollectionResponse <EnumResponseDto> res;

            try
            {
                var genders = new List <Gender>()
                {
                    Gender.Female,
                    Gender.Male,
                    Gender.Unknown,
                };

                var lsDtos = genders.Select(trType => new EnumResponseDto
                {
                    Code  = ((int)trType).SafeString(),
                    Title = trType.GetEnumDescription().SafeString()
                }).ToList();

                res = new ApiPagedCollectionResponse <EnumResponseDto>
                {
                    Result       = lsDtos,
                    TotalRecords = lsDtos.Count,
                    Message      = MessageResultEnum.OperationSuccessFullyDone.GetEnumDescription()
                };
            }
            catch (Exception ex)
            {
                Logger.ErrorException(ex.Message, ex);
                res = new ApiPagedCollectionResponse <EnumResponseDto>
                {
                    Message = MessageResultEnum.OperationFailed.GetEnumDescription()
                };
                return(Json(res));
            }
            return(Json(res));
        }