private void BTNReturn_Click(object sender, RoutedEventArgs e) { try { string DamageStatus = "A"; if ((CBStatus.IsChecked ?? true) || (CBStatus_Copy.IsChecked ?? true)) { DamageStatus = "I"; } TBikeDAL MyDAL = new TBikeDAL(); if (ExpiredStack.Visibility == Visibility.Hidden) { if (CBBike.SelectedValue != null) { MyDAL.UpdateBookingStatus("S", CBBike.SelectedValue.ToString().Trim(), Customer, TLUsername.Text); MyDAL.UpdateBikeStatus(CBBike.SelectedValue.ToString().Trim(), "", DamageStatus, TBConditionReal.Text, null, Convert.ToDateTime(null), TLUsername.Text); PopWindow pop = new PopWindow(ImageType.Information, "Success", "Bicycle: " + CBBike.Text + " Returned", "Thank You"); pop.ShowDialog(); BindComboBox(CBBike); } else { PopWindow pop = new PopWindow(ImageType.Error, "Error", "No Bicycle is currently being rented out", "OK"); pop.ShowDialog(); } } else { //this is for late return part if (LBCustomer.Text != null) { MyDAL.UpdateBookingStatus("S", ListBicycle.SelectedValue.ToString().Trim(), LBName.Text, TLUsername.Text); MyDAL.UpdateBikeStatus(ListBicycle.SelectedValue.ToString().Trim(), "", DamageStatus, TBCondition.Text, null, Convert.ToDateTime(null), TLUsername.Text); PopWindow pop = new PopWindow(ImageType.Warning, "Late Return", "Late Returned Bicycle: " + ListBicycle.Text + " Returned", "OK"); pop.ShowDialog(); BindComboBoxCustomer(CBCustomer); } else { PopWindow pop = new PopWindow(ImageType.Error, "Error", "No Bicycle is currently being rented out", "Okay"); pop.ShowDialog(); } } } catch (Exception ex) { PopWindow pop = new PopWindow(ImageType.Error, "Error ", ex.Message, "Okay"); pop.ShowDialog(); } }