public ActionResult Index(BONoticeSearchCriteria criteria, string download) { ShipperReturnByIdentity currentIdentity = new ShipperReturnByIdentity(); currentIdentity = GetValueFromIdentity(); int companyId = String.IsNullOrEmpty(currentIdentity.CompanyId) ? 0 : int.Parse(currentIdentity.CompanyId); string pipelineDuns = criteria.PipelineDuns; ViewBag.pipelineDuns = pipelineDuns; if (download != null) { var request = new RestRequest(string.Format("GetSwntTotalRecords"), Method.POST) { RequestFormat = DataFormat.Json }; request.JsonSerializer = NewtonsoftJsonSerializer.Default; request.AddJsonBody(criteria); var response = client.Execute <int>(request); int totalRecords = response.Data; criteria.PageSize = totalRecords; criteria.PageNo = 1; criteria.NoticeList = GetNoticesBySearch(criteria); DownloadCSV(criteria); } return(this.View(criteria)); }
public List <SwntPerTransactionDTO> GetNoticesBySearch(BONoticeSearchCriteria criteria) { List <SwntPerTransactionDTO> finalResult = new List <SwntPerTransactionDTO>(); // If All Search Date-Fields are Empty or Null // _client.BaseUrl = new Uri("http://localhost:56676"); var request = new RestRequest(string.Format("GetSwntByCriteria"), Method.POST) { RequestFormat = DataFormat.Json }; request.JsonSerializer = NewtonsoftJsonSerializer.Default; request.AddJsonBody(criteria); var response = client.Execute <SwntResultDTO>(request); if (response.Data != null) { finalResult = response.Data.swntPerTransactionDTO; criteria.RecordCount = response.Data.RecordCount; } else { finalResult = new List <SwntPerTransactionDTO>(); criteria.RecordCount = 0; } return(finalResult); }
public bool DownloadCSV(BONoticeSearchCriteria criteria) { var csvExport = new CsvExport(); try { var noticeList = criteria.NoticeList; // noticeList = ReduceDuplicates(noticeList); foreach (var Item in noticeList) { csvExport.AddRow(); csvExport["Subject"] = Item.Subject; csvExport["Posted Date"] = Item.PostingDateTime; } Response.Clear(); MemoryStream Ms = new MemoryStream(csvExport.ExportToBytes()); Response.ContentType = "application/CSV"; Response.AddHeader("content-disposition", "attachment;filename=" + "NoticesDataTable.csv"); Response.Buffer = true; Response.Cache.SetCacheability(HttpCacheability.NoCache); Ms.WriteTo(Response.OutputStream); Response.End(); return(true); } catch (Exception ex) { return(false); } }
public JsonResult <List <SwntPerTransactionDTO> > Get([FromUri] BONoticeSearchCriteria criteria) { List <SwntPerTransactionDTO> noticelist = new List <SwntPerTransactionDTO>(); noticelist = _INoticeService.GetNoticesBySearch(criteria); return(Json(noticelist)); }
public async Task <ActionResult> GetData(string pipelineDuns, SwntDateFilter filters) { JsonResult result = new JsonResult(); try { // Initialization. string search = Request.Form.GetValues("search[value]")[0]; string draw = Request.Form.GetValues("draw")[0]; string order = Request.Form.GetValues("order[0][column]")[0]; string orderDir = Request.Form.GetValues("order[0][dir]")[0]; int startRec = Convert.ToInt32(Request.Form.GetValues("start")[0]); int pageSize = Convert.ToInt32(Request.Form.GetValues("length")[0]); //Loading. BONoticeSearchCriteria criteria = new BONoticeSearchCriteria(); criteria.PageNo = (startRec / pageSize) + 1; criteria.PageSize = pageSize; criteria.SortField = GetColumnNameToSort(order); criteria.SortDirection = orderDir; criteria.PipelineDuns = pipelineDuns; criteria.postStartDate = filters.PostStartDate; criteria.postEndDate = filters.PostEndDate; criteria.EffectiveStartDate = filters.EffectiveStartDate; criteria.EffectiveEndDate = filters.EffectiveEndDate; criteria.Keyword = filters.Keyword; criteria.IsCritical = filters.IsCritical == "true" ? true : false; criteria.WatchListId = filters.WatchListId; List <SwntPerTransactionDTO> swntPerTransactionlist = new List <SwntPerTransactionDTO>(); swntPerTransactionlist = GetNoticesBySearch(criteria); // swntPerTransactionlist = ReduceDuplicates(swntPerTransactionlist); // Total record count. int totalRecords = criteria.RecordCount; // swntPerTransactionlist.Count; // Verification. // Sorting. // swntPerTransactionlist = this.SortByColumnWithOrder(order, orderDir, swntPerTransactionlist); // Filter record count. int recFilter = criteria.RecordCount; // swntPerTransactionlist.Count; // Apply pagination. // swntPerTransactionlist = swntPerTransactionlist.Skip(startRec).Take(pageSize).ToList(); // Loading drop down lists. result = this.Json(new { draw = Convert.ToInt32(draw), recordsTotal = totalRecords, recordsFiltered = recFilter, data = swntPerTransactionlist }, JsonRequestBehavior.AllowGet); } catch (Exception ex) { } return(result); }
public List <SwntPerTransaction> GetRecentNotice(BONoticeSearchCriteria criteria) { List <SwntPerTransaction> swntList = new List <SwntPerTransaction>(); var count = noticesRepository.GetTotalCount(criteria.pipelineId, criteria.IsCritical); if (count > 0) { var RecentDay = noticesRepository.GetRecentNoticePostDate(criteria.pipelineId, criteria.IsCritical); swntList = noticesRepository.GetNoticeUsingPostDate(criteria.pipelineId, criteria.IsCritical, RecentDay); } return(swntList); }
public List <SwntPerTransactionDTO> GetNoticesBySearch(BONoticeSearchCriteria criteria) { List <SwntPerTransaction> finalResult = new List <SwntPerTransaction>(); // If All Search Date-Fields are Empty or Null if (((criteria.EffectiveStartDate == DateTime.MinValue) && (criteria.EffectiveEndDate == DateTime.MinValue)) && ((criteria.postStartDate == DateTime.MinValue) && (criteria.postEndDate == DateTime.MinValue)) && (string.IsNullOrEmpty(criteria.Keyword))) { var startDate = DateTime.Now.AddDays(-30); var endDate = DateTime.Now.AddHours(24); // Dates are same as on dashboard for Notices. finalResult = noticesRepository.GetByCreatedDateRange(criteria.PipelineDuns, criteria.IsCritical, startDate, endDate).OrderByDescending(a => a.PostingDateTime).ToList(); } else if (((criteria.EffectiveStartDate == DateTime.MinValue) && (criteria.EffectiveEndDate == DateTime.MinValue)) && ((criteria.postStartDate == DateTime.MinValue) && (criteria.postEndDate == DateTime.MinValue)) && (!string.IsNullOrEmpty(criteria.Keyword))) { // NOTE:- Search only based on Description, not any date. finalResult = noticesRepository.GetByKeyword(criteria.PipelineDuns, criteria.IsCritical, criteria.Keyword); } else { // No Date-Field is empty if (((criteria.EffectiveStartDate != DateTime.MinValue) && (criteria.EffectiveEndDate != DateTime.MinValue)) && ((criteria.postStartDate != DateTime.MinValue) && (criteria.postEndDate != DateTime.MinValue))) { // result is Notice List of (Post date between Poststart-PostEnd) OR (NoticeEffectiveDate starts from EffectiveStartdate AND NoticeEndDate ends till EffectiveEndDate) finalResult = noticesRepository.GetByPostEffDatesRange(criteria.PipelineDuns, criteria.IsCritical, criteria.postStartDate, criteria.postEndDate, criteria.EffectiveStartDate, criteria.EffectiveEndDate, criteria.Keyword); } else { // Only Post-Date fields in Search are empty if ((criteria.EffectiveStartDate != DateTime.MinValue) && (criteria.EffectiveEndDate != DateTime.MinValue)) { // result is list of Notices of (NoticeEffectiveDate > EffectiveStartdate) AND (NoticeEndDate < EffectiveEndDate) finalResult = noticesRepository.GetNoticesByEffDateRange(criteria.PipelineDuns, criteria.IsCritical, criteria.EffectiveStartDate, criteria.EffectiveEndDate, criteria.Keyword); } else { // Only Effective-Date fields in search are empty finalResult = noticesRepository.GetNoticesUsingRangeofPostDate(criteria.PipelineDuns, criteria.IsCritical, criteria.postStartDate, criteria.postEndDate, criteria.Keyword); } } } return(finalResult.Select(a => modelfactory.Parse(a)).OrderByDescending(a => a.PostingDateTime.GetValueOrDefault()).ToList()); }
public ActionResult Index(string pipelineDuns, BONoticeSearchCriteria criteria) { // criteria.IsCritical = true; DateTime minDate = DateTime.MinValue; ShipperReturnByIdentity currentIdentity = new ShipperReturnByIdentity(); currentIdentity = GetValueFromIdentity(); int companyId = String.IsNullOrEmpty(currentIdentity.CompanyId) ? 0 : int.Parse(currentIdentity.CompanyId); criteria.RecipientCompanyID = companyId; ViewBag.pipelineDuns = pipelineDuns; // criteria.pipelineId = pipelineId; criteria.PipelineDuns = pipelineDuns; criteria.postStartDate = null; criteria.postEndDate = null; criteria.EffectiveStartDate = null; criteria.EffectiveEndDate = null; //criteria.pipelineId = pipelineId; return(this.View(criteria)); }
public int SearchCount(int PipelineID, BONoticeSearchCriteria searchCriteria) { throw new NotImplementedException(); }
public List <BONotice> Search(int PipelineID, BONoticeSearchCriteria searchCriteria) { throw new NotImplementedException(); }
public List <BONotice> SearchNotices(int pipelineId, BONoticeSearchCriteria criteria) { throw new NotImplementedException(); }