//拼接数据集sql,并记录数据集 private void ConcatSQLByDataSet(UIControls ui) { DataSetTableMapping mapping = GetTableNameByDataSource(ui); foreach (Control c in ui.GroupBoxDataSet.Controls) { ucCheckBoxList uccbl = c as ucCheckBoxList; if (uccbl != null) { //_sql.Append("("); bool checkedPrevious = false; foreach (CheckBox cb in uccbl) { if (cb.Checked) { StringBuilder sql = new StringBuilder(); //sql.Append("DataSetID=(select ").Append(mapping.DataSetIDFieldName) // .Append(" from ").Append(mapping.DatabaseTableName) // .Append(" where ").Append(mapping.DataSetLabelFieldName).Append("='").Append(cb.Text).Append("')"); sql.Append("DataSetID='").Append(cb.Tag.ToString()).Append("'"); AppendOr(ref checkedPrevious, cb.Checked, sql.ToString()); } } _sql.Append(" and "); break; } } }
private void ConcatISCCPSQL(UIControls ui) { //_sql.Append("select KeyWords,Resolution, DataYear, DataMonth, Data10Day,ImageData, ValidValuePercent, statTypeID from cp_periodicsynthesis_tb where PeriodTypeID=4 and "); _sql.Append("select KeyWord as KeyWords,Resolution, YEAR(ReceiveTime) as DataYear, MONTH(ReceiveTime) as DataMonth,null as Data10Day, ImageData,3 as statTypeID from cp_isccpd2_tb where ReceiveUTCTime=9999 and ");//MONTH(ReceiveTime)=12;"); RecordSearchType(ui); RecordDateTime(ui); foreach (Control c in ui.GroupBoxProductPeriod.Controls) { RadioButton rb = c as RadioButton; if (rb != null && rb.Checked) { _productPeriod = rb.Text; } } switch (_searchType) { case "连续查询": { ConcatISCCPSQLByProductTimeContinue(); break; } case "同期查询": { ConcatISCCPSQLByProductTimeOverTheSamePeriod(ui); break; } } #region 波段号 foreach (Control c in ui.GroupBoxDataSet.Controls) { ucCheckBoxList uccbl = c as ucCheckBoxList; if (uccbl != null) { foreach (CheckBox cb in uccbl) { if (cb.Checked) { int isccpband = int.Parse(cb.Tag.ToString()); } } break; } } #endregion }
//检查数据集合法性 public bool CheckValidDataSet() { List <bool> bits = new List <bool>(); foreach (Control c in _groupBoxDataSet.Controls) { ucCheckBoxList uccbl = c as ucCheckBoxList; if (uccbl != null) { foreach (CheckBox cb in uccbl) { bits.Add(cb.Checked); } break; } } return(CheckAtLeastOne(bits)); }