Пример #1
0
 public CurrentObjectTableView(DataSet set, String mirror_table)
 {
     if (set != null)
     {
         relation_data_table = set.Tables[mirror_table];
         relation            = relation_data_table as IMySQLRelationTableBase;
         if (relation == null)
         {
             DataTable table = set.Tables[mirror_table];
             if (table == null)
             {
                 throw new Exception("Failed to get table:" + mirror_table);
             }
             else
             {
                 throw new Exception("Found table, but is not proper type:" + mirror_table);
             }
         }
         InitCurrentObject(relation.parent_table as IXDataTable, relation.child_table as IXDataTable, null);
         ChildRelationName = relation.TableName;
     }
     else
     {
         base.TableName = "(tmp)" + "current_" + mirror_table;
     }
 }
Пример #2
0
        public CurrentObjectDataView(DataSet set, String mirror_table)
        {
            if (set != null)
            {
                relation = set.Tables[mirror_table] as IMySQLRelationTableBase;

                if (relation != null)
                {
                    InitCurrentObject(relation.parent_table as DataTable
                                      , relation.child_table as DataTable, null);
                }
                InitDataView(set, mirror_table);
            }
        }
Пример #3
0
            public override string ToString()
            {
                if (this.RowState == DataRowState.Deleted || this.RowState == DataRowState.Detached)
                {
                    return("<deleted>");
                }
                IMySQLRelationTableBase itable = (this.Table as IMySQLRelationTableBase);
                DataRow parent = this.GetParentRow(itable.ParentOfChild);

                if (parent == null)
                {
                    return("-deleted-");
                }
                return(this.GetParentRow(itable.ParentOfChild)[PrizeExceptionSet.NameColumn].ToString());
            }
Пример #4
0
        void DoClick()
        {
            if (!allow_edit)
            {
                MessageBox.Show("Edit is not enabled.");
                return;
            }
            ListBox list  = null;
            Control c     = Parent.Controls[_target_list];
            int     index = -1;

            if (c != null)
            {
                list = c as ListBox;

                if (list != null)
                {
                    CurrentObjectDataView codv = list.DataSource as CurrentObjectDataView;
                    index = list.SelectedIndex;
                    if (codv != null)
                    {
                        IMySQLRelationTableBase relation_table = codv.Table as IMySQLRelationTableBase;
                        if (relation_table != null)
                        {
                            relation_table.MoveRowUp(codv.Current);
                        }
                    }
                    CurrentObjectTableView cotv = list.DataSource as CurrentObjectTableView;
                    if (cotv != null)
                    {
                        IMySQLRelationTableBase relation_table = cotv.relation_data_table as IMySQLRelationTableBase;
                        if (relation_table != null)
                        {
                            relation_table.MoveRowUp(cotv.Current);
                        }
                    }
                }
            }
            if (list != null && list.SelectedItem != null)
            {
                if (index > 0)
                {
                    list.SelectedIndex = index;
                    list.SelectedIndex = index - 1;
                }
            }
        }
Пример #5
0
 public CurrentObjectDataView(DataSet set, String mirror_table, bool meta_relation)
 {
     if (meta_relation)
     {
         relation2 = set.Tables[mirror_table] as IMetaMySQLRelation;
         if (relation2 != null)
         {
             relation = relation2 as IMySQLRelationTableBase;
             Table    = set.Tables[mirror_table];
             InitCurrentObject(relation2.root_table, null, relation2.parents);
         }
     }
     else
     {
         relation = set.Tables[mirror_table] as IMySQLRelationTableBase;
         if (relation != null)
         {
             InitCurrentObject(relation.parent_table, relation.child_table, null);
         }
     }
     InitDataView(set, mirror_table);
 }
Пример #6
0
 public CurrentObjectTableView(DataSet set, String mirror_table, bool meta_relation)
 {
     relation_data_table = set.Tables[mirror_table];
     if (meta_relation)
     {
         relation2 = relation_data_table as IMetaMySQLRelation;
         if (relation2 != null)
         {
             relation = relation2 as IMySQLRelationTableBase;
             InitCurrentObject(null, null, relation2.parents);
             ChildRelationName = relation.TableName;
         }
     }
     else
     {
         relation = relation_data_table as IMySQLRelationTableBase;
         if (relation != null)
         {
             InitCurrentObject(relation.parent_table, relation.child_table, null);
             ChildRelationName = relation.TableName;
         }
     }
 }