コード例 #1
0
 public void Delete(DeliveryType deliveryType)
 {
     using (var s = m_dbManger.OpenSession())
     {
         using (var t = s.BeginTransaction())
         {
             s.Delete(deliveryType);
             t.Commit();
             DeleteFromCache(deliveryType);
         }
     }
 }
コード例 #2
0
 public void Add(DeliveryType deliveryType)
 {
     using (var s = m_dbManger.OpenSession())
     {
         using (var t = s.BeginTransaction())
         {
             s.Save(deliveryType);
             t.Commit();
             AddToCache(deliveryType);
         }
     }
 }
コード例 #3
0
        public DeliveryTypeEdit(Window owner, DeliveryType deliveryType)
        {
            m_deliveryType = deliveryType;
            this.Owner = owner;

            InitializeComponent();

            cbIsActive.IsChecked = m_deliveryType.IsActive;
            tbComment.Text = m_deliveryType.Comment;
            tbPrice.Text = m_deliveryType.Price.ToString();
            tbMinOrderAmount.Text = m_deliveryType.MinimumOrderSummaryCondition.ToString();
            cbMinOrderActivation.IsChecked = m_deliveryType.IsConditional;

            Title = tbComment.Text.Length < 1 ? "[Новая]" : String.Format("Доставка: {0}", m_deliveryType.Comment);
        }
コード例 #4
0
        private void btnAdd_Click(object sender, RoutedEventArgs e)
        {
            var c = new DeliveryType
            {
                Comment = "",
                IsActive = false,
                IsConditional = false,
                MinimumOrderSummaryCondition = 0,
                Price = 0,
                Id = Int32.MinValue
            };
            var cew = new DeliveryTypeEdit(this, c);
            cew.ShowDialog();

            if (cew.DialogResult.HasValue && cew.DialogResult.Value)
            {
                ReloadList();
            }
        }
コード例 #5
0
ファイル: Customer.cs プロジェクト: sinland/vkshopmanager
        public DeliveryType GetDeliveryInfo()
        {
            if (m_deliveryType == null)
            {
                var mgr = Core.Repositories.DbManger.GetInstance();
                var repo = mgr.GetDeliveryRepository();

                m_deliveryType = repo.GetById(this.DeliveryTypeId);
            }

            return m_deliveryType;
        }
コード例 #6
0
 private void lbDeliveries_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (e.AddedItems.Count > 0)
     {
         var obj = e.AddedItems[0] as DeliveryType;
         if (obj != null) m_selectedMember = obj;
     }
 }
コード例 #7
0
 public void Update(DeliveryType deliveryType)
 {
     using (var s = m_dbManger.OpenSession())
     {
         using (var t = s.BeginTransaction())
         {
             s.Update(deliveryType);
             t.Commit();
             UpdateInCache(deliveryType);
         }
     }
 }
コード例 #8
0
 private void UpdateInCache(DeliveryType p)
 {
     if (s_idToDeliveryCache.ContainsKey(p.Id)) s_idToDeliveryCache[p.Id] = p;
 }
コード例 #9
0
 private void DeleteFromCache(DeliveryType p)
 {
     if (s_idToDeliveryCache.ContainsKey(p.Id)) s_idToDeliveryCache.Remove(p.Id);
 }
コード例 #10
0
 private void AddToCache(DeliveryType p)
 {
     if (!s_idToDeliveryCache.ContainsKey(p.Id)) s_idToDeliveryCache.Add(p.Id, p);
 }