public ActionResult SaveActivation(JobActivationChecklist model)
        {
            string errors = String.Empty;

            try
            {
                if (ModelState.IsValid)
                {
                    var result = ChecklistDal.saveJobActivation(model);
                    if (result > 0)
                    {
                        Session["PRJID"]   = model.PRJID;
                        model.recordExists = new Guid().ToString();
                        LoadActivationLookup(model);

                        return(View("index", model));
                    }
                }
                else
                {
                    errors = GetModelError(errors);
                }
                LoadActivationLookup(model);
                return(View("index", model));
            }
            catch (Exception ex)
            {
                ModelState.AddModelError(String.Empty, ex.Message + BusinessConstants.contactAdmin);
                LoadActivationLookup(model);
                return(RedirectToAction("error"));
            }
        }
        public ActionResult JobChecklist(string PRJID)
        {
            int ProjectHeaderID = 0;

            if (!string.IsNullOrWhiteSpace(PRJID) && Int32.TryParse(PRJID, out ProjectHeaderID))
            {
                Session["PRJID"] = ProjectHeaderID;
            }
            if (Session["PRJID"] != null)
            {
                ViewBag.Title = string.Format("{0}", Session["PRJID"]);
                var model = new JobActivationChecklist();
                if (ProjectHeaderID > 0)
                {
                    model.PRJID = ProjectHeaderID;
                    model       = ChecklistDal.getProjectActivationDetails(model);
                    LoadActivationLookup(model);
                }

                return(View("index", model));
            }
            else
            {
                return(RedirectToAction("error", new Exception("Data Not Found")));
            }
        }
Example #3
0
        public static JobActivationChecklist JobActivationLookup(JobActivationChecklist objActivation)
        {
            try
            {
                var resultSet = SqlHelper.ExecuteDataset(_myConnection, CommandType.StoredProcedure,
                                                         "spATL_PRJ_JobActChkLst_LkUp",
                                                         new SqlParameter("@PRJID", objActivation.PRJID));

                objActivation.ListCustomersTypes = new List <DOC08_CustomerType>();
                foreach (DataRow item in resultSet.Tables[0].Rows)
                {
                    var customer = new DOC08_CustomerType();
                    customer.CustomerTypeID = Convert.ToInt32(item["CustomerTypeId"]);
                    customer.Description    = Convert.ToString(item["Description"]);
                    objActivation.ListCustomersTypes.Add(customer);
                }

                objActivation.ListJobTypes = new List <DOC09_JobTypes>();
                foreach (DataRow item in resultSet.Tables[1].Rows)
                {
                    var jobType = new DOC09_JobTypes();
                    jobType.JobTypeId   = Convert.ToInt32(item["JobTypeId"]);
                    jobType.JobTypeDesc = Convert.ToString(item["JobTypeDesc"]);
                    objActivation.ListJobTypes.Add(jobType);
                }

                objActivation.ListResponses = new List <DOC10_Responses>();
                foreach (DataRow item in resultSet.Tables[2].Rows)
                {
                    var response = new DOC10_Responses();
                    response.ResponseId = Convert.ToInt32(item["ResponseId"]);
                    response.Response   = Convert.ToString(item["Response"]);
                    objActivation.ListResponses.Add(response);
                }

                objActivation.ListLabourTypes = new List <SYS10_MhRates>();
                foreach (DataRow item in resultSet.Tables[3].Rows)
                {
                    var labourType = new SYS10_MhRates();
                    labourType.MhRateId   = Convert.ToString(item["MhRateId"]);
                    labourType.MhRateName = Convert.ToString(item["MhRateName"]);
                    objActivation.ListLabourTypes.Add(labourType);
                }

                objActivation.ListUsers = new List <Sys_UsersData>();
                foreach (DataRow item in resultSet.Tables[4].Rows)
                {
                    var usersData = new Sys_UsersData();
                    usersData.UserId = Convert.ToInt32(item["UserId"]);
                    usersData.Name   = Convert.ToString(item["Name"]);
                    objActivation.ListUsers.Add(usersData);
                }

                foreach (DataRow item in resultSet.Tables[5].Rows)
                {
                    objActivation.PRJID = Convert.ToInt32(item["ProjectHeaderId"]);
                    objActivation.projectInformation.JobNumber                   = Convert.ToString(item["Atlas_Job_Number"]);
                    objActivation.projectInformation.CompanyName                 = Convert.ToString(item["Atlas_Company_Name"]);
                    objActivation.projectInformation.CustomerProfile             = new Profile();
                    objActivation.projectInformation.CustomerProfile.Name        = Convert.ToString(item["Contractor_Name"]);
                    objActivation.projectInformation.CustomerProfile.Address     = Convert.ToString(item["Contractor_Address"]);
                    objActivation.projectInformation.CustomerProfile.City        = Convert.ToString(item["Contractor_City"]);
                    objActivation.projectInformation.CustomerProfile.State       = Convert.ToString(item["Contractor_State"]);
                    objActivation.projectInformation.CustomerProfile.Zip         = Convert.ToString(item["Contractor_Zip"]);
                    objActivation.projectInformation.CustomerProfile.PhoneNumber = Convert.ToString(item["Contractor_Phone"]);
                    //TODO: Check Ext, Contact
                    //objActivation.projectInformation.CustomerProfile.Extension = Convert.ToString(item["Contractor_PhoneExt"]);
                    //objActivation.projectInformation.CustomerProfile.ContactName = Convert.ToString(item["Contractor_Contact"]);
                    objActivation.projectInformation.ProjectProfile             = new Profile();
                    objActivation.projectInformation.ProjectProfile.Name        = Convert.ToString(item["JobName"]);
                    objActivation.projectInformation.ProjectProfile.Address     = Convert.ToString(item["JobAddress"]);
                    objActivation.projectInformation.ProjectProfile.City        = Convert.ToString(item["JobCity"]);
                    objActivation.projectInformation.ProjectProfile.State       = Convert.ToString(item["JobState"]);
                    objActivation.projectInformation.ProjectProfile.Zip         = Convert.ToString(item["JobZip"]);
                    objActivation.projectInformation.ProjectProfile.PhoneNumber = Convert.ToString(item["JobPhone"]);
                    //TODO:
                    //objActivation.projectInformation.ProjectProfile.Extension = Convert.ToString(item["Job_PhoneExt"]);
                    objActivation.projectInformation.ProjectProfile.ContactName = Convert.ToString(item["JobContact"]);
                    objActivation.projectInformation.Estimator = Convert.ToString(item["EstimatorsName"]);
                }

                if (resultSet.Tables[5].Rows.Count == 0)
                {
                    objActivation.PRJID = 0;
                }
            }
            catch (Exception ex)
            {
                Logger.SaveErr(ex);
                throw ex;
            }
            return(objActivation);
        }
Example #4
0
        internal static int saveJobActivation(JobActivationChecklist model)
        {
            int result = 0;

            try
            {
                List <SqlParameter> parametersList = new List <SqlParameter>();
                parametersList.Add(new SqlParameter("@PRJID", model.PRJID));
                parametersList.Add(new SqlParameter("@CustomerTypeID", model.projectInformation.CustomerType));
                parametersList.Add(new SqlParameter("@JobTypeId", model.projectInformation.Jobtype));
                parametersList.Add(new SqlParameter("@CustomerBid_JobNum", model.projectInformation.CustomerBidReference));
                parametersList.Add(new SqlParameter("@Scope", model.projectInformation.ScopeWorkToBePerformed));
                parametersList.Add(new SqlParameter("@LabourType", model.projectInformation.TypeOfLabour));
                parametersList.Add(new SqlParameter("@Contract", model.contractPaperWork.CopyOfContractorPO));
                parametersList.Add(new SqlParameter("@ContractComments", model.contractPaperWork.CopyOfContractorPOComments));
                parametersList.Add(new SqlParameter("@ScopePhased", model.contractPaperWork.BrokenScopephases));
                parametersList.Add(new SqlParameter("@ScopePhasedComments", model.contractPaperWork.BrokenScopephasesComments));
                parametersList.Add(new SqlParameter("@BIRollups", model.contractPaperWork.BidRollUp));
                parametersList.Add(new SqlParameter("@BIRollupsComments", model.contractPaperWork.BidRollUpComments));
                parametersList.Add(new SqlParameter("@Packslip", model.contractPaperWork.PackCFSPIRollUp));
                parametersList.Add(new SqlParameter("@PackslipComments", model.contractPaperWork.PackCFSPIRollUpcomments));
                parametersList.Add(new SqlParameter("@Quotes", model.contractPaperWork.ApplicableQuote));
                parametersList.Add(new SqlParameter("@QuotesComments", model.contractPaperWork.ApplicableQuoteComments));
                parametersList.Add(new SqlParameter("@Drawings", model.contractPaperWork.DrawingConditions));
                parametersList.Add(new SqlParameter("@DrawingsComments", model.contractPaperWork.DrawingConditionsComments));
                parametersList.Add(new SqlParameter("@Photos", model.contractPaperWork.SitePhotos));
                parametersList.Add(new SqlParameter("@PhotoComments", model.contractPaperWork.SitePhotosComments));
                parametersList.Add(new SqlParameter("@HardCard", model.contractPaperWork.HardCard));
                parametersList.Add(new SqlParameter("@HardCardComments", model.contractPaperWork.HardCardComments));
                parametersList.Add(new SqlParameter("@PayEnvelope", model.contractPaperWork.PayEnvelope));
                parametersList.Add(new SqlParameter("@PayEnvelopeComments", model.contractPaperWork.PayEnvelopeComments));
                parametersList.Add(new SqlParameter("@Bonding", model.bondingInsurance.InsuranceCertification));
                parametersList.Add(new SqlParameter("@BondingComments", model.bondingInsurance.InsuranceCertificationComments));
                parametersList.Add(new SqlParameter("@SafetyOfficer", model.safetyRequirements.SafetyOfficer));
                parametersList.Add(new SqlParameter("@SafetyOfficerComments", model.safetyRequirements.SafetyOfficerComments));
                parametersList.Add(new SqlParameter("@PreStartSafetyMeeting", model.safetyRequirements.SafetyMeeting));
                parametersList.Add(new SqlParameter("@PreStartSafetyMeetingComments", model.safetyRequirements.SafetyMeetingComments));
                parametersList.Add(new SqlParameter("@DailySafetyMeetings", model.safetyRequirements.DailySafetyMeeting));
                parametersList.Add(new SqlParameter("@DailySafetyMeetingComments", model.safetyRequirements.DailySafetyMeetingComments));
                parametersList.Add(new SqlParameter("@PPE", model.safetyRequirements.PPENeeded));
                parametersList.Add(new SqlParameter("@PPEComments", model.safetyRequirements.PPENeededComments));
                parametersList.Add(new SqlParameter("@Fall", model.safetyRequirements.FallProtection));
                parametersList.Add(new SqlParameter("@FallComments", model.safetyRequirements.FallProtectionComments));
                parametersList.Add(new SqlParameter("@EquipCerts", model.safetyRequirements.EquipmentCertification));
                parametersList.Add(new SqlParameter("@EquipCertComments", model.safetyRequirements.EquipmentCertificationComments));
                parametersList.Add(new SqlParameter("@OtherHaz", model.safetyRequirements.OtherHazards));
                parametersList.Add(new SqlParameter("@OtherHazComments", model.safetyRequirements.OtherHazardsComments));
                parametersList.Add(new SqlParameter("@OtherComments", model.otherImportantFactors.OtherPertinentInformation));
                parametersList.Add(new SqlParameter("@ApprovedBy", Convert.ToInt32(model.ApprovedBy)));
                parametersList.Add(new SqlParameter("@DateCompleted", model.DateCompleted));
                parametersList.Add(new SqlParameter("@DateReviewed", model.DateReviewed));

                var id = SqlHelper.ExecuteNonQuery(_myConnection, CommandType.StoredProcedure, "spATL_PRJ_JobActChkLst_InsUpd",
                                                   parametersList.ToArray());
                result = (Convert.ToInt32(id) == -1) ? 1 : result;
            }
            catch (Exception ex)
            {
                Logger.SaveErr(ex);
            }
            return(result);
        }
Example #5
0
        internal static JobActivationChecklist getProjectActivationDetails(JobActivationChecklist objActivation)
        {
            try
            {
                var resultSet = SqlHelper.ExecuteDataset(_myConnection, CommandType.StoredProcedure,
                                                         "spATL_PRJ_JobActChkLst_GetDtls",
                                                         new SqlParameter("@PRJID", objActivation.PRJID));
                objActivation.projectInformation    = new ProjectInformation();
                objActivation.contractPaperWork     = new ContractPaperWork();
                objActivation.bondingInsurance      = new BondingInsurance();
                objActivation.safetyRequirements    = new SafetyRequirements();
                objActivation.otherImportantFactors = new OtherImportantFactors();
                foreach (DataRow item in resultSet.Tables[0].Rows)
                {
                    objActivation.recordExists = new Guid().ToString();
                    objActivation.projectInformation.CustomerType = Convert.ToString(item["CustomerTypeID"]);
                    objActivation.projectInformation.Jobtype      = Convert.ToString(item["JobTypeId"]);

                    objActivation.projectInformation.CustomerBidReference = Convert.ToString(item["CustomerBid_JobNum"]);

                    objActivation.projectInformation.ScopeWorkToBePerformed = Convert.ToString(item["Scope"]);
                    objActivation.projectInformation.TypeOfLabour           = Convert.ToString(item["LabourType"]);

                    objActivation.contractPaperWork.CopyOfContractorPO         = Convert.ToString(item["Contract"]);
                    objActivation.contractPaperWork.CopyOfContractorPOComments = Convert.ToString(item["ContractComments"]);

                    objActivation.contractPaperWork.BrokenScopephases         = Convert.ToString(item["ScopePhased"]);
                    objActivation.contractPaperWork.BrokenScopephasesComments = Convert.ToString(item["ScopePhasedComments"]);

                    objActivation.contractPaperWork.BidRollUp         = Convert.ToString(item["BIRollups"]);
                    objActivation.contractPaperWork.BidRollUpComments = Convert.ToString(item["BIRollupsComments"]);

                    objActivation.contractPaperWork.PackCFSPIRollUp         = Convert.ToString(item["Packslip"]);
                    objActivation.contractPaperWork.PackCFSPIRollUpcomments = Convert.ToString(item["PackslipComments"]);

                    objActivation.contractPaperWork.ApplicableQuote         = Convert.ToString(item["Quotes"]);
                    objActivation.contractPaperWork.ApplicableQuoteComments = Convert.ToString(item["QuotesComments"]);

                    objActivation.contractPaperWork.SitePhotos         = Convert.ToString(item["Photos"]);
                    objActivation.contractPaperWork.SitePhotosComments = Convert.ToString(item["PhotoComments"]);

                    objActivation.contractPaperWork.DrawingConditions         = Convert.ToString(item["Drawings"]);
                    objActivation.contractPaperWork.DrawingConditionsComments = Convert.ToString(item["DrawingsComments"]);

                    objActivation.contractPaperWork.HardCard         = Convert.ToString(item["HardCard"]);
                    objActivation.contractPaperWork.HardCardComments = Convert.ToString(item["HardCardComments"]);

                    objActivation.contractPaperWork.PayEnvelope         = Convert.ToString(item["PayEnvelope"]);
                    objActivation.contractPaperWork.PayEnvelopeComments = Convert.ToString(item["PayEnvelopeComments"]);

                    objActivation.bondingInsurance.InsuranceCertification         = Convert.ToString(item["Bonding"]);
                    objActivation.bondingInsurance.InsuranceCertificationComments = Convert.ToString(item["BondingComments"]);

                    objActivation.safetyRequirements.SafetyOfficer         = Convert.ToString(item["SafetyOfficer"]);
                    objActivation.safetyRequirements.SafetyOfficerComments = Convert.ToString(item["SafetyOfficerComments"]);

                    objActivation.safetyRequirements.SafetyMeeting         = Convert.ToString(item["PreStartSafetyMeeting"]);
                    objActivation.safetyRequirements.SafetyMeetingComments = Convert.ToString(item["PreStartSafetyMeetingComments"]);

                    objActivation.safetyRequirements.DailySafetyMeeting         = Convert.ToString(item["DailySafetyMeetings"]);
                    objActivation.safetyRequirements.DailySafetyMeetingComments = Convert.ToString(item["DailySafetyMeetingComments"]);

                    objActivation.safetyRequirements.PPENeeded         = Convert.ToString(item["PPE"]);
                    objActivation.safetyRequirements.PPENeededComments = Convert.ToString(item["PPEComments"]);

                    objActivation.safetyRequirements.FallProtection         = Convert.ToString(item["Fall"]);
                    objActivation.safetyRequirements.FallProtectionComments = Convert.ToString(item["FallComments"]);

                    objActivation.safetyRequirements.EquipmentCertification         = Convert.ToString(item["EquipCerts"]);
                    objActivation.safetyRequirements.EquipmentCertificationComments = Convert.ToString(item["EquipCertComments"]);

                    objActivation.safetyRequirements.OtherHazards         = Convert.ToString(item["OtherHaz"]);
                    objActivation.safetyRequirements.OtherHazardsComments = Convert.ToString(item["OtherHazComments"]);

                    objActivation.otherImportantFactors.OtherPertinentInformation = Convert.ToString(item["OtherComments"]);
                    objActivation.ApprovedBy    = Convert.ToString(item["Approved"]);
                    objActivation.DateCompleted = Convert.ToDateTime(item["DateCompleted"]).ToShortDateString();
                    objActivation.DateReviewed  = Convert.ToDateTime(item["ApprovedDate"]).ToShortDateString();
                }
            }
            catch (Exception ex)
            {
                objActivation.recordExists = string.Empty;
                Logger.SaveErr(ex);
            }
            return(objActivation);
        }
Example #6
0
        public FileStreamResult printJobActivation(string prjid)
        {
            string title = string.Empty;

            var model = new JobActivationChecklist();

            model.PRJID = Convert.ToInt32(prjid);
            model       = ChecklistDal.getProjectActivationDetails(model);
            model       = ChecklistDal.JobActivationLookup(model);

            MemoryStream ms       = new MemoryStream();
            Document     document = new Document(PageSize.A4, 15, 10, 15, 35);
            PdfWriter    writer   = PdfWriter.GetInstance(document, ms);

            writer.PageEvent = new PDFReportEventHelper(title);

            // Open the PDF document
            document.Open();
            document.Add(PDFUtil.HeaderSection("Job Activation Checklist"));

            var projectTable = PDFUtil.createTableWithHeader("Project Information", new float[] { 3, 6 });

            projectTable.AddCell(PDFUtil.CreateCell("Atlas Job Number", PDFUtil.font_body_bold, 2, false));
            projectTable.AddCell(PDFUtil.CreateCell(model.projectInformation.JobNumber, PDFUtil.spanNormalBlack, 0, false));
            projectTable.AddCell(PDFUtil.CreateCell("Atlas Company Name", PDFUtil.font_body_bold, 2, false));
            projectTable.AddCell(PDFUtil.CreateCell(model.projectInformation.CompanyName, PDFUtil.spanNormalBlack, 0, false));
            projectTable.AddCell(PDFUtil.CreateCell("Customer/Contractor Name", PDFUtil.font_body_bold, 2, false));
            projectTable.AddCell(PDFUtil.CreateCell(model.projectInformation.CustomerProfile.Name, PDFUtil.spanNormalBlack, 0, false));
            projectTable.AddCell(PDFUtil.CreateCell("Address, City, State, Zip", PDFUtil.font_body_bold, 2, false));
            string CustomerAddr = string.Format("{0} | {1} | {2} | {3}",
                                                model.projectInformation.CustomerProfile.Address ?? "-",
                                                model.projectInformation.CustomerProfile.City ?? "-",
                                                model.projectInformation.CustomerProfile.State ?? "-",
                                                model.projectInformation.CustomerProfile.Zip ?? "-");

            projectTable.AddCell(PDFUtil.CreateCell(CustomerAddr, PDFUtil.spanNormalBlack, 0, false));
            projectTable.AddCell(PDFUtil.CreateCell("Phone Number, Extension", PDFUtil.font_body_bold, 2, false));
            string CustomerPhone = string.Format("{0} | {1}",
                                                 AppUtil.formatPhoneNumber(model.projectInformation.CustomerProfile.PhoneNumber) ?? "-",
                                                 AppUtil.formatPhoneNumber(model.projectInformation.CustomerProfile.Extension) ?? "-");

            projectTable.AddCell(PDFUtil.CreateCell(CustomerPhone, PDFUtil.spanNormalBlack, 0, false));
            projectTable.AddCell(PDFUtil.CreateCell("Project Name", PDFUtil.font_body_bold, 2, false));
            projectTable.AddCell(PDFUtil.CreateCell(model.projectInformation.ProjectProfile.Name, PDFUtil.spanNormalBlack, 0, false));
            projectTable.AddCell(PDFUtil.CreateCell("Address, City, State, Zip", PDFUtil.font_body_bold, 2, false));
            string ProjectAddr = string.Format("{0} | {1} | {2} | {3}",
                                               model.projectInformation.ProjectProfile.Address ?? "-",
                                               model.projectInformation.ProjectProfile.City ?? "-",
                                               model.projectInformation.ProjectProfile.State ?? "-",
                                               model.projectInformation.ProjectProfile.Zip ?? "-");

            projectTable.AddCell(PDFUtil.CreateCell(ProjectAddr, PDFUtil.spanNormalBlack, 0, false));
            projectTable.AddCell(PDFUtil.CreateCell("Contact Name/Phone Number, Ext", PDFUtil.font_body_bold, 2, false));
            string ProjectPhone = string.Format("{0} | {1} | {2}",
                                                model.projectInformation.CustomerProfile.ContactName ?? "-",
                                                AppUtil.formatPhoneNumber(model.projectInformation.CustomerProfile.PhoneNumber) ?? "-",
                                                AppUtil.formatPhoneNumber(model.projectInformation.CustomerProfile.Extension) ?? "-");

            projectTable.AddCell(PDFUtil.CreateCell(ProjectPhone, PDFUtil.spanNormalBlack, 0, false));
            projectTable.AddCell(PDFUtil.CreateCell("Customer Type", PDFUtil.font_body_bold, 2, false));
            projectTable.AddCell(PDFUtil.CreateCell(model.ListCustomersTypes.
                                                    First(i => i.CustomerTypeID.ToString() == model.projectInformation.CustomerType).Description, PDFUtil.spanNormalBlack, 0, false));
            projectTable.AddCell(PDFUtil.CreateCell("Job Type", PDFUtil.font_body_bold, 2, false));
            projectTable.AddCell(PDFUtil.CreateCell(model.ListJobTypes.
                                                    First(i => i.JobTypeId.ToString() == model.projectInformation.Jobtype).JobTypeDesc, PDFUtil.spanNormalBlack, 0, false));
            projectTable.AddCell(PDFUtil.CreateCell("Customer Bid/Job Reference #", PDFUtil.font_body_bold, 2, false));
            projectTable.AddCell(PDFUtil.CreateCell(model.projectInformation.CustomerBidReference, PDFUtil.spanNormalBlack, 0, false));
            projectTable.AddCell(PDFUtil.CreateCell("Scope of Work to be performed", PDFUtil.font_body_bold, 2, false));
            projectTable.AddCell(PDFUtil.CreateCell(model.projectInformation.ScopeWorkToBePerformed, PDFUtil.spanNormalBlack, 0, false));

            projectTable.AddCell(PDFUtil.CreateCell("Type of Labor", PDFUtil.font_body_bold, 2, false));
            projectTable.AddCell(PDFUtil.CreateCell(model.ListLabourTypes.First(i => i.MhRateId.ToString() == model.projectInformation.TypeOfLabour).MhRateName, PDFUtil.spanNormalBlack, 0, false));

            document.Add(projectTable);

            var ContractTable = PDFUtil.createTableWithHeader("Contract/Job Paperwork", new float[] { 3, 1, 1.5f, 5 });

            ContractTable.AddCell(PDFUtil.CreateCell("Copy of Contract or PO", PDFUtil.font_body_bold, 2, false));
            ContractTable.AddCell(PDFUtil.CreateCell(model.ListResponses.
                                                     First(i => i.ResponseId.ToString() == model.contractPaperWork.CopyOfContractorPO).Response, PDFUtil.spanNormalBlack, 0, false));
            ContractTable.AddCell(PDFUtil.CreateCell("Comments", PDFUtil.font_body_bold, 2, false));
            ContractTable.AddCell(PDFUtil.CreateCell(model.contractPaperWork.CopyOfContractorPOComments, PDFUtil.spanNormalBlack, 0, false));

            ContractTable.AddCell(PDFUtil.CreateCell("Broken scope into appropriate phases", PDFUtil.font_body_bold, 2, false));
            ContractTable.AddCell(PDFUtil.CreateCell(model.ListResponses.
                                                     First(i => i.ResponseId.ToString() == model.contractPaperWork.BrokenScopephases).Response, PDFUtil.spanNormalBlack, 0, false));
            ContractTable.AddCell(PDFUtil.CreateCell("Comments", PDFUtil.font_body_bold, 2, false));
            ContractTable.AddCell(PDFUtil.CreateCell(model.contractPaperWork.BrokenScopephasesComments, PDFUtil.spanNormalBlack, 0, false));

            ContractTable.AddCell(PDFUtil.CreateCell("Bid Roll-up (For each BI being activated)", PDFUtil.font_body_bold, 2, false));
            ContractTable.AddCell(PDFUtil.CreateCell(model.ListResponses.
                                                     First(i => i.ResponseId.ToString() == model.contractPaperWork.BidRollUp).Response, PDFUtil.spanNormalBlack, 0, false));
            ContractTable.AddCell(PDFUtil.CreateCell("Comments", PDFUtil.font_body_bold, 2, false));
            ContractTable.AddCell(PDFUtil.CreateCell(model.contractPaperWork.BidRollUpComments, PDFUtil.spanNormalBlack, 0, false));

            ContractTable.AddCell(PDFUtil.CreateCell("Pack CFS for each BI rollup", PDFUtil.font_body_bold, 2, false));
            ContractTable.AddCell(PDFUtil.CreateCell(model.ListResponses.
                                                     First(i => i.ResponseId.ToString() == model.contractPaperWork.PackCFSPIRollUp).Response, PDFUtil.spanNormalBlack, 0, false));
            ContractTable.AddCell(PDFUtil.CreateCell("Comments", PDFUtil.font_body_bold, 2, false));
            ContractTable.AddCell(PDFUtil.CreateCell(model.contractPaperWork.PackCFSPIRollUpcomments, PDFUtil.spanNormalBlack, 0, false));

            ContractTable.AddCell(PDFUtil.CreateCell("Applicable quote(s) for special material", PDFUtil.font_body_bold, 2, false));
            ContractTable.AddCell(PDFUtil.CreateCell(model.ListResponses.
                                                     First(i => i.ResponseId.ToString() == model.contractPaperWork.ApplicableQuote).Response, PDFUtil.spanNormalBlack, 0, false));
            ContractTable.AddCell(PDFUtil.CreateCell("Comments", PDFUtil.font_body_bold, 2, false));
            ContractTable.AddCell(PDFUtil.CreateCell(model.contractPaperWork.ApplicableQuoteComments, PDFUtil.spanNormalBlack, 0, false));

            ContractTable.AddCell(PDFUtil.CreateCell("Drawings/field conditions or grading reports", PDFUtil.font_body_bold, 2, false));
            ContractTable.AddCell(PDFUtil.CreateCell(model.ListResponses.
                                                     First(i => i.ResponseId.ToString() == model.contractPaperWork.DrawingConditions).Response, PDFUtil.spanNormalBlack, 0, false));
            ContractTable.AddCell(PDFUtil.CreateCell("Comments", PDFUtil.font_body_bold, 2, false));
            ContractTable.AddCell(PDFUtil.CreateCell(model.contractPaperWork.DrawingConditionsComments, PDFUtil.spanNormalBlack, 0, false));

            ContractTable.AddCell(PDFUtil.CreateCell("Site Photos", PDFUtil.font_body_bold, 2, false));
            ContractTable.AddCell(PDFUtil.CreateCell(model.ListResponses.
                                                     First(i => i.ResponseId.ToString() == model.contractPaperWork.SitePhotos).Response, PDFUtil.spanNormalBlack, 0, false));
            ContractTable.AddCell(PDFUtil.CreateCell("Comments", PDFUtil.font_body_bold, 2, false));
            ContractTable.AddCell(PDFUtil.CreateCell(model.contractPaperWork.SitePhotosComments, PDFUtil.spanNormalBlack, 0, false));

            ContractTable.AddCell(PDFUtil.CreateCell("Hard Card completely filled out", PDFUtil.font_body_bold, 2, false));
            ContractTable.AddCell(PDFUtil.CreateCell(model.ListResponses.
                                                     First(i => i.ResponseId.ToString() == model.contractPaperWork.HardCard).Response, PDFUtil.spanNormalBlack, 0, false));
            ContractTable.AddCell(PDFUtil.CreateCell("Comments", PDFUtil.font_body_bold, 2, false));
            ContractTable.AddCell(PDFUtil.CreateCell(model.contractPaperWork.HardCardComments, PDFUtil.spanNormalBlack, 0, false));

            ContractTable.AddCell(PDFUtil.CreateCell("Pay Envelope (residential only)", PDFUtil.font_body_bold, 2, false));
            ContractTable.AddCell(PDFUtil.CreateCell(model.ListResponses.
                                                     First(i => i.ResponseId.ToString() == model.contractPaperWork.PayEnvelope).Response, PDFUtil.spanNormalBlack, 0, false));
            ContractTable.AddCell(PDFUtil.CreateCell("Comments", PDFUtil.font_body_bold, 2, false));
            ContractTable.AddCell(PDFUtil.CreateCell(model.contractPaperWork.PayEnvelopeComments, PDFUtil.spanNormalBlack, 0, false));

            document.Add(ContractTable);

            document.NewPage();

            var BondingTable = PDFUtil.createTableWithHeader("Bonding/Insurance/Labor ", new float[] { 3, 1, 1.5f, 5 });

            BondingTable.AddCell(PDFUtil.CreateCell("Received bond (if required) and necessary insurance certification", PDFUtil.font_body_bold, 2, false));
            BondingTable.AddCell(PDFUtil.CreateCell(model.ListResponses.
                                                    First(i => i.ResponseId.ToString() == model.bondingInsurance.InsuranceCertification).Response, PDFUtil.spanNormalBlack, 0, false));
            BondingTable.AddCell(PDFUtil.CreateCell("Comments", PDFUtil.font_body_bold, 2, false));
            BondingTable.AddCell(PDFUtil.CreateCell(model.bondingInsurance.InsuranceCertificationComments, PDFUtil.spanNormalBlack, 0, false));

            document.Add(BondingTable);

            var SafetyTable = PDFUtil.createTableWithHeader("Safety Requirements - For all 'Yes' answers, please provide additional details",
                                                            new float[] { 3, 1, 1.5f, 5 });

            SafetyTable.AddCell(PDFUtil.CreateCell("Is there a safety officer on site? If so, provide Contact Informatios there a safety officer on site? If so, provide Contact Information", PDFUtil.font_body_bold, 2, false));
            SafetyTable.AddCell(PDFUtil.CreateCell(model.ListResponses.
                                                   First(i => i.ResponseId.ToString() == model.safetyRequirements.SafetyOfficer).Response, PDFUtil.spanNormalBlack, 0, false));
            SafetyTable.AddCell(PDFUtil.CreateCell("Comments", PDFUtil.font_body_bold, 2, false));
            SafetyTable.AddCell(PDFUtil.CreateCell(model.safetyRequirements.SafetyOfficerComments, PDFUtil.spanNormalBlack, 0, false));

            SafetyTable.AddCell(PDFUtil.CreateCell("Any safety meetings/orientation or badging needed before the job starts?", PDFUtil.font_body_bold, 2, false));
            SafetyTable.AddCell(PDFUtil.CreateCell(model.ListResponses.
                                                   First(i => i.ResponseId.ToString() == model.safetyRequirements.SafetyMeeting).Response, PDFUtil.spanNormalBlack, 0, false));
            SafetyTable.AddCell(PDFUtil.CreateCell("Comments", PDFUtil.font_body_bold, 2, false));
            SafetyTable.AddCell(PDFUtil.CreateCell(model.safetyRequirements.SafetyMeetingComments, PDFUtil.spanNormalBlack, 0, false));

            SafetyTable.AddCell(PDFUtil.CreateCell("Any daily safety meetings, truck/tool inspections required?", PDFUtil.font_body_bold, 2, false));
            SafetyTable.AddCell(PDFUtil.CreateCell(model.ListResponses.
                                                   First(i => i.ResponseId.ToString() == model.safetyRequirements.DailySafetyMeeting).Response, PDFUtil.spanNormalBlack, 0, false));
            SafetyTable.AddCell(PDFUtil.CreateCell("Comments", PDFUtil.font_body_bold, 2, false));
            SafetyTable.AddCell(PDFUtil.CreateCell(model.safetyRequirements.DailySafetyMeetingComments, PDFUtil.spanNormalBlack, 0, false));

            SafetyTable.AddCell(PDFUtil.CreateCell("Any specific PPE needed (e.g. fall protection,flotation, fire clothing, etc.)", PDFUtil.font_body_bold, 2, false));
            SafetyTable.AddCell(PDFUtil.CreateCell(model.ListResponses.
                                                   First(i => i.ResponseId.ToString() == model.safetyRequirements.PPENeeded).Response, PDFUtil.spanNormalBlack, 0, false));
            SafetyTable.AddCell(PDFUtil.CreateCell("Comments", PDFUtil.font_body_bold, 2, false));
            SafetyTable.AddCell(PDFUtil.CreateCell(model.safetyRequirements.PPENeededComments, PDFUtil.spanNormalBlack, 0, false));

            SafetyTable.AddCell(PDFUtil.CreateCell("Is fall protection is required? Please provide details of the situation ?", PDFUtil.font_body_bold, 2, false));
            SafetyTable.AddCell(PDFUtil.CreateCell(model.ListResponses.
                                                   First(i => i.ResponseId.ToString() == model.safetyRequirements.FallProtection).Response, PDFUtil.spanNormalBlack, 0, false));
            SafetyTable.AddCell(PDFUtil.CreateCell("Comments", PDFUtil.font_body_bold, 2, false));
            SafetyTable.AddCell(PDFUtil.CreateCell(model.safetyRequirements.FallProtectionComments, PDFUtil.spanNormalBlack, 0, false));

            SafetyTable.AddCell(PDFUtil.CreateCell("Any equipment certifications required (e.g. Bobcats, Forklifts, High lift, etc)?", PDFUtil.font_body_bold, 2, false));
            SafetyTable.AddCell(PDFUtil.CreateCell(model.ListResponses.
                                                   First(i => i.ResponseId.ToString() == model.safetyRequirements.EquipmentCertification).Response, PDFUtil.spanNormalBlack, 0, false));
            SafetyTable.AddCell(PDFUtil.CreateCell("Comments", PDFUtil.font_body_bold, 2, false));
            SafetyTable.AddCell(PDFUtil.CreateCell(model.safetyRequirements.EquipmentCertificationComments, PDFUtil.spanNormalBlack, 0, false));

            SafetyTable.AddCell(PDFUtil.CreateCell("Other hazards (water, lane closure, dust/respirator, HEPA, vacuum, heavy lifting)", PDFUtil.font_body_bold, 2, false));
            SafetyTable.AddCell(PDFUtil.CreateCell(model.ListResponses.
                                                   First(i => i.ResponseId.ToString() == model.safetyRequirements.OtherHazards).Response, PDFUtil.spanNormalBlack, 0, false));
            SafetyTable.AddCell(PDFUtil.CreateCell("Comments", PDFUtil.font_body_bold, 2, false));
            SafetyTable.AddCell(PDFUtil.CreateCell(model.safetyRequirements.OtherHazardsComments, PDFUtil.spanNormalBlack, 0, false));

            document.Add(SafetyTable);

            var OtherImportantTable = PDFUtil.createTableWithHeader("Other Important Factors", new float[] { 3, 7 });

            OtherImportantTable.AddCell(PDFUtil.CreateCell("Please fill in any other pertinant information", PDFUtil.font_body_bold, 2, false));
            OtherImportantTable.AddCell(PDFUtil.CreateCell(model.otherImportantFactors.OtherPertinentInformation, PDFUtil.spanNormalBlack, 0, false));
            document.Add(OtherImportantTable);

            var footerTable = PDFUtil.createTableWithHeader("", new float[] { 1, 2, 1, 2 }, true);

            footerTable.AddCell(PDFUtil.CreateCell("Estimator Name", PDFUtil.font_body_bold, 2, false));
            footerTable.AddCell(PDFUtil.CreateCell(model.projectInformation.Estimator, PDFUtil.spanNormalBlack, 0, false));
            footerTable.AddCell(PDFUtil.CreateCell("Date Completed", PDFUtil.font_body_bold, 2, false));
            footerTable.AddCell(PDFUtil.CreateCell(model.DateCompleted, PDFUtil.spanNormalBlack, 0, false));

            footerTable.AddCell(PDFUtil.CreateCell("Approved By", PDFUtil.font_body_bold, 2, false));
            footerTable.AddCell(PDFUtil.CreateCell(model.ListUsers.First(i => i.UserId.ToString() == model.ApprovedBy).Name, PDFUtil.spanNormalBlack, 0, false));
            footerTable.AddCell(PDFUtil.CreateCell("Date Reviewed", PDFUtil.font_body_bold, 2, false));
            footerTable.AddCell(PDFUtil.CreateCell(model.DateReviewed, PDFUtil.spanNormalBlack, 0, false));
            document.Add(footerTable);

            document.Close();
            byte[]       file   = ms.ToArray();
            MemoryStream output = new MemoryStream();

            output.Write(file, 0, file.Length);
            output.Position = 0;

            HttpContext.Response.AddHeader("content-disposition", "inline; filename=JobActivation_" + prjid + ".pdf");
            return(File(output, "application/pdf"));
        }
        public void LoadActivationLookup(JobActivationChecklist model)
        {
            model = ChecklistDal.JobActivationLookup(model);


            if (model.ListLabourTypes == null)
            {
                model.ListLabourTypes = new List <SYS10_MhRates>();
            }

            IEnumerable <SelectListItem> ListLabourTypes = model.ListLabourTypes.Select(c => new SelectListItem
            {
                Value = Convert.ToString(c.MhRateId),
                Text  = c.MhRateName
            });

            ViewBag.ListLabourTypes = ListLabourTypes;

            if (model.ListCustomersTypes == null)
            {
                model.ListCustomersTypes = new List <DOC08_CustomerType>();
            }
            IEnumerable <SelectListItem> ListCustomersType = model.ListCustomersTypes.Select(c => new SelectListItem
            {
                Value = Convert.ToString(c.CustomerTypeID),
                Text  = c.Description
            });

            ViewBag.ListCustomersType = ListCustomersType;
            if (model.ListJobTypes == null)
            {
                model.ListJobTypes = new List <DOC09_JobTypes>();
            }
            IEnumerable <SelectListItem> ListJobType = model.ListJobTypes.Select(c => new SelectListItem
            {
                Value = Convert.ToString(c.JobTypeId),
                Text  = c.JobTypeDesc
            });

            ViewBag.ListJobType = ListJobType;
            if (model.ListResponses == null)
            {
                model.ListResponses = new List <DOC10_Responses>();
            }

            IEnumerable <SelectListItem> ListResponses = model.ListResponses.Select(c => new SelectListItem
            {
                Value = Convert.ToString(c.ResponseId),
                Text  = c.Response
            });

            ViewBag.ListResponses = ListResponses;

            IEnumerable <SelectListItem> ListUser = model.ListUsers.Select(c => new SelectListItem
            {
                Value = Convert.ToString(c.UserId),
                Text  = c.Name
            });

            ViewBag.ListUser = ListUser;
        }