Esempio n. 1
0
        //protected:
        protected override void OnLoad(EventArgs e)
        {
            m_ndxerTableGen = new KeyIndexer(AppContext.TableManager.TablesGeneration.DataProvider);
            m_ndxerTableGen.Connect();

            var tm = AppContext.TableManager.Tables;

            foreach (IDataTable table in AppContext.TableManager.Tables)
            {
                var lvi = new ListViewItem(table.Name, 0)
                {
                    Tag = table
                };

                m_lvTables.Items.Add(lvi);
            }


            m_lvTables.Columns[0].AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent);

            var wp = AppContext.Settings.UserSettings.WindowPlacement[OPT_KEY];

            if (wp != null)
            {
                Bounds = wp;
            }

            base.OnLoad(e);
        }
Esempio n. 2
0
        void LoadDataAsync()
        {
            Action <Task> onErr = t =>
            {
                string msg = t.Exception.InnerException.Message;
                AppContext.LogManager.LogSysError($"Lecture de la table des monnaies: {msg}");

                UseWaitCursor = false;
                MessageBox.Show(msg, null, MessageBoxButtons.OK, MessageBoxIcon.Error);
            };


            Action onConnected = () =>
            {
                m_cbCountries.Items.Add("");

                if (m_ndxerCountries.Source.Count > 0)
                {
                    IEnumerable <CountryListEntry> countries = from Country ctry in m_ndxerCountries.Source.Enumerate()
                                                               select new CountryListEntry(ctry);

                    m_cbCountries.Items.AddRange(countries.ToArray());

                    Assert(m_cbCountries.Items[0].ToString() == "");
                }

                if (m_datum != null)
                {
                    FillForm();
                }
                else
                {
                    m_cbCountries.SelectedIndex = 0;
                }

                UpdateUI();
                UseWaitCursor = false;
            };


            Action connect = () =>
            {
                m_ndxerCurrencies.Connect();
                m_ndxerCountries.Connect();
            };



            var task = new Task(connect, TaskCreationOptions.LongRunning);

            task.OnError(onErr);
            task.OnSuccess(onConnected);

            UseWaitCursor = true;
            task.Start();
        }
Esempio n. 3
0
        //protected:
        protected override void OnLoad(EventArgs e)
        {
            m_ndxerProfiles.Connect();
            m_ndxerMgmntMode.Connect();

            LoadData();
            RegisterHandlers();

            base.OnLoad(e);
        }
Esempio n. 4
0
        public ProductMappingChecker(AttrIndexer <uint> ndxerMapProdNber, KeyIndexer ndxerProduct, KeyIndexer ndxerContext)
        {
            m_ndxerMapProdNber = ndxerMapProdNber;
            m_ndxerMapProdNber.Connect();

            m_ndxerProduct = ndxerProduct;
            m_ndxerProduct.Connect();

            m_ndxerContext = ndxerContext;
            m_ndxerContext.Connect();
        }
Esempio n. 5
0
        public SpotValueChecker(IDatumProvider spotValues, KeyIndexer labels, KeyIndexer prodMappings)
        {
            Assert(spotValues != null);
            Assert(labels != null);
            Assert(prodMappings != null);

            m_srcSpotValues = spotValues;
            m_srcSpotValues.Connect();

            m_ProductMappings = prodMappings;
            m_ProductMappings.Connect();

            m_labels = labels;
            m_labels.Connect();
        }
Esempio n. 6
0
        void ConnectAsync()
        {
            Action connect = () =>
            {
                m_ndxerPlaces.Connect();
                m_ndxerCountries.Connect();
            };

            Action <Task> onErr = (t) =>
            {
                UseWaitCursor = false;
                string msg = t.Exception.InnerException.Message;
                MessageBox.Show(msg, null, MessageBoxButtons.OK, MessageBoxIcon.Error);
            };

            Action onConnected = () =>
            {
                if (m_ndxerCountries.Source.Count > 0)
                {
                    var countries = from Country ctry in m_ndxerCountries.Source.Enumerate()
                                    select new CountryListEntry(ctry);

                    m_cbCountries.Items.AddRange(countries.ToArray());
                }

                if (m_datum != null)
                {
                    FillForm();
                }
                else
                {
                    m_cbCountries.SelectedIndex = -1;
                }

                UpdateUI();
                UseWaitCursor = false;
            };


            var task = new Task(connect, TaskCreationOptions.LongRunning);

            task.OnError(onErr);
            task.OnSuccess(onConnected);

            UseWaitCursor = true;
            task.Start();
        }
Esempio n. 7
0
        public KeyIndexer GetKeyIndexer(uint idTable)
        {
            Assert(AppContext.TableManager.GetTable(idTable) != null);

            lock (m_lock)
            {
                KeyIndexer ndxer = m_keysIndexers.Find(x => x.Source.DataSource.ID == idTable);


                if (ndxer == null)
                {
                    ndxer = new KeyIndexer(GetDataProvider(idTable));
                    ndxer.Connect();

                    m_keysIndexers.Add(ndxer);
                }

                return(ndxer);
            }
        }
Esempio n. 8
0
        //protected:
        protected override void OnLoad(EventArgs e)
        {
            m_ndxProfiles.Connect();

            foreach (ProfilePrivilege_t p in ProfilePrivileges.Privileges)
            {
                m_cbPrivilege.Items.Add(new ComboBoxEntry(ProfilePrivileges.GetPrivilegeName(p), p));
            }

            if (m_cbPrivilege.Items.Count > 0)
            {
                m_cbPrivilege.SelectedIndex = 0;
            }

            if (m_datum != null)
            {
                LoadDatumInfo();
                RegisterHandlers();
            }

            UpdateUI();

            base.OnLoad(e);
        }
Esempio n. 9
0
        public void Start()
        {
            Assert(IsListening == false);
            Assert(IsDisposed == false);


            IEnumerable <IDataTable> tables = AppContext.TableManager.DeployableTables.Add(
                AppContext.TableManager.TRLabels, AppContext.TableManager.TRSpotValues);

            foreach (IDataTable tbl in tables)
            {
                uint idTable = tbl.ID;

                Action <IDataRow> rowReplacing = delegate(IDataRow row)
                {
                    if (!Disabled)
                    {
                        m_replacingCache.Add(Tuple.Create(idTable, row));
                    }
                };

                Action <IDataRow> rowInserted = delegate(IDataRow row)
                {
                    if (!Disabled)
                    {
                        for (int i = 0; i < m_replacingCache.Count; ++i)
                        {
                            if (m_replacingCache[i].Item1 == idTable && m_replacingCache[i].Item2.ID == row.ID)
                            {
                                var obj = row as ITaggedRow;

                                if (obj == null || !obj.Disabled)
                                {
                                    LogAction(row, idTable, ActionCode_t.ReplaceRow);
                                }
                                else
                                {
                                    LogAction(row, idTable, ActionCode_t.DeleteRow);
                                }

                                m_replacingCache.RemoveAt(i);
                                return;
                            }
                        }

                        LogAction(row, idTable, ActionCode_t.AddRow);
                    }
                };

                Action <IDataRow> rowReplaced = delegate(IDataRow row)
                {
                    if (!Disabled)
                    {
                        for (int i = 0; i < m_replacingCache.Count; ++i)
                        {
                            if (m_replacingCache[i].Item1 == idTable && m_replacingCache[i].Item2.ID == row.ID)
                            {
                                var obj = row as ITaggedRow;

                                if (obj == null || !obj.Disabled)
                                {
                                    LogAction(row, idTable, ActionCode_t.ReplaceRow);
                                }
                                else
                                {
                                    LogAction(row, idTable, ActionCode_t.DeleteRow);
                                }

                                m_replacingCache.RemoveAt(i);
                                return;
                            }
                        }

                        LogAction(row, idTable, ActionCode_t.ReplaceRow);
                    }
                };

                Action <IDataRow> rowDeleted = delegate(IDataRow row)
                {
                    if (!Disabled)
                    {
                        for (int i = 0; i < m_replacingCache.Count; ++i)
                        {
                            if (m_replacingCache[i].Item1 == idTable && m_replacingCache[i].Item2.ID == row.ID)
                            {
                                return;
                            }
                        }

                        LogAction(row, idTable, ActionCode_t.DeleteRow);
                    }
                };


                var indexer = new KeyIndexer(tbl.DataProvider);
                indexer.Connect();
                m_dataIndexers.Add(indexer);

                indexer.DatumReplacing += rowReplacing;
                indexer.DatumDeleted   += rowDeleted;
                indexer.DatumInserted  += rowInserted;
                indexer.DatumReplaced  += rowReplaced;
            }


            IsListening = true;
        }