public static int BuildDataSource(WFActivityField field, ISheet sheetDS, int startIndex) { string strSql = ""; switch (field.DataType) { case FieldInfo.DATATYPE_LIST: strSql = String.Format("SELECT [Value] FROM [dbo].[SGP_KeyValue] WHERE [Key] = '{0}' AND ISNULL([Value],'')<>'' AND Status = 1 ORDER BY Sort", field.KeyValueSource); break; case FieldInfo.DATATYPE_LIST_SQL: strSql = field.KeyValueSource; break; } if (strSql != "") { DataTable dt = DbHelperSQL.Query(strSql).Tables[0]; foreach (DataRow dr in dt.Rows) { sheetDS.CreateRow(startIndex).CreateCell(0).SetCellValue(Convert.ToString(dr["Value"])); startIndex++; } } return startIndex; }
private static bool FieldIsEmpty(WFActivityField field, string fieldValue) { if (String.IsNullOrEmpty(fieldValue)) { return true; } else { switch ((field.DataType)) { case FieldInfo.DATATYPE_DOUBLE: case FieldInfo.DATATYPE_FLOAT: case FieldInfo.DATATYPE_INT: double dValue = 0; double.TryParse(fieldValue, out dValue); if (dValue == 0) { return true; } break; } } return false; }
private int Compare(WFActivityField field1, WFActivityField field2) { return String.Compare(field1.DisplayName, field2.DisplayName); }