示例#1
0
 private void InitRecord()
 {
     Cursor.Current = Cursors.WaitCursor;
     userLevelBindingSource.DataSource = UserLevelManager.GetAll();
     userBindingSource.DataSource      = UserManager.GetAll();
     Cursor.Current = Cursors.Default;
 }
示例#2
0
        private void userLevelDataGridView_RowLeave(object sender, DataGridViewCellEventArgs e)
        {
            if (userLevelBindingSource == null)
            {
                return;
            }
            if (userLevelDataGridView.Rows.Count <= 1)
            {
                return;
            }
            if (!userLevelDataGridView.IsCurrentRowDirty)
            {
                return;
            }
            Validate();
            userLevelBindingSource.EndEdit();
            var iResult = UserLevelManager.Save((UserLevel)userLevelBindingSource.Current);

            toolStripStatusLabel1.Text = iResult > 0 ? @"User Level Type was saved successfully." : @"Error occurred when saving User Level.";
        }
示例#3
0
 private void DeleteUserLevel()
 {
     if (userLevelBindingSource != null)
     {
         var dResult = MessageBox.Show(@"Delete current record?", @"Delete", MessageBoxButtons.YesNo,
                                       MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);
         if (dResult == DialogResult.Yes)
         {
             if (UserLevelManager.Delete(((UserLevel)userLevelBindingSource.Current)))
             {
                 MessageBox.Show(@"Record was deleted successfully.", @"Delete", MessageBoxButtons.OK,
                                 MessageBoxIcon.Information);
                 userLevelBindingSource.RemoveCurrent();
             }
             else
             {
                 MessageBox.Show(@"Error on delete operation.", @"Delete", MessageBoxButtons.OK,
                                 MessageBoxIcon.Error);
                 userLevelDataGridView.Focus();
             }
         }
     }
 }