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"))); } }
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; }