// Client public static clsListPaidAccounts fncGetPaidAccounts(string clientNumber) { string clNbr; double interestRate; string number, type; double balance; int day, month, year; StreamReader myTxt = new StreamReader("7.infoPaidAccount.txt"); clsListPaidAccounts tmp = new clsListPaidAccounts(); while (!myTxt.EndOfStream) { clNbr = myTxt.ReadLine(); double interestrate = Convert.ToDouble(myTxt.ReadLine()); interestRate = interestrate; number = myTxt.ReadLine(); type = myTxt.ReadLine(); balance = Convert.ToDouble(myTxt.ReadLine()); day = Convert.ToInt32(myTxt.ReadLine()); month = Convert.ToInt32(myTxt.ReadLine()); year = Convert.ToInt32(myTxt.ReadLine()); if (clNbr == clientNumber) { /// <summary> /// Constructor that takes seven arguments -> in the Function protected abstract : Pay interest. /// </summary> tmp.fncAdd(new clsPaidAccount(interestRate, number, type, balance, day, month, year)); } } myTxt.Close(); //MessageBox.Show("PaidAccounts : " + tmp.Quantity.ToString()); return(tmp); }
public static void fncWritePaidAccountsinXML() { listPaidAccounts = frmBank.fncGetvListPaidAccounts(); XmlWriterSettings set = new XmlWriterSettings(); set.Indent = true; XmlWriter writer = XmlWriter.Create(Application.StartupPath + @"/6.infoPaidAccountin.xml", set); writer.WriteStartDocument(); writer.WriteStartElement("PaidAccounts"); foreach (clsPaidAccount paidAccount in listPaidAccounts.Elements) { writer.WriteStartElement("PaidAccount"); writer.WriteElementString("interestRate", (paidAccount.vInterestRate / 100).ToString()); writer.WriteElementString("number", paidAccount.vNumber); writer.WriteElementString("type", paidAccount.vType); writer.WriteElementString("balance", paidAccount.vBalance.ToString()); writer.WriteElementString("openDay", paidAccount.vOpenDate.vDay.ToString()); writer.WriteElementString("openMonth", paidAccount.vOpenDate.vMonth.ToString()); writer.WriteElementString("openYear", paidAccount.vOpenDate.vYear.ToString()); writer.WriteEndElement(); } writer.WriteEndElement(); writer.WriteEndDocument(); writer.Close(); MessageBox.Show(listPaidAccounts.Quantity.ToString() + " Paid Accounts were added to a xml document !"); }
/// <summary> /// Constructor that takes five arguments with lists. /// </summary> public clsClient(string vNumber, string vName, string vLastName, string vNip, string vAddress, clsListUnpaidAccounts vListUnpaidAccounts, clsListPaidAccounts vListPaidAccounts) : base(vNumber, vName, vLastName) { clsClient.staticNbcounter++; clientIdCounter = staticNbcounter; Address = vAddress; Nip = vNip; ListUnpaidAccounts = vListUnpaidAccounts; ListPaidAccounts = vListPaidAccounts; }