public CustomerRemoval() { DataRetentionService = DependencyResolver.Current .GetService <IDataRetentionService>(); StringResourceProvider = DependencyResolver.Current .GetService <IStringResourceProvider>(); }
protected void MaintenanceCallback(IAsyncResult result) { IDataRetentionService dataRetentionService = (DataRetentionService)result.AsyncState; if (dataRetentionService != null) { dataRetentionService.InactiveCustomerMaintenance(); } if (result.IsCompleted) { Status = "Complete"; EndTime = DateTime.Now; Session.Remove("EndTime"); Session.Remove("StartTime"); } }
public AccountController(NoticeProvider noticeProvider, IClaimsIdentityProvider claimsIdentityProvider, SendWelcomeEmailProvider sendWelcomeEmailProvider, AppConfigProvider appConfigProvider, CartActionProvider cartActionProvider, IDataRetentionService dataRetentionService, IStringResourceProvider stringResourceProvider, CaptchaVerificationProvider captchaVerificationProvider) { Settings = new AccountSettings(); CaptchaSettings = new CaptchaSettings(); ControllerHelper = new AccountControllerHelper(Settings); NoticeProvider = noticeProvider; ClaimsIdentityProvider = claimsIdentityProvider; SendWelcomeEmailProvider = sendWelcomeEmailProvider; AppConfigProvider = appConfigProvider; CartActionProvider = cartActionProvider; DataRetentionService = dataRetentionService; StringResourceProvider = stringResourceProvider; CaptchaVerificationProvider = captchaVerificationProvider; }
protected CustomerAddress() { DataRetentionService = DependencyResolver.Current.GetService <IDataRetentionService>(); }
protected void RunMaintenance_Click(object sender, EventArgs e) { SqlParameter[] spa = { DB.CreateSQLParameter("@purgeAnonCustomers", SqlDbType.TinyInt, 1, CommonLogic.IIF(PurgeAnonUsers.Checked, 1, 0), ParameterDirection.Input), DB.CreateSQLParameter("@cleanShoppingCartsOlderThan", SqlDbType.SmallInt, 2, Convert.ToInt16(ClearAllShoppingCarts.SelectedValue), ParameterDirection.Input), DB.CreateSQLParameter("@cleanWishListsOlderThan", SqlDbType.SmallInt, 2, Convert.ToInt16(ClearAllWishLists.SelectedValue), ParameterDirection.Input), DB.CreateSQLParameter("@eraseCCFromAddresses", SqlDbType.TinyInt, 1, CommonLogic.IIF(EraseAddressCreditCards.Checked, 1, 0), ParameterDirection.Input), DB.CreateSQLParameter("@clearProductViewsOrderThan", SqlDbType.SmallInt, 2, Convert.ToInt16(ClearProductViewsOlderThan.SelectedValue), ParameterDirection.Input), DB.CreateSQLParameter("@eraseCCFromOrdersOlderThan", SqlDbType.SmallInt, 2, Convert.ToInt16(EraseOrderCreditCards.SelectedValue), ParameterDirection.Input), DB.CreateSQLParameter("@defragIndexes", SqlDbType.TinyInt, 1, CommonLogic.IIF(TuneIndexes.Checked, 1, 0), ParameterDirection.Input), DB.CreateSQLParameter("@updateStats", SqlDbType.TinyInt, 1, CommonLogic.IIF(UpdateStatistics.Checked, 1, 0), ParameterDirection.Input), DB.CreateSQLParameter("@purgeDeletedRecords", SqlDbType.TinyInt, 1, CommonLogic.IIF(PurgeDeletedRecords.Checked, 1, 0), ParameterDirection.Input), DB.CreateSQLParameter("@removeRTShippingDataOlderThan", SqlDbType.SmallInt, 2, Convert.ToInt16(dlClearRTShippingData.SelectedValue), ParameterDirection.Input), DB.CreateSQLParameter("@clearSearchLogOlderThan", SqlDbType.SmallInt, 2, Convert.ToInt16(dlClearSearchData.SelectedValue), ParameterDirection.Input), DB.CreateSQLParameter("@cleanOrphanedLocalizedNames", SqlDbType.TinyInt, 2, CleanupLocalizationData.Checked ? 1 : 0, ParameterDirection.Input), DB.CreateSQLParameter("@cleanupSecurityLog", SqlDbType.TinyInt, 2, CleanupSecurityLog.Checked ? 1 : 0, ParameterDirection.Input), DB.CreateSQLParameter("@clearProfilesOlderThan", SqlDbType.SmallInt, 2, Convert.ToInt16(EraseProfileLog.SelectedValue), ParameterDirection.Input), }; if (Status == null || Status != "Processing") { Status = "Processing"; StartTime = DateTime.Now; Session.Remove("EndTime"); IDataRetentionService dataRetentionService = null; if (AppLogic.AppConfigBool("DataRetentionPolicies.Enabled") && AnonymizeInactiveCustomers.Checked && AppLogic.AppConfigNativeInt("DataRetentionPolicies.MonthsBeforeUserDataAnonymized") > 0) { dataRetentionService = DependencyResolver.Current.GetService <IDataRetentionService>(); } RunMaintenance.BeginInvoke( spa, new AsyncCallback(MaintenanceCallback), dataRetentionService); } if (SaveSettings.Checked) { var tmpS = new StringBuilder(1024); tmpS.Append("PurgeAnonUsers="); tmpS.Append(PurgeAnonUsers.Checked); tmpS.Append(","); tmpS.Append("PurgeDeletedRecords="); tmpS.Append(PurgeDeletedRecords.Checked); tmpS.Append(","); tmpS.Append("AnonymizeInactiveCustomers="); tmpS.Append(AnonymizeInactiveCustomers.Checked); tmpS.Append(","); tmpS.Append("ClearAllShoppingCarts="); tmpS.Append(ClearAllShoppingCarts.Items[ClearAllShoppingCarts.SelectedIndex].Value); tmpS.Append(","); tmpS.Append("ClearAllWishLists="); tmpS.Append(ClearAllWishLists.Items[ClearAllWishLists.SelectedIndex].Value); tmpS.Append(","); tmpS.Append("EraseOrderCreditCards="); tmpS.Append(EraseOrderCreditCards.Items[EraseOrderCreditCards.SelectedIndex].Value); tmpS.Append(","); tmpS.Append("EraseAddressCreditCards="); tmpS.Append(EraseAddressCreditCards.Checked); tmpS.Append(","); tmpS.Append("ClearProductViewsOlderThan="); tmpS.Append(ClearProductViewsOlderThan.Items[ClearProductViewsOlderThan.SelectedIndex].Value); tmpS.Append(","); tmpS.Append("TuneIndexes="); tmpS.Append(TuneIndexes.Checked); tmpS.Append(","); tmpS.Append("UpdateStatistics="); tmpS.Append(UpdateStatistics.Checked); tmpS.Append(","); tmpS.Append("CleanUpLocalizationData="); tmpS.Append(CleanupLocalizationData.Checked); tmpS.Append(","); tmpS.Append("ClearProfiles="); tmpS.Append(EraseProfileLog.Items[EraseProfileLog.SelectedIndex].Value); tmpS.Append(","); tmpS.Append("ClearRTShipping="); tmpS.Append(dlClearRTShippingData.Items[dlClearRTShippingData.SelectedIndex].Value); tmpS.Append(","); tmpS.Append("ClearSearch="); tmpS.Append(dlClearSearchData.Items[dlClearSearchData.SelectedIndex].Value); tmpS.Append(","); tmpS.Append("CleanUpSecurityLog="); tmpS.Append(CleanupSecurityLog.Checked); tmpS.Append(","); tmpS.Append("SaveSettings="); tmpS.Append(SaveSettings.Checked); AppConfigManager.SetAppConfigValue("System.SavedDatabaseMaintenance", tmpS.ToString()); } //Schedule the next maintenance alert AppConfigManager.SetAppConfigValue("NextMaintenanceDate", DateTime.Now.AddMonths(1).ToString()); Response.Redirect(System.IO.Path.GetFileName(Request.PhysicalPath)); }