private void AcceptRequest_click(object sender, RoutedEventArgs e) { OurSitDb OurSitSchema = new OurSitDb(); OurSitDb OurSitSchema1 = new OurSitDb(); OurSitDb OurSitSchema2 = new OurSitDb(); OurSitDb OurSitSchema3 = new OurSitDb(); DataRowView rowBeingSelected = SearchDeliveryDataGrid.CurrentItem as DataRowView; //int CurrentRowIndex = SearchRentalDataGrid.Items.If if (rowBeingSelected != null) { int Id = Convert.ToInt32(rowBeingSelected[0]); string Message = txtReason.Text; if (OurSitSchema.UpdateDeliveryRequest(Id, 1, Message)) { //int CustomerId, int DriverId, string VehicleId, string ItemDimension, int ItemQuantity, string FromLocation, string Destination,float Cost, DateTime DispatchTime, DateTime ArrivalTime, DateTime ReturnTime) if (OurSitSchema1.AddDelivery(Convert.ToInt32(rowBeingSelected[1]), 1, "99091", Convert.ToString(rowBeingSelected[3]), Convert.ToInt32(rowBeingSelected[4]), Convert.ToString(rowBeingSelected[5]), Convert.ToString(rowBeingSelected[6]), 0, Convert.ToDateTime(rowBeingSelected[7]), Convert.ToDateTime(rowBeingSelected[8]), DateTime.MaxValue)) { if (OurSitSchema2.DeleteDeliveryRequest(Id)) { btnViewDelivery_Click(sender, e); MessageBox.Show("Customer Delivery Request Accepted.", "Success!"); } } else { rowBeingSelected[9] = "Pending"; OurSitSchema3.UpdateDeliveryRequest(Id, 0, Message); } } } }
private void CancelRequest_click(object sender, RoutedEventArgs e) { OurSitDb OurSitSchema = new OurSitDb(); DataRowView rowBeingSelected = SearchDeliveryDataGrid.CurrentItem as DataRowView; if (rowBeingSelected != null) { string Message = txtReason.Text; int Id = Convert.ToInt32(rowBeingSelected[0]); if (OurSitSchema.UpdateDeliveryRequest(Id, 2, Message)) { rowBeingSelected[9] = "Cancelled"; rowBeingSelected[10] = Message; MessageBox.Show("Customer Delivery Request Cancelled.", "Success!"); } } }