/// <summary>
        /// close the screen and return the selected extract as accepted record
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void AcceptExtract(System.Object sender, EventArgs e)
        {
            MExtractMasterRow ExtractMasterRow;

            FResultTable = new MExtractMasterTable();
            //MExtractMasterRow SelectedRow = null;
            DataRow SelectedRow = null;

            if (AllowMultipleSelect)
            {
                // multiple rows may have been selected: find all the ones where first column is ticked
                foreach (DataRow Row in FDataTable.Rows)
                {
                    if (Convert.ToBoolean(Row[FCheckedColumnName]) == true)
                    {
                        ExtractMasterRow             = FResultTable.NewRowTyped();
                        ExtractMasterRow.ExtractId   = (int)Row[MExtractMasterTable.GetExtractIdDBName()];
                        ExtractMasterRow.ExtractName = Row[MExtractMasterTable.GetExtractNameDBName()].ToString();
                        ExtractMasterRow.ExtractDesc = Row[MExtractMasterTable.GetExtractDescDBName()].ToString();
                        ExtractMasterRow.KeyCount    = (int)Row[MExtractMasterTable.GetKeyCountDBName()];
                        ExtractMasterRow.CreatedBy   = Row[MExtractMasterTable.GetCreatedByDBName()].ToString();
                        ExtractMasterRow.DateCreated = (DateTime)Row[MExtractMasterTable.GetDateCreatedDBName()];
                        FResultTable.Rows.Add(ExtractMasterRow);
                    }
                }
            }
            else
            {
                // just one row can be selected
                DataRowView[] SelectedGridRow = clbDetails.SelectedDataRowsAsDataRowView;

                if (SelectedGridRow.Length >= 1)
                {
                    SelectedRow = SelectedGridRow[0].Row;

                    ExtractMasterRow             = FResultTable.NewRowTyped();
                    ExtractMasterRow.ExtractId   = (int)SelectedRow[MExtractMasterTable.GetExtractIdDBName()];
                    ExtractMasterRow.ExtractName = SelectedRow[MExtractMasterTable.GetExtractNameDBName()].ToString();
                    ExtractMasterRow.ExtractDesc = SelectedRow[MExtractMasterTable.GetExtractDescDBName()].ToString();
                    ExtractMasterRow.KeyCount    = (int)SelectedRow[MExtractMasterTable.GetKeyCountDBName()];
                    ExtractMasterRow.CreatedBy   = SelectedRow[MExtractMasterTable.GetCreatedByDBName()].ToString();
                    ExtractMasterRow.DateCreated = (DateTime)SelectedRow[MExtractMasterTable.GetDateCreatedDBName()];
                    FResultTable.Rows.Add(ExtractMasterRow);
                }
            }

            Close();
        }
Пример #2
0
        /// <summary>
        /// Create grid and populate
        /// </summary>
        private void CreateGrid()
        {
            string CheckedMember      = FCheckedColumnName;
            string IdMember           = MExtractMasterTable.GetExtractIdDBName();
            string NameMember         = MExtractMasterTable.GetExtractNameDBName();
            string DescriptionMember  = MExtractMasterTable.GetExtractDescDBName();
            string DeletableMember    = MExtractMasterTable.GetDeletableDBName();
            string KeyCountMember     = MExtractMasterTable.GetKeyCountDBName();
            string CreatedByMember    = MExtractMasterTable.GetCreatedByDBName();
            string DateCreatedMember  = MExtractMasterTable.GetDateCreatedDBName();
            string ModifiedByMember   = MExtractMasterTable.GetModifiedByDBName();
            string DateModifiedMember = MExtractMasterTable.GetDateModifiedDBName();

            FExtractMasterTable = TRemote.MPartner.Partner.WebConnectors.GetAllExtractHeaders();

            if (FExtractMasterTable != null)
            {
                DataView view = new DataView(FExtractMasterTable);

                FDataTable = view.ToTable(true,
                                          new string[] { IdMember, NameMember, DescriptionMember, DeletableMember, KeyCountMember, CreatedByMember, DateCreatedMember,
                                                         ModifiedByMember, DateModifiedMember });
                FDataTable.Columns.Add(new DataColumn(CheckedMember, typeof(bool)));
                clbDetails.Columns.Clear();

                if (FAllowMultipleSelect)
                {
                    clbDetails.AddCheckBoxColumn("Select", FDataTable.Columns[FCheckedColumnName], 17, false);
                }
                else
                {
                    clbDetails.AutoFindColumn = 0;
                }

                clbDetails.AddTextColumn("Extract Name", FDataTable.Columns[NameMember] /*, 200*/);
                clbDetails.AddCheckBoxColumn("Deletable", FDataTable.Columns[DeletableMember] /*, 120*/);
                clbDetails.AddTextColumn("Key Count", FDataTable.Columns[KeyCountMember] /*, 80*/);
                clbDetails.AddTextColumn("Description", FDataTable.Columns[DescriptionMember] /*, 300*/);

                clbDetails.DataBindGrid(FDataTable, NameMember, CheckedMember, NameMember, false, true, false);
                clbDetails.SetCheckedStringList("");
            }

            this.clbDetails.ValueChanged += new System.EventHandler(this.UpdateRecordCount);

            PrepareButtons();
            UpdateRecordCount();
        }
        /// <summary>
        /// reload extract list when search button is clicked
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void RefreshExtractList(System.Object sender, EventArgs e)
        {
            bool     AllUsers         = true;
            String   CreatedByUser    = "";
            String   ModifiedByUser   = "";
            DateTime?DateCreatedFrom  = null;
            DateTime?DateCreatedTo    = null;
            DateTime?DateModifiedFrom = null;
            DateTime?DateModifiedTo   = null;

            string CheckedMember     = FCheckedColumnName;
            string IdMember          = MExtractMasterTable.GetExtractIdDBName();
            string NameMember        = MExtractMasterTable.GetExtractNameDBName();
            string DescriptionMember = MExtractMasterTable.GetExtractDescDBName();
            string DeletableMember   = MExtractMasterTable.GetDeletableDBName();
            string KeyCountMember    = MExtractMasterTable.GetKeyCountDBName();
            string CreatedByMember   = MExtractMasterTable.GetCreatedByDBName();
            string DateCreatedMember = MExtractMasterTable.GetDateCreatedDBName();

            if (cmbUserCreated.GetSelectedString().Length > 0)
            {
                AllUsers      = false;
                CreatedByUser = cmbUserCreated.GetSelectedString();
            }

            if (cmbUserModified.GetSelectedString().Length > 0)
            {
                AllUsers       = false;
                ModifiedByUser = cmbUserModified.GetSelectedString();
            }

            if (dtpCreatedFrom.Text.Length > 0)
            {
                DateCreatedFrom = dtpCreatedFrom.Date;
            }

            if (dtpCreatedTo.Text.Length > 0)
            {
                DateCreatedTo = dtpCreatedTo.Date;
            }

            if (dtpModifiedFrom.Text.Length > 0)
            {
                DateModifiedFrom = dtpModifiedFrom.Date;
            }

            if (dtpModifiedTo.Text.Length > 0)
            {
                DateModifiedTo = dtpModifiedTo.Date;
            }

            FExtractMasterTable = TRemote.MPartner.Partner.WebConnectors.GetAllExtractHeaders(txtExtractName.Text,
                                                                                              txtExtractDesc.Text, AllUsers, CreatedByUser, ModifiedByUser, DateCreatedFrom, DateCreatedTo,
                                                                                              DateModifiedFrom, DateModifiedTo);

            if (FExtractMasterTable != null)
            {
                DataView view = new DataView(FExtractMasterTable);

                FDataTable = view.ToTable(true,
                                          new string[] { IdMember, NameMember, DescriptionMember, DeletableMember, KeyCountMember, CreatedByMember, DateCreatedMember });
                FDataTable.Columns.Add(new DataColumn(CheckedMember, typeof(bool)));
                clbDetails.Columns.Clear();

                if (FAllowMultipleSelect)
                {
                    clbDetails.AddCheckBoxColumn("Select", FDataTable.Columns[FCheckedColumnName], 17, false);
                }

                clbDetails.AddTextColumn("Extract Name", FDataTable.Columns[NameMember], 200);
                clbDetails.AddCheckBoxColumn("Deletable", FDataTable.Columns[DeletableMember], 120);
                clbDetails.AddTextColumn("Key Count", FDataTable.Columns[KeyCountMember], 80);
                clbDetails.AddTextColumn("Description", FDataTable.Columns[DescriptionMember], 300);

                clbDetails.DataBindGrid(FDataTable, NameMember, CheckedMember, NameMember, false, true, false);
                clbDetails.SetCheckedStringList("");
            }

            PrepareButtons();

            clbDetails.Select();
        }