Exemple #1
0
        public DataTable GetTableDisplay()
        {
            DataTable displayTable = null;

            while (true)
            {
                if (m_dataTable == null)
                {
                    break;
                }

                displayTable = new DataTable();
                YoSqlHelper.EachColumn(m_yoColumnDict, (key, val) => {
                    displayTable.Columns.Add(new DataColumn(key, typeof(string)));
                });

                foreach (DataRow row in m_dataTable.Rows)
                {
                    var rowNew = displayTable.NewRow();
                    displayTable.Rows.Add(rowNew);

                    YoSqlHelper.EachColumn(m_yoColumnDict, (key, yoColumn) => {
                        rowNew[key] = getColumnDisplay(row[key], yoColumn);
                    });
                }

                break;
            }

            return(displayTable);
        }
Exemple #2
0
        bool parseSqlSet()
        {
            bool result = false;

            while (true)
            {
                if (m_uiDict == null)
                {
                    break;
                }

                m_errorDict  = new Dictionary <string, object>();
                m_sqlSetDict = new Dictionary <string, string>();

                YoSqlHelper.EachColumn(m_yoColumnDict, (key, column) => {
                    while (true)
                    {
                        object value = null;
                        if (!checkColumn(ref value, m_uiDict, key, column))
                        {
                            break;
                        }

                        if (value == null)
                        {
                            break;
                        }

                        var dbValue = m_dataRow[key];
                        if (dbValue != null)
                        {
                            if (value.ToString() == dbValue.ToString())
                            {
                                break;
                            }
                        }

                        var temp = string.Format(" `{0}`='{1}' ", key, value);
                        m_sqlSetDict.Add(key, temp);
                        break;
                    }
                });

                if (m_errorDict.Count > 0)
                {
                    break;
                }

                if (m_sqlSetDict.Count == 0)
                {
                    break;
                }

                result = true;
                break;
            }
            return(result);
        }
Exemple #3
0
        bool parseSqlValues()
        {
            bool result = false;

            while (true)
            {
                m_errorDict     = new Dictionary <string, object>();
                m_listSqlColumn = new List <string>();
                m_listSqlValue  = new List <string>();

                YoSqlHelper.EachColumn(m_yoColumnDict, (key, column) => {
                    while (true)
                    {
                        object value = null;
                        if (!checkColumn(ref value, m_uiDict, key, column))
                        {
                            break;
                        }

                        m_listSqlColumn.Add(string.Format("`{0}`", key));
                        m_listSqlValue.Add(string.Format("'{0}'", value));
                        break;
                    }
                });

                if (m_errorDict.Count > 0)
                {
                    break;
                }

                if (m_listSqlValue.Count == 0)
                {
                    break;
                }

                result = true;
                break;
            }
            return(result);
        }