Пример #1
0
    /// <summary>
    /// Checks if the user may login and sets the Session object to check later which type of user is currently logged in.
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void Login_Click(object sender, EventArgs e)
    {
        UserMapping userMapping = new UserMapping();
        LoginMapping loginMapping = new LoginMapping();
        LoginCheck.LoggedIn = false;
        User user = new User();
        user.Email = logUserName.Text;
        user.Pass = logPassword.Text;

        try
        {
            user = loginMapping.mapFromService(service.Login2(loginMapping.mapToService(user)));

            if (user.MayLogin)
            {
                user = userMapping.mapFromService(service.Login2(userMapping.mapToService(user)));
                Session["UserObject"] = user;
                Session["UserObjectOwn"] = userMapping.mapFromService(service.Login2(userMapping.mapToService(user)));
                userOwn = (User)Session["UserObjectOwn"];

                LoginCheck.LoggedIn = true;
                if (userOwn.UserCompany.CompanyID == 0 && userOwn.UserCv.CvID == 0)
                {
                    if (userOwn.Email.Equals("*****@*****.**"))
                        Response.Redirect("dashboardRamon.aspx");
                    else if (userOwn.Email.Equals("*****@*****.**"))
                        Response.Redirect("dashboardBrian.aspx");
                    else if (userOwn.Email.Equals("*****@*****.**"))
                        Response.Redirect("dashboardDennis.aspx");
                    else if (userOwn.Email.Equals("*****@*****.**"))
                        Response.Redirect("dashboardJan.aspx");
                }
                else
                    Response.Redirect("home.aspx");
            }
            else
            {
                errorMessage.InnerHtml = "<span>Onjuiste inloggegevens</span>";
            }
        }
        catch (System.Net.WebException)
        {
            errorMessage.InnerHtml = "<span>Er kon geen verbinding gemaakt worden met de webservice<br />Probeer het later nog eens</span>";
        }
    }
Пример #2
0
 /// <summary>
 /// Gets all the information this page needs.
 /// </summary>
 public override void CheckTypeAndFill()
 {
     if (!LoginCheck.LoggedIn || user == null)
         Response.Redirect("login.aspx");
     else if (user.UserCv.CvID == 0 && user.UserCompany.CompanyID != 0)
     {
         service = new MatchyService();
         UserMapping mapping = new UserMapping();
         CvMapping cvMapping = new CvMapping();
         user = mapping.mapFromService(service.GetUser(Int32.Parse(profileId))[0]);
         user.UserCv = cvMapping.mapFromService(service.GetCv(getURL())[0]);
         Session["UserObject"] = user;
     }
     else
     {
         var contentPlaceHolder = (ContentPlaceHolder)Master.FindControl("contentPlaceholderHeader");
         var profileLink = (LinkButton)contentPlaceHolder.FindControl("profileLink");
         profileLink.CssClass = "active";
     }
 }
Пример #3
0
 /// <summary>
 /// The standard changeURL for profilescreen
 /// </summary>
 public virtual void changeURL()
 {
     int parseable;
     if (url.Contains("="))
     {
         if(url.Contains("profile="))
             profileId = Request.QueryString["profile"];
         else
             profileId = Request.QueryString["company"];
     }
     service = new MatchyService();
     UserMapping mapping = new UserMapping();
     if (Int32.TryParse(profileId, out parseable))
     {
         try
         {
             user = mapping.mapFromService(service.GetUser(Int32.Parse(profileId))[0]);
             Session["UserObject"] = user;
         }
         catch
         {
             if (user.UserCv.CvID != 0)
                 Response.Redirect("profile.aspx?profile=" + string.Format(user.ProfileId.ToString()));
             else
                 Response.Redirect("company.aspx?company=" + string.Format(user.ProfileId.ToString()));
         }
     }
     else
     {
         if (user.UserCv.CvID != 0)
             Response.Redirect("profile.aspx?profile=" + string.Format(user.ProfileId.ToString()));
         else
             Response.Redirect("company.aspx?company=" + string.Format(user.ProfileId.ToString()));
     }
 }