Esempio n. 1
0
        public IEnumerable <TicketDto> TicketByEmployer(TransByEmployerDTO requestParam)
        {
            IList <TicketDto> transDtoList = new List <TicketDto>();
            var employees = _db2.Tickets.Where(o => o.AspNetUserId == requestParam.EmployerId).ToList();

            foreach (var item in employees)
            {
                var transDto = new TicketDto()
                {
                    Title        = item.Title,
                    Description  = item.Description,
                    CreatedAt    = item.CreatedAt,
                    TicketId     = item.TicketId,
                    noOfComments = item.Comment.Count().ToString()
                };

                if (item.status == TicketStatus.Open)
                {
                    transDto.Status = "Open";
                }
                else
                {
                    transDto.Status = "Close";
                }

                transDtoList.Add(transDto);
            }
            return(transDtoList);
        }
Esempio n. 2
0
        public IEnumerable <TransactionDto> TransactionByEmployer(TransByEmployerDTO requestParam)
        {
            IList <TransactionDto> transDtoList = new List <TransactionDto>();
            var trans = _db2.Transactions.Where(o => o.EmployerId == requestParam.EmployerId).ToList();

            foreach (var item in trans)
            {
                var transDto = new TransactionDto()
                {
                    Amount          = item.Amount.ToString(),
                    EmployeeId      = getUserName(item.Employee.EmployeeId),
                    EmployerId      = getUserName(item.Employer.EmployerId),
                    EndDate         = item.Salary.EndDate.ToString(),
                    PaymentCategory = item.PaymentCategory,
                    StartDate       = item.Salary.StartDate.ToString(),
                    TransactionDate = item.TransactionDate.ToString(),
                    TransactionId   = item.TransactionId
                };

                switch (item.PaymentChannel)
                {
                case PaymentChannelType.Web:
                    transDto.PaymentChannel = "Web";
                    break;

                case PaymentChannelType.Pos:
                    transDto.PaymentChannel = "Pos";
                    break;

                case PaymentChannelType.Cash:
                    transDto.PaymentChannel = "Cash";
                    break;

                default:
                    break;
                }

                switch (item.PaymentStatus)
                {
                case PaymentStatus.Failed:
                    transDto.PaymentStatus = "Failed";
                    break;

                case PaymentStatus.Successful:
                    transDto.PaymentStatus = "Successful";
                    break;

                case PaymentStatus.pending:
                    transDto.PaymentStatus = "pending";
                    break;

                default:
                    break;
                }

                transDtoList.Add(transDto);
            }
            return(transDtoList);
        }
Esempio n. 3
0
        public IEnumerable <NotificationDTO> NotificationByEmployer(TransByEmployerDTO requestParam)
        {
            IList <NotificationDTO> transDtoList = new List <NotificationDTO>();
            var employees = _db2.Notifications.Where(o => o.AspNetUserId == requestParam.EmployerId).ToList();

            foreach (var item in employees)
            {
                var transDto = new NotificationDTO()
                {
                    CreatedBy        = item.CreatedBy,
                    Description      = item.Description,
                    NotificationDate = item.NotificationDate,
                    NotificationId   = item.NotificationId
                };

                transDtoList.Add(transDto);
            }
            return(transDtoList);
        }
Esempio n. 4
0
        public IHttpActionResult NotificationByUser(TransByEmployerDTO requestParam)
        {
            try
            {
                var json = JsonConvert.SerializeObject(requestParam);
                log(json);

                if (!ModelState.IsValid)
                {
                    var message = string.Join(" | ", ModelState.Values
                                              .SelectMany(v => v.Errors)
                                              .Select(e => e.ErrorMessage));

                    var error = new ErorrMessage()
                    {
                        ResponseCode   = 403,
                        ResponseStatus = false,
                        Message        = message
                    };

                    return(ResponseMessage(Request.CreateResponse(HttpStatusCode.Forbidden, error)));
                }

                var transactionResponse = util.NotificationByEmployer(requestParam);
                if (transactionResponse.Count() == 0)
                {
                    return(ResponseMessage(Request.CreateResponse(HttpStatusCode.NotFound, ErrorResponse(404, "Unable to capture record"))));
                }

                return(Ok(SuccessResponse(200, "successful", transactionResponse)));
            }
            catch (Exception ex)
            {
                return(ResponseMessage(Request.CreateResponse(HttpStatusCode.InternalServerError, ErrorResponse(500, ex.Message.ToString()))));
            }
        }
Esempio n. 5
0
        public IEnumerable <EmployerDTO> EmployeeByEmployer(TransByEmployerDTO requestParam)
        {
            IList <EmployerDTO> transDtoList = new List <EmployerDTO>();
            var employees = _db2.Employees.Where(o => o.EmployerId == requestParam.EmployerId).ToList();

            foreach (var item in employees)
            {
                var transDto = new EmployerDTO()
                {
                    AccountName   = item.AccountName,
                    AccountNumber = item.AccountNumber,
                    Address       = item.AspNetUser.Address,
                    AttachedDate  = item.AttachedDate,
                    BankName      = item.BankName,
                    BVN           = item.BVN,
                    CategoryId    = item.CategoryId,
                    DateOfBirth   = item.AspNetUser.DateOfBirth,
                    Email         = item.AspNetUser.Email,
                    FirstName     = item.AspNetUser.FirstName,
                    Id            = item.EmployeeId,
                    LastName      = item.AspNetUser.LastName,
                    MiddleName    = item.AspNetUser.MiddleName,
                    NIMC          = item.NIMC,
                    PhoneNumber   = item.AspNetUser.PhoneNumber,
                    PlaceOfBirth  = item.AspNetUser.PlaceOfBirth,
                    SalaryAmount  = item.SalaryAmount,
                    StateOfOrigin = item.AspNetUser.StateOfOrigin
                };

                switch (item.AspNetUser.Sex)
                {
                case SexType.Female:
                    transDto.Sex = "Female";
                    break;

                case SexType.Male:
                    transDto.Sex = "Male";
                    break;

                default:
                    break;
                }

                switch (item.QualificationType)
                {
                case QualificationType.Bsc:
                    transDto.QualificationType = "Bsc";
                    break;

                case QualificationType.Hnd:
                    transDto.QualificationType = "Hnd";
                    break;

                case QualificationType.Msc:
                    transDto.QualificationType = "Msc";
                    break;

                case QualificationType.Ond:
                    transDto.QualificationType = "Ond";
                    break;

                case QualificationType.Ssce:
                    transDto.QualificationType = "Ssce";
                    break;

                default:
                    break;
                }


                transDtoList.Add(transDto);
            }
            return(transDtoList);
        }