public string UpdateStatus(int Id, bool Mode) { object result = null; string strReturn = string.Empty; try { etblPropertyM obj = new etblPropertyM(); obj = BL_tblPropertyM.GetSingleRecordById(Id); if (Mode == true) { obj.cStatus = "A"; } else { obj.cStatus = "D"; } int i = BL_tblPropertyM.UpdateStatus(obj); if (i == 1) { result = new { st = 1, msg = "Updated successfully." }; } else { result = new { st = 0, msg = "Kindly try after some time." }; } } catch (Exception) { result = new { st = 0, msg = "Kindly try after some time." }; } strReturn = OneFineRateAppUtil.clsUtils.ConvertToJson(result); return(strReturn); }
public JsonResult BindGrid() { object result = null; string strReturn = string.Empty; try { DataSet ds = new DataSet(); ds = BL_tblPropertyM.GetDataforPropertyDashboard(Convert.ToInt32(Session["PropId"].ToString())); DataTable dtrooms = ds.Tables[1]; DataTable dtdays = ds.Tables[0]; DataTable dtvalue = ds.Tables[2]; string rooms = dtrooms.Rows[0]["A"].ToString(); string days = getweekdaysJson(dtdays); string values = dtvalue.Rows[0]["A"].ToString(); result = new { st = 1, rooms = rooms, days = days, values = values }; return(Json(result, JsonRequestBehavior.AllowGet)); } catch (Exception) { return(Json(result, JsonRequestBehavior.AllowGet)); } }
/// <summary> /// Not in Use /// </summary> /// <returns></returns> public JsonResult BindBestPossibleRates() { int PropId = Convert.ToInt32(Session["PropId"].ToString()); List <etblPropertyDashboardView> results = new List <etblPropertyDashboardView>(); results = BL_tblPropertyM.GetAllBestPossibleRates(PropId); return(Json(new { suggestions = results }, JsonRequestBehavior.AllowGet)); }
public JsonResult GetBookingInsightsData(int iPropId, int iDays, string cType, string bookingOrRevenue) { try { var data = BL_tblPropertyM.GetBookingInsights_GraphData(iPropId, iDays, cType, bookingOrRevenue); return(Json(new { data }, JsonRequestBehavior.AllowGet)); } catch (Exception) { return(Json(new { data = new eBookingInsightsGraphModel() }, JsonRequestBehavior.AllowGet)); } }
public JsonResult GetNegotiationOverviewData(int iPropId, int iDays) { try { var data = BL_tblPropertyM.GetNegotiationOverview_GraphData(iPropId, iDays); return(Json(new { data }, JsonRequestBehavior.AllowGet)); } catch (Exception) { return(Json(new { data = new eNegotiationOverviewGraphModel() }, JsonRequestBehavior.AllowGet)); } }
public ActionResult GetPerformanceOverview(int iPropId, int iDays) { try { var data = BL_tblPropertyM.GetPerformanceOverview_GraphData(iPropId, iDays); return(PartialView("~/Views/Dashboard/_PerformanceOverview.cshtml", data)); } catch (Exception) { return(Content("")); } }
public JsonResult GetHotelRank() { try { int iPropId = Convert.ToInt32(Session["PropId"].ToString()); var data = BL_tblPropertyM.GetHotelRank(iPropId); return(Json(new { data }, JsonRequestBehavior.AllowGet)); } catch (Exception) { return(Json(new { data = new HotelRank() }, JsonRequestBehavior.AllowGet)); } }
// GET: ChangeHistory public ActionResult Index() { int iUserID = ((OneFineRateBLL.BL_Login.UserDetails)Session["UserDetails"]).iUserId; etblChangeHistory obj = new etblChangeHistory { PropertyList = new List <SelectListItem> { new SelectListItem { Text = "All Hotels", Value = "0" } } }; obj.PropertyList.AddRange(BL_tblPropertyM.GetUserPropertyList(iUserID)); return(View(obj)); }
public ActionResult MappedHotels() { if (Session["UserDetails"] != null) { int iUserID = ((OneFineRateBLL.BL_Login.UserDetails)Session["UserDetails"]).iUserId; ViewData["UserId"] = iUserID; List <eUsersPropertyMap> LEU = BL_tblPropertyM.GetListForSingle(iUserID); if (LEU.Count == 1) //if (LEU.Count == 1 && Session["PropId"] == null) { return(RedirectToAction("ViewDashboard", "Property", new { PropId = LEU[0].iPropId.ToString(), PropName = LEU[0].sHotelName })); } } Session["PropId"] = null; return(View()); }
public ActionResult GetHistoryChangeDataExcel(int?PropId, string chkradio, string dtfrom, string dtto, string dteffectivefrom, string dteffectiveto, int?id, int?roomType, int?ratePlan) { DataTable dt = new DataTable(); DateTime dtFrom = dtfrom == "" ? DateTime.Now : DateTime.ParseExact(dtfrom, "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture); DateTime dtTo = dtto == "" ? DateTime.Now : DateTime.ParseExact(dtto, "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture); if (chkradio == "R") { DateTime dtEffectiveFrom = dteffectivefrom == "" ? DateTime.Now : DateTime.ParseExact(dteffectivefrom, "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture); DateTime dtEffectiveTo = dteffectiveto == "" ? DateTime.Now : DateTime.ParseExact(dteffectiveto, "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture); if (PropId != 0) { dt = BL_tblChangeHistory.getRecordForSearchExcel(PropId.Value, dtFrom, dtTo, roomType.Value, ratePlan.Value, dtEffectiveFrom, dtEffectiveTo); } else { dt = BL_tblChangeHistory.getRecordForSearchExcel(PropId.Value, dtFrom, dtTo, 0, 0, dtEffectiveFrom, dtEffectiveTo); } } if (chkradio == "I" || chkradio == "B") { string Id = id.ToString(); dt = BL_tblChangeHistory.getRecordForSearchExcel(PropId.Value, dtFrom, dtTo, Id); } if (chkradio == "Promotion") { string Id = id.ToString(); dt = BL_tblChangeHistory.getRecordForSearchPromotionsExcel(dtFrom, dtTo, Id, PropId.Value); } if (chkradio == "RatePlan") { dt = BL_tblChangeHistory.getRecordForSearchRatePlanExcel(dtFrom, dtTo, PropId.Value); } DownloadExcel(dt); int iUserID = ((OneFineRateBLL.BL_Login.UserDetails)Session["UserDetails"]).iUserId; etblChangeHistory obj = new etblChangeHistory { PropertyList = new List <SelectListItem> { new SelectListItem { Text = "All Hotels", Value = "0" } } }; obj.PropertyList.AddRange(BL_tblPropertyM.GetUserPropertyList(iUserID)); return(View("Index", obj)); }
//public string BindGrid() //{ // object result = null; // string strReturn = string.Empty; // try // { // DataSet ds = new DataSet(); // ds = BL_tblPropertyM.GetDataforPropertyDashboard(Convert.ToInt32(Session["PropId"].ToString())); // DataTable dtrooms = ds.Tables[1]; // DataTable dtdays = ds.Tables[0]; // DataTable dtvalue = ds.Tables[2]; // string rooms = dtrooms.Rows[0]["A"].ToString(); // string days = getweekdaysJson(dtdays); // string values = dtvalue.Rows[0]["A"].ToString(); // result = new { st = 1, rooms = rooms, days = days, values = values }; // } // catch (Exception) // { // } // strReturn = OneFineRateAppUtil.clsUtils.ConvertToJson(result); // return strReturn; //} public string FetchNegCount() { object result = null; string strReturn = string.Empty; try { int CNT = BL_tblPropertyM.GetPendingChangesCount(Convert.ToInt32(Session["PropId"].ToString())); result = new { st = 1, CNT = CNT }; } catch (Exception) { } strReturn = OneFineRateAppUtil.clsUtils.ConvertToJson(result); return(strReturn); }
public static List <PNames> GetPropertyLocalityMap(int propId) { List <PNames> objMapping = new List <PNames>(); using (OneFineRateEntities db = new OneFineRateEntities()) { List <PNames> lstPNames = BL_tblPropertyM.GetAllPropertyList(propId); objMapping = (from map in db.tblPropertyCompetitorSets.ToList() join loc in lstPNames on map.iCPropId equals Convert.ToInt32(loc.Id) where map.iPropId == propId select new PNames() { Id = loc.Id, Name = loc.Name }).ToList(); return(objMapping); } }
public ActionResult Edit() { int id = 0; if (Session["PropId"] != null) { id = Convert.ToInt32(Session["PropId"].ToString()); } else { throw new Exception("Property ID Null"); } etblPropertyM_User obj = new etblPropertyM_User(); try { obj = BL_tblPropertyM.GetSingleRecordById_User(id); obj.sviewType = "Edit"; obj.StateList = BL_tblStateM.StateList(obj.iStateId, obj.iCountryId); obj.CityList = BL_tblCityM.CityList(obj.iCityId, obj.iStateId, obj.iCountryId); obj.AreaList = BL_tblMacroAreaM.AreasList(obj.iAreaId, obj.iCityId); obj.LocalityList = BL_Locality.LocalityList(obj.iLocalityId, obj.iAreaId); obj.AccessbilityItems = BL_tblAccessbilityM.GetAccessbilities(obj.sAccessbilityIds); obj.AwardsItems = BL_tblAwardM.GetAwards(obj.sAwardIds); obj.AffilationItems = BL_tblAffiliationM.GetAffilations(obj.sAffiliationIds); obj.LanguagesItems = BL_tblLanguageM.GetLanguages(obj.sLanguageIds); //for only showing purpose obj.sHotelNameO = obj.sHotelName; obj.iChainIdO = obj.iChainId; obj.iCountryIdO = obj.iCountryId; obj.iStateIdO = obj.iStateId; obj.iCityIdO = obj.iCityId; obj.iAreaIdO = obj.iAreaId; obj.iLocalityIdO = obj.iLocalityId; ViewBag.PropertyLocalityMap = GetLocalitiesJson(BL_tblPropertyM.GetPropertyLocalityMap(id)); } catch (Exception) { throw; } return(View(obj)); }
public ActionResult EditMaster(int id) { etblPropertyM obj = new etblPropertyM(); try { obj = BL_tblPropertyM.GetSingleRecordById(id); obj.sviewType = "EditMaster"; obj.StateList = BL_tblStateM.StateList(obj.iStateId, obj.iCountryId); obj.CityList = BL_tblCityM.CityList(obj.iCityId, obj.iStateId, obj.iCountryId); obj.AreaList = BL_tblMacroAreaM.AreasList(obj.iAreaId, obj.iCityId); obj.LocalityList = BL_Locality.LocalityList(obj.iLocalityId, obj.iAreaId); obj.latitude = obj.dLatitude; obj.longitude = obj.dLongitude; obj.Mode = "Edit"; obj.sInitialHotelName = obj.sHotelName; } catch (Exception ex) { throw; } return(View("Index", obj)); }
public IEnumerable <ValidationResult> Validate(ValidationContext validationContext) { var piYearBuilt = new[] { "iLastRenovation" }; if (iLastRenovation.ToString() != "" && Convert.ToInt16(iYearBuilt) > Convert.ToInt16(iLastRenovation)) { yield return(new ValidationResult("Please enter valid last renovation.", piYearBuilt)); } var sName = new[] { "sHotelName" }; string sInitialHotelName1 = String.IsNullOrEmpty(sInitialHotelName) ? "" : sInitialHotelName.ToString().ToLower(); if ((sHotelName.ToString().ToLower() != sInitialHotelName1) && (sHotelName.ToString() != "" && !String.IsNullOrEmpty(iCityId.ToString()) && !String.IsNullOrEmpty(iAreaId.ToString()) && !String.IsNullOrEmpty(iLocalityId.ToString()))) { bool result = BL_tblPropertyM.CheckDataExist(sHotelName, Convert.ToInt32(iCityId), Convert.ToInt32(iAreaId), Convert.ToInt32(iLocalityId)); if (!result) { yield return(new ValidationResult("Hotel name already exist.", sName)); } } var sNT1 = new[] { "sNearestTransport1" }; if (!string.IsNullOrEmpty(sNearestTransport1)) { if (dNearestTransport1 == null) { yield return(new ValidationResult("*", sNT1)); } } var dNT1 = new[] { "dNearestTransport1" }; if (dNearestTransport1 != null) { if (string.IsNullOrEmpty(sNearestTransport1)) { yield return(new ValidationResult("*", dNT1)); } } var sNT2 = new[] { "sNearestTransport2" }; if (!string.IsNullOrEmpty(sNearestTransport2)) { if (dNearestTransport2 == null) { yield return(new ValidationResult("*", sNT2)); } } var dNT2 = new[] { "dNearestTransport2" }; if (dNearestTransport2 != null) { if (string.IsNullOrEmpty(sNearestTransport2)) { yield return(new ValidationResult("*", dNT2)); } } var sNT3 = new[] { "sNearestTransport3" }; if (!string.IsNullOrEmpty(sNearestTransport3)) { if (dNearestTransport3 == null) { yield return(new ValidationResult("*", sNT3)); } } var dNT3 = new[] { "dNearestTransport3" }; if (dNearestTransport3 != null) { if (string.IsNullOrEmpty(sNearestTransport3)) { yield return(new ValidationResult("*", dNT3)); } } var sDTA1 = new[] { "sDistanceToAirportRailway1" }; if (!string.IsNullOrEmpty(sDistanceToAirportRailway1)) { if (dDistanceToAirportRailway1 == null) { yield return(new ValidationResult("*", sDTA1)); } } var dDTA1 = new[] { "dDistanceToAirportRailway1" }; if (dDistanceToAirportRailway1 != null) { if (string.IsNullOrEmpty(sDistanceToAirportRailway1)) { yield return(new ValidationResult("*", dDTA1)); } } var sDTA2 = new[] { "sDistanceToAirportRailway2" }; if (!string.IsNullOrEmpty(sDistanceToAirportRailway2)) { if (dDistanceToAirportRailway2 == null) { yield return(new ValidationResult("*", sDTA2)); } } var dDTA2 = new[] { "dDistanceToAirportRailway2" }; if (dDistanceToAirportRailway2 != null) { if (string.IsNullOrEmpty(sDistanceToAirportRailway2)) { yield return(new ValidationResult("*", dDTA2)); } } var sDTA3 = new[] { "sDistanceToAirportRailway3" }; if (!string.IsNullOrEmpty(sDistanceToAirportRailway3)) { if (dDistanceToAirportRailway3 == null) { yield return(new ValidationResult("*", sDTA3)); } } var dDTA3 = new[] { "dDistanceToAirportRailway3" }; if (dDistanceToAirportRailway3 != null) { if (string.IsNullOrEmpty(sDistanceToAirportRailway3)) { yield return(new ValidationResult("*", dDTA3)); } } }
public ActionResult GetHotelSearchData(string hotelSearchTxt) { var hotelList = BL_tblPropertyM.GetAllPropertyNameList(hotelSearchTxt); return(Json(new { hotelList }, JsonRequestBehavior.AllowGet)); }
public ActionResult Modify(etblPropertyM_User prop) { try { if (ModelState.IsValid) { try { prop.dtActionDate = DateTime.Now; //get all AccessbilityId comma seperated if (prop.SelectedAccessbility != null) { prop.sAccessbilityIds = prop.SelectedAccessbility.Select(i => i.ToString(CultureInfo.InvariantCulture)).Aggregate((s1, s2) => s1 + "," + s2); } //get all AwardsIds comma seperated if (prop.SelectedAwards != null) { prop.sAwardIds = prop.SelectedAwards.Select(i => i.ToString(CultureInfo.InvariantCulture)).Aggregate((s1, s2) => s1 + "," + s2); } //get all AffilationsIds comma seperated if (prop.SelectedAffilations != null) { prop.sAffiliationIds = prop.SelectedAffilations.Select(i => i.ToString(CultureInfo.InvariantCulture)).Aggregate((s1, s2) => s1 + "," + s2); } //get all languages comma seperated if (prop.SelectedLanguages != null) { prop.sLanguageIds = prop.SelectedLanguages.Select(i => i.ToString(CultureInfo.InvariantCulture)).Aggregate((s1, s2) => s1 + "," + s2); } if (prop.SelectPrimaryLocalities != null) { JArray jArray = (JArray)JsonConvert.DeserializeObject(prop.SelectPrimaryLocalities.Replace("\\", "\"")); if (jArray != null) { List <etblPropertyLocalityMap> lstPropertyLocalityMap = new List <etblPropertyLocalityMap>(); foreach (var item in jArray) { lstPropertyLocalityMap.Add(new etblPropertyLocalityMap() { iPropId = prop.iPropId, iAreaLocalityId = Convert.ToInt32(item["Id"]), cAreaLocality = Convert.ToString(item["Status"]), dtActionDate = DateTime.Now, iActionBy = ((OneFineRateBLL.BL_Login.UserDetails)Session["UserDetails"]).iUserId }); } prop.PropertyLocalityMapList = lstPropertyLocalityMap; } } prop.iActionBy = ((OneFineRateBLL.BL_Login.UserDetails)Session["UserDetails"]).iUserId; int result = BL_tblPropertyM.UpdateRecord_User(prop); if (result == 1) { TempData["msg"] = "Property Informaion Modified Successfully"; return(RedirectToAction("Edit")); } else { TempData["Error"] = "Some unknown error had happen !"; return(View(prop.sviewType, prop)); } } catch (Exception) { throw; } } prop.AccessbilityItems = BL_tblAccessbilityM.GetAccessbilities(prop.sAccessbilityIds); prop.AwardsItems = BL_tblAwardM.GetAwards(prop.sAwardIds); prop.AffilationItems = BL_tblAffiliationM.GetAffilations(prop.sAffiliationIds); prop.LanguagesItems = BL_tblLanguageM.GetLanguages(prop.sLanguageIds); prop.StateList = BL_tblStateM.StateList(prop.iStateId, prop.iCountryId); prop.CityList = BL_tblCityM.CityList(prop.iCityId, prop.iStateId, prop.iCountryId); prop.AreaList = BL_tblMacroAreaM.AreasList(prop.iAreaId, prop.iCityId); prop.LocalityList = BL_Locality.LocalityList(prop.iLocalityId, prop.iAreaId); //prop.sAccessbilityIds = prop.SelectedAccessbility.Select(i => i.ToString(CultureInfo.InvariantCulture)).Aggregate((s1, s2) => s1 + "," + s2); ////get all AwardsIds comma seperated //prop.sAwardIds = prop.SelectedAwards.Select(i => i.ToString(CultureInfo.InvariantCulture)).Aggregate((s1, s2) => s1 + "," + s2); ////get all AffilationsIds comma seperated //prop.sAffiliationIds = prop.SelectedAffilations.Select(i => i.ToString(CultureInfo.InvariantCulture)).Aggregate((s1, s2) => s1 + "," + s2); ////get all languages comma seperated //prop.sLanguageIds = prop.SelectedLanguages.Select(i => i.ToString(CultureInfo.InvariantCulture)).Aggregate((s1, s2) => s1 + "," + s2); //for only showing purpose prop.sHotelNameO = prop.sHotelName; prop.iChainIdO = prop.iChainId; prop.iCountryIdO = prop.iCountryId; prop.iStateIdO = prop.iStateId; prop.iCityIdO = prop.iCityId; prop.iAreaIdO = prop.iAreaId; prop.iLocalityIdO = prop.iLocalityId; ViewBag.PropertyLocalityMap = GetLocalitiesJson(BL_tblPropertyM.GetPropertyLocalityMap(prop.iPropId)); TempData["Error"] = "Validation failed ! Please correct the errors and try again."; } catch (Exception) { } return(View(prop.sviewType, prop)); }
public ActionResult Add(etblPropertyM prop) { if (ModelState.IsValid) { try { prop.iActionBy = ((OneFineRateBLL.BL_Login.UserDetails)Session["UserDetails"]).iUserId; prop.dtActionDate = DateTime.Now; if (prop.Mode == "Add") { prop.cStatus = "I"; int result = BL_tblPropertyM.AddRecord(prop); if (result == 1) { TempData["msg"] = "Property Added Successfully"; return(RedirectToAction("List")); } else { return(View("Index", prop)); } } else { int result = BL_tblPropertyM.UpdateRecord(prop); if (result == 1) { TempData["msg"] = "Property Modified Successfully"; return(RedirectToAction("List")); } else { return(View("Index", prop)); } } } catch (Exception) { throw; } } else { TempData["ERROR"] = "Validation failed! Please correct the errors and try again."; prop.StateList = BL_tblStateM.StateList(prop.iStateId, prop.iCountryId); prop.CityList = BL_tblCityM.CityList(prop.iCityId, prop.iStateId, prop.iCountryId); prop.AreaList = BL_tblMacroAreaM.AreasList(prop.iAreaId, prop.iCityId); prop.LocalityList = BL_Locality.LocalityList(prop.iLocalityId, prop.iAreaId); prop.latitude = prop.dLatitude; prop.longitude = prop.dLongitude; prop.Mode = "Edit"; return(View("Index", prop)); } //else //{ // string errormsg = ""; // foreach (ModelState modelState in ViewData.ModelState.Values) // { // foreach (ModelError error in modelState.Errors) // { // errormsg += error.ErrorMessage; // errormsg += "</br>"; // } // } //} }
public ActionResult GetCitySearchData(string citySearchTxt) { var cityList = BL_tblPropertyM.GetAllCityNameList(citySearchTxt); return(Json(new { cityList }, JsonRequestBehavior.AllowGet)); }
public JsonResult GetAllProperty(string txt) { List <PNames> data = BL_tblPropertyM.GetAllPropertyName(Convert.ToInt32(Session["PropId"]), txt); return(Json(data, JsonRequestBehavior.AllowGet)); }