Example #1
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 }));
        }
Example #2
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\""
            });
        }
Example #3
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());
        }