Exemplo n.º 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);
            }
        }
        private void CopySelected_Button_Click(object sender, EventArgs e)
        {
            var selected = MainDataFilter.Where(o => o.IsSelected == true).ToList();

            if (selected.Count <= 0)
            {
                selected = new List <AccountDetail>(MainDataFilter);
            }

            if (selected?.Count > 0)
            {
                foreach (var item in selected)
                {
                    var find = AccountDetailData.Find(o => o.AccountID == item.AccountID && o.AccountDetailID == item.AccountDetailID);
                    // TH chưa có trong danh sách
                    if (find == null)
                    {
                        // Thêm vào danh sách
                        AccountDetailData.Add(new AccountDetail
                        {
                            CompanyID         = UserInfo.CompanyID,
                            AccountID         = item.AccountID,
                            AccountDetailID   = item.AccountDetailID,
                            AccountDetailName = item.AccountDetailName,
                            Status            = ModifyMode.Insert
                        });
                    }
                }

                AccountDetail_GridView.RefreshData();
            }
        }
        private void InitAccountDetailGridView()
        {
            AccountDetail_GridView.Columns.Clear();

            AccountDetail_GridView.AddColumn("AccountID", "Tài khoản", 100, false);
            AccountDetail_GridView.AddColumn("AccountDetailID", "Thống kê", 80, false);
            AccountDetail_GridView.AddColumn("AccountDetailName", "Mô tả", 250, false, fixedWidth: false);
        }
        private void AccountDetail_GridView_SelectionChanged(object sender, DevExpress.Data.SelectionChangedEventArgs e)
        {
            int rowIndex = AccountDetail_GridView.FocusedRowHandle;

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

            AccountDetail selected = AccountDetail_GridView.GetFocusedRow().CastTo <AccountDetail>();

            if (selected == null)
            {
                return;
            }

            // Không phải Dòng thêm mới
            if (selected.Status != ModifyMode.Insert)
            {
                AccountDetail_GridView.UnselectRow(rowIndex);
            }
        }
Exemplo n.º 5
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;
            }
        }
Exemplo n.º 6
0
 private void AccountDetail_Delete_Button_Click(object sender, EventArgs e)
 {
     AccountDetail_GridView.DeleteSelectedRows();
 }
Exemplo n.º 7
0
 private void SetupAccountDetailGridView()
 {
     AccountDetail_GridView.SetupGridView(newItemRow: NewItemRowPosition.None, columnAutoWidth: true);
 }
 private void Delete_Button_Click(object sender, EventArgs e)
 {
     AccountDetailData.Remove(o => o.IsSelected == true);
     AccountDetail_GridView.RefreshData();
 }