public JsonResult LoadAllBookings() { var draw = HttpContext.Request.Form["draw"].FirstOrDefault(); var start = Request.Form["start"].FirstOrDefault(); var length = Request.Form["length"].FirstOrDefault(); var sortColumn = Request.Form["columns[" + Request.Form["order[0][column]"].FirstOrDefault() + "][name]"].FirstOrDefault(); var sortColumnDir = Request.Form["order[0][dir]"].FirstOrDefault(); var searchValue = Request.Form["search[value]"].FirstOrDefault(); int pageSize = length != null?Convert.ToInt32(length) : 0; int skip = start != null?Convert.ToInt32(start) : 0; int recordsTotal = 0; if (!string.IsNullOrEmpty(Convert.ToString(HttpContext.Session.GetString("UserID")))) { var result = _IBookingVenue.ShowBookingDetail(); if (result.Count() > 0) { var v = _IBookingVenue.ShowAllBooking(sortColumn, sortColumnDir, searchValue); recordsTotal = v.Count(); var data = v.Skip(skip).Take(pageSize).ToList(); return(Json(new { draw = draw, recordsFiltered = recordsTotal, recordsTotal = recordsTotal, data = data })); } else { return(Json("Failed")); } } else { return(Json("Failed")); } }
public JsonResult ShowBookingDetails() { if (!string.IsNullOrEmpty(Convert.ToString(HttpContext.Session.GetString("UserID")))) { var result = _IBookingVenue.ShowBookingDetail(Convert.ToInt32(HttpContext.Session.GetString("UserID"))); if (result.Count() > 0) { List <BookingDetailTemp> resultnew = new List <BookingDetailTemp>(); foreach (var item in result) { BookingDetailTemp BT = new BookingDetailTemp(); DateTime?BDT = item.BookingDate; string BookingDate = BDT.Value.ToString("dd/MM/yyyy"); DateTime?BDTA = item.BookingApprovalDate; string BookingApprovalDate; if (item.BookingApprovalDate == null) { BookingApprovalDate = "----------"; } else { BookingApprovalDate = BDTA.Value.ToString("dd/MM/yyyy"); } BT.BookingNo = item.BookingNo; BT.BookingID = item.BookingID; BT.BookingDate = BookingDate; string BookingApproval; if (item.BookingApproval == "P") { BookingApproval = "Pending"; } else if (item.BookingApproval == "C") { BookingApproval = "Cancelled"; } else { BookingApproval = "Approved"; } BT.BookingApproval = BookingApproval; BT.BookingApprovalDate = BookingApprovalDate; resultnew.Add(BT); } return(Json(resultnew)); } else { return(Json("Failed")); } } else { return(Json("Failed")); } }