コード例 #1
0
        private void AccountDetail_GridView_SelectionChanged(object sender, DevExpress.Data.SelectionChangedEventArgs e)
        {
            int rowIndex = AccountDetail_GridView.FocusedRowHandle;

            if (!AccountDetail_GridView.IsRowSelected(rowIndex))
            {
                return;
            }

            var  selected = AccountDetail_GridView.GetFocusedRow().CastTo <AccountDetail>();
            bool isNewRow = AccountDetail_GridView.IsNewItemRow(rowIndex);

            if (selected == null)
            {
                return;
            }

            // Dòng thêm mới
            if (isNewRow || selected.Status == ModifyMode.Insert)
            {
                return;
            }

            // Có quyền kế toán trưởng
            if (ClientCommon.HasAuthority(UserInfo.UserRole, BSRole.KeToanTruong))
            {
                return;
            }

            if (selected.CreateUser.ToUpper() != UserInfo.UserID.ToUpper())
            {
                AccountDetail_GridView.UnselectRow(rowIndex);
            }
        }
コード例 #2
0
        private void AccountDetail_GridView_ShowingEditor(object sender, CancelEventArgs e)
        {
            int  rowIndex = AccountDetail_GridView.FocusedRowHandle;
            var  selected = AccountDetail_GridView.GetFocusedRow().CastTo <AccountDetail>();
            bool isNewRow = AccountDetail_GridView.IsNewItemRow(rowIndex);

            // Dòng thêm mới
            if (isNewRow || selected.Status == ModifyMode.Insert)
            {
                return;
            }

            // Có quyền kế toán trưởng
            if (ClientCommon.HasAuthority(UserInfo.UserRole, BSRole.KeToanTruong))
            {
                return;
            }

            if (selected.CreateUser.ToUpper() != UserInfo.UserID.ToUpper())
            {
                e.Cancel = true;
            }
        }