private void InsertIntoDatabase() { int feedbackValue = 0; int result = 0; IncedentTypes incedent = GetIncedentType(); if (incedent != IncedentTypes.none) { feedbackValue = GetFeedbackValue(incedent); if (feedbackValue != 0) { LoadIncedentFromHiddenFields(incedent, feedbackValue); result = Incedent.ReportProblem(problem); if (result > 0) { PnlSuccessFailure.Visible = true; PnlSuccessFailure.CssClass = "notification alert-success spacer-t10"; LblStatus.Text = "Your Problem has been recorded!"; } else { PnlSuccessFailure.Visible = true; PnlSuccessFailure.CssClass = "notification alert-error spacer-t10"; LblStatus.Text = "Something went wrong. Please try again!"; } } else { PnlSuccessFailure.Visible = true; PnlSuccessFailure.CssClass = "notification alert-warning spacer-t10"; LblStatus.Text = "Please select an option!"; } } }
private void LoadIncedentFromHiddenFields(IncedentTypes incedent, int feedbackValue) { problem = new Incedent() { FeedbackValue = feedbackValue, IncedentType = Convert.ToInt32(incedent), HotelID = GetHotel(), UserID = GetUser(), IncedentDescription = additionalComments, IncedentTime = DateTime.Now, RoomNo = GetRoomNo() }; }
private int GetFeedbackValue(IncedentTypes incedent) { String feedbackValue = String.Empty; if (incedent == IncedentTypes.CommonArea) { feedbackValue = HdnCommon.Value; image = GetImage("common_file"); } else if (incedent == IncedentTypes.FrontDesk) { feedbackValue = HdnFrontdesk.Value; image = GetImage("frontdesk_file"); } else if (incedent == IncedentTypes.Housekeeping) { feedbackValue = HdnHousekeeping.Value; image = GetImage("housekeeping_file"); } else if (incedent == IncedentTypes.Maintenance) { feedbackValue = HdnMaintenance.Value; image = GetImage("maintain_file"); } else if (incedent == IncedentTypes.Room) { feedbackValue = HdnRoom.Value; image = GetImage("room_file"); } else if (incedent == IncedentTypes.WiFiInternet) { feedbackValue = HdnWifi.Value; image = GetImage("internet_file"); } else if (incedent == IncedentTypes.Food) { feedbackValue = HdnFood.Value; image = GetImage("food_file"); } else if (incedent == IncedentTypes.Fitness) { feedbackValue = HdnFitness.Value; image = GetImage("fitness_file"); } else if (incedent == IncedentTypes.Parking) { feedbackValue = HdnParking.Value; image = GetImage("parking_file"); } return(Convert.ToInt32(feedbackValue)); }