Example #1
0
        private void btnConvert_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                tbOracleConnectionStringText = TbOracleConnectionString.Text;
                TbCmsConnectionStringText    = TbCmsConnectionString.Text;
                string conn = TbCmsConnectionStringText;
                //get thread safe klayer
                if (conn != null)
                {
                    // Code that runs on application startup
                    DevExpress.Xpo.Metadata.XPDictionary dict =
                        new DevExpress.Xpo.Metadata.ReflectionDictionary();
                    dict.GetDataStoreSchema(typeof(NewNetServicesModule).Assembly);
                    DevExpress.Xpo.DB.IDataStore store =
                        DevExpress.Xpo.XpoDefault
                        .GetConnectionProvider(conn,
                                               DevExpress.Xpo.DB.AutoCreateOption.SchemaAlreadyExists);
                    store = new DevExpress.Xpo.DB.DataCacheNode(new DevExpress.Xpo.DB.DataCacheRoot(store));
                    var layer = new DevExpress.Xpo.ThreadSafeDataLayer(dict, store);
                    Tsdl = layer;
                }
                if (Tsdl == null)
                {
                    //DevExpress.XtraEditors.XtraMessageBox.Show($"Couldn't create dl");
                    return;
                }
                //   MAINWorker.Connect(tsdl);
            }
            catch (Exception ex)
            {
                NewNetServices.Module.Core.StaticHelperMethods.WriteOut($"{ex}");
            }

            BtnConvert.IsEnabled = false;
            Task.Factory
            .StartNew(() =>
            {
                Task.WhenAll(BeginWork());
                Dispatcher.Invoke(() => BtnConvert.IsEnabled = true);
            });
        }
Example #2
0
        void CreateDataLayer()
        {
            TbCmsConnectionStringText = TbCmsConnectionString.Text;
            string conn = TbCmsConnectionStringText;

            //get thread safe klayer
            if (conn != null)
            {
                // Code that runs on application startup
                DevExpress.Xpo.Metadata.XPDictionary dict =
                    new DevExpress.Xpo.Metadata.ReflectionDictionary();
                dict.GetDataStoreSchema(typeof(NewNetServicesModule).Assembly);
                DevExpress.Xpo.DB.IDataStore store =
                    DevExpress.Xpo.XpoDefault
                    .GetConnectionProvider(conn,
                                           DevExpress.Xpo.DB.AutoCreateOption.SchemaAlreadyExists);
                store = new DevExpress.Xpo.DB.DataCacheNode(new DevExpress.Xpo.DB.DataCacheRoot(store));
                var layer = new DevExpress.Xpo.ThreadSafeDataLayer(dict, store);
                Tsdl = layer;
            }
        }
Example #3
0
        private void btnConvert_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                dbName = TbDb.Text;
                if (!wcTable.Contains(dbName))
                {
                    wcTable                  = dbName + "." + wcTable;
                    oltTable                 = dbName + "." + oltTable;
                    oltPortsTable            = dbName + "." + oltPortsTable;
                    splitterTable            = dbName + "." + splitterTable;
                    splitterPortsTable       = dbName + "." + splitterPortsTable;
                    oltSplitterDpTable       = dbName + "." + oltSplitterDpTable;
                    outdPairsTable           = dbName + "." + outdPairsTable;
                    assignmentPrimlocTable   = dbName + "." + assignmentPrimlocTable;
                    assignmentDPairsTable    = dbName + "." + assignmentDPairsTable;
                    assignmentSplitPortTable = dbName + "." + assignmentSplitPortTable;
                    assignmentOltTable       = dbName + "." + assignmentOltTable;
                    addressTable             = dbName + "." + addressTable;
                    cablesWithOUTSpansTable  = dbName + "." + cablesWithOUTSpansTable;
                    conTable                 = dbName + ".Conduits";
                    CABLEPAIR_Table          = dbName + ".CablePairs";
                    dgroupTable              = dbName + ".DesignationGroups";
                    cpdpTable                = dbName + ".CABLEPAIRDESIGNATIONPAIR";
                    dpTable                  = dbName + ".DesignationPairs";
                    junkTable                = dbName + ".JUNCTIONS";
                    subTable                 = dbName + ".Subscribers";
                }
                tbOracleConnectionStringText = TbOracleConnectionString.Text;
                TbCmsConnectionStringText    = TbCmsConnectionString.Text;
                string conn = TbCmsConnectionStringText;
                //get thread safe klayer
                if (conn != null)
                {
                    // Code that runs on application startup
                    DevExpress.Xpo.Metadata.XPDictionary dict =
                        new DevExpress.Xpo.Metadata.ReflectionDictionary();
                    dict.GetDataStoreSchema(typeof(NewNetServicesModule).Assembly);
                    DevExpress.Xpo.DB.IDataStore store =
                        DevExpress.Xpo.XpoDefault
                        .GetConnectionProvider(conn,
                                               DevExpress.Xpo.DB.AutoCreateOption.SchemaAlreadyExists);
                    store = new DevExpress.Xpo.DB.DataCacheNode(new DevExpress.Xpo.DB.DataCacheRoot(store));
                    var layer = new DevExpress.Xpo.ThreadSafeDataLayer(dict, store);
                    Tsdl = layer;
                }
                if (Tsdl == null)
                {
                    //DevExpress.XtraEditors.XtraMessageBox.Show($"Couldn't create dl");
                    return;
                }
                //   MAINWorker.Connect(tsdl);
            }
            catch (Exception ex)
            {
                NewNetServices.Module.Core.StaticHelperMethods.WriteOut($"{ex}");
            }

            using (UnitOfWork uow = new UnitOfWork(Tsdl))
            {
                //using (UnitOfWork uow = MAINWorker.OptimisticLockingReadBehavior = LockingOption)
                //    uow = MAINWorker. LockingOption  STATE = (DefaultFields
                this.state = DefaultFields.GetBusinessObjectDefault <State>(uow,
                                                                            new List <Tuple <string, object> >()
                {
                    new Tuple <string, object>("ShortName", State),
                    new Tuple <string, object>("LongName", (State == "IA" ? "Iowa" : State == "ND"? "North Dakota" :""))
                })
                             .Oid;
            }
            BtnConvert.IsEnabled = false;
            Task.Factory
            .StartNew(() =>
            {
                Task.WhenAll(BeginWork());
                Dispatcher.Invoke(() => BtnConvert.IsEnabled = true);
            });
            //if (ToggleStep.IsChecked.HasValue && ToggleStep.IsChecked.Value)
            //{
            //    Dispatcher.Invoke(() => ProgressBar.Maximum = 0);

            //    WorkBeginning?.Invoke("GID GUID Matching..", null);
            //    HandleStep2<Location>();
            //    HandleStep2<Cable>();
            //}
            //else
            //{
        }