예제 #1
0
 public ProjectManagement()
 {
     projectRepository = new RepositoryProject();
     accoutM           = new RepositoryAccount();
     taskManagement    = new TaskManagement();
     configSystenm     = new RepositoryConfig();
 }
예제 #2
0
        public ActionResult Edit(ProjectEng.Models.Task task, string pMStaff)
        {
            _repositorytask    = new RepositoryTask();
            _repositoryproject = new RepositoryProject();

            if (ModelState.IsValid)
            {
                //task.Create = DateTime.Now;
                OperationStatus ops = _repositorytask.SaveTask(task);
                if (!ops.Status)
                {
                    ModelState.AddModelError("", ops.ExceptionInnerMessage);
                }
                else
                {
                    ModelState.AddModelError("", "Data Save!!");
                }
            }
            var listproject = _repositoryproject.GetListProject("");

            ViewBag.ProjectId = new SelectList(listproject, "ProjectId", "Description");

            ViewBag.ProjectId = task.ProjectID;
            ViewBag.PMStaff   = pMStaff;
            loadPMStaff("ALL");
            return(RedirectToAction("ProjectList", "Project", new { ProjectId = task.ProjectID, PMStaff = pMStaff }));
        }
예제 #3
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));
        }
예제 #4
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());
        }
예제 #5
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());
        }
예제 #6
0
        public ActionResult DashboardToPdf(string page)
        {
            _repositoryProject = new RepositoryProject();
            var sortparam   = "ProjectID";
            var statuspaged = "A";
            var pagednumber = 1;
            var pagetotal   = int.Parse(page);

            var model = _repositoryProject.GetListProject(sortparam, statuspaged, pagednumber, pagetotal, p => p.Customers, p => p.ProjectStaffs);

            return(new PartialViewAsPdf("_DashboardPdf", model)
            {
                FileName = "_DashboardPdf.pdf",
                PageSize = Size.Letter,
                PageOrientation = Orientation.Portrait,
                MinimumFontSize = 14,
                PageMargins = { Top = 20, Bottom = 10 },
                PageHeight = 40,
                CustomSwitches =
                    "--footer-center \"Name: " + "_DashboardPdf" + "  DOS: " +
                    DateTime.Now.Date.ToString("MM/dd/yyyy") + "  Page: [page]/[toPage]\"" +
                    " --footer-line --footer-font-size \"9\" --footer-spacing 6 --footer-font-name \"calibri light\""
            });
        }
예제 #7
0
        public ActionResult Index(string sortparam, string PMStaff, string Status, string customeridpage, string pMStaffpage, string statuspage, int?page, int customerid = -1)
        {
            _repositoryProject  = new RepositoryProject();
            _repositoryCustomer = new RepositoryCustomer();

            loadCustomer();
            loadPMStaff();

            ViewBag.Customeridpage = customeridpage ?? customerid.ToString();
            ViewBag.PMStaffpage    = pMStaffpage ?? PMStaff;
            ViewBag.sortCode       = string.IsNullOrEmpty(sortparam) ? "ProjectID" : "";
            ViewBag.CustomerName   = string.IsNullOrEmpty(sortparam) ? "CustomerName" : "";

            var statuspaged = Status ?? "A";

            ViewBag.Statuspage    = statuspage ?? statuspaged;
            ViewBag.CurrentFilter = sortparam;

            var pagednumber = page ?? 1;

            if (string.IsNullOrEmpty(PMStaff) && string.IsNullOrEmpty(pMStaffpage))
            {
                var list = _repositoryProject.GetListProject(sortparam, statuspaged, pagednumber, pagedcount, p => p.Customers, p => p.ProjectStaffs);
                return(View(list));
            }
            else
            {
                if (customerid != -1)
                {
                    if (!PMStaff.Equals("ALL"))
                    {
                        customerid = customerid != -1? customerid : int.Parse(customeridpage);
                        PMStaff    = pMStaffpage;
                        Status     = statuspage;

                        var list = _repositoryProject.GetListProjectByCustomerId(sortparam, customerid, PMStaff, statuspaged, pagednumber, pagedcount, p => p.Customers, p => p.ProjectStaffs);

                        return(View(list));
                    }
                    else
                    {
                        customerid = customerid != -1 ? customerid : int.Parse(customeridpage);
                        Status     = statuspage;
                        var list = _repositoryProject.GetListProjectByCustomerId(sortparam, customerid, statuspaged, pagednumber, pagedcount, p => p.Customers, p => p.ProjectStaffs);
                        return(View(list));
                    }
                }

                PMStaff = pMStaffpage ?? PMStaff;
                if (PMStaff.Equals("ALL"))
                {
                    Status = statuspage;
                    var list = _repositoryProject.GetListProject(sortparam, statuspaged, pagednumber, pagedcount, p => p.Customers, p => p.ProjectStaffs);
                    return(View(list));
                }
                else
                {
                    Status = statuspage;
                    var list = _repositoryProject.GetListProjectByPM(sortparam, PMStaff, statuspaged, pagednumber, pagedcount, p => p.Customers, p => p.ProjectStaffs);
                    return(View(list));
                }
            }

            return(View());
        }