public IHttpActionResult FilterNotices(string PipelineDuns, bool isCritical, DateTime startDate, DateTime endDate) { UprdSwntRepository uprdSwntRepository = new UprdSwntRepository(); var result = uprdSwntRepository.GetByCreatedDateRange(PipelineDuns, isCritical, startDate, endDate); List <BONotice> noticeList = new List <BONotice>(); foreach (var item in result) { BONotice notice = uprdSwntRepository.MappingNotice(item); noticeList.Add(notice); } return(Json(noticeList)); }
public List <BONotice> FilterNotices(string PipelineDuns, bool isCritical, DateTime startDate, DateTime endDate) { var result = noticesRepository.GetByCreatedDateRange(PipelineDuns, isCritical, startDate, endDate).OrderByDescending(a => a.PostingDateTime).ToList(); if (result == null || result.Count == 0) { result = noticesRepository.GetLastFiveNotice(PipelineDuns, isCritical); } List <BONotice> noticeList = new List <BONotice>(); foreach (var item in result) { BONotice notice = MapNoticeDetailDTO(item); noticeList.Add(notice); } return(noticeList); }
public ActionResult Detail(int ID, string pipelineDuns) { var request = new RestRequest(string.Format("GetNoticeOnId/" + ID), Method.GET); var response = client.Execute <BONotice>(request); BONotice obj = new BONotice(); if (response.Data != null) { obj = response.Data; var pipes = GetPipelines(); var pipe = pipes.Where(a => a.DUNSNo == pipelineDuns).FirstOrDefault(); ViewBag.pipelinedetail = pipe.Name; obj.Message = StringToParagraphs(obj.Message, 100); obj.TSP = pipe.Name; //pipe.NameWithoutDuns + "/" + pipe.DUNSNo; } return(this.View(obj)); }
private BONotice MapNoticeDetailDTO(SwntPerTransaction swnt) { BONotice notice = new BONotice(); if (swnt != null) { notice.ID = (int)swnt.Id; notice.Message = swnt.Message; notice.subject = GetSubjectUsingNoticeDetails(swnt.Subject, swnt.Message); notice.IsCritical = swnt.CriticalNoticeIndicator.Trim() == "Y" ? true : false; notice.CreatedDate = swnt.PostingDateTime.GetValueOrDefault(); if ((swnt.NoticeEffectiveDateTime) == null) { notice.NoticeEffectiveDate = String.Empty; } else { notice.NoticeEffectiveDate = swnt.NoticeEffectiveDateTime.GetValueOrDefault().ToString("MM/dd/yyyy"); //notice.NoticeEffectiveDate = Convert.ToDateTime(swnt.NoticeEffectiveDate.Substring(4, 2) + "/" + swnt.NoticeEffectiveDate.Substring(6, 2) + "/" + swnt.NoticeEffectiveDate.Substring(0, 4)).Date.ToString(); } if (swnt.PostingDateTime == null) { notice.PostingDate = String.Empty; } else { notice.PostingDate = swnt.PostingDateTime.GetValueOrDefault().ToString("MM/dd/yyyy"); // notice.NoticeEndDate = Convert.ToDateTime(swnt.PostingDate.Substring(4, 2) + "/" + swnt.PostingDate.Substring(6, 2) + "/" + swnt.PostingDate.Substring(0, 4)).Date.ToString(); } notice.NoticeEndDate = swnt.NoticeEndDateTime.GetValueOrDefault().ToString("MM/dd/yyyy"); //notice.PipelineID = swnt.PipelineId; notice.PipelineDuns = swnt.TransportationserviceProvider; notice.TSP = swnt.TransportationServiceProviderPropCode + " / " + swnt.TransportationserviceProvider; notice.NoticeId = swnt.NoticeId; notice.NoticeStatusDescription = swnt.NoticeStatusDesc; notice.NoticeTypeDesc1 = swnt.NoticeTypeDesc1; notice.NoticeTypeDesc2 = swnt.NoticeTypeDesc2; notice.PriorNotice = swnt.PriorNotice; notice.ReqrdResp = swnt.ReqrdResp; } return(notice); }
private BONotice MergeNotices(BONoticeList list) { BONotice obj = new BONotice(); obj.CreatedDate = list.FirstOrDefault().CreatedDate; obj.StatusID = list.FirstOrDefault().StatusID; obj.PipelineDuns = list.FirstOrDefault().PipelineDuns; obj.RecipientCompanyID = list.FirstOrDefault().RecipientCompanyID; obj.NoticeEffectiveDate = DateTime.ParseExact(list.Where(a => a.NoticeEffectiveDate != "").FirstOrDefault().NoticeEffectiveDate, "yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture).ToString("MM/dd/yyyy"); obj.NoticeEndDate = DateTime.ParseExact(list.Where(a => a.NoticeEndDate != "").FirstOrDefault().NoticeEndDate, "yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture).ToString("MM/dd/yyyy"); obj.Message = list.FirstOrDefault().Message; obj.MessageID = list.FirstOrDefault().MessageID; obj.IsCritical = list.FirstOrDefault().IsCritical; obj.InboxID = list.FirstOrDefault().InboxID; obj.ID = list.FirstOrDefault().ID; obj.RecipientCompanyID = list.FirstOrDefault().RecipientCompanyID; return(obj); }