Exemple #1
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);
        }
Exemple #2
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);
        }
Exemple #3
0
        public override bool Init(Client client)
        {
            if (client.ConnType == ConnectionType.WebSocket && client.WSData != null)
            {
                string[] WSData = Regex.Split(client.WSData, BaseFuncs.WSplit);
                string   Action = WSData[0];

                if (Action == "AddPhoneCall" && WSData.Length == 4)
                {
                    PhoneCall phoneCall = new PhoneCall();
                    phoneCall.Name    = WSData[1];
                    phoneCall.Phone   = WSData[2];
                    phoneCall.Comment = WSData[3];

                    if (phoneCallService.Add(phoneCall) != null)
                    {
                        Logger.ConsoleLog("Added new phone call: " + phoneCall.Phone, ConsoleColor.Yellow);
                    }
                }
            }
            else
            {
                BaseFuncs.Show404(client);
            }
            return(false);
        }
Exemple #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);
        }
Exemple #5
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);
        }
Exemple #6
0
        public override bool Init(Client client)
        {
            string Action = BaseFuncs.GetAdditionalURLArray(client.URL, this.URL)[0];

            if (Action == "success")
            {
                client.Redirect("http://thegameslot.com/robokassa/success");
            }

            else if (Action == "result")
            {
                try
                {
                    string get = "?InvId=" + client.GetParam("InvId") + "&OutSum=" + client.GetParam("OutSum") + "&SignatureValue=" + client.GetParam("SignatureValue");
                    Logger.ConsoleLog("KAWAI get: " + get);
                    using (WebClient wc = new WebClient())
                    {
                        string res = wc.DownloadString("http://thegameslot.com/robokassa/result/" + get);
                        Logger.ConsoleLog("RESULT FROM GAMESLOT: " + res);
                        client.HttpSend(res);
                        return(false);
                    }
                }
                catch (Exception ex)
                {
                    Logger.ConsoleLog("ERROR ON KAWAI ROBO: " + ex, ConsoleColor.Red);
                }
            }


            /*
             * string Action = BaseFuncs.GetAdditionalURLArray(client.URL, this.URL)[0];
             * Order order = this.CheckOrderByID(client.GetParam("InvId"));
             *
             * if(Action == "success")
             * {
             *  if(order != null)
             *  {
             *      client.Redirect("/order/" + order.UniqueCode);
             *  }
             * }
             * else if(Action == "result")
             * {
             *  if (order != null && this.ResultCRC(client).Equals(client.GetParam("SignatureValue")))
             *  {
             *      orderService.ChangeStatus(1, order);
             *      if(order.PartnerID > 0)
             *      {
             *          Partner partner = partnerService.GetByID(order.PartnerID);
             *          partnerService.ChangeWalletValue(partner.Wallet + orderService.CalculatePartnersIncome(order), order.PartnerID);
             *      }
             *      client.HttpSend("OK" + order.ID);
             *  }
             * }
             */
            BaseFuncs.Show404(client);
            return(true);
        }
Exemple #7
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);
        }
Exemple #8
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)
        {
            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);
        }