Example #1
0
        public ActionResult Edit(Project project, string CMStaff, string PMStaff, string PDEStaff, string SEStaff, string QEStaff, string DRStaff)
        {
            _repositoryProject  = new RepositoryProject();
            _repositoryCustomer = new RepositoryCustomer();
            int projectoldid = Convert.ToInt32(ViewBag.projectidold);

            var projectedit = _repositoryProject.GetProjectByProjectId(project.ProjectID, p => p.ProjectStaffs);

            projectedit.ProjectStaffs.CMStaff  = CMStaff;
            projectedit.ProjectStaffs.PMStaff  = PMStaff;
            projectedit.ProjectStaffs.PDEStaff = PDEStaff;
            projectedit.ProjectStaffs.SEStaff  = SEStaff;
            projectedit.ProjectStaffs.QEStaff  = QEStaff;
            projectedit.ProjectStaffs.DRStaff  = DRStaff;
            projectedit.ProjectID  = project.ProjectID;
            projectedit.Status     = project.Status;
            projectedit.CustomerId = project.CustomerId;

            projectedit.ProjectStatus = Status.Modify;



            if (ModelState.IsValid)
            {
                projectedit.ProjectStatus = Status.Modify;
                OperationStatus ops = _repositoryProject.SaveProject(projectedit);
                if (ops.Status)
                {
                    return(RedirectToAction("ProjectList", new { PMStaff = PMStaff }));
                }
                else
                {
                    ModelState.AddModelError("", ops.ExceptionInnerMessage);
                }
            }
            var listcustomer = _repositoryCustomer.GetListcustomer();

            _repositoryStaff = new RepositoryStaff();
            loadStaf();
            ViewBag.CustomerId = new SelectList(listcustomer, "CustomerId", "CustomerName");

            return(View());
        }
Example #2
0
        public ActionResult CreateProject(Project project, string CMStaff, string PMStaff, string PDEStaff, string SEStaff, string QEStaff, string DRStaff)
        {
            _repositoryProject    = new RepositoryProject();
            _repositoryCustomer   = new RepositoryCustomer();
            project.ProjectStaffs = new ProjectStaff();

            //int projectid = project.ProjectID;

            project.ProjectStaffs.CMStaff  = CMStaff;
            project.ProjectStaffs.PMStaff  = PMStaff;
            project.ProjectStaffs.PDEStaff = PDEStaff;
            project.ProjectStaffs.SEStaff  = SEStaff;
            project.ProjectStaffs.QEStaff  = QEStaff;
            project.ProjectStaffs.DRStaff  = DRStaff;
            //project.ProjectStaffs.ProjectId = projectid;

            project.Create = DateTime.Now;

            var listcustomer = _repositoryCustomer.GetListcustomer();


            if (ModelState.IsValid)
            {
                project.ProjectStatus = Status.Add;
                OperationStatus ops = _repositoryProject.SaveProject(project);
                if (ops.Status)
                {
                    return(RedirectToAction("ProjectList"));
                }
                else
                {
                    ModelState.AddModelError("", ops.ExceptionInnerMessage);
                }
            }

            _repositoryStaff = new RepositoryStaff();
            loadStaf();
            ViewBag.CustomerId = new SelectList(listcustomer, "CustomerId", "CustomerName");

            return(View());
        }