Exemple #1
0
        public ActionResult Update(string id, int page = 1, string key = "", string pc = "", string group = "")
        {
            ViewBag.LaneType    = FunctionHelper.LaneTypes1();
            ViewBag.CheckPlates = FunctionHelper.CheckBSType();
            ViewBag.PCs         = GetPCList();

            ViewBag.keyValue   = key;
            ViewBag.pcValue    = pc;
            ViewBag.PN         = page;
            ViewBag.groupValue = group;

            var obj = _tblLaneService.GetById(Guid.Parse(id));

            return(View(obj));
        }
Exemple #2
0
        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
        }