Beispiel #1
0
        public IActionResult Index(Userrelation relation)
        {
            List <Userrelation> relations = null;

            if (relation.Name == null)
            {
                relations = relatonService.GetAll();
            }
            else
            {
                relations = relatonService.Query(relation);
            }
            var projects = projectService.GetAll();

            ViewData["projects"]  = projects;
            ViewData["relations"] = relations;
            return(View());
        }
Beispiel #2
0
        public IActionResult Index(Thecase caselist)
        {
            var                 json      = HttpContext.Request.Cookies["user"];
            User                loginuser = JsonConvert.DeserializeObject <User>(json);
            List <Plan>         plans     = null;
            List <Unit>         units     = null;
            List <Project>      projects  = null;
            List <Userrelation> relations = null;
            List <Thecase>      cases     = null;

            if (loginuser.relation.Eid == 1)
            {
                plans     = planService.GetAll();
                projects  = projectService.GetAll();
                units     = unitService.GetAll();
                relations = relationService.GetAll();
                if (caselist.Proid > 0)
                {
                    cases = caseService.QueryByProid((int)caselist.Proid);
                }
                else if (caselist.Pid > 0)
                {
                    cases = caseService.QueryByPid((int)caselist.Pid);
                }
                else if (caselist.Unid > 0)
                {
                    cases = caseService.QueryByUnid((int)caselist.Unid);
                }
                else if (caselist.State != null)
                {
                    cases = caseService.QueryByState(caselist.State);
                }
                else if (caselist.Name != null)
                {
                    cases = caseService.QueryByName(loginuser.relation.Name);
                }
                else if (caselist.Toname != null)
                {
                    cases = caseService.QueryByToName(loginuser.relation.Name);
                }
                else if (caselist.State != null)
                {
                    cases = caseService.QueryByState(caselist.State);
                }
                else if (caselist.Ctitle == null)
                {
                    cases = caseService.GetAll();
                }
                else
                {
                    cases = caseService.Query(0, caselist);
                }
            }
            else
            {
                int proid = (int)loginuser.relation.Proid;
                projects  = projectService.QueryById(proid);
                plans     = planService.QueryByProid(proid);
                units     = unitService.QueryByProid(proid);
                relations = relationService.QueryByProid(proid);
                if (caselist.Pid > 0)
                {
                    cases = caseService.QueryByPid((int)caselist.Pid);
                }
                else if (caselist.Unid > 0)
                {
                    cases = caseService.QueryByUnid((int)caselist.Unid);
                }
                else if (caselist.State != null)
                {
                    cases = caseService.QueryByState(caselist.State);
                }
                else if (caselist.Name != null)
                {
                    cases = caseService.QueryByName(loginuser.relation.Name);
                }
                else if (caselist.Toname != null)
                {
                    cases = caseService.QueryByToName(loginuser.relation.Name);
                }
                else if (caselist.Ctitle == null)
                {
                    cases = caseService.QueryByProid(proid);
                }
                else
                {
                    cases = caseService.Query(proid, caselist);
                }
            }
            ViewData["projects"]  = projects;
            ViewData["plans"]     = plans;
            ViewData["units"]     = units;
            ViewData["relations"] = relations;
            ViewData["cases"]     = cases;
            return(View());
        }