private void Button1_Click(object sender, EventArgs e) { // MessageBox.Show(CBGyart.Checked.ToString()); if (TBAzon.Text.Length < 3 || TBNev.Text.Length < 3) { MessageBox.Show("Hiányzó adat(ok)!"); } else { SqlCommand sqlCmd = new SqlCommand("TermekModosit"); sqlCmd.CommandType = CommandType.StoredProcedure; if (TBId.Text is null)//Insert { sqlCmd.Parameters.AddWithValue("@Id", 0); } else//update { sqlCmd.Parameters.AddWithValue("@Id", TBId.Text); } sqlCmd.Parameters.AddWithValue("@Azonosito", TBAzon.Text); sqlCmd.Parameters.AddWithValue("@Nev", TBNev.Text); sqlCmd.Parameters.AddWithValue("@Gyartando", CBGyart.Checked.ToString()); try { DbManagment.SqlCommandRun(sqlCmd); Close(); } catch (Exception exp) { //MessageBox.Show(exp.Message.ToString()); MessageBox.Show(exp.Message.ToString(), "HIBA", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void Button1_Click(object sender, EventArgs e) { if (CBTermekek.SelectedValue.ToString() == null || NDarab.Value < 1 || NDarab.Value > 1000000) { MessageBox.Show("Hibás adatok!"); } else { SqlCommand sqlCmd = new SqlCommand("TermekAlkatreszModosit"); sqlCmd.CommandType = CommandType.StoredProcedure; if (Id == 0)//Insert { sqlCmd.Parameters.AddWithValue("@Id", 0); } else//update { sqlCmd.Parameters.AddWithValue("@Id", Id); } sqlCmd.Parameters.AddWithValue("@TermekId", TermekId); sqlCmd.Parameters.AddWithValue("@AlkatreszId", Int32.Parse(CBTermekek.SelectedValue.ToString())); sqlCmd.Parameters.AddWithValue("@AlkatreszMennyiseg", NDarab.Value); try { DbManagment.SqlCommandRun(sqlCmd); Close(); } catch (Exception exp) { //MessageBox.Show(exp.Message.ToString()); MessageBox.Show(exp.Message.ToString(), "HIBA", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
void PopulateDataGridView() { string query = "SELECT ta.[Id] as 'AlkatreszId' ,t.Id, t.Azonosito , t.Nev , ta.AlkatreszMennyiseg as 'darab'" + "FROM[erp].[dbo].[TermekAlkatresz] ta " + "inner join Termek t on ta.AlkatreszId = t.Id " + "where TermekId = " + CBTermekek.SelectedValue.ToString(); dgvEmployee.DataSource = DbManagment.SqlDataAdRun(query); }
void ComboBoxFill() { string query = "SELECT [Id],[Azonosito] +' '+ Nev as Azon FROM[erp].[dbo].[Termek] where Gyartando = 1"; DataSet ds = DbManagment.SqlDataSetCreate(query, "Termek"); CBTermekek.DisplayMember = "Azon"; CBTermekek.ValueMember = "Id"; CBTermekek.DataSource = ds.Tables["Termek"]; }
public void MunkaKesz(string id) { Nev dialogus = new Nev(); dialogus.ShowDialog(); string nev = dialogus.textBox1Text; if (dialogus.mentes) { using (SqlConnection sqlCon = new SqlConnection(connectionString)) { sqlCon.Open(); SqlCommand cmd = new SqlCommand("update gyartasifolyamat set nev = @nev , mikor = GETDATE() where id = @id", sqlCon); cmd.Parameters.AddWithValue("@nev", nev); cmd.Parameters.AddWithValue("@id", id); cmd.ExecuteNonQuery(); // ha minden kész akkor készre rakni /* cmd = new SqlCommand("IF " + * "(select count(*) from GyartasiFolyamat where GyartasId = @id and mikor is null ) = 0 " + * "BEGIN " + * "update[GyartasTermekek] set Kesz = 1 where id = @id; " + * "END", sqlCon); * cmd.Parameters.AddWithValue("@id", id); * cmd.ExecuteNonQuery();*/ } // MessageBox.Show(id.ToString()); try { SqlCommand sqlCmd = new SqlCommand("GyartasFolyamatElkeszult"); sqlCmd.CommandType = CommandType.StoredProcedure; sqlCmd.Parameters.AddWithValue("@Id", id); sqlCmd.Parameters.AddWithValue("@Nev", nev); DbManagment.SqlCommandRun(sqlCmd); sqlCmd = new SqlCommand("GyartasiFolyamatKesz"); sqlCmd.CommandType = CommandType.StoredProcedure; sqlCmd.Parameters.AddWithValue("@Id", id); DbManagment.SqlCommandRun(sqlCmd); } catch (Exception exp) { MessageBox.Show(exp.Message.ToString(), "HIBA", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void button1_Click(object sender, EventArgs e) { // MessageBox.Show(GenerateSHA256String(tboxPass.Text).Length.ToString()); //new DataTable(); // sqlDa.Fill(dtbl); if (TBoxCheck()) { SqlCommand sqlCmd = new SqlCommand("insert into felhasznalok values(@user,@name,@pass)"); sqlCmd.Parameters.AddWithValue("@user", tboxUser.Text); sqlCmd.Parameters.AddWithValue("@name", tboxName.Text); sqlCmd.Parameters.AddWithValue("@pass", GenerateSHA256String(tboxPass.Text)); DbManagment.SqlCommandRun(sqlCmd); this.Hide(); var form2 = new Login(); form2.Closed += (s, args) => this.Close(); form2.Show(); } }
void ComboBoxFill() { // using (SqlConnection sqlCon = new SqlConnection(connectionString)) //{ string query = "SELECT [Id],[Azonosito] +' '+ Nev as Azon FROM[erp].[dbo].[Termek] where id = " + AlkatreszId; if (Beszuras) { query = "SELECT [Id],[Azonosito] +' '+ Nev as Azon FROM[erp].[dbo].[Termek] where id != " + TermekId; } // SqlDataAdapter da = new SqlDataAdapter(query, sqlCon); // sqlCon.Open(); DataSet ds = DbManagment.SqlDataSetCreate(query, "Termek");// new DataSet(); // da.Fill(ds, "Termek"); CBTermekek.DisplayMember = "Azon"; CBTermekek.ValueMember = "Id"; CBTermekek.DataSource = ds.Tables["Termek"]; // } // public static DataSet SqlDataSetCreate(string query, string tablename) }
private void button1_Click(object sender, EventArgs e) { if (CBTermekek.SelectedValue.ToString() == null || NDarab.Value < 1 || NDarab.Value > 9999999) { MessageBox.Show("Hibás adatok!"); } else { try { SqlCommand sqlCmd = new SqlCommand("RaktarModosit"); sqlCmd.CommandType = CommandType.StoredProcedure; sqlCmd.Parameters.AddWithValue("@Id", Int32.Parse(CBTermekek.SelectedValue.ToString())); sqlCmd.Parameters.AddWithValue("@Novel", 1); sqlCmd.Parameters.AddWithValue("@Darab", NDarab.Value); DbManagment.SqlCommandRun(sqlCmd); Close(); } catch (Exception exp) { MessageBox.Show(exp.Message.ToString()); } } }
private void PopulateDataGridView() { string query = "SELECT * FROM [RaktarView] where azonosito like '%" + TBAzon.Text + "%' and nev like '%" + TBNev.Text + "%'"; dgvEmployee.DataSource = DbManagment.SqlDataAdRun(query); }