Пример #1
0
        //更新
        public IActionResult Update(ForCase forCase)
        {
            var casedetail = new Casedetail();
            var thecase    = new Thecase();

            foreach (PropertyInfo info in typeof(Thecase).GetProperties())
            {
                PropertyInfo pro = typeof(ForCase).GetProperty(info.Name);
                if (pro != null)
                {
                    info.SetValue(thecase, pro.GetValue(forCase));
                }
            }
            foreach (PropertyInfo info in typeof(Casedetail).GetProperties())
            {
                PropertyInfo pro = typeof(ForCase).GetProperty(info.Name);
                if (pro != null)
                {
                    info.SetValue(casedetail, pro.GetValue(forCase));
                }
            }
            thecase.Uid    = caseService.ShowDetail(forCase.Cid).Uid;
            thecase.Toname = relationService.ShowDetail(forCase.Uid2).Name;
            casedetail.Uid = forCase.Uid2;
            caseService.Update(thecase);
            detailservice.Update(casedetail);
            return(Redirect(Url.Action("Detail", "_Case") + $"?cid={forCase.Cid}"));
        }
Пример #2
0
        public IActionResult Detail(ForCase forcase)
        {
            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;

            if (loginuser.relation.Eid == 1)
            {
                plans     = planService.GetAll();
                projects  = projectService.GetAll();
                units     = unitService.GetAll();
                relations = relationService.GetAll();
            }
            else
            {
                int proid = (int)loginuser.relation.Proid;
                projects  = projectService.QueryById(proid);
                plans     = planService.QueryByProid(proid);
                units     = unitService.QueryByProid(proid);
                relations = relationService.QueryByProid(proid);
            }
            ViewData["projects"]  = projects;
            ViewData["plans"]     = plans;
            ViewData["units"]     = units;
            ViewData["relations"] = relations;
            //
            var thecase    = caseService.ShowDetail(forcase.Cid);
            var casedetail = detailservice.ShowDetail(forcase.Cid);

            forcase.Ctitle  = thecase.Ctitle;
            forcase.Detail  = casedetail.Detail;
            forcase.Proid   = thecase.Proid;
            forcase.Proname = projectService.ShowDetail((int)thecase.Proid).Proname;
            forcase.Pid     = thecase.Pid;
            if (thecase.Pid != null)
            {
                forcase.Pname = planService.Show((int)thecase.Pid).Pname;
            }
            forcase.Unid = thecase.Unid;
            if (thecase.Unid != null)
            {
                forcase.UnName = unitService.ShowDetail((int)thecase.Unid).UnName;
            }
            forcase.Uid        = thecase.Uid;
            forcase.Uid2       = casedetail.Uid;
            forcase.State      = thecase.State;
            forcase.Name       = thecase.Name;
            forcase.Toname     = thecase.Toname;
            forcase.Prior      = casedetail.Prior;
            forcase.Detail     = casedetail.Detail;
            forcase.Previous   = casedetail.Previous;
            forcase.Result     = casedetail.Result;
            forcase.ModifyDate = casedetail.ModifyDate;
            return(View(forcase));
        }
Пример #3
0
        public IActionResult Del(ForCase forCase)
        {
            var count = caseService.Del(forCase.Cid);

            if (count > 0)
            {
                detailservice.Del(forCase.Cid);
            }
            return(Redirect(Url.Action("Index", "_Thecase")));
        }
Пример #4
0
        public IActionResult RunCase(ForCase forCase)
        {
            var thecase    = caseService.ShowDetail(forCase.Cid);
            var casedetail = detailservice.ShowDetail(forCase.Cid);

            thecase.State     = forCase.State;
            casedetail.Result = forCase.Result;
            caseService.Update(thecase);
            detailservice.Update(casedetail);
            return(Redirect(Url.Action("Index", "_Case")));
            //else
        }
Пример #5
0
        public IActionResult Create(ForCase forCase)
        {
            int count      = 0;
            var casedetail = new Casedetail()
            {
                Uid        = forCase.Uid2,
                ModifyDate = DateTime.Now,
                Prior      = forCase.Prior,
                Detail     = forCase.Detail,
                Previous   = forCase.Previous,
            };
            var cid = detailservice.Create(casedetail);

            if (cid > 0)
            {
                var  json      = HttpContext.Request.Cookies["user"];
                User loginuser = JsonConvert.DeserializeObject <User>(json);
                var  thecase   = new Thecase()
                {
                    Cid    = cid,
                    Uid    = loginuser.detail.Uid,
                    Pid    = forCase.Pid,
                    Unid   = forCase.Unid,
                    Proid  = loginuser.relation.Proid,
                    Ctitle = forCase.Ctitle,
                    Name   = loginuser.detail.Uname,
                    State  = "enable",
                    Toname = relationService.ShowDetail(forCase.Uid2).Name,
                };
                count = caseService.Create(thecase);
                if (count == 0)
                {
                    detailservice.Del(cid);
                }
            }
            return(Redirect(Url.Action("Index", "_Case")));
            //else
        }