public IHttpActionResult UpdatePressNoteNotification(UpdatePressNoteNotificationRequest updatePressNoteNotificationRequest) { var responses = new Responses(); try { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (Utility.UserId < 0) { return(BadRequest(Utility.INVALID_USER)); } var pressNoteNotification = new PressNoteNotification() { PressNoteNotificationId = updatePressNoteNotificationRequest.PressNoteNotificationId, PressNoteId = updatePressNoteNotificationRequest.PressNoteId, NotificationId = updatePressNoteNotificationRequest.NotificationId, ModifiedBy = Utility.UserId }; int result = iPressNoteNotification.UpdatePressNoteNotification(pressNoteNotification); switch (result) { case 1: responses.Status = Utility.SUCCESS_STATUS_RESPONSE; responses.Description = "Press Note Notification updated successfully."; break; case -2: responses.Status = Utility.ERROR_STATUS_RESPONSE; responses.Description = "Press Note Notification already exists."; break; case -3: responses.Status = Utility.ERROR_STATUS_RESPONSE; responses.Description = "Press Note Notification doesn't exist."; break; default: responses.Status = Utility.ERROR_STATUS_RESPONSE; responses.Description = "Error while updating Press Note Notification."; break; } } catch (Exception ex) { responses.Status = Utility.ERROR_STATUS_RESPONSE; responses.Description = "Error while updating Press Note Notification."; Utility.WriteLog("UpdatePressNoteNotification", updatePressNoteNotificationRequest, "Error while updating Press Note Notification. (PressNoteNotificationAdminController)", ex.ToString()); } return(Ok(responses)); }
public int DeletePressNoteNotification(PressNoteNotification pressNoteNotification) { using (DemsifyEntities dataContext = new DemsifyEntities()) { ObjectParameter result = new ObjectParameter("Result", typeof(int)); dataContext.PressNoteNotificationDelete(pressNoteNotification.PressNoteNotificationId, pressNoteNotification.ModifiedBy, result); return(Convert.ToInt32(result.Value)); } }
public IHttpActionResult AddPressNoteNotification(AddPressNoteNotificationRequest addPressNoteNotificationRequest) { var responses = new Responses(); try { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var pressNoteNotification = new PressNoteNotification() { PressNoteId = addPressNoteNotificationRequest.PressNoteId, NotificationId = addPressNoteNotificationRequest.NotificationId, CreatedBy = Utility.UserId }; int result = iPressNoteNotification.AddPressNoteNotification(pressNoteNotification); if (result > 0) { responses.Status = Utility.SUCCESS_STATUS_RESPONSE; responses.Description = "Press Note Notification added successfully."; } else if (result == -2) { responses.Status = Utility.ERROR_STATUS_RESPONSE; responses.Description = "Press Note Notification alread exists."; } else { responses.Status = Utility.ERROR_STATUS_RESPONSE; responses.Description = "Error while adding Press Note Notification."; } } catch (Exception ex) { responses.Status = Utility.ERROR_STATUS_RESPONSE; responses.Description = "Error while adding Press Note Notification."; Utility.WriteLog("AddPressNoteNotification", addPressNoteNotificationRequest, "Error while adding Press Note Notification. (PressNoteNotificationAdminController)", ex.ToString()); } return(Ok(responses)); }
public IEnumerable <PressNoteNotification> GetPressNoteNotification(PressNoteNotification pressNoteNotification) { using (DemsifyEntities dataContext = new DemsifyEntities()) { ObjectParameter totalPageCount = new ObjectParameter("TotalPageCount", typeof(int)); ObjectParameter totalRecord = new ObjectParameter("TotalRecord", typeof(int)); var pressNoteNotifications = dataContext.PressNoteNotificationGet(pressNoteNotification.PressNoteNotificationId, pressNoteNotification.PressNoteId, Utility.TrimString(pressNoteNotification.SearchText), pressNoteNotification.IsActive, pressNoteNotification.PageNumber, pressNoteNotification.PageSize, pressNoteNotification.IsPagingRequired, Utility.TrimString(pressNoteNotification.OrderBy), Utility.TrimString(pressNoteNotification.OrderByDirection), totalPageCount, totalRecord).ToList(); var pressNoteNotificationList = new List <PressNoteNotification>(); foreach (var pressNoteNotificationDetail in pressNoteNotifications) { pressNoteNotificationList.Add(new PressNoteNotification() { PressNoteNotificationId = pressNoteNotificationDetail.PressNoteNotificationId, PressNoteId = pressNoteNotificationDetail.PressNoteId, NotificationId = pressNoteNotificationDetail.Notificationid, RegulationId = pressNoteNotificationDetail.Regulationid, NotificationNumber = pressNoteNotificationDetail.Notificationnumber, RegulationNumber = pressNoteNotificationDetail.Regulationnumber, NotificationName = pressNoteNotificationDetail.NotificationName, NotificationTypeName = pressNoteNotificationDetail.NotificationTypeName, NotificationDate = pressNoteNotificationDetail.NotificationDate, NotificationEffectiveDate = pressNoteNotificationDetail.NotificationEffectiveDate, NotificationTypeId = pressNoteNotificationDetail.NotificationTypeId, GSRNo = pressNoteNotificationDetail.GSRNo, GSRDate = pressNoteNotificationDetail.GSRDate, NotificationPDF = pressNoteNotificationDetail.NotificationPDF, GSRPDF = pressNoteNotificationDetail.GSRPDF, TotalPageCount = Convert.ToInt32(totalPageCount.Value), TotalRecord = Convert.ToInt32(totalRecord.Value) }); } return(pressNoteNotificationList); } }
public IHttpActionResult GetPressNoteNotification([FromUri] GetPressNoteNotificationRequest getPressNoteNotificationRequest) { var responses = new Responses(); try { if (Utility.UserId < 0) { return(BadRequest(Utility.INVALID_USER)); } if (getPressNoteNotificationRequest == null) { getPressNoteNotificationRequest = new GetPressNoteNotificationRequest(); } if (getPressNoteNotificationRequest.PageSize == null) { getPressNoteNotificationRequest.PageSize = Convert.ToInt32(ConfigurationManager.AppSettings["PageSize"]); } var pressNoteNotification = new PressNoteNotification() { PressNoteNotificationId = getPressNoteNotificationRequest.PressNoteNotificationId, PressNoteId = getPressNoteNotificationRequest.PressNoteId, SearchText = getPressNoteNotificationRequest.SearchText, IsActive = getPressNoteNotificationRequest.IsActive, PageNumber = getPressNoteNotificationRequest.PageNumber, PageSize = Convert.ToInt32(getPressNoteNotificationRequest.PageSize), IsPagingRequired = (getPressNoteNotificationRequest.PageNumber != null) ? true : false, OrderBy = getPressNoteNotificationRequest.OrderBy, OrderByDirection = getPressNoteNotificationRequest.OrderByDirection }; var pressNoteNotifications = iPressNoteNotification.GetPressNoteNotification(pressNoteNotification); var pressNoteNotificationList = new List <GetPressNoteNotificationResponse>(); foreach (var pressNoteNotificationDetail in pressNoteNotifications) { pressNoteNotificationList.Add(new GetPressNoteNotificationResponse() { PressNoteNotificationId = Convert.ToInt32(pressNoteNotificationDetail.PressNoteNotificationId), PressNoteId = pressNoteNotificationDetail.PressNoteId, NotificationId = pressNoteNotificationDetail.NotificationId, RegulationId = pressNoteNotificationDetail.RegulationId, NotificationNumber = pressNoteNotificationDetail.NotificationNumber, RegulationNumber = pressNoteNotificationDetail.RegulationNumber, NotificationName = pressNoteNotificationDetail.NotificationName, NotificationTypeName = pressNoteNotificationDetail.NotificationTypeName, NotificationDate = pressNoteNotificationDetail.NotificationDate, NotificationEffectiveDate = pressNoteNotificationDetail.NotificationEffectiveDate, NotificationTypeId = pressNoteNotificationDetail.NotificationTypeId, GSRNo = pressNoteNotificationDetail.GSRNo, GSRDate = pressNoteNotificationDetail.GSRDate, NotificationPDF = pressNoteNotificationDetail.NotificationPDF, GSRPDF = pressNoteNotificationDetail.GSRPDF, IsActive = Convert.ToBoolean(pressNoteNotificationDetail.IsActive), CreatedBy = pressNoteNotificationDetail.CreatedBy, TotalPageCount = pressNoteNotificationDetail.TotalPageCount, TotalRecord = pressNoteNotificationDetail.TotalRecord }); } responses.Status = Utility.SUCCESS_STATUS_RESPONSE; responses.Description = "Press Note Notification retrieved successfully"; responses.Response = pressNoteNotificationList; } catch (Exception ex) { responses.Status = Utility.ERROR_STATUS_RESPONSE; responses.Description = "Error while retrieving Press Note Notification."; Utility.WriteLog("GetPressNoteNotification", getPressNoteNotificationRequest, "Error while retrieving Press Note Notification. (PressNoteNotificationAdminController)", ex.ToString()); } return(Ok(responses)); }