//------------------------------------------------------------------------------
// written by: Shivangi C
// assisted by: NA
// debugged by:Shivangi C
//
// summary: This file has the binding of the UI controls and display, with the 
//          bussiness layer functions for the Page which Login of a memeber
//          
//------------------------------------------------------------------------------



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;

namespace StockForecasterClient
{
    public partial class Login : System.Web.UI.Page
    {
        /// <summary>
        /// make the webservice object to call the web methods required
        /// </summary>
        SFSService.StockInfo serviceObj;

        /// <summary>
        /// The functions to be called and controls to be loaded on Page load event 
        /// are initialize/called here
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            serviceObj = new SFSService.StockInfo();
        }
        /// <summary>
        /// Code for on Button Click event for the Memnber Login functionality
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Submit1_ServerClick(object sender, EventArgs e)
        {
            // call to webservice method LoginUser
            int output = serviceObj.LoginUser(txtUserId.Value, txtPwd.Value);
            if (output == 1)
            {
                Session["login"] = txtUserId;
                Response.Redirect("ForecasterClient.aspx");
            }
            else if (output == 0)
            {
                lblMsg1.Text = "User ID or Password is not correct";
            }

        }
    }
}
