Esempio n. 1
0
        public override bool Init(Client client)
        {
            string tosend = TemplateActivator.Activate(this, client);

            client.HttpSend(tosend);
            return(true);
        }
Esempio n. 2
0
        public override bool Init(Client client)
        {
            int orderID;

            if (int.TryParse(BaseFuncs.GetAdditionalURLArray(client.URL, this.URL)[0], out orderID))
            {
                RussianKawaiShop.Order order = orderService.GetByID(orderID);
                if (order != null && order.Status > 0)
                {
                    if (client.PostParam("AddEMS") != null && client.PostParam("ems") != null)
                    {
                        this.ChangeStatus(client.PostParam("ems"), order);
                        client.Redirect("/");
                        return(false);
                    }
                    else
                    {
                        Hashtable data = new Hashtable();
                        data.Add("Order", order);
                        client.HttpSend(TemplateActivator.Activate(this, client, data));
                        return(true);
                    }
                }
            }

            BaseFuncs.Show404(client);
            return(false);
        }
Esempio n. 3
0
        public override bool Init(Client client)
        {
            int productID;

            if (int.TryParse(BaseFuncs.GetAdditionalURLArray(client.URL, this.URL)[0], out productID))
            {
                Product product = productService.GetByID(productID);
                if (product != null)
                {
                    Hashtable data = new Hashtable();

                    if (client.PostParam("EditProduct") != null)
                    {
                        double price;
                        int    category;
                        if (double.TryParse(client.PostParam("price"), out price) && int.TryParse(client.PostParam("category"), out category))
                        {
                            productService.EditProduct(client.PostParam("name"), client.PostParam("jpname"), price, client.PostParam("desc"), client.PostParam("images"), category, client.PostParam("volume"), client.PostParam("productsInCat"), client.PostParam("productColors"), client.PostParam("Image30x68"), client.PostParam("Image178x170"), client.PostParam("Image60x135"), productID);
                            client.Redirect("/products/#pr_" + product.ID);
                            Logger.ConsoleLog("Edited product: " + product.Name + " (ID: " + product.ID + ")", ConsoleColor.Yellow);

                            return(false);
                        }
                    }
                    data.Add("Product", product);
                    client.HttpSend(TemplateActivator.Activate(this, client, data));
                    return(true);
                }
            }


            BaseFuncs.Show404(client);
            return(false);
        }
Esempio n. 4
0
        public override bool Init(Client client)
        {
            int productColorID;

            if (int.TryParse(BaseFuncs.GetAdditionalURLArray(client.URL, this.URL)[0], out productColorID))
            {
                ProductColor productColor = productColorService.GetByID(productColorID);
                if (productColor != null)
                {
                    Hashtable data = new Hashtable();

                    if (client.PostParam("EditProductColor") != null && client.PostParam("name") != null)
                    {
                        if (client.PostParam("RGB") != null)
                        {
                            productColorService.EditProductColor(client.PostParam("RGB"), client.PostParam("name"), productColorID);
                            client.Redirect("/product.color/#pr_" + productColor.ID);
                            Logger.ConsoleLog("Edited product color: " + productColor.RGB + " (ID: " + productColor.ID + ")", ConsoleColor.Yellow);

                            return(false);
                        }
                    }
                    data.Add("ProductColor", productColor);
                    client.HttpSend(TemplateActivator.Activate(this, client, data));
                    return(true);
                }
            }

            BaseFuncs.Show404(client);
            return(false);
        }
Esempio n. 5
0
        public override bool Init(Client client)
        {
            int orderID, orderStatus;

            if (client.GetParam("order_id") != null && int.TryParse(client.GetParam("order_id"), out orderID) && client.GetParam("order_status") != null && int.TryParse(client.GetParam("order_status"), out orderStatus))
            {
                Order order = orderService.GetByID(orderID);
                if (order != null)
                {
                    if (client.GetParam("withPartner") != null && order.Status <= 0 && orderStatus > 0)
                    {
                        if (order.PartnerID > 0)
                        {
                            Partner partner = partnerService.GetByID(order.PartnerID);
                            partnerService.ChangeWalletValue(partner.Wallet + orderService.CalculatePartnersIncome(order), order.PartnerID);
                        }
                    }
                    orderService.ChangeStatus(orderStatus, order);
                }
            }

            Hashtable data = new Hashtable();
            List <RussianKawaiShop.Order> orders     = orderService.GetByStatus(1).OrderBy(olist => olist.ID * -1).ToList();
            List <RussianKawaiShop.Order> SentOrders = orderService.GetByStatus(2).OrderBy(olist => olist.ID * -1).ToList();

            data.Add("Orders", orders);
            data.Add("SentOrders", SentOrders);
            client.HttpSend(TemplateActivator.Activate(this, client, data));
            return(true);
        }
Esempio n. 6
0
        public override bool Init(Client client)
        {
            int faqID;

            if (int.TryParse(BaseFuncs.GetAdditionalURLArray(client.URL, this.URL)[0], out faqID))
            {
                RussianKawaiShop.FAQ faq = faqService.GetByID(faqID);
                if (faq != null)
                {
                    Hashtable data = new Hashtable();

                    if (client.PostParam("EditFAQ") != null)
                    {
                        if (client.PostParam("question") != null && client.PostParam("answer") != null)
                        {
                            faq.Question = client.PostParam("question");
                            faq.Answer   = client.PostParam("answer");
                            faqService.Edit(faq);

                            client.Redirect("/faq/#pr_" + faq.ID);
                            Logger.ConsoleLog("Edited faq: " + faq.Question + " (ID: " + faq.ID + ")", ConsoleColor.Yellow);

                            return(false);
                        }
                    }
                    data.Add("FAQ", faq);
                    client.HttpSend(TemplateActivator.Activate(this, client, data));
                    return(true);
                }
            }


            BaseFuncs.Show404(client);
            return(false);
        }
Esempio n. 7
0
        public override bool Init(Client client)
        {
            Hashtable data = new Hashtable();

            data.Add("menuActive", "faq");
            client.HttpSend(TemplateActivator.Activate(this, client, data));
            return(true);
        }
Esempio n. 8
0
        public override bool Init(Client client)
        {
            Hashtable data = new Hashtable();

            data.Add("Partner", partnerService.GetCurrentPartner(client));
            data.Add("PartnerOrders", orderService.GetPartnerOrders(partnerService.GetCurrentPartner(client).ID));
            client.HttpSend(TemplateActivator.Activate(this, client, data));
            return(true);
        }
        public RazorTemplateEngine(RazorTemplateEngineConfiguration configuration)
        {
            Contract.Requires <ArgumentNullException>(configuration != null);

            _compiler         = configuration.CodeLanguage.GetCompiler();
            _cache            = configuration.CachePolicy.GetCache <Type>();
            _activator        = new TemplateActivator(configuration.TemplateFactory);
            _resourceProvider = configuration.ResourceProvider;
            _cacheExpiration  = configuration.CacheExpiration;
        }
Esempio n. 10
0
 public override bool Init(Client client)
 {
     if (cartService.GetByCookie(cartService.GetCookie(client)).Count > 0)
     {
         Hashtable data = new Hashtable();
         data.Add("menuActive", "cart");
         client.HttpSend(TemplateActivator.Activate(this, client, data));
         return(true);
     }
     else
     {
         client.Redirect("/cart/");
     }
     return(false);
 }
Esempio n. 11
0
        public override bool Init(Client client)
        {
            if (client.PostParam("action") == "login")
            {
                if (this.Login(client.PostParam("login"), client.PostParam("password"), client))
                {
                    client.Redirect("/");
                    return(false);
                }
            }

            Hashtable data = new Hashtable();

            client.HttpSend(TemplateActivator.Activate(this, client, data));
            return(true);
        }
Esempio n. 12
0
        public override bool Init(Client client)
        {
            Order order = orderService.GetByUniqueCode(BaseFuncs.GetAdditionalURLArray(client.URL, this.URL)[0]);

            if (order != null)
            {
                Hashtable data = new Hashtable();
                data.Add("Order", order);
                client.HttpSend(TemplateActivator.Activate(this, client, data));
            }
            else
            {
                BaseFuncs.Show404(client);
            }
            return(true);
        }
Esempio n. 13
0
        public override bool Init(Client client)
        {
            if (client.PostParam("action") == "reg")
            {
                if (Registration(client.PostParam("login"), client.PostParam("password"), client.PostParam("name"), client.PostParam("email"), client))
                {
                    client.HttpSend("Молодец, регнулся.");
                    client.Redirect("http://partner." + client.Host);
                    return(false);
                }
            }
            Hashtable data = new Hashtable();

            data.Add("menuActive", "partner");
            client.HttpSend(TemplateActivator.Activate(this, client, data));
            return(true);
        }
        public RazorTemplateEngine(IResourceProvider resourceProvider, ITemplateFactory templateFactory)
        {
            Contract.Requires <ArgumentNullException>(resourceProvider != null);
            Contract.Requires <ArgumentNullException>(templateFactory != null);

            var configuration = new RazorTemplateEngineConfiguration
            {
                ResourceProvider = resourceProvider,
                TemplateFactory  = templateFactory
            };

            _compiler         = configuration.CodeLanguage.GetCompiler();
            _cache            = configuration.CachePolicy.GetCache <Type>();
            _activator        = new TemplateActivator(configuration.TemplateFactory);
            _resourceProvider = configuration.ResourceProvider;
            _cacheExpiration  = configuration.CacheExpiration;
        }
Esempio n. 15
0
        public override bool Init(Client client)
        {
            if (client.Referer != null && client.Referer.Contains("robokassa"))
            {
                client.Redirect("http://thegameslot.com");
                return(false);
            }

            if (client.GetParam("ad") == "woman_ru")
            {
                WebSocket.AD_WOMAN_RU++;
                client.Redirect("/");
            }
            Hashtable data = new Hashtable();

            data.Add("menuActive", "main");
            client.HttpSend(TemplateActivator.Activate(this, client, data));
            return(true);
        }
Esempio n. 16
0
        public override bool Init(Client client)
        {
            int productId = 0;

            int.TryParse(BaseFuncs.GetAdditionalURLArray(client.URL, URL)[0], out productId);
            Hashtable data = new Hashtable();

            if (productService.GetByID(productId) != null)
            {
                data.Add("Product", this.productService.GetByID(productId));
                string tosend = TemplateActivator.Activate(this, client, data);
                client.HttpSend(tosend);
            }
            else
            {
                BaseFuncs.Show404(client);
            }

            return(true);
        }
        public override bool Init(Client client)
        {
            Hashtable data = new Hashtable();

            if (client.PostParam("AddProductCategory") != null)
            {
                if (client.PostParam("name") != null)
                {
                    ProductCategory productCategory = new ProductCategory();
                    int             id = productCategoryService.CreateCategory(client.PostParam("name")).ID;

                    client.Redirect("/product.category/#pr_" + productCategory.ID);
                    Logger.ConsoleLog("Added new product category: " + productCategory.Name + " (ID: " + id + ")", ConsoleColor.Yellow);

                    return(false);
                }
            }

            client.HttpSend(TemplateActivator.Activate(this, client, data));
            return(true);
        }
Esempio n. 18
0
        public override bool Init(Client client)
        {
            if (client.PostParam("AddProduct") != null)
            {
                double price;
                int    category;
                if (double.TryParse(client.PostParam("price"), out price) && int.TryParse(client.PostParam("category"), out category))
                {
                    Product product = productService.CreateProduct(client.PostParam("name"), client.PostParam("jpname"), price, client.PostParam("desc"), client.PostParam("images"), category, client.PostParam("volume"), client.PostParam("productsInCat"), client.PostParam("productColors"), client.PostParam("Image30x68"), client.PostParam("Image178x170"), client.PostParam("Image60x135"));
                    if (product != null)
                    {
                        client.Redirect("/products/#pr_" + product.ID);
                        Logger.ConsoleLog("Added new product: " + product.Name + " (ID: " + product.ID + ")", ConsoleColor.Yellow);

                        return(false);
                    }
                }
            }

            client.HttpSend(TemplateActivator.Activate(this, client));
            return(true);
        }
        public override bool Init(Client client)
        {
            if (client.PostParam("AddProductColor") != null)
            {
                if (client.PostParam("ColorRGB") != null && client.PostParam("name") != null)
                {
                    ProductColor pColor = new ProductColor();
                    pColor.RGB  = client.PostParam("ColorRGB");
                    pColor.Name = client.PostParam("name");

                    ProductColor productColor = productColorService.CreateProductColorReturn(pColor);
                    if (productColor != null)
                    {
                        client.Redirect("/product.color/#pr_" + productColor.ID);
                        Logger.ConsoleLog("Added new product color: " + productColor.RGB + " (ID: " + productColor.ID + ")", ConsoleColor.Yellow);

                        return(false);
                    }
                }
            }

            client.HttpSend(TemplateActivator.Activate(this, client));
            return(true);
        }
        public override bool Init(Client client)
        {
            int productCategoryID;

            if (int.TryParse(BaseFuncs.GetAdditionalURLArray(client.URL, this.URL)[0], out productCategoryID))
            {
                ProductCategory productCategory = productCategoryService.GetByID(productCategoryID);
                if (productCategory != null)
                {
                    Hashtable data = new Hashtable();

                    if (client.PostParam("EditProductCategory") != null)
                    {
                        if (client.PostParam("name") != null)
                        {
                            productCategory.Name        = client.PostParam("name");
                            productCategory.Image       = client.PostParam("image");
                            productCategory.Description = client.PostParam("desc");
                            productCategoryService.EditCategory(productCategory);

                            client.Redirect("/product.category/#pr_" + productCategory.ID);
                            Logger.ConsoleLog("Edited product category: " + productCategory.Name + " (ID: " + productCategory.ID + ")", ConsoleColor.Yellow);

                            return(false);
                        }
                    }
                    data.Add("ProductCategory", productCategory);
                    client.HttpSend(TemplateActivator.Activate(this, client, data));
                    return(true);
                }
            }


            BaseFuncs.Show404(client);
            return(false);
        }
Esempio n. 21
0
        public override bool Init(Client client)
        {
            int categoryId = 1;

            string[] url = BaseFuncs.GetAdditionalURLArray(client.URL, URL);
            if (url.Length > 1)
            {
                int.TryParse(url[1], out categoryId);
            }

            ProductCategory productCategory = productCategoryService.GetByID(categoryId);

            if (productCategory == null)
            {
                productCategory = productCategoryService.GetByID(1);
            }

            Hashtable data = new Hashtable();

            data.Add("productCategory", productCategory);
            data.Add("menuActive", "catalog");
            client.HttpSend(TemplateActivator.Activate(this, client, data));
            return(true);
        }
Esempio n. 22
0
        public override bool Init(Client client)
        {
            if (client.PostParam("AddFAQ") != null)
            {
                if (client.PostParam("question") != null && client.PostParam("answer") != null)
                {
                    RussianKawaiShop.FAQ fq = new RussianKawaiShop.FAQ();
                    fq.Question = client.PostParam("question");
                    fq.Answer   = client.PostParam("answer");

                    RussianKawaiShop.FAQ faq = faqService.Create(fq);
                    if (faq != null)
                    {
                        client.Redirect("/faq/#pr_" + faq.ID);
                        Logger.ConsoleLog("Added new faq: " + faq.Question + " (ID: " + faq.ID + ")", ConsoleColor.Yellow);

                        return(false);
                    }
                }
            }

            client.HttpSend(TemplateActivator.Activate(this, client));
            return(true);
        }
Esempio n. 23
0
        public override bool Init(Client client)
        {
            if (client.ConnType == ConnectionType.WebSocket)
            {
                if (client.WSData != null)
                {
                    string[] WSData = Regex.Split(client.WSData, BaseFuncs.WSplit);
                    string   Action = WSData[0];

                    if (Action == "AddProductToCartAction")
                    {
                        WebSocket.WSPeople++;
                        if (this.AddToCart(WSData[1], WSData[2], WSData[3], client))
                        {
                            client.SendWebsocket("CountItemsInCartAction" + BaseFuncs.WSplit + cartService.CountProductsNum(cartService.GetCookie(client)));
                        }
                    }
                }
                return(false);
            }
            else if (client.PostParam("action") != null)
            {
                string Action = client.PostParam("action");
                if (Action == "AddProductToCartAction")
                {
                    WebSocket.JSPeople++;
                    if (this.AddToCart(client.PostParam("id"), client.PostParam("num"), client.PostParam("productColor"), client))
                    {
                        client.HttpSend(cartService.CountProductsNum(cartService.GetCookie(client)).ToString());
                        return(false);
                    }
                }
            }

            if (client.PostParam("ClearCart") != null)
            {
                cartService.SetNewCookie(client);
                client.Redirect("/cart/");
                return(false);
            }
            else if (client.PostParam("CreateOrder") != null)
            {
                Order order = new Order();
                order.Email   = client.PostParam("email");
                order.Name    = client.PostParam("name");
                order.Country = client.PostParam("country");
                order.City    = client.PostParam("city");
                // order.Region = client.PostParam("region");
                order.Street = client.PostParam("street");
                order.Phone  = client.PostParam("phone");
                order.Home   = client.PostParam("home");
                order.Room   = client.PostParam("room");
                order.Index  = client.PostParam("index");

                order.Comment = client.PostParam("comment");

                if (client.PostParam("saleCode") != null)
                {
                    Partner pr = partnerService.GetByLogin(client.PostParam("saleCode"));
                    if (pr != null)
                    {
                        order.PartnerID = pr.ID;
                    }
                }

                Order orderResult = orderService.CreateOrder(order, client);
                if (orderResult != null)
                {
                    client.Redirect("/order/" + orderResult.UniqueCode);
                    return(false);
                }
            }

            Hashtable data = new Hashtable();

            data.Add("menuActive", "cart");
            client.HttpSend(TemplateActivator.Activate(this, client, data));
            return(true);
        }
Esempio n. 24
0
 public override bool Init(Client client)
 {
     client.HttpSend(TemplateActivator.Activate(this, client));
     return(true);
 }