private void Login(object sender, RoutedEventArgs args) { //here login try { //DataWork._ConnectionString = ConfigurationManager.ConnectionStrings //["AdamDbCon"].ConnectionString; DataWork._ConnectionString = "Data Source=10.111.0.101\\SQLEXPRESS;Initial Catalog=AdamDB;Persist Security Info=True;User ID=AdminNew;Password=ddaedeqq"; int type = DataWork.GetUsersType(tbLogin.Text, tbPassword.Password); if (type == 0) { throw new Exception("Логин/пароль не совпадают"); } if (type == -1) { throw new Exception("Нет соединения. Запустите Kerio VPN Client и выполните подключение к серверу. Затем, попробуйте снова."); } if (!DataWork.If_checked(tbLogin.Text, tbPassword.Password)) { ActiveUser.dt_log.Start(); DataWork.CheckIn(tbLogin.Text, tbPassword.Password); ActiveUser.login = tbLogin.Text; ActiveUser.password = tbPassword.Password; ActiveUser.UserType = type; Window wn = new MainWindow(type); wn.Show(); this.Close(); } } catch (Exception e) { Window wn = new wnError(e.Message, 1); wn.ShowDialog(); } }