private DataSet ReadSelections(string scheduleName, ComboBox comboBox) { //Read user selections for the specified control SelectionsDS selections = null; try { selections = new SelectionsDS(); DataSet ds = new DataSet(); ds.Merge(this.mMediator.FillDataset(App.SELECTION_DATAFILE, "", null)); selections.Merge(ds.Tables["SelectionTable"].Select("ScheduleName='" + scheduleName + "' AND ControlName='" + comboBox.Name + "'")); } catch (Exception ex) { throw ex; } return(selections); }
protected void SaveSelections(string scheduleName, ComboBox comboBox) { //Update user selections for the specified control try { //Read entire selections file SelectionsDS ds = new SelectionsDS(); ds.Merge(this.mMediator.FillDataset(App.SELECTION_DATAFILE, "", null)); //Add current combobox entry if doesn't exist SelectionsDS.SelectionTableRow[] rows = (SelectionsDS.SelectionTableRow[])ds.SelectionTable.Select("ScheduleName='" + scheduleName + "' AND ControlName='" + comboBox.Name + "' AND Selection='" + comboBox.Text + "'"); if (rows.Length == 0) { ds.SelectionTable.AddSelectionTableRow(scheduleName, comboBox.Name, comboBox.Text); ds.SelectionTable.AcceptChanges(); this.mMediator.ExecuteNonQuery(App.SELECTION_DATAFILE, new object[] { ds }); } } catch { } }