public frmChangeAdminPass(string con, int id) { InitializeComponent(); connection = con; db = new DB_CEGSA(con); IDUser = id; var clients = from U in db.User where U.ID_user==IDUser select U; foreach (User user in clients) CurrPass = user.Password; }
private void btnEnter_Click(object sender, EventArgs e) { if (txtLogin.Text == "" || txtPassword.Text == "") { MessageBox.Show("Все поля должны быть заполнены"); return; } SqlConnection connect = new SqlConnection(connection); try { connect.Open(); connect.Close(); } catch { MessageBox.Show("Не удалось подключиться к БД. Проверьте параметры подключения к БД"); return; } db = new DB_CEGSA(connection); var query = from U in db.User where U.Login == txtLogin.Text && U.Password == txtPassword.Text select U; bool flag = false; bool admin = false; foreach (User U in query) { flag = true; if ((bool)U.Admin) admin = true; } if (!flag) { MessageBox.Show("Неверные имя или пароль"); return; } if (!admin) { MessageBox.Show("Для дальнейших действий необходимы права администратора"); return; } enter = true; this.Close(); }
public frmClient(string con, int id) { InitializeComponent(); connection = con; db = new DB_CEGSA(con); IDUser = id; NEW = false; var clients = from U in db.User where U.ID_user == IDUser select U; foreach (User user in clients) { txtLogin.Text = user.Login; txtPassword.Text = user.Password; txtFIO.Text = user.Fio; } }
public frmClient(string con) { InitializeComponent(); connection = con; db = new DB_CEGSA(con); }
public frmBase() { InitializeComponent(); frmAutorization frmA = new frmAutorization(); frmA.ShowDialog(); connection = frmA.connection; db = new DB_CEGSA(connection); }
void NewSession() { Packet sendData = new Packet(); sendData.ChatMessage = "LogOut"; sendData.ChatDataIdentifier = DataIdentifier.Message; byte[] data = sendData.GetDataStream(); for (int i = 0; i < CLientsList.Count; i++) serverSocket.BeginSendTo(data, 0, data.Length, SocketFlags.None, CLientsList[i].ep, new AsyncCallback(this.SendData), CLientsList[i].ep); if (serverSocket != null) { //serverSocket.Disconnect(true); serverSocket.Dispose(); //serverSocket.Close(); } Hide(); frmAutorization frmA = new frmAutorization(); frmA.ShowDialog(); connection = frmA.connection; db = new DB_CEGSA(connection); var_G = new BigInteger(0); var_Q = new BigInteger(0); var_Y = new BigInteger(0); var_E = new BigInteger(0); var_S = new BigInteger(0); var_R = new BigInteger(0); var_NewE = new BigInteger(0); var_NewR = new BigInteger(0); var_Si = new BigInteger[1]; var_Hi = new BigInteger[1]; var_Ri = new BigInteger[1]; var_Yi = new BigInteger[1]; int var_Ri_Count = 0; int var_Yi_Count = 0; int var_Si_Count = 0; int var_Hi_Count = 0; this.AcceptButton = btnStart; kol_clients = 0; AllowAutorize = true; try { clientList.Clear(); } catch { } try { listClients.Clear(); } catch { } try { lstClients.Items.Clear(); } catch { } try { CLientsList.Clear(); } catch { } lstCurrentClients.Items.Clear(); progressBar1.Value = 0; toolStrip1.Enabled = true; tbtnAdd.Enabled = true; tbtnDel.Enabled = true; tbtnEdit.Enabled = true; tbtnChangeAdminPass.Enabled = true; btnStart.Enabled = true; lstClients.Enabled = true; lstCurrentClients.Enabled = true; lstCurrentClients.Visible = true; btnAddClient.Visible = true; btnAddAllClients.Visible = true; btnDelAllClients.Visible = true; btnDelClient.Visible = true; label1.Visible = true; lstCurrentClients.Enabled = true; btnAddClient.Enabled = true; btnAddAllClients.Enabled = true; btnDelAllClients.Enabled = true; btnDelClient.Enabled = true; label1.Enabled = true; cmbServerAddress.Enabled = true; ReadListClients(); Show(); }
void EditAdmin() { int id = 0; string login = "******"; var Admin = from U in db.User where U.Login == login select U; foreach (User U in Admin) id = U.ID_user; frmChangeAdminPass frmC = new frmChangeAdminPass(connection, id); frmC.ShowDialog(); db = new DB_CEGSA(connection); }
void EditClient() { int id = 0; string login = ""; try { login = lstClients.SelectedItem.ToString(); } catch { return; } var clients = from U in db.User where U.Login == login select U; foreach (User U in clients) id = U.ID_user; frmClient frmC = new frmClient(connection, id); frmC.ShowDialog(); db = new DB_CEGSA(connection); ReadListClients(); }
public frmChangeAdminPass(string con) { InitializeComponent(); connection = con; db = new DB_CEGSA(con); }