Exemplo n.º 1
0
        private void Users_GridView_ShowingEditor(object sender, CancelEventArgs e)
        {
            string col      = Users_GridView.FocusedColumn.FieldName;
            int    rowIndex = Users_GridView.FocusedRowHandle;
            var    selected = Users_GridView.GetFocusedRow().CastTo <Users>();
            bool   isNewRow = Users_GridView.IsNewItemRow(rowIndex);

            if (col == "UserID" && !(isNewRow || selected?.Status == ModifyMode.Insert))
            {
                e.Cancel = true;
            }
        }
Exemplo n.º 2
0
        private void FilterUserRole()
        {
            this.UserRole_GridView.ClearColumnsFilter();

            string filter = string.Empty;
            Users  user   = Users_GridView.GetFocusedRow().CastTo <Users>();

            if (user != null)
            {
                UserID_TextBox.Text = user.UserID;
                UserID_CheckedComboBoxEdit.EditValue = new List <string> {
                    user.UserID
                };
                UserID_CheckedComboBoxEdit.RefreshEditValue();
                filter += $"[UserID] = '{user.UserID}'";
            }

            // filter grid
            if (!string.IsNullOrEmpty(filter))
            {
                this.UserRole_GridView.ActiveFilterString = filter;
            }
        }
Exemplo n.º 3
0
        private void Users_GridView_RowUpdated(object sender, RowObjectEventArgs e)
        {
            Users row = e.Row.CastTo <Users>();

            if (!string.IsNullOrEmpty(row.NewPassword))
            {
                row.Password = ClientCommon.GetPassword(row.NewPassword);
            }

            bool isNewRow = Users_GridView.IsNewItemRow(e.RowHandle);

            if (isNewRow)
            {
                row.Status = ModifyMode.Insert;
                return;
            }

            if (row.Status == ModifyMode.Insert)
            {
                return;
            }

            row.Status = ModifyMode.Update;
        }
Exemplo n.º 4
0
 private void UserDelete_Button_Click(object sender, EventArgs e)
 {
     Users_GridView.DeleteSelectedRows();
 }