public string CreateQueryWithWhereList(List <ColumnCheckListItem> mColumnList, ObservableList <WhereConditionItem> whereConditionList, string tableName, DataSourceBase.eDSType dSType)
        {
            var query = CreateQueryWithColumnList(mColumnList, tableName, dSType);

            if (whereConditionList == null)
            {
                return(query);
            }
            var whereQuery = string.Empty;

            for (int i = 0; i < whereConditionList.Count; i++)
            {
                var wQuery  = "";
                var wCond   = whereConditionList[i].Condition.ToLower();
                var wColVal = whereConditionList[i].TableColumn.Trim();
                var wOpr    = whereConditionList[i].Opertor;
                var wRowVal = whereConditionList[i].RowValue;

                if (string.IsNullOrEmpty(wRowVal))
                {
                    continue;
                }

                if (wCond == "empty")
                {
                    wCond = "";
                }

                if (wOpr == "Equals")
                {
                    if (wColVal == "GINGER_ID")
                    {
                        wQuery = string.Concat(wQuery, " ", wCond, " ", wColVal, " = ", wRowVal);
                    }
                    else
                    {
                        wQuery = string.Concat(wQuery, " ", wCond, " ", wColVal, " = \"", wRowVal, "\"");
                    }
                }
                else if (wOpr == "NotEquals")
                {
                    if (wColVal == "GINGER_ID")
                    {
                        wQuery = string.Concat(wQuery, " ", wCond, " ", wColVal, " <> ", wRowVal);
                    }
                    else
                    {
                        wQuery = string.Concat(wQuery, " ", wCond, " ", wColVal, " <>  \"", wRowVal, "\"");
                    }
                }
                else if (wOpr == "Contains")
                {
                    wQuery = string.Concat(wQuery, " ", wCond, " ", wColVal, " Like ", "\"%", wRowVal, "%\"");
                }
                else if (wOpr == "NotContains")
                {
                    wQuery = string.Concat(wQuery, " ", wCond, " ", wColVal, " Not Like ", "\"%", wRowVal, "%\"");
                }
                else if (wOpr == "StartsWith")
                {
                    wQuery = string.Concat(wQuery, " ", wCond, " ", wColVal, " like ", "\"", wRowVal, "%\"");
                }
                else if (wOpr == "NotStartsWith")
                {
                    wQuery = string.Concat(wQuery, " ", wCond, " ", wColVal, " Not Like ", "\"", wRowVal, "%\"");
                }
                else if (wOpr == "EndsWith")
                {
                    wQuery = string.Concat(wQuery, " ", wCond, " ", wColVal, " like ", "\"%", wRowVal, "\"");
                }
                else if (wOpr == "NotEndsWith")
                {
                    wQuery = string.Concat(wQuery, " ", wCond, " ", wColVal, " not like ", "\"%", wRowVal, "\"");
                }


                whereQuery = string.Concat(whereQuery, wQuery);
            }
            if (whereQuery != string.Empty)
            {
                query += " Where " + whereQuery;
            }
            return(query);
        }
        public string CreateQueryWithColumnList(List <ColumnCheckListItem> selectedColumnList, string tableName, DataSourceBase.eDSType dSType)
        {
            var selectedColumn = new StringBuilder();

            if (selectedColumnList.Count == 0)
            {
                return(string.Empty);
            }
            foreach (var column in selectedColumnList)
            {
                selectedColumn.Append(column.ColumnText.ToLower());
                if (selectedColumnList.Count > 1)
                {
                    selectedColumn.Append(",");
                }
            }

            if (selectedColumn[selectedColumn.Length - 1].Equals(','))
            {
                selectedColumn = selectedColumn.Remove((selectedColumn.Length - 1), 1);
            }

            var query = "";

            if (dSType.Equals(DataSourceBase.eDSType.LiteDataBase))
            {
                query = selectedColumn.ToString();
            }
            else
            {
                query = string.Concat("Select ", selectedColumn, " from ", tableName);
            }

            return(query);
        }