Esempio n. 1
0
        protected void DispatchGridCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName != DeleteOrderOptionCommand)
            {
                return;
            }

            int orderOptionId;

            if (!Int32.TryParse((string)e.CommandArgument, out orderOptionId))
            {
                return;
            }

            var result = DeletedOrderOption(orderOptionId);

            if (result)
            {
                FilteredListing.Rebind();
            }

            ctlAlertMessage.PushAlertMessage(
                message: String.Format("{0} {1} {2}",
                                       AppLogic.GetString("admin.common.OrderOption", Locale),
                                       orderOptionId,
                                       AppLogic.GetString(result ? "admin.common.HasBeenDeleted" : "admin.common.CouldNotBeDeleted", Locale)),
                type: AlertMessage.AlertType.Success);
        }
Esempio n. 2
0
 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();
     }
 }
 /// <summary>
 /// Row Command
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void ShippingZoneGrid_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "DeleteItem")
     {
         if (DeleteZone(Localization.ParseNativeInt(e.CommandArgument.ToString())))
         {
             FilteredListing.Rebind();
         }
     }
 }
Esempio n. 4
0
        protected void btnAddToLevel_Click(object sender, EventArgs e)
        {
            string addValue = txtNewEmail.Text.Trim();

            if (!string.IsNullOrEmpty(addValue))
            {
                int customerIdToAdd = 0;
                int parsedCustomerID;

                if (int.TryParse(addValue, out parsedCustomerID))                   //Admin entered a customer ID
                {
                    customerIdToAdd = parsedCustomerID;

                    if (!CheckForValidCustomer(customerIdToAdd))
                    {
                        customerIdToAdd = 0;
                    }
                }
                else                    //Admin entered an email
                {
                    customerIdToAdd = Customer.GetIDFromEMail(addValue);
                }

                if (customerIdToAdd != 0)
                {
                    string customerLevelNameToAdd = DisplayLevelName(CustomerLevelId);
                    if (!CheckIfCustomerLevelCustomerExists(customerIdToAdd, CustomerLevelId))
                    {
                        // clear the carts for this customer. This is to ensure their product pricing is correct
                        // their current cart can have customer level pricing, not retail pricing, and this prevents that:
                        DB.ExecuteSQL(String.Format("delete from shoppingcart where customerid={0}", customerIdToAdd));
                        DB.ExecuteSQL(String.Format("delete from kitcart where customerid={0}", customerIdToAdd));

                        DB.ExecuteSQL(String.Format("Update customer set CustomerLevelID={0} where CustomerID={1}", CustomerLevelId, customerIdToAdd));
                        AlertMessageDisplay.PushAlertMessage(string.Format("{0}{1}", AppLogic.GetString("admin.customerlevel.CustomerAdded", ThisCustomer.LocaleSetting), string.IsNullOrEmpty(customerLevelNameToAdd) ? string.Empty : string.Format(": {0} ({1}={2})", customerLevelName, AppLogic.GetString("admin.common.id", ThisCustomer.LocaleSetting), CustomerLevelId)), AspDotNetStorefrontControls.AlertMessage.AlertType.Success);
                    }
                    else
                    {
                        AlertMessageDisplay.PushAlertMessage(string.Format("{0}{1}", AppLogic.GetString("admin.customerlevel.AlreadyExistsInLevel", ThisCustomer.LocaleSetting), string.IsNullOrEmpty(customerLevelNameToAdd) ? string.Empty : string.Format(": {0} ({1}={2})", customerLevelName, AppLogic.GetString("admin.common.id", ThisCustomer.LocaleSetting), CustomerLevelId)), AspDotNetStorefrontControls.AlertMessage.AlertType.Error);
                    }
                }
                else
                {
                    AlertMessageDisplay.PushAlertMessage(AppLogic.GetString("admin.customerlevel.NotInDatabase", ThisCustomer.LocaleSetting), AspDotNetStorefrontControls.AlertMessage.AlertType.Warning);
                }

                txtNewEmail.Text = string.Empty;
                FilteredListing.Rebind();
            }
            else
            {
                AlertMessageDisplay.PushAlertMessage(AppLogic.GetString("admin.customerlevel.IdOrEmailRequired", ThisCustomer.LocaleSetting), AspDotNetStorefrontControls.AlertMessage.AlertType.Error);
            }
        }
Esempio n. 5
0
        protected void grdCustomersInLevel_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "ClearLevel")
            {
                grdCustomersInLevel.EditIndex = -1;
                DB.ExecuteSQL(String.Format("update Customer set CustomerLevelID=0 where CustomerID={0}", e.CommandArgument));
                AlertMessageDisplay.PushAlertMessage(AppLogic.GetString("admin.customerlevel.RemovedFromLevel", ThisCustomer.LocaleSetting), AspDotNetStorefrontControls.AlertMessage.AlertType.Success);
            }

            FilteredListing.Rebind();
        }
Esempio n. 6
0
 protected void gMain_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "DeleteItem")
     {
         try
         {
             DeleteProductType(Localization.ParseNativeInt(e.CommandArgument.ToString()));
             ctlAlertMessage.PushAlertMessage("Item Deleted", AspDotNetStorefrontControls.AlertMessage.AlertType.Success);
         }
         catch (Exception ex)
         {
             ctlAlertMessage.PushAlertMessage(ex.Message, AspDotNetStorefrontControls.AlertMessage.AlertType.Error);
         }
         FilteredListing.Rebind();
     }
 }
        void RemoveCustomerLevelCommandHandler(object sender, CommandEventArgs e)
        {
            int customerLevelId;

            if (!Int32.TryParse((string)e.CommandArgument, out customerLevelId))
            {
                return;
            }

            if (RemoveCustomerLevel(customerLevelId))
            {
                AlertMessageDisplay.PushAlertMessage("admin.Common.ItemDeleted".StringResource(), AlertMessage.AlertType.Success);

                FilteredListing.Rebind();
            }
        }
Esempio n. 8
0
        void SetDefaultVariantCommandHandler(object sender, CommandEventArgs e)
        {
            int variantId;

            if (!Int32.TryParse((string)e.CommandArgument, out variantId))
            {
                return;
            }

            if (SetDefaultVariant(variantId))
            {
                AlertMessageDisplay.PushAlertMessage(
                    String.Format("Variant {0} set as default variant", variantId),
                    AlertMessage.AlertType.Success);

                FilteredListing.Rebind();
            }
        }
Esempio n. 9
0
        void DeleteVariantCommandHandler(object sender, CommandEventArgs e, bool deleted, string successStringResource)
        {
            int variantId;

            if (!Int32.TryParse((string)e.CommandArgument, out variantId))
            {
                return;
            }

            if (SetDeletedFlag(variantId, deleted))
            {
                AlertMessageDisplay.PushAlertMessage(
                    BuildAlertMessage(variantId, successStringResource),
                    AlertMessage.AlertType.Success);

                FilteredListing.Rebind();
            }
        }
Esempio n. 10
0
        void CloneVariantCommandHandler(object sender, CommandEventArgs e)
        {
            int variantId;

            if (!Int32.TryParse((string)e.CommandArgument, out variantId))
            {
                return;
            }

            if (CloneVariant(variantId))
            {
                AlertMessageDisplay.PushAlertMessage(
                    AppLogic.GetString("admin.entityProductVariantsOverview.VariantCloned", ThisCustomer.SkinID, ThisCustomer.LocaleSetting),
                    AlertMessage.AlertType.Success);

                FilteredListing.Rebind();
            }
        }
        void PublishAffiliateCommandHandler(object sender, CommandEventArgs e, bool published, string successStringResource)
        {
            int affiliateId;

            if (!Int32.TryParse((string)e.CommandArgument, out affiliateId))
            {
                return;
            }

            if (SetPublishedFlag(affiliateId, published))
            {
                AlertMessageDisplay.PushAlertMessage(
                    BuildAffiliateAlertMessage(affiliateId, successStringResource),
                    AlertMessage.AlertType.Success);

                FilteredListing.Rebind();
            }
        }
        protected void RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == DeleteCommand)
            {
                var salesPromptId = Localization.ParseNativeInt((string)e.CommandArgument);

                try
                {
                    DB.ExecuteSQL(
                        "update SalesPrompt set Deleted = 1 where SalesPromptID = @id",
                        new[] { new SqlParameter("@id", salesPromptId) });

                    ctrlAlertMessage.PushAlertMessage("Sales prompt deleted", AlertMessage.AlertType.Success);
                }
                catch (Exception exception)
                {
                    ctrlAlertMessage.PushAlertMessage("Unable to delete sales prompt:<br />" + exception.ToString(), AlertMessage.AlertType.Error);
                }

                FilteredListing.Rebind();
            }
        }
Esempio n. 13
0
        void CloneProductCommandHandler(object sender, CommandEventArgs e)
        {
            int productId;

            if (!Int32.TryParse((string)e.CommandArgument, out productId))
            {
                return;
            }

            if (CloneProduct(productId))
            {
                AlertMessageDisplay.PushAlertMessage(
                    BuildProductAlertMessage(productId, "admin.productgrid.ProductCloned"),
                    AlertMessage.AlertType.Success);

                FilteredListing.Rebind();
            }
            else
            {
                AlertMessageDisplay.PushAlertMessage(
                    BuildProductAlertMessage(productId, "admin.productgrid.ProductNotCloned"),
                    AlertMessage.AlertType.Error);
            }
        }
Esempio n. 14
0
        protected void Save_Click(object sender, EventArgs e)
        {
            var customerAnonymizeSuccesses = new StringBuilder();
            var cannotBeAnonymized         = new StringBuilder();
            var customerAnonymizeErrors    = new StringBuilder();

            var customerDeleteSuccesses = new StringBuilder();
            var cannotBeDeleted         = new StringBuilder();
            var customerDeleteErrors    = new StringBuilder();

            var orderAnonymizeSuccesses = new StringBuilder();
            var orderAnonymizeErrors    = new StringBuilder();

            foreach (GridViewRow row in Grid.Rows)
            {
                if (row.RowType != DataControlRowType.DataRow)
                {
                    continue;
                }

                // We're getting the customer id through a hidden field because the grid data keys are cleared in the GridLoad() sorting above.
                var customerId   = Convert.ToInt32(((HiddenField)row.FindControl("hidCustomerId")).Value);
                var chkAnonymize = (CheckBox)row.FindControl("chkAnonymizeCustomer");
                var chkRemove    = (CheckBox)row.FindControl("chkRemoveCustomer");
                var customerInfo = ((HiddenField)row.FindControl("hidCustomerInfo")).Value;

                if (chkAnonymize.Checked)
                {
                    if (!DataRetentionService.CustomerCanBeAnonymized(customerId))
                    {
                        cannotBeAnonymized
                        .Append(customerInfo)
                        .Append("<br />");

                        continue;
                    }

                    var result = DataRetentionService.AnonymizeCustomer(customerId);

                    if (!result.Success)
                    {
                        customerAnonymizeErrors
                        .Append(customerInfo)
                        .Append("<br />");

                        SysLog.LogException(result.Error, MessageTypeEnum.GeneralException, MessageSeverityEnum.Error);

                        continue;
                    }

                    if (!result.Value)
                    {
                        customerAnonymizeErrors
                        .Append(customerInfo)
                        .Append("<br />");

                        continue;
                    }

                    customerAnonymizeSuccesses
                    .Append(customerInfo)
                    .Append("<br />");

                    foreach (var orderResult in DataRetentionService.AnonymizeOrders(customerId))
                    {
                        if (!orderResult.Success)
                        {
                            orderAnonymizeErrors
                            .Append(customerInfo)
                            .Append("<br />");

                            SysLog.LogException(result.Error, MessageTypeEnum.GeneralException, MessageSeverityEnum.Error);

                            continue;
                        }

                        if (!orderResult.Value)
                        {
                            orderAnonymizeErrors
                            .Append(customerInfo)
                            .Append("<br />");

                            continue;
                        }

                        orderAnonymizeSuccesses
                        .Append(customerInfo)
                        .Append("<br />");
                    }
                }
            }

            if (customerAnonymizeSuccesses.Length > 0)
            {
                AlertMessageDisplay.PushAlertMessage(
                    string.Concat("The following customer(s) have been anonymized:<br />", customerAnonymizeSuccesses.ToString()),
                    AlertMessage.AlertType.Success);
            }

            if (cannotBeAnonymized.Length > 0)
            {
                AlertMessageDisplay.PushAlertMessage(
                    string.Concat("The following customer(s) and their orders could not be anonymized:<br />", cannotBeAnonymized.ToString()),
                    AlertMessage.AlertType.Error);
            }

            if (customerAnonymizeErrors.Length > 0)
            {
                AlertMessageDisplay.PushAlertMessage(
                    string.Concat("The following customer(s) could not be anonymized:<br />", customerAnonymizeErrors.ToString()),
                    AlertMessage.AlertType.Error);
            }

            if (customerDeleteSuccesses.Length > 0)
            {
                AlertMessageDisplay.PushAlertMessage(
                    string.Concat("The following customer(s) have been removed:<br />", customerDeleteSuccesses.ToString()),
                    AlertMessage.AlertType.Success);
            }

            if (cannotBeDeleted.Length > 0)
            {
                AlertMessageDisplay.PushAlertMessage(
                    string.Concat("The following customer(s) and their orders could not be removed:<br />", cannotBeDeleted.ToString()),
                    AlertMessage.AlertType.Error);
            }

            if (customerDeleteErrors.Length > 0)
            {
                AlertMessageDisplay.PushAlertMessage(
                    string.Concat("The following customer(s) could not be removed:<br />", customerDeleteErrors.ToString()),
                    AlertMessage.AlertType.Error);
            }

            if (orderAnonymizeSuccesses.Length > 0)
            {
                AlertMessageDisplay.PushAlertMessage(
                    string.Concat("The following customer(s) orders have been anonymized:<br />", orderAnonymizeSuccesses.ToString()),
                    AlertMessage.AlertType.Success);
            }

            if (orderAnonymizeErrors.Length > 0)
            {
                AlertMessageDisplay.PushAlertMessage(
                    string.Concat("The following customer's orders could not be anonymized:<br />", orderAnonymizeErrors.ToString()),
                    AlertMessage.AlertType.Error);
            }

            FilteredListing.Rebind();
        }