예제 #1
0
        public async Task <IActionResult> Get_List(string time, byte status)
        {
            try
            {
                string controllerName = this.ControllerContext.ActionDescriptor.ControllerTypeInfo.CustomAttributes.FirstOrDefault().ConstructorArguments[0].Value.ToString();
                var    data           = await _temporaryBillManager.Get_List_Bill(time, status);

                var permission            = Portal.Utils.SessionExtensions.Get <List <Permissions> >(_session, Portal.Utils.SessionExtensions.SesscionPermission);
                var path                  = _httpContextAccessor.HttpContext.Request.Path.Value;
                var currentPagePermission = permission.Where(c => c.MenuUrl.ToLower().Contains(controllerName.ToLower())).ToList();
                ViewData[nameof(PermissionEnum.Create)] = currentPagePermission.Count(c => c.ActionCode == (nameof(PermissionEnum.Create))) > 0 ? 1 : 0;
                ViewData[nameof(PermissionEnum.Update)] = currentPagePermission.Count(c => c.ActionCode == (nameof(PermissionEnum.Update))) > 0 ? 1 : 0;
                ViewData[nameof(PermissionEnum.Delete)] = currentPagePermission.Count(c => c.ActionCode == (nameof(PermissionEnum.Delete))) > 0 ? 1 : 0;
                if (status == (byte)BillStatus.TemporaryKTV)
                {
                    var session = _httpContextAccessor.HttpContext.Session;
                    var account = Portal.Utils.SessionExtensions.Get <Accounts>(session, Portal.Utils.SessionExtensions.SessionAccount);
                    if (account.JobPositionName.ToLower().Trim().Contains("kỹ thuật viên"))
                    {
                        data = await _temporaryBillManager.Get_List_Bill_KTV(time, account.Id);

                        data = data.OrderBy(c => c.Status).ToList();
                    }
                }
                return(PartialView("_List", data));
            }
            catch (Exception ex)
            {
                return(Json(new { Result = false, Message = ex.Message }));
            }
        }
예제 #2
0
        public async Task <IActionResult> Get_List(string time)
        {
            try
            {
                var data = await _temporaryBillManager.Get_List_Bill(time, 3);

                return(PartialView("_List", data));
            }
            catch (Exception ex)
            {
                return(Json(new { Result = false, Message = ex.Message }));
            }
        }