private void button8_Click(object sender, EventArgs e) { if (txtNum.Text == "" || txtCol.Text == "" || txtMark.Text == "" || txtPer.Text == "") { ErrorInputLable er = new ErrorInputLable(); er.Show(); } else { Regex regex = new Regex(@"[a-z]{1}[0-9]{3}[a-z]{2}"); Match match = regex.Match(txtNum.Text.ToString()); if (match.Success) { OracleConnection ora = new OracleConnection("DATA SOURCE = EC11; PASSWORD = qwerty; USER ID = Dmitriy;"); ora.Open(); OracleCommand com = new OracleCommand("addAuto", ora); com.CommandType = System.Data.CommandType.StoredProcedure; com.Parameters.Add("numAuto", OracleType.Char, 20).Value = txtNum.Text; com.Parameters.Add("colAuto", OracleType.Char, 20).Value = txtCol.Text; com.Parameters.Add("markAuto", OracleType.Char, 20).Value = txtMark.Text; com.Parameters.Add("perAuto", OracleType.Char, 20).Value = txtPer.Text; com.ExecuteNonQuery(); AddForm a = new AddForm(); a.Show(); ora.Close(); } else { ErrorInputLable er = new ErrorInputLable(); er.Show(); } } }
private void PremGo_Click(object sender, EventArgs e) { if (sumPrem.Text == "") { ErrorInputLable er = new ErrorInputLable(); er.Show(); } else { OracleConnection ora = new OracleConnection("DATA SOURCE = EC11; PASSWORD = qwerty; USER ID = Dmitriy;"); ora.Open(); OracleCommand com = new OracleCommand("DRIVER_CASH", ora); com.CommandType = System.Data.CommandType.StoredProcedure; string dateStart = (time_start.Value.Date + dateTimePicker1.Value.TimeOfDay).ToString("yyyy-MM-dd HH:mm:ss"); com.Parameters.Add("START_DATE", OracleType.Timestamp).Value = dateStart; string dateEnd = (time_end.Value.Date + dateTimePicker2.Value.TimeOfDay).ToString("yyyy-MM-dd HH:mm:ss"); com.Parameters.Add("END_DATE", OracleType.Timestamp).Value = dateEnd; com.Parameters.Add("CASH", OracleType.Number).Value = sumPrem.Text.ToString(); com.Parameters.Add("FIRST_PERSONNEL_V", OracleType.Char, 30).Direction = ParameterDirection.Output; com.Parameters.Add("SECOND_PERSONNEL_V", OracleType.Char, 30).Direction = ParameterDirection.Output; com.Parameters.Add("THIRD_PERSONNEL_V", OracleType.Char, 30).Direction = ParameterDirection.Output; com.Parameters.Add("PRIZE_ONE", OracleType.Float).Direction = ParameterDirection.Output; com.Parameters.Add("PRIZE_TWO", OracleType.Float).Direction = ParameterDirection.Output; com.Parameters.Add("PRIZE_FREE", OracleType.Float).Direction = ParameterDirection.Output; com.ExecuteNonQuery(); DataTable tabla = new DataTable(); DataColumn Name = new DataColumn("Фамилия", typeof(string)); DataColumn Cash = new DataColumn("Премия", typeof(string)); tabla.Columns.AddRange(new DataColumn[] { Name, Cash }); DataRow row1 = tabla.NewRow(); row1["Фамилия"] = com.Parameters["FIRST_PERSONNEL_V"].Value.ToString(); row1["Премия"] = com.Parameters["PRIZE_ONE"].Value.ToString(); DataRow row2 = tabla.NewRow(); row2["Фамилия"] = com.Parameters["SECOND_PERSONNEL_V"].Value.ToString(); row2["Премия"] = com.Parameters["PRIZE_TWO"].Value.ToString(); DataRow row3 = tabla.NewRow(); row3["Фамилия"] = com.Parameters["THIRD_PERSONNEL_V"].Value.ToString(); row3["Премия"] = com.Parameters["PRIZE_FREE"].Value.ToString(); tabla.Rows.Add(row1); tabla.Rows.Add(row2); tabla.Rows.Add(row3); OracleDataAdapter adapt = new OracleDataAdapter(); adapt.SelectCommand = com; adapt.Fill(tabla); dataGridView1.DataSource = tabla; ora.Close(); } }
private void button7_Click(object sender, EventArgs e) { if (delAutoNum.Text == "") { ErrorInputLable er = new ErrorInputLable(); er.Show(); } else { OracleConnection ora = new OracleConnection("DATA SOURCE = EC11; PASSWORD = qwerty; USER ID = Dmitriy;"); ora.Open(); OracleCommand com = new OracleCommand("delAuto", ora); com.CommandType = System.Data.CommandType.StoredProcedure; com.Parameters.Add("numAuto", OracleType.Char, 20).Value = delAutoNum.Text; com.ExecuteNonQuery(); DelWokerForm d = new DelWokerForm(); d.Show(); ora.Close(); } }
private void button4_Click(object sender, EventArgs e) { if (addRoute.Text == "") { ErrorInputLable er = new ErrorInputLable(); er.Show(); } else { OracleConnection ora = new OracleConnection("DATA SOURCE = EC11; PASSWORD = qwerty; USER ID = Dmitriy;"); ora.Open(); OracleCommand com = new OracleCommand("addRoute", ora); com.CommandType = System.Data.CommandType.StoredProcedure; com.Parameters.Add("nameRoute", OracleType.Char, 50).Value = addRoute.Text; com.ExecuteNonQuery(); AddForm a = new AddForm(); a.Show(); ora.Close(); } }
private void UpPer_Click(object sender, EventArgs e) { if (UpNumEX.Text == "" || textLastName.Text == "") { ErrorInputLable er = new ErrorInputLable(); er.Show(); } else { OracleConnection ora = new OracleConnection("DATA SOURCE = EC11; PASSWORD = qwerty; USER ID = Dmitriy;"); ora.Open(); OracleCommand com = new OracleCommand("updateLastNameAuto", ora); com.CommandType = System.Data.CommandType.StoredProcedure; com.Parameters.Add("numAuto", OracleType.Char, 20).Value = UpNumEX.Text; com.Parameters.Add("lastName", OracleType.Char, 20).Value = textLastName.Text; com.ExecuteNonQuery(); updateForm u = new updateForm(); u.Show(); ora.Close(); } }