コード例 #1
0
 /// <summary>
 /// Handles the Clicked event of the crossSell control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param>
 protected void crossSell_Clicked(object sender, EventArgs e)
 {
     try {
     CheckBox checkbox = sender as CheckBox;
     if(checkbox != null) {
       DataGridItem row = checkbox.NamingContainer as DataGridItem;
       int crossProductId = 0;
       if(row != null) {
     int.TryParse(dgCrossSells.DataKeys[row.ItemIndex].ToString(), out crossProductId);
       }
       if(checkbox.Checked) {
     CrossSell crossSell = new CrossSell();
     crossSell.ProductId = productId;
     crossSell.CrossProductId = crossProductId;
     crossSell.Save();
     Store.Caching.ProductCache.RemoveCrossSellCollectionFromCache(productId);
     LoadProducts();
     base.MasterPage.MessageCenter.DisplaySuccessMessage(LocalizationUtility.GetText("lblCrossSellSaved"));
       }
       else {
     Query query = new Query(CrossSell.Schema).WHERE(CrossSell.Columns.ProductId, productId).AND(CrossSell.Columns.CrossProductId, crossProductId);
     query.QueryType = QueryType.Delete;
     query.Execute();
     Store.Caching.ProductCache.RemoveCrossSellCollectionFromCache(productId);
     LoadProducts();
     base.MasterPage.MessageCenter.DisplaySuccessMessage(LocalizationUtility.GetText("lblCrossSellDeleted"));
       }
     }
       }
       catch(Exception ex) {
     Logger.Error(typeof(crosssells).Name + ".crossSell_Clicked", ex);
     base.MasterPage.MessageCenter.DisplayCriticalMessage(ex.Message);
       }
 }
コード例 #2
0
 /// <summary>
 /// Handles the Clicked event of the crossSell control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param>
 protected void crossSell_Clicked(object sender, EventArgs e)
 {
     try {
         CheckBox checkbox = sender as CheckBox;
         if (checkbox != null)
         {
             DataGridItem row            = checkbox.NamingContainer as DataGridItem;
             int          crossProductId = 0;
             if (row != null)
             {
                 int.TryParse(dgCrossSells.DataKeys[row.ItemIndex].ToString(), out crossProductId);
             }
             if (checkbox.Checked)
             {
                 CrossSell crossSell = new CrossSell();
                 crossSell.ProductId      = productId;
                 crossSell.CrossProductId = crossProductId;
                 crossSell.Save();
                 Store.Caching.ProductCache.RemoveCrossSellCollectionFromCache(productId);
                 LoadProducts();
                 base.MasterPage.MessageCenter.DisplaySuccessMessage(LocalizationUtility.GetText("lblCrossSellSaved"));
             }
             else
             {
                 Query query = new Query(CrossSell.Schema).WHERE(CrossSell.Columns.ProductId, productId).AND(CrossSell.Columns.CrossProductId, crossProductId);
                 query.QueryType = QueryType.Delete;
                 query.Execute();
                 Store.Caching.ProductCache.RemoveCrossSellCollectionFromCache(productId);
                 LoadProducts();
                 base.MasterPage.MessageCenter.DisplaySuccessMessage(LocalizationUtility.GetText("lblCrossSellDeleted"));
             }
         }
     }
     catch (Exception ex) {
         Logger.Error(typeof(crosssells).Name + ".crossSell_Clicked", ex);
         base.MasterPage.MessageCenter.DisplayCriticalMessage(ex.Message);
     }
 }
コード例 #3
0
        public void Update(int ProductId,int CrossProductId)
        {
            CrossSell item = new CrossSell();

                item.ProductId = ProductId;

                item.CrossProductId = CrossProductId;

            item.MarkOld();
            item.Save(UserName);
        }
コード例 #4
0
        public void Insert(int ProductId,int CrossProductId)
        {
            CrossSell item = new CrossSell();

            item.ProductId = ProductId;

            item.CrossProductId = CrossProductId;

            item.Save(UserName);
        }