Beispiel #1
0
        public PaymentInfo getPaymentInfo(string paymentId,PaymentType paymentType,DateTime startDate,DateTime endDate)
        {
            PaymentInfo paymentInfo = new PaymentInfo(paymentId, paymentType, startDate, endDate);

            foreach (PaymentInfo p in this.paymentsInfoList)
                if (p.Equals(paymentInfo))
                    return p;

            this.paymentsInfoList.Add(paymentInfo);
            return paymentInfo;
        }
Beispiel #2
0
        public static KeyValuePair<DateTime, ArrayList> read(StreamReader streamReader)
        {
            ArrayList transactions = new ArrayList();
            string accountNumber = null;
            PaymentInfo paymentInfo = null;
            DateTime startDate = new DateTime();

            string temp = streamReader.ReadToEnd();
            temp = temp.Replace("&nbsp;", "");
            temp = Database.removeScripts(temp);
            //System.IO.File.WriteAllText(@"C:\Users\Itay\Desktop\WriteText.txt", temp);

            StringBuilder sb = new StringBuilder();
            StringWriter sw = new StringWriter(sb);
            sw.Write(temp);
            sw.Close();
            StringReader sr = new StringReader(sb.ToString());

            using (XmlReader reader = XmlReader.Create(sr))
            {
                Transaction e = null;
                List<string> row;

                while ((row = getNextLine(reader)) != null)
                {
                    try
                    {
                        e = parseTransaction(row, startDate);
                        transactions.Add(e);
                    }
                    catch
                    {
                        try
                        {
                            string details = parseDetailsRow(row);
                            e.details = details;
                        }
                        catch
                        {
                            try
                            {
                                startDate = parseStartDateFromSumRow(row);
                                DateTime endDate = parseEndDateFromSumRow(row);

                                /* we should get here only once in START */
                                paymentInfo = new PaymentInfo(accountNumber, PaymentType.Poalim, startDate, endDate);
                            }
                            catch
                            {
                                try
                                {
                                    accountNumber = parseAccountNumber(row);
                                }
                                catch
                                {
                                }
                            }
                        }
                    }

                }
            }

            foreach (Transaction t in transactions)
                t.paymentInfo = paymentInfo;

            return new KeyValuePair<DateTime, ArrayList>(startDate, transactions);
        }