コード例 #1
0
ファイル: RequestController.cs プロジェクト: irina-dav/citr
        public ViewResult ListMyRequests()
        {
            Employee currEmployee = ldapService.GetUserEmployee();

            ViewBag.Title = "Мои заявки";
            List <Request> requests = repository.Requests.Where(r => r.AuthorID == currEmployee.EmployeeID).ToList();

            return(View("List", requests));
        }
コード例 #2
0
        public void AddRow(IHistoryable obj, string text)
        {
            if (obj.History == null)
            {
                obj.History = new List <HistoryRow>();
            }

            string historyText = Regex.Replace(text, "<.*?>", string.Empty);

            obj.History.Add(new HistoryRow()
            {
                AuthorEmployeeID = ldapService.GetUserEmployee().EmployeeID,
                Date             = DateTime.Now,
                Text             = historyText
            });
            context.SaveChanges();
        }
コード例 #3
0
ファイル: HomeController.cs プロジェクト: irina-dav/citr
        public IActionResult Index()
        {
            int currEmployeeId = ldapService.GetUserEmployee().EmployeeID;

            if (requestRepository.Requests
                .Any(r => r.State == RequestState.Approving &&
                     r.Details.Any(d => d.ResourceOwnerID == currEmployeeId && d.ApprovingResult == ResourceApprovingResult.None)))
            {
                return(RedirectToAction("ListToApprove", "Request"));
            }
            else if (User.IsInRole("Admins"))
            {
                return(RedirectToAction("List", "Resource"));
            }
            else
            {
                return(RedirectToAction("ListMyRequests", "Request"));
            }
        }