private void ButtonReturnBike_Click(object sender, RoutedEventArgs e) { var deleterecord = App._bikebookingdatastorage; deleterecord.Remove(deletebikebookingdatastorage as ManageBooking); StorageClass.StoreXML <List <ManageBooking> >("BikeBookingManager.xml", deleterecord); DisplayRentedBike(); var updateItem = (from biker in App._bikedatastorage select biker); updateItem .Where(exp => exp.RentedBike == exp.RentedBike) .ToList().ForEach(exp => { exp.RentedBike -= 1; exp.AvailableBike += 1; }); StorageClass.StoreXML <List <ManageBike> >("BikeManager.xml", App._bikedatastorage); DisplayAvailableBike(); TextboxSearch.Visibility = Visibility.Visible; LabelboxSearch.Visibility = Visibility.Visible; }
public void DisplayRentedBike() { App._bikebookingdatastorage = StorageClass.ReadXML <List <ManageBooking> >("BikeBookingManager.xml"); if (App._bikebookingdatastorage == null) { App._bikebookingdatastorage = new List <ManageBooking>(); } datgridBikeRented.ItemsSource = App._bikebookingdatastorage; }
public void btnNextPage_Click(object sender, RoutedEventArgs e) { if (dtpckStartDate.Text != "" && dtpckEndDate.Text != "") { if (_curretnselections != null) { var updateDatesinList = (from bik in _curretnselections select bik); updateDatesinList .Where(bik => bik.endDate == null & bik.startDate == null) .ToList().ForEach(bik => { bik.startDate = dtpckStartDate.Text; bik.endDate = dtpckEndDate.Text; }); grdSelectBike.Visibility = Visibility.Collapsed; grdCustomerDetail.Visibility = Visibility.Visible; var bikesDetail = (from biker in App._bikebookingdatastorage where biker.CustomerId == CustomerId select biker); ManageBooking datastore = new ManageBooking { CustomerId = CustomerId, Deposit = (from bik in _curretnselections select bik.totalDeposit).LastOrDefault(), TypeCity = (from bik in _curretnselections select bik.TypeCity).LastOrDefault(), TypeMountain = (from bik in _curretnselections select bik.TypeMountain).LastOrDefault(), TypeRacing = (from bik in _curretnselections select bik.TypeRacing).LastOrDefault(), TypeEBike = (from bik in _curretnselections select bik.TypeEBike).LastOrDefault(), ReturnDeposit = (from bik in _curretnselections select bik.totalDeposit).LastOrDefault(), //ReturnDeposit = 30, EndDate = dtpckEndDate.Text, Quantity = (from bik in _curretnselections select bik.totalQuantitty).LastOrDefault(), Rent = (from bik in _curretnselections select bik.totalRent).LastOrDefault(), StartDate = dtpckStartDate.Text, //Address = "Hermann Str 5", TotalAmount = (from bik in _curretnselections select bik.totalDeposit).LastOrDefault() + (from bik in _curretnselections select bik.totalRent).LastOrDefault() }; App._bikebookingdatastorage.Add(datastore); StorageClass.StoreXML <List <ManageBooking> >("BikeBookingManager.xml", App._bikebookingdatastorage); DisplayRentedBike(); } } else { MessageBox.Show("Please Select Start Date and End Date.", "Error!!", MessageBoxButton.OKCancel); } }
public void DisplayRentedBike() { if (_curretnselections == null) { _curretnselections = new List <CurrentOrder>(); } datgridBikeOrder.ItemsSource = _curretnselections; App._bikebookingdatastorage = StorageClass.ReadXML <List <ManageBooking> >("BikeBookingManager.xml"); if (App._bikebookingdatastorage == null) { App._bikebookingdatastorage = new List <ManageBooking>(); } txtboxTotalAmount.Text = (from bik in App._bikebookingdatastorage where bik.CustomerId == CustomerId select bik.TotalAmount).LastOrDefault().ToString(); //datgridBikeOrder.ItemsSource = App._bikebookingdatastorage; }
private void Application_Startup(object sender, StartupEventArgs e) { _bikedatastorage = StorageClass.ReadXML <List <ManageBike> >("BikeManager.xml"); if (_bikedatastorage == null) { _bikedatastorage = new List <ManageBike>(); } _bikebookingdatastorage = StorageClass.ReadXML <List <ManageBooking> >("BikeBookingManager.xml"); if (_bikebookingdatastorage == null) { _bikebookingdatastorage = new List <ManageBooking>(); } _biketypesdatastorage = StorageClass.ReadXML <List <ManageBikeTypes> >("BikeTypeManager.xml"); if (_biketypesdatastorage == null) { _biketypesdatastorage = new List <ManageBikeTypes>(); } }
private void ButtonOrderNow_Click(object sender, RoutedEventArgs e) { var bikesDetails = (from biker in App._bikebookingdatastorage where biker.CustomerId == CustomerId select biker); bikesDetails.Where(bike => bike.CustomerId == CustomerId) .ToList().ForEach(bike => { bike.Email = Email.Text; bike.FullName = FullName.Text; bike.Address = Address.Text; bike.ZipCode = ZipCode.Text; bike.CityName = City.Text; bike.Phone = Phone.Text; MessageBox.Show("Your Booking is Saved!", "Alert!!!"); Email.Text = ""; FullName.Text = ""; Address.Text = ""; ZipCode.Text = ""; City.Text = ""; Phone.Text = ""; txtboxTotalAmount.Text = ""; _curretnselections = new List <CurrentOrder>(); datgridBikeOrder.ItemsSource = null; }); StorageClass.StoreXML <List <ManageBooking> >("BikeBookingManager.xml", App._bikebookingdatastorage); var updateItem = (from biker in App._bikedatastorage select biker); updateItem .Where(exp => exp.RentedBike == exp.RentedBike) .ToList().ForEach(exp => { exp.RentedBike += 1; exp.AvailableBike -= 1; }); StorageClass.StoreXML <List <ManageBike> >("BikeManager.xml", App._bikedatastorage); }
public void DisplayAvailableBike() { App._bikedatastorage = StorageClass.ReadXML <List <ManageBike> >("BikeManager.xml"); if (App._bikedatastorage == null) { App._bikedatastorage = new List <ManageBike>(); } datgridBikeRented.ItemsSource = App._bikebookingdatastorage; int availableBike = (from bike in App._bikedatastorage select bike.AvailableBike).FirstOrDefault(); string availableBiketoDisplay = "Available Bike " + Convert.ToString(availableBike); availableBikes.Content = availableBiketoDisplay; int rentedBike = (from bike in App._bikedatastorage select bike.RentedBike).FirstOrDefault(); string rentedBiketoDisplay = "Rented Bike " + Convert.ToString(rentedBike); rentedBikes.Content = rentedBiketoDisplay; }