示例#1
0
 public Operation(int id, DateTime date, Account credit, Account debit, decimal amount, string note)
 {
     ID = id;
     Date = date;
     Credit = credit;
     Debit = debit;
     Amount = amount;
     Note = note;
 }
		partial void login(NSObject sender)
		{
			ReadOnlyCollection<DataFeed> feeds;

			try
			{
				Account account = new Account(_userNameField.StringValue, _passwordField.StringValue);
				feeds = account.GetDataFeeds();
			}
			catch (InvalidOperationException)
			{
				NSAlert.WithMessage("Unable to log in", "OK", "", "", "").BeginSheet(this.Window);
				feeds = null;
			}
					
			if (feeds != null)
			{
				new Account_ListController(feeds).ShowWindow(sender);
				Close();
			}
		}
示例#3
0
 public bool IsInList(Account account)
 {
     return (account.ID != 0) && ((_idAccount == account.ID) || (_idAccount2 == account.ID));
 }
示例#4
0
        public void ClearAccountID(Account account)
        {
            int sqlPaymentNumber = 1;

            if (account.IsPolicyKaskoAndPayment2())
            {
                _idAccount2 = 0;
                sqlPaymentNumber = 2;
            }
            else
                _idAccount = 0;

            _provider.DoOther("exec Policy_Delete_AccountID @p1, @p2", ID, sqlPaymentNumber);
        }
        private TreeViewItem ChildAccount(Account account)
        {
            TreeViewItem newNode = new TreeViewItem() { Header = account.AccountName, Tag=account.AccountId };
            List<Account> accounts = Accounts.GetList(account.AccountId);
            foreach (Account acc in accounts)
            {
                newNode.Items.Add(ChildAccount(acc));
            }

            return newNode;
        }
        private void btnUpdateAccount_Click(object sender, RoutedEventArgs e)
        {
            string newAccountName = txtAccount.Text.Trim();
            TreeViewItem updatedNode = tvAccounts.SelectedItem as TreeViewItem;

            if (string.IsNullOrWhiteSpace(newAccountName) || updatedNode == null)
                return;

            string level = SqlHierarchyId.Parse(updatedNode.Tag.ToString()).GetLevel().ToString();
            if (level == "1")
                return;

            string parentId = SqlHierarchyId.Parse(updatedNode.Tag.ToString()).GetAncestor(1).ToString();

            try
            {
                foreach (Account account in Accounts.GetList(parentId))
                {
                    if (account.AccountName == newAccountName)
                    {
                        MessageBox.Show("An account  has not been updated. Enter unique account name.", "Duplicated account", MessageBoxButton.OK, MessageBoxImage.Error);
                        return;
                    }
                }

                Account updatedAccount = new Account(updatedNode.Tag.ToString(), newAccountName);
                int result = Accounts.UpdateAccount(updatedAccount);
                if (result > 0)
                    UpdateAccountsTree();
                else
                    throw new Exception();

            }
            catch
            {
                MessageBox.Show("Can't update selected account.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
示例#7
0
        private string AccountInsert(params object[] Params)
        {
            int idAccount;
            int.TryParse(Params[0].ToString(), out idAccount);

            if (idAccount == 0)
            {
                idAccount = _accounts.Count + 1;

                Account account = new Account();
                account.IDPolicyType = Params[3].ToString();

                _accounts.Add(idAccount, account);
            }

            return idAccount.ToString();
        }