Example #1
0
        internal static void DeleteOrder(int id)
        {
            // create our NHibernate session factory
            var sessionFactory = FluentNHibernate.CreateSessionFactory();

            using (var session = sessionFactory.OpenSession())
            {
                // retreive all stores and display them
                using (var transaction = session.BeginTransaction())
                {
                    order ord = session.Load <order>(id);

                    int eventId = ord.orderEvent.id;

                    var queryString = string.Format("delete {0} where id = :id", typeof(order));
                    session.CreateQuery(queryString)
                    .SetParameter("id", id)
                    .ExecuteUpdate();

                    transaction.Commit();

                    InventoryAvailability.Set(eventId);
                }
            }
        }
Example #2
0
        static public void saveAll(events evt)
        {
            // create our NHibernate session factory
            var sessionFactory = FluentNHibernate.CreateSessionFactory();

            using (var session = sessionFactory.OpenSession())
            {
                // retreive all stores and display them
                using (session.BeginTransaction())
                {
                    foreach (order o in evt.orderList)
                    {
                        o.checkin    = evt.checkIn;
                        o.checkout   = evt.checkOut;
                        o.orderEvent = evt;
                    }


                    session.SaveOrUpdate(evt);

                    /*
                     * foreach (order ord in ords)
                     * {
                     *  session.Update(ord);
                     * }
                     */

                    session.Transaction.Commit();

                    InventoryAvailability.Set(evt.id);
                }
            }
        }
Example #3
0
        static public IList <order> GetDetail(int EventId)
        {
            // create our NHibernate session factory

            InventoryAvailability.Set(EventId);

            var sessionFactory = FluentNHibernate.CreateSessionFactory();

            using (var session = sessionFactory.OpenSession())
            {
                // retreive all stores and display them
                using (session.BeginTransaction())
                {
                    events evt = session.Load <events>(EventId);

                    IList <order> ord = evt.orderList.ToList();

                    return(ord);
                }
            }
        }
Example #4
0
        static public void saveAll(List <order> ords)
        {
            // create our NHibernate session factory
            var sessionFactory = FluentNHibernate.CreateSessionFactory();

            using (var session = sessionFactory.OpenSession())
            {
                // retreive all stores and display them
                using (session.BeginTransaction())
                {
                    session.Update(ords[0].orderEvent);

                    foreach (order ord in ords)
                    {
                        session.Update(ord);
                    }

                    InventoryAvailability.Set(ords[0].orderEvent.id);

                    session.Transaction.Commit();
                }
            }
        }