/// <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(); }