private void button4_Click(object sender, EventArgs e) { String owner = textBox1.Text; String product = textBox2.Text; String contact = textBox4.Text; String approval_holder = textBox5.Text; String address = textBox6.Text; String why = textBox3.Text; String reception_date = dateTimePicker1.Value.ToString("yyyy-MM-dd"); Boolean confirmation = false; if (checkBox1.Checked == true) { confirmation = true; } try { SqlConnection sqlConnection = new SqlConnection(@"Data Source=DESKTOP-R7MNN89\SQLEXPRESS;Initial Catalog=IBSHR;User ID=sa;Password=nrkdrk"); sqlConnection.Open(); SqlCommand sqlCommand = new SqlCommand("INSERT INTO GrantOperations(owner,product,confirmation,contact,reception_date,approval_holder,address,why)" + " VALUES (@owner,@product,@confirmation,@contact,@reception_date,@approval_holder,@address,@why)", sqlConnection); sqlCommand.Parameters.Add("@owner", owner); sqlCommand.Parameters.Add("@product", product); sqlCommand.Parameters.Add("@confirmation", confirmation); sqlCommand.Parameters.Add("@contact", contact); sqlCommand.Parameters.Add("@reception_date", reception_date); sqlCommand.Parameters.Add("@approval_holder", approval_holder); sqlCommand.Parameters.Add("@address", address); sqlCommand.Parameters.Add("@why", why); sqlCommand.ExecuteNonQuery(); SavedDialogForm savedDialogForm = new SavedDialogForm(); DialogResult dialogResult = savedDialogForm.ShowDialog(); if (dialogResult == DialogResult.OK) { //do processing } else { //do processing } textBox1.Text = String.Empty; textBox2.Text = String.Empty; textBox3.Text = String.Empty; textBox4.Text = String.Empty; textBox5.Text = String.Empty; textBox6.Text = String.Empty; checkBox1.Checked = false; } catch (Exception ex) { MessageBox.Show("Veritabanına eklenirken hata oluştu. Hata: " + ex.Message); } }
private void button4_Click(object sender, EventArgs e) { String service_claimant = textBox1.Text; String contact = textBox4.Text; String address = textBox6.Text; String product = textBox2.Text; String appointment_date = dateTimePicker1.Value.ToString("yyyy-MM-dd"); String fault = textBox3.Text; String fault_description = textBox5.Text; try { SqlConnection sqlConnection = new SqlConnection(@"Data Source=DESKTOP-R7MNN89\SQLEXPRESS;Initial Catalog=IBSHR;User ID=sa;Password=nrkdrk"); sqlConnection.Open(); SqlCommand sqlCommand = new SqlCommand("INSERT INTO TechnicalService(service_claimant,contact,address,product,appointment_date,fault,fault_description)" + " VALUES (@service_claimant,@contact,@address,@product,@appointment_date,@fault,@fault_description)", sqlConnection); sqlCommand.Parameters.Add("@service_claimant", service_claimant); sqlCommand.Parameters.Add("@contact", contact); sqlCommand.Parameters.Add("@address", address); sqlCommand.Parameters.Add("@product", product); sqlCommand.Parameters.Add("@appointment_date", appointment_date); sqlCommand.Parameters.Add("@fault", fault); sqlCommand.Parameters.Add("@fault_description", fault_description); sqlCommand.ExecuteNonQuery(); textBox1.Text = String.Empty; textBox2.Text = String.Empty; textBox3.Text = String.Empty; textBox4.Text = String.Empty; textBox5.Text = String.Empty; textBox6.Text = String.Empty; SavedDialogForm savedDialogForm = new SavedDialogForm(); DialogResult dialogResult = savedDialogForm.ShowDialog(); if (dialogResult == DialogResult.OK) { //do processing } else { //do processing } } catch (Exception ex) { MessageBox.Show("Veritabanına eklenirken hata oluştu. Hata: " + ex.Message); } }
private void button1_Click(object sender, EventArgs e) { String id = label2.Text; Boolean processed; Boolean approval; Boolean forwarding; if (checkBox1.Checked == true) { processed = true; } else { processed = false; } if (checkBox3.Checked == true) { approval = true; } else { approval = false; } String operation = textBox1.Text; String reception_date = dateTimePicker1.Value.ToString("yyyy-MM-dd"); String fee = textBox3.Text; String completion_date = dateTimePicker2.Value.ToString("yyyy-MM-dd"); String operations_carried = textBox7.Text; if (checkBox2.Checked == true) { forwarding = true; } else { forwarding = false; } String referral_clarification = textBox2.Text; try { SqlConnection sqlConnection = new SqlConnection(@"Data Source=DESKTOP-R7MNN89\SQLEXPRESS;Initial Catalog=IBSHR;User ID=sa;Password=nrkdrk"); sqlConnection.Open(); SqlCommand sqlCommand = new SqlCommand("INSERT INTO TechnicalOperations(TRId,processed,approval,operation,reception_date,fee,completion_date,operations_carried,forwarding,referral_clarification,delivery)" + " VALUES (@TRId,@processed,@approval,@operation,@reception_date,@fee,@completion_date,@operations_carried,@forwarding,@referral_clarification,@delivery)", sqlConnection); sqlCommand.Parameters.Add("@TRId", id); sqlCommand.Parameters.Add("@processed", processed); sqlCommand.Parameters.Add("@approval", approval); sqlCommand.Parameters.Add("@operation", operation); sqlCommand.Parameters.Add("@reception_date", reception_date); sqlCommand.Parameters.Add("@fee", fee); sqlCommand.Parameters.Add("@completion_date", completion_date); sqlCommand.Parameters.Add("@operations_carried", operations_carried); sqlCommand.Parameters.Add("@forwarding", forwarding); sqlCommand.Parameters.Add("@referral_clarification", referral_clarification); sqlCommand.Parameters.Add("@delivery", "0"); sqlCommand.ExecuteNonQuery(); SavedDialogForm savedDialogForm = new SavedDialogForm(); DialogResult dialogResult = savedDialogForm.ShowDialog(); if (dialogResult == DialogResult.OK) { //do processing } else { //do processing } } catch (Exception ex) { MessageBox.Show("Veritabanına eklenirken hata oluştu. Hata: " + ex.Message); } }