Esempio n. 1
0
        public new static Acct ot_dynamic_cast(Storable pObject)
        {
            global::System.IntPtr cPtr = otapiPINVOKE.Acct_ot_dynamic_cast(Storable.getCPtr(pObject));
            Acct ret = (cPtr == global::System.IntPtr.Zero) ? null : new Acct(cPtr, false);

            return(ret);
        }
Esempio n. 2
0
 public CustomerSupplier(string nameType, Acct ledgerAccount, DocType invoiceDoc, DocType creditDoc, DocType paymentDoc)
 {
     NameType      = nameType;
     Name          = NameType.NameType();
     LedgerAccount = ledgerAccount;
     InvoiceDoc    = invoiceDoc;
     CreditDoc     = creditDoc;
     PaymentDoc    = paymentDoc;
     _module       = nameType == "C" ? "/customer/" : "/supplier/";
 }
Esempio n. 3
0
        /// <summary>Send details of the current account</summary>
        private void SendAccountStatus()
        {
            // Only send differences
            if (Acct.Equals(m_last_account))
            {
                return;
            }

            // Send the account status to Tradee
            Model.DispatchMsg(new InMsg.AccountUpdate(Acct));
            m_last_account = new Account(Acct);
        }
 public CustomerSupplier(string nameType, Acct ledgerAccount, DocType invoiceDoc, DocType creditDoc, DocType paymentDoc)
 {
     NameType = nameType;
     Name = NameType.NameType();
     LedgerAccount = ledgerAccount;
     InvoiceDoc = invoiceDoc;
     CreditDoc = creditDoc;
     PaymentDoc = paymentDoc;
     string module = nameType == "C" ? "/customer/" : "/supplier/";
     Menu = new MenuOption[] {
         new MenuOption("Listing", module + "default.html"),
         new MenuOption("VAT codes", module + "vatcodes.html"),
         new MenuOption("New " + Name, module + "detail.html?id=0"),
         new MenuOption("New " + InvoiceDoc.UnCamel(), module + "document.html?id=0&type=" + (int)InvoiceDoc),
         new MenuOption("New " + CreditDoc.UnCamel(), module + "document.html?id=0&type=" + (int)CreditDoc),
         new MenuOption("New " + PaymentDoc.UnCamel(), module + "payment.html?id=0")
     };
 }
Esempio n. 5
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Acct.Length != 0)
            {
                hash ^= Acct.GetHashCode();
            }
            if (Pass.Length != 0)
            {
                hash ^= Pass.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Esempio n. 6
0
 public static void Main()
 {
     Acct myAcct = new Acct(25.00);
     myAcct.Deposit(700.00);
     if(myAcct.Withdraw(300.00) < 0)
        Console.WriteLine("Insufficient funds");
     if(myAcct.Withdraw(450.00) < 0)
        Console.WriteLine("Insufficient funds");
     Console.WriteLine
        ("My balance after completing transactions is {0:C}",
      myAcct.GetBalance());
     Console.WriteLine("The number of transactions is {0}",
      Acct.GetTransactionCount());
     Acct yourAcct = new Acct();                                        yourAcct.Deposit(1234.56);                                         Console.WriteLine
        ("Your balance after completing transactions is {0:C}",              yourAcct.GetBalance());
     Console.WriteLine("The number of transactions is {0}",
      Acct.GetTransactionCount());
 }
Esempio n. 7
0
        public async Task <bool> CreateAcct(AcctCreate model)
        {
            var entity =
                new Acct()
            {
                OwnerID    = _userId,
                AcctName   = model.AcctName,
                AcctType   = (Acct.AcctTypeEnum)model.AcctType,
                TotalValue = model.TotalValue,
                OpenedUtc  = DateTimeOffset.Now,
                InvestorID = model.InvestorID
            };

            using (var ctx = new ApplicationDbContext())
            {
                ctx.Accts.Add(entity);
                return(await ctx.SaveChangesAsync() == 1);
            }
        }
Esempio n. 8
0
        private static void InitializeAcct(ATM_Context db)
        {
            CreateNewUser(db);

            Console.WriteLine();
            var user    = db.Users.Where(u => u.UserName == activeUser.UserName).First();
            var newAcct = new Acct()
            {
                AcctUser       = user,
                AcctName       = user.UserName,
                CurrentBalance = 0
            };

            db.Accounts.Add(newAcct);
            db.SaveChanges();
            Console.WriteLine($"Your Account has been intialized with the Username: [{user.UserName}]" +
                              $" , with the Password [{user.Password}]");
            Console.WriteLine("Please login to this Acct to deposit an initial balalnce");
        }
Esempio n. 9
0
 internal static HandleRef getCPtr(Acct obj)
 {
     return((obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr);
 }
Esempio n. 10
0
        /// <summary>Handle messages received from the trade data source</summary>
        public void DispatchMsg(ITradeeMsg msg)
        {
            // Ignore messages after dispose
            if (!IsConnected)
            {
                return;
            }

            // Dispatch received messages
            switch (msg.ToMsgType())
            {
            default:
                #region
            {
                Debug.WriteLine("Unknown Message Type {0} received".Fmt(msg.GetType().Name));
                Owner.Status.SetStatusMessage(msg: "Unknown Message Type {0} received".Fmt(msg.GetType().Name), fr_color: Color.Red, display_time: TimeSpan.FromSeconds(5));
                break;
            }

                #endregion
            case EMsgType.HelloTradee:
                #region
            {
                var m = (InMsg.HelloTradee)msg;
                MsgBox.Show(Owner, m.Text, "Test Msg Received");
                break;
            }

                #endregion
            case EMsgType.CandleData:
                #region
            {
                var cd = (InMsg.CandleData)msg;
                if (cd.Candle != null)
                {
                    MarketData[cd.SymbolCode].Add(cd.TimeFrame, cd.Candle);
                }
                if (cd.Candles != null)
                {
                    MarketData[cd.SymbolCode].Add(cd.TimeFrame, cd.Candles);
                }
                break;
            }

                #endregion
            case EMsgType.AccountUpdate:
                #region
            {
                var acct = (InMsg.AccountUpdate)msg;
                Acct.Update(acct.Acct);
                break;
            }

                #endregion
            case EMsgType.PositionsUpdate:
                #region
            {
                var pos = (InMsg.PositionsUpdate)msg;
                Acct.Update(pos.Positions);
                Positions.Update(pos.Positions);
                break;
            }

                #endregion
            case EMsgType.PendingOrdersUpdate:
                #region
            {
                var orders = (InMsg.PendingOrdersUpdate)msg;
                Acct.Update(orders.PendingOrders);
                Positions.Update(orders.PendingOrders);
                break;
            }

                #endregion
            case EMsgType.SymbolData:
                #region
            {
                var sd = (InMsg.SymbolData)msg;
                MarketData[sd.Symbol].PriceData = sd.Data;
                break;
            }

                #endregion
            case EMsgType.HistoryData:
                #region
            {
                var hd = (InMsg.HistoryData)msg;
                Positions.Update(hd.Orders);
                break;
            }
                #endregion
            }
        }
Esempio n. 11
0
 internal static HandleRef getCPtr(Acct obj)
 {
     return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
 }
Esempio n. 12
0
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Acct obj)
 {
     return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr);
 }
Esempio n. 13
0
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Acct obj) {
   return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
 }
Esempio n. 14
0
 /// <summary>Update the non-instrument related things</summary>
 public void Step()
 {
     Acct.Update();
 }
Esempio n. 15
0
        static void Main(string[] args)
        {
            using (var db = new ATM_Context())
            {
                var userInstance = new User();
                while (loggedIn == false)
                {
                    Console.WriteLine("1) Login");
                    Console.WriteLine("2) Create New User");
                    string choiceString = Read("> ");
                    int    choiceTry;
                    int.TryParse(choiceString, out choiceTry);
                    if (choiceTry > 0)
                    {
                        int choice = int.Parse(choiceString);

                        switch (choice)
                        {
                        case 1:
                            Login(db);
                            break;

                        case 2:
                            InitializeAcct(db);
                            break;

                        default:
                            break;
                        }
                    }
                }
                activeAcct = db.Accounts.Where(n => n.AcctName == activeUser.UserName).First();

                var time = DateTime.Now;
                while (loggedIn == true)

                {
                    Console.WriteLine("1) Make Withdrawl");
                    Console.WriteLine("2) Deposit Funds");
                    Console.WriteLine("3) Print Balance");
                    Console.WriteLine("4) Transfer Funds");
                    Console.WriteLine("5) Logout");
                    int choice = int.Parse(Read("> "));

                    switch (choice)
                    {
                    case 1:
                        WithdrawWithODP(db);
                        break;

                    case 2:
                        Deposit(db);
                        break;

                    case 3:
                        PrintBalance(db);
                        break;

                    case 4:
                        Transfer(db);
                        break;

                    case 5:
                        Logout(db);
                        break;

                    default:
                        break;
                    }
                }
            }
        }
Esempio n. 16
0
        private static void Transfer(ATM_Context db)
        {
            bool transfering = new bool();

            transfering = true;
            while (transfering == true)
            {
                foreach (var Acct in db.Accounts)
                {
                    Console.WriteLine(Acct.AcctName);
                }
                var  acctNameString = Read("To which acct would you like to transfer the funds?");
                Acct recipientAcct  = db.Accounts.Where(a => a.AcctName == acctNameString).First();
                var  adjValue       = double.Parse(Read("How much would you like to transfer?"));

                if (activeAcct.CurrentBalance - adjValue > 0)
                {
                    Console.WriteLine($"Confirm transfer of ${adjValue} from {activeAcct.AcctName}" +
                                      $" to { recipientAcct.AcctName} (Y/N)");
                    string confirmChoice = Read("> ");
                    if (confirmChoice.ToLower() == "y")
                    {
                        DateTime time = DateTime.Now;
                        recipientAcct.CurrentBalance = recipientAcct.CurrentBalance + adjValue;
                        activeAcct.CurrentBalance    = activeAcct.CurrentBalance - adjValue;
                        logBalance = activeAcct.CurrentBalance;
                        adjustment = "transfer";
                        Console.WriteLine("Transfer Complete");
                        var newATM_Log = new ATM_Log()
                        {
                            ActiveAcct    = activeAcct,
                            Time          = time,
                            Adjustment    = adjustment,
                            AdjValue      = adjValue,
                            RecipientAcct = recipientAcct,
                            LogBalance    = logBalance
                        };

                        db.ATM_Logs.Add(newATM_Log);
                        db.SaveChanges();
                        transfering = false;
                    }
                    else
                    {
                        transfering = false;
                    }
                }
                else
                {
                    Console.WriteLine("There are insufficient funds available for this transfer");
                    Console.WriteLine("1)Print Balance");
                    Console.WriteLine("2)Transfer a lesser amount");
                    Console.WriteLine("3)Main Menu");

                    int choice = int.Parse(Read("> "));
                    switch (choice)
                    {
                    case 1:
                        PrintBalance(db);
                        break;

                    case 2:
                        Transfer(db);
                        break;

                    case 3:
                        transfering = false;
                        break;

                    default:
                        break;
                    }
                }
            }
        }