protected void btnSave_Click(object sender, System.EventArgs e) { Commerce.Common.Product product = null; if (lblID.Text != string.Empty) { product = new Commerce.Common.Product(int.Parse(lblID.Text)); } else { product = new Commerce.Common.Product(); } product.AdminComments = txtAdminComments.Text; product.CurrencyCode = ddlCurrencyCodeID.SelectedValue.Trim(); product.DimensionUnit = txtDimensionUnit.Text; product.ProductName = txtProductName.Text; product.ShortDescription = txtShortDescription.Text; product.Sku = txtSku.Text; product.StockLocation = txtStockLocation.Text; product.Status = (ProductStatus)int.Parse(ddlStatusID.SelectedValue); product.ShippingType = (ShippingType)int.Parse(ddlShippingTypeID.SelectedValue); product.ProductType = (ProductType)int.Parse(ddlProductTypeID.SelectedValue); product.UnitOfMeasure = txtUnitOfMeasure.Text; product.ManufacturerID = int.Parse(ddlManufacturerID.SelectedValue); product.ShipEstimateID = int.Parse(ddlShipEstimateID.SelectedValue); product.TaxTypeID = int.Parse(ddlTaxTypeID.SelectedValue); int parsedInt = 0; decimal parsedDec = 0; int.TryParse(txtListOrder.Text, out parsedInt); product.ListOrder = parsedInt; decimal.TryParse(txtOurPrice.Text, out parsedDec); product.OurPrice = decimal.Parse(txtOurPrice.Text); decimal.TryParse(txtRetailPrice.Text, out parsedDec); product.RetailPrice = parsedDec; decimal.TryParse(txtHeight.Text, out parsedDec); product.Height = parsedDec; decimal.TryParse(txtLength.Text, out parsedDec); product.Length = parsedDec; decimal.TryParse(txtWeight.Text, out parsedDec); product.Weight = parsedDec; decimal.TryParse(txtWidth.Text, out parsedDec); product.Width = parsedDec; try { product.Save(Utility.GetUserName()); ResultMessage1.ShowSuccess("Update Successful"); } catch (Exception x) { ThrowError(x.Message); } }
protected void btnSave_Click(object sender, EventArgs e) { string sRating = ddlRating.SelectedValue; if (!String.IsNullOrEmpty(sRating)) { //if the selection is null for some reason //default it. int rating = int.Parse(sRating); //add the review string review = Utility.StripHTML(txtReview.Text); string title = Utility.StripHTML(txtTitle.Text); try { string thisUser = Utility.GetUserName(); ProductReview rev = new ProductReview(); rev.ProductID = productID; rev.AuthorName = thisUser; rev.Body = review; rev.IsApproved = false; rev.PostDate = DateTime.UtcNow; rev.Rating = rating; rev.Title = title; rev.Save(thisUser); ResultMessage1.ShowSuccess("Review Saved!"); } catch (Exception x) { ResultMessage1.ShowFail("Oops! There was an error and your review was not saved: " + x.Message); } } ToggleEditor(false); }
protected void btnDelete_Click(object sender, EventArgs e) { int adID = int.Parse(ViewState["adID"].ToString()); Query q = new Query(Commerce.Common.Ad.GetTableSchema()).AddWhere("adID", adID); q.QueryType = QueryType.Delete; q.Execute(); ResultMessage1.ShowSuccess("Ad Deleted"); }
protected void btnSave_Click(object sender, System.EventArgs e) { CMS.Content text = CMS.ContentService.GetContent(ContentName); if (!text.IsLoaded) { text.IsNew = true; text.ContentGUID = Guid.NewGuid(); } text.Locale = LocaleList.SelectedValue; text.ContentName = ContentName; text.Body = txtContent.Value; text.Save(Page.User.Identity.Name); ResultMessage1.ShowSuccess("Content Saved"); }
protected void btnSave_Click(object sender, System.EventArgs e) { TextEntry text = new TextEntry(ContentName); if (!text.IsLoaded) { text.IsNew = true; } text.ContentName = ContentName; text.Content = txtContent.Text; text.ListOrder = 1; text.ContentGroupID = 0; text.Save(Utility.GetUserName()); ResultMessage1.ShowSuccess("Content Saved"); }
protected void SaveCrossList(object sender, EventArgs e) { //first, remove all the cross-sell bits int productID = Utility.GetIntParameter("id"); Product prod = new Product(productID); try { //prod.SaveManyToMany("CSK_Promo_Product_CrossSell_Map", "crossProductID", chkProducts.Items); //Utility.SaveManyToMany("CSK_Store_Product", "productID", "CSK_Promo_Product_CrossSell_Map", "crossProductID", chkProducts.Items); Utility.SaveManyToMany("productID", productID, "CSK_Promo_Product_CrossSell_Map", "crossProductID", chkProducts.Items); ResultMessage1.ShowSuccess("Cross-Sells saved"); } catch (Exception x) { ResultMessage1.ShowFail(x.Message); } }
protected void btnSave_Click(object sender, EventArgs e) { Commerce.Common.Ad ad = null;; if (ViewState["adID"] != null) { int adID = int.Parse(ViewState["adID"].ToString()); ad = new Commerce.Common.Ad(adID); } else { ad = new Commerce.Common.Ad(); } ad.AdText = txtAdText.Text; ad.CategoryID = int.Parse(ddlCategoryID.Text); ad.DateExpires = DateTime.UtcNow.AddDays(100); ad.PageName = ViewState["pageName"].ToString(); ad.Placement = ViewState["placement"].ToString(); ad.ProductSku = ddlProductID.Text; ad.Save(Utility.GetUserName()); ResultMessage1.ShowSuccess("Ad Saved"); }
protected void btnSetGeneral_Click(object sender, EventArgs e) { // Get the current configuration file. System.Configuration.Configuration config = WebConfigurationManager.OpenWebConfiguration(Request.ApplicationPath); GeneralSettings section = (GeneralSettings)config.GetSection("GeneralSettings"); try { if (section != null) { section.CurrencyCode = ddlCurrencyType.SelectedValue; section.LoginRequirement = ddlLogin.SelectedValue; config.Save(); ResultMessage1.ShowSuccess("General Settings Saved"); } else { throw new Exception("There is no GeneralSettings section in the Web.Config"); } } catch (Exception x) { ResultMessage1.ShowFail(x.Message); } }