Exemplo n.º 1
0
        public ActionResult EditResearchGroup(EditResearchGroupBindingModel model)
        {
            //validation of model that collegeid and educationalgroup should be required
            if (!ModelState.IsValid)
            {
                ViewBag.ModelState = ModelState;
            }
            //if model is valid
            else
            {
                var result = ResearchGroupManager.Update(model);
                switch (result)
                {
                case ResearchGroupManager.researchgroupcreatestatus.failed:
                    ViewBag.Failed = Fa.Error;
                    break;

                case ResearchGroupManager.researchgroupcreatestatus.duplicate:
                    ViewBag.Duplicate = Fa.DuplicateResearchGroup;
                    break;

                default:
                    return(RedirectToAction("Index"));
                }
            }
            var colleges = CollegeManager.List();

            ViewBag.College          = colleges;
            ViewBag.EducationalGroup = EducationalGroupManager.FindByCollegeId(model.CollegeId.Value);
            return(View(model));
        }
Exemplo n.º 2
0
        public ActionResult EditResearchGroup(int id)
        {
            var researchgroup = ResearchGroupManager.Find(id);

            if (researchgroup != null)
            {
                var set = new EditResearchGroupBindingModel
                {
                    Name               = researchgroup.Name,
                    CollegeId          = researchgroup.CollegeId,
                    EducationalGroupId = researchgroup.EducationalGroupId,
                };
                var colleges = CollegeManager.List();
                ViewBag.College          = colleges;
                ViewBag.EducationalGroup = EducationalGroupManager.FindByCollegeId(researchgroup.CollegeId);
                return(View(set));
            }
            return(RedirectToAction("Index"));
        }
Exemplo n.º 3
0
        public ActionResult CreateProject(CreateProjectBindingModel model)
        {
            if (!ModelState.IsValid)
            {
                ViewBag.ModelState = ModelState;
            }
            else
            {
                var result = ProjectManager.Create(model);
                switch (result)
                {
                case ProjectManager.createprojectstatus.failed:
                    ViewBag.Failed = Fa.Error;
                    break;

                case ProjectManager.createprojectstatus.duplicate:
                    ViewBag.Duplicate = Fa.DuplicateExecuter;
                    break;

                default:
                    return(RedirectToAction("Index"));
                }
            }
            ViewBag.Employers = EmployerManager.List();
            var colleges = CollegeManager.List();

            ViewBag.College       = colleges;
            ViewBag.ResearchGroup = ResearchGroupManager.List();
            if (colleges.Count > 0)
            {
                var educationalgroup = EducationalGroupManager.FindByCollegeId(colleges.FirstOrDefault().Id);
                ViewBag.EducationalGroup = educationalgroup;
                ViewBag.Executer         = ExecuterManager.FindByCollegeId(colleges.FirstOrDefault().Id);
            }
            else
            {
                ViewBag.EducationalGroup = new List <EducationalGroupModel>();
                ViewBag.Executer         = new List <ExecuterModel>();
            }
            ViewBag.ResearchGroup = ResearchGroupManager.List();
            return(View(model));
        }
Exemplo n.º 4
0
        public ActionResult CreateProject()
        {
            ViewBag.Employers = EmployerManager.List();
            var colleges = CollegeManager.List();

            ViewBag.College       = colleges;
            ViewBag.ResearchGroup = ResearchGroupManager.List();
            if (colleges.Count > 0)
            {
                var educationalgroup = EducationalGroupManager.FindByCollegeId(colleges.FirstOrDefault().Id);
                ViewBag.EducationalGroup = educationalgroup;
                ViewBag.Executer         = ExecuterManager.FindByCollegeId(colleges.FirstOrDefault().Id);
            }
            else
            {
                ViewBag.EducationalGroup = new List <EducationalGroupModel>();
                ViewBag.Executer         = new List <ExecuterModel>();
            }
            ViewBag.ResearchGroup = ResearchGroupManager.List();
            return(View());
        }
Exemplo n.º 5
0
        public ActionResult EditProject(int id)
        {
            var project = ProjectManager.Find(id);

            if (project != null)
            {
                var set = new EditProjectBindingModel
                {
                    ProjectId               = project.ProjectId,
                    Title                   = project.Title,
                    EmployerId              = project.EmployerId,
                    CollegeId               = project.CollegeId,
                    EducationalGroupId      = project.EducationalGroupId,
                    ExecuterId              = project.ExecuterId,
                    ResearchGroupId         = project.ResearchGroupId,
                    Price                   = project.Price,
                    OverHeadPrice           = project.OverHeadPrice,
                    ReceivePrice            = project.ReceivePrice,
                    RemainPrice             = project.RemainPrice,
                    PaymentPrice            = project.PaymentPrice,
                    MainContractId          = project.MainContractId,
                    MainContractDateStr     = Utility.DateToString(project.MainContractDate),
                    InternalContractId      = project.MainContractId,
                    InternalContractDateStr = Utility.DateToString(project.InternalContractDate),
                    ProjectEndDateStr       = Utility.DateToString(project.ProjectEndDate),
                    PhasesNum               = project.PhasesNum,
                    ProjectStatus           = project.ProjectStatus,
                    ProjectType             = project.ProjectType,
                    Explain                 = project.Explain,
                };
                var colleges = CollegeManager.List();
                ViewBag.College          = colleges;
                ViewBag.EducationalGroup = EducationalGroupManager.FindByCollegeId(project.CollegeId);
                ViewBag.ResearchGroup    = ResearchGroupManager.List();
                ViewBag.Employers        = EmployerManager.List();
                ViewBag.Executer         = ExecuterManager.FindByCollegeId(project.CollegeId);
                return(View(set));
            }
            return(RedirectToAction("Index"));
        }
Exemplo n.º 6
0
        public ActionResult CreateResearchGroup(CreateResearchGroupBindingModel model)
        {
            //validation of model that collegeid and educationalgroup should be required
            if (!ModelState.IsValid)
            {
                ViewBag.ModelState = ModelState;
            }
            //if model is valid
            else
            {
                var result = ResearchGroupManager.Create(model);
                switch (result)
                {
                case ResearchGroupManager.researchgroupcreatestatus.failed:
                    ViewBag.Failed = Fa.Error;
                    break;

                case ResearchGroupManager.researchgroupcreatestatus.duplicate:
                    ViewBag.Duplicate = Fa.DuplicateEducationalGroup;
                    break;

                default:
                    return(RedirectToAction("Index"));
                }
            }
            //if researchgroupcreatestatus was failed or duplicate or modelstate is invalid should assign viewbags
            var colleges = CollegeManager.List();

            ViewBag.College = colleges;
            if (colleges.Count > 0)
            {
                ViewBag.EducationalGroup = EducationalGroupManager.FindByCollegeId(colleges.FirstOrDefault().Id);
            }
            else
            {
                ViewBag.EducationalGroup = new List <EducationalGroupModel>();
            }
            return(View(model));
        }
Exemplo n.º 7
0
        public ActionResult ProjectInfo(int id)
        {
            var project = ProjectManager.Find(id);

            if (project != null)
            {
                var set = new ProjectViewModel
                {
                    Title                = project.Title,
                    ProjectId            = project.ProjectId,
                    Price                = project.Price,
                    OverHeadPrice        = project.OverHeadPrice,
                    ReceivePrice         = project.ReceivePrice,
                    RemainPrice          = project.RemainPrice,
                    PaymentPrice         = project.PaymentPrice,
                    MainContractId       = project.MainContractId,
                    MainContractDate     = Utility.DateToString(project.MainContractDate),
                    InternalContractId   = project.MainContractId,
                    InternalContractDate = Utility.DateToString(project.InternalContractDate),
                    ProjectEndDate       = Utility.DateToString(project.ProjectEndDate),
                    PhasesNum            = project.PhasesNum,
                    ProjectStatus        = project.ProjectStatus,
                    ProjectType          = project.ProjectType,
                    Explain              = project.Explain,
                    Id = project.Id,
                };
                set.Employer = EmployerManager.Find(project.EmployerId).Name;
                var executer = ExecuterManager.FindExecuter(project.ExecuterId);
                set.Executer         = executer.FirstName + " " + executer.LastName;
                set.College          = CollegeManager.Find(project.CollegeId).Name;
                set.EducationalGroup = EducationalGroupManager.Find(project.EducationalGroupId).Name;
                set.ResearchGroup    = ResearchGroupManager.Find(project.ResearchGroupId).Name;
                ViewBag.ProjectInfo  = set;
                return(View());
            }
            return(RedirectToAction("Error"));
        }
Exemplo n.º 8
0
        //show list of researchgroups
        // GET: ResearchGroup
        public ActionResult Index()
        {
            var researchgroups = ResearchGroupManager.List().OrderBy(t => t.College).ThenBy(t => t.EducationalGroup).ToList();

            return(View(researchgroups));
        }
Exemplo n.º 9
0
 public ActionResult DeleteResearchGroup(int id)
 {
     ResearchGroupManager.Delete(id);
     return(RedirectToAction("Index"));
 }