public string GetByPageSortJSON(int pageNumber, int pageSize, string sortDirection, string sortColumn) { var list = new DailyRecordRepository().AsQueryable(); if (sortDirection.ToLower() == "asc") return new JavaScriptSerializer().Serialize(list.OrderBy(sortColumn).Skip((pageNumber - 1) * pageSize).Take(pageSize).ToList()); else return new JavaScriptSerializer().Serialize(list.OrderByDescending(sortColumn).Skip((pageNumber - 1) * pageSize).Take(pageSize).ToList()); }
public List<DailyRecord> GetByPageSort(int pageNumber, int pageSize, string sortDirection, string sortColumn) { var list = new DailyRecordRepository().AsQueryable(); if (sortDirection.ToLower() == "asc") return list.OrderBy(sortColumn).Skip((pageNumber - 1) * pageSize).Take(pageSize).ToList(); else return list.OrderByDescending(sortColumn).Skip((pageNumber - 1) * pageSize).Take(pageSize).ToList(); }
public LogicSystem() { _daySummaryRepository = new RepositoryFactory().GetDaySummaryRepository(); _employeeRepository = new RepositoryFactory().GetEmployeeRepository(); _personRepository = new RepositoryFactory().GetPersonRepository(); _workTypeRepository = new RepositoryFactory().GetWorkTypeRepository(); _dailyRecordRepository = new RepositoryFactory().GetDailyRecordRepository(); _permissionRepository = new RepositoryFactory().GetPermissionRepository(); }
public List<DailyRecord> GetByPageSortSearch(int pageNumber, int pageSize, string sortDirection, string sortColumn, string search) { var list = new DailyRecordRepository().AsQueryable(); var filteredList = list.Where(p => p.TruckID.Contains(search) || p.SerialNumber.Contains(search) || p.SBC_VIN.Contains(search) || p.State.Contains(search) || p.City.Contains(search) ); if (sortDirection.ToLower() == "asc") return filteredList.OrderBy(sortColumn).Skip((pageNumber - 1) * pageSize).Take(pageSize).ToList(); else return filteredList.OrderByDescending(sortColumn).Skip((pageNumber - 1) * pageSize).Take(pageSize).ToList(); }
public string GetDataTable() { string role = Session["UserRole"] + ""; role = role.ToLower(); string[] coloumns = { "", "HistoricArc", "SBC_VIN", "UUID", "TruckID", "InstallType", "SerialNumber", "PhoneNumber", "City", "State", "InstallationDate" }; int echo = Int32.Parse(Request.Params["sEcho"]); int displayLength = Int32.Parse(Request.Params["iDisplayLength"]); int colIndex = Int32.Parse(Request.Params["iSortCol_0"]); int displayStart = Int32.Parse(Request.Params["iDisplayStart"]); string search = (Request.Params["sSearch"] + "").Trim(); DailyRecordRepository dal = new DailyRecordRepository(); var records = dal.AsQueryable(); int totalRecords = records.Count(); int totalDisplayRecords = totalRecords; var filteredList = records; if (search != "") filteredList = records.Where(p => p.TruckID.Contains(search) || p.SerialNumber.Contains(search) || p.PhoneNumber.Contains(search) || p.SBC_VIN.Contains(search) || p.State.Contains(search) || p.City.Contains(search) ); var orderedList = filteredList.OrderByDescending(p => p.ID); if (colIndex < coloumns.Length && coloumns[colIndex] + "" != "") { string sortDir = Request.Params["sSortDir_0"]; string sortExpression = coloumns[colIndex] + sortDir; orderedList = sortDir == "asc" ? filteredList.OrderBy(coloumns[colIndex]) : filteredList.OrderByDescending(coloumns[colIndex]); } StringBuilder sb = new StringBuilder(); sb.Clear(); JQueryResponse rs = new JQueryResponse(); var pagedList = orderedList.Skip(displayStart).Take(displayLength).ToList(); var numbers = pagedList.Where(p => p.PhoneNumber + "" != "").Select(p => p.PhoneNumber).ToList(); var messageRepo = new MessageRepository(); foreach (var item in pagedList) { List<string> data = new List<string>(); string status = ""; if (item.DeInstallRequired) status = "<div class='de-install-required' title='De-Install Required'></div>"; if (item.InstallComplete) status += "<div class='install-completed' title='Completed'></div>"; data.Add(status); //data.Add(item.HistoricArc); data.Add(item.SBC_VIN); //data.Add(item.UUID); //data.Add(item.TruckID); data.Add(item.InstallType); data.Add(item.SerialNumber); data.Add(WrapToolTip(item.PhoneNumber)); var msg = ""; item.PhoneNumber = (item.PhoneNumber + "").Trim().Trim('-'); if (item.PhoneNumber != "") { var message = messageRepo.GetMessage(item.PhoneNumber); if (message != null) msg = WrapToolTip(message.Body); } data.Add(msg); data.Add(item.City); data.Add(item.State); data.Add(item.InstallDate.ToString("MM/dd/yyyy")); string editIcon = "<img src='images/edit.png' class='icon' alt='' onclick=\"Edit(" + item.ID + ")\" title='Edit Record' />"; string deleteIcon = "<img id='delete' src='images/delete.png' class='icon' alt='' onclick=\"Delete(" + item.ID + ")\" title='Delete Record' />"; string icons = "<img src='images/log.png' class='icon' alt='' onclick=\"SmsLog('" + item.PhoneNumber + "')\" title='SMS Log' />"; ; if (CanEdit) icons += editIcon; if (CanDelete) icons += deleteIcon; data.Add(icons); rs.aaData.Add(data); } rs.sEcho = echo; rs.iTotalRecords = totalRecords; rs.iTotalDisplayRecords = totalDisplayRecords; return new JavaScriptSerializer().Serialize(rs); }
public LogicTerminal() { _dailyRecordRepository = new RepositoryFactory().GetDailyRecordRepository(); _personRepository = new RepositoryFactory().GetPersonRepository(); _employeeRepository = new RepositoryFactory().GetEmployeeRepository(); }