public ActionResult Search(string prefix) { var countries = objCity.GetCities().Where(p => p.StateName.Contains(prefix) || p.CityName.Contains(prefix) || p.CountryName.Contains(prefix)); int pageindex = 0; var filter = countries.OrderBy(p => p.CityId).Skip(pageindex * PageSize).Take(PageSize); Session["users"] = countries; Session["pageindex"] = 0; if (filter.Count() > 0) { CityDetails obj = new CityDetails() { Status = true, CityList = filter }; return(Json(obj, JsonRequestBehavior.AllowGet)); } else { CityDetails obj = new CityDetails() { Status = false, ErrorMessage = SettingsManager.Instance.Branding == "SINDHI" ? Resources.SPMOResources.NoMoreInformationAvail : "आणखी माहिती उपलब्ध नाही" }; return(Json(obj, JsonRequestBehavior.AllowGet)); } }
/*------------------------------------------------END OF Getting List of Cities and Hotels------------------------------------------------*/ //Deleting the city from cityDetails using the id public bool DeleteCity(int id) { CityDetails cityDetails = dbContext.cityDetails.Find(id); if (cityDetails != null) { dbContext.cityDetails.Remove(cityDetails); dbContext.SaveChanges(); return(true); } else { return(false); } }
public ActionResult CityFirst() { IQueryable <CityModel> users = (IQueryable <CityModel>)Session["users"]; int pageindex = 0; var filter = users.OrderBy(p => p.CityId).Skip(pageindex * PageSize).Take(PageSize); Session["users"] = users; Session["pageindex"] = 0; CityDetails obj = new CityDetails() { Status = true, CityList = filter }; return(Json(obj, JsonRequestBehavior.AllowGet)); }
private void InitializeComponents() { SailSearchModule = new SailSearch { SearchButton = Window.Get <Button>(SearchCriteria.ByAutomationId(SailSearchIds.SearchButtonId)), CitySearchLabel = Window.Get <Label>(SearchCriteria.ByAutomationId(SailSearchIds.CitySearchLabelId)), CitySearchTextBox = Window.Get <TextBox>(SearchCriteria.ByAutomationId(SailSearchIds.CitySearchTextBoxId)) }; CityDetailsModule = new CityDetails { CityNameLabel = Window.Get <Label>(SearchCriteria.ByAutomationId(CityDetailsIds.CityNameLabelId)), CityNameLatLabel = Window.Get <Label>(SearchCriteria.ByAutomationId(CityDetailsIds.CityNameLatLabelId)), CityNameLongLabel = Window.Get <Label>(SearchCriteria.ByAutomationId(CityDetailsIds.CityNameLongLabelId)), CityPropertiesGrid = Window.Get <ListView>(SearchCriteria.ByAutomationId(CityDetailsIds.CityPropertiesGridId)) }; }
public void Admin_AddCity_NullValuePassing() { //Arrange AdminController adminController = new AdminController() { Request = new HttpRequestMessage() { Properties = { { HttpPropertyKeys.HttpConfigurationKey, new HttpConfiguration() } } } }; CityDetails city = new CityDetails(); //Act var response = adminController.AddCity(city); //Assert Assert.AreEqual(HttpStatusCode.Conflict, response.StatusCode); }
/// <summary> /// The AssignDevoteeDetails. /// </summary> /// <returns>The <see cref="Devotee"/>.</returns> private Devotee AssignDevoteeDetails() { Devotee devotee = new Devotee(); devotee.ReceiptNumber = Convert.ToInt32(txtReceiptNumber.Text); devotee.DevoteeName = Convert.ToString(txtName.Text); devotee.Address = Convert.ToString(txtAddress.Text); CountryDetails selCountry = (CountryDetails)cmbCountry.SelectedItem; devotee.CountryCode = Convert.ToInt32(selCountry.CountryID); devotee.Country = Convert.ToString(selCountry.CountryName); StateDetails selState = (StateDetails)cmbState.SelectedItem; devotee.StateCode = Convert.ToInt32(selState.StateID); devotee.State = Convert.ToString(selState.StateName); CityDetails selCity = (CityDetails)cmbCity.SelectedItem; devotee.CityCode = Convert.ToInt32(selCity.CityID); devotee.City = Convert.ToString(selCity.CityName); devotee.Amount = 500; devotee.ReceiptCreatedDate = DateTime.Now.Date; devotee.AnadhanamDate = Convert.ToDateTime(dtAnadhanamDate.Value.Date); devotee.ContactNumber = Convert.ToString(txtMobileNumber.Text); if (cmbPaymentMode.SelectedIndex == 1) { devotee.PaymentMode = PaymentMode.CHEQUE; devotee.ChequeNo = Convert.ToString(txtChequeNumber.Text); devotee.ChequeDate = Convert.ToDateTime(dtChequeDate.Value.Date); devotee.ChequeDrawn = Convert.ToString(txtDrawnOn.Text); } else { devotee.PaymentMode = PaymentMode.CASH; } return(devotee); }
public void Admin_AddCity_WrongDetails() { //Arrange AdminController adminController = new AdminController() { Request = new HttpRequestMessage() { Properties = { { HttpPropertyKeys.HttpConfigurationKey, new HttpConfiguration() } } } }; CityDetails city = new CityDetails(); city.cityName = "Nasik"; //Same City that is already been added in the database //Act var response = adminController.AddCity(city); //Assert Assert.AreEqual(HttpStatusCode.Conflict, response.StatusCode); }
public void Admin_AddCity_CorrectDetails() { //Arrange CityDetails city = new CityDetails(); AdminController adminController = new AdminController() { Request = new HttpRequestMessage() { Properties = { { HttpPropertyKeys.HttpConfigurationKey, new HttpConfiguration() } } } }; city.cityName = "Nasik"; //Act var response = adminController.AddCity(city); //Assert Assert.AreEqual(HttpStatusCode.Created, response.StatusCode); }
/// <summary> /// The cmbCity_SelectedValueChanged. /// </summary> /// <param name="sender">The sender<see cref="object"/>.</param> /// <param name="e">The e<see cref="EventArgs"/>.</param> private void cmbCity_SelectedValueChanged(object sender, EventArgs e) { CityDetails selectedCity = (CityDetails)cmbCity.SelectedItem; }
/// <summary> /// The ValidateDevoteeDetails. /// </summary> /// <returns>The <see cref="bool"/>.</returns> internal bool ValidateDevoteeDetails() { bool blnSubmit = true; if (string.IsNullOrWhiteSpace(txtMobileNumber.Text) && txtMobileNumber.Text.Length <= 10) { blnSubmit = false; MessageBox.Show("Please enter valid mobile number !...", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return(blnSubmit); } if (string.IsNullOrWhiteSpace(txtReceiptNumber.Text)) { blnSubmit = false; MessageBox.Show("Please enter valid receipt number !...", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return(blnSubmit); } if (string.IsNullOrWhiteSpace(txtName.Text)) { blnSubmit = false; MessageBox.Show("Please enter valid devotee Name !...", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return(blnSubmit); } if (string.IsNullOrWhiteSpace(txtAddress.Text)) { blnSubmit = false; MessageBox.Show("Please enter valid devotee address !...", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return(blnSubmit); } CountryDetails country = (CountryDetails)cmbCountry.SelectedItem; if (string.IsNullOrWhiteSpace(country.CountryName)) { blnSubmit = false; MessageBox.Show("Please choose county details !...", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return(blnSubmit); } StateDetails state = (StateDetails)cmbState.SelectedItem; if (string.IsNullOrWhiteSpace(state.StateName)) { blnSubmit = false; MessageBox.Show("Please choose state details !...", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return(blnSubmit); } CityDetails city = (CityDetails)cmbCity.SelectedItem; if (string.IsNullOrWhiteSpace(city.CityName)) { blnSubmit = false; MessageBox.Show("Please choose city details !...", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return(blnSubmit); } if (dtAnadhanamDate.Value.Day == 1 && dtAnadhanamDate.Value.Month == 1) { blnSubmit = false; MessageBox.Show("Anadhanam cannot be made on this day,please choose other date !...", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); return(blnSubmit); } else if (dtAnadhanamDate.Value.Date > DateTime.Now.AddMonths(4).Date) { blnSubmit = false; string strMessage = "Anadhanam date must not exceed more than 4 months (" + (DateTime.Now.AddMonths(4).Date).ToString("dd-MMM-yyyy") + ")!..."; MessageBox.Show(strMessage, "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); return(blnSubmit); } else if (dtAnadhanamDate.Value.Date < DateTime.Now.Date) { blnSubmit = false; MessageBox.Show("Anadhanam date must be Today or Above,You cannot select past date !...", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); return(blnSubmit); } if (!string.IsNullOrWhiteSpace(Convert.ToString(cmbPaymentMode.Text.ToUpper()))) { string strPaymentMode = Convert.ToString(cmbPaymentMode.Text.ToUpper()); if (strPaymentMode == "CHEQUE") { if (string.IsNullOrWhiteSpace(txtChequeNumber.Text)) { blnSubmit = false; MessageBox.Show("Please enter cheque number & proceed !...", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); return(blnSubmit); } if (string.IsNullOrWhiteSpace(txtDrawnOn.Text)) { blnSubmit = false; MessageBox.Show("Please enter cheque drawn details & Proceed !...", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); return(blnSubmit); } } } else { blnSubmit = false; MessageBox.Show("Please Select Payment Mode!...", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); return(blnSubmit); } return(blnSubmit); }
/*------------------------------------------------END OF DASHBOARD------------------------------------------------*/ // CRUD on City Table //Adding City in the cityDetails Table public bool AddCity(CityDetails city) { dbContext.cityDetails.Add(city); dbContext.SaveChanges(); return(true); }
/*------------------------------------------------END OF Deleting the City------------------------------------------------*/ // CRUD on Hotel Table //Adding Hotel in the hotelDetails Table public bool AddHotel(CityHotelDetailsFromAdmin hotel) { CityDetails cityDetails = new CityDetails(); cityDetails.cityName = hotel.cityName; HotelDetails hotelDetails = new HotelDetails(); hotelDetails.hotelName = hotel.hotelName; hotelDetails.hotelAddress = hotel.hotelAddress; hotelDetails.doubleRooms = hotel.numberOfDoubleRooms; hotelDetails.starRating = hotel.hotelRating; hotelDetails.singleRooms = hotel.numberOfSingleRooms; RoomDetails roomDetails = new RoomDetails(); if (CheckCityIfExists(cityDetails.cityName)) { if (!AddCity(cityDetails)) { return(false); } } int cityId = dbContext.cityDetails.Where(y => y.cityName == cityDetails.cityName).Select(y => y.cityId).FirstOrDefault(); if (CheckHotelIfExists(hotelDetails.hotelName, cityId)) { dbContext.hotelDetails.Add(hotelDetails); dbContext.SaveChanges(); int hotelId = FindTheAppropriateHotelId(hotel.hotelName); //Calling a different function to map Hotel and City Id if (!CityIdHotelIdUpdate(cityId, hotelId)) { return(false); } //Starting to add rooms for (int i = 1; i <= hotel.numberOfSingleRooms; i++) { roomDetails.hotelId = hotelId; roomDetails.roomType = "Single"; roomDetails.price = hotel.priceOfSingleRoom; if (!AddRoom(roomDetails)) { return(false); } } for (int i = 1; i <= hotel.numberOfDoubleRooms; i++) { roomDetails.hotelId = hotelId; roomDetails.roomType = "Double"; roomDetails.price = hotel.priceOfDoubleRoom; if (!AddRoom(roomDetails)) { return(false); } } return(true); } else { return(false); } }
public void Init(CityDetails initValue) { CityDetails = initValue; NotifyStateChanged(); }