public void RegisterCommand() { ErrorMes = ""; flag = true; bool flagToRegistata = true; string AdminLogin = "******"; if (PhoneNumberLog == null || PhoneNumberLog == String.Empty || PhoneNumberLog.Length != 17) { flagToRegistata = false; ErrorMes = Properties.Resources.emptyfieldlogin; } if (PasswordFirst != PasswordSecond) { flagToRegistata = false; ErrorMes = Properties.Resources.eaqfield; } if (PasswordFirst.Length < 6) { flagToRegistata = false; ErrorMes = Properties.Resources.charac; } if (PasswordFirst == String.Empty || PasswordSecond == String.Empty || PasswordFirst == null || PasswordSecond == null) { flagToRegistata = false; ErrorMes = Properties.Resources.emptyfield; } if (PhoneNumberLog.Equals(AdminLogin)) { IsAdmin = true; } else { IsAdmin = false; } bool IsDone = true; if (flagToRegistata) { SqlConnect spam = new SqlConnect(); string Pass = firstHash(PasswordFirst).ToString(); IsDone = spam.InsertUsersRecords(PhoneNumberLog, Pass, IsAdmin); if (IsDone) { ViewLogin t = new ViewLogin(); t.Show(); CloseAction(); } } if (!IsDone) { ErrorMes = Properties.Resources.existserr; } flag = false; }
public void RegisterCommand() { ErrorMes = ""; //разрешаем валидацию flag = true; Login += " "; int x1 = Login.Length - 1; Login = Login.Substring(0, x1); bool fl = true; //проверка на равенство паролей if (PasswordFirst != PasswordSecond) { fl = false; ErrorMes = Properties.Resources.eaqfield; } // проверка на длинну if (PasswordFirst != null) { if (PasswordFirst.Length < 8) { fl = false; ErrorMes = Properties.Resources.charac; } } //проверяем на пустую строку if (PasswordFirst == String.Empty || PasswordSecond == String.Empty || PasswordFirst == null || PasswordSecond == null) { fl = false; ErrorMes = Properties.Resources.emptyfield; } //флаг проверяющий записались ли данный в бд bool IsDone = true; if (fl && canreg) { SqlConnect spam = new SqlConnect(); string Pass = firstHash(PasswordFirst).ToString(); IsDone = spam.InsertUsersRecords(Login, Pass); if (IsDone) { //записываю пустые поля в финансовую информацию SqlConnect sqlConnect = new SqlConnect(); int id = Convert.ToInt32(sqlConnect.GetIdUserByName(Login)); SqlConnectUserInfo connectUserInfo = new SqlConnectUserInfo(); connectUserInfo.InsertEmptyFields(id); ViewLogin t = new ViewLogin(); t.WindowStartupLocation = WindowStartupLocation.CenterScreen; t.Show(); CloseAction(); } } //если данные не записались ошибка if (!IsDone) { ErrorMes = Properties.Resources.existserr; } canreg = true; //запрещаем валидацию flag = false; }