private void CBBike_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (CBBike.Items.Count == 0) { MainWindow main = new MainWindow(); main.Framework.Visibility = Visibility.Collapsed; } else { if (CBBike.SelectedIndex == -1) { CBBike.SelectedIndex = 0; } TBikeDAL MyDAL = new TBikeDAL(); DataTable ResultTable = MyDAL.ShowBookingTableByBike(CBBike.SelectedValue.ToString().Trim(), "R"); TBIkeUtility.TranslateRecordStatusDescription(new List <string> { "BookingStatus" }, ref ResultTable); LBCustomer.Text = Convert.ToString(ResultTable.Rows[0]["Customer"]); Customer = LBCustomer.Text; LBBookingDate.Text = Convert.ToString(ResultTable.Rows[0]["BookingDate"]); LBBicycle.Text = Convert.ToString(ResultTable.Rows[0]["BicycleName"]); LBRemarks.Text = Convert.ToString(ResultTable.Rows[0]["Remark"]); } }
public void PopulateSnackDataTable() { TBikeDAL MyDAL = new TBikeDAL(); DataTable ResultTable = MyDAL.ShowAllSnackTable(); Column1.Header = "Snack ID"; Column1.Binding = new Binding("SnackID"); Column2.Header = "Snack Name"; Column2.Binding = new Binding("SnackName"); Column3.Header = "Snack Type"; Column3.Binding = new Binding("SnackType"); Column4.Header = "Snack Status"; Column4.Binding = new Binding("SnackStatusInFull"); Column5.Header = "Quantity"; Column5.Binding = new Binding("Quantity"); Column6.Header = "Price"; Column6.Binding = new Binding("Price"); Column7.Header = "CreatedBy"; Column7.Binding = new Binding("CreatedBy"); TBIkeUtility.TranslateRecordStatusDescription(new List <string> { "SnackStatus" }, ref ResultTable); dataGrid1.ItemsSource = ResultTable.DefaultView; dataGrid1.AutoGenerateColumns = false; dataGrid1.CanUserAddRows = false; }
public void PopulateDataGrid() { TBikeDAL MyDAL = new TBikeDAL(); DataTable ResultTable = MyDAL.ShowAllBookingTable(); TBIkeUtility.TranslateRecordStatusDescription(new List <string> { "BookingStatus" }, ref ResultTable); //dataGrid1.ItemsSource = ResultTable.DefaultView; //dataGrid1.AutoGenerateColumns = false; //dataGrid1.CanUserAddRows = false; }
private void CBBike_SelectionChanged(object sender, SelectionChangedEventArgs e) { TBikeDAL MyDAL = new TBikeDAL(); DataRowView dataRow = (DataRowView)dataGrid1.SelectedItem; int index = dataGrid1.Items.IndexOf(dataGrid1.CurrentItem); if (index == -1) { index = 0; } //string cellValue = dataRow.Row.ItemArray[index].ToString(); DataTable ResultTable = MyDAL.SelectBicycleByID(CBBike.SelectedValue.ToString().Trim()); Column1.Header = "Bicycle ID"; Column1.Binding = new Binding("BicycleID"); Column2.Header = "Bicycle Name"; Column2.Binding = new Binding("BicycleName"); Column3.Header = "Bicycle Type"; Column3.Binding = new Binding("BicycleType"); Column4.Header = "Bicycle Status"; Column4.Binding = new Binding("BicycleStatusInFull"); Column5.Header = "Current Renter"; Column5.Binding = new Binding("CurrentRenter"); Column6.Header = "Quantity"; Column6.Binding = new Binding("Quantity"); Column7.Header = "Total Rents"; Column7.Binding = new Binding("TotalRents"); Column8.Header = "Price"; Column8.Binding = new Binding("Price"); Column9.Header = "Bicycle Color"; Column9.Binding = new Binding("Color"); Column9.Header = "Last Date Booked"; Column9.Binding = new Binding("LastUpdatedAt"); Column10.Header = "Created By"; Column10.Binding = new Binding("CreatedBy"); TBIkeUtility.TranslateRecordStatusDescription(new List <string> { "BicycleStatus" }, ref ResultTable); dataGrid1.ItemsSource = ResultTable.DefaultView; dataGrid1.AutoGenerateColumns = false; dataGrid1.IsReadOnly = true; }
public void PopulateBikeDataTable() { TBikeDAL MyDAL = new TBikeDAL(); DataTable ResultTable = MyDAL.ShowAllBikeTable(); Column1.Header = "Bicycle ID"; Column1.Binding = new Binding("BicycleID"); Column2.Header = "Bicycle Name"; Column2.Binding = new Binding("BicycleName"); Column3.Header = "Bicycle Type"; Column3.Binding = new Binding("BicycleType"); Column4.Header = "Bicycle Status"; Column4.Binding = new Binding("BicycleStatusInFull"); Column5.Header = "Current Renter"; Column5.Binding = new Binding("CurrentRenter"); Column6.Header = "Quantity"; Column6.Binding = new Binding("Quantity"); Column7.Header = "Total Rents"; Column7.Binding = new Binding("Total Rents"); Column8.Header = "Price"; Column8.Binding = new Binding("Price"); Column9.Header = "Color"; Column9.Binding = new Binding("Color"); Column10.Header = "Condition"; Column10.Binding = new Binding("Condition"); Column11.Header = "Last Date Booked"; Column11.Binding = new Binding("LastUpdatedAt"); Column12.Header = "Created By"; Column12.Binding = new Binding("CreatedBy"); TBIkeUtility.TranslateRecordStatusDescription(new List <string> { "BicycleStatus" }, ref ResultTable); dataGrid1.ItemsSource = ResultTable.DefaultView; dataGrid1.AutoGenerateColumns = false; dataGrid1.CanUserAddRows = false; }