Ejemplo n.º 1
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (existEmptySpace())
     {
         MessageBox.Show("Completați toate câmpurile!");
     }
     else
     if (!existAdmin(txtUserLogAdmin.Text.Trim()))
     {
         MessageBox.Show("Adminul nu există în sistem");
     }
     else
     if (!corectPassword(txtUserLogAdmin.Text.Trim(), txtPassLogAdmin.Text.Trim()))
     {
         txtPassLogAdmin.Text = "";
         MessageBox.Show("Parola introdusă este Incorectă");
     }
     else
     {
         clear();
         this.Close();
         FormAdmin frm = new FormAdmin();
         frm.Show();
     }
 }
Ejemplo n.º 2
0
        private void FormUpdateUtilizator_FormClosed(object sender, FormClosedEventArgs e)
        {
            Clear();
            FormAdmin form = new FormAdmin();

            form.Show();
        }
Ejemplo n.º 3
0
        private void button1_Click_1(object sender, EventArgs e)
        {
            Clear();
            this.Close();

            FormAdmin form = new FormAdmin();

            form.Show();
        }
Ejemplo n.º 4
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            string email = txtEmail.Text.Trim() + "@atm" + comboBoxEmail.Text.Trim();

            if (txtNume.Text == "" || txtPrenume.Text == "" || txtEmail.Text == "" || (txtSexF.Checked == false && txtSexM.Checked == false) || txtTelefon.Text == "" || txtParola.Text == "" || txtConfirmaParola.Text == "" || string.IsNullOrEmpty(comboBoxEmail.Text) || string.IsNullOrEmpty(comboBoxDataAn.Text) || string.IsNullOrEmpty(comboBoxDataLuna.Text) || string.IsNullOrEmpty(comboBoxDataZi.Text))
            {
                MessageBox.Show("Vă rugăm completați toate câmpurile!");
            }
            else if (txtConfirmaParola.Text != txtParola.Text)
            {
                MessageBox.Show("Parolele nu coincid!");
                txtParola.Text = txtConfirmaParola.Text = "";
            }

            else if (!checkPhone(txtTelefon.Text))
            {
                MessageBox.Show("Telefon incorect!");
                txtTelefon.Text = "";
            }

            else
            {
                var nw = ConfigurationManager.ConnectionStrings["nw"];
                using (SqlConnection con = new SqlConnection(nw.ConnectionString))
                {
                    bool blocat = chkBlocat.Checked;

                    string data = comboBoxDataAn.Text.Trim() + "-" + comboBoxDataLuna.Text.Trim() + "-" + comboBoxDataZi.Text.Trim();
                    con.Open();

                    SqlCommand cmd = new SqlCommand("UpdateUtilizatori", con);
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.AddWithValue("@InitialEmail", email);
                    cmd.Parameters.AddWithValue("@Nume", txtNume.Text.Trim());
                    cmd.Parameters.AddWithValue("@Prenume", txtPrenume.Text.Trim());
                    cmd.Parameters.AddWithValue("@Sex", Gender);
                    cmd.Parameters.AddWithValue("@DataNastere", data);
                    cmd.Parameters.AddWithValue("@Telefon", txtTelefon.Text.Trim());
                    cmd.Parameters.AddWithValue("@Parola", HashParola(txtParola.Text.Trim()));
                    cmd.Parameters.AddWithValue("@Blocat", blocat);
                    cmd.ExecuteNonQuery();
                }

                MessageBox.Show("Update realizat cu succes!");
                Clear();
                this.Close();

                FormAdmin form = new FormAdmin();
                form.Show();
            }
        }