using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace StacjaProb { public partial class AddUser : Form { public AddUser() { InitializeComponent(); } private void AddUser_Load(object sender, EventArgs e) { textBoxPass.MaxLength = 32; textBoxPass.PasswordChar = '*'; textBoxRePass.MaxLength = 32; textBoxRePass.PasswordChar = '*'; } private void buttonSave_Click(object sender, EventArgs e) { try { if (String.Compare(textBoxPass.Text, textBoxRePass.Text, false) == 0) { mySqlFunctions.Insert("INSERT INTO sys_users SET USR_USERNAME='" + textBoxLogin.Text + "',USR_PASSWORD=md5('" + textBoxPass.Text + "'),USR_FIRST_NAME='" + textBoxImie.Text + "',USR_LAST_NAME='" + textBoxNazwisko.Text + "',USR_STATUS='1',USR_PRT_ID=1,USR_AUDIT_CU='" + vGlobal.tst_login_name + "',USR_AUDIT_CD=now()"); int max_id = mySqlFunctions.sqlIntValue("select max(USR_ID) from sys_users"); if (checkBoxIsAdmin.Checked) mySqlFunctions.Insert("INSERT INTO tst_users_type SET TUT_USR_ID=" + max_id.ToString() + ",TUT_TYPE='1',TUT_AUDIT_CU='" + vGlobal.tst_login_name + "',TUT_AUDIT_CD=now()"); else mySqlFunctions.Insert("INSERT INTO tst_users_type SET TUT_USR_ID=" + max_id.ToString() + ",TUT_TYPE='0',TUT_AUDIT_CU='" + vGlobal.tst_login_name + "',TUT_AUDIT_CD=now()"); this.Close(); } else MessageBox.Show("Podano dwa różne hasła!"); } catch (Exception ex) { MessageBox.Show(ex.Message); } } } }