Example #1
0
        public override global::System.Data.DataSet Clone()
        {
            MoneyDataSet cln = ((MoneyDataSet)(base.Clone()));

            cln.InitVars();
            cln.SchemaSerializationMode = this.SchemaSerializationMode;
            return(cln);
        }
Example #2
0
 public AccountEditForm(bool isDebit, MoneyDataSet.AccountTypesRow accountType = null, MoneyDataSet.AccountsRow account = null)
 {
     InitializeComponent();
     this.keeper = MoneyDataKeeper.Instance;
     this.isDebit = isDebit;
     this.accountType = accountType;
     this.account = account;
 }
Example #3
0
 public Lend(LendTableAdapter lendTableAdapter, BindingSource lendBindingSource, MoneyDataSet moneyDataSet, DataGridViewRow row)
 {
     InitializeComponent();
     this.lendTableAdapter  = lendTableAdapter;
     this.lendBindingSource = lendBindingSource;
     this.moneyDataSet      = moneyDataSet;
     this.row = row;
     usersBindingSource.DataSource = moneyDataSet;
 }
Example #4
0
 public DohodOperation(DohodTableAdapter dohodTableAdapter, BindingSource dohodBindingSource, MoneyDataSet moneyDataSet, DataGridViewRow currentRow)
 {
     InitializeComponent();
     this.dohodTableAdapter  = dohodTableAdapter;
     this.dohodBindingSource = dohodBindingSource;
     this.moneyDataSet       = moneyDataSet;
     this.row = currentRow;
     isNew    = row == null;
 }
Example #5
0
 public Borrow(BorrowTableAdapter borrowTableAdapter, BindingSource borrowBindingSource, DataGridViewRow row, MoneyDataSet moneyDataSet)
 {
     InitializeComponent();
     this.borrowTableAdapter  = borrowTableAdapter;
     this.borrowBindingSource = borrowBindingSource;
     this.row          = row;
     this.moneyDataSet = moneyDataSet;
     isNew             = row == null;
 }
        public TransactionViewForm(MoneyDataSet.TransactionsRow transaction)
        {
            InitializeComponent();
            this.transaction = transaction;

            MoneyDataSet.TransactionsRow sourceTransaction = null;
            MoneyDataSet.TransactionsRow destinationTransaction = null;

            // lookup paired transaciton
            if ((!transaction.IsPairReferenceIDNull()) && (transaction.PairReferenceID != 0))
            {
                foreach (MoneyDataSet.TransactionsRow t in
                    keeper.Transactions.Where(t => ((!t.IsPairReferenceIDNull()) && (t.PairReferenceID == transaction.PairReferenceID))))
                    // setting source and destination
                    if (t.TypeID.Equals(transaction.TransactionTemplatesRow.SourceTransactionTypeID))
                    {
                        sourceTransaction = t;
                    }
                    else if (t.TypeID.Equals(transaction.TransactionTemplatesRow.DestinationTransactionTypeID))
                    {
                        destinationTransaction = t;
                    }

                if ((sourceTransaction == null) || (destinationTransaction == null))
                {
                    ErrorHelper.ShowErrorBox(ErrorHelper.Errors.InvalidTransaction);
                    return;
                }

                tbDestinationAccount.Text = destinationTransaction.AccountRow.FullTitle;
                tbDestinationAmount.Text = destinationTransaction.Amount.ToString(Consts.UI.CurrencyFormat,
                    destinationTransaction.AccountRow.CurrenciesRow.CurrencyCultureInfo);
            }
            else
            {
                sourceTransaction = transaction;
                // only one transaction, removing second column
                tlpTemplateTransaction.Controls.Remove(gbDestination);
                tlpTemplateTransaction.SetColumnSpan(gbSource, 2);
            }
            tbTitle.Text = sourceTransaction.FullTitle;
            tbSourceAccount.Text = sourceTransaction.AccountRow.FullTitle;
            tbSourceAmount.Text = sourceTransaction.Amount.ToString(Consts.UI.CurrencyFormat,
                sourceTransaction.AccountRow.CurrenciesRow.CurrencyCultureInfo);
            tbDescription.Text = sourceTransaction.Description;
            ttbTags.Tags = keeper.GetTransactionTagStrings(sourceTransaction);
            if (sourceTransaction.PlannedTransactionsRow != null)
            {
                tbImplementsPlan.Text = sourceTransaction.PlannedTransactionsRow.FullTitle;
            }
            else
            {
                tbImplementsPlan.Text = Resources.Labels.TransactionNotPlanned;
            }
            this.DialogResult = DialogResult.Cancel;
        }
Example #7
0
 public PlanEditForm(MoneyDataSet.TransactionTemplatesRow template,
     MoneyDataSet.PlannedTransactionsRow sourcePlan = null, MoneyDataSet.PlannedTransactionsRow destinationPlan = null, bool isCopy = false)
 {
     InitializeComponent();
     this.keeper = MoneyDataKeeper.Instance;
     this.template = template;
     this.sourcePlan = sourcePlan;
     this.destinationPlan = destinationPlan;
     this.isCopy = isCopy;
 }
Example #8
0
        public AccountViewForm(MoneyDataSet.AccountsRow account)
        {
            InitializeComponent();
            this.account = account;

            tbTitle.Text = account.FullTitle;
            tbBalance.Text = account.Balance.ToString(Consts.UI.CurrencyFormat, account.CurrenciesRow.CurrencyCultureInfo);
            tbDescription.Text = account.Description;
            ttbTags.Tags = keeper.GetAccountTagStrings(account);
            DialogResult = DialogResult.Cancel;
        }
Example #9
0
 public static bool DeleteAccount(MoneyDataSet.AccountsRow account)
 {
     if (MessageBox.Show(String.Format(Resources.Labels.DeleteAccountFormat, account.Title),
         Resources.Labels.DeleteAccountTitle, MessageBoxButtons.OKCancel,
         MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2) == DialogResult.OK)
     {
         MoneyDataKeeper.Instance.DeleteAccount(account.ID);
         return true;
     }
     return false;
 }
Example #10
0
        public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(global::System.Xml.Schema.XmlSchemaSet xs)
        {
            MoneyDataSet ds = new MoneyDataSet();

            global::System.Xml.Schema.XmlSchemaComplexType type     = new global::System.Xml.Schema.XmlSchemaComplexType();
            global::System.Xml.Schema.XmlSchemaSequence    sequence = new global::System.Xml.Schema.XmlSchemaSequence();
            global::System.Xml.Schema.XmlSchemaAny         any      = new global::System.Xml.Schema.XmlSchemaAny();
            any.Namespace = ds.Namespace;
            sequence.Items.Add(any);
            type.Particle = sequence;
            global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable();
            if (xs.Contains(dsSchema.TargetNamespace))
            {
                global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream();
                global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream();
                try {
                    global::System.Xml.Schema.XmlSchema schema = null;
                    dsSchema.Write(s1);
                    for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext();)
                    {
                        schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current));
                        s2.SetLength(0);
                        schema.Write(s2);
                        if ((s1.Length == s2.Length))
                        {
                            s1.Position = 0;
                            s2.Position = 0;
                            for (; ((s1.Position != s1.Length) &&
                                    (s1.ReadByte() == s2.ReadByte()));)
                            {
                                ;
                            }
                            if ((s1.Position == s1.Length))
                            {
                                return(type);
                            }
                        }
                    }
                }
                finally {
                    if ((s1 != null))
                    {
                        s1.Close();
                    }
                    if ((s2 != null))
                    {
                        s2.Close();
                    }
                }
            }
            xs.Add(dsSchema);
            return(type);
        }
Example #11
0
        public static bool DeleteTransaction(MoneyDataSet.TransactionsRow transaction)
        {
            String message = transaction.IsPairReferenceIDNull() ? String.Format(Resources.Labels.DeleteTransactionFormat, transaction.FullTitle) :
                String.Format(Resources.Labels.DeletePairedTransactionFormat, transaction.FullTitle);

            if (MessageBox.Show(message, Resources.Labels.DeleteTransactionTitle, MessageBoxButtons.OKCancel,
                MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2) == DialogResult.OK)
            {
                MoneyDataKeeper.Instance.DeleteTransaction(transaction.ID);
                return true;
            }
            return false;
        }
Example #12
0
        /// <summary>
        /// Add template to a specific list
        /// </summary>
        /// <param name="collection">List, where to add template</param>
        /// <param name="template">Template to add</param>
        /// <param name="onClick">Click handlers</param>
        public static void InsertTemplate(ToolStripItemCollection collection, MoneyDataSet.TransactionTemplatesRow template, EventHandler onClick)
        {
            Image image = null;
            if (template.ID.Equals(MoneyDataSet.IDs.TransactionTemplates.Transfer))
            {
                image = Properties.Resources.table_relationship;
            }
            ToolStripMenuItem tsmiFromTemplate = new ToolStripMenuItem(template.Title, image, onClick);
            tsmiFromTemplate.Tag = template;
            tsmiFromTemplate.ToolTipText = template.Message;

            collection.Add(tsmiFromTemplate);
        }
 private bool askDeleteAccount(MoneyDataSet.AccountsRow account)
 {
     if (MessageBox.Show(String.Format(Resources.Labels.DeleteAccountFormat,
         (lbAccounts.SelectedItem as MoneyDataSet.AccountsRow).Title),
         Resources.Labels.DeleteAccountTitle, MessageBoxButtons.OKCancel,
         MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2) == DialogResult.OK)
     {
         deleteAccount(account.ID);
         updateAccountsTab();
         updateTransactionsTab();
         updateWelcomeTab();
         updateTagCloud();
         return true;
     }
     return false;
 }
Example #14
0
        public PlanViewForm(MoneyDataSet.PlannedTransactionsRow plan)
        {
            InitializeComponent();

            // locate source and destination plans
            if ((!plan.IsPairReferenceIDNull()) && (plan.PairReferenceID != 0))
            {
                foreach (MoneyDataSet.PlannedTransactionsRow p in
                    keeper.PlannedTransactions.Where(p => ((!p.IsPairReferenceIDNull()) &&
                        (p.PairReferenceID == plan.PairReferenceID))))
                    // setting source and destination
                    if (p.TransactionTypeID.Equals(plan.TransactionTemplatesRow.SourceTransactionTypeID))
                    {
                        sourcePlan = p;
                    }
                    else if (p.TransactionTypeID.Equals(plan.TransactionTemplatesRow.DestinationTransactionTypeID))
                    {
                        destinationPlan = p;
                    }

                if ((sourcePlan == null) || (destinationPlan == null))
                {
                    ErrorHelper.ShowErrorBox(ErrorHelper.Errors.InvalidTransaction);
                    return;
                }

                tbDestinationAccountType.Text = destinationPlan.AccountTypeRow.Title;
                tbDestinationAmount.Text = destinationPlan.Amount.ToString(Consts.UI.CurrencyFormat,
                    destinationPlan.CurrenciesRow.CurrencyCultureInfo);
            }
            else
            {
                sourcePlan = plan;
                // only one planned transaction, removing second column
                tlpTemplatePlan.Controls.Remove(gbDestination);
                tlpTemplatePlan.SetColumnSpan(gbSource, 2);
            }

            tbTitle.Text = sourcePlan.FullTitle;
            tbSourceAccountType.Text = sourcePlan.AccountTypeRow.Title;
            tbSourceAmount.Text = sourcePlan.Amount.ToString(Consts.UI.CurrencyFormat,
                sourcePlan.CurrenciesRow.CurrencyCultureInfo);
            tbDescription.Text = sourcePlan.Description;
            ttbTags.Tags = keeper.GetPlannedTransactionTagStrings(sourcePlan);

            this.DialogResult = DialogResult.Cancel;
        }
        private bool askDeletePlannedTransaction(MoneyDataSet.PlannedTransactionsRow plan)
        {
            String message = String.Empty;
            if (plan.IsPairReferenceIDNull())
            {
                message = String.Format(Resources.Labels.DeletePlannedTransactionFormat, plan.FullTitle);
            }
            else
            {
                message = String.Format(Resources.Labels.DeletePairedPlannedTransactionFormat, plan.FullTitle);
            }

            if (MessageBox.Show(message, Resources.Labels.DeletePlannedTransactionTitle, MessageBoxButtons.OKCancel,
                MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2) == DialogResult.OK)
            {
                deletePlannedTransaction(plan.ID);
                updatePlannedTransactionsTab();
                updateWelcomeTab();
                updateTagCloud();
                return true;
            }
            return false;
        }
        public TransactionEditForm(MoneyDataSet.TransactionTemplatesRow template, MoneyDataSet.PlannedTransactionsRow plan = null)
        {
            InitializeComponent();
            this.keeper = MoneyDataKeeper.Instance;
            this.template = template;
            this.sourcePlan = plan;

            sourceAccounts = keeper.GetAccounts(template.AccountTypesRowByFK_AccountTypes_Source_TransactionTemplates,
                template.ExactSourceAccountType);

            if (template.HasDestinationAccount)
            {
                if (sourcePlan != null)
                {
                    int pairID = sourcePlan.PairReferenceID;
                    sourcePlan = null;

                    // trying to find source and destination plans
                    foreach(MoneyDataSet.PlannedTransactionsRow pairedPlan in keeper.PlannedTransactions.Where(p =>
                        ((!p.IsPairReferenceIDNull()) && (p.PairReferenceID != 0) && (p.PairReferenceID == pairID))))
                    {
                        if (pairedPlan.TransactionTypeID.Equals(template.SourceTransactionTypeID))
                        {
                            sourcePlan = pairedPlan;
                        }
                        if (pairedPlan.TransactionTypeID.Equals(template.DestinationTransactionTypeID))
                        {
                            destinationPlan = pairedPlan;
                        }
                    }
                }

                destinationAccounts = keeper.GetAccounts(template.AccountTypesRowByFK_AccountTypes_Destination_TransactionTemplates,
                    template.ExactDestinationAccountType);
            }
        }
Example #17
0
 private void openTransactionType(MoneyDataSet.TransactionTypesRow transactionType)
 {
     TransactionTypeForm form = new TransactionTypeForm(transactionType);
     if (form.ShowDialog(this) == DialogResult.OK)
     {
         fillTransactionTypes();
     }
 }
Example #18
0
 private void openTemplate(MoneyDataSet.TransactionTemplatesRow template)
 {
     TemplateForm form = new TemplateForm(template);
     if (form.ShowDialog(this) == DialogResult.OK)
     {
         fillTemplates();
     }
 }
Example #19
0
 private void openCurrency(MoneyDataSet.CurrenciesRow currency)
 {
     CurrencyForm form = new CurrencyForm(currency);
     if (form.ShowDialog(this) == DialogResult.OK)
     {
         fillCurrencies();
     }
 }
Example #20
0
        public bool IsTemplateRelevant(MoneyDataSet.TransactionTemplatesRow template)
        {
            if (!template.IsVisible)
            {
                return false;
            }

            if (!GetAccounts(template.AccountTypesRowByFK_AccountTypes_Source_TransactionTemplates, template.ExactSourceAccountType).Any())
            {
                return false;
            }

            if (template.HasDestinationAccount)
            {
                if (!GetAccounts(template.AccountTypesRowByFK_AccountTypes_Destination_TransactionTemplates, template.ExactDestinationAccountType).Any())
                {
                    return false;
                }
            }

            return true;
        }
Example #21
0
 public IEnumerable<MoneyDataSet.AccountsRow> GetAccounts(MoneyDataSet.AccountTypesRow firstAccountType = null,  
     bool showOnlyFirstType = false)
 {
     if (firstAccountType != null)
     {
         List<MoneyDataSet.AccountsRow> sorted = new List<MoneyDataSet.AccountsRow>();
         sorted.AddRange(this.Accounts.Where(a => (a.TypeID.Equals(firstAccountType.ID))));
         if (!showOnlyFirstType)
         {
             sorted.AddRange(this.Accounts.Where(a => ((!a.TypeID.Equals(firstAccountType.ID)) &&
                 (a.AccountTypesRow.IsDebit == firstAccountType.IsDebit))));
             sorted.AddRange(this.Accounts.Where(a => (a.AccountTypesRow.IsDebit != firstAccountType.IsDebit)));
         }
         return sorted;
     }
     else
     {
         return this.Accounts;
     }
 }
Example #22
0
 public IEnumerable<String> GetPlannedTransactionTagStrings(MoneyDataSet.PlannedTransactionsRow plan)
 {
     return ds.PlannedTransactionTags.Where(t => (t.PlannedTransactionID == plan.ID)).Select(tt => (tt.TagRow.Title));
 }
Example #23
0
 public IEnumerable<String> GetTransactionTagStrings(MoneyDataSet.TransactionsRow transaction)
 {
     return ds.TransactionTags.Where(t => (t.TransactionID == transaction.ID)).Select(tt => (tt.TagRow.Title));
 }
Example #24
0
        public MoneyDataSet.TransactionsRow PreCreateTransaction(MoneyDataSet.TransactionTypesRow type, String title, String description, DateTime dateTime, 
            MoneyDataSet.AccountsRow account, double amount, MoneyDataSet.PlannedTransactionsRow plan = null,
            MoneyDataSet.TransactionTemplatesRow template = null, int pairReference = 0)
        {
            MoneyDataSet.TransactionsRow transaction = ds.Transactions.NewTransactionsRow();

            transaction.Title = title;
            transaction.Description = description;
            transaction.AccountRow = account;
            transaction.TransactionTypesRow = type;
            transaction.Amount = Math.Round(amount, Consts.Keeper.AmountRoundingDigits);
            transaction.TransactionTime = dateTime;
            transaction.EntryTime = DateTime.Now;

            if (plan != null)
            {
                transaction.PlannedTransactionsRow = plan;
            }

            if (template != null)
            {
                transaction.TransactionTemplatesRow = template;
                if (template.HasDestinationAccount)
                {
                    if (pairReference > 0)
                    {
                        transaction.PairReferenceID = pairReference;
                    }
                    else
                    {
                        transaction.PairReferenceID = transaction.ID;
                    }
                }
            }

            return transaction;
        }
Example #25
0
        public MoneyDataSet.PlannedTransactionsRow PreCreatePlannedTransaction(MoneyDataSet.TransactionTypesRow type, String title, String description, DateTime? dateTime,
            MoneyDataSet.AccountTypesRow accountType, double amount, MoneyDataSet.CurrenciesRow currency, MoneyDataSet.RecurrenciesRow recurrency,
            DateTime? endDateTime, bool isAggregated, MoneyDataSet.TransactionTemplatesRow template = null, int pairReference = 0)
        {
            MoneyDataSet.PlannedTransactionsRow plan = ds.PlannedTransactions.NewPlannedTransactionsRow();

            plan.Title = title;
            plan.Description = description;
            plan.AccountTypeRow = accountType;
            plan.TransactionTypeRow = type;
            plan.Amount = Math.Round(amount, Consts.Keeper.AmountRoundingDigits);
            if (dateTime != null)
            {
                plan.StartTime = dateTime.Value;
            }
            if (endDateTime != null)
            {
                plan.EndTime = endDateTime.Value;
            }
            plan.CurrenciesRow = currency;
            plan.RecurrenciesRow = recurrency;
            plan.EntryTime = DateTime.Now;
            plan.TransactionTemplatesRow = template;
            plan.IsAggregated = isAggregated;

            if (template != null)
            {
                if (template.HasDestinationAccount)
                {
                    if (pairReference > 0)
                    {
                        plan.PairReferenceID = pairReference;
                    }
                    else
                    {
                        plan.PairReferenceID = plan.ID;
                    }
                }
            }

            return plan;
        }
Example #26
0
        public MoneyDataSet.AccountsRow PreCreateAccount(MoneyDataSet.AccountTypesRow type, String title, String description, MoneyDataSet.CurrenciesRow currency, 
            double balance)
        {
            MoneyDataSet.AccountsRow account = ds.Accounts.NewAccountsRow();

            account.Title = title;
            account.Description = description;
            account.CurrenciesRow = currency;
            account.AccountTypesRow = type;
            account.Balance = balance;
            account.EntryTime = DateTime.Now;
            account.IsHidden = false;

            return account;
        }
 public TransactionTypeForm(MoneyDataSet.TransactionTypesRow existingItem)
 {
     InitializeComponent();
     this.keeper = MoneyDataKeeper.Instance;
     this.existingItem = existingItem;
 }
Example #28
0
        public IEnumerable<MoneyDataSet.TransactionsRow> GetPlannedTransactionImplementations(MoneyDataSet.PlannedTransactionsRow plan, DateTime date)
        {
            IEnumerable<MoneyDataSet.TransactionsRow> transactions = this.Transactions.Where(t => (!t.IsPlannedTransactionIDNull()));

            if ((plan.IsHistoryReferenceIDNull()) || (plan.HistoryReferenceID == 0))
            {
                transactions = transactions.Where(t => (t.PlannedTransactionID == plan.ID));
            }
            else
            {
                IEnumerable<int> planIDs = ds.PlannedTransactions.Where(p => (p.HistoryReferenceID == plan.HistoryReferenceID)).Select(s => (s.ID));
                transactions = transactions.Where(t => (planIDs.Contains(t.PlannedTransactionID)));
            }

            int days =  plan.RecurrenciesRow.IncrementDays + plan.RecurrenciesRow.IncrementMonths * 30 + plan.RecurrenciesRow.IncrementYears * 365;
            DateTime startDate;
            DateTime endDate;

            if (plan.IsAggregated)
            {
                startDate = date.Date;
                endDate = date.AddDays(days).Date;
            }
            else
            {
                startDate = date.AddDays(-days / 2).Date;
                endDate = date.AddDays(days / 2).Date;
            }

            return (days > 0 ? transactions.Where(t => ((t.TransactionTime.Date >= startDate) && (t.TransactionTime.Date <= endDate))) : transactions);
        }
Example #29
0
 public IEnumerable<String> GetAccountTagStrings(MoneyDataSet.AccountsRow account)
 {
     return ds.AccountTags.Where(t => (t.AccountID == account.ID)).Select(at => (at.TagRow.Title));
 }
Example #30
0
 public CurrencyForm(MoneyDataSet.CurrenciesRow existingItem)
 {
     InitializeComponent();
     this.keeper = MoneyDataKeeper.Instance;
     this.existingItem = existingItem;
 }
Example #31
0
        public double GetAccountBalace(MoneyDataSet.AccountsRow account, DateTime date)
        {
            double amount = 0;

            if (account.IsActive)
            {
                // checking for account creation time
                DateTime creationTime = account.EntryTime;
                if ((!account.IsHistoryReferenceIDNull()) && ((account.HistoryReferenceID != 0)))
                {
                    creationTime = ds.Accounts.Where(a => ((!a.IsHistoryReferenceIDNull()) && (a.HistoryReferenceID == account.HistoryReferenceID))).Select(s => (s.EntryTime)).Min();
                }
                if (creationTime < date)
                {
                    // rolling back transactions until we pass required date
                    amount = account.Balance;
                    IOrderedEnumerable<MoneyDataSet.TransactionsRow> transactions = null;
                    if ((account.IsHistoryReferenceIDNull()) || (account.HistoryReferenceID == 0))
                    {
                        transactions = this.Transactions.Where(t => ((t.AccountID == account.ID))).OrderByDescending(o => (o.TransactionTime));
                    }
                    else
                    {
                        transactions = this.Transactions.Where(t => ((!t.AccountRow.IsHistoryReferenceIDNull()) &&
                            (t.AccountRow.HistoryReferenceID == account.HistoryReferenceID))).OrderByDescending(o => (o.TransactionTime));
                    }

                    foreach (MoneyDataSet.TransactionsRow transaction in transactions)
                    {
                        if (transaction.TransactionTime < date)
                        {
                            // we've passed required date, current amount is actual balance
                            return amount;
                        }

                        if (transaction.TransactionTypesRow.IsIncome)
                        {
                            amount -= transaction.Amount;
                        }
                        else
                        {
                            amount += transaction.Amount;
                        }
                    }
                    // no transactions found before that date
                }
            }
            return amount;
        }
Example #32
0
 public IEnumerable<MoneyDataSet.AccountTypesRow> GetAccountTypes(MoneyDataSet.AccountTypesRow selected, bool onlySelected = false)
 {
     List<MoneyDataSet.AccountTypesRow> list = new List<MoneyDataSet.AccountTypesRow>();
     list.Add(selected);
     if (!onlySelected)
     {
         list.AddRange(ds.AccountTypes.Where(at => ((at.IsDebit == selected.IsDebit) && (!at.ID.Equals(selected.ID)))).OrderBy(o => (o.SortOrder)));
     }
     return list;
 }
Example #33
0
        public bool FileTryDecrypt()
        {
            if (dsTmp != null)
            {
                try
                {
                    EncryptionHelper.Instance.Password = this.Password;
                    StringReader reader = new StringReader(EncryptionHelper.Instance.Decrypt(dsTmp.Setup[0].EncryptedData));

                    MoneyDataSet dsTry = new MoneyDataSet();
                    dsTry.ReadXml(reader);
                    dsTmp = dsTry;
                    return true;
                }
                catch (CryptographicException ce)
                {
                    Log.Write(ce);
                    return false;
                }
            }
            else
            {
                return false;
            }
        }
Example #34
0
 private void openAccountType(MoneyDataSet.AccountTypesRow accountType)
 {
     AccountTypeForm form = new AccountTypeForm(accountType);
     if (form.ShowDialog(this) == DialogResult.OK)
     {
         fillAccountTypes();
     }
 }
Example #35
0
            public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedTableSchema(global::System.Xml.Schema.XmlSchemaSet xs)
            {
                global::System.Xml.Schema.XmlSchemaComplexType type     = new global::System.Xml.Schema.XmlSchemaComplexType();
                global::System.Xml.Schema.XmlSchemaSequence    sequence = new global::System.Xml.Schema.XmlSchemaSequence();
                MoneyDataSet ds = new MoneyDataSet();

                global::System.Xml.Schema.XmlSchemaAny any1 = new global::System.Xml.Schema.XmlSchemaAny();
                any1.Namespace       = "http://www.w3.org/2001/XMLSchema";
                any1.MinOccurs       = new decimal(0);
                any1.MaxOccurs       = decimal.MaxValue;
                any1.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax;
                sequence.Items.Add(any1);
                global::System.Xml.Schema.XmlSchemaAny any2 = new global::System.Xml.Schema.XmlSchemaAny();
                any2.Namespace       = "urn:schemas-microsoft-com:xml-diffgram-v1";
                any2.MinOccurs       = new decimal(1);
                any2.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax;
                sequence.Items.Add(any2);
                global::System.Xml.Schema.XmlSchemaAttribute attribute1 = new global::System.Xml.Schema.XmlSchemaAttribute();
                attribute1.Name       = "namespace";
                attribute1.FixedValue = ds.Namespace;
                type.Attributes.Add(attribute1);
                global::System.Xml.Schema.XmlSchemaAttribute attribute2 = new global::System.Xml.Schema.XmlSchemaAttribute();
                attribute2.Name       = "tableTypeName";
                attribute2.FixedValue = "moneyDateTableDataTable";
                type.Attributes.Add(attribute2);
                type.Particle = sequence;
                global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable();
                if (xs.Contains(dsSchema.TargetNamespace))
                {
                    global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream();
                    global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream();
                    try {
                        global::System.Xml.Schema.XmlSchema schema = null;
                        dsSchema.Write(s1);
                        for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext();)
                        {
                            schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current));
                            s2.SetLength(0);
                            schema.Write(s2);
                            if ((s1.Length == s2.Length))
                            {
                                s1.Position = 0;
                                s2.Position = 0;
                                for (; ((s1.Position != s1.Length) &&
                                        (s1.ReadByte() == s2.ReadByte()));)
                                {
                                    ;
                                }
                                if ((s1.Position == s1.Length))
                                {
                                    return(type);
                                }
                            }
                        }
                    }
                    finally {
                        if ((s1 != null))
                        {
                            s1.Close();
                        }
                        if ((s2 != null))
                        {
                            s2.Close();
                        }
                    }
                }
                xs.Add(dsSchema);
                return(type);
            }
Example #36
0
 public bool IsPlannedTransactionImplemented(MoneyDataSet.PlannedTransactionsRow plan, DateTime date)
 {
     return (GetPlannedTransactionImplementations(plan, date).Any());
 }