Пример #1
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);
        }
Пример #2
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);
        }
Пример #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);
        }
Пример #4
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);
        }
Пример #5
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);
        }
Пример #6
0
        private string ResultCRC(Client client)
        {
            string crc = client.GetParam("OutSum") + ":" + client.GetParam("InvId") + ":" + "12311974b";

            Console.WriteLine(crc);
            return(BaseFuncs.MD5(crc).ToUpper());
        }
Пример #7
0
        public string SetNewCookie(Client client)
        {
            string cookie = BaseFuncs.MD5(new Random().Next() + "CRT" + Environment.TickCount);

            //client.SetCookie.Add("Cart", cookie);
            client.SetCookie("Cart", new Cookie(cookie));
            return(cookie);
        }
Пример #8
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);
        }
Пример #9
0
        public bool Authorize(string Login, string Pswd, Client client)
        {
            Partner partner = this.GetByLogin(Login);

            if (partner != null && partner.Password == BaseFuncs.MD5(Pswd))
            {
                partner.UserSession = this.GetRandomUserSession();
                client.SetCookie("PartnerSession", new Cookie(partner.UserSession));
                this.UpdateUserSession(partner.UserSession, partner.ID);
                return(true);
            }
            return(false);
        }
Пример #10
0
        public Partner CreatePartner(Partner partner)
        {
            if (partner.Name.Length > 0 && partner.Login != null && partner.Password.Length > 0)
            {
                if (this.GetByLogin(partner.Login) == null)
                {
                    partner.Password = BaseFuncs.MD5(partner.Password);
                    return(this.GetByID(DBConnector.manager.InsertQueryReturn(partner)));
                }
            }

            return(null);
        }
Пример #11
0
        public override bool Init(Client client)
        {
            string rf = BaseFuncs.GetAdditionalURLArray(client.URL, URL)[0];

            if (rf != null)
            {
                Partner partner = partnerService.GetByLogin(rf);
                if (partner != null)
                {
                    partnerService.SavePartnerToCustomer(partner, client);
                }
            }
            client.Redirect("/");
            return(false);
        }
Пример #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);
        }
Пример #13
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);
        }
Пример #14
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);
        }
        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);
        }
Пример #16
0
 public static void Send(string email, string theme, string text)
 {
     BaseFuncs.SendEMail("nktbamba", "*****@*****.**", "De7828gDq1ws99772j1bbcgm", email, theme, text);
 }
Пример #17
0
        public string SignatureValue(Order order)
        {
            string mrh_pass1 = "12311974a";

            return(BaseFuncs.MD5(this.mrh_login + ":" + order.TotalCost.ToString() + ".00:" + order.ID + ":" + mrh_pass1));
        }
Пример #18
0
 private string GetRandomUserSession()
 {
     return(BaseFuncs.MD5(new Random().Next() + "prtnr" + Environment.TickCount));
 }