示例#1
0
        public ActionResult QueryEmployee(string id)
        {
            QueryEmployeeDetailView queryEmployeeDetailView = new QueryEmployeeDetailView();

            #region Access Check
            bool hasPermission = GetEmployee().IsGuaranteed("QueryEmployee_Read");
            if (!hasPermission)
            {
                ModelState.AddModelError("", "AccessDenied");
                return(View(queryEmployeeDetailView));
            }
            #endregion


            queryEmployeeDetailView.EmployeeView       = GetEmployee();
            queryEmployeeDetailView.QueryEmployeeViews = _queryEmployeeService.GetQueryEmployees(Guid.Parse(id)).QueryEmployeeViews;
            queryEmployeeDetailView.QueryView          = GetQueryView(id);// _queryService.GetQuery(new GetRequest() { ID = Guid.Parse(id) }).QueryView;

            #region DropDownList For Employees

            queryEmployeeDetailView.EmployeeViews = _employeeService.GetEmployees().EmployeeViews;
            List <DropDownItem> list = new List <DropDownItem>();

            if (queryEmployeeDetailView.EmployeeViews.Count() > 0)
            {
                foreach (EmployeeView employeeView in queryEmployeeDetailView.EmployeeViews)
                {
                    list.Add(new DropDownItem {
                        Value = employeeView.ID.ToString(), Text = employeeView.Name
                    });
                }
            }
            var selectList = new SelectList(list, "Value", "Text");
            ViewData["Employees"] = selectList;

            #endregion

            return(View(queryEmployeeDetailView));
        }
示例#2
0
        public ActionResult Index(string id)
        {
            QueryEmployeeHomePageView queryEmployeeHomePageView = new QueryEmployeeHomePageView();

            #region Access Check
            bool hasPermission = GetEmployee().IsGuaranteed("QueryEmployee_Read");
            if (!hasPermission)
            {
                ModelState.AddModelError("", "AccessDenied");
                return(View(queryEmployeeHomePageView));
            }
            #endregion

            queryEmployeeHomePageView.EmployeeView       = GetEmployee();
            queryEmployeeHomePageView.QueryEmployeeViews = _queryEmployeeService.GetQueryEmployees(Guid.Parse(id)).QueryEmployeeViews;

            return(View(queryEmployeeHomePageView));
        }