You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
193 lines
6.0 KiB
193 lines
6.0 KiB
6 months ago
|
using MESClassLibrary.BLL.BasicInfo;
|
||
|
using MESClassLibrary.EFModel;
|
||
|
using System;
|
||
|
using System.Collections.Generic;
|
||
|
using System.Linq;
|
||
|
using System.Web;
|
||
|
|
||
|
namespace MESWebSite.HttpHandlers
|
||
|
{
|
||
|
/// <summary>
|
||
|
/// ProductHandler 的摘要说明
|
||
|
/// </summary>
|
||
|
public class ProductHandler : IHttpHandler
|
||
|
{
|
||
|
|
||
|
HttpRequest Request = null;
|
||
|
HttpResponse Response = null;
|
||
|
|
||
|
public void ProcessRequest(HttpContext context)
|
||
|
{
|
||
|
context.Response.ContentType = "text/plain";
|
||
|
Request = context.Request;
|
||
|
Response = context.Response;
|
||
|
|
||
|
string method = Request.Params["method"];
|
||
|
switch (method)
|
||
|
{
|
||
|
|
||
|
case "QueryList":
|
||
|
QueryList();
|
||
|
break;
|
||
|
case "SaveInfo":
|
||
|
SaveInfo();
|
||
|
break;
|
||
|
case "DelInfo":
|
||
|
DelInfo();
|
||
|
break;
|
||
|
case "QueryForCombobox":
|
||
|
QueryForCombobox();
|
||
|
break;
|
||
|
case "GetComboboxProduct":
|
||
|
GetComboboxProduct();
|
||
|
break;
|
||
|
case "GetComboboxProduct1":
|
||
|
GetComboboxProduct1();
|
||
|
break;
|
||
|
case "GetComboboxDataForStockNo":
|
||
|
GetComboboxDataForStockNo();
|
||
|
break;
|
||
|
default:
|
||
|
break;
|
||
|
|
||
|
}
|
||
|
|
||
|
}
|
||
|
public bool IsReusable
|
||
|
{
|
||
|
get
|
||
|
{
|
||
|
return false;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void QueryList()
|
||
|
{
|
||
|
string page = Request.Params["page"];
|
||
|
string pagesize = Request.Params["rows"];
|
||
|
string stockNo = Request.Params["StockNo"];
|
||
|
string productName = Request.Params["ProductName"];
|
||
|
string partNo = Request.Params["PartNo"];
|
||
|
string productTypeID = Request.Params["ProductTypeID"];
|
||
|
|
||
|
if (string.IsNullOrEmpty(page))
|
||
|
{
|
||
|
page = "0";
|
||
|
}
|
||
|
if (string.IsNullOrEmpty(pagesize))
|
||
|
{
|
||
|
pagesize = "15";
|
||
|
}
|
||
|
ProductBLL bll = new ProductBLL();
|
||
|
Response.Write(bll.SearchInfoAll(page, pagesize, stockNo, productTypeID, productName, partNo));
|
||
|
Response.End();
|
||
|
|
||
|
|
||
|
}
|
||
|
void SaveInfo()
|
||
|
{
|
||
|
string ProductID = Request.Params["ProductID"];
|
||
|
string ProductTypeID = Request.Params["ProductTypeID"];
|
||
|
string StockNo = Request.Params["StockNo"];
|
||
|
string PartName = Request.Params["PartName"];
|
||
|
string ProductName = Request.Params["ProductName"];
|
||
|
string ColorName = Request.Params["ColorName"];
|
||
|
string PartNo = Request.Params["PartNo"];
|
||
|
string Rows = Request.Params["Rows"];
|
||
|
string Cols = Request.Params["Cols"];
|
||
|
string Layers = Request.Params["Layers"];
|
||
|
string PicturePath = Request.Params["PicturePath"];
|
||
|
string Des = Request.Params["Des"];
|
||
|
string isImport = Request.Params["isImport"];
|
||
|
string ProjectID = Request.Params["ProjectID"];
|
||
|
string isHigh = Request.Params["isHigh"];
|
||
|
|
||
|
|
||
|
ProductBLL bll = new ProductBLL();
|
||
|
tb_Product md = new tb_Product();
|
||
|
|
||
|
md.ProductTypeID = ProductTypeID;
|
||
|
md.StockNo = StockNo;
|
||
|
md.PartName = PartName;
|
||
|
md.ProductName = ProductName;
|
||
|
md.ColorName = ColorName;
|
||
|
md.PartNo = PartNo;
|
||
|
md.Rows = String.IsNullOrEmpty(Rows) ? 0 : Convert.ToInt32(Rows);
|
||
|
md.Cols = String.IsNullOrEmpty(Cols) ? 0 : Convert.ToInt32(Cols);
|
||
|
md.Layers = String.IsNullOrEmpty(Layers) ? 0 : Convert.ToInt32(Layers);
|
||
|
md.PicturePath = PicturePath;
|
||
|
md.Des = Des;
|
||
|
md.isImport = String.IsNullOrEmpty(isImport) ? 0 : Convert.ToInt16(isImport);
|
||
|
md.IsHigh = String.IsNullOrEmpty(isHigh) ? 0 : Convert.ToInt16(isHigh);
|
||
|
md.ProjectID = ProjectID;
|
||
|
|
||
|
if (ProductID == "0")
|
||
|
{
|
||
|
//新增
|
||
|
md.ProductID = Guid.NewGuid().ToString();
|
||
|
Response.Write(bll.AddInfo(md) == true ? md.ProductID.ToString() : "false");
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
//修改
|
||
|
md.ProductID = ProductID;
|
||
|
Response.Write(bll.UpdateInfo(md) == true ? md.ProductID.ToString() : "false");
|
||
|
}
|
||
|
Response.End();
|
||
|
}
|
||
|
void DelInfo()
|
||
|
{
|
||
|
string ProductID = Request.Params["ProductID"];
|
||
|
|
||
|
ProductBLL bll = new ProductBLL();
|
||
|
tb_Product md = new tb_Product();
|
||
|
md.ProductID = ProductID;
|
||
|
Response.Write(bll.DeleteInfo(md) == true ? "true" : "false");
|
||
|
Response.End();
|
||
|
|
||
|
}
|
||
|
|
||
|
void QueryForCombobox()
|
||
|
{
|
||
|
string ProductTypeNo = Request.Params["ProductTypeNo"];
|
||
|
string ProductTypeNo1 = Request.Params["ProductTypeNo1"];
|
||
|
|
||
|
ProductBLL bll = new ProductBLL();
|
||
|
Response.Write(bll.GetComboboxData(ProductTypeNo, ProductTypeNo1));
|
||
|
Response.End();
|
||
|
}
|
||
|
|
||
|
void GetComboboxProduct()
|
||
|
{
|
||
|
string ProductTypeNo = Request.Params["ProductTypeNo"];
|
||
|
|
||
|
ProductBLL bll = new ProductBLL();
|
||
|
Response.Write(bll.GetComboboxProduct(ProductTypeNo));
|
||
|
Response.End();
|
||
|
|
||
|
}
|
||
|
|
||
|
void GetComboboxProduct1()
|
||
|
{
|
||
|
string ProductTypeNo = Request.Params["ProductTypeNo"];
|
||
|
|
||
|
ProductBLL bll = new ProductBLL();
|
||
|
Response.Write(bll.GetComboboxProduct1(ProductTypeNo));
|
||
|
Response.End();
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
void GetComboboxDataForStockNo()
|
||
|
{
|
||
|
string ProductTypeNo = Request.Params["ProductTypeNo"];
|
||
|
|
||
|
ProductBLL bll = new ProductBLL();
|
||
|
Response.Write(bll.GetComboboxDataForStockNo(ProductTypeNo));
|
||
|
Response.End();
|
||
|
|
||
|
}
|
||
|
|
||
|
}
|
||
|
}
|