日期:2014-05-17 浏览次数:20423 次
[HttpPost] public ActionResult Index(Orders order, FormCollection formcollection) { OrderLines orderline = new OrderLines(); OrderLineDetails orderlinedetail = new OrderLineDetails(); order.OrderId = System.DateTime.Now.ToString("yyMMddHHmmssffff"); orderline.OrderLineId = System.DateTime.Now.ToString("yyMMddHHmmssffff"); orderlinedetail.OrderLineDetailId = System.DateTime.Now.ToString("yyMMddHHmmssffff"); order.ShippingConsignee = Request.Form["consignee"].ToString(); order.ShippingPostCode = Request.Form["postcode"].ToString(); order.ShippingTel = Request.Form["tel"].ToString(); order.ShippingMobile = Request.Form["mobile"].ToString(); order.ShippingAddressInfo = Request.Form["address"].ToString(); order.ShippingProvince = Request.Form["province"]; order.ShippingCity = Request.Form["city"]; order.ShippingDistrict = Request.Form["district"]; order.ShippingMobile = Request.Form["mobile"].ToString(); order.ShippingPostCode = Request.Form["postcode"].ToString(); order.MemberEmail = Request.Form["email"]; order.Remark = Request.Form["fq"] + ","; ViewData["oid"] = order.OrderId; ViewProductDetail product = datacontext.GetProduct(Request.Form["productid"]); orderline.Price = product.DetailPrice; orderline.OrderId = order.OrderId; orderlinedetail.OrderId = order.OrderId; orderlinedetail.OrderLineId = orderline.OrderLineId; orderlinedetail.ProductDetailCode = product.DetailCode; orderlinedetail.ProductDetailName = product.DetailName; orderlinedetail.Size = Request.Form["ringsize"]; if (Request.Form["Message1"] != "") { order.Remark += Request.Form["Message1"]; } order.OrderFrom = "工行商城"; if (Request.Form["invoice_title"] != "") { order.InvoiceContent = Request.Form["invoice_title"]; } UpdateModel(order); datacontext.Add(order); UpdateModel(orderline); datacontext.Add(orderline); UpdateModel(orderlinedetail); datacontext.Add(orderlinedetail); datacontext.Save(); return RedirectToAction("Details", "Order", new { orderid = order.OrderId }); }
//添加订单 public void Add(Orders order) { using (DavidnileDataContext datacontext = new DavidnileDataContext()) { datacontext.Orders.InsertOnSubmit(order); } } //添加订单信息 public void Add(OrderLines orderline) { using (DavidnileDataContext datacontext = new DavidnileDataContext()) { datacontext.OrderLines.InsertOnSubmit(orderline); } } //添加详细订单信息 public void Add(OrderLineDetails orderlinedetail) { using (DavidnileDataContext datacontext = new DavidnileDataContext()) { datacontext.OrderLineDetails.InsertOnSubmit(orderlinedetail); } } //信息保存 public void Save() { using (Davi