/// <summary>
		/// Erstellt eine neue Aktie
		/// </summary>
		/// <param name="portFolio">Portfolio, zu dem die Aktie gehört</param>
		public Share(PortFolio portFolio)
		{
			Logs = new List<ShareLog>();

			_PortFolio = portFolio;
		}
        public int Update(PortFolio portfolio)
        {
            SqlConnection _connection;

            using (_connection = Utilities.GetOpenConnection())
            {
                string processQuery = "Update  portfolio SET Titulo='" + portfolio.Titulo + "',UserId='" + portfolio.UserId + "',CategoriaId='" + portfolio.CategoriaId + "',Description='" + portfolio.Description + "',Imagen='" + portfolio.Imagen + "',TermCopy='" + portfolio.TermCopy + "',Cliente='" + portfolio.Cliente + "'  where id=" + portfolio.Id;
                return(_connection.Execute(processQuery));
            }
        }
        public int Insert(PortFolio portfolio)
        {
            SqlConnection _connection;

            using (_connection = Utilities.GetOpenConnection())
            {
                string processQuery = "INSERT INTO portfolio VALUES (@Titulo, @Userid,@CategoriaId,@Description,@Imagen,@TermCopy,@Cliente)";
                return(_connection.Execute(processQuery, new { portfolio.Titulo, portfolio.UserId, portfolio.CategoriaId, portfolio.Description, portfolio.Imagen, portfolio.TermCopy, portfolio.Cliente }));
            }
        }
Beispiel #4
0
        public ActionResult UpdatePortfolio(PortFolio portfolio)
        {
            ZonaFl.Business.SubSystems.SUser suser = new Business.SubSystems.SUser();

            //ZonaFl.Persistence.Entities.AspNetUsers useru = null;
            ZonaFl.Business.SubSystems.SPortfolio portn      = new Business.SubSystems.SPortfolio();
            Persistence.Entities.PortFolio        portfolioP = new Persistence.Entities.PortFolio();
            portfolioP.InjectFrom(portfolio);

            if (portn.UpdatePortFolioByUser(portfolioP))
            {
                return(Json(data: true));
            }
            else
            {
                return(Json(data: false));
            }
        }
Beispiel #5
0
        public void agregaPortFolio(PortFolio portFolio)
        {
            ConexionBD datos = new ConexionBD();

            try
            {
                datos.setearQuery("INSERT INTO PORTFOLIO (IdImagenPort_P, IdProfesional_P, Estado) VALUES (@IdImagenPort_P, @IdProfesional_P, @Estado)");

                datos.agregarParametro("@IdImagenPort_P", portFolio.IdPortFolio);
                datos.agregarParametro("@IdProfesional_P", portFolio.Profesional.IdProfesional);
                datos.agregarParametro("@Estado", portFolio.Estado);

                datos.ejecutarAccion();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                datos.cerrarConexion();
            }
        }
		/// <summary>
		/// Erstellt ein neues MainViewModel und nimmt einige Initialisierungen vor
		/// </summary>
		public MainViewModel()
		{
			// Liste erstellen
			OwnPortFolio = new PortFolio(new List<Share>());

			// Legt eine neue Beispielaktie an, damit der Benutzer bei Applikationsstart sofort kaufen kann
			CurrentShare = new Share(OwnPortFolio);
			CurrentShare.Name = "Microsoft Inc.";
			CurrentShare.PurchasePrice = 373M;
			CurrentShare.CurrentPrice = 373M;
			CurrentShare.Count = 17;

			// Legt eine Aktie an und "kauft" diese, damit man direkt sieht, wie alles aussieht
			Share initShare = new Share(OwnPortFolio);
			initShare.Count = 23;
			initShare.Name = "Google Inc.";
			initShare.CurrentPrice = 750M;
			initShare.PurchasePrice = 723M;
			// hiermit wird "gekauft"
			OwnPortFolio.Add(initShare);
			

			// erstellt einen Timer (Intervall: 1 Sekunde), der dem PortFolio sagt, dass es Preissimulationen durchführen soll
			_Timer = new System.Windows.Forms.Timer();
			_Timer.Interval = 1000;
			// Lambda-Funktion
			_Timer.Tick += (sender, args) =>
			{
				OwnPortFolio.SimulatePriceChanges();
			};

			// Timer abhänhig vom Wer oben in "SimulateChanges" festgesetzen Wert starten
			if (SimulateChanges)
				_Timer.Start();
		}