Ejemplo n.º 1
0
    protected void accao_Click(object sender, EventArgs e)
    {
        MembershipUser user = Membership.GetUser();
        SQLDatabaseManager db = new SQLDatabaseManager();
        Button btn = (Button)sender;
        String texto = btn.Text;
        GridViewRow gvr = (GridViewRow)btn.NamingContainer;
        Client c = new Client(user.ProviderUserKey.ToString());
        int idv = c.getIDVolunt();


        if(texto.Equals("Aceitar"))
        {
            Label lblServ =  (Label)GridView1.Rows[gvr.RowIndex].FindControl("IDS");
            
            String query = String.Format("UPDATE Servico SET IDVoluntario='{0}', Status='{1}' WHERE IDServico='{2}'", idv, "Aceite", lblServ.Text);
           
            db.ExecuteNonQuery(query);
            Response.Redirect("~/Volunts/ManageServicos.aspx");
        }
        else
        {
            Label lblServ = (Label)GridView1.Rows[gvr.RowIndex].FindControl("IDS");

            String query = String.Format("UPDATE Servico SET IDVoluntario='{0}', Status='{1}' WHERE IDServico='{2}'", "15", "Nao Aceite", lblServ.Text);

            db.ExecuteNonQuery(query);
            Response.Redirect("~/Volunts/ManageServicos.aspx");
        }


    }
Ejemplo n.º 2
0
    protected void Confirm_Click(object sender, EventArgs e)
    {
        MembershipUser user = Membership.GetUser();
        Client c = new Client(user.ProviderUserKey.ToString());
        MembershipUser newUser;
        if((newUser=c.NovoUser(tuser.Text, tpass.Text)) == null)
        {
            
        }
        else
        {


        SQLDatabaseManager db = new SQLDatabaseManager();
        Dictionary<String, String> InsertData = new Dictionary<String, String>()
            {
                
                {"Nome", tnome.Text},
                {"Morada", tmorada.Text},
                {"Email", temail.Text},
                {"Contacto", tcontactos.Text},
                {"UserId", newUser.ProviderUserKey.ToString()}
                
            };
        db.Insert("Admin", InsertData);
        Roles.AddUserToRole(newUser.UserName, "Admin");
        Response.Redirect("~/Admin/AMain.aspx");
        }
    }
Ejemplo n.º 3
0
    protected void Confirm_Click(object sender, EventArgs e)
    {
        if (Page.IsValid)
        {
            MembershipUser user = Membership.GetUser();
            SQLDatabaseManager db = new SQLDatabaseManager();
            Client c = new Client(user.ProviderUserKey.ToString());
            int id = c.getIDCliente();


            Dictionary<String, String> InsertData = new Dictionary<String, String>()
            {
                {"IDCliente", id.ToString()},
                {"Nome", tnome.Text},
                {"Morada", tmorada.Text},
                {"DataNasc", tdata.Text},
                {"Contacto", tcontacto.Text},
                {"Condicoes",tcondicoes.Text}
                
            };


            db.Insert("Idoso", InsertData);
            Response.Redirect("~/Clients/MainPage.aspx");
        }
    }
Ejemplo n.º 4
0
 protected void reject_Click(object sender, EventArgs e)
 {
     SQLDatabaseManager db = new SQLDatabaseManager();
     String query = String.Format("UPDATE Voluntario SET Status='Rejeitado' WHERE IDVoluntario='{0}'", DropDownList1.SelectedValue);
     db.ExecuteNonQuery(query);
     Response.Redirect("~/Admin/Accept.aspx");
 }
Ejemplo n.º 5
0
    protected void Confirm_Click(object sender, EventArgs e)
    {
        MembershipUser user = Membership.GetUser();
        SQLDatabaseManager db = new SQLDatabaseManager();
        String where = String.Format("IDIdoso='{0}'", DropDownList1.SelectedValue);
        db.Delete("Idoso", where);

        Response.Redirect("~/Clients/ManageIdosos.aspx");
    }
Ejemplo n.º 6
0
    protected void Confirm_Click(object sender, EventArgs e)
    {
        
            MembershipUser user = Membership.GetUser();
            SQLDatabaseManager db = new SQLDatabaseManager();

            String upquery = String.Format("UPDATE Cliente SET Nome='{0}', Morada='{1}', DataNasc='{2}', Email='{3}', Contactos='{4}' WHERE UserId='{5}'", tnome.Text, tmorada.Text, tdata.Text, temail.Text, tcontactos.Text, user.ProviderUserKey.ToString());
            db.ExecuteNonQuery(upquery);

            Response.Redirect("~/Clients/MainPage.aspx");
        
    }
Ejemplo n.º 7
0
Archivo: Client.cs Proyecto: swigz/AIMC
 public Boolean checkValid()
 {
     SQLDatabaseManager db = new SQLDatabaseManager();
     String query = String.Format("SELECT Status, IDVoluntario FROM VOluntario WHERE UserId='{0}'", userID);
     DataTable dt;
     dt = db.GetDataTable(query);
     if (dt.Rows[0]["Status"].ToString().Equals("Aguarda") || dt.Rows[0]["Status"].ToString().Equals("Rejeitado"))
     {
         return false;
     }
     return true;
 }
Ejemplo n.º 8
0
    protected void Page_Load(object sender, EventArgs e)
    {
        MembershipUser user = Membership.GetUser();
        SQLDatabaseManager db = new SQLDatabaseManager();

        String query = String.Format("SELECT [Nome], [Morada], [Email], [DataNasc], [Contactos], [Disponibilidade], [Status], [Habilitacoes] FROM [Voluntario] WHERE UserId='{0}'", user.ProviderUserKey.ToString());
        DataTable temp;
        temp = db.GetDataTable(query);


        FormView1.DataSource = temp;
        FormView1.DataBind();
    }
Ejemplo n.º 9
0
    protected void Page_Load(object sender, EventArgs e)
    {
        MembershipUser user = Membership.GetUser();
        SQLDatabaseManager db = new SQLDatabaseManager();


        String query = String.Format("SELECT [Email], [Morada], [Nome], [Contacto], [UserId] FROM [Admin] WHERE UserId='{0}'", user.ProviderUserKey.ToString());
        DataTable temp;
        temp = db.GetDataTable(query);


        FormView1.DataSource = temp;
        FormView1.DataBind();
    }
Ejemplo n.º 10
0
 protected void Confirm_Click(object sender, EventArgs e)
 {
     
         MembershipUser user = Membership.GetUser();
         Client c = new Client(user.ProviderUserKey.ToString());
         
         SQLDatabaseManager db = new SQLDatabaseManager();
         
         String upquery = String.Format("UPDATE Idoso SET Nome='{0}', Morada='{1}', DataNasc='{2}', Contacto='{3}', Condicoes='{4}' WHERE IDIdoso='{5}'", tnome.Text, tmorada.Text, tdata.Text, tcontacto.Text, tcondicoes.Text, DropDownList1.SelectedValue);
         int r= db.ExecuteNonQuery(upquery);
        
         Response.Redirect("~/Clients/ManageIdosos.aspx");
     
 }
Ejemplo n.º 11
0
    protected void Page_Load(object sender, EventArgs e)
    {
        MembershipUser user = Membership.GetUser();
        SQLDatabaseManager db = new SQLDatabaseManager();
        Client c = new Client(user.ProviderUserKey.ToString());
        int id = c.getIDCliente();
        String query = String.Format("SELECT I.Nome, I.Morada, I.Contacto, S.Servico, S.Notas, S.Horario, S.Status, V.Nome AS Vnome, V.Contactos From Idoso I, Servico S, Voluntario V WHERE S.IDCliente=I.IDCliente AND V.IDVoluntario=S.IDVoluntario AND I.IDIdoso=S.IDIdoso AND S.IDCliente='{0}'", id);

        DataTable temp;
        temp = db.GetDataTable(query);

        GridView1.DataSource = temp;
        GridView1.DataBind();

    }
Ejemplo n.º 12
0
Archivo: Client.cs Proyecto: swigz/AIMC
    public int getIDVolunt()
    {
        int id;
        SQLDatabaseManager db = new SQLDatabaseManager();

        DataTable dt;
        String query = String.Format("SELECT IDVoluntario FROM Voluntario WHERE UserId='{0}'", userID);



        dt = db.GetDataTable(query);
        id = Convert.ToInt32(dt.Rows[0]["IDVoluntario"].ToString());
        return id;

    }
Ejemplo n.º 13
0
Archivo: Client.cs Proyecto: swigz/AIMC
    public int getIDIdoso(int idc, String nome)
    {
        int id;
        SQLDatabaseManager db = new SQLDatabaseManager();

        DataTable dt;
        String query = String.Format("SELECT IDIdoso FROM Idoso WHERE (IDCliente='{0}' AND Nome='{1}')", idc, nome);



        dt = db.GetDataTable(query);
        id = Convert.ToInt32(dt.Rows[0]["IDIdoso"].ToString());
        return id;

    }
Ejemplo n.º 14
0
    protected void Page_Load(object sender, EventArgs e)
    {
        MembershipUser user = Membership.GetUser();
        SQLDatabaseManager db = new SQLDatabaseManager();
        Client c = new Client(user.ProviderUserKey.ToString());
        int id = c.getIDCliente();

        String query = String.Format("SELECT Nome, Morada, Contacto, DataNasc, Condicoes FROM Idoso WHERE IDCliente='{0}'", id);
        DataTable temp;
        temp = db.GetDataTable(query);

        GridView1.DataSource = temp;
        GridView1.DataBind();


    }
Ejemplo n.º 15
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         
         SQLDatabaseManager db = new SQLDatabaseManager();
         
         String query = String.Format("SELECT IDVoluntario, Nome, Status From Voluntario WHERE IDVoluntario<>15 AND Status='Aguarda'");
         DataTable temp;
         temp = db.GetDataTable(query);
         DropDownList1.DataValueField = "IDVoluntario";
         DropDownList1.DataTextField = "Nome";
         DropDownList1.DataSource = temp;
         DropDownList1.DataBind();
         DropDownList1.Items.Insert(0, "Escolha um Voluntário.");
     }
 }
Ejemplo n.º 16
0
    protected void add_Click(object sender, EventArgs e)
    {
        
            if(DropDownList1.SelectedIndex.Equals(0))
            {
                Label1.Visible = true;
            }
        
            MembershipUser user = Membership.GetUser();
            SQLDatabaseManager db = new SQLDatabaseManager();
            Client c = new Client(user.ProviderUserKey.ToString());
            int idcliente = c.getIDCliente();
            int ididoso = c.getIDIdoso(idcliente, DropDownList1.SelectedItem.Text);

            

            foreach (ListItem item in CheckBoxList1.Items)
            {
                if (item.Selected)
                {
                    selected += item.Text + " - ";
                }
            }
            
            Dictionary<String, String> InsertData = new Dictionary<String, String>()
            {

                {"IDCliente", idcliente.ToString()},
                {"IDIdoso", ididoso.ToString()},
                {"Servico", selected},
                {"Notas", tnotas.Text},
                {"Horario", thorario.Text},
                {"Status", "Não Aceite"},
                {"IDVoluntario", "15"}
            };
            if (!db.Insert("dbo.Servico", InsertData))
            {
                Response.Redirect("Erro ao criar entrada");
            }
            else
            {
                Response.Redirect("~/Clients/VerServico.aspx");

            }
    }
Ejemplo n.º 17
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            MembershipUser user = Membership.GetUser();
            SQLDatabaseManager db = new SQLDatabaseManager();

            String query = String.Format("SELECT Nome, Morada, Email, Contacto FROM Admin WHERE UserID='{0}'", user.ProviderUserKey.ToString());
            DataTable temp;
            temp = db.GetDataTable(query);

            tnome.Text = temp.Rows[0]["Nome"].ToString();
            tmorada.Text = temp.Rows[0]["Morada"].ToString();
           
            temail.Text = temp.Rows[0]["Email"].ToString();
            tcontactos.Text = temp.Rows[0]["Contacto"].ToString();
        }
    }
Ejemplo n.º 18
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            MembershipUser user = Membership.GetUser();
            SQLDatabaseManager db = new SQLDatabaseManager();
            Client c = new Client(user.ProviderUserKey.ToString());
            int id = c.getIDCliente();

            String query = String.Format("SELECT IDIdoso, Nome From Idoso WHERE IDCliente='{0}'", id);
            DataTable temp;
            temp = db.GetDataTable(query);
            DropDownList1.DataValueField = "IDIdoso";
            DropDownList1.DataTextField = "Nome";
            DropDownList1.DataSource = temp;
            DropDownList1.DataBind();
            DropDownList1.Items.Insert(0, "Escolha um idoso.");
        }
    }
Ejemplo n.º 19
0
    protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
    {
            Confirm.Enabled = true;
            MembershipUser user = Membership.GetUser();
            SQLDatabaseManager db = new SQLDatabaseManager();
            Client c = new Client(user.ProviderUserKey.ToString());
            int id = c.getIDCliente();
            String query = String.Format("SELECT Nome, Morada, DataNasc, Contacto, Condicoes FROM Idoso WHERE IDIdoso='{0}'", DropDownList1.SelectedValue);
            DataTable temp;
            temp = db.GetDataTable(query);

            tnome.Text = temp.Rows[0]["Nome"].ToString();
            tmorada.Text = temp.Rows[0]["Morada"].ToString();
            tdata.Text = temp.Rows[0]["DataNasc"].ToString();
            tcondicoes.Text = temp.Rows[0]["condicoes"].ToString();
            tcontacto.Text = temp.Rows[0]["Contacto"].ToString();
        
        
        
    }
Ejemplo n.º 20
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            MembershipUser user = Membership.GetUser();
            SQLDatabaseManager db = new SQLDatabaseManager();

            String query = String.Format("SELECT Nome, Morada, DataNasc, Email, Contactos, Disponibilidade, Habilitacoes FROM Voluntario WHERE UserID='{0}'", user.ProviderUserKey.ToString());
            DataTable temp;
            temp = db.GetDataTable(query);

            tnome.Text = temp.Rows[0]["Nome"].ToString();
            tmorada.Text = temp.Rows[0]["Morada"].ToString();
            tdata.Text = temp.Rows[0]["DataNasc"].ToString();
            temail.Text = temp.Rows[0]["Email"].ToString();
            tcontactos.Text = temp.Rows[0]["Contactos"].ToString();
            tdisp.Text = temp.Rows[0]["Disponibilidade"].ToString();
            thabil.Text = temp.Rows[0]["Habilitacoes"].ToString();
        }
    }
Ejemplo n.º 21
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            MembershipUser user = Membership.GetUser();
            SQLDatabaseManager db = new SQLDatabaseManager();
            Client c = new Client(user.ProviderUserKey.ToString());
            int id = c.getIDCliente();

            String query = String.Format("SELECT S.IDServico, S.Servico, I.Nome From Servico S, Idoso I WHERE I.IDIdoso=S.IDIdoso AND S.IDCliente='{0}'", id);
            DataTable temp;
            temp = db.GetDataTable(query);
            temp.Columns.Add("NomeServico", typeof(string), "Nome + ' - ' + Servico");
            DropDownList1.DataValueField = "IDServico";
            DropDownList1.DataTextField = "NomeServico";
            DropDownList1.DataSource = temp;
            DropDownList1.DataBind();
            DropDownList1.Items.Insert(0, "Escolha o serviço a alterar.");
        }
    }
Ejemplo n.º 22
0
    protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
    {
        if (DropDownList1.SelectedIndex.Equals(0))
        {

            FormView1.DataSource = null;
            FormView1.DataBind();
        }
        else
        {
            SQLDatabaseManager db = new SQLDatabaseManager();

            String query = String.Format("SELECT [Nome], [Morada], [Email], [DataNasc], [Contactos], [Disponibilidade], [Status], [Habilitacoes] FROM [Voluntario] WHERE IDVoluntario='{0}'", DropDownList1.SelectedValue);
            DataTable temp;
            temp = db.GetDataTable(query);


            FormView1.DataSource = temp;
            FormView1.DataBind();
        }
    }
Ejemplo n.º 23
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            MembershipUser user = Membership.GetUser();
            SQLDatabaseManager db = new SQLDatabaseManager();

            Client c = new Client(user.ProviderUserKey.ToString());
            if (!c.checkValid())
            {
                Response.Redirect("~/Volunts/Offlimits.aspx");
            }
            int id = c.getIDVolunt();

            String query = String.Format("Select I.Nome, I.Morada, I.Contacto, I.Condicoes, S.Servico, S.Notas, S.Horario, S.Status, S.IDServico, S.IDVoluntario FROM Idoso I, Servico S, Voluntario V WHERE S.IDIdoso=I.IDIdoso AND S.IDVoluntario=V.IDVoluntario AND (S.IDVoluntario='15' OR S.IDVoluntario='{0}')", id);
            DataTable temp;
            temp = db.GetDataTable(query);
            GridView1.DataSource = temp;
            GridView1.DataBind();
        }
    }
Ejemplo n.º 24
0
    protected void Confirm_Click(object sender, EventArgs e)
    {

        MembershipUser user = Membership.GetUser();
        SQLDatabaseManager db = new SQLDatabaseManager();

        foreach (ListItem item in CheckBoxList1.Items)
        {
            if (item.Selected)
            {
                selected += item.Text + " - ";
            }
        }
        if (!selected.Equals(null))
        {
            String query = String.Format("UPDATE Servico SET Servico='{0}' WHERE IDServico='{1}'", selected, DropDownList1.SelectedValue);
            db.ExecuteNonQuery(query);
            Response.Redirect("~/Clients/VerServico.aspx");
        }
        else
        {
            Label1.Visible = true;
        }
    }
Ejemplo n.º 25
0
    protected void CreateUserWizard1_CreatedUser(object sender, EventArgs e)
    {

        if (RadioButtonList1.SelectedIndex.Equals(0))
        {
            
            //fill dos parametros da query com dados inseridos na textbox
            String user = CreateUserWizard1.UserName;
            String pass = CreateUserWizard1.Password;
            String email = CreateUserWizard1.Email;
            String nome = ((TextBox)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("Tnome")).Text;
            String morada = ((TextBox)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("Tmorada")).Text;
            String tlf = ((TextBox)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("Tcontactos")).Text;
            String data = ((TextBox)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("Tdata")).Text;
            String uid = Membership.GetUser(CreateUserWizard1.UserName).ProviderUserKey.ToString();

            //operação de insert

            SQLDatabaseManager db = new SQLDatabaseManager();
            

           

            Dictionary<String, String> InsertData = new Dictionary<String, String>()
            {
                {"Username", user},
                {"Nome", nome},
                {"Morada", morada},
                {"DataNasc", data},
                {"Email", email},
                {"Contactos", tlf},
                {"UserId",uid},
                
            };

           if(!db.Insert("dbo.Cliente", InsertData))
           {
               Response.Redirect("Erro ao criar entrada");
           }
            
            Roles.AddUserToRole(CreateUserWizard1.UserName.ToString(), "Cliente");
        }
        else
        {
            String user = CreateUserWizard1.UserName;
            String pass = CreateUserWizard1.Password;
            String email = CreateUserWizard1.Email;


            String nome = ((TextBox)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("Tnome")).Text;
            String morada = ((TextBox)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("Tmorada")).Text;
            String tlf = ((TextBox)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("Tcontactos")).Text;
            String data = ((TextBox)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("Tdata")).Text;
            String uid = Membership.GetUser(CreateUserWizard1.UserName).ProviderUserKey.ToString();
            //Response.Redirect(uid);

            SQLDatabaseManager db = new SQLDatabaseManager();


            Dictionary<String, String> InsertData = new Dictionary<String, String>()
            {
                
                {"Nome", nome},
                {"Morada", morada},
                {"Email", email},
                {"DataNasc", data},
                {"Contactos", tlf},
                {"UserId",uid},
                {"Username", user},
                {"Disponibilidade", "Nao definida"},
                {"Habilitacoes", "Nao definidas"},
                {"Status", "Aguarda"}
            };

            if (!db.Insert("dbo.Voluntario", InsertData))
            {
                Response.Redirect("Erro ao criar entrada");
            }

            Roles.AddUserToRole(CreateUserWizard1.UserName.ToString(), "Voluntario");
        }
    }