private static void RemoveExistingAdjustment(POSAIData.POSAIEntities db, InventoryQtyAdjustmentRet qbadj) { var xadj = (from i in db.InventoryAdjustments where i.TxnID == qbadj.TxnID select i).FirstOrDefault(); if (xadj == null) { return; } db.InventoryAdjustments.Remove(xadj); }
TrackableCollection <InventoryQtyAdjustmentRet> WalkInventoryQtyAdjustmentRet(IInventoryQtyAdjustmentRetList InventoryQtyAdjustmentRetList) { TrackableCollection <InventoryQtyAdjustmentRet> AdjList = new TrackableCollection <InventoryQtyAdjustmentRet>(null); if (InventoryQtyAdjustmentRetList.Count == 0) { return(AdjList); } for (int i = 0; i < InventoryQtyAdjustmentRetList.Count; i++) { InventoryQtyAdjustmentRet adj = new InventoryQtyAdjustmentRet(); IInventoryQtyAdjustmentRet QBadj = InventoryQtyAdjustmentRetList.GetAt(i); if (QBadj == null) { continue; } //Go through all the elements of IQBadjList //Get value of TxnID if (QBadj.TxnID != null) { adj.TxnID = (string)QBadj.TxnID.GetValue(); } //Get value of TimeCreated if (QBadj.TimeCreated != null) { adj.TimeCreated = (DateTime)QBadj.TimeCreated.GetValue(); } //Get value of TimeModified if (QBadj.TimeModified != null) { adj.TimeModified = (DateTime)QBadj.TimeModified.GetValue(); } //Get value of Associate if (QBadj.Associate != null) { adj.Associate = (string)QBadj.Associate.GetValue(); } //Get value of Comments if (QBadj.Comments != null) { adj.Comments = (string)QBadj.Comments.GetValue(); } //Get value of CostDifference if (QBadj.CostDifference != null) { adj.CostDifference = (decimal)QBadj.CostDifference.GetValue(); } //Get value of HistoryDocStatus if (QBadj.HistoryDocStatus != null) { adj.HistoryDocStatus = ((ENHistoryDocStatus)QBadj.HistoryDocStatus.GetValue()).ToString(); } //Get value of InventoryAdjustmentNumber if (QBadj.InventoryAdjustmentNumber != null) { adj.InventoryAdjustmentNumber = (int)QBadj.InventoryAdjustmentNumber.GetValue(); } //Get value of InventoryAdjustmentSource if (QBadj.InventoryAdjustmentSource != null) { adj.InventoryAdjustmentSource = ((ENInventoryAdjustmentSource)QBadj.InventoryAdjustmentSource.GetValue()).ToString(); } //Get value of ItemsCount if (QBadj.ItemsCount != null) { adj.ItemsCount = (int)QBadj.ItemsCount.GetValue(); } //Get value of NewQuantity if (QBadj.NewQuantity != null) { adj.NewQuantity = (int)QBadj.NewQuantity.GetValue(); } //Get value of OldQuantity if (QBadj.OldQuantity != null) { adj.OldQuantity = (int)QBadj.OldQuantity.GetValue(); } //Get value of QtyDifference if (QBadj.QtyDifference != null) { adj.QtyDifference = (int)QBadj.QtyDifference.GetValue(); } //Get value of QuickBooksFlag if (QBadj.QuickBooksFlag != null) { adj.QuickBooksFlag = ((ENQuickBooksFlag)QBadj.QuickBooksFlag.GetValue()).ToString(); } //Get value of Reason if (QBadj.Reason != null) { adj.Reason = (string)QBadj.Reason.GetValue(); } //Get value of StoreExchangeStatus if (QBadj.StoreExchangeStatus != null) { adj.StoreExchangeStatus = ((ENStoreExchangeStatus)QBadj.StoreExchangeStatus.GetValue()).ToString(); } //Get value of StoreNumber if (QBadj.StoreNumber != null) { adj.StoreNumber = (int)QBadj.StoreNumber.GetValue(); } //Get value of TxnDate if (QBadj.TxnDate != null) { adj.TxnDate = (DateTime)QBadj.TxnDate.GetValue(); } //Get value of TxnState if (QBadj.TxnState != null) { adj.TxnState = ((ENTxnState)QBadj.TxnState.GetValue()).ToString(); } //Get value of Workstation if (QBadj.Workstation != null) { adj.Workstation = (int)QBadj.Workstation.GetValue(); } if (QBadj.InventoryQtyAdjustmentItemRetList != null) { adj.InventoryQtyAdjustmentItemRet = new TrackableCollection <InventoryQtyAdjustmentItemRet>(null); for (int i348 = 0; i348 < QBadj.InventoryQtyAdjustmentItemRetList.Count; i348++) { IInventoryQtyAdjustmentItemRet InventoryQtyAdjustmentItemRet = QBadj.InventoryQtyAdjustmentItemRetList.GetAt(i348); InventoryQtyAdjustmentItemRet adjItm = new InventoryQtyAdjustmentItemRet(); //Get value of ListID if (InventoryQtyAdjustmentItemRet.ListID != null) { adjItm.ListID = (string)InventoryQtyAdjustmentItemRet.ListID.GetValue(); } //Get value of NewQuantity if (InventoryQtyAdjustmentItemRet.NewQuantity != null) { adjItm.NewQuantity = (int)InventoryQtyAdjustmentItemRet.NewQuantity.GetValue(); } //Get value of NumberOfBaseUnits if (InventoryQtyAdjustmentItemRet.NumberOfBaseUnits != null) { adjItm.NumberOfBaseUnits = (int)InventoryQtyAdjustmentItemRet.NumberOfBaseUnits.GetValue(); } //Get value of OldQuantity if (InventoryQtyAdjustmentItemRet.OldQuantity != null) { adjItm.OldQuantity = (int)InventoryQtyAdjustmentItemRet.OldQuantity.GetValue(); } //Get value of QtyDifference if (InventoryQtyAdjustmentItemRet.QtyDifference != null) { adjItm.QtyDifference = (int)InventoryQtyAdjustmentItemRet.QtyDifference.GetValue(); } //Get value of SerialNumber if (InventoryQtyAdjustmentItemRet.SerialNumber != null) { adjItm.SerialNumber = (string)InventoryQtyAdjustmentItemRet.SerialNumber.GetValue(); } //Get value of UnitOfMeasure if (InventoryQtyAdjustmentItemRet.UnitOfMeasure != null) { adjItm.UnitOfMeasure = (string)InventoryQtyAdjustmentItemRet.UnitOfMeasure.GetValue(); } adj.InventoryQtyAdjustmentItemRet.Add(adjItm); } } //if (QBadj.DataExtRetList != null) //{ // for (int i356 = 0; i356 < QBadj.DataExtRetList.Count; i356++) // { // IDataExtRet DataExtRet = QBadj.DataExtRetList.GetAt(i356); // //Get value of OwnerID // string OwnerID357 = (string)DataExtRet.OwnerID.GetValue(); // //Get value of DataExtName // string DataExtName358 = (string)DataExtRet.DataExtName.GetValue(); // //Get value of DataExtType // ENDataExtType DataExtType359 = (ENDataExtType)DataExtRet.DataExtType.GetValue(); // //Get value of DataExtValue // string DataExtValue360 = (string)DataExtRet.DataExtValue.GetValue(); // } //} AdjList.Add(adj); } return(AdjList); }