public override string export(HttpContext context) { String yearMonth = context.Request.Params["yearMonth"].ToString(); String style = context.Request.Params["style"].ToString(); if (!String.IsNullOrWhiteSpace(yearMonth)) { if (style == "cp") { DataTable dt = new BLL.OrdersDetailBLL().HuiZongOrdersDetail(Convert.ToInt32(yearMonth)); var list = MyData.Utils.ConvertToList <OrdersDetail>(dt).ToList(); String savePath = @"\DataExport\Chanpin_HZ" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xls"; ExcelHelper.Excel_ChanpinHZ(yearMonth, list, System.Web.HttpContext.Current.Server.MapPath(@"\Template\Chanpin_HZ.xls"), System.Web.HttpContext.Current.Server.MapPath(savePath)); return(savePath); } else if (style == "dd") { DataTable dt = new BLL.OrdersDetailBLL().HuiZongOrders(Convert.ToInt32(yearMonth)); String savePath = @"\DataExport\Dingdan_HZ" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xls"; ExcelHelper.Excel_DingdanHZ(yearMonth, dt, System.Web.HttpContext.Current.Server.MapPath(@"\Template\Dingdan_HZ.xls"), System.Web.HttpContext.Current.Server.MapPath(savePath)); return(savePath); } } return(null); }
public String HuiZongOrders(HttpContext context) { String yearMonth = context.Request.Params["yearMonth"].ToString(); if (!String.IsNullOrWhiteSpace(yearMonth)) { DataTable dt = new BLL.OrdersDetailBLL().HuiZongOrders(Convert.ToInt32(yearMonth)); return(MyData.Utils.EasyuiDataGridJson(dt)); } return(null); }
public String getDetailByOrdersId(HttpContext context) { Model.OrdersDetail ordersDetail = new Model.OrdersDetail(); String orderId = context.Request.Params["orderId"].ToString(); if (!String.IsNullOrWhiteSpace(orderId)) { ordersDetail.OrdersId = orderId; } else { ordersDetail.OrdersId = ""; } DataTable dt = new BLL.OrdersDetailBLL().GetByOrdersId(ordersDetail); return(MyData.Utils.EasyuiDataGridJson(dt)); }
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 override String del(HttpContext context) { var id = context.Request.Params["id"].ToString(); var orderId = context.Request.Params["OrdersId"].ToString(); String ids = ""; int nums = 0; decimal allprice = 0; if (new BLL.OrdersDetailBLL().Delete(id)) { Model.OrdersDetail ordersDetail = new Model.OrdersDetail(); ordersDetail.OrdersId = orderId; 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("删除失败"); }