private void button5_Click(object sender, EventArgs e)
        {
            user.SetId(_client.GetCurIdentity("User") + 1);

              UserForm uf = new UserForm(user, _roles, _users);
              uf.ShowDialog();

              user = uf.user;

              if (user.Id != 0)
              {
            textBoxUserID.Text = user.Id.ToString();
              }
        }
Beispiel #2
0
        private void UserEditBtn_Click(object sender, EventArgs e)
        {
            User user = new User();

              if (dataGridViewUsers.CurrentRow != null)
              {
            user.SetValues(
              Convert.ToInt32(dataGridViewUsers.CurrentRow.Cells["Id"].Value),
              Convert.ToInt32(dataGridViewUsers.CurrentRow.Cells["PositionId"].Value),
              dataGridViewUsers.CurrentRow.Cells["Nick"].Value.ToString(),
              dataGridViewUsers.CurrentRow.Cells["Password"].Value.ToString()
              );

            UserForm pf = new UserForm(user, _db._ds.Tables["Position"], _db._ds.Tables["User"]);
            pf.ShowDialog();

            if (user.Id != 0)
            {
              _db._ds.Tables["User"].Rows[dataGridViewUsers.CurrentRow.Index]["Id"] = user.Id;
              _db._ds.Tables["User"].Rows[dataGridViewUsers.CurrentRow.Index]["PositionId"] = user.PositionId;
              _db._ds.Tables["User"].Rows[dataGridViewUsers.CurrentRow.Index]["Nick"] = user.Nick;
              _db._ds.Tables["User"].Rows[dataGridViewUsers.CurrentRow.Index]["Password"] = user.Password;

              _db._adapterUser.Update(_db._ds.Tables["User"]);
            }
              }
              else
              {
            MessageBox.Show(@"Выделите строку с пользователем!");
              }
        }
Beispiel #3
0
        private void NewUserBtn_Click(object sender, EventArgs e)
        {
            User user = new User();

              user.SetId(client.GetCurIdentity("User") + 1);

              UserForm uf = new UserForm(user, _db._ds.Tables["Position"], _db._ds.Tables["User"]);
              uf.ShowDialog();

              user = uf.user;

              if (user.Id != 0)
              {
            DataRow newRow = _db._ds.Tables["User"].NewRow();
            newRow["Id"] = user.Id;
            newRow["PositionId"] = user.PositionId;
            newRow["Nick"] = user.Nick;
            newRow["Password"] = user.Password;
            _db._ds.Tables["User"].Rows.Add(newRow);

            _db._adapterUser.Update(_db._ds.Tables["User"]);

            user.Clear();
              }
        }