public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; HttpPostedFile files = context.Request.Files[0]; // string url = context.Server.MapPath("~/"); string name = context.Request["GoodsName"]; int typeid = int.Parse(context.Request["TypeID"]); int cfid = int.Parse(context.Request["CFID"]); using (MYAdminManagerEntities1 mb = new MYAdminManagerEntities1()) { Goods good = new Goods(); GoodsType type = mb.GoodsType.Find(typeid); CFplace cf = mb.CFplace.Find(cfid); files.SaveAs(context.Server.MapPath("~/") + "\\attres\\imgs\\" + files.FileName); if (File.Exists(context.Server.MapPath("~/") + "\\attres\\imgs\\" + files.FileName)) { good.GoodsName = name; good.img = files.FileName; good.CFID = cf.CFID; good.TypeID = type.TypeID; mb.Goods.Add(good); if (mb.SaveChanges() > 0) { context.Response.Write("ok"); } } } }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; int ids = int.Parse(context.Request["ids"]); string pwd = context.Request["pwd1"]; string rpwd = context.Request["rpwd1"]; using (MYAdminManagerEntities1 mb = new MYAdminManagerEntities1()) { AdminUser user = mb.AdminUser.Find(ids); if (pwd == user.UserPwd) { user.UserPwd = rpwd; if (mb.SaveChanges() > 0) { context.Response.Write("ok"); } else { context.Response.Write("no"); } } else { context.Response.Write("no"); } } }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "application/json"; using (MYAdminManagerEntities1 mb = new MYAdminManagerEntities1()) { var list = mb.GoodsType.Select(g => new { g.TypeID, g.TypeName }).ToList(); context.Response.Write(JsonConvert.SerializeObject(list)); } }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "application/json"; using (MYAdminManagerEntities1 mb = new MYAdminManagerEntities1()) { var list = mb.AdminUser.Select(g => new { g.UserID, g.UserName, g.UserPhone, g.UserPwd }).Where(g => g.UserID == 1).ToList(); context.Response.Write(JsonConvert.SerializeObject(list)); } }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "application/json"; using (MYAdminManagerEntities1 mb = new MYAdminManagerEntities1()) { Buyer buy = new Buyer(); var list = mb.Buyer.Select(g => new { g.BuyID, g.BuyerName, g.HZTime }).OrderByDescending(g => g.HZTime).ToList(); context.Response.Write(JsonConvert.SerializeObject(list)); } }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; string name = context.Request["name"]; using (MYAdminManagerEntities1 mb = new MYAdminManagerEntities1()) { CFplace cf = new CFplace(); cf.CFPlaces = name; mb.CFplace.Add(cf); if (mb.SaveChanges() > 0) { context.Response.Write("ok"); } } }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; int ids = int.Parse(context.Request.QueryString["ids"]); string name = context.Request.QueryString["name"]; using (MYAdminManagerEntities1 mb = new MYAdminManagerEntities1()) { GoodsType goods = mb.GoodsType.Find(ids); goods.TypeName = name; if (mb.SaveChanges() > 0) { context.Response.Write("ok"); } } }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; int ids = int.Parse(context.Request.QueryString["ids"]); using (MYAdminManagerEntities1 mb = new MYAdminManagerEntities1()) { Buyer buyer = mb.Buyer.Find(ids); mb.Buyer.Remove(buyer); //var userid= mb.AdminUser.FirstOrDefault(model => model.UserID == user.UserID); //user.UserID = int.Parse(userid.ToString()); if (mb.SaveChanges() > 0) { context.Response.Write("ok"); } } }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; string name = context.Request["name"]; string times = context.Request["time"]; using (MYAdminManagerEntities1 mb = new MYAdminManagerEntities1()) { Buyer buyer = new Buyer(); buyer.BuyerName = name; buyer.HZTime = DateTime.Parse(times); mb.Buyer.Add(buyer); if (mb.SaveChanges() > 0) { context.Response.Write("ok"); } } }
public void ProcessRequest(HttpContext context) { int ids = int.Parse(context.Request.QueryString["ids"]); string name = context.Request["name"]; string places = context.Request["places"]; using (MYAdminManagerEntities1 mb = new MYAdminManagerEntities1()) { Goods good = mb.Goods.Find(ids); var list = mb.CFplace.Select(c => new { c.CFID, c.CFPlaces }).Where(cfs => cfs.CFPlaces == places).ToList(); good.GoodsName = name; good.CFID = list[0].CFID; if (mb.SaveChanges() > 0) { context.Response.Write("ok"); } } }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; int ids = int.Parse(context.Request.QueryString["ids"]); string name = context.Request["name"]; string phone = context.Request["phone"]; using (MYAdminManagerEntities1 mb = new MYAdminManagerEntities1()) { AdminUser user = mb.AdminUser.Find(ids); user.UserName = name; user.UserPhone = phone; if (mb.SaveChanges() > 0) { context.Response.Write("ok"); } } }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "application/json"; int ids = int.Parse(context.Request.QueryString["ids"]); using (MYAdminManagerEntities1 mb = new MYAdminManagerEntities1()) { if (ids == 0) { var list = mb.GoodsType.Select(g => new { g.TypeID, g.TypeName }).ToList(); context.Response.Write(JsonConvert.SerializeObject(list)); } else { GoodsType type = mb.GoodsType.Find(ids); var list = mb.GoodsType.Select(g => new { g.TypeID, g.TypeName }).Where(gs => gs.TypeID == type.TypeID && gs.TypeName == type.TypeName).ToList(); context.Response.Write(JsonConvert.SerializeObject(list)); } } }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; string phone = context.Request.QueryString["phone"]; string pwd = context.Request.QueryString["pwd"]; using (MYAdminManagerEntities1 mb = new MYAdminManagerEntities1()) { var user = mb.AdminUser.Select(u => new { u.UserPhone, u.UserPwd }).Where(u => u.UserPhone == phone).ToList(); AdminUser ad = new AdminUser(); ad.UserPhone = user[0].UserPhone; ad.UserPwd = user[0].UserPwd; if (ad.UserPhone == user[0].UserPhone && ad.UserPwd == user[0].UserPwd) { context.Response.Write("ok"); } else { context.Response.Write("no"); } } }