示例#1
0
        public string DoRenderIntoFinalStep(IOrder order)
        {
            var listid = ModuleSettingsProvider.GetSettingValue <string>("PriceListID", ModuleID);
            var offers = order.OrderItems.Select(item => OfferService.GetOffer(item.ArtNo));

            return(string.Format("<script type='text/javascript'>var _tmr = _tmr || [];_tmr.push({{type: 'itemView', productid: [{0}], pagetype: 'purchase', totalvalue: '{1}', list: '{2}' }});</script>", offers.Select(o => "'" + o.OfferId + "'").AggregateString(","), order.OrderItems.Sum(item => item.Price * item.Amount), listid));
        }
示例#2
0
        public Image DoProcessPhoto(Image photo)
        {
            string fileName = ModuleSettingsProvider.GetAbsolutePath() + "Modules/" + ModuleStringId + "/" + ModuleSettingsProvider.GetSettingValue <string>("WatermarkImage", ModuleStringId);

            if (!File.Exists(fileName))
            {
                return(photo);
            }

            using (Stream streamOpen = new FileStream(fileName, FileMode.Open))
            {
                using (Image watermarkImage = Image.FromStream(streamOpen))
                {
                    using (var graphics = Graphics.FromImage(photo))
                    {
                        graphics.DrawImage(watermarkImage,
                                           Convert.ToInt32((photo.Width * ModuleSettingsProvider.GetSettingValue <decimal>("WatermarkPositionX", ModuleStringId) / 100) -
                                                           (watermarkImage.Width * ModuleSettingsProvider.GetSettingValue <decimal>("WatermarkPositionX", ModuleStringId) / 100)),
                                           Convert.ToInt32((photo.Height * ModuleSettingsProvider.GetSettingValue <decimal>("WatermarkPositionY", ModuleStringId) / 100) -
                                                           (watermarkImage.Height * ModuleSettingsProvider.GetSettingValue <decimal>("WatermarkPositionY", ModuleStringId) / 100)),
                                           watermarkImage.Width, watermarkImage.Height);
                    }
                }
                streamOpen.Close();
            }

            return(photo);
        }
示例#3
0
        public static bool UninstallCallbackModule()
        {
            bool isInstall;

            ModuleSettingsProvider.RemoveSqlSetting("email4notify", _moduleName);
            ModuleSettingsProvider.RemoveSqlSetting("emailFormat", _moduleName);
            ModuleSettingsProvider.RemoveSqlSetting("emailSubject", _moduleName);
            ModuleSettingsProvider.RemoveSqlSetting("windowTitle", _moduleName);
            ModuleSettingsProvider.RemoveSqlSetting("windowText", _moduleName);

            using (var da = new SQLDataAccess())
            {
                if (!ModulesRepository.IsExistsModuleTable(da, "Module", _moduleName))
                {
                    return(true);
                }

                da.cmd.CommandText = "DROP TABLE Module." + _moduleName;
                da.cmd.CommandType = CommandType.Text;

                da.cnOpen();
                da.cmd.ExecuteNonQuery();
                da.cnClose();

                isInstall = ModulesRepository.IsExistsModuleTable(da, "Module", _moduleName);
            }
            return(isInstall);
        }
示例#4
0
        public static bool InstallStoreReviewsModule()
        {
            if (!ModulesRepository.IsExistsModuleTable("Module", "StoreReview"))
            {
                ModulesRepository.ModuleExecuteNonQuery(
                    @"CREATE TABLE Module.StoreReview
                    (  ID int NOT NULL IDENTITY (1, 1),
	                        ParentID int NULL,
	                        ReviewerEmail nvarchar(50) NOT NULL,
                            ReviewerName nvarchar(100) NOT NULL,
	                        Review nvarchar(MAX) NOT NULL,
	                        DateAdded datetime NOT NULL,
                            Moderated bit NOT NULL,
	                        Rate int NULL
	                        )  ON [PRIMARY]
	                            TEXTIMAGE_ON [PRIMARY]                                        
                        ALTER TABLE Module.StoreReview ADD CONSTRAINT
	                        PK_StoreReview PRIMARY KEY CLUSTERED 
	                        (
	                        ID
	                        ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]                                        
                        ALTER TABLE Module.StoreReview SET (LOCK_ESCALATION = TABLE)
                        SET IDENTITY_INSERT Module.StoreReview ON",
                    CommandType.Text);
            }
            ModuleSettingsProvider.SetSettingValue("PageSize", "20", "StoreReviews");
            return(ModulesRepository.IsExistsModuleTable("Module", "StoreReview"));
        }
示例#5
0
        public static void AddStoreReview(StoreReview storeReview)
        {
            ModulesRepository.ModuleExecuteNonQuery(
                "INSERT INTO [Module].[StoreReview] ([ParentID],[Rate],[Review],[ReviewerEmail],[ReviewerName],[DateAdded],[Moderated]) VALUES (@ParentID,@Rate,@Review,@ReviewerEmail,@ReviewerName,GETDATE(),@Moderated)",
                CommandType.Text,
                new SqlParameter("@ParentID", storeReview.ParentId == 0 ? DBNull.Value : (object)storeReview.ParentId),
                new SqlParameter("@Rate", storeReview.Rate),
                new SqlParameter("@Review", storeReview.Review),
                new SqlParameter("@ReviewerEmail", storeReview.ReviewerEmail),
                new SqlParameter("@ReviewerName", storeReview.ReviewerName),
                new SqlParameter("@Moderated", storeReview.Moderated));

            if (ModuleSettingsProvider.GetSettingValue <bool>("EnableSendMails", "StoreReviews"))
            {
                var message = ModuleSettingsProvider.GetSettingValue <string>("Format", "StoreReviews");
                message = message.Replace("#NAME#", storeReview.ReviewerName);
                message = message.Replace("#EMAIL#", storeReview.ReviewerEmail);
                message = message.Replace("#REVIEW#", storeReview.Review);

                ModulesService.SendModuleMail(
                    ModuleSettingsProvider.GetSettingValue <string>("Subject", "StoreReviews"),
                    message,
                    ModuleSettingsProvider.GetSettingValue <string>("Email", "StoreReviews"),
                    true);
            }
        }
示例#6
0
 public bool InstallModule()
 {
     ModuleSettingsProvider.SetSettingValue("UniSenderId", string.Empty, ModuleID);
     ModuleSettingsProvider.SetSettingValue("UniSenderFromName", string.Empty, ModuleID);
     ModuleSettingsProvider.SetSettingValue("UniSenderFromEmail", string.Empty, ModuleID);
     ModuleSettingsProvider.SetSettingValue("UniSenderRegUsersList", string.Empty, ModuleID);
     return(true);
 }
示例#7
0
文件: QrCode.cs 项目: gkovalev/nastia
 public string RenderToRightColumn()
 {
     if (!ModuleSettingsProvider.GetSettingValue <bool>("EnableQrcode", ModuleStringId))
     {
         return(string.Empty);
     }
     return("<img src =\"Modules/AdvQrCode/GetQrCodeByUrl.ashx\"/ alt=\"qrcode\">");
 }
示例#8
0
 public bool UninstallModule()
 {
     ModuleSettingsProvider.RemoveSqlSetting("UniSenderId", ModuleID);
     ModuleSettingsProvider.RemoveSqlSetting("UniSenderFromName", ModuleID);
     ModuleSettingsProvider.RemoveSqlSetting("UniSenderFromEmail", ModuleID);
     ModuleSettingsProvider.RemoveSqlSetting("UniSenderRegUsersList", ModuleID);
     ModuleSettingsProvider.RemoveSqlSetting("UniSenderOrderCustomersList", ModuleID);
     return(true);
 }
        public static bool UninstallBuyInTimeModule()
        {
            ModuleSettingsProvider.RemoveSqlSetting("BuyInTimeActionTitle", ModuleName);
            ModuleSettingsProvider.RemoveSqlSetting("BuyInTimeLabel", ModuleName);
            ModuleSettingsProvider.RemoveSqlSetting("BuyInTimeDefaultActionTextMode1", ModuleName);
            ModuleSettingsProvider.RemoveSqlSetting("BuyInTimeDefaultActionTextMode2", ModuleName);

            return(true);
        }
示例#10
0
        public bool UninstallModule()
        {
            ModuleSettingsProvider.RemoveSqlSetting("MailChimpId", ModuleID);
            ModuleSettingsProvider.RemoveSqlSetting("MailChimpFromName", ModuleID);
            ModuleSettingsProvider.RemoveSqlSetting("MailChimpFromEmail", ModuleID);
            ModuleSettingsProvider.RemoveSqlSetting("MailChimpRegUsersList", ModuleID);
            ModuleSettingsProvider.RemoveSqlSetting("MailChimpOrderCustomer", ModuleID);

            return(true);
        }
示例#11
0
        public string DoRenderAfterBodyStart()
        {
            var counter = ModuleSettingsProvider.GetSettingValue <string>("COUNTER", ModuleID);

            if (string.IsNullOrEmpty(counter))
            {
                return(string.Empty);
            }

            return("<div style='display:none !important;'>" + counter + "</div>");
        }
示例#12
0
 public string DoRenderBeforeBodyEnd()
 {
     return
         (String.Format("<link rel='stylesheet' href='{0}' /><script src='{1}' data-callback-options data-callback-title='{2}' data-callback-text='{3}'></script>" +
                        "<script src='{4}'></script>",
                        "Modules/Callback/callback.css",
                        "Modules/Callback/callback.js",
                        ModuleSettingsProvider.GetSettingValue <string>("windowTitle", ModuleStringId),
                        ModuleSettingsProvider.GetSettingValue <string>("windowText", ModuleStringId),
                        "Modules/Callback/localization/" + CultureInfo.CurrentCulture.ToString() + "/lang.js"
                        ));
 }
示例#13
0
        public static void SendEmail(CallbackCustomer callbackCustomer)
        {
            string email   = ModuleSettingsProvider.GetSettingValue <string>("email4notify", _moduleName);
            string subject = ModuleSettingsProvider.GetSettingValue <string>("emailSubject", _moduleName);
            string format  = ModuleSettingsProvider.GetSettingValue <string>("emailFormat", _moduleName);

            format =
                format.Replace("#NAME#", callbackCustomer.Name)
                .Replace("#PHONE#", callbackCustomer.Phone)
                .Replace("#COMMENT#", callbackCustomer.Comment);

            Mails.SendMail.SendMailNow(email, subject, format, true);
        }
示例#14
0
        public string DoRenderAfterBodyStart()
        {
            var counterId = ModuleSettingsProvider.GetSettingValue <string>("COUNTER_ID", ModuleID);
            var counter   = ModuleSettingsProvider.GetSettingValue <string>("COUNTER", ModuleID);

            if (string.IsNullOrEmpty(counterId) || string.IsNullOrEmpty(counter))
            {
                return(string.Empty);
            }

            return("<div style='display:none !important;'>" + counter + "</div>" + string.Format("<script type=\"text/javascript\" src=\"{0}\"></script> " +
                                                                                                 "<div class=\"yacounterid\" data-counterId=\"{1}\"></div>",
                                                                                                 "modules/yametrika/js/tracking.js",
                                                                                                 counterId));
        }
示例#15
0
        public string RenderToProductInformation(int productId)
        {
            var discountModel = BuyInTimeService.GetByProduct(productId, DateTime.Now);

            if (discountModel == null)
            {
                return(string.Empty);
            }

            var actionTitle = ModuleSettingsProvider.GetSettingValue <string>("BuyInTimeActionTitle", ModuleStringId);
            var countdown   = discountModel.DateExpired != null
                                ? string.Format(BuyInTimeService.CountdownScript, ((DateTime)discountModel.DateExpired).ToString("dd.MM.yyyy HH:mm:ss"))
                                : string.Empty;

            return(string.Format("<div class=\"buy-in-time-product\"><div class=\"buy-in-time-action-b\">{0}</div> {1}</div>", actionTitle, countdown));
        }
示例#16
0
        public string DoRenderBeforeBodyEnd()
        {
            string res;

            var listid = ModuleSettingsProvider.GetSettingValue <string>("PriceListID", ModuleID);

            string url = HttpContext.Current.Request.Url.ToString().ToLower();

            if (url.Contains("default.aspx"))
            {
                res = string.Format("<script type='text/javascript'>var _tmr = _tmr || [];_tmr.push({{type: 'itemView', productid: '', pagetype: 'home',totalvalue: '', list: '{0}' }});</script>", listid);
            }
            else if (url.Contains("catalog.aspx"))
            {
                res =
                    string.Format("<script type='text/javascript'>var _tmr = _tmr || [];_tmr.push({{type: 'itemView', productid: '', pagetype: 'category', totalvalue:'', list: '{0}' }});</script>", listid);
            }
            else if (url.Contains("details.aspx"))
            {
                Offer mainOffer;
                var   product = ProductService.GetProduct(HttpContext.Current.Request["ProductID"].TryParseInt());
                if (product != null &&
                    (mainOffer = OfferService.GetMainOffer(product.Offers, product.AllowPreOrder,
                                                           HttpContext.Current.Request["color"].TryParseInt(true), HttpContext.Current.Request["size"].TryParseInt(true))) != null)
                {
                    res =
                        string.Format("<script type='text/javascript'>var _tmr = _tmr || [];_tmr.push({{type: 'itemView',productid: '{0}',pagetype: 'product', totalvalue:'{1}',list: '{2}' }});</script>", mainOffer.OfferId, mainOffer.Price.ToString("F2").Replace(",", "."), listid);
                }
                else
                {
                    res = string.Empty;
                }
            }
            else if (url.Contains("shoppingcart.aspx"))
            {
                var cart = ShoppingCartService.CurrentShoppingCart;

                res = string.Format("<script type='text/javascript'>var _tmr = _tmr || [];_tmr.push({{type: 'itemView',productid: [{0}], pagetype: 'cart', totalvalue:'{1}', list: '{2}' }});</script>", cart.Select(o => "'" + o.OfferId + "'").AggregateString(","), cart.TotalPrice.ToString("F2").Replace(",", "."), listid);
            }
            else
            {
                res = string.Format("<script type='text/javascript'>var _tmr = _tmr || [];_tmr.push({{type: 'itemView', productid: '', pagetype: 'other', totalvalue: '', list: '{0}' }});</script>", listid);
            }

            return(res);
        }
示例#17
0
        public static bool InstallCallbackModule()
        {
            bool isInstall;

            using (var da = new SQLDataAccess())
            {
                if (ModulesRepository.IsExistsModuleTable(da, "Module", _moduleName))
                {
                    return(true);
                }

                da.cmd.CommandText = "CREATE TABLE Module." + _moduleName +
                                     @"(
	                                        ID int NOT NULL IDENTITY (1, 1),
                                            Name nvarchar(100) NOT NULL,
	                                        Phone nvarchar(50) NOT NULL,
                                            DateAdded nvarchar(50) not null,
	                                        Comment nvarchar(MAX) NOT NULL,
	                                        AdminComment nvarchar(MAX) NOT NULL,
                                            Processed bit NOT NULL,
	                                        )  ON [PRIMARY]
	                                         TEXTIMAGE_ON [PRIMARY]                                        
                                           ALTER TABLE Module." + _moduleName + @" ADD CONSTRAINT
	                                        PK_Callback PRIMARY KEY CLUSTERED 
	                                        (
	                                        ID
	                                        ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]                                        
                                        ALTER TABLE Module." + _moduleName + @" SET (LOCK_ESCALATION = TABLE)
                                        SET IDENTITY_INSERT Module." + _moduleName + " ON";
                da.cmd.CommandType = CommandType.Text;

                da.cnOpen();
                da.cmd.ExecuteNonQuery();
                da.cnClose();

                ModuleSettingsProvider.SetSettingValue("email4notify", "", _moduleName);
                ModuleSettingsProvider.SetSettingValue("emailFormat", "<h4>Поступил новый заказ обратного звонка</h4><br/> Имя: #NAME# <br/> Телефон: #PHONE# <br/> Комментарий: #COMMENT#", _moduleName);
                ModuleSettingsProvider.SetSettingValue("emailSubject", "Заказ обратного звонка", _moduleName);
                ModuleSettingsProvider.SetSettingValue("windowTitle", "Обратный звонок", _moduleName);
                ModuleSettingsProvider.SetSettingValue("windowText", "Укажите свое имя и номер телефона, и мы Вам обязательно перезвоним.", _moduleName);

                isInstall = ModulesRepository.IsExistsModuleTable(da, "Module", _moduleName);
            }
            return(isInstall);
        }
示例#18
0
        public static bool InstallStoreReviewsModule()
        {
            bool isInstall;

            using (var da = new SQLDataAccess())
            {
                if (ModulesRepository.IsExistsModuleTable(da, "Module", "StoreReview"))
                {
                    return(true);
                }

                da.cmd.CommandText = @"CREATE TABLE Module.StoreReview
	                                        (
	                                        ID int NOT NULL IDENTITY (1, 1),
	                                        ParentID int NULL,
	                                        ReviewerEmail nvarchar(50) NOT NULL,
                                            ReviewerName nvarchar(100) NOT NULL,
	                                        Review nvarchar(MAX) NOT NULL,
	                                        DateAdded datetime NOT NULL,
                                            Moderated bit NOT NULL,
	                                        Rate int NULL
	                                        )  ON [PRIMARY]
	                                         TEXTIMAGE_ON [PRIMARY]                                        
                                        ALTER TABLE Module.StoreReview ADD CONSTRAINT
	                                        PK_StoreReview PRIMARY KEY CLUSTERED 
	                                        (
	                                        ID
	                                        ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]                                        
                                        ALTER TABLE Module.StoreReview SET (LOCK_ESCALATION = TABLE)
                                        SET IDENTITY_INSERT Module.StoreReview ON
                                        ";
                da.cmd.CommandType = CommandType.Text;

                da.cnOpen();
                da.cmd.ExecuteNonQuery();
                da.cnClose();

                ModuleSettingsProvider.SetSettingValue("PageSize", "20", "StoreReviews");
                isInstall = ModulesRepository.IsExistsModuleTable(da, "Module", "StoreReview");
            }
            return(isInstall);
        }
示例#19
0
        public ProductLabel GetLabel()
        {
            var labelCode = ModuleSettingsProvider.GetSettingValue <string>("BuyInTimeLabel", ModuleStringId);

            if (labelCode.IsNullOrEmpty())
            {
                return(null);
            }

            var productDiscounts = BuyInTimeService.GetProductDiscountsList(DateTime.Now);

            if (productDiscounts == null || productDiscounts.Count == 0)
            {
                return(null);
            }

            return(new ProductLabel()
            {
                LabelCode = labelCode,
                ProductIds = productDiscounts.Select(p => p.ProductId).ToList()
            });
        }
示例#20
0
        public string DoRenderIntoFinalStep(IOrder order)
        {
            var counterId = ModuleSettingsProvider.GetSettingValue <string>("COUNTER_ID", ModuleID);

            if (string.IsNullOrEmpty(counterId))
            {
                return(string.Empty);
            }

            return(string.Format(
                       "<script type=\"text/javascript\">\r\n" +
                       "$(setTimeout(function () {{\r\n" +
                       "var yaParams = {{ order_id:\"{0}\", order_price: {1}, currency: \"{2}\", exchange_rate: 1, goods: [{3}]}};\r\n" +
                       "yaCounter{4}.reachGoal('Order', yaParams);\r\n" +
                       "}},3000));\r\n" +
                       "</script>\r\n",
                       order.OrderID,
                       order.Sum.ToString().Replace(",", "."),
                       order.OrderCurrency.CurrencyCode,
                       string.Join(", ",
                                   order.OrderItems.Select(orderItem => string.Format("{{ id: '{0}', name: '{1}', price: {2}, quantity: {3} }}",
                                                                                      HttpUtility.HtmlEncode(orderItem.ArtNo), HttpUtility.HtmlEncode(orderItem.Name), orderItem.Price.ToString().Replace(",", "."), orderItem.Amount.ToString().Replace(",", ".")))),
                       counterId));
        }
示例#21
0
 public bool UpdateModule()
 {
     ModuleSettingsProvider.SetSettingValue("UniSenderOrderCustomersList", string.Empty, ModuleID);
     return(true);
 }
示例#22
0
        public static bool InstallBuyInTimeModule()
        {
            ModulesRepository.ModuleExecuteNonQuery(
                @"IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'Module." + ModuleName + @"') AND type in (N'U'))
                Begin
                    CREATE TABLE Module." + ModuleName + @"
	                    (
	                    Id int NOT NULL IDENTITY (1, 1),
	                    ProductId int NOT NULL,
                        DateStart datetime NOT NULL,
	                    DateExpired datetime NOT NULL,
	                    DiscountInTime float(53) NOT NULL,
                        ActionText nvarchar(MAX) NOT NULL,
	                    ShowMode tinyint NOT NULL,
                        IsRepeat bit NOT NULL,
                        DaysRepeat int NOT NULL,
                        Picture nvarchar(50) NULL
	                    )  ON [PRIMARY]
                    
                    ALTER TABLE Module." + ModuleName + @" ADD CONSTRAINT
	                    PK_BuyInTime PRIMARY KEY CLUSTERED 
	                    (Id) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
                    
                    ALTER TABLE Module." + ModuleName + @" ADD CONSTRAINT
	                    FK_BuyInTime_Product FOREIGN KEY
	                    (ProductId) REFERENCES Catalog.Product (ProductId) ON UPDATE  NO ACTION ON DELETE  CASCADE
                End",
                CommandType.Text);

            ModuleSettingsProvider.SetSettingValue("BuyInTimeLabel", "<span class=\"buyintime-label\">Успей купить</span>", ModuleName);

            ModuleSettingsProvider.SetSettingValue("BuyInTimeActionTitle",
                                                   "<div class=\"buy-in-time-title\">Успей купить!</div> <div class=\"buy-in-time-action\">До конца распродажи:</div>",
                                                   ModuleName);

            ModuleSettingsProvider.SetSettingValue("BuyInTimeDefaultActionTextMode1",
                                                   "<div class=\"buy-in-time-main-b\"> " +
                                                   "<div style=\"border-radius: 2px; background-color: #eceaeb; padding: 24px 20px 0 0px;\">" +
                                                   "<div style=\"padding: 0 15px;display: inline-block;vertical-align: top;\">" +
                                                   "#ActionTitle# #Countdown# " +
                                                   "</div>" +
                                                   "<div style=\"display:inline-block; vertical-align:bottom; padding:0; margin:0 20px 0 0;\">" +
                                                   "<a href=\"#ProductLink#\">" +
                                                   "#ProductPicture#" +
                                                   "</a>" +
                                                   "</div>" +
                                                   "<div style=\"display:inline-block; vertical-align:top; position:relative; min-height:125px;width: 270px;\">" +
                                                   "<div style=\"margin-bottom:5px;\">" +
                                                   "<a href=\"#ProductLink#\" style=\"font-size:18px; font-weight:bold;text-decoration:none;\">#ProductName#</a>" +
                                                   "</div>" +
                                                   "<div style=\"margin-bottom:5px;\"> " +
                                                   "<span style=\"color: #d40b3e; \">Цена: #OldPrice#</span> Экономия: #DiscountPrice#" +
                                                   "</div>" +
                                                   "<div style=\"font-weight:bold; margin-bottom:5px;\"> " +
                                                   "Цена сегодня: #NewPrice#" +
                                                   "</div>" +
                                                   "<div style=\"margin-bottom:20px;\"> " +
                                                   "<a href=\"#ProductLink#\" class=\"btn btn-big btn-buy\">Купить</a>" +
                                                   "</div>" +
                                                   "<div class=\"buy-in-time-discount\"> " +
                                                   "<div style=\"font-size:24px;\">#DiscountPercent#%</div> " +
                                                   "<span style=\"font-size:12px;\">скидка</span> " +
                                                   "</div>" +
                                                   "</div>" +
                                                   "<div style=\"display: inline-block; vertical-align: top; border-left: 1px solid #cccbce; margin-left:10px;\">" +
                                                   "<ul>" +
                                                   "<li style=\"padding-bottom:10px;\">Самая низкая цена</li>" +
                                                   "<li style=\"padding-bottom:10px;\">Бесплатная доставка в день заказа</li>" +
                                                   "<li style=\"padding-bottom:10px;\">Гарантия производителя</li>" +
                                                   "<li>Бесплатное обучение</li>" +
                                                   "</ul>" +
                                                   "</div>" +
                                                   "</div>" +
                                                   "</div>",
                                                   ModuleName);

            ModuleSettingsProvider.SetSettingValue("BuyInTimeDefaultActionTextMode2",
                                                   "<div class=\"buy-in-time\"> " +
                                                   "<div class=\"center\"> " +
                                                   "#ActionTitle# #Countdown# " +
                                                   "</div> " +
                                                   "<div class=\"center\"> " +
                                                   "<div style=\"position:relative; margin:0; padding:10px; display:inline-block;\"> " +
                                                   "<a href=\"#ProductLink#\"> " +
                                                   "#ProductPicture# " +
                                                   "</a> " +
                                                   "<div class=\"buy-in-time-discount\"> " +
                                                   "<div style=\"font-size:24px;\">#DiscountPercent#%</div> " +
                                                   "<span style=\"font-size:12px;\">скидка</span> " +
                                                   "</div> " +
                                                   "</div> " +
                                                   "</div> " +
                                                   "<div style=\"margin-bottom:5px;\"> " +
                                                   "<a href=\"#ProductLink#\" style=\"font-size:14px; font-weight:bold;\">#ProductName#</a> " +
                                                   "</div> " +
                                                   "<div style=\"margin-bottom:5px;\"> " +
                                                   "<span style=\"color: #d40b3e;\">Цена: #OldPrice#</span> " +
                                                   "</div> " +
                                                   "<div style=\"font-weight:bold; margin-bottom:5px;\">Цена сегодня: #NewPrice#</div> " +
                                                   "<div style=\"font-weight:bold;\">Экономия: #DiscountPrice#</div> " +
                                                   "</div>",
                                                   ModuleName);

            return(true);
        }
示例#23
0
 public bool InstallModule()
 {
     ModuleSettingsProvider.SetSettingValue("showmode", "related", ModuleID);
     return(true);
 }
示例#24
0
 public bool UninstallModule()
 {
     ModuleSettingsProvider.RemoveSqlSetting("WatermarkPositionX", ModuleStringId);
     ModuleSettingsProvider.RemoveSqlSetting("WatermarkPositionY", ModuleStringId);
     return(true);
 }
示例#25
0
 public bool InstallModule()
 {
     ModuleSettingsProvider.SetSettingValue("WatermarkPositionX", 0m, ModuleStringId);
     ModuleSettingsProvider.SetSettingValue("WatermarkPositionY", 0m, ModuleStringId);
     return(true);
 }
示例#26
0
 public bool UninstallModule()
 {
     ModuleSettingsProvider.RemoveSqlSetting("showmode", ModuleID);
     return(true);
 }
示例#27
0
        public string GetShoppingCartPopupJson(Offer offer, float amount, bool isSocialTemplate)
        {
            var product = offer.Product;

            var shpCart = ShoppingCartService.CurrentShoppingCart;

            var totalItems    = shpCart.TotalItems;
            var totalDiscount = shpCart.TotalDiscount;
            var totalPrice    = shpCart.TotalPrice;

            var totalCounts = string.Format("{0} {1}",
                                            totalItems == 0 ? "" : totalItems.ToString(CultureInfo.InvariantCulture),
                                            Strings.Numerals(totalItems, Resource.Client_UserControls_ShoppingCart_Empty,
                                                             Resource.Client_UserControls_ShoppingCart_1Product,
                                                             Resource.Client_UserControls_ShoppingCart_2Products,
                                                             Resource.Client_UserControls_ShoppingCart_5Products));

            var customerGroup = CustomerContext.CurrentCustomer.CustomerGroup;

            var showMode = ModuleSettingsProvider.GetSettingValue <string>("showmode", ModuleID);

            var relatedProducts = new List <RelatedProductsModel>();

            if (showMode != "none")
            {
                relatedProducts =
                    ProductService.GetRelatedProducts(product.ProductId, showMode == "related" ? RelatedType.Related : RelatedType.Alternative)
                    .Select(item => new RelatedProductsModel
                {
                    ProductId = item.ProductId,
                    Name      = item.Name,
                    ArtNo     = item.ArtNo,
                    Link      = UrlService.GetLink(ParamType.Product, item.UrlPath, item.ProductId),
                    Price     = CatalogService.RenderPrice(item.MainPrice, item.Discount, true, customerGroup),
                    Photo     = item.Photo != null
                                ? String.Format("<img src='{0}' alt='{1}' class='img-cart' />",
                                                FoldersHelper.GetImageProductPath(ProductImageType.Small, item.Photo, false),
                                                item.PhotoDesc)
                                : "<img src='images/nophoto_xsmall.jpg' alt='' class='img-cart' />",
                    Buttons = GetItemButtons(item)
                }).ToList();
            }


            var obj = new
            {
                status   = "success",
                showCart = true,
                tpl      = "Modules/ShoppingCartPopup/cartpopup.tpl",

                product.Name,
                Sku        = offer.ArtNo,
                TotalItems = totalItems,
                Price      = CatalogService.RenderPrice(offer.Price, product.CalculableDiscount, true, customerGroup),
                Photo      =
                    offer.Photo != null
                        ? String.Format("<img src='{0}' alt='{1}' class='img-cart' />",
                                        FoldersHelper.GetImageProductPath(ProductImageType.Small, offer.Photo.PhotoName, false),
                                        offer.Product.Name)
                        : "<img src='images/nophoto_xsmall.jpg' alt='' class='img-cart' />",

                Link = isSocialTemplate
                            ? "social/detailssocial.aspx?productid=" + product.ProductId
                            : UrlService.GetLink(ParamType.Product, product.UrlPath, product.ProductId),

                ColorHeader = SettingsCatalog.ColorsHeader,
                ColorName   = offer.Color != null ? offer.Color.ColorName : null,
                SizeHeader  = SettingsCatalog.SizesHeader,
                SizeName    = offer.Size != null ? offer.Size.SizeName : null,

                TotalCount = totalCounts,
                TotalPrice = CatalogService.GetStringPrice(totalPrice - totalDiscount > 0 ? totalPrice - totalDiscount : 0),

                RelatedTitle = showMode == "related"
                                    ? SettingsCatalog.RelatedProductName
                                    : SettingsCatalog.AlternativeProductName,
                RelatedProducts = relatedProducts
            };

            return(JsonConvert.SerializeObject(obj));
        }
示例#28
0
        public string RenderMainPageAfterCarousel()
        {
            var cacheKey = BuyInTimeService.CacheKey + BuyInTimeService.eShowMode.Vertical;

            if (CacheManager.Contains(cacheKey))
            {
                return(CacheManager.Get <string>(cacheKey));
            }

            var action           = BuyInTimeService.GetByShowMode((int)BuyInTimeService.eShowMode.Vertical, DateTime.Now);
            var actionHorizontal = BuyInTimeService.GetByShowMode((int)BuyInTimeService.eShowMode.Horizontal, DateTime.Now);

            if (actionHorizontal != null && action != null && action.Id < actionHorizontal.Id)
            {
                CacheManager.Insert(cacheKey, "");
                return(string.Empty);
            }

            if (action != null)
            {
                if (action.IsRepeat && action.DateExpired < DateTime.Now)
                {
                    action.DateExpired = BuyInTimeService.GetExpireDateTime(action.DateExpired, action.DaysRepeat);
                }

                var actionTitle = ModuleSettingsProvider.GetSettingValue <string>("BuyInTimeActionTitle", ModuleStringId);
                var countdown   = string.Format(BuyInTimeService.CountdownScript, action.DateExpired.ToString("dd.MM.yyyy HH:mm:ss"));

                var actionText = action.ActionText.Replace("#ActionTitle#", actionTitle)
                                 .Replace("#Countdown#", countdown);

                var product = ProductService.GetProduct(action.ProductId);
                if (product == null)
                {
                    return(actionText);
                }

                var offer = product.Offers.FirstOrDefault(o => o.Main) ?? product.Offers.FirstOrDefault();
                if (offer == null)
                {
                    return(actionText);
                }

                actionText =
                    actionText.Replace("#ProductPicture#", action.Picture.IsNotEmpty()
                        ? string.Format("<img src=\"modules/{0}/pictures/{1}\" />", ModuleStringId.ToLower(), action.Picture)
                        : string.Empty)
                    .Replace("#ProductLink#",
                             UrlService.GetLink(ParamType.Product, product.UrlPath, product.ProductId))
                    .Replace("#ProductName#", product.Name)
                    .Replace("#OldPrice#", CatalogService.GetStringPrice(offer.Price).Replace("руб", "р"))
                    .Replace("#NewPrice#",
                             CatalogService.GetStringPrice(offer.Price, action.DiscountInTime).Replace("руб", "р"))
                    .Replace("#DiscountPrice#",
                             CatalogService.GetStringPrice(offer.Price * action.DiscountInTime / 100).Replace("руб", "р"))
                    .Replace("#DiscountPercent#", action.DiscountInTime.ToString("0.##"));

                CacheManager.Insert(cacheKey, actionText);

                return(actionText);
            }

            return(string.Empty);
        }