Esempio n. 1
0
        public Ac4ySDSequence LoadXmlById(int id)
        {
            Ac4ySDSequence a = null;

            using (var ctx = new AllContext(baseName, userName, password))
            {
                var query = ctx.Ac4ySDSequences
                            .Where(ss => ss.id == id)
                            .FirstOrDefault <Ac4ySDSequence>();

                a = query;
            }

            string xml = a.serialization;

            Ac4ySDSequence aResult = null;

            XmlSerializer serializer = new XmlSerializer(typeof(Ac4ySDSequence));

            StringReader reader = new StringReader(xml);

            aResult = (Ac4ySDSequence)serializer.Deserialize(reader);
            reader.Close();

            return(aResult);
        }
Esempio n. 2
0
        public void addNew(Ac4ySDSequence _Ac4ySDSequence)
        {
            using (var ctx = new AllContext(baseName, userName, password))
            {
                ctx.Ac4ySDSequences.Add(_Ac4ySDSequence);

                ctx.SaveChanges();
            }
        }
Esempio n. 3
0
        public Ac4ySDSequence findFirstById(Int32 id)
        {
            Ac4ySDSequence a = null;

            using (var ctx = new AllContext(baseName, userName, password))
            {
                var query = ctx.Ac4ySDSequences
                            .Where(ss => ss.id == id)
                            .FirstOrDefault <Ac4ySDSequence>();

                a = query;
            }
            return(a);
        }
Esempio n. 4
0
        static void Main(string[] args)
        {
            Ac4ySDSequenceEntityMethods     ac4YSDSequenceEntityMethods     = new Ac4ySDSequenceEntityMethods("Ac4ySD2");
            Ac4ySDSequencePersistentService ac4YSDSequencePersistentService = new Ac4ySDSequencePersistentService("Ac4ySD2");

            Ac4ySDSequence sequence = new Ac4ySDSequence()
            {
                Communication = new List <Ac4ySDCommunication>()
                {
                    new Ac4ySDCommunication()
                    {
                        Sender = new Ac4ySDParticipant()
                        {
                            Name = "frontend"
                        }
                        , Receiver = new Ac4ySDParticipant()
                        {
                            Name = "backend"
                        }
                        , Message = new Ac4ySDMessage()
                        {
                            Message = "login"
                        }
                    }
                    , new Ac4ySDCommunication()
                    {
                        Sender = new Ac4ySDParticipant()
                        {
                            Name = "backend"
                        }
                        , Receiver = new Ac4ySDParticipant()
                        {
                            Name = "frontend"
                        }
                        , Message = new Ac4ySDMessage()
                        {
                            Message = "ok"
                        }
                    }
                }
            };

            GetObjectResponse obj = ac4YSDSequencePersistentService.GetFirstWithXML(1);

            Console.WriteLine(obj.GUID);
        }
Esempio n. 5
0
        static void Main(string[] args)
        {
            Ac4ySDSequenceEntityMethods ac4YSDSequenceEntityMethods = new Ac4ySDSequenceEntityMethods("Ac4ySD4", "manager", "Manager99");
            //Ac4ySDSequencePersistentService ac4YSDSequencePersistentService = new Ac4ySDSequencePersistentService();

            Ac4ySDSequence sequence = new Ac4ySDSequence()
            {
                Communication = new List <Ac4ySDCommunication>()
                {
                    new Ac4ySDCommunication()
                    {
                        Sender = new Ac4ySDParticipant()
                        {
                            Name = "frontend"
                        }
                        , Receiver = new Ac4ySDParticipant()
                        {
                            Name = "backend"
                        }
                        , Message = new Ac4ySDMessage()
                        {
                            Message = "login"
                        }
                    }
                    , new Ac4ySDCommunication()
                    {
                        Sender = new Ac4ySDParticipant()
                        {
                            Name = "backend"
                        }
                        , Receiver = new Ac4ySDParticipant()
                        {
                            Name = "frontend"
                        }
                        , Message = new Ac4ySDMessage()
                        {
                            Message = "ok"
                        }
                    }
                }
            };

            ac4YSDSequenceEntityMethods.SaveWithXml(sequence);
        }
Esempio n. 6
0
        public void SaveWithXml(Ac4ySDSequence _Ac4ySDSequence)
        {
            string xml = "";

            XmlSerializer serializer   = new XmlSerializer(typeof(Ac4ySDSequence));
            StringWriter  stringWriter = new StringWriter();
            XmlWriter     xmlWriter    = XmlWriter.Create(stringWriter);

            serializer.Serialize(xmlWriter, _Ac4ySDSequence);

            xml = stringWriter.ToString();

            _Ac4ySDSequence.serialization = xml;

            using (var ctx = new AllContext(baseName, userName, password))
            {
                ctx.Ac4ySDSequences.Add(_Ac4ySDSequence);

                ctx.SaveChanges();
            }
        }
Esempio n. 7
0
        public GetObjectResponse SaveWithXml(Ac4ySDSequence _Ac4ySDSequence)
        {
            var response = new GetObjectResponse();

            try
            {
                _Ac4ySDSequenceEntityMethods.SaveWithXml(_Ac4ySDSequence);
                response.Result = new Ac4yProcessResult()
                {
                    Code = "1"
                };
            }
            catch (Exception exception)
            {
                response.Result = (new Ac4yProcessResult()
                {
                    Code = "-1", Message = exception.StackTrace
                });
            }

            return(response);
        }
        public GetObjectResponse Save(Ac4ySDSequence _Ac4ySDSequence)
        {
            Ac4ySDSequencePersistentService persistentService = new Ac4ySDSequencePersistentService(baseName);

            return(persistentService.Save(_Ac4ySDSequence));
        }