/**************************************************************
Written by: Rushi Rawal
(Application client back-end, this modules communicates with the web service)
**************************************************************/

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class Default2 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        
    }


    protected void Button1_Click(object sender, EventArgs e)
    {
        Service3.Service serv = new Service3.Service();
        //ReturnStruct a1;
        int a;
        string tickerSym = "\0";
        double[] price = new double[100];
        Random rand = new Random();
        double[] result = new double[3];

        string CompanyName = this.ddlCompanyName.Text;
        System.Int32 AmountInvested = Convert.ToInt32(this.tbFundsAvailable.Text);
        System.Int32 TimeDuration = Convert.ToInt32(this.tbTimeDuration.Text);

        result = serv.Predictor(CompanyName, AmountInvested, TimeDuration);

        this.tbProjectedValue.Text = Convert.ToString(result[0]);

        if (result[0] > AmountInvested)
        {
            this.Label6.Visible = true;
            this.Label6.Text = "Buy!!";
        }
        else if (result[0] < AmountInvested)
        {
            this.Label6.Visible = true;
            this.Label6.Text = "Sale";
        }
        else
        {
            this.Label6.Visible = true;
            this.Label6.Text = "Hold";
        }
        
        //Response.Write("<script language='javascript'> alert('" + this.tbFundsAvailable.Text + "'); </script>");
    
    }

    protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
    {

    }

    protected void tbFundsAvailable_TextChanged(object sender, EventArgs e)
    {

    }
   
}
