protected void LoginButton_Click(object sender, EventArgs e)
    {
        string AuthenticatedUser;
        BUS_Facade newFacade = new BUS_Facade(TextBoxUserName.Text, TextBoxPassword.Text);
        //AuthenticatedUser = newFacade.ProcessAuthenticationRequest();
        AuthenticatedUser = newFacade.TestAuthenticationServer();
        if (TextBoxUserName.Text == AuthenticatedUser)
        {
            Session["New"] = TextBoxUserName.Text;
            if (newFacade.ProcessCheckIfUserIsSalesRep())
            {
                //newFacade.TestAuthenticationServer();

                Response.Redirect("SRP_Portal.aspx");
            }
            else
            {
                Response.Redirect("CUS_Portal.aspx");
            }
        }
        else
        {
            Label1.Visible = true;
            Label1.Text = "Invalid Username or Password";
        }
    }
        public void BUS_TST_FacadeAddUser()
        {
            MBSWBWEBUSERCONTACT uIWebUser = new MBSWBWEBUSERCONTACT();

            uIWebUser.ACCOUNTNUM = "123";
            uIWebUser.CONTACTPERSONID = "123";
            uIWebUser.DATAAREAID = "MBS";
            uIWebUser.EMAIL = "*****@*****.**";
            uIWebUser.NAME = "Nick";
            uIWebUser.SALESREPID = "123";
            uIWebUser.WEBLOGON = "tommypenguin";
            uIWebUser.WEBPASSWORD = "******";

            object Class = uIWebUser;
            int ActionType = 1;

            //Facade newFacade = new Facade(uICustomer, ActionType);
            BUS_Facade newFacade = new BUS_Facade(Class, ActionType);
            newFacade.ProcessRequest();
        }
 public void BUS_TST_FacadeUserPassword()
 {
     BUS_Facade newFacade = new BUS_Facade("dbrees", "dbrees");
     newFacade.ProcessAuthenticationRequest();
 }
    protected void Button1_Click(object sender, EventArgs e)
    {
        MBSWBWEBUSERCONTACT uIWebUser = new MBSWBWEBUSERCONTACT();

        uIWebUser.ACCOUNTNUM = this.TextBoxAccountNum.Text;
        uIWebUser.CONTACTPERSONID = this.TextBoxContactPersonId.Text;
        uIWebUser.DATAAREAID = this.DropDownListCompany.SelectedItem.ToString();
        uIWebUser.EMAIL = this.TextEmail.Text;
        uIWebUser.NAME = this.TextBoxFullName.Text;
        uIWebUser.SALESREPID = this.TextBoxSalesRepId.Text;
        uIWebUser.WEBLOGON = this.TextBoxUserName.Text;
        uIWebUser.WEBPASSWORD = this.TextBoxPassword.Text;
        uIWebUser.RECID = 1000;

        object Class = uIWebUser;
        int ActionType = 1;

        BUS_Facade newFacade = new BUS_Facade(Class, ActionType);
        newFacade.ProcessRequest();

        try
        {
            Response.Redirect("Login.aspx");

        }
        catch (Exception)
        {
            Response.Write("<b>Could not create user.</b>");
        }

        if (Page.IsValid)
        {
            SuccessLabel.Text = "You have successfully registered on the FFR's website";
        }
        else
        {
            SuccessLabel.Text = "Failed to registers on FFR's website, please verify you have entered all necessary information.";
        }
        /*

        SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["AXMbsDevEntities"].ConnectionString);
        con.Open();
        //string insCmd = "Insert into MBSWBWEBUSERCONTACT (ACCOUNTNUM, NAME, EMAIL, WEBLOGON, WEBPASSWORD, CONTACTPERSONID, SALESREPID, DATAAREAID) values (@UserName, @Password, @Email, @FullName, @Company)";
        string insCmd = "Insert into MBSWBWEBUSERCONTACT (ACCOUNTNUM, NAME, EMAIL, WEBLOGON, WEBPASSWORD, CONTACTPERSONID, SALESREPID, DATAAREAID) ";
        insCmd += "values (@ACCOUNTNUM, @NAME, @EMAIL, @WEBLOGON, @WEBPASSWORD, @CONTACTPERSONID, @SALESREPID, @DATAAREAID)";
        SqlCommand insertUser = new SqlCommand(insCmd, con);
        insertUser.Parameters.AddWithValue("@ACCOUNTNUM", TextBoxAccountNum.Text);
        insertUser.Parameters.AddWithValue("@NAME", TextBoxFullName.Text);
        insertUser.Parameters.AddWithValue("@EMAIL", TextEmail.Text);
        insertUser.Parameters.AddWithValue("@WEBLOGON", TextBoxUserName.Text);
        insertUser.Parameters.AddWithValue("@WEBPASSWORD", TextBoxPassword.Text);
        insertUser.Parameters.AddWithValue("@CONTACTPERSONID", TextBoxContactPersonId.Text);
        insertUser.Parameters.AddWithValue("@SALESREPID", TextBoxSalesRepId.Text);
        insertUser.Parameters.AddWithValue("@DATAAREAID", DropDownListCompany.SelectedItem.ToString());

        try
        {
            insertUser.ExecuteNonQuery();
            con.Close();
            Response.Redirect("Login.aspx");

        }
        catch(Exception ex)
        {
            Response.Write("<b>Could not write to db for record being passed.</b>");
        }
        finally
        {
            //Any Special Action you want to add....

        }*/
    }