public static ShippingDetail SaveOrUpdateShippingDetail(VehicleDataContext db,long shipId, Entity.Item item, string engineNumber, int status, bool voucher, string ex, ItemInstance itemInstance, string itemType, string color, string branchCode, string orderNumber) { //IDao<Shippingdetail, long> dao; //IDao<ShippingHeader, long> shdao; //List<Shippingdetail> list; ShippingDetail SD = null; //dao = DaoFactory.GetDao<Shippingdetail, long>(); //dao.SetCriteria(new ICriterion[] { Expression.And(Expression.Eq("Shippingheader.Id", shipId), Expression.Eq("Enginenumber", engineNumber.Trim())) }); //list = dao.GetAll(); SD = db.ShippingDetails.FirstOrDefault( p => p.ShippingId == shipId && p.EngineNumber == engineNumber.Trim()); if (SD == null) { SD = new ShippingDetail(); SD.ShippingId = shipId; SD.EngineNumber = engineNumber; db.ShippingDetails.InsertOnSubmit(SD); } SD.ItemType = itemType; SD.Color = color; SD.Item = item; SD.BranchCode = branchCode; SD.OrderNumber = orderNumber; SD.Status = status; SD.VoucherStatus = voucher? 1:0; SD.ItemCode = item.ItemCode; SD.VMEPResponseDate = DateTime.MinValue; if (itemInstance != null) SD.ProductInstanceId = itemInstance.ItemInstanceId; //if (!string.IsNullOrEmpty(ex)) SD.Exception = ex; return SD; }
private void attach_ShippingDetails(ShippingDetail entity) { this.SendPropertyChanging("ShippingDetails"); entity.Item = this; }
private void detach_ShippingDetails(ShippingDetail entity) { this.SendPropertyChanging("ShippingDetails"); entity.ItemInstance = null; }
private void detach_ShippingDetails(ShippingDetail entity) { this.SendPropertyChanging("ShippingDetails"); entity.ShippingHeader = null; }