Exemplo n.º 1
0
        protected string SearchContent(string SearchText)
        {
            string[] temp = SearchText.Split('+');
            SearchText = "";
            foreach (var word in temp)
            {
                SearchText += word + " ";
            }
            SearchText = SearchText.Substring(0, (SearchText.Length - 1));

            string result = "";

            using (var db = new dbEntities())
            {
                var query = from b in db.products
                            where b.Name.ToLower().Contains(SearchText.ToLower())
                            select b;
                foreach (var product in query)
                {
                    result += string.Format("<div class=product-container><div class=product-image><a href=/product.aspx?id={0}><img src=/images/products/{1} height=180 width=180/></a></div><div class=product-name><a href=/product.aspx?id={2}>{3}</a></div><div class=product-price>{4} грн</div><form class=add-to-cart action=actions/AddToCart.aspx id=ToCartForm ><input type=hidden Value={5} name=Id /><input type=hidden Value=1 name=Count /><input type=hidden Value={6} name=Url /><input type=submit value=" + "'В корзину'" + "class=submit /></form></div>",
                                            (product.Id + 1274), product.Image, (product.Id + 1274), product.Name, product.Price, product.Id, CurrentUrl);
                }
            }
            if (result == "")
            {
                result = "<div style='font-size:20px; text-align:center; padding-top:20px;'>По вашему запросу ничего не найдено!</div>";
            }
            return(result);
        }
Exemplo n.º 2
0
        protected string CartInfo()
        {
            HttpCookie CartCookie = Request.Cookies["cart"];

            if (CartCookie != null && CartCookie["cart"] != "")
            {
                int      sum    = 0;
                int      count  = 0;
                string   value  = CartCookie["cart"];
                string[] blocks = value.Split('a');
                foreach (var products in blocks)
                {
                    if (products != "")
                    {
                        string[] result = products.Split('c');
                        count = int.Parse(result[1]);
                        using (var db = new dbEntities())
                        {
                            var ID    = int.Parse(result[0]);
                            var query = from b in db.products
                                        where b.Id == ID
                                        select b.Price;
                            sum += query.First().GetValueOrDefault();
                        }
                    }
                }
                return(String.Format("<div id=" + "cartinfo" + ">Добавлено в корзину: {0} <br /> На суму: {1} грн</div> ", (blocks.Length - 1), sum));
            }
            else
            {
                return("<div id=" + "cartinfo" + ">Добавлено в корзину: 0 <br /> На суму: 0 грн</div> ");
            }
        }
Exemplo n.º 3
0
 protected string Content()
 {
     using (var db = new dbEntities())
     {
         var query = from b in db.contents
                     where b.name.Equals("contacts")
                     select b.content1;
         return(query.First());
     }
 }
Exemplo n.º 4
0
        protected string CartContent()
        {
            string     result     = "";
            HttpCookie CartCookie = Request.Cookies["cart"];

            if (CartCookie != null && CartCookie["cart"] != "")
            {
                result += "<form action=actions/delcart.aspx class=cart-form><table align=center border=1><tr><td>Наименование</td><td>Количество</td><td>Цена за единицу</td><td>Удалить</td></tr>";
                using (var db = new dbEntities())
                {
                    int      sum    = 0;
                    int      count  = 0;
                    string   value  = CartCookie["cart"];
                    string[] blocks = value.Split('a');
                    foreach (var products in blocks)
                    {
                        if (products != "")
                        {
                            string[] info = products.Split('c');
                            count = int.Parse(info[1]);
                            var ID    = int.Parse(info[0]);
                            var query = from b in db.products
                                        where b.Id == ID
                                        select b;
                            sum    += query.First().Price.GetValueOrDefault() * count;
                            result += string.Format("<tr><td align=left>{0}</td><td>{1} шт.</td><td>{2} грн</td><td><input type=checkbox name=Flags[] value={3} /></td></tr>",
                                                    query.First().Name, count, query.First().Price.GetValueOrDefault(), query.First().Id);
                        }
                    }
                    result += string.Format("<tr><td></td><td>Итого: </td><td>{0} грн</td><td></td></tr>", sum);
                }
                result += "</table><input type=submit value='Удалить отмеченные' class=submit /></form><form action=actions/clearcart.aspx class=clearcart-form><input type=submit value='Очистить корзину' class=submit></form><form action=actions/addorder.aspx class=addorder-form><table align=center border=0><tr align=left><td>Ваш номер телефона:</td><td><input type=text name=contacts required=required/></td></tr><tr align=left><td>Адрес доставки:</td><td><input type=text name=Adress /></td></tr><tr><td colspan=2>Дополнительные пожелания:</td></tr></table><textarea name=additional class=additional-info></textarea><br /><input type=submit value='Сделать заказ' class=submit /></form>";
            }
            else
            {
                result = "Ваша корзина пуста!";
            }

            if (Request.QueryString["err"] != null)
            {
                int err = int.Parse(Request.QueryString["err"]);
                if (err == 0)
                {
                    result += "<div style='font-size:20px; text-align:center; color:red; padding-top:20px;'>Ваш заказ принят. Ждите пока с вами свяжется курьер.</div>";
                }
                else
                {
                    result += "<div style='font-size:20px; text-align:center; color:red; padding-top:20px;'>Чтото пошло не так. <br />Если ошибка повториться то вы можете совершить заказ по телефону.</div>";
                }
            }
            return(result);
        }
Exemplo n.º 5
0
        protected string Categories()
        {
            string allCategories = "";

            using (var db = new dbEntities())
            {
                var query = from cat in db.categories
                            select cat;
                foreach (var category in query)
                {
                    allCategories += "<li><a href=" + string.Format("/home.aspx?cat={0}", category.Id) + string.Format(">{0}</a></li>", category.CategoryName);
                }
            }
            return(allCategories);
        }
Exemplo n.º 6
0
        protected string CatalogContent()
        {
            string content = "";

            using (var db = new dbEntities())
            {
                var query = from cat in db.categories
                            select cat;
                foreach (var category in query)
                {
                    content += string.Format("<div style='margin:15px 15px 15px 15px; float:left;'><div class=product-image><a href=home.aspx?cat={0}><img src=/images/categories/{1} height=180 width=180/></a></div><div class=product-name><a href=home.aspx?cat={0}>{2}</a></div></div>",
                                             category.Id, category.Image, category.CategoryName);
                }
            }
            return(content);
        }
Exemplo n.º 7
0
 protected string ProductsContent()
 {
     using (var db = new dbEntities())
     {
         int    page, cat;
         string result = "";
         if (Request.QueryString["page"] == null)
         {
             page = 1;
         }
         else
         {
             page = int.Parse(Request.QueryString["page"]);
         }
         if (Request.QueryString["cat"] == null || Request.QueryString["cat"] == "0")
         {
             var query = (from b in db.products
                          select b).OrderByDescending(b => b.Popularity).Skip((page * 12) - 12).Take(12);
             foreach (var product in query)
             {
                 result += string.Format("<div class=product-container><div class=product-image><a href=/product.aspx?id={0}><img src=/images/products/{1} height=180 width=180/></a></div><div class=product-name><a href=/product.aspx?id={2}>{3}</a></div><div class=product-price>{4} грн</div><form class=add-to-cart action=actions/AddToCart.aspx id=ToCartForm ><input type=hidden Value={5} name=Id /><input type=hidden Value=1 name=Count /><input type=hidden Value={6} name=Url /><input type=submit value=" + "'В корзину'" + "class=submit /></form></div>",
                                         (product.Id + 1274), product.Image, (product.Id + 1274), product.Name, product.Price, product.Id, CurrentUrl);
             }
         }
         else
         {
             cat = int.Parse(Request.QueryString["cat"]);
             var query = (from b in db.products
                          where b.Category == cat
                          select b).OrderByDescending(b => b.Popularity).Skip((page * 12) - 12).Take(12);
             foreach (var product in query)
             {
                 result += string.Format("<div class=product-container><div class=product-image><a href=/product.aspx?id={0}><img src=/images/products/{1} height=180 width=180/></a></div><div class=product-name><a href=/product.aspx?id={2}>{3}</a></div><div class=product-price>{4} грн</div><form class=add-to-cart action=actions/AddToCart.aspx id=ToCartForm ><input type=hidden Value={5} name=Id /><input type=hidden Value=1 name=Count /><input type=hidden Value={6} name=Url /><input type=submit value=" + "'В корзину'" + "class=submit /></form></div>",
                                         (product.Id + 1274), product.Image, (product.Id + 1274), product.Name, product.Price, product.Id, CurrentUrl);
             }
         }
         return(result);
     }
 }
Exemplo n.º 8
0
        protected string ContentNavigation()
        {
            string result     = "";
            int    page_count = 0;

            using (var db = new dbEntities())
            {
                int query;
                if (Request.QueryString["cat"] == null)
                {
                    query = db.products.Count();
                }
                else
                {
                    int category = int.Parse(Request.QueryString["cat"]);
                    query = db.products.Where(b => b.Category == category).Count();
                }
                page_count = (int)decimal.Ceiling((decimal)query / 12);
            }
            int cat = 0, page = 1;

            result += "<table><tr><td align=left width=175px>";
            if (Request.QueryString["page"] == null)
            {
                page = 1;
            }
            else
            {
                page = int.Parse(Request.QueryString["page"]);
            }
            if (Request.QueryString["cat"] == null)
            {
                cat = 0;
            }
            else
            {
                cat = int.Parse(Request.QueryString["cat"]);
            }
            int temp = page;

            if (page > 1)
            {
                temp = page - 1;
            }
            result += string.Format("<div class=navigation-left><a href=/home.aspx?cat={0}&page={1}", cat, temp);
            result += ">Предыдущая страница</a></div></td><td align=center width=250px><div class=navigation-center>";
            if (page == page_count - 1 && page_count > 4)
            {
                temp = page - 3;
            }
            else if (page == page_count && page_count > 4)
            {
                temp = page - 4;
            }
            else if (page == 4 && page_count == 4)
            {
                temp = page - 3;
            }
            else if (page > 3)
            {
                temp = page - 2;
            }
            else
            {
                temp = 1;
            }

            result += string.Format("<a href=/home.aspx?cat={0}&page={1}", cat, temp);
            if (page == 1)
            {
                result += " class=current";
            }

            result += string.Format(">[{0}]</a>", temp);

            if (page_count > 1)
            {
                if (page == page_count - 1 && page_count > 4)
                {
                    temp = page - 2;
                }
                else if (page == page_count && page_count > 4)
                {
                    temp = page - 3;
                }
                else if (page == 4 && page_count == 4)
                {
                    temp = page - 2;
                }
                else if (page > 3)
                {
                    temp = page - 1;
                }
                else
                {
                    temp = 2;
                }
                result += string.Format("<a href=/home.aspx?cat={0}&page={1}", cat, temp);

                if (page == 2)
                {
                    result += " class=current";
                }

                result += string.Format(">[{0}]</a>", temp);
            }

            if (page_count > 2)
            {
                if (page == page_count - 1 && page_count > 4)
                {
                    temp = page - 1;
                }
                else if (page == page_count && page_count > 4)
                {
                    temp = page - 2;
                }
                else if (page == 4 && page_count == 4)
                {
                    temp = page - 1;
                }
                else if (page > 3)
                {
                    temp = page;
                }
                else
                {
                    temp = 3;
                }
                result += string.Format("<a href=home.aspx?cat={0}&page={1}", cat, temp);

                if (page_count == 3 && page == 3)
                {
                    result += " class=current";
                }
                else if (page_count == 4 && page == 3)
                {
                    result += " class=current";
                }
                else if (page_count == 5 && page == 3)
                {
                    result += " class=current";
                }
                else if (page_count > 5 && page < page_count - 1 && page > 2)
                {
                    result += " class=current";
                }

                result += string.Format(">[{0}]</a>", temp);
            }

            if (page_count > 3)
            {
                if (page == page_count - 1 && page_count > 4)
                {
                    temp = page;
                }
                else if (page == page_count && page_count > 4)
                {
                    temp = page - 1;
                }
                else if (page == 4 && page_count == 4)
                {
                    temp = page;
                }
                else if (page > 3)
                {
                    temp = page + 1;
                }
                else
                {
                    temp = 4;
                }
                result += string.Format("<a href=home.aspx?cat={0}&page={1}", cat, temp);

                if (page_count < 6 && page == 4)
                {
                    result += " class=current";
                }
                else if (page == page_count - 1 && page_count != 4)
                {
                    result += " class=current";
                }

                result += string.Format(">[{0}]</a>", temp);
            }

            if (page_count > 4)
            {
                if (page == page_count - 1 && page_count > 4)
                {
                    temp = page + 1;
                }
                else if (page == page_count && page_count > 4)
                {
                    temp = page;
                }
                else if (page > 3)
                {
                    temp = page + 2;
                }
                else
                {
                    temp = 5;
                }
                result += string.Format("<a href=home.aspx?cat={0}&page={1}", cat, temp);

                if (page == page_count)
                {
                    result += " class=current";
                }

                result += string.Format(">[{0}]</a>", temp);
            }
            result += "</div></td> <td align=right width=175px><div class=navigation-right>";
            if (page == page_count)
            {
                temp = page;
            }
            else
            {
                temp = page + 1;
            }
            result += string.Format("<a href=home.aspx?cat={0}&page={1}", cat, temp);
            result += ">Следующая страница</a></div></td></tr></table>";
            return(result);
        }
Exemplo n.º 9
0
        protected string ProductContent()
        {
            int    id, dbId;
            string result = "";

            if (Request.QueryString["id"] != null)
            {
                id   = int.Parse(Request.QueryString["id"]);
                dbId = id - 1274;
            }
            else
            {
                id   = 0;
                dbId = 0;
            }
            using (var db = new dbEntities())
            {
                var query = from b in db.products
                            where b.Id == dbId
                            select b;
                foreach (var prod in query)
                {
                    result += string.Format("<div class=product-header><div id=product-image><img src=/images/products/{0} width=300px/></div><div id=products-name>{1}</div><div id=product-id>Код товара:{2}</div><div id=price>{3} грн</div><div><form class=add-to-cart action=actions/AddToCart.aspx><input type=hidden value={4} name=Id /><input type=hidden value={5} name=Url /><div class=count>Количество:<input type=number value=1 name=Count class=product-count /></div><br /><input type=submit value='В корзину' class=submit></form>",
                                            prod.Image, prod.Name, id, prod.Price, dbId, Request.Url);
                    if (Access() == 1)
                    {
                        result += string.Format("<form action=actions/admin/delproduct.aspx><input type=hidden value={0} name=Id /><input type=hidden value={1} name=Url /><input type=submit value=Удалить товар></form>",
                                                dbId, Request.Url);
                        result += string.Format("<form action=actions/admin/updateredirect.aspx><input type=hidden value={0} name=id /><input type=submit value=Изменить товар></form>",
                                                dbId);
                    }
                    result += string.Format("</div></div><div class=product-description>{0}</div><div class=product-comments>", prod.Description);
                    int printed = 0;
                    if (prod.Comments != null)
                    {
                        string[] allcomments = prod.Comments.Split('a');
                        foreach (string comment in allcomments)
                        {
                            if (comment != "")
                            {
                                int CommentId = int.Parse(comment);
                                var q         = from res in db.comments
                                                where res.Id == CommentId
                                                select res;
                                foreach (var comm in q)
                                {
                                    string ip     = comm.Ip;
                                    bool   banned = false;
                                    var    q1     = from a in db.banlists
                                                    where a.Ip == ip
                                                    select a;
                                    foreach (var bans in q1)
                                    {
                                        banned = true;
                                    }
                                    if (banned == false)
                                    {
                                        result += string.Format("<div class=comment><div class=comment-name>{0}</div><div class=comment-time>{1}</div><div style='clear:both;'></div><p class=comment-text>{2}</p>",
                                                                comm.Name, comm.Time, comm.Text);
                                        if (Access() == 1 || Access() == 2)
                                        {
                                            result += string.Format("<form action=actions/admin/delcomment.aspx><input type=hidden value={0} name=Id /><input type=hidden value={1} name=Url /><input type=submit value='Удалить отзыв'></form><form action=actions/admin/banip.aspx><input type=hidden value={2} name=userIp /><input type=hidden value={1} name=Url /><input type=submit value='Заблокировать пользователя'></form>",
                                                                    comm.Id, Request.Url, comm.Ip);
                                        }

                                        result += "</div>";
                                        printed++;
                                    }
                                }
                            }
                        }
                    }
                    if (printed == 0)
                    {
                        result += "<div style='font-size:16px; text-align:left; padding-left:20px;'>У даного товара нет отзывов.</div>";
                    }
                    result += string.Format("</div><form action=actions/addcomment.aspx id=add-comment><input type=hidden value={0} name=productID /><input type=hidden value={1} name=Url /><div align=left>Введите имя:<br /><input type=text id=add-comment-name name=name required/><br />Ваш отзыв:<br /><textarea id=add-comment-text name=text required></textarea><br /><input type=submit value='Оставить отзыв' id=add-comment-submit/></div></form>",
                                            dbId, Request.Url);
                    int err;
                    if (Request.QueryString["err"] != null)
                    {
                        err = int.Parse(Request.QueryString["err"]);
                        switch (err)
                        {
                        case 0: { break; }

                        case 1:
                        {
                            result += "<div style='font-size:20px; width:600px; text-align:left; color:red; padding-top:20px;'>Чтото пошло не так. Проверьте корректность введенных данных.<br />Данные не должны содержать кавычек и символов < > = ; <br /></div>";
                            break;
                        }

                        case 2:
                        {
                            result += "<div style='font-size:20px; width:600px; text-align:left; color:red; padding-top:20px;'>Вы заблокированы. Вы больше не можете оставлять отзывы на этом сайте</div>";
                            break;
                        }

                        default:
                        {
                            result += "<div style='font-size:20px; width:600px; text-align:left; color:red; padding-top:20px;'>Сервис отзывов временно недоступен</div>";
                            break;
                        }
                        }
                    }
                }
            }
            return(result);
        }
Exemplo n.º 10
0
        protected string AdminContent()
        {
            string result = "";

            if (Request.QueryString["type"] == null)
            {
                return("<div style='font-size:20px; text-align:center; padding-top:20px;'>Слева находиться список доступных вам функций</div>");
            }
            else
            if (Request.QueryString["res"] != null)
            {
                int res = int.Parse(Request.QueryString["res"]);
                switch (res)
                {
                case 1: return("<div style='font-size:20px; text-align:center; padding-top:20px;'>Операция прошла успешно</div>");

                case 2: return("<div style='font-size:20px; text-align:center; padding-top:20px;'>Ошибка при выполнении операции. Операция не выполнена или выполнена не до конца!</div>");

                default: return("");
                }
            }
            else
            {
                int type = int.Parse(Request.QueryString["type"]);
                switch (type)
                {
                case 1:
                {
                    if (Access() == 1)
                    {
                        result += "<form enctype=multipart/form-data action=actions/admin/addproduct.aspx method=post >Популярность товара(чем выше тем выше он отображаеться):<br /><input type=text name=popularity /><br />Цена в гривнах:<br /><input type=text name=price /><br />Название товара:<br /><input type=text name=name /><br />Категория товара (Вводить ИД категории! просмотреть ид нужной категории можно во вкладке изменить категорию):<br /><input type=text name=category /><br />Описание товара(можно применять html тэги):<br /><textarea name=description style='width:600px; height:600px;'></textarea><br /><input type=hidden name=MAX_FILE_SIZE value=30000 />Изображение товара(рекомендуется 200х200 пикселей в формате png):<br /><input type=file name=image /><br /><input type=submit value='Добавить товар' /></form>";
                    }
                    else
                    {
                        result += "<div style='font-size:20px; text-align:center; padding-top:20px;'>У вас нету доступа</div>";
                    }
                    return(result);
                }

                case 2:
                {
                    if (Access() == 1)
                    {
                        if (Request.QueryString["id"] == null)
                        {
                            result += "<table border=1><tr><td>Ид товара</td><td>Код товара</td><td>Цена</td><td>Имя товара</td><td>Катогория</td><td>Изменить</td></tr>";
                            using (var db = new dbEntities())
                            {
                                var query = from b in db.products
                                            select b;
                                foreach (var product in query)
                                {
                                    result += string.Format("<tr><td>{0}</td><td>{1}</td><td>{2} грн</td><td>{3}</td><td>{4}</td><td><a href=admin.aspx?type=2&id={0}>Изменить</a></td></tr>",
                                                            product.Id, product.Id + 1274, product.Price, product.Name, product.Category);
                                }
                                result += "</table>";
                            }
                        }
                        else
                        {
                            int id = int.Parse(Request.QueryString["id"]);
                            using (var db = new dbEntities())
                            {
                                bool exist = false;
                                var  query = from b in db.products
                                             where b.Id == id
                                             select b;
                                foreach (var product in query)
                                {
                                    exist   = true;
                                    result += string.Format("<form action=actions/admin/updateproduct.aspx method=post >Популярность товара(чем выше тем выше он отображаеться):<br /><input type=text name=popularity value={0} /><br />Цена в гривнах:<br /><input type=text name=price value={1} /><br />Название товара:<br /><input type=text name=name value={2} /><br />Категория товара (Вводить ИД категории! просмотреть ид нужной категории можно во вкладке изменить категорию):<br /><input type=text name=category value={3} /><br />Описание товара(можно применять html тэги):<br /><textarea name=description style='width:600px; height:600px;'>{4}</textarea><br />Изображение товара:<br /><input type=text name=image value={5} /><br /><input type=hidden value={6} name=id /><input type=submit value=Изменить товар /></form>",
                                                            product.Popularity, product.Price, product.Name, product.Category, product.Description, product.Image, product.Id);
                                }
                                if (exist == false)
                                {
                                    result += "<div style='font-size:20px; text-align:center; padding-top:20px;'>Данного товара нету в базе</div>";
                                }
                            }
                        }
                    }
                    else
                    {
                        result += "<div style='font-size:20px; text-align:center; padding-top:20px;'>У вас нет доступа</div>";
                    }
                    return(result);
                }

                case 3:
                {
                    if (Access() != 1)
                    {
                        result += "<div style='font-size:20px; text-align:center; padding-top:20px;'>У вас нет доступа</div>";
                    }
                    else
                    {
                        result += "<form action=actions/admin/delproducts.aspx><table border=1><tr><td>Ид товара</td><td>Код товара</td><td>Цена</td><td>Имя товара</td><td>Катогория</td><td>Удалить</td></tr>";
                        using (var db = new dbEntities())
                        {
                            var query = from b in db.products
                                        select b;
                            foreach (var product in query)
                            {
                                result += string.Format("<tr><td>{0}</td><td>{1}</td><td>{2} грн</td><td>{3}</td><td>{4}</td><td><input type=checkbox name=Flags[] value={0} /></td></tr>",
                                                        product.Id, product.Id + 1274, product.Price, product.Name, product.Category);
                            }
                            result += "<tr><td colspan=6 align=center><input type=hidden name=Url value=~/admin.aspx?res=1 /><input type=submit value='Удалить отмеченные' /></td></tr></table></form>";
                        }
                    }
                    return(result);
                }

                case 4:
                {
                    if (Access() != 1)
                    {
                        result += "<div style='font-size:20px; text-align:center; padding-top:20px;'>У вас нет доступа</div>";
                    }
                    else
                    {
                        result += "<form enctype=multipart/form-data action=actions/admin/addcategory.aspx method=post>Название категории:<br /><input type=text name=name /><br /><input type=hidden name=MAX_FILE_SIZE value=30000 />Изображение категории(рекомендуется 200х200 пикселей в формате png):<br /><input type=file name=image /><br /><input type=submit value='Добавить категорию' /></form>";
                    }
                    return(result);
                }

                case 5:
                {
                    if (Access() != 1)
                    {
                        result += "<div style='font-size:20px; text-align:center; padding-top:20px;'>У вас нет доступа</div>";
                    }
                    else
                    {
                        if (Request.QueryString["id"] == null)
                        {
                            result += "<table border=1><tr><td>Ид категории</td><td>Название</td><td>Изменить</td></tr>";
                            using (var db = new dbEntities())
                            {
                                var q = from b in db.categories
                                        select b;
                                foreach (var category in q)
                                {
                                    result += string.Format("<tr><td>{0}</td><td>{1}</td><td><a href=admin.aspx?type=5&id={0}>Изменить</a></td></tr>",
                                                            category.Id, category.CategoryName);
                                }
                            }
                            result += "</table>";
                        }
                        else
                        {
                            int id = int.Parse(Request.QueryString["id"]);
                            using (var db = new dbEntities())
                            {
                                var q = from b in db.categories
                                        where b.Id == id
                                        select b;
                                foreach (var cat in q)
                                {
                                    result += string.Format("<form action=actions/admin/updatecategory.aspx>Название категории:<br /><input type=text name=name value={0} /><br />Изображение категории:<br /><input type=text name=image value={1} /><br /><input type=hidden value={2} name=id /><input type=submit value='Изменить категорию' /></form>",
                                                            cat.CategoryName, cat.Image, cat.Id);
                                }
                            }
                        }
                    }
                    return(result);
                }

                case 6:
                {
                    if (Access() != 1)
                    {
                        result += "<div style='font-size:20px; text-align:center; padding-top:20px;'>У вас нет доступа</div>";
                    }
                    else
                    {
                        result += "<form action=actions/admin/delcategory.aspx><table border=1><tr><td>Ид категории</td><td>Название</td><td>Удалить</td></tr>";
                        using (var db = new dbEntities())
                        {
                            var query = from b in db.categories
                                        select b;
                            foreach (var cat in query)
                            {
                                result += string.Format("<tr><td>{0}</td><td>{1}</td><td><input type=checkbox name=Flags[] value={0} /></td></tr>",
                                                        cat.Id, cat.CategoryName);
                            }
                            result += "<tr><td colspan=3 align=center><input type=submit value='Удалить отмеченные' /></td></tr></table></form>";
                        }
                    }
                    return(result);
                }

                case 7:
                {
                    if (Access() != 1 && Access() != 2)
                    {
                        result += "<div style='font-size:20px; text-align:center; padding-top:20px;'>У вас нет доступа</div>";
                    }
                    else
                    {
                        result += "<form action=actions/admin/delbanlist.aspx><table border=1><tr><td>IP-адрес</td><td>Удалить</td></tr>";
                        using (var db = new dbEntities())
                        {
                            var q = from b in db.banlists
                                    select b;
                            foreach (var adress in q)
                            {
                                result += string.Format("<tr><td>{0}</td><td><input type=checkbox name=Flags[] value={1} /></td></tr>",
                                                        adress.Ip, adress.Id);
                            }
                        }
                        result += "<tr><td colspan=2 align=center><input type=submit value='Удалить отмеченные' /></td></tr></table></form>";
                        result += "<form style='margin-top:20px;' action=actions/admin/clearbanlist.aspx>Очистить весь список:<br /><input type=submit value='Очистить банлист' /></form>";
                        result += "<form style='margin-top:20px;' action=actions/admin/banip.aspx>Добавить адрес в банлист:<br /><input type=text name=userIp /><br /><input type=hidden name=Url value=~/admin.aspx?res=1 /><input type=submit value='Добавить в банлист' /></form>";
                    }
                    return(result);
                }

                case 8:
                {
                    if (Access() != 1)
                    {
                        result += "<div style='font-size:20px; text-align:center; padding-top:20px;'>У вас нет доступа</div>";
                    }
                    else
                    {
                        result += "<form action=actions/admin/adduser.aspx><h3>Добавить пользователя</h3><br /><table><tr><td>Логин: </td><td><input type=text name=login /></td></tr><tr><td>Пароль: </td><td><input type=text name=pass /></td></tr><tr><td>Уровень доступа(1-админ 2-модератор)</td><td><input type=text name=access /></td></tr><tr><td colspan=2><input type=submit value='Добавить пользователя' /></td></tr></form>";

                        result += "<form action=actions/admin/delusers.aspx><table border=1><tr><td>Логин</td><td>Пароль</td><td>Уровень доступа</td><td>Удалить</td></tr>";
                        using (var db = new dbEntities())
                        {
                            var q = from b in db.users
                                    select b;
                            foreach (var user in q)
                            {
                                result += string.Format("<tr><td>{0}</td><td>{1}</td><td>{2}</td><td><input type=checkbox name=Flags[] value={3} /></td></tr>",
                                                        user.Login, user.Password, user.Access, user.Id);
                            }
                        }
                        result += "<tr><td colspan=4 align=center><input type=submit value='Удалить отмеченные' /></td></tr></table></form>";
                    }
                    return(result);
                }

                case 9:
                {
                    if (Access() != 1)
                    {
                        result += "<div style='font-size:20px; text-align:center; padding-top:20px;'>У вас нет доступа</div>";
                    }
                    else
                    {
                        result += "<form action=actions/admin/content.aspx method=post >";
                        using (var db = new dbEntities())
                        {
                            var q = from b in db.contents
                                    select b;
                            foreach (var page in q)
                            {
                                result += string.Format("<h3>{0}</h3><br /><textarea name={1} style='width:600px; height:600px;'>{2}</textarea><br />",
                                                        page.title, page.id, page.content1);
                            }
                        }
                        result += "<input type=submit value='Применить изменения'></form>";
                    }
                    return(result);
                }

                case 10:
                {
                    if (Access() != 1)
                    {
                        result += "<div style='font-size:20px; text-align:center; padding-top:20px;'>У вас нет доступа</div>";
                    }
                    else
                    {
                        int sum = 0;
                        using (var db = new dbEntities())
                        {
                            var q = from b in db.orders
                                    select b;
                            foreach (var order in q)
                            {
                                result += string.Format("<div style='margin-top:15px; margin-bottom:15px;'><h3>Заказ №{0}</h3><form action=actions/admin/delorder.aspx><input type=hidden name=id value={0} /><input type=hidden name=Url value={1} /><input type=submit value='Удалить заказ' /></form><br /><table border=1><tr><td>Название</td><td>Количиество</td><td>Цена за единицу</td><td>Цена за все</td></tr>",
                                                        order.Id, Request.Url);
                                string[] blocks = order.OrderProducts.Split('a');
                                foreach (var block in blocks)
                                {
                                    if (block != "")
                                    {
                                        string[] info   = block.Split('c');
                                        int      prodId = int.Parse(info[0]);
                                        var      q2     = from b in db.products
                                                          where b.Id == prodId
                                                          select b;
                                        foreach (var product in q2)
                                        {
                                            result += string.Format("<tr><td>{0}</td><td>{1}</td><td>{2}</td><td>{3}</td></tr>",
                                                                    product.Name, info[1], product.Price, int.Parse(info[1]) * (int)product.Price);
                                            sum += int.Parse(info[1]) * (int)product.Price;
                                        }
                                    }
                                }
                                result += string.Format("<tr><td colspan=4 align=right>Итого:{0} грн</td></tr></table><p>Адрес доставки: {1}</p><p>Контакты заказчика: {2}</p><p>Дополнительные пожелания: {3}</p></div>",
                                                        sum, order.OrderAdress, order.OrderContacts, order.OrderAdditional);
                            }
                        }
                    }
                    return(result);
                }

                case 11:
                {
                    if (Access() != 1 && Access() != 2)
                    {
                        result += "<div style='font-size:20px; text-align:center; padding-top:20px;'>У вас нет доступа</div>";
                    }
                    else
                    {
                        using (var db = new dbEntities())
                        {
                            var q = from b in db.comments
                                    select b;
                            foreach (var comment in q)
                            {
                                bool   banned = false;
                                string ip     = comment.Ip;

                                var q2 = from a in db.banlists
                                         where a.Ip == ip
                                         select a;
                                foreach (var ban in q2)
                                {
                                    banned = true;
                                }
                                if (banned == false)
                                {
                                    result += string.Format("<div class=comment><div class=comment-name>{0}</div><div class=comment-time>{1}</div><div style='clear:both;'></div><p class=comment-text>{2}</p>",
                                                            comment.Name, comment.Time, comment.Text);
                                    result += string.Format("<form action=actions/admin/delcomment.aspx><input type=hidden value={0} name=Id /><input type=hidden value={2} name=Url /><input type=submit value='Удалить отзыв'></form><form action=actions/admin/banip.aspx><input type=hidden value={1} name=userIp /><input type=hidden value={2} name=Url /><input type=submit value='Заблокировать пользователя'></form></div>",
                                                            comment.Id, comment.Ip, Request.Url);
                                }
                            }
                        }
                    }
                    return(result);
                }

                default: return("<div style='font-size:20px; text-align:center; padding-top:20px;'>Слева находиться список доступных вам функций</div>");
                }
            }
        }