Ejemplo n.º 1
0
        //public ActionResult CapBook()
        //{
        //    ManageCapBookModel model = new ManageCapBookModel();
        //    model.PersonalSummary = new DataTableModel(1, (IQueryable)service.GetVwTLCSummaryQueryable());

        //    Session["ManageCapBookModel"] = model;
        //    ViewData["SelectedCapBookPersonalId"] = (long)0;

        //    return View(model);
        //}
        public ActionResult CapBookPartial(Nullable <long> PersonalId)
        {
            ManageCapBookModel model = (ManageCapBookModel)Session["ManageCapBookModel"];

            if (PersonalId != null)
            {
                ViewData["SelectedCapBookPersonalId"] = (long)PersonalId;
                model.SelectedPersonnelId             = (long)PersonalId;
                TLC_PersonalSummaryModel ps = model.PersonalSummary.GetItem(PersonalId);
                if (ps != null)
                {
                    model.Passport = ps.EnscoPassportNo;
                }
            }

            IQueryable <CAP_CompetencyAssessModel> compItems = service.GetCompAssessQueryable(model.Passport, null);

            compItems = compItems.OrderBy(x => x.Title);

            model.Competency = new DataTableModel(2, compItems);
            if (model.Passport != null && model.SelectedPersonnelId != 0)
            {
                model.CapBooks      = service.GetCAPBookQueryable().Where(x => x.EnscoPassportNo == model.Passport);
                model.KSAs          = new DataTableModel(3, model.CapBooks.Where(x => x.CompId == (long)0));
                model.Additional    = new DataTableModel(3, model.CapBooks.Where(x => x.CompId == (long)0));
                model.Expired       = new DataTableModel(3, model.CapBooks.Where(x => x.CompId == (long)0));
                model.AssessorGuide = new DataTableModel(3, model.CapBooks.Where(x => x.CompId == (long)0));

                int count = model.KSAs.Dataset.Count();
            }

            return(PartialView("CapBookPartial", model));
        }
Ejemplo n.º 2
0
        public ActionResult CapBookReport(string passportId)
        {
            CAP_BookReportModel model = new CAP_BookReportModel();

            model.CapBookEnscoLogo = HttpContext.Server.MapPath("~/Images/CapEnscoLogo.png");
            model.CapBookImage1    = HttpContext.Server.MapPath("~/Images/CapBook1.png");
            model.CapBookImage2    = HttpContext.Server.MapPath("~/Images/CapBook2.png");
            model.CapBookTlcLogo   = HttpContext.Server.MapPath("~/Images/TlcLogo.png");

            model.CapBookPage1  = HttpContext.Server.MapPath("~/Images/CapBookPage1.png");
            model.CapBookPage2  = HttpContext.Server.MapPath("~/Images/CapBookPage2.png");
            model.CapBookPage3  = HttpContext.Server.MapPath("~/Images/CapBookPage3.png");
            model.CapBookPage4  = HttpContext.Server.MapPath("~/Images/CapBookPage4.png");
            model.CapBookPage5  = HttpContext.Server.MapPath("~/Images/CapBookPage5.png");
            model.CapBookPage6  = HttpContext.Server.MapPath("~/Images/CapBookPage6.png");
            model.CapBookPage7  = HttpContext.Server.MapPath("~/Images/CapBookPage7.png");
            model.CapBookPage8  = HttpContext.Server.MapPath("~/Images/CapBookPage8.png");
            model.CapBookPage9  = HttpContext.Server.MapPath("~/Images/CapBookPage9.png");
            model.CapBookPage10 = HttpContext.Server.MapPath("~/Images/CapBookPage10.png");

            // Get User Information
            LookupListModel <dynamic> lkpPosition = LookupListSystem.GetLookupList("Position");
            LookupListModel <dynamic> lkpDept     = LookupListSystem.GetLookupList("Department");
            LookupListModel <dynamic> lkpBU       = LookupListSystem.GetLookupList("BusinessUnit");

            UserModel user = ServiceSystem.GetUserFromPassport(passportId);

            model.Passport     = passportId;
            model.Name         = user.DisplayName;
            model.Position     = (string)lkpPosition.GetDisplayValue(user.Position);
            model.Department   = (string)lkpPosition.GetDisplayValue(user.Department);
            model.BusinessUnit = (string)lkpPosition.GetDisplayValue(user.BusinessUnit);
            model.RigFacility  = UtilitySystem.Settings.RigName;
            if (user.Manager != null)
            {
                UserModel manager = ServiceSystem.GetUser((int)user.Manager);
                if (manager != null)
                {
                    model.Supervisor = manager.DisplayName;
                }
            }
            model.OIM = IrmaServiceSystem.GetAdminCustomValue("OIMName");

            CapBookReport report = new CapBookReport();

            RigCapService RigCapService             = new RigCapService();
            IQueryable <CAP_BookModel> capBookItems = RigCapService.GetCAPBookQueryable().Where(x => x.EnscoPassportNo == passportId).OrderBy(x => x.CompId);
            int           compNo   = 1;
            int           ksaNo    = 1;
            CAP_BookModel lastItem = null;

            foreach (CAP_BookModel item in capBookItems)
            {
                if (lastItem != null)
                {
                    if (lastItem.CompId != item.CompId)
                    {
                        compNo++;
                        ksaNo = 0;
                    }
                    ksaNo++;
                }
                item.CompetencyNumber = string.Format("{0}.0", compNo);
                item.KSANumber        = string.Format("{0}.{1}", compNo, ksaNo);

                model.Items.Add(item);

                lastItem = (lastItem == null || lastItem.CompId != item.CompId) ? item : lastItem;
            }
            List <CAP_BookReportModel> list = new List <CAP_BookReportModel>();

            list.Add(model);
            report.DataSource = list;

            Session["currentReport"] = report;

            return(RedirectToAction("ShowReport", "Report"));
        }