public string UpdateMacroArea(int id, int countryid, int stateid, int cityid, string macroareaname) { object result = null; string strReturn = string.Empty; try { eMacroAreaM obj = new eMacroAreaM(); obj = BL_tblMacroAreaM.GetSingleRecordById(id); obj.iCountryId = countryid; obj.iStateId = stateid; obj.iCityId = cityid; obj.sArea = macroareaname; int i = BL_tblMacroAreaM.UpdateRecord(obj); if (i == 1) { result = new { st = 1, msg = clsUtils.ErrorMsg("MacroArea", 2) }; } else if (i == 2) { result = new { st = 0, msg = clsUtils.ErrorMsg("MacroArea", 0) }; } else { result = new { st = 0, msg = clsUtils.ErrorMsg("MacroArea", 3) }; } } catch (Exception) { result = new { st = 0, msg = clsUtils.ErrorMsg("", 3) }; } strReturn = OneFineRateAppUtil.clsUtils.ConvertToJson(result); return(strReturn); }
public string DeleteMacroArea(int id, string status) { object result = null; string strReturn = string.Empty; try { eMacroAreaM obj = new eMacroAreaM(); obj = BL_tblMacroAreaM.GetSingleRecordById(id); obj.cStatus = status; obj.iActionBy = ((OneFineRateBLL.BL_Login.UserDetails)Session["UserDetails"]).iUserId; int i = BL_tblMacroAreaM.UpdateRecord(obj); if (i == 1) { result = new { st = 1, msg = clsUtils.ErrorMsg("MacroArea", 4, status) }; } else { result = new { st = 0, msg = clsUtils.ErrorMsg("MacroArea", 0) }; } } catch (Exception) { result = new { st = 0, msg = clsUtils.ErrorMsg("", 3) }; } strReturn = OneFineRateAppUtil.clsUtils.ConvertToJson(result); return(strReturn); }
// GET: MacroAreaAjax public ActionResult Index() { eMacroAreaM obj = new eMacroAreaM(); obj.StateList = BL_tblMacroAreaM.StateList(obj.iStateId, obj.iCountryId); obj.CityList = BL_tblMacroAreaM.CityList(obj.iCityId, obj.iStateId, obj.iCountryId); return(View(obj)); }
public ActionResult Edit(int id) { eMacroAreaM obj = new eMacroAreaM(); obj = BL_tblMacroAreaM.GetSingleRecordById(id); obj.StateList = BL_tblMacroAreaM.StateList(obj.iStateId, obj.iCountryId); obj.CityList = BL_tblMacroAreaM.CityList(obj.iCityId, obj.iStateId, obj.iCountryId); ViewBag.OpenEditModel = "Y"; return(PartialView("Index", obj)); }
public JsonResult BindMacroArea(string id) { int cid = int.Parse(id); List <eMacroAreaM> results = BL_tblMacroAreaM.GetAllRecordsById(cid); return(Json(new { suggestions = results }, JsonRequestBehavior.AllowGet)); }
public ActionResult Index() { etblPropertyM obj = new etblPropertyM(); 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.Mode = "Add"; obj.latitude = Convert.ToDecimal("28.577286048"); obj.longitude = Convert.ToDecimal("77.203674316"); obj.sInitialHotelName = ""; return(View(obj)); }
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 AddMacroArea(eMacroAreaM eObj) { string strReturn = string.Empty; try { if (eObj.iAreaId == 0) { eObj.dtActionDate = DateTime.Now; eObj.cStatus = "A"; eObj.iActionBy = 1; int i = BL_tblMacroAreaM.AddRecord(eObj); if (i == 1) { strReturn = "Added successfully."; } else { strReturn = "Kindly try after some time."; } } else { eObj.dtActionDate = DateTime.Now; int i = BL_tblMacroAreaM.UpdateRecord(eObj); if (i == 1) { strReturn = "Updated successfully."; } else { strReturn = "Kindly try after some time."; } } } catch (Exception) { strReturn = "Kindly try after some time."; } TempData["result"] = strReturn; return(RedirectToAction("Index")); }
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 string AddMacroArea(int countryid, int stateid, int cityid, string macroareaname) { object result = null; string strReturn = string.Empty; try { eMacroAreaM eObj = new eMacroAreaM(); eObj.iCountryId = countryid; eObj.iStateId = stateid; eObj.iCityId = cityid; eObj.sArea = macroareaname; eObj.dtActionDate = DateTime.Now; eObj.cStatus = "A"; eObj.iActionBy = ((OneFineRateBLL.BL_Login.UserDetails)Session["UserDetails"]).iUserId; int i = BL_tblMacroAreaM.AddRecord(eObj); if (i == 1) { result = new { st = 1, msg = clsUtils.ErrorMsg("MacroArea", 1) }; } else if (i == 2) { result = new { st = 0, msg = clsUtils.ErrorMsg("MacroArea", 0) }; } else { result = new { st = 0, msg = clsUtils.ErrorMsg("MacroArea", 3) }; } } catch (Exception) { result = new { st = 0, msg = clsUtils.ErrorMsg("", 3) }; } strReturn = OneFineRateAppUtil.clsUtils.ConvertToJson(result); return(strReturn); }
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>"; // } // } //} }