예제 #1
0
        private void SetupGrid()
        {
            // create a new table
            FCriteriaData.Columns.Add(PBankTable.GetPartnerKeyDBName(), Type.GetType("System.Int64"));
            FCriteriaData.Columns.Add(BankTDSPBankTable.GetSiteKeyDBName(), Type.GetType("System.Int64"));
            FCriteriaData.Columns.Add(BankTDSPBankTable.GetLocationKeyDBName(), Type.GetType("System.Int32"));
            FCriteriaData.Columns.Add(PBankTable.GetBranchNameDBName(), Type.GetType("System.String"));
            FCriteriaData.Columns.Add(PBankTable.GetBranchCodeDBName(), Type.GetType("System.String"));
            FCriteriaData.Columns.Add(PBankTable.GetBicDBName(), Type.GetType("System.String"));
            FCriteriaData.Columns.Add(BankTDSPBankTable.GetCityDBName(), Type.GetType("System.String"));
            FCriteriaData.Columns.Add(BankTDSPBankTable.GetCountryCodeDBName(), Type.GetType("System.String"));
            FCriteriaData.Columns.Add(BankTDSPBankTable.GetStatusCodeDBName(), Type.GetType("System.String"));

            FCriteriaData.PrimaryKey = new DataColumn[] {
                FCriteriaData.Columns[PBankTable.GetPartnerKeyDBName()],
                FCriteriaData.Columns[BankTDSPBankTable.GetSiteKeyDBName()], FCriteriaData.Columns[BankTDSPBankTable.GetLocationKeyDBName()]
            };
            FCriteriaData.DefaultView.AllowNew = false;

            // add columns to the grid
            grdDetails.Columns.Clear();
            grdDetails.AddTextColumn("Partner Key", FCriteriaData.Columns[PBankTable.GetPartnerKeyDBName()], 80);
            grdDetails.AddTextColumn("Bank Name", FCriteriaData.Columns[PBankTable.GetBranchNameDBName()]);
            grdDetails.AddTextColumn("Bank/Branch Code", FCriteriaData.Columns[PBankTable.GetBranchCodeDBName()], 120);
            grdDetails.AddTextColumn("BIC/SWIFT Code", FCriteriaData.Columns[PBankTable.GetBicDBName()], 110);
            grdDetails.AddTextColumn("Status", FCriteriaData.Columns[BankTDSPBankTable.GetStatusCodeDBName()], 70);
            grdDetails.AddTextColumn("City", FCriteriaData.Columns[PLocationTable.GetCityDBName()], 80);
            grdDetails.AddTextColumn("Country", FCriteriaData.Columns[PLocationTable.GetCountryCodeDBName()], 60);

            grdDetails.DoubleClickCell           += new TDoubleClickCellEventHandler(grdDetails_DoubleClickCell);
            grdDetails.EnterKeyPressed           += new TKeyPressedEventHandler(grdDetails_EnterKey);
            grdDetails.Selection.FocusRowEntered += new SourceGrid.RowEventHandler(this.FocusedRowChanged);
        }
예제 #2
0
        private void Filter(System.Object sender, EventArgs e)
        {
            // Apply filter to the grid

            DataView MyDataView = FCriteriaData.DefaultView;

            String Filter = "";

            if (!string.IsNullOrEmpty(txtBranchName.Text))
            {
                Filter += FCriteriaData.Columns[PBankTable.GetBranchNameDBName()] + " LIKE '" + txtBranchName.Text + "%'";
            }

            if (!string.IsNullOrEmpty(txtBranchCode.Text))
            {
                if (Filter != "")
                {
                    Filter += " AND ";
                }

                Filter += FCriteriaData.Columns[PBankTable.GetBranchCodeDBName()] + " LIKE '" + txtBranchCode.Text + "%'";
            }

            if (!string.IsNullOrEmpty(txtBicCode.Text))
            {
                if (Filter != "")
                {
                    Filter += " AND ";
                }

                Filter += FCriteriaData.Columns[PBankTable.GetBicDBName()] + " LIKE '" + txtBicCode.Text + "%'";
            }

            if (!string.IsNullOrEmpty(txtCity.Text))
            {
                if (Filter != "")
                {
                    Filter += " AND ";
                }

                Filter += FCriteriaData.Columns[PLocationTable.GetCityDBName()] + " LIKE '" + txtCity.Text + "%'";
            }

            if (!string.IsNullOrEmpty(txtCountry.Text))
            {
                if (Filter != "")
                {
                    Filter += " AND ";
                }

                Filter += FCriteriaData.Columns[PLocationTable.GetCountryCodeDBName()] + " LIKE '" + txtCountry.Text + "%'";
            }

            if (!chkShowInactive.Checked)
            {
                if (Filter != "")
                {
                    Filter += " AND ";
                }

                Filter += FCriteriaData.Columns[BankTDSPBankTable.GetStatusCodeDBName()] + " = '" +
                          SharedTypes.StdPartnerStatusCodeEnumToString(TStdPartnerStatusCode.spscACTIVE) + "'";
            }

            MyDataView.RowFilter  = Filter;
            grdDetails.DataSource = new DevAge.ComponentModel.BoundDataView(MyDataView);

            UpdateRecordNumberDisplay();
            SelectRowInGrid();
            FocusedRowChanged(this, null);
        }
예제 #3
0
        /// <summary>
        /// Load data into grid
        /// </summary>
        /// <param name="AFirstTime">True if being run for the first time</param>
        public void LoadDataGrid(bool AFirstTime)
        {
            // Only call data from server if the dataset is actually empty.
            // (A filled dataset is passed to this screen from the 'Finance Details' tab and 'Find By Bank Details'.)
            if ((FMainDS == null) || (FMainDS.PBank.Rows.Count == 0))
            {
                FMainDS = new BankTDS();
                FMainDS.Merge(TRemote.MPartner.Partner.WebConnectors.GetPBankRecords());
            }

            FCriteriaData.Clear();

            if (AFirstTime)
            {
                // setup the grid on first run
                SetupGrid();
            }

            // create a new row for each bank record
            foreach (BankTDSPBankRow BankRow in FMainDS.PBank.Rows)
            {
                if (BankRow.PartnerKey >= 0)
                {
                    DataRow NewBankRow = FCriteriaData.NewRow();
                    NewBankRow[PBankTable.GetPartnerKeyDBName()]         = BankRow.PartnerKey;
                    NewBankRow[BankTDSPBankTable.GetCityDBName()]        = BankRow.City;
                    NewBankRow[BankTDSPBankTable.GetCountryCodeDBName()] = BankRow.CountryCode;
                    NewBankRow[PBankTable.GetBranchNameDBName()]         = BankRow.BranchName;

                    if (BankRow.BranchCode.StartsWith(SharedConstants.INACTIVE_VALUE_WITH_QUALIFIERS + " "))
                    {
                        NewBankRow[PBankTable.GetBranchCodeDBName()] = BankRow.BranchCode.Substring(11);
                    }
                    else if (BankRow.BranchCode.StartsWith(SharedConstants.INACTIVE_VALUE_WITH_QUALIFIERS))
                    {
                        NewBankRow[PBankTable.GetBranchCodeDBName()] = BankRow.BranchCode.Substring(10);
                    }
                    else
                    {
                        NewBankRow[PBankTable.GetBranchCodeDBName()] = BankRow.BranchCode;
                    }

                    NewBankRow[BankTDSPBankTable.GetSiteKeyDBName()]     = BankRow.SiteKey;
                    NewBankRow[BankTDSPBankTable.GetLocationKeyDBName()] = BankRow.LocationKey;

                    NewBankRow[PBankTable.GetBicDBName()] = BankRow.Bic;
                    NewBankRow[BankTDSPBankTable.GetStatusCodeDBName()] = BankRow.StatusCode;
                    FCriteriaData.Rows.Add(NewBankRow);
                }
            }

            // sort order for grid
            DataView MyDataView = FCriteriaData.DefaultView;

            MyDataView.Sort       = "p_branch_name_c ASC";
            grdDetails.DataSource = new DevAge.ComponentModel.BoundDataView(MyDataView);

            SelectRowInGrid();
            FinishButtonPanelSetup();
            Filter(this, null);
        }