public override String get(HttpContext context) { BLL.ProductsBLL productsBLL = new BLL.ProductsBLL(); Model.Products products = new Model.Products(); string[] st = context.Request.Params["wherestr"].ToString().Split(','); products.ProductName = st[0]; DataTable dt = productsBLL.GetAllProducts(products); return(MyData.Utils.EasyuiDataGridJson(dt)); }
public override String update(HttpContext context) { BLL.ProductsBLL productsBLL = new BLL.ProductsBLL(); Model.Products products = new Model.Products(); products.Id = context.Request.Params["Id"].ToString(); products.ProductName = context.Request.Params["ProductName"].ToString(); products.Unit = context.Request.Params["Unit"].ToString(); products.UnitPrice = Convert.ToDecimal(context.Request.Params["UnitPrice"].ToString()); products.UpdatePerson = userName; products.State = Convert.ToInt32(context.Request.Params["State"].ToString()); if (productsBLL.Update(products)) { return("0"); } else { return("保存失败"); } }
public override String add(HttpContext context) { BLL.OrdersDetailBLL ordersDetailBll = new BLL.OrdersDetailBLL(); Model.OrdersDetail ordersDetail = new Model.OrdersDetail(); var productId = context.Request.Params["ProductId"].ToString(); var orderId = context.Request.Params["OrdersId"].ToString(); DataTable dt = new BLL.ProductsBLL().getProductsById(productId); if (dt.Rows.Count == 0) { return("产品不存在!"); } DataRow dr = dt.Rows[0]; ordersDetail.Id = System.Guid.NewGuid().ToString(); ordersDetail.OrdersId = orderId; ordersDetail.ProductId = productId; ordersDetail.Num = Convert.ToInt32(context.Request.Params["Num"].ToString()); ordersDetail.ProductName = dr["ProductName"].ToString(); ordersDetail.Price = Convert.ToDecimal(dr["UnitPrice"].ToString()) * Convert.ToInt32(context.Request.Params["Num"].ToString()); ordersDetail.UnitPrice = Convert.ToDecimal(dr["UnitPrice"].ToString()); ordersDetail.CreatePerson = userName; ordersDetail.UpdatePerson = userName; ordersDetail.CreateTime = DateTime.Now; ordersDetail.UpdateTime = DateTime.Now; ordersDetail.State = -1; String ids = ""; int nums = 0; decimal allprice = 0; if (new BLL.OrdersDetailBLL().Insert(ordersDetail)) { DataTable dd = new BLL.OrdersDetailBLL().GetByOrdersId(ordersDetail); foreach (DataRow dr1 in dd.Rows) { ids += dr1["ProductId"].ToString() + ","; nums += Convert.ToInt32(dr1["Num"].ToString()); allprice += Convert.ToDecimal(dr1["Price"].ToString()); } return(ids + "$共" + nums + "件$" + allprice); } return("保存失败"); }
public String getProducts(HttpContext context) { DataTable dt = new BLL.ProductsBLL().getProducts(); return(MyData.Utils.EasuuiComboxJson(dt)); }