public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/html"; List <Good> list = new List <Good>(); PersonMng.GetGood(ref list); var Data = new { goods = list }; string html = CommonHelper.RenderHtml("products.html", Data); context.Response.Write(html); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/html"; if (context.Request["phone"] == null) { return; } string phone = context.Request["phone"]; Person person = new Person(); AdminMng.QueryPersonByPhone(phone, ref person); List <Value> list = new List <Value>(); PersonMng.GetValue(person.Id, ref list); list.Reverse(0, list.Count); var Data = new { values = list, value = person.Value }; string html = CommonHelper.RenderHtml("valueHistory.html", Data); context.Response.Write(html); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/html"; Person person = new Person(); person.Phone = context.Request["phone"]; person.Psd = context.Request["psd"]; person.IsAdmin = false; int res = PersonMng.Reg(person); if (res == 0) { context.Response.Write("<script>alert('注册成功');window.location.href='mHandler.ashx';</script>"); } else if (res == -1) { context.Response.Write("<script>alert('注册失败');window.location.href='mHandler.ashx';</script>"); } else { context.Response.Write("<script>alert('未知错误');window.location.href='mHandler.ashx';</script>"); } }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/html"; if (context.Request["goodId"] == null || context.Request["phone"] == null) { return; } Person person = new Person(); AdminMng.QueryPersonByPhone(context.Request["phone"], ref person); Good good = new Good(); PersonMng.GetGoodById(Convert.ToInt32(context.Request["goodId"]), ref good); Buy buy = new Buy(); buy.PersonId = person.Id; buy.GoodId = good.Id; buy.IsCheck = false; buy.Num = Convert.ToInt32(context.Request["num"]); buy.Date = System.DateTime.Now.ToString(); PersonMng.AddBuy(buy); context.Response.Redirect("goodHandler.ashx"); return; }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/html"; Person person = new Person(); AdminMng.QueryPersonByPhone(context.Request["phone"], ref person); /* * if (context.Request["goodId"] != null) * { * Good good = new Good(); * PersonMng.GetGoodById(Convert.ToInt32(context.Request["goodId"]), ref good); * Buy buy = new Buy(); * buy.PersonId = person.Id; * buy.GoodId = good.Id; * buy.IsCheck = false; * buy.Num = Convert.ToInt32(context.Request["num"]); * buy.Date = System.DateTime.Now.ToString(); * PersonMng.AddBuy(buy); * context.Response.Redirect("goodHandler.ashx"); * return; * } * if (person.IsAdmin == true) * { * List<Person> p = new List<Person>(); * List<Good> g = new List<Good>(); * List<Buy> b = new List<Buy>(); * AdminMng.GetBuyAll(ref b, ref g, ref p); * List<BuyShow> bss = new List<BuyShow>(); * for (int i = 0; i < p.Count; ++i) * { * BuyShow bs = new BuyShow(); * bs.person = p[i]; * bs.good = g[i]; * bs.buy = b[i]; * bs.sum = b[i].Num * g[i].Value; * bss.Add(bs); * } * bss.Reverse(0, bss.Count); * var Data = new { data = bss }; * string html = CommonHelper.RenderHtml("check.html", Data); * context.Response.Write(html); * } * else * {*/ List <Person> p = new List <Person>(); List <Good> g = new List <Good>(); List <Buy> b = new List <Buy>(); PersonMng.GetBuy(person.Id, ref b, ref g, ref p); List <BuyShow> bss = new List <BuyShow>(); for (int i = 0; i < p.Count; ++i) { BuyShow bs = new BuyShow(); bs.person = p[i]; bs.good = g[i]; bs.buy = b[i]; bs.sum = b[i].Num * g[i].Value; bss.Add(bs); } bss.Reverse(0, bss.Count); var Data = new { data = bss }; string html = CommonHelper.RenderHtml("history.html", Data); context.Response.Write(html); //} }