private void SaveProductTabs(int productId) { foreach (var detailsTabsModule in AttachedModules.GetModules <IProductTabs>()) { var classInstance = (IProductTabs)Activator.CreateInstance(detailsTabsModule, null); if (ModulesRepository.IsActiveModule(classInstance.ModuleStringId) && classInstance.CheckAlive()) { foreach (ListViewItem tabBody in lvTabBodies.Items) { var tabTitleId = 0; var stringTabTitleId = ((HiddenField)tabBody.FindControl("hfTabTitleId")).Value; var stringTabBody = ((TextBox)tabBody.FindControl("fckTabBody")).Text; if (!int.TryParse(stringTabTitleId, out tabTitleId)) { continue; } if (string.IsNullOrEmpty(stringTabBody)) { classInstance.DeleteProductDetailsTab(productId, tabTitleId); } else if (!string.IsNullOrEmpty(stringTabTitleId)) { classInstance.SaveProductDetailsTab(productId, tabTitleId, stringTabBody); } } } } }
protected void Page_Load(object sender, EventArgs e) { if (!SettingsDesign.DisplayToolBarBottom) { this.Visible = false; return; } LoadModules(); toolbarBottomWishlist.Visible = SettingsDesign.WishListVisibility; toolbarBottomInplace.Visible = CustomerContext.CurrentCustomer.IsAdmin || CustomerContext.CurrentCustomer.IsModerator || TrialService.IsTrialEnabled; toolbarBottomCompare.Visible = SettingsCatalog.EnableCompareProducts; toolbarBottomRecently.Visible = SettingsDesign.RecentlyViewVisibility; var recentlyItems = RecentlyViewService.LoadViewDataByCustomer(CustomerContext.CustomerId, 3); RecentlyCount = recentlyItems.Count; CompareCount = ShoppingCartService.CurrentCompare.Count; WishlistCount = ShoppingCartService.CurrentWishlist.Count; CartCount = ShoppingCartService.CurrentShoppingCart.TotalItems; if (RecentlyCount > 0) { lvToolbarBottomRecentlyView.DataSource = recentlyItems; lvToolbarBottomRecentlyView.DataBind(); } foreach (var module in AttachedModules.GetModules <IRenderIntoShoppingCart>()) { var moduleObject = (IRenderIntoShoppingCart)Activator.CreateInstance(module, null); ShowConfirmButton &= moduleObject.ShowConfirmButtons; } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { var ocModule = AttachedModules.GetModules(AttachedModules.EModuleType.OrderConfirmation).FirstOrDefault(); if (ocModule != null) { var classInstance = (IOrderConfirmation)Activator.CreateInstance(ocModule, null); if (classInstance.IsActive && classInstance.CheckAlive() && !string.IsNullOrEmpty(classInstance.FileUserControlOrderConfirmation)) { Redirect("orderconfirmationmodule.aspx", true); } } } var shoppingCart = ShoppingCartService.CurrentShoppingCart; PageData = LoadOrderConfirmationData(CustomerSession.CustomerId); if (!shoppingCart.CanOrder && (PageData.OrderConfirmationData.ActiveTab != EnActiveTab.FinalTab)) { Redirect("shoppingcart.aspx", true); } //check current step and save state in db var activeT = EnActiveTab.NoTab; if (!IsPostBack) { Enum.TryParse(Request["tab"], true, out activeT); if (activeT != PageData.OrderConfirmationData.ActiveTab) { if (activeT < PageData.OrderConfirmationData.ActiveTab) { PageData.OrderConfirmationData.ActiveTab = activeT; } Redirect(PageData); } } if (PageData.OrderConfirmationData.ActiveTab == EnActiveTab.FinalTab) { OrderConfirmationService.Delete(CustomerSession.CustomerId); LoadOrderConfirmationData(CustomerSession.CustomerId); } if (PageData.OrderConfirmationData.ActiveTab == EnActiveTab.NoTab) { //ShowTab(PageData.OrderConfirmationData.UserType == EnUserType.RegistredUser ? EnActiveTab.UserTab : EnActiveTab.DefaultTab); //Changed by Evgeni to prevent user registration ShowTab(EnActiveTab.UserTab); } else { ShowTab(PageData.OrderConfirmationData.ActiveTab); } SetMeta(new MetaInfo(string.Format("{0} - {1}", Resource.Client_OrderConfirmation_DrawUpOrder, SettingsMain.ShopName)), string.Empty); }
protected void Page_Load(object sender, EventArgs e) { if (Request["module"].IsNullOrEmpty()) { Response.Redirect(UrlService.GetAdminAbsoluteLink("")); } var module = AttachedModules.GetModules().FirstOrDefault( item => ((IModule)Activator.CreateInstance(item, null)).ModuleStringId == Request["module"]); if (module == null) { Response.Redirect(UrlService.GetAdminAbsoluteLink("")); } ckbActiveModule.Attributes.Add("data-modulestringid", Request["module"]); ckbActiveModule.Checked = ModulesRepository.IsActiveModule(Request["module"]); lblIsActive.Text = ckbActiveModule.Checked ? Resources.Resource.Admin_Module_Active : Resources.Resource.Admin_Module_NotActive; lblIsActive.ForeColor = ckbActiveModule.Checked ? System.Drawing.Color.Green : System.Drawing.Color.Red; var moduleObject = (IModule)Activator.CreateInstance(module, null); lblHead.Text = moduleObject.ModuleName; if (moduleObject.ModuleControls != null) { rptTabs.DataSource = moduleObject.ModuleControls; rptTabs.DataBind(); int currentControlIndex = CurrentControlIndex; if (currentControlIndex < 0 || currentControlIndex > (moduleObject.ModuleControls.Count - 1)) { currentControlIndex = 0; } if (moduleObject.ModuleControls != null && moduleObject.ModuleControls.Any()) { Control c = (this).LoadControl( UrlService.GetAbsoluteLink(string.Format("/Modules/{0}/{1}", moduleObject.ModuleStringId, moduleObject.ModuleControls[currentControlIndex] .File))); if (c != null) { pnlBody.Controls.Add(c); } SetMeta(string.Format("{0} - {1} - {2}", SettingsMain.ShopName, moduleObject.ModuleName, moduleObject.ModuleControls[currentControlIndex].NameTab)); } } else { lblInfo.Text = Resources.Resource.Admin_Module_NotConfigure; } }
private void LoadProductInformationModules() { foreach (var module in AttachedModules.GetModules <IModuleDetails>()) { var classInstance = (IModuleDetails)Activator.CreateInstance(module, null); liProductInformation.Text += classInstance.RenderToProductInformation(CurrentProduct.ProductId); } }
private void LoadModules() { foreach (var module in AttachedModules.GetModules <IRenderIntoMainPage>()) { var classInstance = (IRenderIntoMainPage)Activator.CreateInstance(module, null); MainPageProducts += classInstance.RenderMainPageProducts(); MainPageProductsAfterCarousel += classInstance.RenderMainPageAfterCarousel(); } }
private void LoadModules() { var discountModule = AttachedModules.GetModules <IDiscount>().FirstOrDefault(); if (discountModule != null) { var classInstance = (IDiscount)Activator.CreateInstance(discountModule); _productDiscountModels = classInstance.GetProductDiscountsList(); } }
public static void SendNews(string txtTitle, string text) { foreach (var moduleType in AttachedModules.GetModules <ISendMails>()) { var moduleObject = (ISendMails)Activator.CreateInstance(moduleType, null); if (ModulesRepository.IsActiveModule(moduleObject.ModuleStringId)) { moduleObject.SendMails(txtTitle, text, MailRecipientType.Subscriber); } } }
/// <summary> /// /// </summary> /// <param name="email"></param> public static void Unsubscribe(string email) { SQLDataAccess.ExecuteNonQuery( "UPDATE [Customers].[Subscription] SET [Subscribe] = 0, [UnsubscribeDate] = GETDATE() WHERE [Email] = @Email", CommandType.Text, new SqlParameter("@Email", email)); var modules = AttachedModules.GetModules <ISendMails>(); foreach (var moduleType in modules) { var moduleObject = (ISendMails)Activator.CreateInstance(moduleType, null); moduleObject.UnsubscribeEmail(email); } }
protected void Page_Load(object sender, EventArgs e) { if (Request["module"].IsNullOrEmpty()) { Response.Redirect(UrlService.GetAdminAbsoluteLink("")); } var module = AttachedModules.GetModules(AttachedModules.EModuleType.All).FirstOrDefault( item => ((IModule)Activator.CreateInstance(item, null)).ModuleStringId == Request["module"]); if (module == null) { Response.Redirect(UrlService.GetAdminAbsoluteLink("")); } var moduleObject = (IModule)Activator.CreateInstance(module, null); lblHead.Text = moduleObject.ModuleName; if (moduleObject.ModuleControls != null) { rptTabs.DataSource = moduleObject.ModuleControls; rptTabs.DataBind(); int currentControlIndex = CurrentControlIndex; if (currentControlIndex < 0 || currentControlIndex > (moduleObject.ModuleControls.Count - 1)) { currentControlIndex = 0; } //foreach (var controlName in moduleObject.ModuleControls) //{ Control c = (this).LoadControl(UrlService.GetAbsoluteLink(string.Format("/Modules/{0}/{1}", moduleObject.ModuleStringId, moduleObject.ModuleControls[currentControlIndex].File))); if (c != null) { pnlBody.Controls.Add(c); } Page.Title = string.Format("{0} - {1} - {2}", SettingsMain.ShopName, moduleObject.ModuleName, moduleObject.ModuleControls[currentControlIndex].NameTab); //} } else { lblInfo.Text = Resources.Resource.Admin_Module_NotConfigure; } }
private void LoadTabModules() { var listDetailsTabs = new List <ITab>(); foreach (var detailsTabsModule in AttachedModules.GetModules <IProductTabs>()) { var classInstance = (IProductTabs)Activator.CreateInstance(detailsTabsModule, null); listDetailsTabs.AddRange(classInstance.GetProductDetailsTabsCollection(CurrentProduct.ProductId)); } lvTabsBodies.DataSource = listDetailsTabs; lvTabsTitles.DataSource = listDetailsTabs; lvTabsBodies.DataBind(); lvTabsTitles.DataBind(); }
private void LoadModules() { var customLabels = new List <ProductLabel>(); foreach (var labelModule in AttachedModules.GetModules <ILabel>()) { var classInstance = (ILabel)Activator.CreateInstance(labelModule); var labelCode = classInstance.GetLabel(); if (labelCode != null) { customLabels.Add(labelCode); } } Labels = customLabels.Where(l => l.ProductIds.Contains(Product.ProductId)).Select(l => l.LabelCode).ToList(); }
public override void GetExportFeedString(string filenameAndPath) { _description = ExportFeed.GetModuleSetting(ModuleName, "DescriptionSelection"); _currency = ExportFeed.GetModuleSetting(ModuleName, "Currency"); _googleProductCategory = ExportFeed.GetModuleSetting(ModuleName, "GoogleProductCategory"); _removeHTML = ExportFeed.GetModuleSetting(ModuleName, "RemoveHTML").TryParseBool(); var discountModule = AttachedModules.GetModules <IDiscount>().FirstOrDefault(); if (discountModule != null) { var classInstance = (IDiscount)Activator.CreateInstance(discountModule); _productDiscountModels = classInstance.GetProductDiscountsList(); } var settings = new XmlWriterSettings { Encoding = Encoding.UTF8, Indent = true }; using (var stream = new FileStream(filenameAndPath, FileMode.OpenOrCreate, FileAccess.Write, FileShare.ReadWrite)) { using (var writer = XmlWriter.Create(stream, settings)) { // source http://www.google.com/support/merchants/bin/answer.py?answer=188494&expand=GB writer.WriteStartDocument(); writer.WriteStartElement("rss"); writer.WriteAttributeString("version", "2.0"); writer.WriteAttributeString("xmlns", "g", null, GoogleBaseNamespace); writer.WriteStartElement("channel"); writer.WriteElementString("title", ExportFeed.GetModuleSetting(ModuleName, "DatafeedTitle")); writer.WriteElementString("link", ShopUrl); writer.WriteElementString("description", ExportFeed.GetModuleSetting(ModuleName, "DatafeedDescription")); CommonStatistic.TotalRow = GetProdutsCount(ModuleName); foreach (var productRow in GetProduts(ModuleName)) { ProcessProductRow(productRow, writer); CommonStatistic.RowPosition++; } writer.WriteEndElement(); writer.WriteEndElement(); writer.WriteEndDocument(); } } }
protected void Page_PreRender(object sender, EventArgs e) { float itemsCount = ShoppingCartService.CurrentShoppingCart.TotalItems; Count = string.Format("{0} {1}", itemsCount == 0 ? "" : itemsCount.ToString(), Strings.Numerals(itemsCount, Resources.Resource.Client_UserControls_ShoppingCart_Empty, Resources.Resource.Client_UserControls_ShoppingCart_1Product, Resources.Resource.Client_UserControls_ShoppingCart_2Products, Resources.Resource.Client_UserControls_ShoppingCart_5Products)); var moduleShoppingCartPopup = AttachedModules.GetModules <IShoppingCartPopup>().FirstOrDefault(); if (moduleShoppingCartPopup != null) { TypeSite = "productadded"; } }
protected void btnSend_Click(object sender, EventArgs e) { if (!IsValidData()) { return; } var isSend = false; var modules = AttachedModules.GetModules <ISendMails>().ToArray(); var recipientType = MailRecipientType.None; if (ckbSubscribers.Checked) { recipientType |= MailRecipientType.Subscriber; } if (ckbOrderedCustomers.Checked) { recipientType |= MailRecipientType.OrderCustomer; } foreach (var moduleType in modules) { var moduleObject = (ISendMails)Activator.CreateInstance(moduleType, null); if (ModulesRepository.IsActiveModule(moduleObject.ModuleStringId)) { isSend |= moduleObject.SendMails(txtTitle.Text, fckMailContent.Text, recipientType); } } if (isSend) { lblMessage.Text = Resource.Admin_m_News_MessageIsSend; lblMessage.ForeColor = System.Drawing.Color.Blue; } else { lblMessage.Text = Resource.Admin_m_News_MessageIsSend; lblMessage.ForeColor = System.Drawing.Color.Red; } divMessage.Visible = true; divSend.Visible = false; }
/// <summary> /// /// </summary> /// <param name="id"></param> public static void Subscribe(int id) { SQLDataAccess.ExecuteNonQuery( "UPDATE [Customers].[Subscription] SET [Subscribe] = 1, [SubscribeDate] = GETDATE(), [UnsubscribeDate] = NULL WHERE [Id] = @Id", CommandType.Text, new SqlParameter("@Id", id)); //todo: лишние запросы получения кастомера и подписки <Sckeef> var subscription = GetSubscription(id); var customer = CustomerService.GetCustomerByEmail(subscription.Email); var modules = AttachedModules.GetModules <ISendMails>(); foreach (var moduleType in modules) { var moduleObject = (ISendMails)Activator.CreateInstance(moduleType, null); moduleObject.SubscribeEmail(new Subscription { Email = subscription.Email, FirstName = customer.FirstName, LastName = customer.LastName, Phone = customer.Phone }); } }
protected void Page_PreLoad(object sender, EventArgs e) { if (!IsPostBack) { var showConfirmButtons = true; foreach (var module in AttachedModules.GetModules <IRenderIntoShoppingCart>()) { var moduleObject = (IRenderIntoShoppingCart)Activator.CreateInstance(module, null); showConfirmButtons &= moduleObject.ShowConfirmButtons; } if (!showConfirmButtons && !string.Equals(Request["tab"], "FinalTab")) { Response.Redirect("shoppingcart.aspx"); } if (OrderConfirmationService.OrderID != 0 && string.Equals(Request["tab"], "FinalTab")) { mvOrderConfirm.SetActiveView(ViewOrderConfirmationFinal); StepSuccess.OrderID = OrderConfirmationService.OrderID; OrderConfirmationService.OrderID = 0; return; } } var shoppingCart = ShoppingCartService.CurrentShoppingCart; PageData = LoadOrderConfirmationData(CustomerContext.CustomerId); if (!shoppingCart.CanOrder && (PageData.OrderConfirmationData.ActiveTab != EnActiveTab.FinalTab)) { Response.Redirect("shoppingcart.aspx"); return; } if (PageData.OrderConfirmationData.ActiveTab == EnActiveTab.FinalTab) { OrderConfirmationService.Delete(CustomerContext.CustomerId); LoadOrderConfirmationData(CustomerContext.CustomerId); } ShowTab(PageData.OrderConfirmationData.ActiveTab); }
protected void Page_Load(object sender, EventArgs e) { if (!CustomerSession.CurrentCustomer.RegistredUser) { Response.Redirect("default.aspx"); } //if (!IsPostBack) //{ SetMeta(new MetaInfo(string.Format("{0} - {1}", SettingsMain.ShopName, Resource.Client_MyAccount_MyAccount)), string.Empty); //int countSmsModulesAcvive = AttachedModules.GetModules(AttachedModules.EModuleType.SMS).Select(type => (IModuleSms) Activator.CreateInstance(type, null)).Count(moduleInst => moduleInst.IsActive()); //smsnotifications.Visible = countSmsModulesAcvive > 0; foreach (var type in AttachedModules.GetModules(AttachedModules.EModuleType.MyAccountControls)) { var mac = (IMyAccountControls)Activator.CreateInstance(type, null); if (mac.IsActiveModule) { //foreach (var macontrol in mac.Controls) for (int i = 0; i < mac.Controls.Count; i++) { Control c = (this).LoadControl(UrlService.GetAbsoluteLink(string.Format("/Modules/{0}/{1}", mac.ModuleStringId, mac.Controls[i].File))); if (c != null) { var div = new Panel() { CssClass = "tab-content" }; div.Attributes.Add("data-tabs-content", "true"); div.Controls.Add(c); tabscontents.Controls.Add(div); liDopTabs.Text += string.Format("<div class=\"tab-header\" id=\"{0}{1}\" data-tabs-header=\"true\"><span class=\"tab-inside\">{2}</span><span class=\"right\"></span></div>", mac.ModuleStringId.ToLower(), i + 1, mac.Controls[i].NameTab); } } } } //} }
public static void RunDbDependAppStartServices() { // // Put yours DB depens code here // //Load modules AttachedModules.LoadModules(); // TaskManager TaskManager.TaskManagerInstance().Init(); TaskManager.TaskManagerInstance().Start(); TaskManager.TaskManagerInstance().ManagedTask(TaskSettings.Settings); // LogSessionRestart InternalServices.LogApplicationRestart(false, false); // RefreshCurrency CurrencyService.RefreshCurrency(); }
protected void Page_Load(object sender, EventArgs e) { if (!CustomerContext.CurrentCustomer.RegistredUser) { Response.Redirect("default.aspx"); } bonusTab.Visible = bonusContent.Visible = BonusSystem.IsActive; SetMeta( new MetaInfo(string.Format("{0} - {1}", SettingsMain.ShopName, Resource.Client_MyAccount_MyAccount)), string.Empty); foreach (var type in AttachedModules.GetModules <IMyAccountControls>()) { var mac = (IMyAccountControls)Activator.CreateInstance(type, null); for (int i = 0; i < mac.Controls.Count; i++) { Control c = (this).LoadControl( UrlService.GetAbsoluteLink(string.Format("/Modules/{0}/{1}", mac.ModuleStringId, mac.Controls[i].File))); if (c != null) { var div = new Panel() { CssClass = "tab-content" }; div.Attributes.Add("data-tabs-content", "true"); div.Controls.Add(c); tabscontents.Controls.Add(div); liDopTabs.Text += string.Format( "<div class=\"tab-header\" id=\"{0}{1}\" data-tabs-header=\"true\"><span class=\"tab-inside\">{2}</span><span class=\"right\"></span></div>", mac.ModuleStringId.ToLower(), i + 1, mac.Controls[i].NameTab); } } } }
//protected string RenderPrice(float productPrice, float discount) //{ // if (productPrice == 0) // { // return string.Format("<div class=\'price\'>{0}</div>", Resource.Client_Catalog_ContactWithUs); // } // string res; // float price = CatalogService.CalculateProductPrice(productPrice, 0, customerGroup, null); // float priceWithDiscount = CatalogService.CalculateProductPrice(productPrice, discount, customerGroup, null); // if (price.Equals(priceWithDiscount)) // { // res = string.Format("<div class=\'price\'>{0}</div>", CatalogService.GetStringPrice(price)); // } // else // { // res = string.Format("<div class=\"price-old\">{0}</div><div class=\"price\">{1}</div><div class=\"price-benefit\">{2} {3} {4} {5}% </div>", // CatalogService.GetStringPrice(productPrice), // CatalogService.GetStringPrice(priceWithDiscount), // Resource.Client_Catalog_Discount_Benefit, // CatalogService.GetStringPrice(price - priceWithDiscount), // Resource.Client_Catalog_Discount_Or, // CatalogService.FormatPriceInvariant(discount)); // } // return res; //} private void LoadModules() { var discountModule = AttachedModules.GetModules <IDiscount>().FirstOrDefault(); if (discountModule != null) { var classInstance = (IDiscount)Activator.CreateInstance(discountModule); _productDiscountModels = classInstance.GetProductDiscountsList(); } _customLabels = new List <ProductLabel>(); foreach (var labelModule in AttachedModules.GetModules <ILabel>()) { var classInstance = (ILabel)Activator.CreateInstance(labelModule); var labelCode = classInstance.GetLabel(); if (labelCode != null) { _customLabels.Add(labelCode); } } var bonusSystem = AttachedModules.GetModules <IBonusSystem>().FirstOrDefault(); if (bonusSystem != null) { if (CustomerContext.CurrentCustomer.BonusCardNumber != null) { _bonusCard = BonusSystemService.GetCard(CustomerContext.CurrentCustomer.BonusCardNumber); } else if (BonusSystem.BonusFirstPercent != 0) { _bonusCard = new BonusCard() { BonusPercent = BonusSystem.BonusFirstPercent }; } } }
protected void Page_PreRender(object sender, EventArgs e) { var brand = popUpBrand.SelectBrandId != 0 ? BrandService.GetBrandById(popUpBrand.SelectBrandId) : null; lBrand.Text = brand != null ? brand.Name : Resource.Admin_Product_NotSelected; ibRemoveBrand.Visible = popUpBrand.SelectBrandId != 0; if (!AddingNewProduct) { aToClient.HRef = "../" + UrlService.GetLinkDB(ParamType.Product, ProductId); aToClient.Visible = true; } else { aToClient.Visible = false; } if (ProductId != 0) { var listDetailsTabs = new List <ITab>(); foreach (var detailsTabsModule in AttachedModules.GetModules <IProductTabs>()) { var classInstance = (IProductTabs)Activator.CreateInstance(detailsTabsModule, null); if (ModulesRepository.IsActiveModule(classInstance.ModuleStringId) && classInstance.CheckAlive()) { listDetailsTabs.AddRange(classInstance.GetProductTabsCollection(ProductId)); } } lvTabBodies.DataSource = listDetailsTabs; lvTabTitles.DataSource = listDetailsTabs; lvTabBodies.DataBind(); lvTabTitles.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { //if (string.IsNullOrEmpty(Request["ModuleId"])) //{ // Response.Redirect(""); //} var module = AttachedModules.GetModules <IClientPageModule>().FirstOrDefault( item => ((IClientPageModule)Activator.CreateInstance(item, null)).ModuleStringId == Request["ModuleId"]); if (module != null) { var moduleObject = (IClientPageModule)Activator.CreateInstance(module, null); var userControl = (this).LoadControl( UrlService.GetAbsoluteLink(string.Format("/Modules/{0}/{1}", moduleObject.ModuleStringId, moduleObject.ClientPageControlFileName))); if (userControl != null) { pnlContent.Controls.Add(userControl); } SetMeta(new MetaInfo { Title = moduleObject.PageTitle, MetaDescription = moduleObject.MetaDescription, MetaKeywords = moduleObject.MetaKeyWords }, ""); } else { Response.Redirect(UrlService.GetAdminAbsoluteLink("")); } }
public override void GetExportFeedString(string filenameAndPath) { var tempfile = filenameAndPath + "_temp"; try { _currency = ExportFeed.GetModuleSetting(ModuleName, "Currency"); _description = ExportFeed.GetModuleSetting(ModuleName, "DescriptionSelection"); _salesNotes = ExportFeed.GetModuleSetting(ModuleName, "SalesNotes"); _delivery = ExportFeed.GetModuleSetting(ModuleName, "Delivery").TryParseBool(); _localDeliveryCost = ExportFeed.GetModuleSetting(ModuleName, "LocalDeliveryCost").TryParseBool(); _properties = ExportFeed.GetModuleSetting(ModuleName, "Properties").TryParseBool(); _removeHTML = ExportFeed.GetModuleSetting(ModuleName, "RemoveHTML").TryParseBool(); var discountModule = AttachedModules.GetModules <IDiscount>().FirstOrDefault(); if (discountModule != null) { var classInstance = (IDiscount)Activator.CreateInstance(discountModule); _productDiscountModels = classInstance.GetProductDiscountsList(); } var shopName = ExportFeed.GetModuleSetting(ModuleName, "ShopName").Replace("#STORE_NAME#", SettingsMain.ShopName); var companyName = ExportFeed.GetModuleSetting(ModuleName, "CompanyName").Replace("#STORE_NAME#", SettingsMain.ShopName); FileHelpers.DeleteFile(tempfile); using (var outputFile = new FileStream(tempfile, FileMode.OpenOrCreate, FileAccess.Write, FileShare.ReadWrite)) { var settings = new XmlWriterSettings { Encoding = Encoding.UTF8, Indent = true }; using (var writer = XmlWriter.Create(outputFile, settings)) { writer.WriteStartDocument(); writer.WriteDocType("yml_catalog", null, "shops.dtd", null); writer.WriteStartElement("yml_catalog"); writer.WriteAttributeString("date", DateTime.Now.ToString("yyyy-MM-dd HH:mm")); writer.WriteStartElement("shop"); writer.WriteStartElement("name"); writer.WriteRaw(shopName); writer.WriteEndElement(); writer.WriteStartElement("company"); writer.WriteRaw(companyName); writer.WriteEndElement(); writer.WriteStartElement("url"); writer.WriteRaw(ShopUrl); writer.WriteEndElement(); writer.WriteStartElement("currencies"); var currencies = GetCurrencies().Where(item => AvailableCurrencies.Contains(item.Iso3)).ToList(); ProcessCurrency(currencies, _currency, writer); writer.WriteEndElement(); CommonStatistic.TotalRow = GetCategoriesCount(ModuleName) + GetProdutsCount(ModuleName); writer.WriteStartElement("categories"); foreach (var categoryRow in GetCategories(ModuleName)) { ProcessCategoryRow(categoryRow, writer); CommonStatistic.RowPosition++; } writer.WriteEndElement(); writer.WriteStartElement("offers"); foreach (var offerRow in GetProduts(ModuleName)) { ProcessProductRow(offerRow, writer); CommonStatistic.RowPosition++; } writer.WriteEndElement(); writer.WriteEndElement(); writer.WriteEndElement(); writer.WriteEndDocument(); writer.Flush(); writer.Close(); } } FileHelpers.DeleteFile(filenameAndPath); File.Move(tempfile, filenameAndPath); } catch (Exception ex) { Debug.LogError(ex); } }
public void ManagedTask(TaskSettings settings) { foreach (var setting in settings) { _sched.DeleteJob(new JobKey(setting.JobType, TaskGroup)); if (setting.Enabled) { if (string.IsNullOrEmpty(setting.JobType)) { continue; } var taskType = Type.GetType(setting.JobType); if (taskType == null) { continue; } if (_sched.CheckExists(new JobKey(setting.JobType, TaskGroup))) { continue; } var jobDetail = new JobDetailImpl(setting.JobType, TaskGroup, taskType); jobDetail.JobDataMap[DataMap] = setting; var cronExpression = GetCronString(setting); if (string.IsNullOrEmpty(cronExpression)) { continue; } var trigger = new CronTriggerImpl(setting.JobType, TaskGroup, setting.JobType, TaskGroup, cronExpression); _sched.ScheduleJob(jobDetail, trigger); } } var moduleTasks = AttachedModules.GetModules <IModuleTask>(); foreach (var moduleTask in moduleTasks) { var classInstance = (IModuleTask)Activator.CreateInstance(moduleTask, null); var tasksSettings = classInstance.GetTasks(); foreach (var setting in tasksSettings) { _sched.DeleteJob(new JobKey(setting.JobType, ModuleGroup)); if (setting.Enabled) { var type = Type.GetType(setting.JobType); if (type == null) { continue; } var cronExpression = GetCronString(setting); if (string.IsNullOrEmpty(cronExpression)) { continue; } var jobDetail = new JobDetailImpl(setting.JobType, ModuleGroup, type); jobDetail.JobDataMap[DataMap] = setting; var trigger = new CronTriggerImpl(setting.JobType, ModuleGroup, setting.JobType, ModuleGroup, cronExpression); _sched.ScheduleJob(jobDetail, trigger); } } } }
private static void OnBeginRequest(object sender, EventArgs e) { var app = (HttpApplication)sender; string strCurrentUrl = app.Request.RawUrl.ToLower().Trim(); app.StaticFile304(); // Debug go first if (UrlService.IsDebugUrl(strCurrentUrl)) { // Nothing here // just return return; } // Check cn if (AppServiceStartAction.state != DataBaseService.PingDbState.NoError) { // Nothing here // just return return; } // Check original pictures if (strCurrentUrl.Contains("/pictures/product/original/")) { app.Context.RewritePath("~/err404.aspx"); return; } // Check price_temp folder if (strCurrentUrl.Contains("/price_temp/")) { var actions = RoleActionService.GetCustomerRoleActionsByCustomerId(CustomerContext.CurrentCustomer.Id); if (!(CustomerContext.CurrentCustomer.IsAdmin || TrialService.IsTrialEnabled || CustomerContext.CurrentCustomer.IsVirtual || (CustomerContext.CurrentCustomer.IsModerator && actions.Any(item => item.Key == RoleActionKey.DisplayOrders || item.Key == RoleActionKey.DisplayImportExport))) ) { app.Context.RewritePath("~/err404.aspx"); return; } } // Social string social = UrlService.Social.Find(strCurrentUrl.Contains); if (social != null) { app.Response.RedirectPermanent("~/social/catalogsocial.aspx?type=" + social.Split('-').Last()); } // Check exportfeed //if (strCurrentUrl.Contains("exportfeed.aspx") || strCurrentUrl.Contains("exportfeeddet.aspx")) // return; // Payment return url if (strCurrentUrl.Contains("/paymentreturnurl/")) { app.Context.RewritePath("~/PaymentReturnUrl.aspx?PaymentMethodID=" + app.Request.Path.Split(new[] { "/paymentreturnurl/" }, StringSplitOptions.None).LastOrDefault() + (string.IsNullOrWhiteSpace(app.Request.Url.Query) ? string.Empty : "&" + app.Request.Url.Query.Trim('?'))); return; } if (strCurrentUrl.Contains("/paymentnotification/")) { app.Context.RewritePath("~/HttpHandlers/PaymentNotification.ashx?PaymentMethodID=" + app.Request.Path.Split(new[] { "/paymentnotification/" }, StringSplitOptions.None).LastOrDefault() + (string.IsNullOrWhiteSpace(app.Request.Url.Query) ? string.Empty : "&" + app.Request.Url.Query.Trim('?'))); return; } // Seek in url table foreach (var key in UrlService.UrlTable.Keys.Where(strCurrentUrl.Split('?')[0].EndsWith)) { app.Context.RewritePath(UrlService.UrlTable[key] + (string.IsNullOrWhiteSpace(app.Request.Url.Query) ? string.Empty : (UrlService.UrlTable[key].Contains("?") ? "&" : "?") + app.Request.Url.Query.Trim('?'))); return; } //// Storage //string storage = UrlService.Storages.Find(strCurrentUrl.Contains); //if (storage != null) //{ // var index = strCurrentUrl.IndexOf(storage, StringComparison.Ordinal); // string tail = app.Request.RawUrl.Substring(index + storage.Length); // string pathNew = string.Format("~{0}{1}", storage, tail); // app.Context.RewritePath(pathNew); // return; //} string path = strCurrentUrl; if (app.Request.ApplicationPath != "/") { if (app.Request.ApplicationPath != null) { path = path.Replace(app.Request.ApplicationPath.ToLower(), ""); } } // sometimes Path.GetExtension thows exeption "Illegal characters in path" try { string extention = Path.GetExtension(path.Split('?')[0]); if (UrlService.ExtentionNotToRedirect.Contains(extention)) { return; } } catch (Exception ex) { Debug.LogError(ex, false); } //301 redirect if need if (SettingsSEO.Enabled301Redirects && !path.Contains("/admin/")) { string newUrl = UrlService.GetRedirect301(path.TrimStart('/').Trim('?'), app.Request.Url.AbsoluteUri); if (newUrl.IsNotEmpty()) { app.Response.RedirectPermanent(newUrl); return; } } var modules = AttachedModules.GetModules <IModuleUrlRewrite>(); foreach (var moduleType in modules) { var moduleObject = (IModuleUrlRewrite)Activator.CreateInstance(moduleType, null); string newUrl = path; if (moduleObject.RewritePath(path, ref newUrl)) { app.Context.RewritePath(newUrl); return; } } var param = UrlService.ParseRequest(path); if (param != null) { UrlService.RedirectTo(app, param); } else if (path.IsNotEmpty() && path != "/" && !path.Contains(".") && !path.Contains("?")) { Debug.LogError(new HttpException(404, "Can't get url: " + app.Context.Request.RawUrl + "path: '" + path + "'")); app.Context.RewritePath("~/err404.aspx"); } }
public static void LoadModules() { AttachedModules.LoadModules(); }
protected void Page_Load(object sender, EventArgs e) { lDemoWarning.Visible = Demo.IsDemoEnabled || TrialService.IsTrialEnabled; //BuyInOneClick.Visible = SettingsOrderConfirmation.BuyInOneClick; if (!IsPostBack) { if (Request["products"].IsNotEmpty()) { foreach (var item in Request["products"].Split(";")) { int offerId; var newItem = new ShoppingCartItem() { ShoppingCartType = ShoppingCartType.ShoppingCart, CustomerId = CustomerContext.CustomerId }; var parts = item.Split("-"); if (parts.Length > 0 && (offerId = parts[0].TryParseInt(0)) != 0 && OfferService.GetOffer(offerId) != null) { newItem.OfferId = offerId; } else { continue; } if (parts.Length > 1) { newItem.Amount = parts[1].TryParseFloat(); } else { newItem.Amount = 1; } var currentItem = ShoppingCartService.CurrentShoppingCart.FirstOrDefault(shpCartitem => shpCartitem.OfferId == newItem.OfferId); if (currentItem != null) { currentItem.Amount = newItem.Amount; ShoppingCartService.UpdateShoppingCartItem(currentItem); } else { ShoppingCartService.AddShoppingCartItem(newItem); } } Response.Redirect("shoppingcart.aspx"); return; } UpdateBasket(); SetMeta(new MetaInfo(string.Format("{0} - {1}", SettingsMain.ShopName, Resource.Client_ShoppingCart_ShoppingCart)), string.Empty); if (GoogleTagManager.Enabled) { var tagManager = ((AdvantShopMasterPage)Master).TagManager; tagManager.PageType = GoogleTagManager.ePageType.cart; tagManager.ProdIds = ShoppingCartService.CurrentShoppingCart.Select(item => item.Offer.ArtNo).ToList(); tagManager.TotalValue = ShoppingCartService.CurrentShoppingCart.TotalPrice; } } var showConfirmButtons = true; //подключение модуля foreach (var module in AttachedModules.GetModules <IRenderIntoShoppingCart>()) { var moduleObject = (IRenderIntoShoppingCart)Activator.CreateInstance(module, null); ltrlBottomContent.Text = moduleObject.DoRenderToBottom(); ltrlTopContent.Text = moduleObject.DoRenderToTop(); if (!string.IsNullOrEmpty(moduleObject.ClientSideControlNameBottom)) { var userControl = (this).LoadControl(moduleObject.ClientSideControlNameBottom); if (userControl != null) { ((IUserControlInSc)userControl).ProductIds = ShoppingCartService.CurrentShoppingCart.Select(p => p.Offer.ProductId).ToList(); pnlBottomContent.Controls.Add(userControl); } } if (!string.IsNullOrEmpty(moduleObject.ClientSideControlNameTop)) { var userControl = (this).LoadControl(moduleObject.ClientSideControlNameTop); if (userControl != null) { ((IUserControlInSc)userControl).ProductIds = ShoppingCartService.CurrentShoppingCart.Select(p => p.Offer.ProductId).ToList(); pnlTopContent.Controls.Add(userControl); } } showConfirmButtons &= moduleObject.ShowConfirmButtons; } BuyInOneClick.Visible = showConfirmButtons && SettingsOrderConfirmation.BuyInOneClick; aCheckOut.Visible = showConfirmButtons; }
protected void Page_Load(object sender, EventArgs e) { SetMeta(string.Format("{0} - {1}", SettingsMain.ShopName, Resource.Admin_NewsAdmin_Header)); if (!IsPostBack) { _paging = new SqlPaging { TableName = "[Settings].[News]", ItemsPerPage = 20 }; _paging.AddFieldsRange(new List <Field> { new Field { Name = "NewsID as ID", IsDistinct = true }, new Field { Name = "Title" }, new Field { Name = "ShowOnMainPage" }, new Field { Name = "NewsCategoryID" }, new Field { Name = "AddingDate", Sorting = SortDirection.Descending } }); grid.ChangeHeaderImageUrl("arrowAddingDate", "images/arrowdown.gif"); pageNumberer.CurrentPageIndex = 1; _paging.CurrentPageIndex = 1; ViewState["Paging"] = _paging; } else { _paging = (SqlPaging)(ViewState["Paging"]); _paging.ItemsPerPage = SQLDataHelper.GetInt(ddRowsPerPage.SelectedValue); if (_paging == null) { throw (new Exception("Paging lost")); } string strIds = Request.Form["SelectedIds"]; if (!string.IsNullOrEmpty(strIds)) { strIds = strIds.Trim(); string[] arrids = strIds.Split(' '); _selectionFilter = new InSetFieldFilter(); if (arrids.Contains("-1")) { _selectionFilter.IncludeValues = false; _inverseSelection = true; } else { _selectionFilter.IncludeValues = true; } _selectionFilter.Values = arrids.Where(id => id != "-1").ToArray(); } } var modules = AttachedModules.GetModules <ISendMails>(); foreach (var moduleType in modules) { var moduleObject = (ISendMails)Activator.CreateInstance(moduleType, null); if (ModulesRepository.IsActiveModule(moduleObject.ModuleStringId)) { CanSendNews = true; } } }
protected override void Render(HtmlTextWriter writer) { var modules = Core.AdvantshopConfigService.GetActivityModules(); writer.AddAttribute(HtmlTextWriterAttribute.Id, "myslidemenu"); writer.AddAttribute(HtmlTextWriterAttribute.Class, "jqueryslidemenu"); writer.RenderBeginTag(HtmlTextWriterTag.Div); writer.RenderBeginTag(HtmlTextWriterTag.Ul); int i = 1; foreach (MenuItem parent in this.Items) { try //Added by Evgeni to catch module exception { if (parent.Value == @"modules") { var addingModules = new MenuItem { Text = Resources.Resource.Admin_ModuleManager_Header, NavigateUrl = "modulesmanager.aspx" }; parent.ChildItems.Add(addingModules); var mdls = (from m in AttachedModules.GetModules(AttachedModules.EModuleType.All) orderby((IModule)Activator.CreateInstance(m, null)).ModuleName select m); foreach (var type in mdls) { var addingModule = ((IModule)Activator.CreateInstance(type, null)); if (addingModule.CheckAlive()) { addingModules.ChildItems.Add(new MenuItem { Text = addingModule.ModuleName, NavigateUrl = "module.aspx?module=" + addingModule.ModuleStringId }); } } } } catch { } bool visible = RoleAccess.Check(CurrentCustomer, parent.NavigateUrl.ToLower()) && (!modules.ContainsKey(parent.Value) || modules[parent.Value]); writer.AddAttribute(HtmlTextWriterAttribute.Class, "m-main-item MenuHorizontalItem" + i + (!visible ? " m-hide" : "m-item")); //writer.AddAttribute(HtmlTextWriterAttribute.Onclick, "location='" + RouteService.GetAdminAbsoluteLink(parent.NavigateUrl) + "'"); writer.RenderBeginTag(HtmlTextWriterTag.Li); writer.AddAttribute(HtmlTextWriterAttribute.Href, UrlService.GetAdminAbsoluteLink(parent.NavigateUrl)); writer.AddAttribute(HtmlTextWriterAttribute.Class, "LinkMNImg"); writer.RenderBeginTag(HtmlTextWriterTag.A); writer.AddAttribute(HtmlTextWriterAttribute.Class, "MenuHorizontalItem" + i + "Img"); writer.AddAttribute(HtmlTextWriterAttribute.Src, parent.ImageUrl); writer.RenderBeginTag(HtmlTextWriterTag.Img); writer.RenderEndTag(); // a - parent menuitem writer.RenderEndTag(); // a writer.AddAttribute(HtmlTextWriterAttribute.Class, "LinkMenuHorizontal LinkMH" + i); writer.AddAttribute(HtmlTextWriterAttribute.Href, (visible ? UrlService.GetAdminAbsoluteLink(parent.NavigateUrl) : "#")); writer.RenderBeginTag(HtmlTextWriterTag.A); writer.WriteLine(parent.Text); writer.RenderEndTag(); // a if (parent.ChildItems.Count > 0) { writer.AddAttribute(HtmlTextWriterAttribute.Class, "SubMenu" + i); writer.RenderBeginTag(HtmlTextWriterTag.Ul); foreach (MenuItem item in parent.ChildItems) { visible = RoleAccess.Check(CurrentCustomer, item.NavigateUrl.ToLower()) && (!modules.ContainsKey(item.Value) || modules[item.Value]); writer.AddAttribute(HtmlTextWriterAttribute.Class, (!visible ? "m-hide" : "m-item")); writer.RenderBeginTag(HtmlTextWriterTag.Li); writer.AddAttribute(HtmlTextWriterAttribute.Href, (visible ? UrlService.GetAdminAbsoluteLink(item.NavigateUrl) : "#")); writer.RenderBeginTag(HtmlTextWriterTag.A); writer.WriteLine(item.Text); writer.RenderEndTag(); //a if (item.ChildItems.Count > 0) { writer.RenderBeginTag(HtmlTextWriterTag.Ul); foreach (MenuItem subItem in item.ChildItems) { visible = RoleAccess.Check(CurrentCustomer, subItem.NavigateUrl.ToLower()) && (!modules.ContainsKey(subItem.Value) || modules[subItem.Value]); writer.AddAttribute(HtmlTextWriterAttribute.Class, (!visible ? "m-hide" : "m-item")); writer.RenderBeginTag(HtmlTextWriterTag.Li); writer.AddAttribute(HtmlTextWriterAttribute.Href, (visible ? UrlService.GetAdminAbsoluteLink(subItem.NavigateUrl) : "#")); writer.RenderBeginTag(HtmlTextWriterTag.A); writer.WriteLine(subItem.Text); writer.RenderEndTag(); //a writer.RenderEndTag(); //li } writer.RenderEndTag(); //ul } writer.RenderEndTag(); //li } writer.RenderEndTag(); //ul } writer.RenderEndTag(); // li i++; } writer.RenderEndTag(); //ul writer.RenderEndTag(); //div }