Ejemplo n.º 1
0
        public async Task <IActionResult> OnGetAsync()
        {
            if (Id.HasValue)
            {
                titlesList = branchItemService.GetAllAsync().Result.Select(x => x.DocumentTitle).Distinct().ToList();
                titlesList.Add("سجل تجاري");
                titlesList.Add("رخصة");
                titlesList.Add("عقد النفايات");
                titles      = titlesList.Distinct().ToArray();
                branchItems = branchItemService.GetAllAsync().Result.Where(x => x.BranchId == Id.Value).ToList();
                var _branchService = await branchService.FindAsync(Id.Value);

                if (_branchService != null)
                {
                    viewContent.BranchName   = _branchService.Name;
                    viewContent.BusnissId    = _branchService.BusinessId;
                    viewContent.BusinessName = _branchService.Business.Name;
                    viewContent.BranchId     = _branchService.Id;
                    return(null);
                }

                RedirectToPage("/Index");
            }
            return(RedirectToPage("/Index"));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> OnGet()
        {
            if (Id.HasValue)
            {
                branches = branchService.GetAll().Where(x => x.BusinessId == Id.Value).ToList();
                var getBusinessName = businessService.Find(Id.Value);
                var employeeItems   = employeeItemService.GetAll();
                var branchItems     = await branchItemService.GetAllAsync();

                if (branchItems != null)
                {
                    foreach (var item in branchItems.Where(x => x.Branch.BusinessId == Id.Value))
                    {
                        if (item.ExpDate.HasValue && item.ExpDate.Value.AddDays(-30).Date <= DateTime.Today)
                        {
                            Upcoming upcoming = new Upcoming();
                            upcoming.date    = item.ExpDate.Value;
                            upcoming.Branch  = item.Branch.Name;
                            upcoming.Details = item.DocumentTitle;
                            upcomings.Add(upcoming);
                        }
                    }
                }
                if (employeeItems != null)
                {
                    foreach (var item in employeeItems.Where(x => x.Employee.Branch.BusinessId == Id.Value))
                    {
                        if (item.ExpDate.HasValue && item.ExpDate.Value.AddDays(-30).Date <= DateTime.Today)
                        {
                            Upcoming upcoming = new Upcoming();
                            upcoming.date    = item.ExpDate.Value;
                            upcoming.Branch  = item.Employee.Branch.Name;
                            upcoming.Details = item.DocumentTitle + " " + item.Employee.FirstName + " " + item.Employee.LastName;
                            upcomings.Add(upcoming);
                        }
                    }
                }
                if (getBusinessName != null && branches != null)
                {
                    currentBusiness = getBusinessName.Name;
                    return(null);
                }
                else
                {
                    return(RedirectToPage("/Index"));
                }
            }
            return(RedirectToPage("/Index"));
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> OnGet()
        {
            if (Id.HasValue)
            {
                branchItems = branchItemService.GetAllAsync().Result.Where(x => x.BranchId == Id.Value).ToList();
                var _branchService = await branchService.FindAsync(Id.Value);

                if (branchItems != null && _branchService != null)
                {
                    viewContent.BranchName   = _branchService.Name;
                    viewContent.BusnissId    = _branchService.BusinessId;
                    viewContent.BusinessName = _branchService.Business.Name;
                    viewContent.BranchId     = _branchService.Id;
                    return(null);
                }
                RedirectToPage("/Index");
            }
            return(RedirectToPage("/Index"));
        }