public AlertOption getSelectedOption() { DataTable table = publicDbOpClass.DataTableQuary("select OptionID,OptionText,MainID,IsValid,OptionCode from prj_prsentiment_options where IsValid=1 and MainID=" + this.pkID); AlertOption option = new AlertOption(); if (table.Rows.Count > 0) { option.pkID = (int)table.Rows[0]["OptionID"]; option.OptionID = (int)table.Rows[0]["OptionCode"]; option.OptionText = (string)table.Rows[0]["OptionText"]; option.IsSelected = (bool)table.Rows[0]["IsValid"]; } return(option); }
private AlertOptionCollection GetOptions() { AlertOptionCollection options = new AlertOptionCollection(); DataTable table = publicDbOpClass.DataTableQuary("select OptionID,OptionText,MainID,IsValid,OptionCode from prj_prsentiment_options where MainID=" + this.pkID); int count = table.Rows.Count; if (count == 0) { return(null); } for (int i = 0; i < count; i++) { AlertOption opt = new AlertOption { pkID = (int)table.Rows[i]["OptionID"], OptionID = (int)table.Rows[i]["OptionCode"], OptionText = (string)table.Rows[i]["OptionText"], IsSelected = (bool)table.Rows[i]["IsValid"] }; options.Add(opt); } return(options); }