예제 #1
0
        private IEnumerable <Record> GetRecordsWithoutServiceline(RefreshDataParameters parameters)
        {
            var recordManager = new RecordManager();
            var records       = recordManager.GetData(parameters);

            return(records.Where(i => i.RecordId < records.Max(j => j.RecordId)));
        }
예제 #2
0
        public PartialViewResult RefreshData(RefreshDataParameters parameters)
        {
            // Checks for null and if yes - replaces with the defaults
            parameters.SortingColumn    = parameters.SortingColumn ?? Settings.DefaultSortingColumn;
            parameters.SortingDirection = parameters.SortingDirection ?? Settings.DefaultSortingDirection;

            // Pull the records from database
            var recordManager = new RecordManager();
            var rec           = recordManager.GetData(parameters);

            // Get list of available attachments and mofy a corresponding Record with it
            Dictionary <int, string> attchments = AttachmentManager.GetAttachments();

            foreach (var record in rec)
            {
                record.Attachment = attchments.ContainsKey(record.RecordId) ? attchments[record.RecordId] : String.Empty;
            }

            // Set total amount message and erturn a aprtial view
            ViewBag.Amount = string.Format("Total {0} records.", rec.Count() - 1);

            // Add sorting column and direction to viewbag in orger to indicate the column by displaying appropriate arrow right hand side from its name
            ViewBag.SortingColumn    = parameters.SortingColumn.ToLower().Trim();
            ViewBag.SortingDirection = parameters.SortingDirection;

            return(PartialView("_Data", rec));
        }
예제 #3
0
 public CSV(RefreshDataParameters parameters)
 {
     this.parameters = parameters;
 }
예제 #4
0
 public IEnumerable <Record> GetData(RefreshDataParameters parameters)
 {
     return(DataBase <Record> .GetModel <Record>(Settings.StoredProcedures.RecordsGet, parameters.SqlParameters).Values);
 }
예제 #5
0
        public FileContentResult Csv(RefreshDataParameters parameters)
        {
            var csv = new CSV(parameters);

            return(File(csv.GetBytes(), Settings.CSV.MimeType, Settings.CSV.FileDownloadName));
        }