protected void Save_Click(object sender, EventArgs e) { foreach (GridViewRow row in ShippingGrid.Rows) { var rateBox = row.FindControl <TextBox>("Rate"); if (rateBox == null) { return; } decimal rate = 0; if (!decimal.TryParse(rateBox.Text, out rate)) { AlertMessage.PushAlertMessage("You have specified an invalid value for one of your shipping methods", AspDotNetStorefrontControls.AlertMessage.AlertType.Error); return; } var shippingMethodIdField = row.FindControl <HiddenField>("ShippingMethodID"); if (shippingMethodIdField == null) { return; } var sql = @"Update ShippingMethod set FixedPercentOfTotal = @Rate where ShippingMethodID = @ShippingMethodId"; var parameters = new [] { new SqlParameter("@Rate", String.IsNullOrEmpty(rateBox.Text) ? null : Localization.DecimalStringForDB(rate)), new SqlParameter("@ShippingMethodId", shippingMethodIdField.Value) }; DB.ExecuteSQL(sql, parameters); } AlertMessage.PushAlertMessage("Your rates were saved successfully.", AspDotNetStorefrontControls.AlertMessage.AlertType.Success); BindShippingCalculationTable(); }
protected void Page_Load(object sender, EventArgs e) { Response.CacheControl = "private"; Response.Expires = 0; Response.AddHeader("pragma", "no-cache"); Page.Form.DefaultButton = btnUsage.UniqueID; Page.Form.DefaultFocus = txtUsage.ClientID; giftCardId = CommonLogic.QueryStringNativeInt("giftcardid"); var giftCardIdMatchSql = string.Format("select count(*) as N from giftcard where giftcardid={0}", giftCardId); var giftCardIdFound = DB.GetSqlN(giftCardIdMatchSql) > 0; if (giftCardIdFound) { if (!IsPostBack) { ltSerialNumber.Text = DB.GetSqlS(string.Format("SELECT SerialNumber AS S FROM GiftCard WHERE GiftCardID = {0}", giftCardId)); ViewState["Sort"] = "G.CreatedOn"; ViewState["SortOrder"] = "DESC"; ViewState["SQLString"] = selectSQL; EditLink.NavigateUrl = EditLinkBottom.NavigateUrl = String.Format("{0}?giftcardid={1}", AppLogic.AdminLinkUrl("giftcard.aspx"), giftCardId); buildGridData(); } } else { AlertMessage.PushAlertMessage("admin.giftcardusage.giftcardnotfound".StringResource(), AlertMessage.AlertType.Error); pnlGiftCardUsageWrap.Visible = false; EditLink.Visible = EditLinkBottom.Visible = false; } }
void BindShippingCalculationTable() { //We'll need shipping method shipping charge amounts to work with in building the data source using (DataTable gridData = new DataTable()) { //Populate shipping methods data using (SqlConnection sqlConnection = new SqlConnection(DB.GetDBConn())) { sqlConnection.Open(); string getShippingMethodMapping = "exec aspdnsf_GetStoreShippingMethodMapping @StoreID = @StoreId, @IsRTShipping = 0, @OnlyMapped = @FilterByStore"; var getShippingMethodMappingParams = new[] { new SqlParameter("@StoreId", SelectedStoreId), new SqlParameter("@FilterByStore", FilterShipping), }; using (IDataReader rs = DB.GetRS(getShippingMethodMapping, getShippingMethodMappingParams, sqlConnection)) gridData.Load(rs); } if (gridData.Rows.Count == 0) { AlertMessage.PushAlertMessage(String.Format("You do not have any shipping methods setup for the selected store. Please <a href=\"{0}\">click here</a> to set them up.", AppLogic.AdminLinkUrl("shippingmethods.aspx")), AspDotNetStorefrontControls.AlertMessage.AlertType.Error); ShippingRatePanel.Visible = false; return; } ShippingGrid.DataSource = gridData; ShippingGrid.DataBind(); } }
protected void btnAllowAll_Click(object sender, EventArgs e) { DB.ExecuteSQL("delete from ShippingMethodToStateMap where ShippingMethodID=" + ShippingMethodID.ToString()); DB.ExecuteSQL("insert into ShippingMethodToStateMap(ShippingMethodID,StateID) select " + ShippingMethodID.ToString() + ",StateID from State"); AlertMessage.PushAlertMessage("Items Saved.", AspDotNetStorefrontControls.AlertMessage.AlertType.Success); RenderDataTable(); }
protected void btnSubmit7_Click(object sender, EventArgs e) { string sql = "update product set sename = {0} where productid = {1};"; StringBuilder SQLBatch = new StringBuilder("set nocount on;"); int counter = 0; using (SqlConnection con = new SqlConnection(DB.GetDBConn())) { con.Open(); using (IDataReader dr = DB.GetRS("select productid, name from dbo.product", con)) { while (dr.Read()) { SQLBatch.Append(string.Format(sql, DB.SQuote(SearchEngineNameProvider.GenerateSeName(DB.RSFieldByLocale(dr, "name", Localization.GetDefaultLocale()))), DB.RSFieldInt(dr, "productid").ToString())); counter++; if (counter == 500) { DB.ExecuteSQL(SQLBatch.ToString()); counter = 0; SQLBatch.Length = 0; SQLBatch.Append("set nocount on;"); } } } } if (SQLBatch.Length > 0) { DB.ExecuteSQL(SQLBatch.ToString()); } AlertMessage.PushAlertMessage("SEName Updated", AspDotNetStorefrontControls.AlertMessage.AlertType.Success); }
protected void btnStopBilling_Click(Object sender, EventArgs e) { try { var originalOrder = new Order(OriginalRecurringOrderNumber); var recurringOrderManager = new RecurringOrderMgr(); var result = string.Empty; if (originalOrder.PaymentMethod == AppLogic.ro_PMPayPalExpress && PayPalController.GetAppropriateExpressType() == ExpressAPIType.PayPalExpress) { result = recurringOrderManager.CancelPPECRecurringOrder(originalOrder.OrderNumber, false); } else { result = recurringOrderManager.CancelRecurringOrder(originalOrder.OrderNumber); } if (result == AppLogic.ro_OK) { AlertMessage.PushAlertMessage("admin.recurringorder.OrderCancelSuccess".StringResource(), AspDotNetStorefrontControls.AlertMessage.AlertType.Success); } else { AlertMessage.PushAlertMessage(result, AspDotNetStorefrontControls.AlertMessage.AlertType.Error); } } catch (Exception ex) { AlertMessage.PushAlertMessage(ex.Message, AspDotNetStorefrontControls.AlertMessage.AlertType.Error); } }
private void ExecuteFeed() { Server.ScriptTimeout = 120; if (txtFtpServer.Text.Trim().Length == 0 && m_Feed.CanAutoFTP) { AlertMessage.PushAlertMessage("No ftp server specified", AspDotNetStorefrontControls.AlertMessage.AlertType.Error); } else if (txtFtpFileName.Text.Trim().Length == 0 && m_Feed.CanAutoFTP) { AlertMessage.PushAlertMessage("No remote filename specified", AspDotNetStorefrontControls.AlertMessage.AlertType.Error); } else { Customer ThisCustomer = Context.GetCustomer(); String RuntimeParams = String.Empty; RuntimeParams += String.Format("SID={0}&", cboStore.SelectedValue); UpdateFeed(); var result = m_Feed.ExecuteFeed(ThisCustomer, RuntimeParams); if (!String.IsNullOrWhiteSpace(result)) { AlertMessage.PushAlertMessage(result, AspDotNetStorefrontControls.AlertMessage.AlertType.Error); } } InitializePageData(); }
protected void btnClearAll_Click(object sender, EventArgs e) { DB.ExecuteSQL("delete from ShippingMethodToZoneMap where ShippingMethodID=" + ShippingMethodID.ToString()); AlertMessage.PushAlertMessage("Items Saved.", AspDotNetStorefrontControls.AlertMessage.AlertType.Success); RenderDataTable(); }
protected void btnSubmit_Click(object sender, EventArgs e) { if (String.IsNullOrWhiteSpace(txtWord.Text)) { AlertMessage.PushAlertMessage(AppLogic.GetString("admin.BadWord.EntryRequired", SkinID, LocaleSetting), AspDotNetStorefrontControls.AlertMessage.AlertType.Error); return; } // see if this name is already there: var word = txtWord.Text.Trim(); if (!String.IsNullOrEmpty(AppLogic.badWord(word).Word)) { AlertMessage.PushAlertMessage(AppLogic.GetString("admin.BadWord.ExistingBadWord", SkinID, LocaleSetting), AspDotNetStorefrontControls.AlertMessage.AlertType.Error); return; } try { AppLogic.BadWordTable.Add(word, LocaleSetting); txtWord.Text = String.Empty; AlertMessage.PushAlertMessage("Bad word added.", AspDotNetStorefrontControls.AlertMessage.AlertType.Success); } catch (Exception ex) { AlertMessage.PushAlertMessage(ex.Message, AspDotNetStorefrontControls.AlertMessage.AlertType.Error); } }
protected void btnUndo_Click(object sender, EventArgs e) { DB.ExecuteLongTimeSQL("aspdnsf_UndoImport", 1000); AlertMessage.PushAlertMessage(AppLogic.GetString("admin.common.ImportHasBeenUndone", SkinID, LocaleSetting), AspDotNetStorefrontControls.AlertMessage.AlertType.Success); divReview.Visible = false; }
protected void btnUpload_Click(object sender, EventArgs e) { String XlsName = "Import_" + Localization.ToNativeDateTimeString(System.DateTime.Now).Replace(" ", "").Replace("/", "").Replace(":", "").Replace(".", ""); // handle file upload: try { String Image1 = String.Empty; HttpPostedFile Image1File = fuFile.PostedFile; String ExcelFile = CommonLogic.SafeMapPath("~/images" + "/" + XlsName + ".xls"); if (Image1File.ContentLength != 0) { Image1File.SaveAs(ExcelFile); Import.ProcessExcelImportFile(ExcelFile); ltResults.Text = String.Format(AppLogic.GetString("admin.common.ViewImportLog", SkinID, LocaleSetting), "<a href=\"../images/import.htm\" target=\"_blank\">", "</a>"); AlertMessage.PushAlertMessage(AppLogic.GetString("admin.common.FileUploadedPleaseReviewBelow", SkinID, LocaleSetting), AspDotNetStorefrontControls.AlertMessage.AlertType.Success); divReview.Visible = true; } else { AlertMessage.PushAlertMessage(AppLogic.GetString("admin.common.NoDatatoImport", SkinID, LocaleSetting), AspDotNetStorefrontControls.AlertMessage.AlertType.Error); } } catch (Exception ex) { divReview.Visible = false; AlertMessage.PushAlertMessage(CommonLogic.GetExceptionDetail(ex, "<br/>"), AspDotNetStorefrontControls.AlertMessage.AlertType.Error); } }
protected void Page_Load(object sender, EventArgs e) { Response.CacheControl = "private"; Response.Expires = 0; Response.AddHeader("pragma", "no-cache"); ShippingMethodID = CommonLogic.QueryStringUSInt("shippingmethodid"); if (ShippingMethodID == 0) { Response.Redirect(AppLogic.AdminLinkUrl("shippingmethods.aspx")); } if (IsPostBack) { return; } if (DB.GetSqlN("select count(*) as N from ShippingZone with (NOLOCK)") == 0) { AlertMessage.PushAlertMessage("No Shipping Zones are defined!", AspDotNetStorefrontControls.AlertMessage.AlertType.Warning); return; } RenderDataTable(); }
protected void Page_Load(object sender, EventArgs e) { var queryStringStoreId = Request.QueryStringNativeInt("StoreId"); SelectedStoreId = queryStringStoreId > 0 ? queryStringStoreId : Store.GetDefaultStore().StoreID; var queryStringZoneId = Request.QueryStringNativeInt("ZoneId"); SelectedZoneId = queryStringZoneId > 0 ? queryStringZoneId : GetDefaultZoneId(); if (!IsPostBack) { if (FilterShipping) { BindStores(); } BindZones(); BindShippingCalculationTable(); StoreSelectorPanel.Visible = FilterShipping; if (ZoneSelector.Items.Count == 0) { AlertMessage.PushAlertMessage(String.Format("No shipping zones are defined. <a href=\"{0}\">Click here</a> to define your zones", AppLogic.AdminLinkUrl("shippingzones.aspx")), AspDotNetStorefrontControls.AlertMessage.AlertType.Error); } } }
protected void btnProcessAll_Click(object sender, EventArgs e) { var output = new StringBuilder(); var recurringOrderMgr = new RecurringOrderMgr(); using (var connection = new SqlConnection(DB.GetDBConn())) using (var command = connection.CreateCommand()) { command.CommandText = "Select distinct(OriginalRecurringOrderNumber) from ShoppingCart where RecurringSubscriptionID='' and CartType = @cartType and NextRecurringShipDate < dateadd(d,1,getDate())"; command.Parameters.AddWithValue("@cartType", (int)CartTypeEnum.RecurringCart); connection.Open(); using (var reader = command.ExecuteReader()) while (reader.Read()) { output.AppendFormat( AppLogic.GetString("admin.recurring.ProcessingNextOccurrence"), reader.FieldInt("OriginalRecurringOrderNumber")); output.Append(recurringOrderMgr.ProcessRecurringOrder(reader.FieldInt("OriginalRecurringOrderNumber"))); output.Append("...<br/>"); } } AlertMessage.PushAlertMessage( output.ToString(), AspDotNetStorefrontControls.AlertMessage.AlertType.Info); }
protected void btnUpload_Click(object sender, EventArgs e) { String XmlName = "Import_" + Localization.ToThreadCultureShortDateString(System.DateTime.Now).Replace(" ", "").Replace("/", "").Replace(":", "").Replace(".", ""); // handle file upload: try { String Image1 = String.Empty; HttpPostedFile Image1File = fuFile.PostedFile; String XmlFile = CommonLogic.SafeMapPath("~/images" + "/" + XmlName + ".xml"); if (Image1File.ContentLength != 0) { Image1File.SaveAs(XmlFile); } if (fuFile.FileName.Length != 0) { AlertMessage.PushAlertMessage(AppLogic.GetString("admin.common.FileUploadedPleaseReviewBelow", SkinID, LocaleSetting), AspDotNetStorefrontControls.AlertMessage.AlertType.Success); divReview.Visible = true; Import.ProcessXmlImportFile(XmlFile); ltResults.Text = String.Format(AppLogic.GetString("admin.common.ViewImportLog", SkinID, LocaleSetting), "<a href=\"../images/import.htm\" target=\"_blank\">", "</a>"); } else { divReview.Visible = false; AlertMessage.PushAlertMessage(AppLogic.GetString("admin.importProductsFromXML.UploadError", SkinID, LocaleSetting), AspDotNetStorefrontControls.AlertMessage.AlertType.Error); } } catch { divReview.Visible = false; AlertMessage.PushAlertMessage(AppLogic.GetString("admin.importProductsFromExcel.UploadError", SkinID, LocaleSetting), AspDotNetStorefrontControls.AlertMessage.AlertType.Error); } }
protected void Page_Load(object sender, System.EventArgs e) { if (!OrdersArePendingToday()) { AlertMessage.PushAlertMessage(AppLogic.GetString("admin.recurring.NoRecurringShipmentsDueToday", ThisCustomer.LocaleSetting), AspDotNetStorefrontControls.AlertMessage.AlertType.Warning); } }
protected void btnImport_Click(object sender, EventArgs e) { HttpPostedFile importFile = fuWeightImport.PostedFile; if (importFile == null || !importFile.FileName.EndsWith(".csv")) { AlertMessage.PushAlertMessage("Please select a CSV file for import.", AspDotNetStorefrontControls.AlertMessage.AlertType.Error); return; } //Save as a temp file string fullFilePath = String.Format("{0}\\WeightImport_temp.csv", CommonLogic.SafeMapPath("~/images")); try { importFile.SaveAs(fullFilePath); ProcessImport(fullFilePath); } finally { //Clean up the temp file if (File.Exists(fullFilePath)) { File.Delete(fullFilePath); } } }
protected void btnSubmit_Click(object sender, EventArgs e) { if (EntityId != 0) { DB.ExecuteSQL(String.Format("delete from {0}{1} where {2}ID={3}", EntitySpecs.m_ObjectName, EntitySpecs.m_EntityName, EntitySpecs.m_EntityName, EntityId.ToString())); } for (var i = 0; i <= Request.Form.Count - 1; i++) { if (Request.Form.Keys[i].IndexOf("DisplayOrder_") != -1) { var keys = Request.Form.Keys[i].Split('_'); var entityId = Localization.ParseUSInt(keys[1]); var displayOrder = 1; try { displayOrder = Localization.ParseUSInt(Request.Form[Request.Form.Keys[i]]); } catch { } DB.ExecuteSQL(String.Format("insert into {0}{1}({2}ID,{3}ID,DisplayOrder) values({4},{5},{6})", EntitySpecs.m_ObjectName, EntitySpecs.m_EntityName, EntitySpecs.m_EntityName, EntitySpecs.m_ObjectName, EntityId.ToString(), entityId.ToString(), displayOrder.ToString())); } } AlertMessage.PushAlertMessage("Display order updated", AspDotNetStorefrontControls.AlertMessage.AlertType.Success); Render(SelectedLocale.Name); }
protected void Page_Load(object sender, System.EventArgs e) { Response.CacheControl = "private"; Response.Expires = 0; Response.AddHeader("pragma", "no-cache"); Server.ScriptTimeout = 1000000; StringBuilder importRestrictionMessage = new StringBuilder(300); if (AppLogic.MaxProductsExceeded()) { btnUpload.Enabled = false; importRestrictionMessage.Append("<font class=\"text-danger\">" + AppLogic.GetString("admin.common.ImportExcession", SkinID, LocaleSetting) + " "); importRestrictionMessage.Append(AppLogic.GetString("admin.common.NeedUpgrade", SkinID, LocaleSetting) + "</font>"); AlertMessage.PushAlertMessage(importRestrictionMessage.ToString(), AspDotNetStorefrontControls.AlertMessage.AlertType.Error); } btnUpload.Enabled = true; if (!IsPostBack) { divReview.Visible = false; } Page.Form.DefaultButton = btnUpload.UniqueID; }
protected void btnSubmit1_Click(object sender, EventArgs e) { if (ddOnSale.SelectedValue != "0") { DB.ExecuteSQL("Update product set SalesPromptID=" + ddOnSale.SelectedValue + " where 1=1 " + CommonLogic.IIF(ddOnSaleCat.SelectedValue != "0", " and productid in (select distinct productid from productcategory with (NOLOCK) where categoryid=" + ddOnSaleCat.SelectedValue + ")", "") + CommonLogic.IIF(ddOnSaleDep.SelectedValue != "0", " and productid in (select distinct productid from productsection with (NOLOCK) where SectionID=" + ddOnSaleDep.SelectedValue + ")", "") + CommonLogic.IIF(ddOnSaleManu.SelectedValue != "0", " and productid in (select distinct productid from productmanufacturer with (NOLOCK) where manufacturerid=" + ddOnSaleManu.SelectedValue + ")", "")); AlertMessage.PushAlertMessage("On Sale Prompt updated", AspDotNetStorefrontControls.AlertMessage.AlertType.Success); } }
void DeleteCountry(int countryId) { AppLogic.CountryTaxRatesTable.Remove(countryId); DB.ExecuteSQL( "delete from Country where CountryID = @countryId", new[] { new SqlParameter("countryId", (object)countryId) }); AlertMessage.PushAlertMessage("Item Deleted", AlertMessage.AlertType.Success); }
protected void gMain_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "DeleteItem") { DeleteState(Localization.ParseNativeInt(e.CommandArgument.ToString())); AlertMessage.PushAlertMessage("Item Deleted", AspDotNetStorefrontControls.AlertMessage.AlertType.Success); FilteredListing.Rebind(); } }
private void DeleteFeed(int FeedID) { var result = Feed.DeleteFeed(FeedID); if (!string.IsNullOrWhiteSpace(result)) { AlertMessage.PushAlertMessage(result, AspDotNetStorefrontControls.AlertMessage.AlertType.Error); } InitializePageData(); }
protected void btnUpdate_Click(object sender, EventArgs e) { Page.Validate("DisplayOrder"); if (!Page.IsValid) { AlertMessage.PushAlertMessage("Make sure you've specified a display order", AspDotNetStorefrontControls.AlertMessage.AlertType.Error); return; } UpdateItems(); }
protected void deleteRow(int iden) { DB.ExecuteSQL("DELETE FROM StateTaxRate WHERE TaxClassID=" + iden); DB.ExecuteSQL("DELETE FROM CountryTaxRate WHERE TaxClassID=" + iden); DB.ExecuteSQL("DELETE FROM ZipTaxRate WHERE TaxClassID=" + iden); DB.ExecuteSQL("DELETE FROM TaxClass where TaxClassID=" + iden.ToString()); buildGridData(); AlertMessage.PushAlertMessage("Item Deleted", AspDotNetStorefrontControls.AlertMessage.AlertType.Success); }
protected void btnSubmit_Click(object sender, EventArgs e) { var newSelectedShippingCalculationId = int.Parse(hdnSelectedShippingCalculationId.Value); EnsureStoreShippingCalculation(SelectedStoreId); UpdateStoreCalculation(newSelectedShippingCalculationId, SelectedStoreId); BindShippingCalculations(SelectedStoreId); AlertMessage.PushAlertMessage("Shipping calculation method updated.", AspDotNetStorefrontControls.AlertMessage.AlertType.Success); Response.Redirect(AppLogic.AdminLinkUrl("shipping.aspx")); }
protected void btnProcess_Click(Object sender, EventArgs e) { if (OriginalRecurringOrderNumber != 0) { RecurringOrderMgr orderMgr = new RecurringOrderMgr(); string message = orderMgr.ProcessRecurringOrder(OriginalRecurringOrderNumber); AlertMessage.PushAlertMessage(message, (message == AppLogic.ro_OK) ? AspDotNetStorefrontControls.AlertMessage.AlertType.Success : AspDotNetStorefrontControls.AlertMessage.AlertType.Error); } }
protected void ClearLocaleLink_Command(object sender, CommandEventArgs e) { if (e.CommandName == ClearLocalCommand) { var locale = (string)e.CommandArgument; DB.ExecuteSQL( "delete from StringResource where LocaleSetting = @locale", new[] { new SqlParameter("@locale", locale) }); AlertMessage.PushAlertMessage("Locale cleared", AspDotNetStorefrontControls.AlertMessage.AlertType.Success); } }
protected void gMain_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == DeleteCommand) { var stringResourceId = Localization.ParseNativeInt((string)e.CommandArgument); DB.ExecuteSQL( "delete from StringResource where StringResourceID = @id", new[] { new SqlParameter("@id", stringResourceId) }); AlertMessage.PushAlertMessage("String resource deleted", AspDotNetStorefrontControls.AlertMessage.AlertType.Success); } }
protected void btnUpdate_Click(object sender, EventArgs e) { Page.Validate("DisplayOrder"); if (Page.IsValid) { UpdateItems(); AlertMessage.PushAlertMessage("Your values were successfully saved.", AlertMessage.AlertType.Success); } else { AlertMessage.PushAlertMessage("Make sure you've specified a display order", AlertMessage.AlertType.Warning); } }