Exemplo n.º 1
0
        //拼接数据集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;
                }
            }
        }
Exemplo n.º 2
0
        private DataSetTableMapping GetTableNameByDataSource(UIControls ui)
        {
            DataSetTableMapping mapping = new DataSetTableMapping();

            foreach (Control c in ui.GroupBoxProductDataSource.Controls)
            {
                RadioButton rb = c as RadioButton;
                if (rb != null && rb.Checked)
                {
                    switch (rb.Text)
                    {
                    case "MOD06":
                    {
                        mapping.DatabaseTableName     = "cp_cldprds2mod06sets_tb";
                        mapping.DataSetIDFieldName    = "Prds2MOD06ID";
                        mapping.DataSetNameFieldName  = "MOD06DataSetName";
                        mapping.DataSetLabelFieldName = "MOD06SetsLabel";
                        break;
                    }

                    case "AIRS":
                    {
                        mapping.DatabaseTableName     = "cp_cldprds2airssets_tb";
                        mapping.DataSetIDFieldName    = "Prds2AIRSID";
                        mapping.DataSetNameFieldName  = "AIRSDataSetName";
                        mapping.DataSetLabelFieldName = "AIRSSetsLabel";
                        break;
                    }

                    case "ISCCP D2":
                    {
                        mapping.DatabaseTableName     = "cp_cldprds2isccpbands_tb";
                        mapping.DataSetIDFieldName    = "Prds2CloudSATID";
                        mapping.DataSetNameFieldName  = "CloudSATDataSetName";
                        mapping.DataSetLabelFieldName = "CloudSATDataSetLabel";
                        break;
                    }
                    }
                    break;
                }
            }
            return(mapping);
        }