public void UpdateBasketTemp(CsBasketTemp temp)
        {
            if (temp == null)
                return;

            using (var ss = Provider.CreateSessionFactory().CreateSession())
            {
                var tranx = ss.GetTransaction();
                try
                {
                    ss.Update(temp);
                    tranx.Commit();
                }
                catch
                {
                    tranx.Rollback();
                    throw;
                }
            }
        }
        public void UpdateBasketTemp(CsBasketTemp temp,string status)
        {
            if (temp == null)
                return;

            using (var ss = Provider.CreateSessionFactory().CreateSession())
            {
                var tranx = ss.GetTransaction();
                try
                {
                    var query = ss.CreateQuery<CsBasketTemp>(" WHERE [ID] = @Id");
                    query.AddParameter("@Id", temp.ID, DbType.Int32);

                    var baskets = query.GetResults<CsBasketTemp>().OrderByDescending(b => b.OrderDate);
                    var basket = baskets.FirstOrDefault();
                    if (basket != null && basket.ID > 0)
                    {
                        basket.SagePayStatus = status;
                        ss.Update(basket);
                        tranx.Commit();
                    }
                }
                catch
                {
                    tranx.Rollback();
                    throw;
                }
            }
        }
 public CsBasketTemp SaveBasketTemp(CsBasketTemp basket)
 {
     using (var session = Provider.CreateSessionFactory().CreateSession())
     {
         var tranx = session.GetTransaction();
         try
         {
             CsBasketTemp savedBasket = null;
             if (basket.ID == 0)
             {
                 savedBasket = session.Insert(basket);
                 if (basket.Items != null && basket.Items.Count > 0)
                 {
                     foreach (var item in basket.Items)
                     {
                         if (item == null) continue;
                         if (item.ID > 0)
                         {
                             session.Update(item);
                         }
                         else
                         {
                             item.BasketID = basket.ID;
                             session.Insert(item);
                         }
                     }
                 }
             }
             else
             {
                 savedBasket = session.Update(basket);
                 if (basket.Items != null && basket.Items.Count > 0)
                 {
                     foreach (var item in basket.Items)
                     {
                         if (item == null) continue;
                         if (item.ID > 0)
                         {
                             session.Update(item);
                         }
                         else
                         {
                             item.BasketID = basket.ID;
                             session.Insert(item);
                         }
                     }
                 }
             }
             tranx.Commit();
             return savedBasket;
         }
         catch
         {
             tranx.Rollback();
             throw;
         }
         finally
         {
             tranx = null;
         }
     }
 }
 public void UpdateBasketTemp(CsBasketTemp temp)
 {
     BasketTempProvider.Instance.UpdateBasketTemp(temp);
 }
 public void UpdateBasketTemp(CsBasketTemp temp, string status)
 {
     BasketTempProvider.Instance.UpdateBasketTemp(temp, status);
 }
 public CsBasketTemp SaveBasketTemp(CsBasketTemp basket)
 {
     return BasketTempProvider.Instance.SaveBasketTemp(basket);
 }