示例#1
0
 private void frmXemNguoiDung_Load(object sender, EventArgs e)
 {
     AppGridView.InitGridView(gridViewNguoiDung, true, false, DevExpress.XtraGrid.Views.Grid.GridMultiSelectMode.RowSelect, false, false);
     AppGridView.ShowField(gridViewNguoiDung, new string[] { "TenDangNhap", "Chon" }, new string[] { "Tên truy cập", "Chọn" }, new int[] { 250, 70 });
     AppGridView.ReadOnlyColumn(gridViewNguoiDung, new string[] { "TenDangNhap" });
     AppGridView.AlignHeader(gridViewNguoiDung, new string[] { "Chon" }, DevExpress.Utils.HorzAlignment.Center);
     AppGridView.UnSortField(gridViewNguoiDung, new string[] { "Chon" });
     InitData();
 }
示例#2
0
        private void frmTaiKhoan_Load(object sender, EventArgs e)
        {
            #region Init GridView
            AppGridView.InitGridView(gridViewTaiKhoan, true, true, GridMultiSelectMode.CellSelect, false, false, "Nhấn vào đây để thêm dòng mới");
            AppGridView.ShowField(gridViewTaiKhoan, new string[] { "MaNhomQuyen", "HoTen", "TenDangNhap", "MatKhau", "Xem", "TrangThai", "ResetPassWordGv", "PhanQuyen", "UserUis" },
                                  new string[] { "Nhóm quyền", "Họ tên", "Tên truy cập", "Mật khẩu", "Xem", "Khoá tài khoản", "Reset mật khẩu GV", "Phân quyền chức năng", "Tài khoản UIS" }, new int[] { 200, 200, 150, 70, 60, 100, 120, 150, 200 });
            AppGridView.ShowEditor(gridViewTaiKhoan, NewItemRowPosition.Top);
            AppGridView.AlignHeader(gridViewTaiKhoan, new string[] { "MaNhomQuyen", "HoTen", "TenDangNhap", "MatKhau", "Xem", "TrangThai", "ResetPassWordGv", "PhanQuyen", "UserUis" }, DevExpress.Utils.HorzAlignment.Center);
            //Attach Control to GridView
            AppGridView.RegisterControlField(gridViewTaiKhoan, "MaNhomQuyen", repositoryItemGridLookUpEditNhomQuyen);
            AppGridView.RegisterControlField(gridViewTaiKhoan, "MatKhau", repositoryItemTextEditMatKhau);
            AppGridView.RegisterControlField(gridViewTaiKhoan, "Xem", repositoryItemButtonEditXem);
            AppGridView.RegisterControlField(gridViewTaiKhoan, "PhanQuyen", repositoryItemButtonEditPhanQuyenTaiKhoan);
            AppGridView.RegisterControlField(gridViewTaiKhoan, "UserUis", repositoryItemCheckedComboBoxEditTaiKhoanUis);
            AppGridView.AlignHeader(gridViewTaiKhoan, new string[] { "Xem", "TrangThai", "PhanQuyen" }, DevExpress.Utils.HorzAlignment.Center);
            AppGridView.UnSortField(gridViewTaiKhoan, new string[] { "Xem", "TrangThai", "PhanQuyen" });
            AppGridView.HideField(gridViewTaiKhoan, new string[] { "Xem" });
            #endregion

            #region RepositoryItemGridLookUpEdit Nhom Quyen
            AppRepositoryItemGridLookUpEdit.InitRepositoryItemGridLookUp(repositoryItemGridLookUpEditNhomQuyen, true, TextEditStyles.Standard);
            AppRepositoryItemGridLookUpEdit.ShowField(repositoryItemGridLookUpEditNhomQuyen, new string[] { "TenNhomQuyen", "GhiChu" }, new string[] { "Tên nhóm quyền", "Ghi chú" });
            repositoryItemGridLookUpEditNhomQuyen.ValueMember   = "MaNhomQuyen";
            repositoryItemGridLookUpEditNhomQuyen.DisplayMember = "TenNhomQuyen";
            repositoryItemGridLookUpEditNhomQuyen.NullText      = string.Empty;
            #endregion

            #region Init Datasource
            bindingSourceTaiKhoan.DataSource  = DataServices.TaiKhoan.GetByNhomQuyenQL((Int32)UserInfo.GroupID);
            bindingSourceNhomQuyen.DataSource = DataServices.NhomQuyen.GetByNhomQuyenQL((Int32)UserInfo.GroupID);

            repositoryItemCheckedComboBoxEditTaiKhoanUis.SelectAllItemCaption = "Tất cả";
            repositoryItemCheckedComboBoxEditTaiKhoanUis.TextEditStyle        = TextEditStyles.Standard;
            repositoryItemCheckedComboBoxEditTaiKhoanUis.Items.Clear();

            IDataReader dr    = DataServices.TaiKhoan.GetAllTaiKhoanUis();
            DataTable   tkUis = new DataTable();
            tkUis.Load(dr);
            bindingSourceTKUis.DataSource = tkUis;

            List <CheckedListBoxItem> list = new List <CheckedListBoxItem>();
            foreach (DataRow obj in tkUis.Rows)
            {
                list.Add(new CheckedListBoxItem((string)obj["MaTaiKhoan"], (string)obj["HoTen"], CheckState.Unchecked, true));
            }
            repositoryItemCheckedComboBoxEditTaiKhoanUis.Items.AddRange(list.ToArray());
            repositoryItemCheckedComboBoxEditTaiKhoanUis.SeparatorChar = ';';


            #endregion
        }