public ChecklistSubSectionDetailsVM(ChecklistSubSectionDetailsBO data, int PermitKey, ENUMBLL.SubmitType ChecklistType) { _data = data; this.PermitKey = PermitKey; this.UserNames = new Dictionary<string, string>(); this.ChecklistType = ENUMBLL.EnumDescription(ChecklistType); // get the final deficiencies if any exist DeficiencyBO finalDeficiencyBO = _data.Deficiencies.Where(d => d.IsFinal.HasValue && d.IsFinal.Value == true).OrderByDescending(d => d.DeficiencyID).FirstOrDefault(); if (finalDeficiencyBO != null) FinalDeficiency = finalDeficiencyBO.Versions.OrderByDescending(v => v.Version).FirstOrDefault(); }
/// <summary> /// Saves a correspondence letter from the posted data /// </summary> /// <param name="PermitKey"></param> /// <param name="CorrespondenceType"></param> /// <returns></returns> private CorrespondenceBO SaveLetterFile(int PermitKey, ENUMBLL.PDFDocuments CorrespondenceType) { // Gets the posted file from the request HttpPostedFileBase File = Request.Files["File"]; // Build the letter data object CorrespondenceDO data = new CorrespondenceDO() { CorrespondenceId = 0, CorrespondenceType = CorrespondenceType.ToString(), DateUploaded = DateTime.Now, FileName = File.FileName, FileSize = File.ContentLength, MimeType = File.ContentType, Guid = Guid.NewGuid(), Name = ENUMBLL.EnumDescription(CorrespondenceType), PermitKey = PermitKey, UserToken = myCoalUser.UserToken, Approved = false }; // read content from stream byte[] content = new byte[File.ContentLength]; File.InputStream.Read(content, 0, (int)File.ContentLength); // post the information to create a new business object CorrespondenceBO letter = CorrespondenceBLL.AddCorrespondence(data, content, DirectoryMapping.CorrespondenceFolder); return letter; }
public ActionResult Upload(int PermitKey, ENUMBLL.PDFDocuments CorrespondenceType) { try { CorrespondenceBO letter = SaveLetterFile(PermitKey, CorrespondenceType); AjaxResult result = new AjaxResult(AjaxResult.AjaxStatus.OK, "The correspondence was uploaded successfully"); result.Data.Add("Letter", letter); result.Data.Add("Url", Url.Action("PermitCorrespondence", "ePermitCorrespondence", new { PermitKey = letter.DataObject.PermitKey })); return Json(result); } catch (Exception ex) { AjaxResult result = new AjaxResult(AjaxResult.AjaxStatus.ERROR, ex.Message); return Json(result); } }
/// <summary> /// A partial view used to upload and approve correspondence letters /// </summary> /// <param name="PermitKey"></param> /// <param name="Type"></param> /// <returns></returns> public ActionResult LetterUploader(int PermitKey, ENUMBLL.PDFDocuments Type) { CorrespondenceDO DataObject = new CorrespondenceDO() { CorrespondenceType = Type.ToString(), PermitKey = PermitKey }; CorrespondenceBO model = new CorrespondenceBO() { DataObject = DataObject }; return PartialView(model); }
public DeficiencyChecklistVM(int PermitKey, ENUMBLL.SubmitType Type, List<ChecklistBO> Data) { this.PermitKey = PermitKey; ChecklistType = ENUMBLL.EnumDescription(Type); ChecklistData = Data; }
/// <summary> /// Renders the collapsed containers for the performance standards in a page /// </summary> /// <param name="PermitKey"></param> /// <param name="Type"></param> /// <returns></returns> public ActionResult CollapsedContainers(int PermitKey, ENUMBLL.PerformanceStandardType Type) { List<PerformanceStandardContainerVM> model = GetPageLevelVM(PermitKey, Type); return PartialView(model); }
/// <summary> /// Gets a list of performance standard container view models to display the collapsed controls for a page /// </summary> /// <param name="PermitKey"></param> /// <param name="Type"></param> /// <returns></returns> private List<PerformanceStandardContainerVM> GetPageLevelVM(int PermitKey, ENUMBLL.PerformanceStandardType Type) { List<PerformanceStandardContainerVM> model = new List<PerformanceStandardContainerVM>(); foreach (PerformanceStandardBO bo in PerformanceStandardBLL.GetByType(PermitKey, Type)) { PerformanceStandardContainerVM vm = new PerformanceStandardContainerVM(bo); model.Add(vm); } return model; }
/// <summary> /// Provides the details for a subsection when it is expanded /// </summary> /// <param name="PermitKey"></param> /// <param name="Section"></param> /// <param name="SubSection"></param> /// <param name="ChecklistType"></param> /// <returns></returns> public ActionResult ChecklistSubSectionDetail(int PermitKey, string Section, string SubSection, ENUMBLL.SubmitType ChecklistType) { ChecklistSubSectionDetailsBO data = DeficiencyBLL.GetChecklistSubSectionDetails(PermitKey, ChecklistType, Section, SubSection); ChecklistSubSectionDetailsVM model = new ChecklistSubSectionDetailsVM(data, PermitKey, ChecklistType); return PartialView(model); }
public ActionResult SaveFinalDeficiency(int DeficiencyID, int PermitKey, string Section, string SubSection, ENUMBLL.SubmitType ChecklistType, string finalDeficiency) { if (!Judge.AllowFinalDeficiencyEntry) return Json(new AjaxResult(AjaxResult.AjaxStatus.ERROR, "You are not able to enter final deficiencies at this time")); DeficiencyDO final = new DeficiencyDO() { DeficiencyID = DeficiencyID, DeficiencyDate = DateTime.Now, DeficiencyStateID = "Final", DeficiencyStatusID = ENUMBLL.EnumDescription(ENUMBLL.DeficiencyStatusType.Deficient), DeficiencyTypeID = ENUMBLL.EnumDescription(ChecklistType), Description = finalDeficiency, PermitKey = PermitKey, Section = Section, SubSection = SubSection, TOCID = 0, UserToken = myCoalUser.UserToken }; final.Version = DeficiencyBLL.Save(final); // Save returns the version, not the id, so we need to look it up again to get the data object List<DeficiencyBO> deficiencies = DeficiencyBLL.GetDeficienciesBySubSection(PermitKey, Section, SubSection); DeficiencyBO deficiency = deficiencies.Find(d => d.IsFinal == true); final = deficiency.Versions.Last(); AjaxResult result = new AjaxResult(AjaxResult.AjaxStatus.OK, "The final deficiency has been saved"); result.Data.Add("DeficiencyDO", final); result.Data.Add("NewSaveUrl", Url.Action("SaveFinalDeficiency", "ePermitChecklist", new { PermitKey = PermitKey, DeficiencyID = final.DeficiencyID, Section = Section, SubSection = SubSection, ChecklistType = ENUMBLL.EnumDescription(ChecklistType) })); result.Data.Add("ResponseType", "FinalDeficiency"); return Json(result); }
/// <summary> /// Provides the details when a rule section is expanded /// </summary> /// <param name="PermitKey"></param> /// <param name="Section"></param> /// <param name="ChecklistType"></param> /// <returns></returns> public ActionResult ChecklistSubSections(int PermitKey, string Section, ENUMBLL.SubmitType ChecklistType) { List<ChecklistSubSectionBO> data = DeficiencyBLL.GetChecklistSubSections(PermitKey, ChecklistType , Section); DeficiencyChecklistSubSectionsVM model = new DeficiencyChecklistSubSectionsVM(PermitKey, ChecklistType, data); return PartialView(model); }