/// <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);
       }
 }
Exemple #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);
     }
 }
        public void Update(int ProductId,int CrossProductId)
        {
            CrossSell item = new CrossSell();

                item.ProductId = ProductId;

                item.CrossProductId = CrossProductId;

            item.MarkOld();
            item.Save(UserName);
        }
        public void Insert(int ProductId,int CrossProductId)
        {
            CrossSell item = new CrossSell();

            item.ProductId = ProductId;

            item.CrossProductId = CrossProductId;

            item.Save(UserName);
        }