Exemplo n.º 1
0
        public string DeleteLocality(int id, string status)
        {
            object result    = null;
            string strReturn = string.Empty;

            try
            {
                etblLocality obj = new etblLocality();
                obj           = BL_Locality.GetSingleRecordById(id);
                obj.cStatus   = status;
                obj.iActionBy = ((OneFineRateBLL.BL_Login.UserDetails)Session["UserDetails"]).iUserId;
                int i = BL_Locality.UpdateRecord(obj);
                if (i == 1)
                {
                    result = new { st = 1, msg = clsUtils.ErrorMsg("Locality", 4, status) };
                }
                else
                {
                    result = new { st = 0, msg = clsUtils.ErrorMsg("Locality", 0) };
                }
            }
            catch (Exception)
            {
                result = new { st = 0, msg = clsUtils.ErrorMsg("", 3) };
            }
            strReturn = OneFineRateAppUtil.clsUtils.ConvertToJson(result);
            return(strReturn);
        }
Exemplo n.º 2
0
        public JsonResult BindLocality(string id)
        {
            int cid = int.Parse(id);
            List <etblLocality> results = BL_Locality.LocalityList(cid);

            return(Json(new
            {
                suggestions = results
            }, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 3
0
        public JsonResult Autocomplete(string term)
        {
            var            result = new List <KeyValuePair <string, string> >();
            IList <PNames> List   = new List <PNames>(BL_Locality.GetAllLocality(Convert.ToInt32(Session["PropId"]), term));

            foreach (var item in List)
            {
                result.Add(new KeyValuePair <string, string>(item.Id.ToString(), item.Name));
            }
            var result3 = result.Where(s => s.Value.ToLower().Contains(term.ToLower())).Select(w => w).ToList();

            return(Json(result3, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 4
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));
        }
Exemplo n.º 5
0
        // GET: SearchHotel
        public ActionResult Index(PropDetailsForBooking prop)
        {
            // int LocalityId = 8;
            // DateTime dtCheckIn = Convert.ToDateTime("2016-06-20");
            // DateTime dtCheckOut = Convert.ToDateTime("2016-06-21");
            // List<PropDetailsForHotelBooking> data = BL_Locality.GetAllProperty(LocalityId, dtCheckIn, dtCheckOut);
            // PropDetailsForBooking obj = new PropDetailsForBooking();
            // if (data.Count > 0)
            // {
            //     foreach (var item in data)
            //     {
            //         obj.PropDetailsList.Add(item);
            //     }
            // }
            //return View(obj);

            int      LocalityId = 2;
            DateTime dtCheckIn  = Convert.ToDateTime("2016-06-20");
            DateTime dtCheckOut = Convert.ToDateTime("2016-06-21");

            if (prop.PropDetailsList.Count != 0)
            {
                LocalityId = prop.iLocalityId;
                dtCheckIn  = prop.PropDetailsList[0].dtCheckIn == null ? DateTime.Now : Convert.ToDateTime(prop.PropDetailsList[0].dtCheckIn);
                dtCheckOut = prop.PropDetailsList[0].dtCheckOut == null ? DateTime.Now : Convert.ToDateTime(prop.PropDetailsList[0].dtCheckOut);
            }

            List <PropDetailsForHotelBooking> data = BL_Locality.GetAllProperty(LocalityId, dtCheckIn, dtCheckOut);
            PropDetailsForBooking             obj  = new PropDetailsForBooking();

            if (data.Count > 0)
            {
                foreach (var item in data)
                {
                    obj.PropDetailsList.Add(item);
                }
            }
            else
            {
                obj = prop;
            }

            return(View("Index", obj));
        }
Exemplo n.º 6
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));
        }
Exemplo n.º 7
0
        public ActionResult Modify(PropDetailsForBooking prop)
        {
            int      LocalityId = prop.iLocalityId;
            DateTime dtCheckIn  = prop.PropDetailsList[0].dtCheckIn == null ? DateTime.Now : Convert.ToDateTime(prop.PropDetailsList[0].dtCheckIn);
            DateTime dtCheckOut = prop.PropDetailsList[0].dtCheckOut == null ? DateTime.Now : Convert.ToDateTime(prop.PropDetailsList[0].dtCheckOut);
            List <PropDetailsForHotelBooking> data = BL_Locality.GetAllProperty(LocalityId, dtCheckIn, dtCheckOut);
            PropDetailsForBooking             obj  = new PropDetailsForBooking();

            if (data.Count > 0)
            {
                foreach (var item in data)
                {
                    obj.PropDetailsList.Add(item);
                }
            }
            else
            {
                obj = prop;
            }

            return(View("Index", obj));
        }
Exemplo n.º 8
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));
        }
Exemplo n.º 9
0
        public string AddLocality(int countryid, int stateid, int cityid, int areaid, string localityname)
        {
            object result    = null;
            string strReturn = string.Empty;

            try
            {
                etblLocality eObj = new etblLocality();
                eObj.iCountryId   = countryid;
                eObj.iStateId     = stateid;
                eObj.iCityId      = cityid;
                eObj.iAreaId      = areaid;
                eObj.sLocality    = localityname;
                eObj.dtActionDate = DateTime.Now;
                eObj.cStatus      = "A";
                eObj.iActionBy    = ((OneFineRateBLL.BL_Login.UserDetails)Session["UserDetails"]).iUserId;
                int i = BL_Locality.AddRecord(eObj);
                if (i == 1)
                {
                    result = new { st = 1, msg = clsUtils.ErrorMsg("Locality", 1) };
                }
                else if (i == 2)
                {
                    result = new { st = 0, msg = clsUtils.ErrorMsg("Locality", 0) };
                }
                else
                {
                    result = new { st = 0, msg = clsUtils.ErrorMsg("Locality", 3) };
                }
            }
            catch (Exception ex)
            {
                result = new { st = 0, msg = clsUtils.ErrorMsg("", 3) };
            }
            strReturn = OneFineRateAppUtil.clsUtils.ConvertToJson(result);
            return(strReturn);
        }
Exemplo n.º 10
0
        public string UpdateLocality(int id, int countryid, int stateid, int cityid, int areaid, string localityname)
        {
            object result    = null;
            string strReturn = string.Empty;

            try
            {
                etblLocality obj = new etblLocality();
                obj            = BL_Locality.GetSingleRecordById(id);
                obj.iCountryId = countryid;
                obj.iStateId   = stateid;
                obj.iCityId    = cityid;
                obj.iAreaId    = areaid;
                obj.sLocality  = localityname;
                obj.iActionBy  = ((OneFineRateBLL.BL_Login.UserDetails)Session["UserDetails"]).iUserId;
                int i = BL_Locality.UpdateRecord(obj);
                if (i == 1)
                {
                    result = new { st = 1, msg = clsUtils.ErrorMsg("Locality", 2) };
                }
                else if (i == 2)
                {
                    result = new { st = 0, msg = clsUtils.ErrorMsg("Locality", 0) };
                }
                else
                {
                    result = new { st = 0, msg = clsUtils.ErrorMsg("Locality", 1) };
                }
            }
            catch (Exception)
            {
                result = new { st = 0, msg = clsUtils.ErrorMsg("", 3) };
            }
            strReturn = OneFineRateAppUtil.clsUtils.ConvertToJson(result);
            return(strReturn);
        }
Exemplo n.º 11
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));
        }
Exemplo n.º 12
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>";
            //        }
            //    }
            //}
        }
Exemplo n.º 13
0
        public JsonResult GetLocations(string txt, int cityId)
        {
            List <PNames> data = BL_Locality.MacroLocalitiesAjaxCall(txt, cityId);

            return(Json(data, JsonRequestBehavior.AllowGet));
        }