Ejemplo n.º 1
0
        protected void btnRequestDualRole_Click(object sender, EventArgs e)
        {
            
                        

            if (User.IsInRole("client"))
            {
                int nifcheck = Users.CheckDuplicateNIF(NIFTitularOficina.Text);
                if (nifcheck == -1) { Response.Redirect("~/Error.aspx"); }
                else if (nifcheck == 0)
                {
                    Roles w = new Roles();
                    if (w.AddUserToRoleByID(User.Identity.GetUserId(), "workshop") == false) { Response.Redirect("~/Error.aspx"); }
                    if (AccStatus.LockAccount(User.Identity.GetUserId()) == false) { Response.Redirect("~/Error.aspx"); }
                    if (Users.UpdateWorkshopDetails(NomeOficina.Text, MoradaOficina.Text, DdlRegiao.SelectedValue, TelefoneOficina.Text, TitularOficina.Text, NIFTitularOficina.Text, User.Identity.GetUserId()) == false) { Response.Redirect("~/Error.aspx"); }
                    Context.GetOwinContext().Authentication.SignOut(DefaultAuthenticationTypes.ApplicationCookie);
                    Response.Redirect("ValidationRequired.aspx");
                }
                else
                {
                    NIFServerValidator.IsValid = false;
                }
               
                
            }
            
        }
Ejemplo n.º 2
0
 protected void ShowWorkshopForm_Click(object sender, EventArgs e)
 {
     if (User.IsInRole("workshop"))
     {
         Roles w = new Roles();
         if (w.AddUserToRoleByID(User.Identity.GetUserId(), "client") == false) { Response.Redirect("~/Error.aspx"); }
         Response.Redirect("RoleChangeSuccess.aspx");
     }
     else if (PainelOficina.Visible == true)
     {
         PainelOficina.Visible = false;
     }
     else
         PainelOficina.Visible = true;
 }