示例#1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            string mySQL = string.Empty;

            mySQL += "UPDATE[AccountDB].[dbo].[User] SET Firstname = '" + txtFirstname.Text.Trim() + "', Lastname  = '" +
                     txtLastname.Text.Trim() + "' , Email  = '" + txtEmail.Text.Trim() + "', Rol = '" + comboBoxRole.Text + "' WHERE UserID = " + this.user_id;
            DataTable userData = Server_connection.executeSQL(mySQL);

            MessageBox.("Unpdated successfuly");
            FormHome fh = new FormHome();

            fh.ShowDialog();
        }
        private void btnRegistrate_Click(object sender, EventArgs e)
        {
            model.Firstname = txtFirstname.Text.Trim();
            model.Lastname  = txtLastname.Text.Trim();
            model.Email     = txtEmail.Text.Trim();
            model.Pasword   = Helpers.Hash(txtPassword.Text.Trim());
            model.Rol       = comboBoxRole.Text.Trim();
            using (AccountDBEntities db = new AccountDBEntities())
            {
                db.User.Add(model);
                db.SaveChanges();
            }
            MessageBox.Show("Registrated successfully");
            this.Hide();
            FormHome f = new FormHome();

            f.Show();
        }