private void btnLogin_Click(object sender, EventArgs e) { DataTable Dt = log.LOGIN(txtID.Text, txtPWD.Text); if (Dt.Rows.Count > 0) { if (Dt.Rows[0][2].ToString() == "Admin") { label2.ForeColor = Color.Black; MessageBox.Show("you'r Loged in admin "); PL_Admin.A1_form A1 = new PL_Admin.A1_form(); A1.ShowDialog(); this.Close(); txtID.Clear(); } else if (Dt.Rows[0][2].ToString() == "User") { label2.ForeColor = Color.Black; MessageBox.Show("you'r Loged in"); PL_Utilisateur.UserPrincipal user = new PL_Utilisateur.UserPrincipal(); user.ShowDialog(); this.Close(); txtPWD.Clear(); } } else { label2.ForeColor = Color.Red; MessageBox.Show("Login failed !"); } }
private void btnCancel_Click(object sender, EventArgs e) { A1_form refrch = new A1_form(); refrch.button12_Click(sender, e); txtDes.Text = null; txtPrice.Text = null; txtQte.Text = null; txtRef.Text = null; pbox.Image = null; }
private void btnOk_Click(object sender, EventArgs e) { if (state == "add") { if (txtDes.Text == "" || txtRef.Text == "" || txtQte.Text == "" || txtPrice.Text == "") { MessageBox.Show("Entrer Tous Les Information", "Attention", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { try { MemoryStream ms = new MemoryStream(); pbox.Image.Save(ms, pbox.Image.RawFormat); byte[] byteImage = ms.ToArray(); prd.ADD_PRODUCT(Convert.ToInt32(cmbCategories.SelectedValue), txtDes.Text , txtRef.Text, Convert.ToInt32(txtQte.Text), txtPrice.Text, byteImage); MessageBox.Show("Ajouté Avec Succée", "L'ajout", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch { byte[] byteImage; byteImage = new byte[0]; prd.ADD_PRODUCT(Convert.ToInt32(cmbCategories.SelectedValue), txtDes.Text , txtRef.Text, Convert.ToInt32(txtQte.Text), txtPrice.Text, byteImage); MessageBox.Show("Ajouté Avec Succée", "L'ajout", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } else { MemoryStream ms = new MemoryStream(); pbox.Image.Save(ms, pbox.Image.RawFormat); byte[] byteImage = ms.ToArray(); prd.UPDATE_PRODUCT(Convert.ToInt32(cmbCategories.SelectedValue), txtDes.Text , txtRef.Text, Convert.ToInt32(txtQte.Text), txtPrice.Text, byteImage); MessageBox.Show("Modifié", " Modification", MessageBoxButtons.OK, MessageBoxIcon.Information); } A1_form refrch = new A1_form(); refrch.button12_Click(sender, e); }