public ActionResult Update(string id) { var obj = _tblCardGroupService.GetById(Guid.Parse(id)); objId = obj.CardGroupID.ToString(); return(View(obj)); }
public ActionResult Update(string id, int page = 1) { ViewBag.CardTypes = GetCardType(); ViewBag.VehicleGroups = GetVehicleGroup(); ViewBag.Formulation = GetFormulation(); //ViewBag.PN = pageNumber; //ViewBag.Group = groupId; var obj = _tblCardGroupService.GetById(Guid.Parse(id)); TempData["obj"] = obj; objId = obj.CardGroupID.ToString(); return(View(obj)); }
public ActionResult ReportEvent(string KeyWord = "", string status = "", string controllerid = "", string cardgroup = "", string fromdate = "", string todate = "", int page = 1, string chkExport = "0", string datefrompicker = "") { var totalItem = 0; var pageSize = 20; var user = GetCurrentUser.GetUser(); string CustomerID = ""; if (!string.IsNullOrWhiteSpace(fromdate) && !string.IsNullOrWhiteSpace(todate)) { datefrompicker = fromdate + "-" + todate; } #region Excel //Excel if (chkExport.Equals("1")) { ////Query lấy dữ liệu var listExcel = _ReportService.GetReportEventExcel(KeyWord, status, controllerid, fromdate, todate, cardgroup); if (listExcel != null && listExcel.Rows.Count > 0) { foreach (DataRow dr in listExcel.Rows) { var customer = new tblCustomer(); var cg = new tblCardGroup(); if (!string.IsNullOrEmpty(dr["CardNumber"].ToString())) { var card = _tblCardService.GetByCardNumber(dr["CardNumber"].ToString()); if (card != null) { if (!string.IsNullOrEmpty(card.CustomerID)) { customer = _tblCustomerService.GetById(Guid.Parse(card.CustomerID)); } } } if (!string.IsNullOrEmpty(dr["CardGroupID"].ToString())) { cg = _tblCardGroupService.GetById(Guid.Parse(dr["CardGroupID"].ToString())); } if (!string.IsNullOrEmpty(dr["ControllerID"].ToString())) { var controller = _tblAccessControllerService.GetById(Guid.Parse(dr["ControllerID"].ToString())); var door = _tblAccessDoorService.GetByController_Readerindex(dr["ControllerID"].ToString(), dr["ReaderIndex"].ToString()); dr["ControllerName"] = controller != null ? controller.ControllerName : ""; dr["DoorName"] = door != null ? door.DoorName : ""; } dr["CustomerName"] = customer != null ? customer.CustomerName : ""; dr["CardGroupName"] = cg != null ? cg.CardGroupName : ""; dr["Address"] = customer != null ? customer.Address : ""; } } listExcel.Columns.Remove("RowNumber"); listExcel.Columns.Remove("ControllerID"); listExcel.Columns.Remove("ReaderIndex"); listExcel.Columns.Remove("CardGroupID"); //Xuất file theo format ReportEventFormatCell(listExcel, "Sự_kiện_quẹt_thẻ", "Sheet1", "", "Sự kiện quẹt thẻ", datefrompicker); return(RedirectToAction("ReportEvent")); } #endregion #region Giao diện var list = _ReportService.GetReportEvent(KeyWord, status, controllerid, fromdate, todate, page, pageSize, ref totalItem, cardgroup); var gridModel = PageModelCustom <ReportEvent_Access> .GetPage(list, page, pageSize, totalItem); ViewBag.CardGroups = GetCardGroupListMonth().ToList(); ViewBag.CardGroupDT = GetCardGroupListMonth().ToDataTableNullable(); ViewBag.CardGroupId = cardgroup; ViewBag.Controllers = GetControllerList().ToList(); ViewBag.ControllerDT = GetControllerList().ToDataTableNullable(); ViewBag.ControllerID = controllerid; ViewBag.Status = status; ViewBag.StatusDDL = FunctionHelper.StatusEventAccess(); ViewBag.Doors = GetDoor(); ViewBag.DateFromPickerValue = datefrompicker; ViewBag.KeyWord = KeyWord; ViewBag.fromdateValue = fromdate; ViewBag.todateValue = !string.IsNullOrWhiteSpace(todate) ? Convert.ToDateTime(todate).ToString("dd/MM/yyyy HH:mm:59") : DateTime.Now.ToString("dd/MM/yyyy 23:59:59"); return(View(gridModel)); #endregion }
public ActionResult HistoryDeleteEvent(string customergroup = "", string number = "0", string key = "", string user = "", string cardgroup = "", string lane = "", string chkExport = "0", string excelcol = "", bool IsFilterByTimeIn = false, string fromdate = "", string todate = "", int page = 1, int pageSize = 20) { var strCG = new List <string>(); GetListChild(strCG, customergroup); var host = Request.Url.Host; var totalItem = 0; decimal totalMoney = 0; var datefrompicker = ""; if (string.IsNullOrEmpty(fromdate)) { fromdate = DateTime.Now.ToString("dd/MM/yyyy 00:00:00"); } if (string.IsNullOrEmpty(todate)) { todate = DateTime.Now.ToString("dd/MM/yyyy 23:59:59"); } if (!string.IsNullOrWhiteSpace(fromdate) && !string.IsNullOrWhiteSpace(todate)) { datefrompicker = fromdate + "-" + todate; } #region Excel //Excel if (chkExport.Equals("1")) { //Query lấy dữ liệu var listExcel = _tblCardEventDeleteService.GetHistoryDeleteEvent_Excel(key, strCG, IsFilterByTimeIn, fromdate, todate, cardgroup, lane, user, customergroup, ref totalItem); foreach (DataRow item in listExcel.Rows) { if (!string.IsNullOrEmpty(item["Làn vào"].ToString())) { var _laneIn = _tblLaneService.GetById(Guid.Parse(item["Làn vào"].ToString())); if (_laneIn != null) { item["Làn vào"] = _laneIn.LaneName; } else { item["Làn vào"] = ""; } } if (!string.IsNullOrEmpty(item["Làn ra"].ToString())) { var _laneOut = _tblLaneService.GetById(Guid.Parse(item["Làn ra"].ToString())); if (_laneOut != null) { item["Làn ra"] = _laneOut.LaneName; } else { item["Làn ra"] = ""; } } if (!item["Nhóm thẻ"].ToString().Equals("LOOP_D") && !item["Nhóm thẻ"].ToString().Equals("LOOP_M")) { if (!string.IsNullOrEmpty(item["Nhóm thẻ"].ToString())) { var _cardgroup = _tblCardGroupService.GetById(Guid.Parse(item["Nhóm thẻ"].ToString())); if (_cardgroup != null) { item["Nhóm thẻ"] = _cardgroup.CardGroupName; } else { item["Nhóm thẻ"] = ""; } } } else { if (item["Nhóm thẻ"].ToString().Equals("LOOP_D")) { item["Nhóm thẻ"] = "Vòng từ - Xe lượt(Loop)"; } else { item["Nhóm thẻ"] = "Vòng từ - Xe tháng(Loop)"; } } var _userIn = _UserService.GetById(item["Giám sát vào"].ToString()); if (_userIn != null) { item["Giám sát vào"] = _userIn.Username; } else { item["Giám sát vào"] = ""; } var _userOut = _UserService.GetById(item["Giám sát ra"].ToString()); if (_userOut != null) { item["Giám sát ra"] = _userOut.Username; } else { item["Giám sát ra"] = ""; } var _user = _UserService.GetById(item["Người xóa"].ToString()); if (_user != null) { item["Người xóa"] = _user.Username; } else { item["Người xóa"] = ""; } } //Xuất file theo format HistoryDeleteEventFormatCell(listExcel, excelcol, "Lịch_sử_xóa_sự_kiện", "Sheet1", "", "Lịch sử xóa sự kiện", datefrompicker); return(RedirectToAction("HistoryDeleteEvent")); } #endregion #region Giao diện var list = _tblCardEventDeleteService.GetHistoryDeleteEvent(key, strCG, IsFilterByTimeIn, fromdate, todate, cardgroup, lane, user, customergroup, page, pageSize, ref totalItem).ToList(); var listid = new List <string>(); if (list.Any()) { var str = ""; foreach (var item in list) { str += item.LaneIDIn + "," + item.LaneIDOut + ","; listid.Add(item.Id); } ViewBag.LaneList = _tblLaneService.GetAllActiveByListId(str).ToList(); } var gridModel = PageModelCustom <ReportInOut108> .GetPage(list, page, pageSize, totalItem); ViewBag.CardGroups = GetCardGroupListNew().ToList(); ViewBag.CardGroupDT = GetCardGroupListNew().ToDataTableNullable(); ViewBag.CardGroupId = cardgroup; ViewBag.Lanes = GetLaneList().ToList(); ViewBag.LaneDT = GetLaneList().ToDataTableNullable(); ViewBag.LaneId = lane; ViewBag.Users = GetUserList().ToList(); ViewBag.UserDT = GetUserList().ToDataTableNullable(); ViewBag.UserId = user; ViewBag.CustomerGroups = GetMenuList(); ViewBag.CustomerGroupId = customergroup; ViewBag.KeyWord = key; ViewBag.Number = number; ViewBag.fromdateValue = fromdate; ViewBag.todateValue = string.IsNullOrWhiteSpace(todate) ? DateTime.Now.ToString("dd/MM/yyyy 23:59") : todate; ViewBag.isFilterByTimeIn = IsFilterByTimeIn; //Session[string.Format("{0}_{1}", SessionConfig.EventIdDelete108ParkingSession, host)] = new List<string>(); //ViewBag.selectedEventValue = GetSetFromSession(listid); ViewBag.TotalMoney = _tblCardEventDeleteService.GetTotalMoney(key, strCG, IsFilterByTimeIn, fromdate, todate, cardgroup, lane, user, customergroup); return(View(gridModel)); #endregion }