public ActionResult SaveExteriorAudit(ExteriorsForm form) { //Save Exteriors Audit Data here. //Need to check current user and Atdd ID to save for. ICollection <string> Exteriors = form.Exteriors; var PropertyId = form.PropertyId; if (Exteriors != null && Exteriors.Count != 0) { var json = JsonConvert.SerializeObject(Exteriors); var auditor = new AuditsModel(); var check = auditor.Audits.Where(a => a.PropertyId.Equals(PropertyId)).FirstOrDefault(); if (check != null) { check.AtddExteriors = json; auditor.SaveChanges(); return(RedirectToAction("StartRenewalAudit", "Atdd", new { PropertyId = PropertyId })); } else { Audit auditObject = new Audit(); auditObject.PropertyId = PropertyId; auditObject.AtddExteriors = json; auditor.Audits.Add(auditObject); auditor.SaveChanges(); return(RedirectToAction("StartRenewalAudit", "Atdd", new { PropertyId = PropertyId })); } } else { Response.Write("Everything is wrong"); } return(RedirectToAction("StartRenewalAudit", "Atdd", new { PropertyId = PropertyId })); }
public ActionResult SaveEmployeesDevelopmentAudit(ICollection <string> EmployeesDevelopment) { //Save Exteriors Audit Data here. //Need to check current user and Hotel ID to save for. int userID = Int32.Parse(Session["UserID"].ToString()); PropertiesModel properties = new PropertiesModel(); var res = properties.Properties.Where(a => a.UserId.Equals(userID)).FirstOrDefault(); var hotelID = res.Id; if (EmployeesDevelopment != null && EmployeesDevelopment.Count != 0) { var json = JsonConvert.SerializeObject(EmployeesDevelopment); var auditor = new AuditsModel(); var check = auditor.Audits.Where(a => a.PropertyId.Equals(hotelID)).FirstOrDefault(); if (check != null) { check.HotelEmployeesDevelopment = json; auditor.SaveChanges(); return(RedirectToAction("AuditReport", "Hotel", new { area = "" })); } else { Audit auditObject = new Audit(); auditObject.PropertyId = hotelID; auditObject.HotelEmployeesDevelopment = json; auditor.Audits.Add(auditObject); auditor.SaveChanges(); return(RedirectToAction("AuditReport", "Hotel", new { area = "" })); } } return(RedirectToAction("AuditReport", "Hotel", new { area = "" })); }
public ActionResult SaveEmployeesDevelopmentAudit(EmployeesDevelopmentForm form) { //Save Exteriors Audit Data here. //Need to check current user and Hotel ID to save for. ICollection <string> EmployeesDevelopment = form.EmployeesDevelopment; var PropertyId = form.PropertyId; if (EmployeesDevelopment != null && EmployeesDevelopment.Count != 0) { var json = JsonConvert.SerializeObject(EmployeesDevelopment); var auditor = new AuditsModel(); var check = auditor.Audits.Where(a => a.PropertyId.Equals(PropertyId)).FirstOrDefault(); if (check != null) { check.AtddEmployeesDevelopment = json; auditor.SaveChanges(); return(RedirectToAction("StartRenewalAudit", "Atdd", new { PropertyId = PropertyId })); } else { Audit auditObject = new Audit(); auditObject.PropertyId = PropertyId; auditObject.AtddEmployeesDevelopment = json; auditor.Audits.Add(auditObject); auditor.SaveChanges(); return(RedirectToAction("StartRenewalAudit", "Atdd", new { PropertyId = PropertyId })); } } return(RedirectToAction("StartRenewalAudit", "Atdd", new { PropertyId = PropertyId })); }
public ActionResult EmployeesDevelopment(int PropertyId) { PropertiesModel properties = new PropertiesModel(); var res = properties.Properties.Where(a => a.Id.Equals(PropertyId)).FirstOrDefault(); if (res != null) { var PID = res.Id; var auditor = new AuditsModel(); var result = auditor.Audits.Where(a => a.PropertyId.Equals(PID)).FirstOrDefault(); if (result != null) { var answersJson = result.AtddEmployeesDevelopment; if (answersJson.ToString().Equals("")) { ViewBag.Answers = new List <string>(); } else { List <string> ansArray = JsonConvert.DeserializeObject <List <string> >(answersJson); ViewBag.Answers = ansArray; } } else { ViewBag.Answers = new List <string>(); } } ViewBag.PropertyId = PropertyId; return(View("~/Views/HotelAudit/EmployeesDevelopment.cshtml")); }
public ActionResult SaveCorporateSocialResponsibilityAudit(CorporateSocialResponsibilityForm form) { //Save Exteriors Audit Data here. //Need to check current user and Hotel ID to save for. ICollection <string> CorporateSocialResponsibility = form.CorporateSocialResponsibility; var PropertyId = form.PropertyId; if (CorporateSocialResponsibility != null && CorporateSocialResponsibility.Count != 0) { var json = JsonConvert.SerializeObject(CorporateSocialResponsibility); var auditor = new AuditsModel(); var check = auditor.Audits.Where(a => a.PropertyId.Equals(PropertyId)).FirstOrDefault(); if (check != null) { check.HotelCorporateSocialResponsibility = json; auditor.SaveChanges(); return(RedirectToAction("StartRenewalAudit", "Atdd", new { PropertyId = PropertyId })); } else { Audit auditObject = new Audit(); auditObject.PropertyId = PropertyId; auditObject.AtddCorporateSocialResponsibility = json; auditor.Audits.Add(auditObject); auditor.SaveChanges(); return(RedirectToAction("StartRenewalAudit", "Atdd", new { PropertyId = PropertyId })); } } return(RedirectToAction("StartRenewalAudit", "Atdd", new { PropertyId = PropertyId })); }
public ActionResult EmployeesDevelopment() { int userID = Int32.Parse(Session["UserID"].ToString()); PropertiesModel properties = new PropertiesModel(); var res = properties.Properties.Where(a => a.UserId.Equals(userID)).FirstOrDefault(); if (res != null) { var PID = res.Id; var auditor = new AuditsModel(); var result = auditor.Audits.Where(a => a.PropertyId.Equals(PID)).FirstOrDefault(); var answersJson = result.HotelEmployeesDevelopment; if (answersJson.ToString().Equals("")) { ViewBag.Answers = new List <string>(); } else { List <string> ansArray = JsonConvert.DeserializeObject <List <string> >(answersJson); ViewBag.Answers = ansArray; } } return(View()); }
public ActionResult StartClassificationAudit(int PropertyId) { PropertiesModel properties = new PropertiesModel(); var res = properties.Properties.Where(a => a.Id.Equals(PropertyId)).FirstOrDefault(); if (res != null) { var auditor = new AuditsModel(); var result = auditor.Audits.Where(a => a.PropertyId.Equals(PropertyId)).FirstOrDefault(); if (result != null) { //Exterirors Section var answersJson = result.AtddExteriors; if (!answersJson.ToString().Equals("")) { var ansArray = JsonConvert.DeserializeObject <List <string> >(answersJson); var progress = ansArray.Count; ViewBag.ExtriorProgress = progress; } else { ViewBag.ExtriorProgress = 0; } //Enternce & Common Areas Section var EntranceCommonAreasJson = result.AtddEntranceCommonAreas; if (!EntranceCommonAreasJson.ToString().Equals("")) { var EntranceCommonAreasAns = JsonConvert.DeserializeObject <List <string> >(EntranceCommonAreasJson); var EntranceCommonAreasJsonProgress = EntranceCommonAreasAns.Count; ViewBag.EntranceCommonAreasProgress = EntranceCommonAreasJsonProgress; } else { ViewBag.EntranceCommonAreasProgress = 0; } //Property Facilities Section var PropertyFacilitiesJson = result.AtddPropertyFacilities; if (!PropertyFacilitiesJson.ToString().Equals("")) { var PropertyFacilitiesAns = JsonConvert.DeserializeObject <List <string> >(PropertyFacilitiesJson); var PropertyFacilitiesJsonProgress = PropertyFacilitiesAns.Count; ViewBag.PropertyFacilitiesProgress = PropertyFacilitiesJsonProgress; } else { ViewBag.PropertyFacilitiesProgress = 0; } //Guest Bedrooms & Bathrooms Section var GuestBedroomsBathroomsJson = result.AtddGuestBedroomsBathrooms; if (!GuestBedroomsBathroomsJson.ToString().Equals("")) { var GuestBedroomsBathroomsAns = JsonConvert.DeserializeObject <List <string> >(GuestBedroomsBathroomsJson); var GuestBedroomsBathroomsJsonProgress = GuestBedroomsBathroomsAns.Count; ViewBag.GuestBedroomsBathroomsProgress = GuestBedroomsBathroomsJsonProgress; } else { ViewBag.GuestBedroomsBathroomsProgress = 0; } //Environment & Sustainability Section var EnvironmentSustainabilityJson = result.AtddEnvironmentSustainability; if (!EnvironmentSustainabilityJson.ToString().Equals("")) { var EnvironmentSustainabilityAns = JsonConvert.DeserializeObject <List <string> >(EnvironmentSustainabilityJson); var EnvironmentSustainabilityJsonProgress = EnvironmentSustainabilityAns.Count; ViewBag.EnvironmentSustainabilityProgress = EnvironmentSustainabilityJsonProgress; } else { ViewBag.EnvironmentSustainabilityProgress = 0; } //Corporate Social Responsibility Section var CorporateSocialResponsibilityJson = result.AtddCorporateSocialResponsibility; if (!CorporateSocialResponsibilityJson.ToString().Equals("")) { var CorporateSocialResponsibilityAns = JsonConvert.DeserializeObject <List <string> >(CorporateSocialResponsibilityJson); var CorporateSocialResponsibilityJsonProgress = CorporateSocialResponsibilityAns.Count; ViewBag.CorporateSocialResponsibilityProgress = CorporateSocialResponsibilityJsonProgress; } else { ViewBag.EnvironmentSustainabilityProgress = 0; } //Customer Feedback Measurement Section var CustomerFeedbackMeasurementJson = result.AtddCustomerFeedbackMeasurement; if (!CustomerFeedbackMeasurementJson.ToString().Equals("")) { var CustomerFeedbackMeasurementAns = JsonConvert.DeserializeObject <List <string> >(CustomerFeedbackMeasurementJson); var CustomerFeedbackMeasurementJsonProgress = CustomerFeedbackMeasurementAns.Count; ViewBag.CustomerFeedbackMeasurementProgress = CustomerFeedbackMeasurementJsonProgress; } else { ViewBag.CustomerFeedbackMeasurementProgress = 0; } //Employees Development Section var EmployeesDevelopmentJson = result.AtddEmployeesDevelopment; if (!EmployeesDevelopmentJson.ToString().Equals("")) { var EmployeesDevelopmentAns = JsonConvert.DeserializeObject <List <string> >(EmployeesDevelopmentJson); var EmployeesDevelopmentJsonProgress = EmployeesDevelopmentAns.Count; ViewBag.EmployeesDevelopmentProgress = EmployeesDevelopmentJsonProgress; } else { ViewBag.EmployeesDevelopmentProgress = 0; } } else { ViewBag.ExtriorProgress = 0; ViewBag.EntranceCommonAreasProgress = 0; ViewBag.PropertyFacilitiesProgress = 0; ViewBag.GuestBedroomsBathroomsProgress = 0; ViewBag.EnvironmentSustainabilityProgress = 0; ViewBag.CorporateSocialResponsibilityProgress = 0; ViewBag.CustomerFeedbackMeasurementProgress = 0; ViewBag.EmployeesDevelopmentProgress = 0; } } ViewBag.PropertyId = PropertyId; ViewBag.Current = "propertyaudit"; return(View()); }