private void SubmitRequest_Click(object sender, RoutedEventArgs e) { if (!string.IsNullOrWhiteSpace(RequestName.Text) && !string.IsNullOrWhiteSpace(RequestQuan.Text) && int.Parse(RequestQuan.Text) != 0) { try { connection.Open(); MySqlCommand cmd = new MySqlCommand(); cmd.CommandText = "insert into requests(REQUEST_NAME,REQUEST_QUANTATY,REQUEST_STATUS) values(@requestname,@requestquan,@requeststs)"; cmd.Parameters.AddWithValue("@requestname", RequestName.Text); cmd.Parameters.AddWithValue("@requestquan", int.Parse(RequestQuan.Text)); cmd.Parameters.AddWithValue("@requeststs", "notchecked"); cmd.Connection = connection; cmd.ExecuteNonQuery(); } catch (MySqlException ex) { MessageBox.Show(ex.ToString()); } finally { connection.Close(); MessageBox.Show("Request Submited", "Success"); RequestName.Clear(); RequestQuan.Clear(); } } else { MessageBox.Show("Please Provide Valid Inputs", "ERROR"); } }
private void TabRequestClear() { // RequestRequestId.Clear(); RequestName.Clear(); RequestCreditType.Clear(); RequestAmount.Clear(); RequestCreditTypeIsAvailable.Clear(); }