private void AddStuffToList(object threadIndex) { for (var i = 0; i < countToAdd; i++) { _testList.Add(new Simple(i.ToString())); } }
public async Task TestUndo() { var simple = new SimpleViewModel(true); var originalC = simple.ACollection; Assert.AreEqual(0, originalC.Count); var origBoxed = simple.StrongReferenceBoxed; var origStrong = simple.StrongReference; var acc = new Accumulator("test"); simple.Accumulator = acc; var newC = new TrackableCollection <string>(acc, true); simple.ACollection = newC; Assert.AreEqual(simple.ACollection, newC); newC.Add("poop"); newC.Add("stinks"); simple.ADouble = 5; Assert.AreEqual(simple.ADouble, 5); simple.AnInt = 5; Assert.AreEqual(simple.AnInt, 5); simple.AString = "yupperz"; Assert.AreEqual(simple.AString, "yupperz"); simple.AnEnum = SimpleViewModel.TestEnum.Three; Assert.AreEqual(SimpleViewModel.TestEnum.Three, simple.AnEnum); simple.NullableDouble = null; Assert.IsNull(simple.NullableDouble); simple.NullableInt = null; Assert.IsNull(simple.NullableInt); simple.NullableEnum = null; Assert.IsNull(simple.NullableEnum); simple.ACollection = null; Assert.IsNull(simple.ACollection); simple.StrongReference = null; Assert.IsNull(simple.StrongReference); simple.StrongReferenceBoxed = null; Assert.IsNull(simple.StrongReferenceBoxed); Assert.AreEqual(13, acc.Records.Count); await acc.UndoAll(acc.Name); Assert.AreEqual(simple.AString, nameof(SimpleViewModel.AString)); Assert.AreEqual(simple.AnInt, 542); Assert.AreEqual(simple.ADouble, 542); Assert.AreEqual(simple.StrongReferenceBoxed, origBoxed); Assert.AreEqual(simple.StrongReference, origStrong); Assert.AreEqual(simple.ACollection, originalC); Assert.AreEqual(0, originalC.Count); Assert.AreEqual(simple.NullableInt, 0); Assert.AreEqual(simple.NullableDouble, 0); Assert.AreEqual(simple.NullableEnum, SimpleViewModel.TestEnum.Two); }
public void TestTrackableCollection_Remove(bool track) { var acc = new Accumulator("test"); var b = new Simple("b"); var coll = new TrackableCollection <Simple>(acc, track) { new Simple("a"), b, new Simple("c") }; Assert.IsTrue(coll.Remove(b)); Assert.AreEqual(2, coll.Count); Assert.IsFalse(coll.Contains(b)); coll.Add(b); Assert.AreEqual(3, coll.Count); Assert.IsTrue(coll.Contains(b)); Assert.IsTrue(coll.Remove(b)); Assert.AreEqual(2, coll.Count); Assert.IsFalse(coll.Contains(b)); if (track) { Assert.AreEqual(6, acc.Records.Count); } else { Assert.AreEqual(0, acc.Records.Count); } }
public void TestTrackableCollection_AddIfNew(bool track) { var acc = new Accumulator("test"); var coll = new TrackableCollection <Simple>(acc, track) { new Simple("a"), new Simple("b"), new Simple("c") }; Assert.AreEqual(3, coll.Count); var d = new Simple("d"); coll.Add(d); Assert.AreEqual(4, coll.Count); Assert.AreEqual("d", coll[3].Value); coll.AddIfNew(d); Assert.AreEqual(4, coll.Count); Assert.AreEqual("d", coll[3].Value); if (track) { Assert.AreEqual(4, acc.Records.Count); } else { Assert.AreEqual(0, acc.Records.Count); } }
public void TestTrackableCollection_Move(bool track) { var acc = new Accumulator("test"); var a = new Simple("a"); var b = new Simple("b"); var c = new Simple("c"); var coll = new TrackableCollection <Simple>(acc, track) { a, b, c, b, c, b, b }; coll.SafeMove(0, 3); Assert.AreEqual(2, coll.IndexOf(a)); coll.SafeMove(3, 3); coll.SafeMove(1, 40); // should result in an Add coll.Clear(); coll.Add(a); coll.SafeMove(0, 0); coll.SafeMove(0, 1); coll.Clear(); coll.SafeMove(0, 0); if (track) { Assert.AreEqual(13, acc.Records.Count); } else { Assert.AreEqual(0, acc.Records.Count); } }
public void TestScopeEachChange_On() { Globals.ScopeEachChange = true; var simple = new SimpleViewModel(true); var newC = new TrackableCollection <string>(); simple.ACollection = newC; Assert.AreEqual(simple.ACollection, newC); newC.Add("poop"); newC.Add("stinks"); simple.ADouble = 5; Assert.AreEqual(simple.ADouble, 5); simple.AnInt = 5; Assert.AreEqual(simple.AnInt, 5); simple.AString = "yupperz"; Assert.AreEqual(simple.AString, "yupperz"); simple.AnEnum = SimpleViewModel.TestEnum.Three; Assert.AreEqual(SimpleViewModel.TestEnum.Three, simple.AnEnum); simple.NullableDouble = null; Assert.IsNull(simple.NullableDouble); simple.NullableInt = null; Assert.IsNull(simple.NullableInt); simple.NullableEnum = null; Assert.IsNull(simple.NullableEnum); simple.ACollection = null; Assert.IsNull(simple.ACollection); simple.StrongReference = null; Assert.IsNull(simple.StrongReference); simple.StrongReferenceBoxed = null; Assert.IsNull(simple.StrongReferenceBoxed); var mgr = AccumulatorManager.Instance; Assert.AreEqual(mgr.Undoables.Count, 46); Globals.ScopeEachChange = false; }
public void TestTracking() { var simple = new SimpleViewModel(true); var acc = new Accumulator("test"); simple.Accumulator = acc; var newC = new TrackableCollection <string>(acc, true); simple.ACollection = newC; Assert.AreEqual(simple.ACollection, newC); newC.Add("poop"); newC.Add("stinks"); simple.ADouble = 5; Assert.AreEqual(simple.ADouble, 5); simple.AnInt = 5; Assert.AreEqual(simple.AnInt, 5); simple.AString = "yupperz"; Assert.AreEqual(simple.AString, "yupperz"); simple.AnEnum = SimpleViewModel.TestEnum.Three; Assert.AreEqual(SimpleViewModel.TestEnum.Three, simple.AnEnum); simple.NullableDouble = null; Assert.IsNull(simple.NullableDouble); simple.NullableInt = null; Assert.IsNull(simple.NullableInt); simple.NullableEnum = null; Assert.IsNull(simple.NullableEnum); simple.ACollection = null; Assert.IsNull(simple.ACollection); simple.StrongReference = null; Assert.IsNull(simple.StrongReference); simple.StrongReferenceBoxed = null; Assert.IsNull(simple.StrongReferenceBoxed); Assert.AreEqual(13, acc.Records.Count); }
public void TestTrackableCollection_Contains() { var b = new Simple("b"); var coll = new TrackableCollection <Simple>() { new Simple("a"), b, new Simple("c") }; Assert.IsTrue(coll.Contains(b)); var d = new Simple("d"); Assert.IsFalse(coll.Contains(d)); coll.Add(d); Assert.IsTrue(coll.Contains(d)); }
private static Master GetFakeData() { TrackableCollection <DetailToMany> manyDetail = new TrackableCollection <DetailToMany>(); manyDetail.Add(new DetailToMany() { DetailToManyId = 1 }); Master master = new Master() { MasterId = 1, ToOne = new DetailOneToOne() { DetailOneToOneId = 1 }, ToMany = manyDetail }; return(master); }
POSAI_mvvm.QuickBooks.TrackableCollection <ItemInventoryRet> WalkItemInventoryRet(IItemInventoryRetList ItemInventoryRetList) { TrackableCollection <ItemInventoryRet> itmList = new TrackableCollection <QuickBooks.ItemInventoryRet>(null); for (int i = 0; i < ItemInventoryRetList.Count; i++) { IItemInventoryRet positm = ItemInventoryRetList.GetAt(i); ItemInventoryRet itm = new ItemInventoryRet(); if (positm == null) { continue; } //Go through all the elements of IpositmList //Get value of ListID if (positm.ListID != null) { itm.ListID = (string)positm.ListID.GetValue(); } //Get value of ALU if (positm.ALU != null) { itm.ALU = (string)positm.ALU.GetValue(); } //Get value of Attribute if (positm.Attribute != null) { itm.Attribute = (string)positm.Attribute.GetValue(); } //Get value of DepartmentCode if (positm.DepartmentCode != null) { itm.DepartmentCode = (string)positm.DepartmentCode.GetValue(); } //Get value of Desc1 if (positm.Desc1 != null) { itm.Desc1 = (string)positm.Desc1.GetValue(); } //Get value of Desc2 if (positm.Desc2 != null) { itm.Desc2 = (string)positm.Desc2.GetValue(); } //Get value of ItemNumber if (positm.ItemNumber != null) { itm.ItemNumber = (int)positm.ItemNumber.GetValue(); } //Get value of ItemType if (positm.ItemType != null) { itm.ItemType = ((ENItemType)positm.ItemType.GetValue()).ToString(); } //Get value of Size if (positm.Size != null) { itm.Size = (string)positm.Size.GetValue(); } #region "More Properties" // //Get value of TimeCreated //if (ItemInventoryRet.TimeCreated != null) //{ //DateTime TimeCreated78 = (DateTime)ItemInventoryRet.TimeCreated.GetValue(); //} ////Get value of TimeModified //if (ItemInventoryRet.TimeModified != null) //{ //DateTime TimeModified79 = (DateTime)ItemInventoryRet.TimeModified.GetValue(); //} ////Get value of COGSAccount //if (ItemInventoryRet.COGSAccount != null) //{ //string COGSAccount82 = (string)ItemInventoryRet.COGSAccount.GetValue(); //} ////Get value of Cost //if (ItemInventoryRet.Cost != null) //{ //double Cost83 = (double)ItemInventoryRet.Cost.GetValue(); //} ////Get value of DepartmentListID //if (ItemInventoryRet.DepartmentListID != null) //{ //string DepartmentListID85 = (string)ItemInventoryRet.DepartmentListID.GetValue(); //} ////Get value of IncomeAccount //if (ItemInventoryRet.IncomeAccount != null) //{ //string IncomeAccount88 = (string)ItemInventoryRet.IncomeAccount.GetValue(); //} ////Get value of IsBelowReorder //if (ItemInventoryRet.IsBelowReorder != null) //{ //bool IsBelowReorder89 = (bool)ItemInventoryRet.IsBelowReorder.GetValue(); //} ////Get value of IsEligibleForCommission //if (ItemInventoryRet.IsEligibleForCommission != null) //{ //bool IsEligibleForCommission90 = (bool)ItemInventoryRet.IsEligibleForCommission.GetValue(); //} ////Get value of IsPrintingTags //if (ItemInventoryRet.IsPrintingTags != null) //{ //bool IsPrintingTags91 = (bool)ItemInventoryRet.IsPrintingTags.GetValue(); //} ////Get value of IsUnorderable //if (ItemInventoryRet.IsUnorderable != null) //{ //bool IsUnorderable92 = (bool)ItemInventoryRet.IsUnorderable.GetValue(); //} ////Get value of HasPictures //if (ItemInventoryRet.HasPictures != null) //{ //bool HasPictures93 = (bool)ItemInventoryRet.HasPictures.GetValue(); //} ////Get value of IsEligibleForRewards //if (ItemInventoryRet.IsEligibleForRewards != null) //{ //bool IsEligibleForRewards94 = (bool)ItemInventoryRet.IsEligibleForRewards.GetValue(); //} ////Get value of IsWebItem //if (ItemInventoryRet.IsWebItem != null) //{ //bool IsWebItem95 = (bool)ItemInventoryRet.IsWebItem.GetValue(); //} ////Get value of LastReceived //if (ItemInventoryRet.LastReceived != null) //{ //DateTime LastReceived98 = (DateTime)ItemInventoryRet.LastReceived.GetValue(); //} ////Get value of MarginPercent //if (ItemInventoryRet.MarginPercent != null) //{ //int MarginPercent99 = (int)ItemInventoryRet.MarginPercent.GetValue(); //} ////Get value of MarkupPercent //if (ItemInventoryRet.MarkupPercent != null) //{ //int MarkupPercent100 = (int)ItemInventoryRet.MarkupPercent.GetValue(); //} ////Get value of MSRP //if (ItemInventoryRet.MSRP != null) //{ //double MSRP101 = (double)ItemInventoryRet.MSRP.GetValue(); //} ////Get value of OnHandStore01 //if (ItemInventoryRet.OnHandStore01 != null) //{ //int OnHandStore01102 = (int)ItemInventoryRet.OnHandStore01.GetValue(); //} ////Get value of OnHandStore02 //if (ItemInventoryRet.OnHandStore02 != null) //{ //int OnHandStore02103 = (int)ItemInventoryRet.OnHandStore02.GetValue(); //} ////Get value of OnHandStore03 //if (ItemInventoryRet.OnHandStore03 != null) //{ //int OnHandStore03104 = (int)ItemInventoryRet.OnHandStore03.GetValue(); //} ////Get value of OnHandStore04 //if (ItemInventoryRet.OnHandStore04 != null) //{ //int OnHandStore04105 = (int)ItemInventoryRet.OnHandStore04.GetValue(); //} ////Get value of OnHandStore05 //if (ItemInventoryRet.OnHandStore05 != null) //{ //int OnHandStore05106 = (int)ItemInventoryRet.OnHandStore05.GetValue(); //} ////Get value of OnHandStore06 //if (ItemInventoryRet.OnHandStore06 != null) //{ //int OnHandStore06107 = (int)ItemInventoryRet.OnHandStore06.GetValue(); //} ////Get value of OnHandStore07 //if (ItemInventoryRet.OnHandStore07 != null) //{ //int OnHandStore07108 = (int)ItemInventoryRet.OnHandStore07.GetValue(); //} ////Get value of OnHandStore08 //if (ItemInventoryRet.OnHandStore08 != null) //{ //int OnHandStore08109 = (int)ItemInventoryRet.OnHandStore08.GetValue(); //} ////Get value of OnHandStore09 //if (ItemInventoryRet.OnHandStore09 != null) //{ //int OnHandStore09110 = (int)ItemInventoryRet.OnHandStore09.GetValue(); //} ////Get value of OnHandStore10 //if (ItemInventoryRet.OnHandStore10 != null) //{ //int OnHandStore10111 = (int)ItemInventoryRet.OnHandStore10.GetValue(); //} ////Get value of OnHandStore11 //if (ItemInventoryRet.OnHandStore11 != null) //{ //int OnHandStore11112 = (int)ItemInventoryRet.OnHandStore11.GetValue(); //} ////Get value of OnHandStore12 //if (ItemInventoryRet.OnHandStore12 != null) //{ //int OnHandStore12113 = (int)ItemInventoryRet.OnHandStore12.GetValue(); //} ////Get value of OnHandStore13 //if (ItemInventoryRet.OnHandStore13 != null) //{ //int OnHandStore13114 = (int)ItemInventoryRet.OnHandStore13.GetValue(); //} ////Get value of OnHandStore14 //if (ItemInventoryRet.OnHandStore14 != null) //{ //int OnHandStore14115 = (int)ItemInventoryRet.OnHandStore14.GetValue(); //} ////Get value of OnHandStore15 //if (ItemInventoryRet.OnHandStore15 != null) //{ //int OnHandStore15116 = (int)ItemInventoryRet.OnHandStore15.GetValue(); //} ////Get value of OnHandStore16 //if (ItemInventoryRet.OnHandStore16 != null) //{ //int OnHandStore16117 = (int)ItemInventoryRet.OnHandStore16.GetValue(); //} ////Get value of OnHandStore17 //if (ItemInventoryRet.OnHandStore17 != null) //{ //int OnHandStore17118 = (int)ItemInventoryRet.OnHandStore17.GetValue(); //} ////Get value of OnHandStore18 //if (ItemInventoryRet.OnHandStore18 != null) //{ //int OnHandStore18119 = (int)ItemInventoryRet.OnHandStore18.GetValue(); //} ////Get value of OnHandStore19 //if (ItemInventoryRet.OnHandStore19 != null) //{ //int OnHandStore19120 = (int)ItemInventoryRet.OnHandStore19.GetValue(); //} ////Get value of OnHandStore20 //if (ItemInventoryRet.OnHandStore20 != null) //{ //int OnHandStore20121 = (int)ItemInventoryRet.OnHandStore20.GetValue(); //} ////Get value of ReorderPointStore01 //if (ItemInventoryRet.ReorderPointStore01 != null) //{ //int ReorderPointStore01122 = (int)ItemInventoryRet.ReorderPointStore01.GetValue(); //} ////Get value of ReorderPointStore02 //if (ItemInventoryRet.ReorderPointStore02 != null) //{ //int ReorderPointStore02123 = (int)ItemInventoryRet.ReorderPointStore02.GetValue(); //} ////Get value of ReorderPointStore03 //if (ItemInventoryRet.ReorderPointStore03 != null) //{ //int ReorderPointStore03124 = (int)ItemInventoryRet.ReorderPointStore03.GetValue(); //} ////Get value of ReorderPointStore04 //if (ItemInventoryRet.ReorderPointStore04 != null) //{ //int ReorderPointStore04125 = (int)ItemInventoryRet.ReorderPointStore04.GetValue(); //} ////Get value of ReorderPointStore05 //if (ItemInventoryRet.ReorderPointStore05 != null) //{ //int ReorderPointStore05126 = (int)ItemInventoryRet.ReorderPointStore05.GetValue(); //} ////Get value of ReorderPointStore06 //if (ItemInventoryRet.ReorderPointStore06 != null) //{ //int ReorderPointStore06127 = (int)ItemInventoryRet.ReorderPointStore06.GetValue(); //} ////Get value of ReorderPointStore07 //if (ItemInventoryRet.ReorderPointStore07 != null) //{ //int ReorderPointStore07128 = (int)ItemInventoryRet.ReorderPointStore07.GetValue(); //} ////Get value of ReorderPointStore08 //if (ItemInventoryRet.ReorderPointStore08 != null) //{ //int ReorderPointStore08129 = (int)ItemInventoryRet.ReorderPointStore08.GetValue(); //} ////Get value of ReorderPointStore09 //if (ItemInventoryRet.ReorderPointStore09 != null) //{ //int ReorderPointStore09130 = (int)ItemInventoryRet.ReorderPointStore09.GetValue(); //} ////Get value of ReorderPointStore10 //if (ItemInventoryRet.ReorderPointStore10 != null) //{ //int ReorderPointStore10131 = (int)ItemInventoryRet.ReorderPointStore10.GetValue(); //} ////Get value of ReorderPointStore11 //if (ItemInventoryRet.ReorderPointStore11 != null) //{ //int ReorderPointStore11132 = (int)ItemInventoryRet.ReorderPointStore11.GetValue(); //} ////Get value of ReorderPointStore12 //if (ItemInventoryRet.ReorderPointStore12 != null) //{ //int ReorderPointStore12133 = (int)ItemInventoryRet.ReorderPointStore12.GetValue(); //} ////Get value of ReorderPointStore13 //if (ItemInventoryRet.ReorderPointStore13 != null) //{ //int ReorderPointStore13134 = (int)ItemInventoryRet.ReorderPointStore13.GetValue(); //} ////Get value of ReorderPointStore14 //if (ItemInventoryRet.ReorderPointStore14 != null) //{ //int ReorderPointStore14135 = (int)ItemInventoryRet.ReorderPointStore14.GetValue(); //} ////Get value of ReorderPointStore15 //if (ItemInventoryRet.ReorderPointStore15 != null) //{ //int ReorderPointStore15136 = (int)ItemInventoryRet.ReorderPointStore15.GetValue(); //} ////Get value of ReorderPointStore16 //if (ItemInventoryRet.ReorderPointStore16 != null) //{ //int ReorderPointStore16137 = (int)ItemInventoryRet.ReorderPointStore16.GetValue(); //} ////Get value of ReorderPointStore17 //if (ItemInventoryRet.ReorderPointStore17 != null) //{ //int ReorderPointStore17138 = (int)ItemInventoryRet.ReorderPointStore17.GetValue(); //} ////Get value of ReorderPointStore18 //if (ItemInventoryRet.ReorderPointStore18 != null) //{ //int ReorderPointStore18139 = (int)ItemInventoryRet.ReorderPointStore18.GetValue(); //} ////Get value of ReorderPointStore19 //if (ItemInventoryRet.ReorderPointStore19 != null) //{ //int ReorderPointStore19140 = (int)ItemInventoryRet.ReorderPointStore19.GetValue(); //} ////Get value of ReorderPointStore20 //if (ItemInventoryRet.ReorderPointStore20 != null) //{ //int ReorderPointStore20141 = (int)ItemInventoryRet.ReorderPointStore20.GetValue(); //} ////Get value of OrderByUnit //if (ItemInventoryRet.OrderByUnit != null) //{ //string OrderByUnit142 = (string)ItemInventoryRet.OrderByUnit.GetValue(); //} ////Get value of OrderCost //if (ItemInventoryRet.OrderCost != null) //{ //double OrderCost143 = (double)ItemInventoryRet.OrderCost.GetValue(); //} ////Get value of Price1 //if (ItemInventoryRet.Price1 != null) //{ //double Price1144 = (double)ItemInventoryRet.Price1.GetValue(); //} ////Get value of Price2 //if (ItemInventoryRet.Price2 != null) //{ //double Price2145 = (double)ItemInventoryRet.Price2.GetValue(); //} ////Get value of Price3 //if (ItemInventoryRet.Price3 != null) //{ //double Price3146 = (double)ItemInventoryRet.Price3.GetValue(); //} ////Get value of Price4 //if (ItemInventoryRet.Price4 != null) //{ //double Price4147 = (double)ItemInventoryRet.Price4.GetValue(); //} ////Get value of Price5 //if (ItemInventoryRet.Price5 != null) //{ //double Price5148 = (double)ItemInventoryRet.Price5.GetValue(); //} ////Get value of QuantityOnCustomerOrder //if (ItemInventoryRet.QuantityOnCustomerOrder != null) //{ //int QuantityOnCustomerOrder149 = (int)ItemInventoryRet.QuantityOnCustomerOrder.GetValue(); //} ////Get value of QuantityOnHand //if (ItemInventoryRet.QuantityOnHand != null) //{ //int QuantityOnHand150 = (int)ItemInventoryRet.QuantityOnHand.GetValue(); //} ////Get value of QuantityOnOrder //if (ItemInventoryRet.QuantityOnOrder != null) //{ //int QuantityOnOrder151 = (int)ItemInventoryRet.QuantityOnOrder.GetValue(); //} ////Get value of QuantityOnPendingOrder //if (ItemInventoryRet.QuantityOnPendingOrder != null) //{ //int QuantityOnPendingOrder152 = (int)ItemInventoryRet.QuantityOnPendingOrder.GetValue(); //} //if (ItemInventoryRet.AvailableQtyList != null) //{ //for (int i153 = 0; i153 < ItemInventoryRet.AvailableQtyList.Count; i153++) //{ //IAvailableQty AvailableQty = ItemInventoryRet.AvailableQtyList.GetAt(i153); ////Get value of StoreNumber //if (AvailableQty.StoreNumber != null) //{ //int StoreNumber154 = (int)AvailableQty.StoreNumber.GetValue(); //} ////Get value of QuantityOnOrder //if (AvailableQty.QuantityOnOrder != null) //{ //int QuantityOnOrder155 = (int)AvailableQty.QuantityOnOrder.GetValue(); //} ////Get value of QuantityOnCustomerOrder //if (AvailableQty.QuantityOnCustomerOrder != null) //{ //int QuantityOnCustomerOrder156 = (int)AvailableQty.QuantityOnCustomerOrder.GetValue(); //} ////Get value of QuantityOnPendingOrder //if (AvailableQty.QuantityOnPendingOrder != null) //{ //int QuantityOnPendingOrder157 = (int)AvailableQty.QuantityOnPendingOrder.GetValue(); //} //} //} ////Get value of ReorderPoint //if (ItemInventoryRet.ReorderPoint != null) //{ //int ReorderPoint158 = (int)ItemInventoryRet.ReorderPoint.GetValue(); //} ////Get value of SellByUnit //if (ItemInventoryRet.SellByUnit != null) //{ //string SellByUnit159 = (string)ItemInventoryRet.SellByUnit.GetValue(); //} ////Get value of SerialFlag //if (ItemInventoryRet.SerialFlag != null) //{ //ENSerialFlag SerialFlag160 = (ENSerialFlag)ItemInventoryRet.SerialFlag.GetValue(); //} ////Get value of StoreExchangeStatus //if (ItemInventoryRet.StoreExchangeStatus != null) //{ //ENStoreExchangeStatus StoreExchangeStatus162 = (ENStoreExchangeStatus)ItemInventoryRet.StoreExchangeStatus.GetValue(); //} ////Get value of TaxCode //if (ItemInventoryRet.TaxCode != null) //{ //string TaxCode163 = (string)ItemInventoryRet.TaxCode.GetValue(); //} ////Get value of UnitOfMeasure //if (ItemInventoryRet.UnitOfMeasure != null) //{ //string UnitOfMeasure164 = (string)ItemInventoryRet.UnitOfMeasure.GetValue(); //} ////Get value of UPC //if (ItemInventoryRet.UPC != null) //{ //string UPC165 = (string)ItemInventoryRet.UPC.GetValue(); //} ////Get value of VendorCode //if (ItemInventoryRet.VendorCode != null) //{ //string VendorCode166 = (string)ItemInventoryRet.VendorCode.GetValue(); //} ////Get value of VendorListID //if (ItemInventoryRet.VendorListID != null) //{ //string VendorListID167 = (string)ItemInventoryRet.VendorListID.GetValue(); //} ////Get value of WebDesc //if (ItemInventoryRet.WebDesc != null) //{ //string WebDesc168 = (string)ItemInventoryRet.WebDesc.GetValue(); //} ////Get value of WebPrice //if (ItemInventoryRet.WebPrice != null) //{ //double WebPrice169 = (double)ItemInventoryRet.WebPrice.GetValue(); //} ////Get value of Manufacturer //if (ItemInventoryRet.Manufacturer != null) //{ //string Manufacturer170 = (string)ItemInventoryRet.Manufacturer.GetValue(); //} ////Get value of Weight //if (ItemInventoryRet.Weight != null) //{ //IQBFloatType Weight171 = (IQBFloatType)ItemInventoryRet.Weight.GetValue(); //} ////Get value of WebSKU //if (ItemInventoryRet.WebSKU != null) //{ //string WebSKU172 = (string)ItemInventoryRet.WebSKU.GetValue(); //} ////Get value of Keywords //if (ItemInventoryRet.Keywords != null) //{ //string Keywords173 = (string)ItemInventoryRet.Keywords.GetValue(); //} ////Get value of WebCategories //if (ItemInventoryRet.WebCategories != null) //{ //string WebCategories174 = (string)ItemInventoryRet.WebCategories.GetValue(); //} //if (ItemInventoryRet.UnitOfMeasure1 != null) //{ ////Get value of ALU //if (ItemInventoryRet.UnitOfMeasure1.ALU != null) //{ //string ALU175 = (string)ItemInventoryRet.UnitOfMeasure1.ALU.GetValue(); //} ////Get value of MSRP //if (ItemInventoryRet.UnitOfMeasure1.MSRP != null) //{ //double MSRP176 = (double)ItemInventoryRet.UnitOfMeasure1.MSRP.GetValue(); //} ////Get value of NumberOfBaseUnits //if (ItemInventoryRet.UnitOfMeasure1.NumberOfBaseUnits != null) //{ //int NumberOfBaseUnits177 = (int)ItemInventoryRet.UnitOfMeasure1.NumberOfBaseUnits.GetValue(); //} ////Get value of Price1 //if (ItemInventoryRet.UnitOfMeasure1.Price1 != null) //{ //double Price1178 = (double)ItemInventoryRet.UnitOfMeasure1.Price1.GetValue(); //} ////Get value of Price2 //if (ItemInventoryRet.UnitOfMeasure1.Price2 != null) //{ //double Price2179 = (double)ItemInventoryRet.UnitOfMeasure1.Price2.GetValue(); //} ////Get value of Price3 //if (ItemInventoryRet.UnitOfMeasure1.Price3 != null) //{ //double Price3180 = (double)ItemInventoryRet.UnitOfMeasure1.Price3.GetValue(); //} ////Get value of Price4 //if (ItemInventoryRet.UnitOfMeasure1.Price4 != null) //{ //double Price4181 = (double)ItemInventoryRet.UnitOfMeasure1.Price4.GetValue(); //} ////Get value of Price5 //if (ItemInventoryRet.UnitOfMeasure1.Price5 != null) //{ //double Price5182 = (double)ItemInventoryRet.UnitOfMeasure1.Price5.GetValue(); //} ////Get value of UnitOfMeasure //if (ItemInventoryRet.UnitOfMeasure1.UnitOfMeasure != null) //{ //string UnitOfMeasure183 = (string)ItemInventoryRet.UnitOfMeasure1.UnitOfMeasure.GetValue(); //} ////Get value of UPC //if (ItemInventoryRet.UnitOfMeasure1.UPC != null) //{ //string UPC184 = (string)ItemInventoryRet.UnitOfMeasure1.UPC.GetValue(); //} //} //if (ItemInventoryRet.UnitOfMeasure2 != null) //{ ////Get value of ALU //if (ItemInventoryRet.UnitOfMeasure2.ALU != null) //{ //string ALU185 = (string)ItemInventoryRet.UnitOfMeasure2.ALU.GetValue(); //} ////Get value of MSRP //if (ItemInventoryRet.UnitOfMeasure2.MSRP != null) //{ //double MSRP186 = (double)ItemInventoryRet.UnitOfMeasure2.MSRP.GetValue(); //} ////Get value of NumberOfBaseUnits //if (ItemInventoryRet.UnitOfMeasure2.NumberOfBaseUnits != null) //{ //int NumberOfBaseUnits187 = (int)ItemInventoryRet.UnitOfMeasure2.NumberOfBaseUnits.GetValue(); //} ////Get value of Price1 //if (ItemInventoryRet.UnitOfMeasure2.Price1 != null) //{ //double Price1188 = (double)ItemInventoryRet.UnitOfMeasure2.Price1.GetValue(); //} ////Get value of Price2 //if (ItemInventoryRet.UnitOfMeasure2.Price2 != null) //{ //double Price2189 = (double)ItemInventoryRet.UnitOfMeasure2.Price2.GetValue(); //} ////Get value of Price3 //if (ItemInventoryRet.UnitOfMeasure2.Price3 != null) //{ //double Price3190 = (double)ItemInventoryRet.UnitOfMeasure2.Price3.GetValue(); //} ////Get value of Price4 //if (ItemInventoryRet.UnitOfMeasure2.Price4 != null) //{ //double Price4191 = (double)ItemInventoryRet.UnitOfMeasure2.Price4.GetValue(); //} ////Get value of Price5 //if (ItemInventoryRet.UnitOfMeasure2.Price5 != null) //{ //double Price5192 = (double)ItemInventoryRet.UnitOfMeasure2.Price5.GetValue(); //} ////Get value of UnitOfMeasure //if (ItemInventoryRet.UnitOfMeasure2.UnitOfMeasure != null) //{ //string UnitOfMeasure193 = (string)ItemInventoryRet.UnitOfMeasure2.UnitOfMeasure.GetValue(); //} ////Get value of UPC //if (ItemInventoryRet.UnitOfMeasure2.UPC != null) //{ //string UPC194 = (string)ItemInventoryRet.UnitOfMeasure2.UPC.GetValue(); //} //} //if (ItemInventoryRet.UnitOfMeasure3 != null) //{ ////Get value of ALU //if (ItemInventoryRet.UnitOfMeasure3.ALU != null) //{ //string ALU195 = (string)ItemInventoryRet.UnitOfMeasure3.ALU.GetValue(); //} ////Get value of MSRP //if (ItemInventoryRet.UnitOfMeasure3.MSRP != null) //{ //double MSRP196 = (double)ItemInventoryRet.UnitOfMeasure3.MSRP.GetValue(); //} ////Get value of NumberOfBaseUnits //if (ItemInventoryRet.UnitOfMeasure3.NumberOfBaseUnits != null) //{ //int NumberOfBaseUnits197 = (int)ItemInventoryRet.UnitOfMeasure3.NumberOfBaseUnits.GetValue(); //} ////Get value of Price1 //if (ItemInventoryRet.UnitOfMeasure3.Price1 != null) //{ //double Price1198 = (double)ItemInventoryRet.UnitOfMeasure3.Price1.GetValue(); //} ////Get value of Price2 //if (ItemInventoryRet.UnitOfMeasure3.Price2 != null) //{ //double Price2199 = (double)ItemInventoryRet.UnitOfMeasure3.Price2.GetValue(); //} ////Get value of Price3 //if (ItemInventoryRet.UnitOfMeasure3.Price3 != null) //{ //double Price3200 = (double)ItemInventoryRet.UnitOfMeasure3.Price3.GetValue(); //} ////Get value of Price4 //if (ItemInventoryRet.UnitOfMeasure3.Price4 != null) //{ //double Price4201 = (double)ItemInventoryRet.UnitOfMeasure3.Price4.GetValue(); //} ////Get value of Price5 //if (ItemInventoryRet.UnitOfMeasure3.Price5 != null) //{ //double Price5202 = (double)ItemInventoryRet.UnitOfMeasure3.Price5.GetValue(); //} ////Get value of UnitOfMeasure //if (ItemInventoryRet.UnitOfMeasure3.UnitOfMeasure != null) //{ //string UnitOfMeasure203 = (string)ItemInventoryRet.UnitOfMeasure3.UnitOfMeasure.GetValue(); //} ////Get value of UPC //if (ItemInventoryRet.UnitOfMeasure3.UPC != null) //{ //string UPC204 = (string)ItemInventoryRet.UnitOfMeasure3.UPC.GetValue(); //} //} //if (ItemInventoryRet.VendorInfo2 != null) //{ ////Get value of ALU //if (ItemInventoryRet.VendorInfo2.ALU != null) //{ //string ALU205 = (string)ItemInventoryRet.VendorInfo2.ALU.GetValue(); //} ////Get value of OrderCost //if (ItemInventoryRet.VendorInfo2.OrderCost != null) //{ //double OrderCost206 = (double)ItemInventoryRet.VendorInfo2.OrderCost.GetValue(); //} ////Get value of UPC //if (ItemInventoryRet.VendorInfo2.UPC != null) //{ //string UPC207 = (string)ItemInventoryRet.VendorInfo2.UPC.GetValue(); //} ////Get value of VendorListID //string VendorListID208 = (string)ItemInventoryRet.VendorInfo2.VendorListID.GetValue(); //} //if (ItemInventoryRet.VendorInfo3 != null) //{ ////Get value of ALU //if (ItemInventoryRet.VendorInfo3.ALU != null) //{ //string ALU209 = (string)ItemInventoryRet.VendorInfo3.ALU.GetValue(); //} ////Get value of OrderCost //if (ItemInventoryRet.VendorInfo3.OrderCost != null) //{ //double OrderCost210 = (double)ItemInventoryRet.VendorInfo3.OrderCost.GetValue(); //} ////Get value of UPC //if (ItemInventoryRet.VendorInfo3.UPC != null) //{ //string UPC211 = (string)ItemInventoryRet.VendorInfo3.UPC.GetValue(); //} ////Get value of VendorListID //string VendorListID212 = (string)ItemInventoryRet.VendorInfo3.VendorListID.GetValue(); //} //if (ItemInventoryRet.VendorInfo4 != null) //{ ////Get value of ALU //if (ItemInventoryRet.VendorInfo4.ALU != null) //{ //string ALU213 = (string)ItemInventoryRet.VendorInfo4.ALU.GetValue(); //} ////Get value of OrderCost //if (ItemInventoryRet.VendorInfo4.OrderCost != null) //{ //double OrderCost214 = (double)ItemInventoryRet.VendorInfo4.OrderCost.GetValue(); //} ////Get value of UPC //if (ItemInventoryRet.VendorInfo4.UPC != null) //{ //string UPC215 = (string)ItemInventoryRet.VendorInfo4.UPC.GetValue(); //} ////Get value of VendorListID //string VendorListID216 = (string)ItemInventoryRet.VendorInfo4.VendorListID.GetValue(); //} //if (ItemInventoryRet.VendorInfo5 != null) //{ ////Get value of ALU //if (ItemInventoryRet.VendorInfo5.ALU != null) //{ //string ALU217 = (string)ItemInventoryRet.VendorInfo5.ALU.GetValue(); //} ////Get value of OrderCost //if (ItemInventoryRet.VendorInfo5.OrderCost != null) //{ //double OrderCost218 = (double)ItemInventoryRet.VendorInfo5.OrderCost.GetValue(); //} ////Get value of UPC //if (ItemInventoryRet.VendorInfo5.UPC != null) //{ //string UPC219 = (string)ItemInventoryRet.VendorInfo5.UPC.GetValue(); //} ////Get value of VendorListID //string VendorListID220 = (string)ItemInventoryRet.VendorInfo5.VendorListID.GetValue(); //} //if (ItemInventoryRet.DataExtRetList != null) //{ //for (int i221 = 0; i221 < ItemInventoryRet.DataExtRetList.Count; i221++) //{ //IDataExtRet DataExtRet = ItemInventoryRet.DataExtRetList.GetAt(i221); ////Get value of OwnerID //string OwnerID222 = (string)DataExtRet.OwnerID.GetValue(); ////Get value of DataExtName //string DataExtName223 = (string)DataExtRet.DataExtName.GetValue(); ////Get value of DataExtType //ENDataExtType DataExtType224 = (ENDataExtType)DataExtRet.DataExtType.GetValue(); ////Get value of DataExtValue //string DataExtValue225 = (string)DataExtRet.DataExtValue.GetValue(); //} //} #endregion itmList.Add(itm); } return(itmList); }
public void Initialize() { _isPresentAmountCanEdit = true; using (var businessPartnerService = SvcClientManager.GetSvcClient<BusinessPartnerServiceClient>(SvcType.BusinessPartnerSvc)) { List<BusinessPartner> list = businessPartnerService.GetInternalCustomersByUser(CurrentUser.Id); if (list.Count > 0) { _idList = list.Select(c => c.Id).ToList(); } _applicants = businessPartnerService.GetInternalCustomersByUser(CurrentUser.Id); _applicants.Insert(0, new BusinessPartner ()); } _deliveries = new TrackableCollection<Delivery>(); _showCommercialInvoiceLines = new TrackableCollection<CommercialInvoice>(); BindCboList(); if (ObjectId > 0) { LoadAttachments(); using ( var letterOfCreditService = SvcClientManager.GetSvcClient<LetterOfCreditServiceClient>(SvcType.LetterOfCreditSvc)) { const string strInfo = "it.Id = @p1 "; var parameters = new List<object> {ObjectId}; LetterOfCredit letterOfCredit = letterOfCreditService.Select(strInfo, parameters, new List<string> { "Quota", "Quota.Currency", "BusinessPartner", "BusinessPartner1", "Currency", "Deliveries", "LCCIRels.CommercialInvoice" }).FirstOrDefault(); if (letterOfCredit != null) { _amount = letterOfCredit.IssueAmount; _lcNo = letterOfCredit.LCNo; _lcType = letterOfCredit.LCType; _lcStatusId = letterOfCredit.LCStatus; _applicantId = letterOfCredit.ApplicantId; _beneficiaryId = letterOfCredit.BeneficiaryId; _beneficiaryName = letterOfCredit.BusinessPartner1.ShortName; _currencyName = letterOfCredit.Currency.Name; _currencyId = letterOfCredit.CurrencyId; _lcDays = letterOfCredit.LCDays; _promptBasisId = letterOfCredit.PromptBasis; _advisingBankId = letterOfCredit.AdvisingBankId; _issueBankId = letterOfCredit.IssueBankId; _issueDate = letterOfCredit.IssueDate; _issueQuantity = letterOfCredit.IssueQuantity; _acceptanceExpiryDate = letterOfCredit.AcceptanceExpiryDate; _lcExpiryDate = letterOfCredit.LCExpiryDate; _latestShippmentDate = letterOfCredit.LatestShippmentDate; _actualAcceptanceDate = letterOfCredit.ActualAcceptanceDate; _presentAmount = letterOfCredit.PresentAmount; _presentDate = letterOfCredit.PresentDate; _comment = letterOfCredit.Comment; _iborType = letterOfCredit.IBORType; _financeStatus = letterOfCredit.FinancialStatus ? 1 : 0; _iborValue = letterOfCredit.IBORValue; _float = letterOfCredit.Float; _interest = letterOfCredit.Interest; _quotaNo = letterOfCredit.Quota == null ? "" : letterOfCredit.Quota.QuotaNo; _selectedQuotaId = letterOfCredit.QuotaId; _deliveries = letterOfCredit.Deliveries; _paymentRequestId = letterOfCredit.PaymentRequestId; if (letterOfCredit.Quota != null) { _IsLCFinished = letterOfCredit.Quota.IsFundflowFinished ?? true; } FilterDeleted(letterOfCredit.LCCIRels); if (letterOfCredit.LCCIRels != null && letterOfCredit.LCCIRels.Count > 0) { _isPresentAmountCanEdit = false; _showCommercialInvoiceLines.Clear(); foreach (var rel in letterOfCredit.LCCIRels) { _showCommercialInvoiceLines.Add(rel.CommercialInvoice); } } } } } else { LCStatusId = (int)DBEntity.EnumEntity.LCStatus.Issued; } PropertyChanged += LetterOfCreditDetailVMPropertyChanged; }
/** * NEWLY ADDED * IMPLEMENT GET ORDER BY EXTERNAL ID */ public Order GetOrderByExternalId(String pId) { using (VideoStoreEntityModelContainer lContainer = new VideoStoreEntityModelContainer()) { Order lOrder = lContainer.Orders.Where((pOrder) => pOrder.ExternalId == pId).FirstOrDefault(); User lUser = lContainer.Users.Where((pUser) => pUser.Id == lOrder.UserId).FirstOrDefault(); lOrder.Customer = lUser; List<OrderItem> lOrderItems = lContainer.OrderItems.Where((pOrderItem) => pOrderItem.order_Id == lOrder.ExternalOrderId).ToList<OrderItem>(); TrackableCollection<OrderItem> lTrackableOrderItems = new TrackableCollection<OrderItem>(); foreach(OrderItem lItem in lOrderItems) { Media lMedia = lContainer.Medias.Where((pMedia) => pMedia.Id == lItem.MediaId).FirstOrDefault(); Stock lStock = lContainer.Stocks.Where((pStock) => pStock.MediaId == lItem.MediaId).FirstOrDefault(); lMedia.Stocks = lStock; lItem.Media = lMedia; lTrackableOrderItems.Add(lItem); } lOrder.OrderItems = lTrackableOrderItems; return lOrder; } }
TrackableCollection <SalesReceiptRet> WalkSalesReceiptRet(ISalesReceiptRetList SalesReceiptRetList) { var xSaleReceiptList = new TrackableCollection <SalesReceiptRet>(null); if (SalesReceiptRetList == null) { return(xSaleReceiptList); } for (var i = 0; i < SalesReceiptRetList.Count; i++) { var SalesReceiptRet = SalesReceiptRetList.GetAt(i); var xSale = new SalesReceiptRet(); //Go through all the elements of ISalesReceiptRetList // Get value of TxnID if (SalesReceiptRet.TxnID != null) { xSale.TxnID = (string)SalesReceiptRet.TxnID.GetValue(); } //Get value of TimeCreated if (SalesReceiptRet.TimeCreated != null) { xSale.TimeCreated = (DateTime)SalesReceiptRet.TimeCreated.GetValue(); } //Get value of TimeModified if (SalesReceiptRet.TimeModified != null) { xSale.TimeModified = (DateTime)SalesReceiptRet.TimeModified.GetValue(); } //Get value of Associate if (SalesReceiptRet.Associate != null) { xSale.Associate = (string)SalesReceiptRet.Associate.GetValue(); } //Get value of Cashier if (SalesReceiptRet.Cashier != null) { xSale.Cashier = (string)SalesReceiptRet.Cashier.GetValue(); } //Get value of Comments if (SalesReceiptRet.Comments != null) { xSale.Comments = (string)SalesReceiptRet.Comments.GetValue(); } //Get value of CustomerListID if (SalesReceiptRet.CustomerListID != null) { xSale.CustomerListID = (string)SalesReceiptRet.CustomerListID.GetValue(); } //Get value of Discount if (SalesReceiptRet.Discount != null) { xSale.Discount = (decimal)SalesReceiptRet.Discount.GetValue(); } //Get value of DiscountPercent if (SalesReceiptRet.DiscountPercent != null) { xSale.DiscountPercent = (decimal)SalesReceiptRet.DiscountPercent.GetValue(); } //Get value of HistoryDocStatus if (SalesReceiptRet.HistoryDocStatus != null) { xSale.HistoryDocStatus = ((ENHistoryDocStatus)SalesReceiptRet.HistoryDocStatus.GetValue()).ToString(); } //Get value of ItemsCount if (SalesReceiptRet.ItemsCount != null) { xSale.ItemsCount = ((int)SalesReceiptRet.ItemsCount.GetValue()).ToString(); } //Get value of PriceLevelNumber if (SalesReceiptRet.PriceLevelNumber != null) { xSale.PriceLevelNumber = (int)SalesReceiptRet.PriceLevelNumber.GetValue();//ENPriceLevelNumber } //Get value of PromoCode if (SalesReceiptRet.PromoCode != null) { xSale.PromoCode = (string)SalesReceiptRet.PromoCode.GetValue(); } //Get value of QuickBooksFlag if (SalesReceiptRet.QuickBooksFlag != null) { xSale.QuickBooksFlag = ((ENQuickBooksFlag)SalesReceiptRet.QuickBooksFlag.GetValue()).ToString(); } //Get value of SalesOrderTxnID if (SalesReceiptRet.SalesOrderTxnID != null) { xSale.SalesOrderTxnID = (string)SalesReceiptRet.SalesOrderTxnID.GetValue(); } //Get value of SalesReceiptNumber if (SalesReceiptRet.SalesReceiptNumber != null) { xSale.SalesReceiptNumber = ((int)SalesReceiptRet.SalesReceiptNumber.GetValue()).ToString(); } //Get value of SalesReceiptType if (SalesReceiptRet.SalesReceiptType != null) { xSale.SalesReceiptType = ((ENSalesReceiptType)SalesReceiptRet.SalesReceiptType.GetValue()).ToString(); } //Get value of ShipDate if (SalesReceiptRet.ShipDate != null) { xSale.ShipDate = (DateTime)SalesReceiptRet.ShipDate.GetValue(); } //Get value of StoreExchangeStatus if (SalesReceiptRet.StoreExchangeStatus != null) { xSale.StoreExchangeStatus = ((ENStoreExchangeStatus)SalesReceiptRet.StoreExchangeStatus.GetValue()).ToString(); } //Get value of StoreNumber if (SalesReceiptRet.StoreNumber != null) { xSale.StoreNumber = ((int)SalesReceiptRet.StoreNumber.GetValue()).ToString(); } //Get value of Subtotal if (SalesReceiptRet.Subtotal != null) { xSale.Subtotal = (Decimal)SalesReceiptRet.Subtotal.GetValue(); } //Get value of TaxAmount if (SalesReceiptRet.TaxAmount != null) { xSale.TaxAmount = ((decimal)SalesReceiptRet.TaxAmount.GetValue()); } //Get value of TaxCategory if (SalesReceiptRet.TaxCategory != null) { xSale.TaxCategory = (string)SalesReceiptRet.TaxCategory.GetValue(); } //Get value of TaxPercentage if (SalesReceiptRet.TaxPercentage != null) { xSale.TaxPercentage = (decimal)SalesReceiptRet.TaxPercentage.GetValue(); } //Get value of TenderType //if (SalesReceiptRet.TenderType != null) //{ // ENTenderType TenderType328 = (ENTenderType)SalesReceiptRet.TenderType.GetValue(); //} //Get value of TipReceiver //if (SalesReceiptRet.TipReceiver != null) //{ // string TipReceiver329 = (string)SalesReceiptRet.TipReceiver.GetValue(); //} //Get value of Total if (SalesReceiptRet.Total != null) { xSale.Total = (decimal)SalesReceiptRet.Total.GetValue(); } //Get value of TrackingNumber if (SalesReceiptRet.TrackingNumber != null) { xSale.TrackingNumber = (string)SalesReceiptRet.TrackingNumber.GetValue(); } //Get value of TxnDate if (SalesReceiptRet.TxnDate != null) { xSale.TxnDate = (DateTime)SalesReceiptRet.TxnDate.GetValue(); } #region "dm code" ////Get value of TxnState //if (SalesReceiptRet.TxnState != null) //{ // ENTxnState TxnState333 = (ENTxnState)SalesReceiptRet.TxnState.GetValue(); //} ////Get value of Workstation //if (SalesReceiptRet.Workstation != null) //{ // int Workstation334 = (int)SalesReceiptRet.Workstation.GetValue(); //} //if (SalesReceiptRet.BillingInformation != null) //{ // //Get value of City // if (SalesReceiptRet.BillingInformation.City != null) // { // string City335 = (string)SalesReceiptRet.BillingInformation.City.GetValue(); // } // //Get value of CompanyName // if (SalesReceiptRet.BillingInformation.CompanyName != null) // { // string CompanyName336 = (string)SalesReceiptRet.BillingInformation.CompanyName.GetValue(); // } // //Get value of Country // if (SalesReceiptRet.BillingInformation.Country != null) // { // string Country337 = (string)SalesReceiptRet.BillingInformation.Country.GetValue(); // } // //Get value of FirstName // if (SalesReceiptRet.BillingInformation.FirstName != null) // { // string FirstName338 = (string)SalesReceiptRet.BillingInformation.FirstName.GetValue(); // } // //Get value of LastName // if (SalesReceiptRet.BillingInformation.LastName != null) // { // string LastName339 = (string)SalesReceiptRet.BillingInformation.LastName.GetValue(); // } // //Get value of Phone // if (SalesReceiptRet.BillingInformation.Phone != null) // { // string Phone340 = (string)SalesReceiptRet.BillingInformation.Phone.GetValue(); // } // //Get value of Phone2 // if (SalesReceiptRet.BillingInformation.Phone2 != null) // { // string Phone2341 = (string)SalesReceiptRet.BillingInformation.Phone2.GetValue(); // } // //Get value of Phone3 // if (SalesReceiptRet.BillingInformation.Phone3 != null) // { // string Phone3342 = (string)SalesReceiptRet.BillingInformation.Phone3.GetValue(); // } // //Get value of Phone4 // if (SalesReceiptRet.BillingInformation.Phone4 != null) // { // string Phone4343 = (string)SalesReceiptRet.BillingInformation.Phone4.GetValue(); // } // //Get value of PostalCode // if (SalesReceiptRet.BillingInformation.PostalCode != null) // { // string PostalCode344 = (string)SalesReceiptRet.BillingInformation.PostalCode.GetValue(); // } // //Get value of Salutation // if (SalesReceiptRet.BillingInformation.Salutation != null) // { // string Salutation345 = (string)SalesReceiptRet.BillingInformation.Salutation.GetValue(); // } // //Get value of State // if (SalesReceiptRet.BillingInformation.State != null) // { // string State346 = (string)SalesReceiptRet.BillingInformation.State.GetValue(); // } // //Get value of Street // if (SalesReceiptRet.BillingInformation.Street != null) // { // string Street347 = (string)SalesReceiptRet.BillingInformation.Street.GetValue(); // } // //Get value of Street2 // if (SalesReceiptRet.BillingInformation.Street2 != null) // { // string Street2348 = (string)SalesReceiptRet.BillingInformation.Street2.GetValue(); // } // //Get value of WebNumber // if (SalesReceiptRet.BillingInformation.WebNumber != null) // { // string WebNumber349 = (string)SalesReceiptRet.BillingInformation.WebNumber.GetValue(); // } //} //if (SalesReceiptRet.ShippingInformation != null) //{ // //Get value of AddressName // if (SalesReceiptRet.ShippingInformation.AddressName != null) // { // string AddressName350 = (string)SalesReceiptRet.ShippingInformation.AddressName.GetValue(); // } // //Get value of City // if (SalesReceiptRet.ShippingInformation.City != null) // { // string City351 = (string)SalesReceiptRet.ShippingInformation.City.GetValue(); // } // //Get value of CompanyName // if (SalesReceiptRet.ShippingInformation.CompanyName != null) // { // string CompanyName352 = (string)SalesReceiptRet.ShippingInformation.CompanyName.GetValue(); // } // //Get value of Country // if (SalesReceiptRet.ShippingInformation.Country != null) // { // string Country353 = (string)SalesReceiptRet.ShippingInformation.Country.GetValue(); // } // //Get value of FullName // if (SalesReceiptRet.ShippingInformation.FullName != null) // { // string FullName354 = (string)SalesReceiptRet.ShippingInformation.FullName.GetValue(); // } // //Get value of Phone // if (SalesReceiptRet.ShippingInformation.Phone != null) // { // string Phone355 = (string)SalesReceiptRet.ShippingInformation.Phone.GetValue(); // } // //Get value of Phone2 // if (SalesReceiptRet.ShippingInformation.Phone2 != null) // { // string Phone2356 = (string)SalesReceiptRet.ShippingInformation.Phone2.GetValue(); // } // //Get value of Phone3 // if (SalesReceiptRet.ShippingInformation.Phone3 != null) // { // string Phone3357 = (string)SalesReceiptRet.ShippingInformation.Phone3.GetValue(); // } // //Get value of Phone4 // if (SalesReceiptRet.ShippingInformation.Phone4 != null) // { // string Phone4358 = (string)SalesReceiptRet.ShippingInformation.Phone4.GetValue(); // } // //Get value of PostalCode // if (SalesReceiptRet.ShippingInformation.PostalCode != null) // { // string PostalCode359 = (string)SalesReceiptRet.ShippingInformation.PostalCode.GetValue(); // } // //Get value of ShipBy // if (SalesReceiptRet.ShippingInformation.ShipBy != null) // { // string ShipBy360 = (string)SalesReceiptRet.ShippingInformation.ShipBy.GetValue(); // } // //Get value of Shipping // if (SalesReceiptRet.ShippingInformation.Shipping != null) // { // double Shipping361 = (double)SalesReceiptRet.ShippingInformation.Shipping.GetValue(); // } // //Get value of State // if (SalesReceiptRet.ShippingInformation.State != null) // { // string State362 = (string)SalesReceiptRet.ShippingInformation.State.GetValue(); // } // //Get value of Street // if (SalesReceiptRet.ShippingInformation.Street != null) // { // string Street363 = (string)SalesReceiptRet.ShippingInformation.Street.GetValue(); // } // //Get value of Street2 // if (SalesReceiptRet.ShippingInformation.Street2 != null) // { // string Street2364 = (string)SalesReceiptRet.ShippingInformation.Street2.GetValue(); // } //} #endregion if (SalesReceiptRet.SalesReceiptItemRetList != null) { xSale.SalesReceiptItems = new TrackableCollection <SalesReceiptRetSalesReceiptItemRet>(null); for (var i365 = 0; i365 < SalesReceiptRet.SalesReceiptItemRetList.Count; i365++) { var xSaleReceiptItem = new SalesReceiptRetSalesReceiptItemRet(); var SalesReceiptItemRet = SalesReceiptRet.SalesReceiptItemRetList.GetAt(i365); //Get value of ListID if (SalesReceiptItemRet.ListID != null) { xSaleReceiptItem.ListID = (string)SalesReceiptItemRet.ListID.GetValue(); } //Get value of ALU if (SalesReceiptItemRet.ALU != null) { xSaleReceiptItem.ALU = (string)SalesReceiptItemRet.ALU.GetValue(); } //Get value of Associate if (SalesReceiptItemRet.Associate != null) { xSaleReceiptItem.Associate = (string)SalesReceiptItemRet.Associate.GetValue(); } //Get value of Attribute if (SalesReceiptItemRet.Attribute != null) { xSaleReceiptItem.Attribute = (string)SalesReceiptItemRet.Attribute.GetValue(); } //Get value of Commission if (SalesReceiptItemRet.Commission != null) { xSaleReceiptItem.Commission = (decimal)SalesReceiptItemRet.Commission.GetValue(); } //Get value of Cost if (SalesReceiptItemRet.Cost != null) { xSaleReceiptItem.Cost = (decimal)SalesReceiptItemRet.Cost.GetValue(); } //Get value of Desc1 if (SalesReceiptItemRet.Desc1 != null) { xSaleReceiptItem.Desc1 = (string)SalesReceiptItemRet.Desc1.GetValue(); } //Get value of Desc2 if (SalesReceiptItemRet.Desc2 != null) { xSaleReceiptItem.Desc2 = (string)SalesReceiptItemRet.Desc2.GetValue(); } //Get value of Discount if (SalesReceiptItemRet.Discount != null) { xSaleReceiptItem.Discount = (decimal)SalesReceiptItemRet.Discount.GetValue(); } //Get value of DiscountPercent if (SalesReceiptItemRet.DiscountPercent != null) { xSaleReceiptItem.DiscountPercent = (decimal)SalesReceiptItemRet.DiscountPercent.GetValue(); } //Get value of DiscountType if (SalesReceiptItemRet.DiscountType != null) { xSaleReceiptItem.DiscountType = (string)SalesReceiptItemRet.DiscountType.GetValue(); } //Get value of DiscountSource if (SalesReceiptItemRet.DiscountSource != null) { xSaleReceiptItem.DiscountSource = ((ENDiscountSource)SalesReceiptItemRet.DiscountSource.GetValue()).ToString(); } //Get value of ExtendedPrice if (SalesReceiptItemRet.ExtendedPrice != null) { xSaleReceiptItem.ExtendedPrice = (decimal)SalesReceiptItemRet.ExtendedPrice.GetValue(); } //Get value of ExtendedTax if (SalesReceiptItemRet.ExtendedTax != null) { xSaleReceiptItem.ExtendedTax = (decimal)SalesReceiptItemRet.ExtendedTax.GetValue(); } //Get value of ItemNumber if (SalesReceiptItemRet.ItemNumber != null) { xSaleReceiptItem.ItemNumber = ((int)SalesReceiptItemRet.ItemNumber.GetValue()).ToString(); } //Get value of NumberOfBaseUnits if (SalesReceiptItemRet.NumberOfBaseUnits != null) { xSaleReceiptItem.NumberOfBaseUnits = ((int)SalesReceiptItemRet.NumberOfBaseUnits.GetValue()).ToString(); } //Get value of Price if (SalesReceiptItemRet.Price != null) { xSaleReceiptItem.Price = (decimal)SalesReceiptItemRet.Price.GetValue(); } //Get value of PriceLevelNumber if (SalesReceiptItemRet.PriceLevelNumber != null) { xSaleReceiptItem.PriceLevelNumber = ((ENPriceLevelNumber)SalesReceiptItemRet.PriceLevelNumber.GetValue()).ToString(); } //Get value of Qty if (SalesReceiptItemRet.Qty != null) { xSaleReceiptItem.Qty = ((int)SalesReceiptItemRet.Qty.GetValue()).ToString(); } //Get value of SerialNumber if (SalesReceiptItemRet.SerialNumber != null) { xSaleReceiptItem.SerialNumber = (string)SalesReceiptItemRet.SerialNumber.GetValue(); } //Get value of Size if (SalesReceiptItemRet.Size != null) { xSaleReceiptItem.Size = (string)SalesReceiptItemRet.Size.GetValue(); } //Get value of TaxAmount if (SalesReceiptItemRet.TaxAmount != null) { xSaleReceiptItem.TaxAmount = (decimal)SalesReceiptItemRet.TaxAmount.GetValue(); } //Get value of TaxCode if (SalesReceiptItemRet.TaxCode != null) { xSaleReceiptItem.TaxCode = (string)SalesReceiptItemRet.TaxCode.GetValue(); } //Get value of TaxPercentage if (SalesReceiptItemRet.TaxPercentage != null) { xSaleReceiptItem.TaxPercentage = (decimal)SalesReceiptItemRet.TaxPercentage.GetValue(); } //Get value of UnitOfMeasure if (SalesReceiptItemRet.UnitOfMeasure != null) { xSaleReceiptItem.UnitOfMeasure = (string)SalesReceiptItemRet.UnitOfMeasure.GetValue(); } //Get value of UPC if (SalesReceiptItemRet.UPC != null) { xSaleReceiptItem.UPC = (string)SalesReceiptItemRet.UPC.GetValue(); } //Get value of WebDesc if (SalesReceiptItemRet.WebDesc != null) { xSaleReceiptItem.WebDesc = (string)SalesReceiptItemRet.WebDesc.GetValue(); } //Get value of Manufacturer if (SalesReceiptItemRet.Manufacturer != null) { xSaleReceiptItem.Manufacturer = (string)SalesReceiptItemRet.Manufacturer.GetValue(); } //Get value of Weight if (SalesReceiptItemRet.Weight != null) { xSaleReceiptItem.Weight = (decimal)SalesReceiptItemRet.Weight.GetValue(); } //Get value of WebSKU if (SalesReceiptItemRet.WebSKU != null) { xSaleReceiptItem.WebSKU = (string)SalesReceiptItemRet.WebSKU.GetValue(); } xSale.SalesReceiptItems.Add(xSaleReceiptItem); } } #region "morecode" //if (SalesReceiptRet.TenderAccountRetList != null) //{ // for (int i396 = 0; i396 < SalesReceiptRet.TenderAccountRetList.Count; i396++) // { // ITenderAccountRet TenderAccountRet = SalesReceiptRet.TenderAccountRetList.GetAt(i396); // //Get value of TenderAmount // if (TenderAccountRet.TenderAmount != null) // { // double TenderAmount397 = (double)TenderAccountRet.TenderAmount.GetValue(); // } // //Get value of TipAmount // if (TenderAccountRet.TipAmount != null) // { // double TipAmount398 = (double)TenderAccountRet.TipAmount.GetValue(); // } // } //} //if (SalesReceiptRet.TenderCashRetList != null) //{ // for (int i399 = 0; i399 < SalesReceiptRet.TenderCashRetList.Count; i399++) // { // ITenderCashRet TenderCashRet = SalesReceiptRet.TenderCashRetList.GetAt(i399); // //Get value of TenderAmount // if (TenderCashRet.TenderAmount != null) // { // double TenderAmount400 = (double)TenderCashRet.TenderAmount.GetValue(); // } // } //} //if (SalesReceiptRet.TenderCheckRetList != null) //{ // for (int i401 = 0; i401 < SalesReceiptRet.TenderCheckRetList.Count; i401++) // { // ITenderCheckRet TenderCheckRet = SalesReceiptRet.TenderCheckRetList.GetAt(i401); // //Get value of CheckNumber // if (TenderCheckRet.CheckNumber != null) // { // string CheckNumber402 = (string)TenderCheckRet.CheckNumber.GetValue(); // } // //Get value of TenderAmount // if (TenderCheckRet.TenderAmount != null) // { // double TenderAmount403 = (double)TenderCheckRet.TenderAmount.GetValue(); // } // } //} //if (SalesReceiptRet.TenderCreditCardRetList != null) //{ // for (int i404 = 0; i404 < SalesReceiptRet.TenderCreditCardRetList.Count; i404++) // { // ITenderCreditCardRet TenderCreditCardRet = SalesReceiptRet.TenderCreditCardRetList.GetAt(i404); // //Get value of CardName // if (TenderCreditCardRet.CardName != null) // { // string CardName405 = (string)TenderCreditCardRet.CardName.GetValue(); // } // //Get value of TenderAmount // if (TenderCreditCardRet.TenderAmount != null) // { // double TenderAmount406 = (double)TenderCreditCardRet.TenderAmount.GetValue(); // } // //Get value of TipAmount // if (TenderCreditCardRet.TipAmount != null) // { // double TipAmount407 = (double)TenderCreditCardRet.TipAmount.GetValue(); // } // } //} //if (SalesReceiptRet.TenderDebitCardRetList != null) //{ // for (int i408 = 0; i408 < SalesReceiptRet.TenderDebitCardRetList.Count; i408++) // { // ITenderDebitCardRet TenderDebitCardRet = SalesReceiptRet.TenderDebitCardRetList.GetAt(i408); // //Get value of Cashback // if (TenderDebitCardRet.Cashback != null) // { // double Cashback409 = (double)TenderDebitCardRet.Cashback.GetValue(); // } // //Get value of TenderAmount // if (TenderDebitCardRet.TenderAmount != null) // { // double TenderAmount410 = (double)TenderDebitCardRet.TenderAmount.GetValue(); // } // } //} //if (SalesReceiptRet.TenderDepositRetList != null) //{ // for (int i411 = 0; i411 < SalesReceiptRet.TenderDepositRetList.Count; i411++) // { // ITenderDepositRet TenderDepositRet = SalesReceiptRet.TenderDepositRetList.GetAt(i411); // //Get value of TenderAmount // if (TenderDepositRet.TenderAmount != null) // { // double TenderAmount412 = (double)TenderDepositRet.TenderAmount.GetValue(); // } // } //} //if (SalesReceiptRet.TenderGiftRetList != null) //{ // for (int i413 = 0; i413 < SalesReceiptRet.TenderGiftRetList.Count; i413++) // { // ITenderGiftRet TenderGiftRet = SalesReceiptRet.TenderGiftRetList.GetAt(i413); // //Get value of GiftCertificateNumber // if (TenderGiftRet.GiftCertificateNumber != null) // { // string GiftCertificateNumber414 = (string)TenderGiftRet.GiftCertificateNumber.GetValue(); // } // //Get value of TenderAmount // if (TenderGiftRet.TenderAmount != null) // { // double TenderAmount415 = (double)TenderGiftRet.TenderAmount.GetValue(); // } // } //} //if (SalesReceiptRet.TenderGiftCardRetList != null) //{ // for (int i416 = 0; i416 < SalesReceiptRet.TenderGiftCardRetList.Count; i416++) // { // ITenderGiftCardRet TenderGiftCardRet = SalesReceiptRet.TenderGiftCardRetList.GetAt(i416); // //Get value of TenderAmount // if (TenderGiftCardRet.TenderAmount != null) // { // double TenderAmount417 = (double)TenderGiftCardRet.TenderAmount.GetValue(); // } // //Get value of TipAmount // if (TenderGiftCardRet.TipAmount != null) // { // double TipAmount418 = (double)TenderGiftCardRet.TipAmount.GetValue(); // } // } //} //if (SalesReceiptRet.DataExtRetList != null) //{ // for (int i419 = 0; i419 < SalesReceiptRet.DataExtRetList.Count; i419++) // { // IDataExtRet DataExtRet = SalesReceiptRet.DataExtRetList.GetAt(i419); // //Get value of OwnerID // string OwnerID420 = (string)DataExtRet.OwnerID.GetValue(); // //Get value of DataExtName // string DataExtName421 = (string)DataExtRet.DataExtName.GetValue(); // //Get value of DataExtType // ENDataExtType DataExtType422 = (ENDataExtType)DataExtRet.DataExtType.GetValue(); // //Get value of DataExtValue // string DataExtValue423 = (string)DataExtRet.DataExtValue.GetValue(); // } //} #endregion xSaleReceiptList.Add(xSale); } return(xSaleReceiptList); }
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); }
private void ProcessNewBlock(Block block) { Coin[] changeset; lock (contracts) lock (coins) { foreach (Transaction tx in block.Transactions) { for (ushort index = 0; index < tx.Outputs.Length; index++) { TransactionOutput output = tx.Outputs[index]; AddressState state = CheckAddressState(output.ScriptHash); if (state.HasFlag(AddressState.InWallet)) { CoinReference key = new CoinReference { PrevHash = tx.Hash, PrevIndex = index }; if (coins.Contains(key)) { coins[key].State |= CoinState.Confirmed; } else { coins.Add(new Coin { Reference = key, Output = output, State = CoinState.Confirmed }); } if (state.HasFlag(AddressState.WatchOnly)) { coins[key].State |= CoinState.WatchOnly; } } } } foreach (Transaction tx in block.Transactions) { foreach (CoinReference input in tx.Inputs) { if (coins.Contains(input)) { if (coins[input].Output.AssetId.Equals(Blockchain.SystemShare.Hash)) { coins[input].State |= CoinState.Spent | CoinState.Confirmed; } else { coins.Remove(input); } } } } foreach (ClaimTransaction tx in block.Transactions.OfType <ClaimTransaction>()) { foreach (CoinReference claim in tx.Claims) { if (coins.Contains(claim)) { coins.Remove(claim); } } } current_height++; changeset = coins.GetChangeSet(); OnProcessNewBlock(block, changeset.Where(p => ((ITrackable <CoinReference>)p).TrackState == TrackState.Added), changeset.Where(p => ((ITrackable <CoinReference>)p).TrackState == TrackState.Changed), changeset.Where(p => ((ITrackable <CoinReference>)p).TrackState == TrackState.Deleted)); coins.Commit(); } if (changeset.Length > 0) { BalanceChanged?.Invoke(this, EventArgs.Empty); } }
private void ProcessNewBlock(Block block) { Coin[] changeset; lock (contracts) lock (coins) { foreach (Transaction tx in block.Transactions) { for (ushort index = 0; index < tx.Outputs.Length; index++) { TransactionOutput output = tx.Outputs[index]; if (contracts.ContainsKey(output.ScriptHash)) { TransactionInput key = new TransactionInput { PrevHash = tx.Hash, PrevIndex = index }; if (coins.Contains(key)) { coins[key].State = CoinState.Unspent; } else { coins.Add(new Coin { Input = key, AssetId = output.AssetId, Value = output.Value, ScriptHash = output.ScriptHash, State = CoinState.Unspent }); } } } } foreach (Transaction tx in block.Transactions) { foreach (TransactionInput input in tx.GetAllInputs()) { if (coins.Contains(input)) { if (coins[input].AssetId == Blockchain.AntShare.Hash) { coins[input].State = CoinState.Spent; } else { coins.Remove(input); } } } } foreach (ClaimTransaction tx in block.Transactions.OfType <ClaimTransaction>()) { foreach (TransactionInput claim in tx.Claims) { if (coins.Contains(claim)) { coins.Remove(claim); } } } current_height++; changeset = coins.GetChangeSet(); OnProcessNewBlock(block, changeset.Where(p => ((ITrackable <TransactionInput>)p).TrackState == TrackState.Added), changeset.Where(p => ((ITrackable <TransactionInput>)p).TrackState == TrackState.Changed), changeset.Where(p => ((ITrackable <TransactionInput>)p).TrackState == TrackState.Deleted)); coins.Commit(); } if (changeset.Length > 0) { BalanceChanged?.Invoke(this, EventArgs.Empty); } }
public void Add(T item) { _underlyingData.Add(item); }