Exemplo n.º 1
0
        // GET: Customer
        public ActionResult CustomerList()
        {
            _repositorycustomer = new RepositoryCustomer();
            var list = _repositorycustomer.GetListcustomer();

            return(View(list));
        }
Exemplo n.º 2
0
        private void loadCustomer()
        {
            var listcustomer = _repositoryCustomer.GetListcustomer();

            listcustomer.Add(new Customer {
                CustomerId = -1, CustomerName = "ALL"
            });
            ViewBag.CustomerId = new SelectList(listcustomer, "CustomerId", "CustomerName", -1);
        }
Exemplo n.º 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());
        }
Exemplo n.º 4
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));
        }
Exemplo n.º 5
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());
        }
Exemplo n.º 6
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());
        }