Exemplo n.º 1
0
        private void AccountDetail_AddNew_Button_Click(object sender, EventArgs e)
        {
            Accounts account = AccountID_SearchLookUpEdit.GetSelectedDataRow().CastTo <Accounts>();

            if (string.IsNullOrEmpty(account.AccountID))
            {
                MessageBoxHelper.ShowErrorMessage(BSMessage.BSM000023);
                return;
            }

            string accountDetailID = AccountDetailID_TextEdit.Text;

            if (string.IsNullOrWhiteSpace(accountDetailID))
            {
                MessageBoxHelper.ShowErrorMessage(BSMessage.BSM000029);
                return;
            }

            if (AccountDetailData.ToList().Find(o => o.AccountID == account.AccountID && o.AccountDetailID == accountDetailID) != null)
            {
                MessageBoxHelper.ShowErrorMessage(BSMessage.BSM000030);
                return;
            }

            string accountDetailName = AccountDetailName_TextEdit.Text;

            if (string.IsNullOrWhiteSpace(accountDetailName))
            {
                MessageBoxHelper.ShowErrorMessage(BSMessage.BSM000025);
                return;
            }

            AccountDetailData.Add(new AccountDetail
            {
                CompanyID         = CommonInfo.CompanyInfo.CompanyID,
                AccountID         = account.AccountID,
                AccountDetailID   = accountDetailID,
                AccountDetailName = accountDetailName,
                Status            = ModifyMode.Insert
            });
        }
Exemplo n.º 2
0
        /// <summary>
        /// Thực hiện lọc tài khoản chi tiết
        /// </summary>
        private void FilterAccountDetail()
        {
            this.AccountDetail_GridView.ClearColumnsFilter();
            string filter = string.Empty;

            Accounts account = AccountID_SearchLookUpEdit.GetSelectedDataRow().CastTo <Accounts>();

            if (account != null)
            {
                AccountDetailName_TextEdit.Text = account.AccountName;
                filter += $"[AccountID] = '{account.AccountID}'";
            }
            else
            {
                AccountDetailName_TextEdit.Text = string.Empty;
            }

            // filter grid
            if (!string.IsNullOrEmpty(filter))
            {
                AccountDetail_GridView.ActiveFilterString = filter;
            }
        }