public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; DTcms.BLL.IntegralManage bllIntegralManage = new BLL.IntegralManage(); DTcms.BLL.BarCode bllBarCode = new BLL.BarCode(); DTcms.BLL.BarCodeCreateRecord bllBarCodeCreateRecord = new BLL.BarCodeCreateRecord(); DTcms.BLL.GoodCategory bllGoodCategory = new BLL.GoodCategory(); string type = context.Request.QueryString["type"]; switch (type) { case "select": //int pageIndex = int.Parse(context.Request.Form["page"]); //int pageSize = int.Parse(context.Request.Form["rows"]); List <Model.IntegralManage> listIntegralManage = bllIntegralManage.GetList(); List <Model.BarCode> listBarCode = bllBarCode.GetList(); List <Model.BarCodeCreateRecord> listBarCodeCreateRecord = bllBarCodeCreateRecord.GetList(); List <Model.GoodCategory> listGoodCategory = bllGoodCategory.GetList(); var query = listIntegralManage.Join(listBarCode, i => i.IntegralCode, b => b.IntegralCode, (i, b) => new { IntegralManageID = i.IntegralManageID, IntegralCode = i.IntegralCode, CreateTime = i.CreateTime, Remark = i.Remark, BarCodeCreateRecordID = b.BarCodeCreateRecordID }) .Join(listBarCodeCreateRecord, a => a.BarCodeCreateRecordID, c => c.BarCodeCreateRecordID, (a, c) => new { IntegralManageID = a.IntegralManageID, IntegralCode = a.IntegralCode, CreateTime = a.CreateTime, Remark = a.Remark, GoodCategoryID = c.GoodCategoryID }) .Join(listGoodCategory, d => d.GoodCategoryID, g => g.GoodCategoryID, (d, g) => new { IntegralManageID = d.IntegralManageID, IntegralCode = d.IntegralCode, CreateTime = d.CreateTime, Remark = d.Remark, IntegralRatio = g.IntegralRatio }); if (context.Request.QueryString["code"] != null) { query = query.Where(i => i.IntegralCode == context.Request.QueryString["code"]); } //query = query.Join(listBarCodeCreateRecord, i => i.BarCodeCreateRecordID, c => c.BarCodeCreateRecordID, (i, c) => new { IntegralManageID = i.IntegralManageID, IntegralCode = i.IntegralCode, CreateTime = i.CreateTime, Remark = i.Remark, GoodCategoryID = c.GoodCategoryID }); //query = query.Join(listBarCodeCreateRecord, i => i.BarCodeCreateRecordID, c => c.BarCodeCreateRecordID, (i, c) => new { aaa=i.BarCodeCreateRecordID}); string json = JsonConvert.SerializeObject(query); context.Response.Write(json); //context.Response.Write("{\"total\":" + "\"" + 50 + "\"" + ",\"rows\":" + json + "}"); break; } }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; DTcms.BLL.GoodCategory bll = new BLL.GoodCategory(); string type = context.Request.QueryString["type"]; DataSet ds = null; switch (type) { case "select": int pageIndex = int.Parse(context.Request.Form["page"].ToString()); int pageSize = int.Parse(context.Request.Form["rows"].ToString()); try { int recordCount = 0; ds = bll.GetList(pageSize, pageIndex, "", "GoodCategoryID", out recordCount); IsoDateTimeConverter timeFormat = new IsoDateTimeConverter(); timeFormat.DateTimeFormat = "yyyy-MM-dd HH:mm:ss"; string json = JsonConvert.SerializeObject(ds.Tables[0], new DataTableConverter(), timeFormat); context.Response.Write("{\"total\":" + "\"" + recordCount + "\"" + ",\"rows\":" + json + "}"); } catch (Exception) { } break; case "del": bll.Delete(context.Request.QueryString["ids"]); break; case "exit": ds = bll.GetGoodCategoryByName(context.Request.Form["param"]); if (ds == null) { context.Response.Write("{\"info\":\"验证通过!\",\"status\":\"y\"}"); } else { context.Response.Write("{\"info\":\"该商品已存在!\",\"status\":\"n\"}"); } break; } }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; BLL.BarCodeCreateRecord bllBarCodeCreateRecord = new BLL.BarCodeCreateRecord(); BLL.GoodCategory bllGoodCategory = new BLL.GoodCategory(); List <Model.BarCodeCreateRecord> listBarCodeCreateRecord = bllBarCodeCreateRecord.GetList(); List <Model.GoodCategory> listGoodCategory = bllGoodCategory.GetList(); var query = listGoodCategory.Where(g => g.GoodCategoryName == "旭贝尔乳基婴儿配方奶粉 1段(0-12个月)铁罐900g").Join(listBarCodeCreateRecord, g => g.GoodCategoryID, b => b.GoodCategoryID, (g, b) => new { g.Standard }).ToList(); //listBarCodeCreateRecord.Join(listGoodCategory,b=>b.GoodCategoryID,g=>g.GoodCategoryID); int param = int.Parse(context.Request.Form["param"]); if (query.Count() == 0 || param % query[0].Standard > 0) { context.Response.Write("{ \"info\":\"请输入" + query[0].Standard + "的倍数\", \"status\":\"n\" }"); } else { context.Response.Write("{ \"info\":\"\", \"status\":\"y\" }"); } }
public void ExcelOut(HttpContext context, string id) { BLL.BarCodeCreateRecord bllbcr = new BLL.BarCodeCreateRecord(); BLL.GoodCategory bllgc = new BLL.GoodCategory(); List <Model.GoodCategory> gList = bllgc.GetList(); List <Model.BarCodeCreateRecord> bList = bllbcr.GetList(); var model = bList.Where(b => b.BarCodeCreateRecordID == int.Parse(id)).ToList(); //var model = bList.Join(gList, b => b.GoodCategoryID, g => g.GoodCategoryID, (b, g) => new { GoodCategoryName = g.GoodCategoryName, BarCodeCreateRecordID = b.BarCodeCreateRecordID, DownLoad=b.DownLoad }).Where(b => b.BarCodeCreateRecordID == int.Parse(id)).ToList(); //Model.BarCodeCreateRecord model = bllbcr.GetModel(id); string aaa = context.Server.MapPath("/DownLoad/"); string FullFileName = aaa + model[0].DownLoad + ".txt"; FileInfo DownloadFile = new FileInfo(FullFileName); context.Response.Clear(); context.Response.ClearHeaders(); context.Response.Buffer = false; context.Response.ContentType = "application/octet-stream"; //context.Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(model[0].GoodCategoryName+".txt", System.Text.Encoding.UTF8)); context.Response.AppendHeader("Content-Disposition", "attachment;filename=" + model[0].RetrospectCode + ".txt"); context.Response.AppendHeader("Content-Length", DownloadFile.Length.ToString()); context.Response.WriteFile(DownloadFile.FullName); context.Response.Flush(); context.Response.End(); }