public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/html";

            if (context.Session["id"] != null)
            {
                string temp = File.ReadAllText(context.Server.MapPath("drugstore_admin_settings.html"));
                List <GoodsTypeModel> dt = GoodsTypeBLL.GetGoodsTypeList();
                StringBuilder         sb = new StringBuilder();
                if (dt != null)
                {
                    foreach (GoodsTypeModel item in dt)
                    {
                        sb.AppendFormat("<tr><td>{0}</td><td>{1}</td><td><a href='ProcessAdminSettingsForm.ashx?goods_id_delete={0}'class='btn btn-danger'>删除</a></td></tr>", item.GoodsTypeid, item.GoodsTypename);
                    }
                }


                temp = temp.Replace("@product_content", sb.ToString());

                List <NewsTypeModel> dt2 = NewsTypeBLL.GetNewsList();
                StringBuilder        sb2 = new StringBuilder();
                foreach (NewsTypeModel item in dt2)
                {
                    sb2.AppendFormat("<tr><td>{0}</td><td>{1}</td><td><a href='ProcessAdminSettingsForm.ashx?news_id_delete={0}'class='btn btn-danger'>删除</a></td></tr>", item.NewsTypeid, item.NewsTypename);
                }
                temp = temp.Replace("@admin", context.Session["admin_name"].ToString());
                temp = temp.Replace("@news_content", sb2.ToString());
                context.Response.Write(temp);
            }
            else
            {
                context.Response.Redirect("~/admin_login.html");
            }
        }
Esempio n. 2
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/html";
            string temp = File.ReadAllText(context.Server.MapPath("drugstore_index.html"));



            List <GoodModel> list1 = GoodsBLL.GetTop5SaleGoods();
            List <GoodModel> list2 = GoodsBLL.GetTop5NewGoods();

            StringBuilder         sb1           = new StringBuilder();
            StringBuilder         sb2           = new StringBuilder();
            StringBuilder         sb3           = new StringBuilder();
            List <GoodsTypeModel> goodsTypeList = GoodsTypeBLL.GetGoodsTypeList();
            int count = 1;

            foreach (GoodModel item in list1)
            {
                sb1.AppendFormat(@"<tr><td>{0}</td><td>{1}</td><td>{2}</td></tr>", count, item.GoodsName, item.GoodsEffect);
                count++;
            }
            count = 1;
            foreach (GoodModel item in list2)
            {
                sb2.AppendFormat(@"<tr><td>{0}</td><td>{1}</td><td>{2}</td></tr>", count, item.GoodsName, item.GoodsEffect);
                count++;
            }
            foreach (GoodsTypeModel item in goodsTypeList)
            {
                sb3.AppendFormat("<a href='drugstore_search.ashx?effect={0}' class='list-group-item'>{1}</a>", item.GoodsTypeid, item.GoodsTypename);
            }
            temp = temp.Replace("@content1", sb1.ToString());
            temp = temp.Replace("@content2", sb2.ToString());
            temp = temp.Replace("@goods_type", sb3.ToString());
            if (context.Session["users_id"] != null)
            {
                temp = temp.Replace("@user_name", context.Session["user_name"].ToString());
            }
            else
            {
                temp = temp.Replace("@user_name", "游客");
            }

            context.Response.Write(temp);
        }
Esempio n. 3
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/html";
            if (context.Session["id"] != null)
            {
                int    id   = context.Request.QueryString["goods_id"] == null ? 0 : Int32.Parse(context.Request.QueryString["goods_id"]);
                string temp = File.ReadAllText(context.Server.MapPath("admin_product_save.html"));

                GoodModel good = GoodsBLL.GetAGoodDetail(id);
                temp = temp.Replace("@Goods_name", good.GoodsName);
                temp = temp.Replace("@Goods_effect", good.GoodsEffect);
                temp = temp.Replace("@Goods_price", good.GoodsPrice.ToString());
                temp = temp.Replace("@Goods_norms", good.GoodsNorms.ToString());
                temp = temp.Replace("@Goods_factory", good.GoodsFactory.ToString());
                temp = temp.Replace("@Goods_stock", good.GoodsStock.ToString());
                temp = temp.Replace("@Goods_id", id.ToString());

                List <GoodsTypeModel> goodsType = GoodsTypeBLL.GetGoodsTypeList();
                StringBuilder         sb        = new StringBuilder();
                string selectedHtml             = "";
                foreach (GoodsTypeModel item in goodsType)
                {
                    if (good.GoodsGoodsType == item.GoodsTypeid)
                    {
                        selectedHtml = "selected = 'true'";
                    }
                    sb.AppendFormat(@"<option value='{0}' {2}>{1}</option>", item.GoodsTypeid, item.GoodsTypename, selectedHtml);
                    selectedHtml = "";
                }

                temp = temp.Replace("@admin", context.Session["admin_name"].ToString());
                temp = temp.Replace("@product_type", sb.ToString());
                context.Response.Write(temp);
            }
            else
            {
                context.Response.Redirect("~/admin_login.html");
            }
        }
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/html";
            if (context.Session["id"] != null)
            {
                string temp = File.ReadAllText(context.Server.MapPath("drugstore_admin_product_add.html"));

                List <GoodsTypeModel> goodsTypeList = GoodsTypeBLL.GetGoodsTypeList();
                StringBuilder         sb            = new StringBuilder();
                foreach (GoodsTypeModel item in goodsTypeList)
                {
                    sb.AppendFormat(@"<option value='{0}'>{1}</option>", item.GoodsTypeid, item.GoodsTypename);
                }
                temp = temp.Replace("@product_type", sb.ToString());
                temp = temp.Replace("@admin", context.Session["admin_name"].ToString());
                context.Response.Write(temp);
            }
            else
            {
                context.Response.Redirect("~/admin_login.html");
            }
        }