コード例 #1
0
        public IEnumerable <DIPPClarification> GetDIPPClarification(DIPPClarification dIPPClarification)
        {
            using (DemsifyEntities dataContext = new DemsifyEntities())
            {
                ObjectParameter totalPageCount = new ObjectParameter("TotalPageCount", typeof(int));
                ObjectParameter totalRecord    = new ObjectParameter("TotalRecord", typeof(int));

                var dIPPClarifications = dataContext.DIPPClarificationGet(dIPPClarification.DIPPClarificationId, Utility.TrimString(dIPPClarification.SearchText), dIPPClarification.IsActive, dIPPClarification.PageNumber, dIPPClarification.PageSize, dIPPClarification.IsPagingRequired, Utility.TrimString(dIPPClarification.OrderBy), Utility.TrimString(dIPPClarification.OrderByDirection), totalPageCount, totalRecord).ToList();

                var dIPPClarificationList = new List <DIPPClarification>();
                foreach (var dIPPClarificationDetail in dIPPClarifications)
                {
                    dIPPClarificationList.Add(new DIPPClarification()
                    {
                        DIPPClarificationId = dIPPClarificationDetail.DIPPClarificationsID,
                        ClarificationTopic  = dIPPClarificationDetail.Title,
                        PDF            = dIPPClarificationDetail.PDF,
                        IsActive       = dIPPClarificationDetail.IsActive,
                        TotalPageCount = Convert.ToInt32(totalPageCount.Value),
                        TotalRecord    = Convert.ToInt32(totalRecord.Value)
                    });
                }
                return(dIPPClarificationList);
            }
        }
コード例 #2
0
        public IHttpActionResult UpdateDIPPClarification(UpdateDIPPClarificationRequest updateDIPPClarificationRequest)
        {
            var responses = new Responses();

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

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

                var dIPPClarification = new DIPPClarification()
                {
                    DIPPClarificationId = updateDIPPClarificationRequest.DIPPClarificationId,
                    ClarificationTopic  = updateDIPPClarificationRequest.ClarificationTopic,
                    PDF        = updateDIPPClarificationRequest.PDF,
                    ModifiedBy = Utility.UserId
                };
                int result = iDIPPClarification.UpdateDIPPClarification(dIPPClarification);

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

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

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

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

                Utility.WriteLog("UpdateDIPPClarification", updateDIPPClarificationRequest, "Error while updating dIPPClarification. (DIPPClarificationAdminController)", ex.ToString());
            }
            return(Ok(responses));
        }
コード例 #3
0
        public int DeleteDIPPClarification(DIPPClarification dIPPClarification)
        {
            using (DemsifyEntities dataContext = new DemsifyEntities())
            {
                ObjectParameter result = new ObjectParameter("Result", typeof(int));

                dataContext.DIPPClarificationDelete(dIPPClarification.DIPPClarificationId, dIPPClarification.ModifiedBy, result);

                return(Convert.ToInt32(result.Value));
            }
        }
コード例 #4
0
        public int UpdateDIPPClarification(DIPPClarification dIPPClarification)
        {
            using (DemsifyEntities dataContext = new DemsifyEntities())
            {
                ObjectParameter result = new ObjectParameter("Result", typeof(int));

                dataContext.DIPPClarificationUpdate(dIPPClarification.DIPPClarificationId, Utility.TrimString(dIPPClarification.ClarificationTopic), Utility.TrimString(dIPPClarification.PDF), dIPPClarification.ModifiedBy, result);

                return(Convert.ToInt32(result.Value));
            }
        }
コード例 #5
0
        public IHttpActionResult AddDIPPClarification(AddDIPPClarificationRequest addDIPPClarificationRequest)
        {
            var responses = new Responses();

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

                var dIPPClarification = new DIPPClarification()
                {
                    ClarificationTopic = addDIPPClarificationRequest.ClarificationTopic,
                    PDF       = addDIPPClarificationRequest.PDF,
                    CreatedBy = Utility.UserId
                };
                int result = iDIPPClarification.AddDIPPClarification(dIPPClarification);
                if (result > 0)
                {
                    responses.Status      = Utility.SUCCESS_STATUS_RESPONSE;
                    responses.Description = "DIPPClarification added successfully.";
                }
                else if (result == -2)
                {
                    responses.Status      = Utility.ERROR_STATUS_RESPONSE;
                    responses.Description = "DIPPClarification alread exists.";
                }
                else
                {
                    responses.Status      = Utility.ERROR_STATUS_RESPONSE;
                    responses.Description = "Error while adding dIPPClarification.";
                }
            }
            catch (Exception ex)
            {
                responses.Status      = Utility.ERROR_STATUS_RESPONSE;
                responses.Description = "Error while adding dIPPClarification.";

                Utility.WriteLog("AddDIPPClarification", addDIPPClarificationRequest, "Error while adding dIPPClarification. (DIPPClarificationAdminController)", ex.ToString());
            }
            return(Ok(responses));
        }
コード例 #6
0
        public IHttpActionResult GetDIPPClarification([FromUri] GetDIPPClarificationRequest getDIPPClarificationRequest)
        {
            var responses = new Responses();

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

                if (getDIPPClarificationRequest == null)
                {
                    getDIPPClarificationRequest = new GetDIPPClarificationRequest();
                }

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

                var dIPPClarification = new DIPPClarification()
                {
                    DIPPClarificationId = getDIPPClarificationRequest.DIPPClarificationId,
                    SearchText          = getDIPPClarificationRequest.SearchText,
                    IsActive            = getDIPPClarificationRequest.IsActive,
                    PageNumber          = getDIPPClarificationRequest.PageNumber,
                    PageSize            = Convert.ToInt32(getDIPPClarificationRequest.PageSize),
                    IsPagingRequired    = (getDIPPClarificationRequest.PageNumber != null) ? true : false,
                    OrderBy             = getDIPPClarificationRequest.OrderBy,
                    OrderByDirection    = getDIPPClarificationRequest.OrderByDirection
                };
                var dIPPClarifications = iDIPPClarification.GetDIPPClarification(dIPPClarification);

                var dIPPClarificationList = new List <GetDIPPClarificationResponse>();
                foreach (var dIPPClarificationDetail in dIPPClarifications)
                {
                    dIPPClarificationList.Add(new GetDIPPClarificationResponse()
                    {
                        DIPPClarificationId = Convert.ToInt32(dIPPClarificationDetail.DIPPClarificationId),
                        ClarificationTopic  = dIPPClarificationDetail.ClarificationTopic,
                        PDF            = dIPPClarificationDetail.PDF,
                        IsActive       = Convert.ToBoolean(dIPPClarificationDetail.IsActive),
                        CreatedBy      = dIPPClarificationDetail.CreatedBy,
                        TotalPageCount = dIPPClarificationDetail.TotalPageCount,
                        TotalRecord    = dIPPClarificationDetail.TotalRecord
                    });
                }

                responses.Status      = Utility.SUCCESS_STATUS_RESPONSE;
                responses.Description = "DIPPClarification retrieved successfully";
                responses.Response    = dIPPClarificationList;
            }
            catch (Exception ex)
            {
                responses.Status      = Utility.ERROR_STATUS_RESPONSE;
                responses.Description = "Error while retrieving dIPPClarification.";

                Utility.WriteLog("GetDIPPClarification", getDIPPClarificationRequest, "Error while retrieving dIPPClarification. (DIPPClarificationUserController)", ex.ToString());
            }
            return(Ok(responses));
        }