I have a problem. I add numbers to ArrayList as 156, 340 (when it is TransferIn or Buy ), etc., and then I delete them, doing it as 156, 340 (when it is TransferOut , Sell ). The following solution works for this without problems. The problem is that for some old data, employees entered an amount equal to 1500 instead of 500 + 400 + 100 + 500. How can I change it so that if there is a Sell / TransferOut and a match inside the ArrayList, it should try to add several elements from this array ArrayList and find elements that are combined together.
ArrayList alNew = new ArrayList(); ArrayList alNewPoIle = new ArrayList(); ArrayList alNewCo = new ArrayList(); string tempAkcjeCzynnosc = (string) alInstrumentCzynnoscBezNumerow[i]; string tempAkcjeInId = (string) alInstrumentNazwaBezNumerow[i]; decimal varAkcjeCena = (decimal) alInstrumentCenaBezNumerow[i]; decimal varAkcjeIlosc = (decimal) alInstrumentIloscBezNumerow[i]; int index; switch (tempAkcjeCzynnosc) { case "Sell": case "TransferOut": index = alNew.IndexOf(varAkcjeIlosc); if (index != -1) { alNew.RemoveAt(index); alNewPoIle.RemoveAt(index); alNewCo.RemoveAt(index); } else {
Madboy
source share