Ejemplo n.º 1
0
        public String GetValue(DsnConnection dsn, object option_id)
        {
            DataRow[] row = values.Select(values.option_idColumn.ColumnName + "='" + option_id.ToString() + "'");
            if (row.Length == 0)
            {
                List <DataRow> rows = DsnSQLUtil.FillDataTable(dsn, values, values.option_idColumn.ColumnName + "=" + DsnSQLUtil.GetSQLValue(dsn, values.option_idColumn, option_id));
                if (rows == null || rows.Count == 0)
                {
#if asdfasdf
                    DataRow newval = values.NewRow();
                    newval[values.option_idColumn] = option_id;
                    newval[values.stringColumn]    = default_value;
                    values.Rows.Add(newval);
                    MySQLDataTable.CommitChanges(dsn, values);
                    return(default_value);
#endif
                    //throw new Exception( "soemthign bad" );
                    return(null);
                }
                else
                {
                    return(rows[0][values.stringColumn].ToString());
                }
            }
            else
            {
                return(row[0][values.stringColumn].ToString());
            }
        }
Ejemplo n.º 2
0
        public void AppendToDatabase()
        {
            MySQLDataTable dbtable = this as MySQLDataTable;

            if (dbtable != null)
            {
                dbtable.AppendToDatabase();
            }
        }
Ejemplo n.º 3
0
        static Local()
        {
            DataTable tmp = new xperdex.classes.MySQLDataTable(StaticDsnConnection.dsn, "select misc_item.name as item_name,misc_item.dept as dept_name,* from misc_def join misc_item using(item_id) join misc_dept using(dept_id)");

            foreach (DataRow row in tmp.Rows)
            {
                String dept    = row["dept_name"].ToString();
                String item    = row["item_name"].ToString();
                int    item_id = Convert.ToInt32(row["item_id"]);
                int    dept_id = Convert.ToInt32(row["dept_id"]);

                GenericItemGroup group = Local.GetItemGroup(dept);
                group.GetGenericItem(item);
            }

            inited = true;
        }
Ejemplo n.º 4
0
        static void table_TableNewRow(object sender, DataTableNewRowEventArgs e)
        {
            MySQLDataTable     that   = e.Row.Table as MySQLDataTable;
            MySQLDataTable <T> that_t = e.Row.Table as MySQLDataTable <T>;
            IXDataTable        xthat  = e.Row.Table as IXDataTable;
            DsnConnection      conn   = null;

            if (that != null)
            {
                conn = that.connection;
            }
            else if (that_t != null)
            {
                conn = that_t.connection;
            }
            if (xthat != null)
            {
                e.Row[xthat.PrimaryKeyName] = DsnConnection.GetGUID(conn);
            }
            else
            {
                e.Row[XDataTable.ID(e.Row.Table)] = DsnConnection.GetGUID(conn);
            }
        }
Ejemplo n.º 5
0
 new internal void AppendToDatabase()
 {
     MySQLDataTable.AppendToDatabase(connection, this);
 }
Ejemplo n.º 6
0
 /// <summary>
 /// This is the thing that actually adds the default TableName_id and TableName_name
 /// </summary>
 /// <param name="trim_info">Option to trim _info and _description</param>
 public void AddDefaultColumns(bool trim_info, bool add_auto_id, bool add_auto_name)
 {
     MySQLDataTable.AddDefaultColumns(this, trim_info, add_auto_id, add_auto_name);
 }