예제 #1
0
 public Dashboard_Admin()
 {
     InitializeComponent();
     this.MouseEnter += Dashboard_Admin_MouseEnter;
     db           = new EquityEntities();
     this.Closed += Dashboard_Admin_Closed;
 }
        private void CustomAction(object obj)
        {
            EquityEntities Con = new EquityEntities();

            if (obj != null)
            {
                _Order = obj as Order;

                var temp = Con.Orders.SingleOrDefault(o => o.OrderID == _Order.OrderID);
                temp.Side             = _Order.Side;
                temp.OrderStatusID    = _Order.OrderStatusID;
                temp.SymbolID         = _Order.SymbolID;
                temp.LimitPrice       = _Order.LimitPrice;
                temp.StopPrice        = _Order.StopPrice;
                temp.TotalQty         = _Order.TotalQty;
                temp.UpdationDate     = System.DateTime.Now;
                Con.Entry(temp).State = System.Data.Entity.EntityState.Modified;
                Con.SaveChanges();
                //App.Current.MainWindow.Hide();
                //Dashboard d = new Dashboard();
                //App.Current.MainWindow = d;
                //d.ShowDialog();
            }
            else
            {
                MessageBox.Show("Please Select atleast one order");
            }
        }
 public PM_ForgotPasswordViewModel(Login login)
 {
     MyCommand = new DelegateCommand(customPredicate, customAction);
     db        = new EquityEntities();
     FPData    = new Login_Model.Login();
     _login    = login;
 }
예제 #4
0
 public SelectPageViewModel()
 {
     _PMRedirect     = new DelegateCommand(PMPredicate, PMAction);
     _TraderRedirect = new DelegateCommand(TraderPredicate, TraderAction);
     _AdminRedirect  = new DelegateCommand(AdminPredicate, AdminAction);
     entity          = new EquityEntities();
 }
예제 #5
0
 public DashboardAdminViewModel()
 {
     AddUser    = new DelegateCommand(AddUserPredicate, AddUserAction);
     EditUser   = new DelegateCommand(EditUserPredicate, EditUserAction);
     DeleteUser = new DelegateCommand(DeleteUserPredicate, DeleteUserAction);
     db         = new EquityEntities();
     Users      = new ObservableCollection <User>(db.Users.Where(t => t.ISActive == true).ToList());
 }
예제 #6
0
 public LoginViewModel()
 {
     _LoginCommand = new DelegateCommand(LoginPredicate, LoginAction);
     Entity        = new EquityEntities();
     _Credentials  = new Login_Model.Login();
     ErrorMessage  = "";
     loginImage    = new Uri(@"Resources\Images\login-page-image.jpg", UriKind.Relative);
 }
예제 #7
0
        private void refresh()
        {
            EditSavedOrder edit = new EditSavedOrder();

            AmendDelegate = new DelegateCommand(CanAmendExecute, AmendExecute);
            Order         = new Order();
            db            = new EquityEntities();
            _Orders       = new ObservableCollection <Order>(db.Orders.Where(t => t.OrderStatusID == 2 && t.PMID == Session.CurrentUser.UserID).ToList());
        }
 public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
 {
     db = new EquityEntities();
     if (value == null)
     {
         return(null);
     }
     return(db.Symbol_Properties.First(x => x.Symbol == value.ToString()).SymbolID);
 }
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            db = new EquityEntities();
            if (value == null)
            {
                return(null);
            }
            long y = (long)value;

            return(db.Symbol_Properties.First(x => x.SymbolID == y).Symbol);
        }
예제 #10
0
        public EditSavedOrder()
        {
            InitializeComponent();
            lblboxLimitPrice.Visibility = Visibility.Hidden;
            txtboxLimitPrice.Visibility = Visibility.Hidden;
            lblboxStopPrice.Visibility  = Visibility.Hidden;
            txtboxStopPrice.Visibility  = Visibility.Hidden;
            this.Loaded += EditSavedOrder_Loaded;
            List <string> sideList = new List <string>();

            sideList.Add("Sell");
            sideList.Add("Buy");
            cbxSide.ItemsSource = sideList;
            SymbolDataRetriveService.UpdateSymbols();
            EquityEntities db      = new EquityEntities();
            var            SymList = db.Symbol_Properties.Select(s => s.Symbol).ToList();

            cbxSymbol.ItemsSource = SymList;
        }
        void CreateOrder_Loaded(object sender, RoutedEventArgs e)
        {
            lblVisibilityPrices.Visibility = Visibility.Hidden;
            db             = new EquityEntities();
            SavedPortfolio = new ObservableCollection <Portfolio>(db.Portfolios.Where(t => t.UserID == Session.CurrentUser.UserID).ToList());
            foreach (var item in SavedPortfolio)
            {
                PName.Add(item.PortfolioName);
            }
            Portfoliobox.ItemsSource = PName;
            var y = db.User_Role.Where(t2 => t2.RoleID == 1).Select(s => s.UserID).ToList();
            var x = db.Users.Where(t => y.Contains(t.UserID)).Select(s2 => s2.UserName).ToList();

            //var x = (from u in db.Users join r in db.User_Role on u.UserID equals r.UserID where r.RoleID == 1 select new { u.UserName }).ToList();

            TraderBox.ItemsSource = x;

            SymbolDataRetriveService.UpdateSymbols();
            SymList = db.Symbol_Properties.Select(s => s.Symbol).ToList();
            cbxSymbolList.ItemsSource  = SymList;
            cbxSymbolList.SelectedItem = SymList[0];
        }
예제 #12
0
        /// <summary>
        /// void UpdateSymbols()
        /// Adds or Updates the Symbol_Properties
        /// </summary>
        public static void UpdateSymbols()
        {
            MarketDataServiceClient Client = new MarketDataServiceClient();
            EquityEntities          db     = new EquityEntities();

            try
            {
                var tempData = Client.GetWholeData().ToList();
                foreach (var item in tempData)
                {
                    db.UPSERT(item.Symbol, Convert.ToDecimal(item.Price), item.Name);
                }
                db.SaveChanges();
            }
            catch (Exception e)
            {
                if (e.Message.Contains("Endpoint"))
                {
                    MessageBox.Show("Server Down\n Showing old data");
                }
            }
        }
 public EditUserViewModel()
 {
     newUser  = new User();
     db       = new EquityEntities();
     EditUser = new DelegateCommand(EditUserPredicate, EditUserAction);
 }
예제 #14
0
 public OrderHistory()
 {
     InitializeComponent();
     db = new EquityEntities();
     grdHistory.MouseEnter += SavedOrders_MouseEnter;
 }
예제 #15
0
 public CreateUserViewModel()
 {
     newUser = new User();
     AddUser = new DelegateCommand(AddUserPredicate, AddUserAction);
     db      = new EquityEntities();
 }
 public SavedOrders()
 {
     InitializeComponent();
     db = new EquityEntities();
     grdSaved.MouseEnter += SavedOrders_MouseEnter;
 }
 private void refresh()
 {
     db      = new EquityEntities();
     _Orders = new ObservableCollection <Order>(db.Orders.Where(t => t.OrderStatusID == 1 && t.PMID == Session.CurrentUser.UserID).ToList());
 }
예제 #18
0
 private void refresh()
 {
     _SaveOrderCommand = new DelegateCommand(CanSaveExecute, SaveExecute);
     db      = new EquityEntities();
     _Orders = new ObservableCollection <Order>(db.Orders.Where(t => t.OrderStatusID == 5 && t.PMID == Session.CurrentUser.UserID).ToList());
 }
예제 #19
0
 public CreatePortfolioViewModel()
 {
     db            = new EquityEntities();
     SavePortfolio = new DelegateCommand(SavePortfolioPredicate, SavePortfolioAction);
     Portfolio     = new Portfolio();
 }
예제 #20
0
 public CreateOrderViewModel()
 {
     CreateOrderDelegate = new DelegateCommand(CreateOrderPredicate, CreateOrderAction);
     _order = new Order();
     db     = new EquityEntities();
 }
 public EditUser()
 {
     InitializeComponent();
     db           = new EquityEntities();
     this.Loaded += EditUser_Loaded;
 }