public static clsListUnpaidAccounts fncGetUnpaidAccounts(string clientNumber) { string clNbr; double commission; int overdraft; string number, type; double balance; int day, month, year; StreamReader myTxt = new StreamReader("8.infoUnPaidAccount.txt"); clsListUnpaidAccounts tmp = new clsListUnpaidAccounts(); while (!myTxt.EndOfStream) { clNbr = myTxt.ReadLine(); commission = Convert.ToDouble(myTxt.ReadLine()); overdraft = Convert.ToInt32(myTxt.ReadLine()); 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 eigth arguments -> in the Function protected abstract : Charge commission. /// </summary> tmp.fncAdd(new clsUnpaidAccount(commission, overdraft, number, type, balance, day, month, year)); } } myTxt.Close(); // MessageBox.Show("UnPaidAccounts : " + tmp.Quantity.ToString()); return(tmp); }
public static void fncWriteUnPaidAccountsinXML() { listUnpaidAccounts = frmBank.fncGetvListUnPaidAccounts(); XmlWriterSettings set = new XmlWriterSettings(); set.Indent = true; XmlWriter writer = XmlWriter.Create(Application.StartupPath + @"/7.infoUnPaidAccountin.xml", set); writer.WriteStartDocument(); writer.WriteStartElement("UnPaidAccounts"); foreach (clsUnpaidAccount unPaidAccount in listUnpaidAccounts.Elements) { writer.WriteStartElement("UnPaidAccount"); writer.WriteElementString("commission", (unPaidAccount.vCommission).ToString()); writer.WriteElementString("overdraft", (unPaidAccount.vOverdraft).ToString()); writer.WriteElementString("number", unPaidAccount.vNumber); writer.WriteElementString("type", unPaidAccount.vType); writer.WriteElementString("balance", unPaidAccount.vBalance.ToString()); writer.WriteElementString("openDay", unPaidAccount.vOpenDate.vDay.ToString()); writer.WriteElementString("openMonth", unPaidAccount.vOpenDate.vMonth.ToString()); writer.WriteElementString("openYear", unPaidAccount.vOpenDate.vYear.ToString()); writer.WriteEndElement(); } writer.WriteEndElement(); writer.WriteEndDocument(); writer.Close(); MessageBox.Show(listUnpaidAccounts.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; }