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");
            }
        }
        public void ProcessRequest(HttpContext context)
        {
            if (context.Session["id"] != null)
            {
                context.Response.ContentType = "text/html";
                string    news_id  = context.Request.QueryString["news_id"];
                string    temp     = File.ReadAllText(context.Server.MapPath("drugstore_admin_news_save.html"));
                NewsModel news     = NewsBLL.GetANews(news_id);
                int       newsType = news.NewsType;
                temp = temp.Replace("@news_title", news.NewsTitle);
                temp = temp.Replace("@news_content", news.NewsContent);


                List <NewsTypeModel> newsTypeList = NewsTypeBLL.GetNewsList();
                StringBuilder        sb           = new StringBuilder();
                string selectedHtml = "";
                foreach (NewsTypeModel item in newsTypeList)
                {
                    if (newsType == item.NewsTypeid)
                    {
                        selectedHtml = "selected = 'true'";
                    }
                    sb.AppendFormat("<option value='{0}' {2}>{1}</option>", item.NewsTypeid.ToString(), item.NewsTypename, selectedHtml);
                    selectedHtml = "";
                }
                temp = temp.Replace("@newstype_content", sb.ToString());
                temp = temp.Replace("@News_id", news_id);
                temp = temp.Replace("@admin", context.Session["admin_name"].ToString());
                context.Response.Write(temp);
            }
            else
            {
                context.Response.Redirect("~/admin_login.html");
            }
        }
Exemplo n.º 3
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/html";
            string type = "全部新闻";
            string temp = File.ReadAllText(context.Server.MapPath("drugstore_news.html"));

            //
            List <NewsModel> newsList = new List <NewsModel>();

            if (context.Request.QueryString["type"] != null)
            {
                int newsType = Int32.Parse(context.Request.QueryString["type"].ToString());
                newsList = NewsBLL.GetNewsListByType(newsType);
            }
            else
            {
                newsList = NewsBLL.GetHotNewsList();
            }

            StringBuilder sb = new StringBuilder();

            int count = 1;

            if (newsList != null)
            {
                foreach (NewsModel item in newsList)
                {
                    //item["News_newstype"]

                    string newsTypeName = NewsTypeBLL.GetNameById(item.NewsType);
                    sb.AppendFormat("<tr><td>{0}</td><td><a href='ProcessNewsDetail.ashx?news_id={1}'>{2}</a></td><td>{3}</td><td>{4}</td></tr>", count, item.NewsId, item.NewsTitle, item.NewsViewCount.ToString(), newsTypeName);
                    count++;
                }
            }


            List <NewsTypeModel> newsTypeList = NewsTypeBLL.GetNewsList();
            StringBuilder        sb3          = new StringBuilder();

            foreach (NewsTypeModel item in newsTypeList)
            {
                sb3.AppendFormat("<a href='ProcessNews.ashx?type={0}' class='list-group-item'>{1}</a>", item.NewsTypeid, item.NewsTypename);
            }


            temp = temp.Replace("@news_type", sb3.ToString());
            temp = temp.Replace("@type", type);
            temp = temp.Replace("@content", sb.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);
        }
Exemplo n.º 4
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/html";
            if (context.Session["id"] != null)
            {
                string temp = File.ReadAllText(context.Server.MapPath("drugstore_admin_news_add.html"));

                List <NewsTypeModel> newsTypeList = NewsTypeBLL.GetNewsList();
                StringBuilder        sb           = new StringBuilder();
                foreach (NewsTypeModel item in newsTypeList)
                {
                    sb.AppendFormat("<option value='{0}'>{1}</option>", item.NewsTypeid.ToString(), item.NewsTypename);
                }
                temp = temp.Replace("@newstype_content", sb.ToString());
                temp = temp.Replace("@admin", context.Session["admin_name"].ToString());
                context.Response.Write(temp);
            }
            else
            {
                context.Response.Redirect("~/admin_login.html");
            }
        }