public void EditButtonClick(object sender, EventArgs e)
 {
     AddEditSotrudnikForm aesf = new AddEditSotrudnikForm();
     aesf.SetFormState(anvlib.Enums.AddEditFormState.Edit);
     var ui = (listControl as ListBox).SelectedValue as UserInfo;
     aesf.EditableItem = ui;
     aesf.DisplayEditableItem(ui);
     var dr = aesf.ShowDialog();
     if (dr == DialogResult.OK)
     {
         sqlmgr.Reconnect();
         sqlmgr.UpdateUser(ui.Id, /*ui.IsAdmin,*/ aesf.GetSelectedRoleId());
         sqlmgr.Disconnect();
         FillList();
     }
 }
 public void AddButtonClick(object sender, EventArgs e)
 {
     AddEditSotrudnikForm aesf = new AddEditSotrudnikForm();
     aesf.SetFormState(anvlib.Enums.AddEditFormState.Add);
     UserInfo ui = new UserInfo();
     aesf.EditableItem = ui;
     var dr = aesf.ShowDialog();
     if (dr == DialogResult.OK)
     {
         sqlmgr.Reconnect();
         ui.Role = (RoleType)aesf.GetSelectedRoleId();
         sqlmgr.CreateUser(ui);
         sqlmgr.Disconnect();
         FillList();
     }
 }