コード例 #1
0
        private void loadPMStaff(string staffname)
        {
            _repositoryStaff = new RepositoryStaff();
            var liststaff = _repositoryStaff.GetListStaff();

            ViewBag.Responsable = new SelectList(liststaff, "StaffName", "StaffName", staffname);
        }
コード例 #2
0
        private void loadPMStaff(string stafn)
        {
            _repositoryStaff = new RepositoryStaff();
            var liststaff = _repositoryStaff.GetListStaff();

            List <StatusPaged> liststatus = new List <StatusPaged>();

            liststatus.Add(new StatusPaged {
                Status = "A"
            });
            liststatus.Add(new StatusPaged {
                Status = "C"
            });
            liststatus.Add(new StatusPaged {
                Status = "H"
            });

            liststaff.Add(new Staff {
                StaffId = -1, StaffName = "ALL", StaffPosition = "ALL"
            });

            var staffname = stafn;

            if (staffname != null)
            {
                ViewBag.PMStaff = new SelectList(liststaff, "StaffName", "StaffName", staffname);
            }
            else
            {
                ViewBag.PMStaff = new SelectList(liststaff, "StaffName", "StaffName", "ALL");
            }

            ViewBag.Status = new SelectList(liststatus, "Status", "Status", "A");
        }
コード例 #3
0
        public ActionResult CreateProject()
        {
            _repositoryCustomer = new RepositoryCustomer();
            _repositoryStaff    = new RepositoryStaff();
            var listcustomer = _repositoryCustomer.GetListcustomer();

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

            loadStaf();

            return(View());
        }
コード例 #4
0
 public ActionResult CreateStaff(Staff staff)
 {
     if (ModelState.IsValid)
     {
         _repositoryStaff = new RepositoryStaff();
         var ops = _repositoryStaff.saveStaff(staff);
         if (ops.Status)
         {
             return(RedirectToAction("ProjectList", "Project"));
         }
         else
         {
             ModelState.AddModelError("", ops.ExceptionInnerMessage);
         }
     }
     return(View());
 }
コード例 #5
0
        public ActionResult Edit(int id)
        {
            _repositoryCustomer = new RepositoryCustomer();
            _repositoryProject  = new RepositoryProject();
            _repositoryStaff    = new RepositoryStaff();

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



            var listcustomer = _repositoryCustomer.GetListcustomer();

            ViewBag.CustomerId = new SelectList(listcustomer, "CustomerId", "CustomerName", project.CustomerId);

            loadStafEdit(project);
            return(View(project));
        }
コード例 #6
0
        public JsonResult AddStaffAsync(string staffname, string staffdescription)
        {
            _repositoryStaff = new RepositoryStaff();
            Staff addstaff = new Staff();

            addstaff.StaffName     = staffname;
            addstaff.StaffPosition = staffdescription;

            OperationStatus ops = _repositoryStaff.saveStaff(addstaff);

            if (ops.Status)
            {
                return(Json(new { StaffId = addstaff.StaffId, StaffName = addstaff.StaffName }, JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json(new ArgumentException(ops.ExceptionInnerMessage), JsonRequestBehavior.AllowGet));
            }
        }
コード例 #7
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());
        }
コード例 #8
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());
        }
コード例 #9
0
        private void loadPMStaff()
        {
            _repositoryStaff = new RepositoryStaff();
            var liststaff = _repositoryStaff.GetListStaff();

            List <StatusPaged> liststatus = new List <StatusPaged>();

            liststatus.Add(new StatusPaged {
                Status = "A"
            });
            liststatus.Add(new StatusPaged {
                Status = "C"
            });
            liststatus.Add(new StatusPaged {
                Status = "H"
            });

            liststaff.Add(new Staff {
                StaffId = -1, StaffName = "ALL", StaffPosition = "ALL"
            });

            ViewBag.PMStaff = new SelectList(liststaff, "StaffName", "StaffName", "ALL");
            ViewBag.Status  = new SelectList(liststatus, "Status", "Status", "A");
        }