public IEnumerable <FIPBReview> GetFIPBReview(FIPBReview fIPBReview)
        {
            using (DemsifyEntities dataContext = new DemsifyEntities())
            {
                ObjectParameter totalPageCount = new ObjectParameter("TotalPageCount", typeof(int));
                ObjectParameter totalRecord    = new ObjectParameter("TotalRecord", typeof(int));

                var fIPBReviews = dataContext.FIPBReviewGet(fIPBReview.FIPBReviewId, Utility.TrimString(fIPBReview.SearchText), fIPBReview.IsActive, fIPBReview.PageNumber, fIPBReview.PageSize, fIPBReview.IsPagingRequired, Utility.TrimString(fIPBReview.OrderBy), Utility.TrimString(fIPBReview.OrderByDirection), totalPageCount, totalRecord).ToList();

                var fIPBReviewList = new List <FIPBReview>();
                foreach (var fIPBReviewDetail in fIPBReviews)
                {
                    fIPBReviewList.Add(new FIPBReview()
                    {
                        FIPBReviewId   = fIPBReviewDetail.id,
                        Name           = fIPBReviewDetail.Name,
                        PDF            = fIPBReviewDetail.PDF,
                        IsActive       = fIPBReviewDetail.IsActive,
                        TotalPageCount = Convert.ToInt32(totalPageCount.Value),
                        TotalRecord    = Convert.ToInt32(totalRecord.Value)
                    });
                }
                return(fIPBReviewList);
            }
        }
Exemple #2
0
        public IHttpActionResult UpdateFIPBReview(UpdateFIPBReviewRequest updateFIPBReviewRequest)
        {
            var responses = new Responses();

            try
            {
                if (!ModelState.IsValid)
                {
                    return(BadRequest(ModelState));
                }

                if (Utility.UserId < 0)
                {
                    return(BadRequest(Utility.INVALID_USER));
                }

                var fIPBReview = new FIPBReview()
                {
                    FIPBReviewId = updateFIPBReviewRequest.FIPBReviewId,
                    Name         = updateFIPBReviewRequest.Name,
                    PDF          = updateFIPBReviewRequest.PDF,
                    ModifiedBy   = Utility.UserId
                };
                int result = iFIPBReview.UpdateFIPBReview(fIPBReview);

                switch (result)
                {
                case 1:
                    responses.Status      = Utility.SUCCESS_STATUS_RESPONSE;
                    responses.Description = "FIPBReview updated successfully.";
                    break;

                case -2:
                    responses.Status      = Utility.ERROR_STATUS_RESPONSE;
                    responses.Description = "FIPBReview already exists.";
                    break;

                case -3:
                    responses.Status      = Utility.ERROR_STATUS_RESPONSE;
                    responses.Description = "FIPBReview doesn't exist.";
                    break;

                default:
                    responses.Status      = Utility.ERROR_STATUS_RESPONSE;
                    responses.Description = "Error while updating fIPBReview.";
                    break;
                }
            }
            catch (Exception ex)
            {
                responses.Status      = Utility.ERROR_STATUS_RESPONSE;
                responses.Description = "Error while updating admin profile.";

                Utility.WriteLog("UpdateFIPBReview", updateFIPBReviewRequest, "Error while updating fIPBReview. (FIPBReviewAdminController)", ex.ToString());
            }
            return(Ok(responses));
        }
        public int DeleteFIPBReview(FIPBReview fIPBReview)
        {
            using (DemsifyEntities dataContext = new DemsifyEntities())
            {
                ObjectParameter result = new ObjectParameter("Result", typeof(int));

                dataContext.FIPBReviewDelete(fIPBReview.FIPBReviewId, fIPBReview.ModifiedBy, result);

                return(Convert.ToInt32(result.Value));
            }
        }
        public int AddFIPBReview(FIPBReview fIPBReview)
        {
            using (DemsifyEntities dataContext = new DemsifyEntities())
            {
                ObjectParameter result = new ObjectParameter("Result", typeof(int));

                dataContext.FIPBReviewAdd(Utility.TrimString(fIPBReview.Name), Utility.TrimString(fIPBReview.PDF), fIPBReview.CreatedBy, result);

                return(Convert.ToInt32(result.Value));
            }
        }
Exemple #5
0
        public IHttpActionResult AddFIPBReview(AddFIPBReviewRequest addFIPBReviewRequest)
        {
            var responses = new Responses();

            try
            {
                if (!ModelState.IsValid)
                {
                    return(BadRequest(ModelState));
                }

                var fIPBReview = new FIPBReview()
                {
                    Name      = addFIPBReviewRequest.Name,
                    PDF       = addFIPBReviewRequest.PDF,
                    CreatedBy = Utility.UserId
                };
                int result = iFIPBReview.AddFIPBReview(fIPBReview);
                if (result > 0)
                {
                    responses.Status      = Utility.SUCCESS_STATUS_RESPONSE;
                    responses.Description = "FIPBReview added successfully.";
                }
                else if (result == -2)
                {
                    responses.Status      = Utility.ERROR_STATUS_RESPONSE;
                    responses.Description = "FIPBReview alread exists.";
                }
                else
                {
                    responses.Status      = Utility.ERROR_STATUS_RESPONSE;
                    responses.Description = "Error while adding fIPBReview.";
                }
            }
            catch (Exception ex)
            {
                responses.Status      = Utility.ERROR_STATUS_RESPONSE;
                responses.Description = "Error while adding fIPBReview.";

                Utility.WriteLog("AddFIPBReview", addFIPBReviewRequest, "Error while adding fIPBReview. (FIPBReviewAdminController)", ex.ToString());
            }
            return(Ok(responses));
        }
Exemple #6
0
        public IHttpActionResult GetFIPBReview([FromUri] GetFIPBReviewRequest getFIPBReviewRequest)
        {
            var responses = new Responses();

            try
            {
                if (Utility.UserId < 0)
                {
                    return(BadRequest(Utility.INVALID_USER));
                }

                if (getFIPBReviewRequest == null)
                {
                    getFIPBReviewRequest = new GetFIPBReviewRequest();
                }

                if (getFIPBReviewRequest.PageSize == null)
                {
                    getFIPBReviewRequest.PageSize = Convert.ToInt32(ConfigurationManager.AppSettings["PageSize"]);
                }

                var fIPBReview = new FIPBReview()
                {
                    FIPBReviewId     = getFIPBReviewRequest.FIPBReviewId,
                    SearchText       = getFIPBReviewRequest.SearchText,
                    IsActive         = getFIPBReviewRequest.IsActive,
                    PageNumber       = getFIPBReviewRequest.PageNumber,
                    PageSize         = Convert.ToInt32(getFIPBReviewRequest.PageSize),
                    IsPagingRequired = (getFIPBReviewRequest.PageNumber != null) ? true : false,
                    OrderBy          = getFIPBReviewRequest.OrderBy,
                    OrderByDirection = getFIPBReviewRequest.OrderByDirection
                };
                var fIPBReviews = iFIPBReview.GetFIPBReview(fIPBReview);

                var fIPBReviewList = new List <GetFIPBReviewResponse>();
                foreach (var fIPBReviewDetail in fIPBReviews)
                {
                    fIPBReviewList.Add(new GetFIPBReviewResponse()
                    {
                        FIPBReviewId   = Convert.ToInt32(fIPBReviewDetail.FIPBReviewId),
                        Name           = fIPBReviewDetail.Name,
                        PDF            = fIPBReviewDetail.PDF,
                        IsActive       = Convert.ToBoolean(fIPBReviewDetail.IsActive),
                        CreatedBy      = fIPBReviewDetail.CreatedBy,
                        TotalPageCount = fIPBReviewDetail.TotalPageCount,
                        TotalRecord    = fIPBReviewDetail.TotalRecord
                    });
                }

                responses.Status      = Utility.SUCCESS_STATUS_RESPONSE;
                responses.Description = "FIPBReview retrieved successfully";
                responses.Response    = fIPBReviewList;
            }
            catch (Exception ex)
            {
                responses.Status      = Utility.ERROR_STATUS_RESPONSE;
                responses.Description = "Error while retrieving fIPBReview.";

                Utility.WriteLog("GetFIPBReview", getFIPBReviewRequest, "Error while retrieving fIPBReview. (FIPBReviewAdminController)", ex.ToString());
            }
            return(Ok(responses));
        }