Example #1
0
        private void RunItem(DataSynDefItem item)
        {
            if (m_guienv != null)
            {
                if (m_guienv.Filter != null && !m_guienv.Filter.Contains(item.Target.Table))
                {
                    return;
                }

                var it = new SynItem(this, item);
                SetItemState(it, SynItemState.Start);
                it.InitAndLoadFootprints();
                it.ProcessFootprints();
                if (m_guienv.CompareOnly)
                {
                    SetItemState(it, SynItemState.Compared);
                }
                else
                {
                    SetItemState(it, SynItemState.Synchronized);
                }
                it.DetachFromSynchronizer();
            }
            else
            {
                using (var it = new SynItem(this, item))
                {
                    it.Run();
                }
            }
        }
Example #2
0
        private void dataSynDefItemFrame1_CreatedItem(object sender, CreateDataSynItemEventArgs e)
        {
            var table = objectListView1.SelectedObject as TargetTableWrapper;

            if (table == null)
            {
                return;
            }

            var nitem = new DataSynDefItem(m_datasyn);

            nitem.Target = new DataSynTarget {
                Table = table.Table
            };
            nitem.Source = e.Source;

            if (m_srcModel != null && nitem.Source is DataSynTableSource)
            {
                var srctable = m_srcModel.FindSimilarTable(table.Table);
                if (srctable != null)
                {
                    nitem.Source = new DataSynTableSource {
                        Name = srctable.FullName
                    }
                }
                ;
            }
            m_datasyn.Items.Add(nitem);

            RefreshData(null, nitem);
        }
Example #3
0
 public void LoadFromXml(XmlElement xml)
 {
     Options.LoadProperties(xml.FindElement("Options"));
     foreach (XmlElement elem in xml.SelectNodes("Item"))
     {
         var item = new DataSynDefItem(this);
         item.LoadFromXml(elem);
         Items.Add(item);
     }
 }
Example #4
0
 public void SetItem(DataSynDefItem item, SynItem synitem)
 {
     m_item       = item;
     m_sourceHint = null;
     m_targetHint = null;
     if (m_item != null && !m_itemCache.ContainsKey(m_item))
     {
         m_itemCache[m_item] = new CacheItem();
     }
     m_synItem = synitem;
     RefreshData();
 }
Example #5
0
        private DataSynGuiEnv CreateGuiEnv(bool compare, DataSynDefItem item)
        {
            var res = new DataSynGuiEnv();

            res.CompareOnly = compare;
            res.ItemEvent  += new EventHandler <SynItemEventArgs>(res_ItemEvent);
            if (item != null)
            {
                res.SetFilter(item.Target.Table);
            }
            return(res);
        }
Example #6
0
        private void CreateTableItem(NameWithSchema source, NameWithSchema target)
        {
            var nitem = new DataSynDefItem(m_datasyn);

            nitem.Source = new DataSynTableSource {
                Name = source
            };
            nitem.Target = new DataSynTarget {
                Table = target
            };
            m_datasyn.Items.Add(nitem);
            RefreshData(null, nitem);
        }
Example #7
0
        public SynItem(Synchronizer syn, DataSynDefItem item)
        {
            m_item     = item;
            m_options  = m_item.GetOptions();
            m_syn      = syn;
            m_srcCache = Path.GetTempFileName();
            m_dstCache = Path.GetTempFileName();
            m_srcSada  = m_syn.m_srcSada;
            m_dstSada  = m_syn.m_dstSada;
            var vals = Enum.GetValues(typeof(SynTableData));

            m_gridFills = new GridTable[vals.Length];
            m_grids     = new GridTable[vals.Length];
        }
Example #8
0
 internal ItemWrapper(DataSynForm form, DataSynDefItem item)
 {
     m_item = item;
     m_form = form;
 }
Example #9
0
        private void RefreshData(NameWithSchema selectTable, DataSynDefItem selectItem)
        {
            var items = new List <object>();

            foreach (var item in m_datasyn.Items)
            {
                items.Add(new ItemWrapper(this, item));
            }
            TargetTableWrapper selwrap = null;

            if (m_dstModel != null)
            {
                var tbls = new List <NameWithSchema>();
                tbls.AddRange(from t in m_dstModel.Tables select t.FullName);
                tbls.Sort();
                foreach (var tbl in tbls)
                {
                    if (m_datasyn.Items.Find(it => it.Target.Table == tbl) != null)
                    {
                        continue;
                    }
                    var wrap = new TargetTableWrapper(this, tbl);
                    items.Add(wrap);
                    if (selectTable != null && selectTable == tbl)
                    {
                        selwrap = wrap;
                    }
                }
            }
            items.SortByKey(obj =>
            {
                var wrap = obj as ItemWrapper;
                if (wrap != null)
                {
                    return(wrap.m_item.Target.Table);
                }
                var tbl = obj as TargetTableWrapper;
                if (tbl != null)
                {
                    return(tbl.Table);
                }
                return(new NameWithSchema(""));
            });
            objectListView1.SetObjects(items);
            if (selwrap != null)
            {
                objectListView1.SelectedObject = selwrap;
            }
            if (selectItem != null)
            {
                objectListView1.SelectedObject = selectItem;
            }

            //using (var gp = new GridPosition(dataGridView1))
            //{
            //    dataGridView1.Rows.Clear();
            //    foreach (var item in m_datasyn.Items)
            //    {
            //        var index = dataGridView1.Rows.Add(item.SourceToString(), item.TargetToString(), item.GetColumnsDescription());
            //        dataGridView1.Rows[index].Tag = item;
            //    }
            //}
            ShowCurrent();
            UpdateEnabling();
        }