Beispiel #1
0
        public ActionResult Index(string key = "", string pc = "", int page = 1)
        {
            int pageSize = 20;

            var list = _tblAccessLineService.GetAllPagingByFirst(key, pc, page, pageSize);

            var gridModel = PageModelCustom <tblAccessLine> .GetPage(list, page, pageSize);

            ViewBag.KeyWord = key;
            ViewBag.PCs     = GetPCList();
            ViewBag.PCID    = pc;

            url = Request.Url.PathAndQuery;

            return(View(gridModel));
        }
Beispiel #2
0
        public ActionResult Index(string key, string pcs, int page = 1, string selectedId = "")
        {
            int pageSize = 20;

            var list = _tblLockerSelfHostService.GetAllPagingByFirst(key, pcs, page, pageSize);

            var gridModel = PageModelCustom <tblLockerSelfHost> .GetPage(list, page, pageSize);

            ViewBag.keyValue        = key;
            ViewBag.pcsValue        = pcs;
            ViewBag.selectedIdValue = selectedId;

            ViewBag.pcsList = _tblLockerPCService.GetAllActive();

            return(View(gridModel));
        }
Beispiel #3
0
        public ActionResult Index(string key, string pc, int page = 1, string group = "", string selectedId = "")
        {
            var pageSize = 20;

            var list = _tblLEDService.GetAllCustomPagingByFirst(key, pc, page, pageSize);

            var gridModel = PageModelCustom <tblLEDCustomViewModel> .GetPage(list, page, pageSize);

            ViewBag.PCs = GetPCList();

            ViewBag.keyValue        = key;
            ViewBag.pcValue         = pc;
            ViewBag.groupValue      = group;
            ViewBag.selectedIdValue = selectedId;

            return(View(gridModel));
        }
Beispiel #4
0
        public ActionResult ReportDetailVehicleAnyTimes(string key = "", string fromdate = "", string vehiclegroupid = "", string customegroup = "", string cardgroup = "", int page = 1)
        {
            var pageSize  = 20;
            var totalItem = 0;
            var str       = new  List <string>();

            GetListChild(str, customegroup);

            var datefrompicker = "";

            if (!string.IsNullOrWhiteSpace(fromdate))
            {
                datefrompicker = fromdate;
            }
            var lstVehicleGroupID = new List <string>();

            if (!string.IsNullOrEmpty(vehiclegroupid))
            {
                var t = vehiclegroupid.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                if (t.Any())
                {
                    foreach (var item in t)
                    {
                        lstVehicleGroupID.Add(item);
                    }
                }
            }
            var list = _ReportService.GetReportDetailVehicleAnyTimse(key, fromdate, lstVehicleGroupID, str, cardgroup, page, pageSize, ref totalItem);

            var gridModel = PageModelCustom <ReportIn> .GetPage(list, page, pageSize, totalItem);

            ViewBag.Lanes    = GetLaneList().ToList();
            ViewBag.Users    = GetAllUser().ToList();
            ViewBag.KeyWord  = key;
            ViewBag.fromDate = !string.IsNullOrEmpty(fromdate) ? Convert.ToDateTime(fromdate).ToString("dd/MM/yyy HH:mm:59") : DateTime.Now.ToString("dd/MM/yyyy HH:mm:59");

            ViewBag.Cardgroups  = GetListCardGroups().ToList();
            ViewBag.CardGroupDT = GetListCardGroups().ToDataTableNullable();
            ViewBag.CardGroupId = cardgroup;

            ViewBag.VehicleGroupDT = GetListVehicle().ToDataTableNullable();
            ViewBag.VehicleID      = vehiclegroupid;
            ViewBag.CustomerGroup  = GetMenuList();
            ViewBag.CustomGroupId  = customegroup;
            return(View(gridModel));
        }
        //Xử lý với thẻ
        #region Card
        public PartialViewResult PartialListCard(string key, string cardgroupids, string customergroupid, string taskid, int page = 1)
        {
            //Load danh sách thẻ đã chọn
            ViewBag.selectedCard = GetSetDataCardSession(taskid, "", "0");

            //
            var pageSize       = 10;
            var customergroups = GetListChild("", customergroupid);

            var list = _tblCardService.GetAllPagingByFirstForUploadLocker(key, "", cardgroupids, customergroups, "", "", page, pageSize);

            var str = new List <string>();

            foreach (var item in list)
            {
                str.Add(item.CardNumber);
            }

            var LockerData = _tblLockerService.GetAllByCards(str);

            foreach (var item in list)
            {
                var kl = LockerData.Where(n => n.CardNumber == item.CardNumber).ToList();

                if (kl.Any())
                {
                    var desc  = "";
                    var count = 0;
                    foreach (var itemLocker in kl)
                    {
                        count++;
                        desc += string.Format("{0}{1}", itemLocker.Name, count == kl.Count ? "" : ",");
                    }

                    item.LockerInfo = desc;
                }
                else
                {
                    item.LockerInfo = "Chưa gắn tủ";
                }
            }

            var gridModel = PageModelCustom <tblCardExtend> .GetPage(list, page, pageSize);

            return(PartialView(gridModel));
        }
Beispiel #6
0
        public ActionResult Index(string key = "", string customergroup = "", int page = 1, string chkExport = "0", string customerstatus = "", string selectedId = "")
        {
            var str = GetListChild("", customergroup);

            if (chkExport.Equals("1"))
            {
                var listExcel = _tblCustomerService.ExcelAllByFirst(key, str, customerstatus);

                //Xuất file theo format
                PK_CustomerMapFormatCell(listExcel, "Danh_sách_khách_hàng", "Sheet1", "", "Danh sách khách hàng", "");

                return(RedirectToAction("Index", new { key = key, customergroup = customergroup, customerstatus = customerstatus, page = page }));
            }

            var pageSize = 20;

            var list = _tblCustomerService.GetAllPagingByFirst(key, str, page, pageSize, customerstatus);

            if (list.Any())
            {
                var lstId         = "";
                var lstCustomerId = "";
                foreach (var item in list)
                {
                    lstId         += item.CustomerGroupID + ";";
                    lstCustomerId += item.CustomerID.ToString() + ",";
                }

                ViewBag.listCustomerGroup = _tblCustomerGroupService.GetAllActiveByListId(lstId).ToList();
                //ViewBag.listCardCustomer = _PK_CardCustomerService.GetAllCardByListCustomerId(lstCustomerId).ToList();
            }

            var gridModel = PageModelCustom <tblCustomer> .GetPage(list, page, pageSize);

            ViewBag.keyValue            = key;
            ViewBag.customergroupValue  = customergroup;
            ViewBag.customerstatusValue = customerstatus;
            ViewBag.selectedIdValue     = selectedId;

            ViewBag.CustomerGroups     = GetMenuList();
            ViewBag.CustomerStatusList = GetCustomerStatusList();

            ViewBag.llevels = GetListAccessLevel();

            return(View(gridModel));
        }
Beispiel #7
0
        /// <summary>
        /// View báo cáo thao tác tủ đồ
        /// </summary>
        /// <param name="key"></param>
        /// <param name="cardgroup"></param>
        /// <param name="fromdate"></param>
        /// <param name="todate"></param>
        /// <param name="chkExport"></param>
        /// <param name="page"></param>
        /// <returns></returns>
        public ActionResult ReportActionHistoryLoker(string key = "", string objcontrol = "", string fromdate = "", string todate = "", string actionLooker = "", string type = "", string chkExport = "0", int page = 1)

        {
            // var totalPage = 0;
            var totalItem = 0;
            var pageSize  = 20;

            var datefrompicker = "";

            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.GetReportActionHistoryLoker_Excel(key, objcontrol, fromdate, todate, actionLooker, type, ref totalItem);

                //Xuất file theo format
                ReportActionHistoryLokerFormatCell(listExcel, "", "Báo_cáo_lịch_sử_thao_tác_tủ_đồ", "Sheet1", "", "Báo cáo lịch sử thao tác tủ đồ", datefrompicker);

                return(RedirectToAction("ReportLockerEvent"));
            }
            #endregion

            #region Giao diện

            var list = _ReportService.ReportActionHistoryLoker(key, objcontrol, fromdate, todate, actionLooker, type, page, pageSize, ref totalItem);

            var gridModel = PageModelCustom <ReportLockerProcess> .GetPage(list, page, pageSize, totalItem);

            ViewBag.KeyWord              = key;
            ViewBag.fromdateValue        = fromdate;
            ViewBag.todateValue          = todate;
            ViewBag.ControllerDT         = GetControllerList().ToDataTableNullable();
            ViewBag.ControllerId         = objcontrol;
            ViewBag.ActionLst            = FunctionHelper.ActionLockerProcess();
            ViewBag.ActionValue          = actionLooker;
            ViewBag.TypeLockerProcessLst = FunctionHelper.TypeLockerProcess();
            ViewBag.typeValue            = type;
            #endregion

            return(View(gridModel));
        }
        public ActionResult Index(string key, string gate, int page = 1, string group = "", string selectedId = "")
        {
            var pageSize = 20;

            var list = _tblPCService.GetAllCustomPagingByFirst(key, gate, page, pageSize);

            var gridModel = PageModelCustom <tblPCCustomViewModel> .GetPage(list, page, pageSize);

            ViewBag.Gates = GetGateList();

            ViewBag.keyValue        = key;
            ViewBag.groupValue      = group;
            ViewBag.gateValue       = gate;
            ViewBag.selectedIdValue = selectedId;

            return(View(gridModel));
        }
Beispiel #9
0
        public ActionResult Index(string key, string control, int page = 1, string group = "", string selectedId = "")
        {
            var pageSize = 20;

            var list = _tblAccessCameraService.GetAllCustomPagingByFirst(key, control, page, pageSize);

            var gridModel = PageModelCustom <tblAccessCameraCustomViewModel> .GetPage(list, page, pageSize);

            ViewBag.Controllers = GetControllerList();

            ViewBag.keyValue        = key;
            ViewBag.controllerValue = control;
            ViewBag.groupValue      = group;
            ViewBag.selectedIdValue = selectedId;

            return(View(gridModel));
        }
Beispiel #10
0
        /// <summary>
        /// Danh sách  tìm kiếm
        /// </summary>
        /// <returns></returns>
        public PartialViewResult Partial_SearchService(string key, string services, int page = 1)
        {
            int pageSize = 3;
            int total    = 0;
            var list     = _BM_Building_ServiceService.GetResidentPaging(key, page, pageSize, ref total);


            var gridModel = PageModelCustom <BM_Building_ServiceCustom> .GetPage(list, page, pageSize, total);

            if (!string.IsNullOrEmpty(services))
            {
                ViewBag.Services = services.Split(',').ToList();
            }


            return(PartialView(gridModel));
        }
Beispiel #11
0
        /// <summary>
        /// Danh sách thành viên tìm kiếm
        /// </summary>
        /// <returns></returns>
        public PartialViewResult Partial_SearchResident(string key, string group, string employees, int page = 1)
        {
            int pageSize = 3;
            int total    = 0;
            var list     = _BM_ResidentService.GetResidentPaging(key, group, page, pageSize, ref total);


            var gridModel = PageModelCustom <BM_ResidentCustom> .GetPage(list, page, pageSize, total);

            if (!string.IsNullOrEmpty(employees))
            {
                ViewBag.Employees = employees.Split(',').ToList();
            }


            return(PartialView(gridModel));
        }
        public ActionResult ReportCustomerExpire(bool IsAlmostExpired = true, string KeyWord = "", string customergroup = "", int page = 1, string date = "", string chkExport = "0")
        {
            var totalItem = 0;
            var pageSize  = 20;
            var user      = GetCurrentUser.GetUser();


            var strCG = new List <string>();

            GetListChild(strCG, customergroup);

            #region Excel
            //Excel
            if (chkExport.Equals("1"))
            {
                //Query lấy dữ liệu
                var listExcel = _ReportService.GetReportCustomerExpireExcel_Access(KeyWord, strCG, user.Id, date, IsAlmostExpired);

                listExcel.Columns.Remove("Inactive");
                listExcel.Columns.Remove("CustomerID");

                //Xuất file theo format
                ReportCustomerExpireExpireFormatCell(listExcel, "Danh_sách_khách_hàng_hết_hạn", "Sheet1", "", "Danh sách khách hàng hết hạn", date);

                return(RedirectToAction("ReportCustomerExpire"));
            }
            #endregion

            #region Giao diện
            var list = _ReportService.GetReportCustomerExpire_Access(KeyWord, strCG, page, pageSize, ref totalItem, user.Id, date, IsAlmostExpired);

            var gridModel = PageModelCustom <ReportCustomerExpire_Access> .GetPage(list, page, pageSize, totalItem);

            ViewBag.KeyWord = KeyWord;
            ViewBag.IsAlmostExpiredValue = IsAlmostExpired;


            ViewBag.CustomerGroups  = GetMenuList();
            ViewBag.CustomerGroupId = customergroup;
            ViewBag.Date            = date;

            return(View(gridModel));

            #endregion
        }
Beispiel #13
0
        public ActionResult Index(string key = "", int page = 1)
        {
            var totalPage = 0;
            var totalItem = 0;
            var pageSize  = 20;

            var list = _ExcelColumnService.GetAllPagingByFirst(key, page, pageSize, ref totalPage, ref totalItem);

            var gridModel = PageModelCustom <ExcelColumnCustom> .GetPage(list, page, pageSize);

            ViewBag.KeyWord = key;

            TempData["url"] = Request.Url.AbsoluteUri;

            ViewBag.objId = (string)TempData["objId"];

            return(View(gridModel));
        }
        public ActionResult Index(string key = "", string line = "", int page = 1)
        {
            //var totalPage = 0;
            //var totalItem = 0;
            var pageSize = 20;

            var list = _tblLockerControllerService.GetAllPagingByFirst(key, line, page, pageSize);

            var gridModel = PageModelCustom <Kztek.Model.Models.tblLockerController> .GetPage(list, page, pageSize);

            ViewBag.KeyWord = key;
            ViewBag.Lines   = GetLineList();
            ViewBag.LineID  = line;

            url = Request.Url.PathAndQuery;

            return(View(gridModel));
        }
        // GET: Parking/tblCards
        #region Danh sách thẻ
        public ActionResult Index(string key = "", string fromdate = "", string todate = "", bool desc = true, string columnquery = "ImportDate", string customerGroup = "", string isCheckByTime = "0", int page = 1, string cardgroup = "")
        {
            int pageSize  = 20;
            int totalItem = 0;
            var str       = new List <string>();

            GetListChildCustomer(str, customerGroup);

            if (string.IsNullOrWhiteSpace(fromdate))
            {
                fromdate = DateTime.Now.ToString("dd/MM/yyy");
            }
            if (string.IsNullOrWhiteSpace(todate))
            {
                todate = DateTime.Now.ToString("dd/MM/yyy");
            }
            var systemConfig = _tblSystemConfigService.GetDefault();
            var list         = _itblCardService.GetAllCartPagingByFirstTSQL(key, fromdate, desc, columnquery, todate, cardgroup, str, isCheckByTime, page, pageSize, ref totalItem);


            var girdMode = PageModelCustom <tblCardCustomViewModel> .GetPage(list, page, pageSize, totalItem);

            //if (systemConfig.FeeName.Contains("TRANSERCO"))
            //{
            //    ViewBag.ListMoney = _itblCardService.GetMoneyByCardNumber();
            //}
            ViewBag.ListMoney = _itblCardService.GetMoneyByCardNumber();
            // ViewBag.System = systemConfig;
            //ViewBag.fromDate = fromdate;
            //ViewBag.toDate = !string.IsNullOrWhiteSpace(todate) ? Convert.ToDateTime(todate).ToString("dd/MM/yyyy HH:mm:59") : DateTime.Now.ToString("dd/MM/yyyy 23:59:59");
            ViewBag.fromdateValue      = fromdate;
            ViewBag.todateValue        = todate;
            ViewBag.KeyWord            = key;
            ViewBag.GroupCustomers     = GetMenuList();
            ViewBag.CustomerId         = customerGroup;
            ViewBag.CardGroupDT        = GetListCardGroups().ToDataTableNullable();
            ViewBag.CardGroupid        = cardgroup;
            ViewBag.isCheckByTimeValue = isCheckByTime;
            ViewBag.ColumnQuery        = columnquery;
            ViewBag.Desc = desc;
            // ViewBag.ISTRANSERCO = systemConfig != null ? (systemConfig.FeeName.Contains("TRANSERCO") ? true : false) : false;
            return(View(girdMode));
        }
Beispiel #16
0
        public ActionResult Index(string key, int page = 1)
        {
            //Khai báo
            int pageSize = 2;

            //Lấy danh sách phân trang
            var list = _UserService.GetAllPagingByFirst(key, page, pageSize);

            //Đổ lên grid
            var gridModel = PageModelCustom <User> .GetPage(list, page, pageSize);

            //ViewBag
            ViewBag.keyValue = key;

            url = Request.Url.PathAndQuery;

            //Đưa ra giao diện
            return(View(gridModel));
        }
Beispiel #17
0
        public ActionResult Index(string key = "", int page = 1)
        {
            //var totalPage = 0;
            //var totalItem = 0;
            var pageSize = 20;

            var list = _BM_ApartmentRoleService.GetAllPagingByFirst(key, page, pageSize);

            var gridModel = PageModelCustom <BM_ApartmentRole> .GetPage(list, page, pageSize);

            ViewBag.KeyWord = key;


            url = Request.Url.AbsoluteUri;

            ViewBag.objId = objId;

            return(View(gridModel));
        }
        public ActionResult Index(string key = "", string residentGroup = "", int page = 1, string chkExport = "0", string selectedId = "")
        {
            var str = GetListChild("", residentGroup);

            //if (chkExport.Equals("1"))
            //{
            //    var listExcel = _BM_ResidentService.ExcelAllByFirst(key, str, customerstatus);

            //    //Xuất file theo format
            //    PK_CustomerMapFormatCell(listExcel, "Danh_sách_khách_hàng", "Sheet1", "", "Danh sách khách hàng", "");

            //    return RedirectToAction("Index", new { key = key, customergroup = customergroup, customerstatus = customerstatus, page = page });
            //}

            var pageSize = 20;

            var list = _BM_ResidentService.GetAllPagingByFirst(key, str, page, pageSize);

            if (list.Any())
            {
                var lstId         = "";
                var lstCustomerId = "";
                foreach (var item in list)
                {
                    lstId         += item.ResidentGroupId + ";";
                    lstCustomerId += item.Id.ToString() + ",";
                }

                ViewBag.LstResidentGroup = _BM_ResidentGroupService.GetAll().ToList();
                //ViewBag.listCardCustomer = _PK_CardCustomerService.GetAllCardByListCustomerId(lstCustomerId).ToList();
            }

            var gridModel = PageModelCustom <BM_Resident> .GetPage(list, page, pageSize);

            ViewBag.keyValue           = key;
            ViewBag.ResidentGroupValue = residentGroup;
            ViewBag.selectedIdValue    = selectedId;

            ViewBag.ResidentGroup = GetMenuList();

            return(View(gridModel));
        }
Beispiel #19
0
        public ActionResult Index(string key, string controllerid, int page = 1)
        {
            //Khai báo
            int pageSize = 20;

            //Lấy danh sách phân trang
            var list = _tblAccessDoorService.GetAllPagingByFirst(key, controllerid, page, pageSize);

            //Đổ lên grid
            var listModel = PageModelCustom <tblAccessDoor> .GetPage(list, page, pageSize);

            //ViewBag
            ViewBag.Key = string.IsNullOrWhiteSpace(key) ? "" : key;
            ViewBag.ControllerIDValue = controllerid;
            ViewBag.Controllers       = GetControllerList();
            url = Request.Url.PathAndQuery;

            //Đưa ra giao diện
            return(View(listModel));
        }
        /// <summary>
        /// Load danh sách bộ điều khiển
        /// </summary>
        /// <param name="computerids">Danh sách các bộ điều khiển tìm kiếm</param>
        /// <param name="page">Trang hiện tại</param>
        /// <returns></returns>
        public PartialViewResult ListController(string key, string computerids, string line, string groupControllerId, int page = 1)
        {
            ViewBag.selectedController = GetSetFromSessionController(null);
            var ControllerGroupList = _tblAccessControllerGroupService.GetAll();
            int pageSize            = 25;

            var list = _tblAccessControllerService.GetAllPagingByFirst(key, computerids, line, groupControllerId, page, pageSize);

            foreach (var item in list)
            {
                if (!String.IsNullOrEmpty(item.ControllerGroupId))
                {
                    var ControllerGroupName = ControllerGroupList.Where(n => n.Id == item.ControllerGroupId).FirstOrDefault().Name;
                    item.ControllerGroupId = ControllerGroupName;
                }
            }
            var gridModel = PageModelCustom <tblAccessController> .GetPage(list, page, pageSize);

            return(PartialView(gridModel));
        }
        public ActionResult Index(string key = "", string cardgroup = "", int page = 1)
        {
            //var totalPage = 0;
            //var totalItem = 0;
            var pageSize = 20;

            var list = _tblFeeService.GetAllCustomPagingByFirst(key, cardgroup, page, pageSize);

            var gridModel = PageModelCustom <FeeCustom> .GetPage(list, page, pageSize);

            ViewBag.KeyWord        = key;
            ViewBag.CardGroupValue = cardgroup;
            ViewBag.CardGroups     = GetCardGroupList();

            url = Request.Url.AbsoluteUri;

            ViewBag.objId = objId;

            return(View(gridModel));
        }
Beispiel #22
0
        // GET: Parking/tblCustomers
        public ActionResult Index(string key = "", string customerGr = "", string selectedId = "", int page = 1, string chkExport = "0")
        {
            int totalItem = 0;
            int pageSize  = 20;
            var str       = new List <string>();
            //GetCustomerGr(str, customerGr);
            var listCustomer = itblCustomerService.GetListCustmer(key, customerGr, selectedId, page, pageSize, ref totalItem);
            var girdModel    = PageModelCustom <tblCustomer> .GetPage(listCustomer, page, pageSize, totalItem);

            if (listCustomer.Any())
            {
                var lstId = "";
                foreach (var item in listCustomer)
                {
                    lstId += item.CustomerGroupID + ",";
                }
                ViewBag.lstCustomerGr = itblCustomerGrService.GetAllActiveByListId(lstId).ToList();
            }
            return(View(girdModel));
        }
Beispiel #23
0
        public ActionResult Index(string key, int?page, string group = "")
        {
            //Khai báo
            int pageNumber = (page ?? 1);
            int pageSize   = 20;

            //Lấy danh sách phân trang
            var list = _UserService.GetAllPagingByFirst(key, pageNumber, pageSize);
            //Đổ lên grid
            var gridModel = PageModelCustom <User> .GetPage(list, pageNumber, pageSize);

            //ViewBag
            ViewBag.Key     = key;
            ViewBag.GroupID = group;
            GroupID         = group;

            ViewBag.selectedUserValue = GetSetFromSession(null);

            //Đưa ra giao diện
            return(View(gridModel));
        }
Beispiel #24
0
        public ActionResult Index(string key = "", int page = 1, string chkExport = "0", string selectedId = "")
        {
            //if (chkExport.Equals("1"))
            //{
            //    var listExcel = _BM_BuildingService.ExcelAllByFirst(key, str, customerstatus);

            //    //Xuất file theo format
            //    PK_CustomerMapFormatCell(listExcel, "Danh_sách_khách_hàng", "Sheet1", "", "Danh sách khách hàng", "");

            //    return RedirectToAction("Index", new { key = key, customergroup = customergroup, customerstatus = customerstatus, page = page });
            //}

            var pageSize = 20;

            var list = _BM_BuildingService.GetAllPagingByFirst(key, page, pageSize);

            var gridModel = PageModelCustom <BM_Building> .GetPage(list, page, pageSize);

            ViewBag.keyValue = key;

            return(View(gridModel));
        }
        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 ReportCardExpire(string KeyWord = "", string cardgroup = "", string customergroup = "", int page = 1, string date = "", string chkExport = "0", bool IsAlmostExpired = true)
        {
            var    totalItem  = 0;
            var    pageSize   = 20;
            var    user       = GetCurrentUser.GetUser();
            string CustomerID = "";


            var strCG = new List <string>();

            GetListChild(strCG, customergroup);

            #region Excel
            //Excel
            if (chkExport.Equals("1"))
            {
                //Query lấy dữ liệu
                var listExcel = _ReportService.GetReportCardExpireExcel_Access(KeyWord, cardgroup, CustomerID, strCG, user.Id, date, IsAlmostExpired);

                if (listExcel != null && listExcel.Rows.Count > 0)
                {
                    foreach (DataRow dr in listExcel.Rows)
                    {
                        if (dr["IsLock"].ToString().Contains("True"))
                        {
                            dr["Trạng thái"] = "Đã khóa thẻ";
                        }
                        else
                        {
                            dr["Trạng thái"] = "Hoạt động";
                        }
                    }
                }
                listExcel.Columns.Remove("IsLock");
                //Xuất file theo format
                ReportCardExpireFormatCell(listExcel, "Danh_sách_thẻ_hết_hạn", "Sheet1", "", "Danh sách thẻ hết hạn", date);

                return(RedirectToAction("ReportCardExpire"));
            }
            #endregion

            #region Giao diện
            var list = _ReportService.GetReportCardExpire_Access(KeyWord, cardgroup, CustomerID, strCG, page, pageSize, ref totalItem, user.Id, date, IsAlmostExpired);

            var gridModel = PageModelCustom <ReportCardExpire_Access> .GetPage(list, page, pageSize, totalItem);

            ViewBag.KeyWord = KeyWord;
            ViewBag.IsAlmostExpiredValue = IsAlmostExpired;

            ViewBag.CardGroups  = GetCardGroupList().ToList();
            ViewBag.CardGroupDT = GetCardGroupList().Where(n => n.CardType == 0).ToDataTableNullable();
            ViewBag.CardGroupId = cardgroup;


            ViewBag.CustomerGroups  = GetMenuList();
            ViewBag.CustomerGroupId = customergroup;

            //ViewBag.CustomerGroups = GetCustomerGroupList().ToList();
            //ViewBag.CustomerGroupDT = GetCustomerGroupList().ToDataTableNullable();
            //ViewBag.CustomerGroupId = customergroup;

            ViewBag.Date = date;

            return(View(gridModel));

            #endregion
        }
        public JsonResult GetListCustomerWantToUse(SelectListModelCardUpload obj)
        {
            var totalPage = 0;
            var totalItem = 0;
            var pageSize  = 0;

            var dtg = new List <AccessUploadMultiDevice>();

            //Lấy người dùng hiện tại
            var user = GetCurrentUser.GetUser();

            var model = new SelectListModelCardUploadReturn();

            model.ListSelfHost   = GetSetFromSessionSelfHost(null);
            model.ListController = GetSetFromSessionController(null);
            model.ListEmployee   = new List <Employee>();
            model.IsUseNewDate   = obj.isusenewdate;

            if (obj.isall)
            {
                var customergroups = GetListChild("", obj.customergroupid);

                var list      = _tblCustomerService.GetAllPagingByFirstForUpload(obj.key, "", customergroups, "", "", obj.pageIndex, obj.pageSize, obj.accesslevelids);
                var gridModel = PageModelCustom <tblCustomerExtend> .GetPage(list, obj.pageIndex, obj.pageSize);

                totalPage = gridModel.TotalPage;
                totalItem = gridModel.TotalItem;
                pageSize  = gridModel.PageSize;

                model.ListCustomer = gridModel.Data.ToList();

                //var customergroups = GetListChild("", obj.customergroupid);

                //model.ListCustomer = _tblCustomerService.GetAllByFirst(obj.key, "", customergroups, "", "", obj.accesslevelids);

                //totalPage = model.ListCustomer.Count / 10;
            }
            else
            {
                var models = GetSetFromSessionCustomer(null);
                model.ListCustomer = _tblCustomerService.GetAllByFirst(models);
            }

            if (model.ListCustomer.Any())
            {
                foreach (var item in model.ListSelfHost)
                {
                    var ko = new AccessUploadMultiDevice()
                    {
                        Address   = item.Address,
                        pageIndex = obj.pageIndex,
                        totalPage = totalPage,
                        totalItem = totalItem,
                        pageSize  = pageSize
                    };

                    var lines = _tblAccessLineService.GetAllActiveByListPC(item.PCID);

                    var ControllerByPC = model.ListController.Where(n => lines.Any(m => m.LineID.ToString() == n.LineID)).ToList();

                    model.ListEmployee = new List <Employee>();

                    ko.totalItem       = ko.totalItem * ControllerByPC.Count;
                    ko.totalController = ControllerByPC.Count;

                    foreach (var itemCustomer in model.ListCustomer)
                    {
                        foreach (var itemController in ControllerByPC)
                        {
                            var map = new Employee();

                            map.CardNumber = "0";

                            map.AccessLevelID = itemCustomer.AccessLevelID.Trim();

                            map.ControllerIDs = itemController.ControllerID.ToString();

                            map.UserID = user.Id;

                            map.UserIDofFinger = itemCustomer.UserIDofFinger;

                            map.Fingers1 = itemCustomer.Finger1;

                            map.Fingers2 = itemCustomer.Finger2;

                            map.Passwords = itemCustomer.Password;

                            map.VerifyTypeID = 0;

                            if (obj.isusenewdate)
                            {
                                map.ExpireDate = Convert.ToDateTime(obj.newdateexpire).ToString("yyyyMMdd").Trim();
                            }
                            else
                            {
                                map.ExpireDate = Convert.ToDateTime(itemCustomer.AccessExpireDate).ToString("yyyyMMdd").Trim();
                            }

                            model.ListEmployee.Add(map);
                        }
                    }

                    ko.DataSend = model.ListEmployee;

                    dtg.Add(ko);
                }
            }

            var t = new SelectListModelCardUploadReturn2()
            {
                ListEmployee = model.ListEmployee,
                ListSelfHost = model.ListSelfHost
            };

            //var red = JsonConvert.SerializeObject(t);

            var a = new JsonResult {
                Data = dtg, MaxJsonLength = Int32.MaxValue
            };

            return(a);

            //return Json(model, JsonRequestBehavior.AllowGet);
        }
        public JsonResult GetListCardWantToUse(SelectListModelCardUpload obj)
        {
            var totalPage = 0;
            var totalItem = 0;
            var pageSize  = 0;

            var dtg = new List <AccessUploadMultiDevice>();

            //Lấy người dùng hiện tại
            var user = GetCurrentUser.GetUser();

            var model = new SelectListModelCardUploadReturn();

            model.ListSelfHost   = GetSetFromSessionSelfHost(null);
            model.ListController = GetSetFromSessionController(null);


            if (obj.isall)
            {
                var customergroups = GetListChild("", obj.customergroupid);

                var list      = _tblCardService.GetAllPagingByFirstForUpload(obj.key, "", obj.cardgroupids, customergroups, "", "", obj.pageIndex, obj.pageSize, obj.accesslevelids, "", "");
                var gridModel = PageModelCustom <tblCardExtend> .GetPage(list, obj.pageIndex, obj.pageSize);

                totalPage = gridModel.TotalPage;
                totalItem = gridModel.TotalItem;
                pageSize  = gridModel.PageSize;

                model.ListCard = gridModel.Data.ToList();
            }
            else
            {
                model.ListCard = GetSetFromSessionCard(null);

                model.ListCard = _tblCardService.GetAllByFirst_v2(model.ListCard);
            }

            var listCustomerId = new List <string>();

            foreach (var item in model.ListCard)
            {
                if (!string.IsNullOrWhiteSpace(item.CustomerId))
                {
                    listCustomerId.Add(item.CustomerId);
                }
            }

            //Danh sách khách hàng
            var ListCustomer = _tblCustomerService.GetAllByListId(listCustomerId);

            if (model.ListCard.Any())
            {
                foreach (var item in model.ListSelfHost)
                {
                    var ko = new AccessUploadMultiDevice()
                    {
                        Address   = item.Address,
                        pageIndex = obj.pageIndex,
                        totalPage = totalPage,
                        totalItem = totalItem,
                        pageSize  = pageSize
                    };

                    var lines = _tblAccessLineService.GetAllActiveByListPC(item.PCID);

                    var ControllerByPC = model.ListController.Where(n => lines.Any(m => m.LineID.ToString() == n.LineID)).ToList();

                    model.ListEmployee = new List <Employee>();

                    //
                    ko.totalItem       = ko.totalItem * ControllerByPC.Count;
                    ko.totalController = ControllerByPC.Count;

                    foreach (var itemCard in model.ListCard)
                    {
                        foreach (var itemController in ControllerByPC)
                        {
                            var map = new Employee();

                            map.CardNumber = itemCard.CardNumber.Trim();

                            map.AccessLevelID = itemCard.AccessLevelID.Trim();

                            map.ControllerIDs = itemController.ControllerID.ToString();

                            map.UserID = user.Id;

                            //Lấy khách hàng
                            if (!string.IsNullOrWhiteSpace(itemCard.CustomerId))
                            {
                                var objCustomer = ListCustomer.FirstOrDefault(n => n.CustomerID.ToString() == itemCard.CustomerId);
                                if (objCustomer != null)
                                {
                                    map.UserIDofFinger = objCustomer.UserIDofFinger;

                                    map.Passwords = objCustomer.Password;
                                }
                                else
                                {
                                    map.UserIDofFinger = 0;

                                    map.Passwords = "";
                                }
                            }
                            else
                            {
                                map.UserIDofFinger = 0;

                                map.Passwords = "";
                            }

                            if (obj.isusenewdate)
                            {
                                map.ExpireDate = Convert.ToDateTime(obj.newdateexpire).ToString("yyyyMMdd").Trim();
                            }
                            else
                            {
                                map.ExpireDate = Convert.ToDateTime(itemCard.AccessExpireDate).ToString("yyyyMMdd").Trim();
                            }

                            model.ListEmployee.Add(map);
                        }
                    }

                    ko.DataSend = model.ListEmployee;

                    dtg.Add(ko);
                }
            }

            //var t = new SelectListModelCardUploadReturn2()
            //{
            //    ListEmployee = model.ListEmployee,
            //    ListSelfHost = model.ListSelfHost
            //};

            //var red = JsonConvert.SerializeObject(t);

            var a = new JsonResult {
                Data = dtg, MaxJsonLength = Int32.MaxValue
            };

            return(a);
        }
Beispiel #29
0
        // Xe ra ngoài bãi

        public ActionResult ReportOut(string key = "", bool ischeckTime = false, string groupCustomer = "", string lane = "", string user = "", string cardgroup = "", string fromdate = "", string todate = "", int page = 1)
        {
            // tìm kiếm theo key
            //     var checkKey = !string.IsNullOrWhiteSpace(key) ? key.Replace(".", "").Replace(",", "").Replace("  ", "") : String.Empty;
            //tim kiems theo nhóm khách hang
            var strs = new List <string>();

            GetListChild(strs, groupCustomer);
            // tìm kiếm theo ngay tháng
            var findDate = "";

            if (string.IsNullOrWhiteSpace(fromdate))
            {
                fromdate = DateTime.Now.ToString("dd/MM/yyyy 00:00:00");
            }
            if (string.IsNullOrWhiteSpace(todate))
            {
                todate = DateTime.Now.ToString("dd/MM/yyyy 00:00:00");
            }
            if (!string.IsNullOrWhiteSpace(fromdate) && !string.IsNullOrWhiteSpace(todate))
            {
                findDate = fromdate + "-" + todate;
            }

            var pagesize  = 20;
            int totalItem = 0;
            var list      = _ReportService.GetReportOuts(key, ischeckTime, fromdate, todate, strs, lane, user, cardgroup, page, pagesize, ref totalItem);

            if (list.Any())
            {
                var str = "";
                foreach (var item in list)
                {
                    str = item.LaneIDIn + "," + item.LaneIDOut + ",";
                }
                ViewBag.ListLane = _LaneService.GetAllActiveByListIds(str).ToList();
            }

            var girdModel = PageModelCustom <ReportInOut> .GetPage(list, page, pagesize, totalItem);

            // truyền list card group sang view
            ViewBag.CardGroups  = GetCardGroups().ToList();
            ViewBag.CarGroupDT  = GetCardGroups().ToDataTableNullable();
            ViewBag.CardGroupId = cardgroup;

            //ViewBag.ListLanes = GetLaneList().ToList();
            ViewBag.LaneDT = GetLaneList().ToDataTableNullable();
            ViewBag.LaneID = lane;

            ViewBag.CustomerGr   = GetMenuList();
            ViewBag.CustomerGrID = groupCustomer;
            //
            ViewBag.User = GetAllUser().ToList();

            // truyen viewBag key để tìm kiếm
            ViewBag.KeyWord   = key;
            ViewBag.CheckTime = ischeckTime;
            // tìm kiếm theo date
            ViewBag.Fromdate = fromdate;
            ViewBag.ToDate   = !string.IsNullOrWhiteSpace(todate) ? Convert.ToDateTime(todate).ToString("dd/MM/yyyy HH:mm:59") :
                               DateTime.Now.ToString("dd/MM/yyyy 00:00:00");
            return(View(girdModel));
        }
Beispiel #30
0
        public ActionResult Index(string key, string cardgroup, string customergroup, string actionvs, string user, string eventtype, string eventstatus, string fromdate, string todate, string chkExport = "0", int page = 1)
        {
            var strCG = new List <string>();

            GetListChild(strCG, customergroup);
            var totalItem      = 0;
            var datefrompicker = "";

            if (!string.IsNullOrWhiteSpace(fromdate) && !string.IsNullOrWhiteSpace(todate))
            {
                datefrompicker = fromdate + "-" + todate;
            }

            int pageSize = 20;

            #region Excel
            //Excel
            if (chkExport.Equals("1"))
            {
                ////Query lấy dữ liệu
                var listExcel = _tblAccessUploadProcessService.GetReportUploadProcessDetailExcel(key, strCG, fromdate, todate, cardgroup, actionvs, user, eventtype, eventstatus);

                if (listExcel != null && listExcel.Rows.Count > 0)
                {
                    foreach (DataRow item in listExcel.Rows)
                    {
                        if (!string.IsNullOrWhiteSpace(item["CustomerGroupID"].ToString()))
                        {
                            var a = _tblCustomerGroupService.GetById(Guid.Parse(item["CustomerGroupID"].ToString()));

                            item["Nhóm KH"] = a != null ? a.CustomerGroupName : "";
                        }
                        if (!string.IsNullOrWhiteSpace(item["Thiết bị"].ToString()))
                        {
                            var b = _tblAccessControllerService.GetById(Guid.Parse(item["Thiết bị"].ToString()));

                            item["Thiết bị"] = b != null ? b.ControllerName : "";
                        }

                        if (!string.IsNullOrWhiteSpace(item["Hành vi"].ToString()))
                        {
                            var b = FunctionHelper.ActionUploadProcess().FirstOrDefault(n => n.ItemValue.Equals(item["Hành vi"].ToString()));

                            item["Hành vi"] = b != null ? b.ItemText : "";
                        }
                    }
                    listExcel.Columns.Remove("CustomerGroupID");
                }


                //Xuất file theo format
                FormatCell(listExcel, "Báo_cáo_chi_tiết_nạp_hủy_thẻ_vân_tay", "Sheet1", "", "Báo cáo chi tiết nạp / hủy thẻ, vân tay", datefrompicker);

                return(RedirectToAction("Index"));
            }
            #endregion

            var list = _tblAccessUploadProcessService.GetReportUploadProcessDetail(key, strCG, fromdate, todate, cardgroup, actionvs, user, page, pageSize, ref totalItem, eventtype, eventstatus);

            var gridModel = PageModelCustom <ReporttblAccessUploadProcess> .GetPage(list, page, pageSize, totalItem);


            ViewBag.CardGroups  = GetCardGroupList().ToList();
            ViewBag.CardGroupDT = GetCardGroupList().ToDataTableNullable();
            ViewBag.CardGroupId = cardgroup;


            ViewBag.Users  = GetUserList().ToList();
            ViewBag.UserDT = GetUserList().ToDataTableNullable();
            ViewBag.UserId = user;

            ViewBag.LstCustomerGroups = GetCustomerGroupList().ToList();
            ViewBag.CustomerGroups    = GetMenuList();
            ViewBag.CustomerGroupId   = customergroup;

            ViewBag.Control = _tblAccessControllerService.GetAllActive().ToList();

            ViewBag.Actions  = FunctionHelper.ActionUploadProcess();
            ViewBag.ActionId = actionvs;

            ViewBag.EventTypes  = FunctionHelper.EventType();
            ViewBag.EventTypeId = eventtype;

            ViewBag.EventStatus   = FunctionHelper.EventStatus();
            ViewBag.EventStatusId = eventstatus;

            ViewBag.KeyWord = key;

            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));
        }