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) { 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); }
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"); } }
void Button1Click(object sender, EventArgs e) { //根据是修改还是新增确定操作 if (this.Text == "货品类别-新增") { //确定关闭窗口,将数据保存到数据库中 //FormGoodTypeBLL tt = new FormGoodTypeBLL(); GoodsType gt = new GoodsType(); gt.GoodsTypeName = textBox1.Text.Trim(); if (gt.GoodsTypeName == "") { MessageBox.Show("未输入类别名称!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } int i_Pid = Int32.Parse(comboBoxTreeView1.Tag.ToString()); if (i_Pid == 0) { gt.GoodsTypePID = 1; } else { gt.GoodsTypePID = i_Pid; } GoodsTypeBLL.AddGoodType(gt); this.Close(); } else { //确定关闭窗口,将数据修改后保存到数据库中 //FormGoodTypeBLL tt = new FormGoodTypeBLL(); GoodsType gt = new GoodsType(); gt.GoodsTypeName = textBox1.Text; gt.GoodsTypePID = Int32.Parse(comboBoxTreeView1.Tag.ToString()); gt.GoodsTypeID = GoodsTypeID; GoodsTypeBLL.ModifyGoodType(gt); this.Close(); } }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/html"; if (context.Session["id"] != null) { string product_id = context.Request.Form["product_id"]; string product_name = context.Request.Form["product_name"]; string product_action = context.Request.Form["product_action"]; string goods_id_delete = context.Request.QueryString["goods_id_delete"]; string news_id = context.Request.Form["news_id"]; string news_name = context.Request.Form["news_name"]; string news_action = context.Request.Form["news_action"]; string news_id_delete = context.Request.QueryString["news_id_delete"]; if (product_action == "0") { if (product_name != null) { int i = GoodsTypeBLL.GoodsType1(product_name); if (i > 0) { context.Response.Write(product_name + "添加成功<a href='ProcessAdminSettings.ashx'>返回设置页面</a>"); //return; } else { context.Response.Write(product_name + "添加失败<a href='ProcessAdminSettings.ashx'>返回设置页面</a>"); //return; } } else { context.Response.Write("添加时请填写类型名<a href='ProcessAdminSettings.ashx'>返回设置页面</a>"); //return; } } else if (product_action == "1") { if (product_id != null && product_name != null) { int i = GoodsTypeBLL.GoodsType2(product_name, product_id); if (i > 0) { context.Response.Write(product_name + "修改成功<a href='ProcessAdminSettings.ashx'>返回设置页面</a>"); //return; } else { context.Response.Write(product_name + "修改失败<a href='ProcessAdminSettings.ashx'>返回设置页面</a>"); //return; } } } else if (goods_id_delete != null) { int i = GoodsTypeBLL.GoodsType3(goods_id_delete); if (i > 0) { context.Response.Write(product_name + "删除成功<a href='ProcessAdminSettings.ashx'>返回设置页面</a>"); //return; } else { context.Response.Write(product_name + "删除失败<a href='ProcessAdminSettings.ashx'>返回设置页面</a>"); //return; } } else if (news_action == "0") { if (news_name != null) { int i = NewsTypeBLL.NewsType2(news_name); if (i > 0) { context.Response.Write(news_name + "添加成功<a href='ProcessAdminSettings.ashx'>返回设置页面</a>"); //return; } else { context.Response.Write(news_name + "添加失败<a href='ProcessAdminSettings.ashx'>返回设置页面</a>"); //return; } } else { context.Response.Write("添加时请填写类型名<a href='ProcessAdminSettings.ashx'>返回设置页面</a>"); //return; } } else if (news_action == "1") { if (news_id != null && news_name != null) { int i = NewsTypeBLL.NewsType1(news_name, news_id); if (i > 0) { context.Response.Write(news_name + "修改成功<a href='ProcessAdminSettings.ashx'>返回设置页面</a>"); //return; } else { context.Response.Write(news_name + "修改失败<a href='ProcessAdminSettings.ashx'>返回设置页面</a>"); //return; } } } else if (news_id_delete != null) { int i = NewsTypeBLL.NewsType3(news_id_delete); if (i > 0) { context.Response.Write(news_name + "删除成功<a href='ProcessAdminSettings.ashx'>返回设置页面</a>"); //return; } else { context.Response.Write(news_name + "删除失败<a href='ProcessAdminSettings.ashx'>返回设置页面</a>"); //return; } } context.Response.Write(product_id + "ProcessAdminSettingsForm" + product_name); } else { context.Response.Redirect("~/admin_login.html"); } }