public JsonResult BindCity(int stateId)
        {
            var results = BL_tblCityM.GetAllRecordsById(stateId).Select(x => new { x.iCityId, x.sCity });

            return(Json(new
            {
                results
            }, JsonRequestBehavior.AllowGet));
        }
示例#2
0
        public JsonResult BindCity(string id)
        {
            int cid = int.Parse(id);
            List <etblCityM> results = BL_tblCityM.GetAllRecordsById(cid);

            return(Json(new
            {
                suggestions = results
            }, JsonRequestBehavior.AllowGet));
        }
示例#3
0
        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));
        }
示例#4
0
        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));
        }
示例#5
0
        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));
        }
示例#6
0
        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));
        }
示例#7
0
        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>";
            //        }
            //    }
            //}
        }