コード例 #1
0
        public void Prepare(Delta delta)
        {
            Console.WriteLine("Pozvan je prepare na NMS-u");
            ITransactionCallback callback = OperationContext.Current.GetCallbackChannel <ITransactionCallback>();

            try
            {
                UpdateResult updateResult = gda.ApplyUpdate(delta);
                if (updateResult.Result == ResultType.Succeeded)
                {
                    callback.CallbackPrepare(true);
                }
                else
                {
                    //Rollback();
                    callback.CallbackPrepare(false);
                }
            }
            catch (Exception ex)
            {
                //Rollback();
                callback.CallbackPrepare(false); // problematicno ako se desi exception u pozivu, nece se uhvatiti
                Console.WriteLine(ex.Message);
            }
        }
コード例 #2
0
        public void Prepare(Delta delta)
        {
            Console.WriteLine("Pozvan je prepare na DMS-u");

            newTree = DMSService.Instance.InitializeNetwork(delta);
            DMSService.updatesCount += 1;
            ITransactionCallback callback = OperationContext.Current.GetCallbackChannel <ITransactionCallback>();

            if (newTree.Data.Values.Count != 0)
            {
                callback.CallbackPrepare(true);
            }
            else
            {
                callback.CallbackPrepare(false);
            }
        }
        public void Prepare(Delta delta)
        {
            Console.WriteLine("Pozvan je prepare na CommunicationEngine-u");
            //TO DO Kopije i provjera da li moze da se primjeni delta
            //NEtwork model = new Network model
            //model.AppltyDelta();...
            ITransactionCallback callback = OperationContext.Current.GetCallbackChannel <ITransactionCallback>();

            callback.CallbackPrepare(true);
        }
コード例 #4
0
        /// <summary>
        /// Trying to apply, APPLYING if it is possible, and write new configuration to new file
        /// </summary>
        /// <param name="delta"></param>
        public void Prepare(ScadaDelta delta)
        {
            Console.WriteLine("Pozvan je Prepare na SCADA");

            ITransactionCallback callback = OperationContext.Current.GetCallbackChannel <ITransactionCallback>();

            if (dbContext.ApplyDelta(delta))
            {
                try
                {
                    ScadaModelParser parser = new ScadaModelParser();

                    // to do:
                    // mozda ove serijaliyacije da budu taskovi_
                    // novu konfiguraciju cuvamo u fajlu
                    parser.SerializeScadaModel(modifiedConfigFile);

                    Console.WriteLine("Prepare true");
                    callback.CallbackPrepare(true);
                }
                catch (Exception ex)
                {
                    ScadaModelParser parser = new ScadaModelParser();
                    parser.DeserializeScadaModel(); // returning to old state (state was previosuly changed in apply delta)

                    Console.WriteLine(ex.Message);
                    Console.WriteLine("1Prepare false");
                    callback.CallbackPrepare(false);
                }
            }
            else
            {
                ScadaModelParser parser = new ScadaModelParser();
                parser.DeserializeScadaModel(); // returning to old state (state was previosuly changed in apply delta)
                Console.WriteLine("2Prepare false");
                callback.CallbackPrepare(false);
            }
        }