/// <summary> /// Prepares the OMQuery Groups /// </summary> /// <param name="datagridview"></param> /// <returns></returns> private static OMQueryGroup PrepareQueryCollection(dbDataGridView datagridview) { //Get all the columns names from resource string fieldColumnName = Helper.GetResourceString(Constants.QUERY_GRID_FIELD); string conditionColumnName = Helper.GetResourceString(Constants.QUERY_GRID_CONDITION); string valueColumnName = Helper.GetResourceString(Constants.QUERY_GRID_VALUE); string operatorColumnName = Helper.GetResourceString(Constants.QUERY_GRID_OPERATOR); OMQueryGroup objectManagerQueryGroup = null; try { OMETrace.WriteFunctionStart(); int rowCount = datagridview.RowCount; if (rowCount > 0) { objectManagerQueryGroup = new OMQueryGroup(); string stringOperator = datagridview.Rows[0].Cells[operatorColumnName].Value.ToString(); CommonValues.LogicalOperators clauseOperator = (CommonValues.LogicalOperators)Enum.Parse(typeof(CommonValues.LogicalOperators), stringOperator); for (int i = 0; i < rowCount; i++) { string fieldName = datagridview.Rows[i].Cells[fieldColumnName].Value.ToString(); string stringCondition = datagridview.Rows[i].Cells[conditionColumnName].Value.ToString(); string className = datagridview.Rows[i].Cells[Constants.QUERY_GRID_CALSSNAME_HIDDEN].Value.ToString(); string fieldType = FieldTypeFor(datagridview.Rows[i]); //get the value for each expression if value not specified then return null string stringValue; if (datagridview.Rows[i].Cells[valueColumnName].Value != null) { stringValue = datagridview.Rows[i].Cells[valueColumnName].Value.ToString(); } else return null; OMQueryClause queryClause = new OMQueryClause(className, fieldName, stringCondition, stringValue, clauseOperator, fieldType); objectManagerQueryGroup.AddOMQueryClause(queryClause); } } OMETrace.WriteFunctionEnd(); } catch (Exception oEx) { LoggingHelper.ShowMessage(oEx); } return objectManagerQueryGroup; }