Esempio n. 1
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            if (!IsPostBack)
            {
                pnlCustomerEdit.Visible = true;

                Title
                      = HeaderText.Text
                      = CustomerId == null
                                                ? "admin.customer.CreateNew".StringResource()
                                                : "admin.customer.EditCustomer".StringResource();
            }

            // Prevent showing empty form if customer is marked deleted
            if (CustomerId.HasValue && CustomerIsDeleted(CustomerId))
            {
                pnlCustomerEdit.Visible = false;
                pnlAddressEdit.Visible  = false;

                AlertMessageDisplay.PushAlertMessage(
                    String.Format("admin.customer.CustomerIsMarkedAsDeleted".StringResource(), ReturnUrlTracker.GetReturnUrl()),
                    AlertMessage.AlertType.Warning);

                return;
            }

            if (!IsPostBack)
            {
                InitializeContent();
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Clears the target customer's session data
        /// </summary>
        protected void btnClearSession_OnClick(object sender, EventArgs e)
        {
            if (CustomerId == null)
            {
                return;
            }

            CustomerSession.StaticClear(CustomerId.Value);
            AlertMessageDisplay.PushAlertMessage("admin.customer.CustomerSessionCleared".StringResource(), AlertMessage.AlertType.Success);
        }
Esempio n. 3
0
        void CheckForSecurityAlerts()
        {
            var auditList = Security.GetAuditIssues(new HttpRequestWrapper(Request));

            AlertMessageDisplay.PushAlertMessage(
                string.Format(AppLogic.GetString("admin.default.auditsummary"),
                              auditList.Where(i => i.ItemType == SecurityAuditItemType.Security).Count(),
                              auditList.Where(i => i.ItemType == SecurityAuditItemType.Configuration).Count()),
                AlertMessage.AlertType.Warning);
        }
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 override void OnLoad(EventArgs e)
        {
            if (!AppLogic.AppConfigBool("DataRetentionPolicies.Enabled"))
            {
                AlertMessageDisplay.PushAlertMessage(StringResourceProvider.GetString("admin.customerremoval.dataretention.notenabled.message"),
                                                     AlertMessage.AlertType.Error);

                Response.Redirect("default.aspx");
            }
            base.OnLoad(e);
        }
Esempio n. 6
0
 protected void btnUpdate_Click(object sender, EventArgs e)
 {
     if (UpdateItems())
     {
         AlertMessageDisplay.PushAlertMessage(AppLogic.GetString("admin.common.Updated", ThisCustomer.LocaleSetting), AlertMessage.AlertType.Success);
     }
     else
     {
         AlertMessageDisplay.PushAlertMessage(AppLogic.GetString("admin.common.UpdateFailed", ThisCustomer.LocaleSetting), AlertMessage.AlertType.Error);
     }
 }
Esempio n. 7
0
 protected void btnUpdate_Click(object sender, EventArgs e)
 {
     if (UpdateDisplayOrder())
     {
         AlertMessageDisplay.PushAlertMessage(AppLogic.GetString("admin.product.variantgrid.UpdatedOrderAndDefault", ThisCustomer.LocaleSetting), AlertMessage.AlertType.Success);
     }
     else
     {
         AlertMessageDisplay.PushAlertMessage(AppLogic.GetString("admin.variant.VariantNotUpdated", ThisCustomer.LocaleSetting), AlertMessage.AlertType.Error);
     }
 }
Esempio n. 8
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. 9
0
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            if (TopicId == null)
            {
                return;
            }

            TopicManager.SetDeleteFlag(TopicId.Value, true);
            AlertMessageDisplay.PushAlertMessage(AppLogic.GetString("admin.topic.deleted", ThisCustomer.LocaleSetting), AlertMessage.AlertType.Success);

            Response.Redirect(ReturnUrlTracker.GetReturnUrl());
        }
Esempio n. 10
0
        void CheckForMaintenanceAlert()
        {
            var nextMaintenanceDate = DateTime.MinValue;

            if (DateTime.TryParse(AppLogic.AppConfig("NextMaintenanceDate"), out nextMaintenanceDate))
            {
                if (nextMaintenanceDate < DateTime.Now)
                {
                    AlertMessageDisplay.PushAlertMessage(AppLogic.GetString("admin.databasemaintenance.overdue"), AlertMessage.AlertType.Warning);
                }
            }
        }
Esempio n. 11
0
        protected void btnSaveAndClose_Click(object sender, EventArgs e)
        {
            if (UpdateItems())
            {
                AlertMessageDisplay.PushAlertMessage(AppLogic.GetString("admin.common.Updated", ThisCustomer.LocaleSetting), AlertMessage.AlertType.Success);
            }
            else
            {
                AlertMessageDisplay.PushAlertMessage(AppLogic.GetString("admin.common.UpdateFailed", ThisCustomer.LocaleSetting), AlertMessage.AlertType.Error);
            }

            Response.Redirect(ReturnUrlTracker.GetReturnUrl());
        }
Esempio n. 12
0
        /// <summary>
        /// Erases all failed transactions linked to the target customer
        /// </summary>
        protected void btnClearFailedTransactions_OnClick(object sender, EventArgs e)
        {
            if (CustomerId == null)
            {
                return;
            }

            var customer = new Customer(CustomerId.Value);

            Customer.ClearFailedTransactions(CustomerId.Value);
            ltlFailedTransactions.Text = (customer.FailedTransactionCount <= 0 ? "0" : customer.FailedTransactionCount.ToString());
            AlertMessageDisplay.PushAlertMessage("admin.customer.FailedTransactionsCleared".StringResource(), AlertMessage.AlertType.Success);
        }
Esempio n. 13
0
        /// <summary>
        /// Updates an existing customer with the information supplied in the form
        /// </summary>
        Tuple <bool, int?> UpdateCustomer()
        {
            var customer = new Customer(CustomerId.Value);

            if (!customer.AdminCanViewCC && chkCanViewCC.Checked)
            {
                Security.LogEvent(
                    securityAction: "Can View Credit Card Updated",
                    description: "A customer's setting 'can view credit card number' has been enabled.",
                    customerUpdated: customer.CustomerID,
                    updatedBy: ThisCustomer.CustomerID,
                    customerSessionId: ThisCustomer.CurrentSessionID);
            }

            customer.UpdateCustomer(
                storeId: ssOne.SelectedStoreID,
                customerLevelId: Convert.ToInt32(ddlCustomerLevel.SelectedValue),
                email: txtEmail.Text.Trim(),
                firstName: txtFirstName.Text.Trim(),
                lastName: txtLastName.Text.Trim(),
                notes: txtNotes.Text.Trim(),
                phone: txtPhone.Text.Trim(),
                okToEmail: chkOkToEmail.Checked,
                localeSetting: ddlCustomerLocaleSetting.SelectedValue != "-1"
                                        ? ddlCustomerLocaleSetting.SelectedItem.Value
                                        : string.Empty,
                microPayBalance: !string.IsNullOrEmpty(txtMicroPay.Text.Trim())
                                        ? Localization.ParseNativeDecimal(txtMicroPay.Text)
                                        : 0,
                over13Checked: chkOver13.Checked,
                vatRegistrationId: GetVatRegId(customer),
                lockedUntil: chkAccountLocked.Checked
                                        ? DateTime.MaxValue
                                        : DateTime.Now.AddMinutes(-1),
                adminCanViewCreditCard: chkCanViewCC.Checked,
                badLogin: -1);

            //Have to handle these separately as passing a null to the aspdnsf_updCustomer sproc results in no change.
            DB.ExecuteSQL(string.Format(
                              @"UPDATE Customer SET AffiliateID = {0} WHERE CustomerID = {1};",
                              Convert.ToInt32(ddlCustomerAffiliate.SelectedValue) == 0
                                        ? "null"
                                        : ddlCustomerAffiliate.SelectedValue,
                              CustomerId.Value));

            DataRetentionService.UpsertLastActivity(CustomerId ?? 0);

            AlertMessageDisplay.PushAlertMessage("admin.customer.CustomerUpdated".StringResource(), AlertMessage.AlertType.Success);

            return(new Tuple <bool, int?>(true, null));
        }
        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. 15
0
        protected void btnMakeBilling_OnClick(object sender, EventArgs e)
        {
            if (dtlAddressList.DataKey.Value == null || Convert.ToInt32(dtlAddressList.DataKey.Value) == 0)
            {
                return;
            }

            var customer  = new Customer(CustomerId);
            var addressID = Convert.ToInt32(dtlAddressList.DataKey.Value);

            customer.SetPrimaryAddress(addressID, AddressTypes.Billing);

            AlertMessageDisplay.PushAlertMessage(
                AppLogic.GetString("admin.primarybillingchanged", AdminLocale),
                AlertMessage.AlertType.Success);
        }
Esempio n. 16
0
        /// <summary>
        /// Resets the target customer's password to a random value and emails them
        /// </summary>
        protected void btnRandomPassword_OnClick(object sender, EventArgs e)
        {
            if (CustomerId == null)
            {
                return;
            }

            var customer = new Customer(CustomerId.Value);
            var password = new Password(AspDotNetStorefrontEncrypt.Encrypt.CreateRandomStrongPassword(8));

            try
            {
                //Send the new password email
                AppLogic.SendMail(
                    AppLogic.AppConfig("StoreName") + " - " + AppLogic.GetString("cst_account_process.aspx.1", customer.SkinID, customer.LocaleSetting),
                    AppLogic.RunXmlPackage("notification.lostpassword.xml.config", null, customer, customer.SkinID, "", "thiscustomerid=" + customer.CustomerID.ToString() + "&newpwd=" + password.ClearPassword, false, false),
                    true,
                    AppLogic.AppConfig("MailMe_FromAddress"),
                    AppLogic.AppConfig("MailMe_FromName"),
                    customer.EMail,
                    customer.FullName(),
                    "",
                    "",
                    AppLogic.MailServer());

                Security.LogEvent(
                    AppLogic.GetString("admin.cst_account_process.event.AdminResetCustomerPassword.Success", ThisCustomer.SkinID, ThisCustomer.LocaleSetting),
                    "",
                    customer.CustomerID,
                    ThisCustomer.CustomerID,
                    ThisCustomer.CurrentSessionID);

                customer.UpdateCustomer(
                    saltedAndHashedPassword: password.SaltedPassword,
                    saltKey: password.Salt,
                    lockedUntil: DateTime.Now.AddMinutes(-1),
                    badLogin: -1,
                    passwordChangeRequired: true);

                AlertMessageDisplay.PushAlertMessage("admin.customer.passwordResetSuccessful".StringResource(), AlertMessage.AlertType.Success);
            }
            catch (Exception ex)
            {
                SysLog.LogException(ex, MessageTypeEnum.GeneralException, MessageSeverityEnum.Alert);
                AlertMessageDisplay.PushAlertMessage("admin.customer.passwordResetError".StringResource(), AlertMessage.AlertType.Danger);
            }
        }
Esempio n. 17
0
        /// <summary>
        /// Adds or removes a ban on the target customer's last IP address
        /// </summary>
        protected void btnBanIP_Click(object sender, EventArgs e)
        {
            if (CustomerId == null)
            {
                return;
            }

            var customer = new Customer(CustomerId.Value);

            if (String.IsNullOrEmpty(customer.LastIPAddress))
            {
                return;
            }

            using (var connection = new SqlConnection(DB.GetDBConn()))
            {
                connection.Open();

                var ipIsBlocked = DB.GetSqlN(
                    "exec [dbo].[aspdnsf_getIPIsRestricted] @ipAddress",
                    connection,
                    new SqlParameter("ipAddress", customer.LastIPAddress));

                if (ipIsBlocked > 0)
                {
                    //Remove the IP address ban
                    DB.ExecuteSQL(
                        "exec [dbo].[aspdnsf_delRestrictedIP] @ipAddress",
                        connection,
                        new[] { new SqlParameter("ipAddress", customer.LastIPAddress) });

                    AlertMessageDisplay.PushAlertMessage("admin.customer.IPAddressUnbanned".StringResource(), AlertMessage.AlertType.Success);
                    btnBanIP.Text = AppLogic.GetString("admin.customer.BanIP", ThisCustomer.LocaleSetting);
                }
                else
                {
                    //Ban the IP address
                    DB.ExecuteSQL(
                        "exec [dbo].[aspdnsf_insRestrictedIP] @ipAddress",
                        connection,
                        new[] { new SqlParameter("ipAddress", customer.LastIPAddress) });

                    AlertMessageDisplay.PushAlertMessage("admin.customer.IPAddressBanned".StringResource(), AlertMessage.AlertType.Success);
                    btnBanIP.Text = AppLogic.GetString("admin.customer.UnBanIP", ThisCustomer.LocaleSetting);
                }
            }
        }
Esempio n. 18
0
        string GetVatRegId(Customer customer)
        {
            if (!VatTEnabled || String.IsNullOrWhiteSpace(txtVATRegID.Text))
            {
                return(null);
            }

            if (AppLogic.VATRegistrationIDIsValid(customer, txtVATRegID.Text))
            {
                return(txtVATRegID.Text);
            }
            else
            {
                AlertMessageDisplay.PushAlertMessage("account.aspx.91".StringResource(), AlertMessage.AlertType.Danger);                 //Registration ID didn't pass validation
            }
            return(null);
        }
Esempio n. 19
0
        Tuple <bool, int?> SaveOrCreateCustomer()
        {
            if (!Page.IsValid)
            {
                AlertMessageDisplay.PushAlertMessage("Please correct the validation issues below", AlertMessage.AlertType.Error);
                return(new Tuple <bool, int?>(false, null));
            }

            if (CustomerId != null)
            {
                return(UpdateCustomer());
            }
            else
            {
                return(CreateNewCustomer());
            }
        }
Esempio n. 20
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            if (!Order.OrderExists(orderNumber))
            {
                AlertMessageDisplay.PushAlertMessage("admin.refund.InvalidOrderNumber".StringResource() + ": " + orderNumber, AlertMessage.AlertType.Error);
                return;
            }

            if (UpdateOrder(orderNumber))
            {
                AlertMessageDisplay.PushAlertMessage("admin.common.Updated".StringResource(), AlertMessage.AlertType.Success);
            }
            else
            {
                AlertMessageDisplay.PushAlertMessage("admin.common.UpdateFailed".StringResource(), AlertMessage.AlertType.Error);
            }
        }
Esempio n. 21
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. 22
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. 23
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();
            }
        }
        protected void Page_Load(object sender, System.EventArgs e)
        {
            EntityId    = CommonLogic.QueryStringUSInt("EntityID");;
            EntityName  = CommonLogic.QueryStringCanBeDangerousContent("EntityName");
            EntitySpecs = EntityDefinitions.LookupSpecs(EntityName);
            Helper      = new EntityHelper(EntitySpecs, 0);

            if (EntityId == 0 || EntityName.Length == 0)
            {
                AlertMessageDisplay.PushAlertMessage(AppLogic.GetString("admin.common.InvalidParameters", SkinID, LocaleSetting), AspDotNetStorefrontControls.AlertMessage.AlertType.Error);
                MainBody.Visible = false;
                return;
            }

            SelectedLocale = LocaleSource.GetDefaultLocale();

            LoadBody(SelectedLocale.Name);
        }
        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 btnSubmit_Click(object sender, EventArgs e)
        {
            for (var i = 0; i <= Request.Form.Count - 1; i++)
            {
                var FieldName = Request.Form.Keys[i];
                if (FieldName.IndexOf("|") != -1 && ((FieldName.StartsWith("simple", StringComparison.InvariantCultureIgnoreCase) || FieldName.StartsWith("sizecolor", StringComparison.InvariantCultureIgnoreCase))))
                {
                    var KeyVal         = CommonLogic.FormCanBeDangerousContent(FieldName);
                    var FieldNameSplit = FieldName.Split('|');
                    var InventoryType  = FieldNameSplit[0].ToLower(CultureInfo.InvariantCulture);
                    var TheProductID   = Localization.ParseUSInt(FieldNameSplit[1]);
                    var TheVariantID   = Localization.ParseUSInt(FieldNameSplit[2]);
                    var Size           = FieldNameSplit[3];
                    var Color          = FieldNameSplit[4];
                    var inputVal       = CommonLogic.FormUSInt(FieldName);

                    if (InventoryType == "simple")
                    {
                        DB.ExecuteSQL("update ProductVariant set Inventory=" + inputVal.ToString() + " where VariantID=" + TheVariantID.ToString());
                    }
                    else
                    {
                        String sql = "select count(*) as N from Inventory  with (NOLOCK)  where VariantID=" + TheVariantID.ToString() + " and lower([size])=" + DB.SQuote(AppLogic.CleanSizeColorOption(Size).ToLowerInvariant()) + " and lower(color)=" + DB.SQuote(AppLogic.CleanSizeColorOption(Color).ToLowerInvariant());
                        if (DB.GetSqlN(sql) == 0)
                        {
                            sql = "insert into Inventory(InventoryGUID,VariantID,[Size],Color,Quan) values(" + DB.SQuote(DB.GetNewGUID()) + "," + TheVariantID.ToString() + "," + DB.SQuote(AppLogic.CleanSizeColorOption(Size)) + "," + DB.SQuote(AppLogic.CleanSizeColorOption(Color)) + "," + inputVal.ToString() + ")";
                            DB.ExecuteSQL(sql);
                        }
                        else
                        {
                            sql = "update Inventory set Quan=" + inputVal.ToString() + " where VariantID=" + TheVariantID.ToString() + " and lower([size])=" + DB.SQuote(AppLogic.CleanSizeColorOption(Size).ToLowerInvariant()) + " and lower(color)=" + DB.SQuote(AppLogic.CleanSizeColorOption(Color).ToLowerInvariant());
                            DB.ExecuteSQL(sql);
                        }
                    }
                }
            }

            DB.ExecuteSQL("Update Inventory set Quan=0 where Quan<0");                // safety check
            DB.ExecuteSQL("Update ProductVariant set Inventory=0 where Inventory<0"); // safety check

            AlertMessageDisplay.PushAlertMessage("Inventory was updated", AspDotNetStorefrontControls.AlertMessage.AlertType.Success);

            LoadBody(SelectedLocale.Name);
        }
Esempio n. 27
0
        protected void AnonymizeCustomer_OnClick(object sender, EventArgs e)
        {
            if (CustomerId == null)
            {
                return;
            }

            // CustomerId can be null, DataRetention takes ints only
            var customerResult = DataRetentionService.AnonymizeCustomer((int)CustomerId);

            if (!customerResult.Success)
            {
                AlertMessageDisplay.PushAlertMessage(customerResult.Error.Message, AlertMessage.AlertType.Error);
                return;
            }

            if (!customerResult.Value)
            {
                AlertMessageDisplay.PushAlertMessage(
                    AppLogic.GetString("dataretentionpolicies.customercannotbeanonymized"),
                    AlertMessage.AlertType.Warning);

                return;
            }

            foreach (var orderResult in DataRetentionService.AnonymizeOrders((int)CustomerId))
            {
                if (!orderResult.Success)
                {
                    AlertMessageDisplay.PushAlertMessage(orderResult.Error.Message, AlertMessage.AlertType.Error);
                    continue;
                }

                if (!orderResult.Value)
                {
                    AlertMessageDisplay.PushAlertMessage(
                        AppLogic.GetString("dataretentionpolicies.orderscannotbeanonymized"),
                        AlertMessage.AlertType.Warning);
                }
            }

            InitializeContent();
        }
Esempio n. 28
0
        protected void UpdateDisplayOrder(object sender, EventArgs e)
        {
            try
            {
                foreach (GridViewRow row in grdDisplayOrder.Rows)
                {
                    var entityId = grdDisplayOrder.DataKeys[row.DataItemIndex].Value;

                    var txtDisplayOrder = (TextBox)row.FindControl("txtDisplayOrder");
                    var litEntityId     = (Literal)row.FindControl("litEntityId");

                    int displayOrderVal;

                    if (int.TryParse(txtDisplayOrder.Text, out displayOrderVal))
                    {
                        var parameters = new[]
                        {
                            new SqlParameter("@displayOrder", displayOrderVal),
                            new SqlParameter("@entityId", entityId)
                        };

                        DB.ExecuteSQL(String.Format("UPDATE {0} SET DisplayOrder = @displayOrder WHERE {0}ID = @entityId", EntityType), parameters);
                    }
                }

                AlertMessageDisplay.PushAlertMessage("admin.orderdetails.UpdateSuccessful".StringResource(), AlertMessage.AlertType.Success);
            }
            catch (Exception exception)
            {
                AlertMessageDisplay.PushAlertMessage(exception.Message, AlertMessage.AlertType.Error);
            }

            // Redirect to this page with the new querystring paramters set
            Response.Redirect(string.Format(
                                  "entitybulkdisplayorder.aspx?entitytype={0}&entityid={1}",
                                  ddEntityType.SelectedValue,
                                  ddEntity.SelectedValue));
        }
Esempio n. 29
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. 30
0
        private void ShowForm(int orderNumber)
        {
            Decimal orderTotal           = 0.0M;
            String  customerServiceNotes = String.Empty;

            using (var dbconn = new SqlConnection(DB.GetDBConn()))
            {
                dbconn.Open();
                using (var rs = DB.GetRS(String.Format("select OrderTotal, CustomerServiceNotes from Orders with (NOLOCK) where OrderNumber={0}", orderNumber), dbconn))
                {
                    if (rs.Read())
                    {
                        orderTotal           = DB.RSFieldDecimal(rs, "OrderTotal");
                        customerServiceNotes = DB.RSField(rs, "CustomerServiceNotes");
                    }
                    else
                    {
                        AlertMessageDisplay.PushAlertMessage("admin.refund.InvalidOrderNumber".StringResource() + ": " + orderNumber, AlertMessage.AlertType.Info);
                    }
                }
            }
            txtNewOrderTotal.Text        = Localization.CurrencyStringForGatewayWithoutExchangeRate(orderTotal);
            txtCustomerServiceNotes.Text = customerServiceNotes;
        }