Hi Team
I have small issue, when trying to debug it i dont see the values. perhaps my logic is when user select dropdown(compartment-full-truck) and purpose(leaving finished product) these must validate if topseal and bottomseal are empty otherwsise truck must not move at all until these are met. Below is my logic. So what the code is doing, it does hit the debug and if statement but its not getting into this logic need some help.
<Label x:Name="lblPurpose" Content="Purpose:" HorizontalAlignment="Left" Margin="12,141,0,0" VerticalAlignment="Top" Width="93" HorizontalContentAlignment="Right" Background="#FFE3E3E3" FontWeight="SemiBold" BorderThickness="1" BorderBrush="#FFBEBEBE"/> <ComboBox x:Name="cbxPurpose" HorizontalAlignment="Left" Margin="110,142,0,0" VerticalAlignment="Top" Width="119" Height="27"/> <Label x:Name="lblCompartment" Content="Compartment:" HorizontalAlignment="Left" Margin="12,171,0,0" VerticalAlignment="Top" Width="93" HorizontalContentAlignment="Right" Background="#FFE3E3E3" FontWeight="SemiBold" BorderThickness="1" BorderBrush="#FFBEBEBE"/> <ComboBox x:Name="cbxCompartment" IsEnabled="True" IsEditable="True" HorizontalAlignment="Left" Margin="110,170,0,0" VerticalAlignment="Top" Width="119" Height="26"/> // back end className private void btnSaveReturn_Click(object sender, RoutedEventArgs e) { if (string.IsNullOrEmpty(txtTicketNu.Text)) { MessageBox.Show("Please select a ticket"); return; } //if(rdbtn1.Is checked){ //update farm/ product // //}else //if(rdbtn2.Is checked){ //update replacements // //}else if (chkFarmName.IsChecked == true) { // MessageBox.Show("Customer, Product AND Replacement Seals can ONLY be updated", "WARNING"); var ticket = Managers.WeighbridgeTicketManager.GetWeighBridgeTicketPK(txtTicketNu.Text); ticket.Customer = cbxCustomer.Text; ticket.Product = cbxProduct.Text; ticket.ReplacementTopSeal = txtRTopSeal.Text; ticket.ReplacementBottomSeal = txtRBottomSeal.Text; Managers.WeighbridgeTicketManager.UpdateTripsheetCustomer(ticket); presenter.PopulateGrid(txtTripsheetNo.Text); MessageBox.Show("Ticket " + TicketNumber + " updated successfully.", "Ticket Update"); ClearFields(); } else { if (string.IsNullOrEmpty(txtReturnWeight.Text)) { MessageBox.Show("Please enter compartment weight"); return; } if (cbxPurpose.SelectedIndex == 0) { MessageBox.Show("Please select a purpose"); return; } Console.WriteLine("Selected compartment: " + (cbxCompartment.SelectedItem != null ? cbxCompartment.SelectedItem.ToString() : "null")); Console.WriteLine("Selected purpose: " + (cbxPurpose.SelectedItem != null ? cbxPurpose.SelectedItem.ToString() : "null")); if (cbxCompartment.SelectedItem != null && cbxCompartment.SelectedItem.ToString() == "truck-full" & cbxPurpose.SelectedItem != null && cbxPurpose.SelectedItem.ToString()== "Leaving Finished Product") { // Validate top seal if (string.IsNullOrEmpty(txtRTopSeal.Text)) { MessageBox.Show("TopSeal cannot be empty when truck is full", "Validation Error"); txtRTopSeal.Focus(); return; } // Validate bottom seal if (string.IsNullOrEmpty(txtRBottomSeal.Text)) { MessageBox.Show("BottomSeal cannot be empty when truck is full", "Validation Error"); txtRBottomSeal.Focus(); return; } }