using System; using System.Collections.Generic; using System.Linq; using System.Web; using Warehouse.Models; using Z.EntityFramework.Plus; namespace Warehouse.DAL.Shipment { public class ShipmentDal { public bool ShipmentContainer(string Container ,tcontainer Shipmentinfo,List StockInfo) { using (var context = new whModel()) { var container = context.tcontainers.Where(a => a.ContainerNo == Container); if (container == null) { return false; } tcontainer t1 = container.FirstOrDefault(); t1.CustomerNo = Shipmentinfo.CustomerNo; t1.Driver = Shipmentinfo.Driver; t1.DriverPhone = Shipmentinfo.DriverPhone; t1.DriveType = Shipmentinfo.DriveType; t1.MaterialCompany = Shipmentinfo.MaterialCompany; t1.PlateNo = Shipmentinfo.PlateNo; t1.shipmentuser = Shipmentinfo.shipmentuser; t1.DriveNo = Shipmentinfo.DriveNo; string stockids = ""; foreach (var item in StockInfo) { stockids += item.stockid + ","; } stockids = stockids.Remove(stockids.Length - 1, 1); string sql = "update wh.tstockinlog set status =3 where id in("+stockids+")"; context.Database.ExecuteSqlCommand(sql); context.SaveChanges(); return true; } } } }