コード例 #1
0
        public ActionResult Create(string controllername, string id)
        {
            //ViewBag
            ViewBag.DDLMenu = GetMenuList();
            //ViewBag.parentidValue = parentid;
            var systemconfig = _tblSystemConfigService.GetDefault();

            ViewBag.ISTRANSERCO = systemconfig != null ? (systemconfig.FeeName.Contains("TRANSERCO") ? true : false) : false;
            int count = _tblCustomerGroupService.CountParent();
            var obj   = new tblCustomerGroup()
            {
                Ordering = count + 1,
                Inactive = false
            };

            if (!string.IsNullOrEmpty(id))
            {
                var obj2 = _tblCustomerGroupService.GetById(Guid.Parse(id));
                if (obj2 != null)
                {
                    obj.ParentID = obj2.ParentID;
                    obj.Inactive = obj2.Inactive;
                    obj.Ordering = obj2.Ordering + 1;
                }
            }

            return(View(obj));
        }
コード例 #2
0
        public ActionResult Update(string id)
        {
            ViewBag.DDLMenu = GetMenuList();

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

            return(View(obj));
        }
コード例 #3
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));
        }