Exemple #1
0
            public static void AddPlasticCard(string name, string BankAccount, string CardHolder, string CardNumber, string Date, CurrencyType currency, decimal Amount)
            {
                PlasticCard newPlasticCard = new PlasticCard()
                {
                    Name          = name,
                    BankAccount   = BankAccount,
                    CardHolder    = CardHolder,
                    CardNumber    = CardNumber,
                    Date          = Date,
                    Currency      = currency,
                    AccountAmount = Amount
                };



                {
                    //Добавление в XML файл
                    XmlElement   xmlAccount    = XmlAccountsDocument.CreateElement("account");
                    XmlAttribute attributeType = XmlAccountsDocument.CreateAttribute("type");
                    attributeType.Value = "PlasticCard";

                    xmlAccount.Attributes.Append(attributeType);

                    XmlElement XmlName = XmlAccountsDocument.CreateElement("name");
                    XmlName.InnerText = newPlasticCard.Name;

                    XmlElement XmlBankAccount = XmlAccountsDocument.CreateElement("BankAccount");
                    XmlBankAccount.InnerText = newPlasticCard.BankAccount;

                    XmlElement XmlCardHolder = XmlAccountsDocument.CreateElement("CardHolder");
                    XmlCardHolder.InnerText = newPlasticCard.CardHolder;

                    XmlElement XmlCardNumber = XmlAccountsDocument.CreateElement("CardNumber");
                    XmlCardNumber.InnerText = newPlasticCard.CardNumber;

                    XmlElement XmlDate = XmlAccountsDocument.CreateElement("date");
                    XmlDate.InnerText = newPlasticCard.Date;

                    XmlElement XmlCurrency = XmlAccountsDocument.CreateElement("currency");
                    XmlCurrency.InnerText = newPlasticCard.Currency.ToString();

                    XmlElement XmlAmount = XmlAccountsDocument.CreateElement("Amount");
                    XmlAmount.InnerText = newPlasticCard.AccountAmount.ToString();

                    xmlAccount.AppendChild(XmlName);
                    xmlAccount.AppendChild(XmlBankAccount);
                    xmlAccount.AppendChild(XmlCardHolder);
                    xmlAccount.AppendChild(XmlCardNumber);
                    xmlAccount.AppendChild(XmlDate);
                    xmlAccount.AppendChild(XmlCurrency);
                    xmlAccount.AppendChild(XmlAmount);

                    XmlAccountsDocument.DocumentElement.AppendChild(xmlAccount);

                    //Добавление ссылки на представление карты в XML в структуру
                    newPlasticCard.PlasticCardInXml = xmlAccount;
                }

                List_PlasticCards.Add(newPlasticCard);
            }
Exemple #2
0
            public static void AddBankAccount(string AccountName, string AccountNumber, CurrencyType Currency, decimal AccountAmount)
            {
                {
                    //Добавление в лист счетов
                    BankAccount NewBankAccount = new BankAccount()
                    {
                        AccountName   = AccountName,
                        AccountNumber = AccountNumber,
                        Currency      = Currency,
                        AccountAmount = AccountAmount
                    };

                    List_BankAccounts.Add(NewBankAccount);
                }

                {
                    //Сохранение счета в файл
                    XmlElement   newAccount = XmlAccountsDocument.CreateElement("account");
                    XmlAttribute attribute  = XmlAccountsDocument.CreateAttribute("type");
                    attribute.Value = "Bank";

                    newAccount.Attributes.Append(attribute);

                    XmlElement XmlAccountName = XmlAccountsDocument.CreateElement("name");
                    XmlAccountName.InnerText = AccountName;

                    XmlElement XmlAccountNumber = XmlAccountsDocument.CreateElement("number");
                    XmlAccountNumber.InnerText = AccountNumber;

                    XmlElement XmlAccountCurrency = XmlAccountsDocument.CreateElement("currency");
                    XmlAccountCurrency.InnerText = Currency.ToString();

                    XmlElement XmlAccountAmount = XmlAccountsDocument.CreateElement("AccountAmount");
                    XmlAccountAmount.InnerText = AccountAmount.ToString();

                    newAccount.AppendChild(XmlAccountName);
                    newAccount.AppendChild(XmlAccountNumber);
                    newAccount.AppendChild(XmlAccountCurrency);
                    newAccount.AppendChild(XmlAccountAmount);

                    XmlAccountsDocument.DocumentElement.AppendChild(newAccount);
                }


                TileManager.BankAccountsTab.AddTile(AccountName);
            }