Ejemplo n.º 1
0
    protected void btnAddQual_Click(object sender, EventArgs e)
    {
        string qual = txtQual.Text;
        uint gvoid = Convert.ToUInt32(Session["Selected"]);

        GFRC.vQualification create = new GFRC.vQualification(gvoid, qual);
        create.createQualification(create);
        Response.Redirect("/VolunteerQual.aspx?form=view&ID=" + create.gvoID);
    }
Ejemplo n.º 2
0
    protected void btnEditQual_Click(object sender, EventArgs e)
    {
        string qual = txeQual.Text;
        uint gvoid = 0, gvqid = 0;
        UInt32.TryParse(lbeShowID.Text, out gvoid);
        UInt32.TryParse(lbeShowQID.Text, out gvqid);

        GFRC.vQualification update = new GFRC.vQualification(gvqid, gvoid, qual);
        update.editQualification(update);
        Response.Redirect("/VolunteerQual.aspx?form=view&ID=" + update.gvoID);
    }
Ejemplo n.º 3
0
        public Vector<vQualification> listQualifications(uint gvoid)
        {
            // Declarations
            Vector<vQualification> quals = new Vector<vQualification>();
            uint gvqid = 0;
            string qualification = null;
            vQualification input = new vQualification();

            // Command
            string query = string.Format("SELECT gvq_id, gvq_qual " +
                                            "FROM gfrc_volunteer_qualification WHERE gvo_id = {0}", gvoid);

            try
            {
                using (conn)
                {
                    conn.Open();
                    cmd = new OleDbCommand(query, conn);
                    rdr = cmd.ExecuteReader();

                    while (rdr.Read())
                    {
                        if (!UInt32.TryParse(rdr.GetValue(0).ToString(), out gvqid))
                            gvqid = 0;
                        qualification = rdr.GetString(1);
                        if (gvqid != 0)
                        {
                            input = new vQualification(gvqid, gvoid, qualification);
                            quals.Add(input);
                        }

                    }
                }
            }
            finally
            {
                if (rdr != null)
                    rdr.Close();
            }
            if (conn != null)
            {
                conn.Close();
            }

            return quals;
        }
Ejemplo n.º 4
0
        public bool editQualification(vQualification edit)
        {
            bool result = false;
            // Command
            string query = String.Format(@"UPDATE gfrc_volunteer_qualification SET gvq_qual = '{0}' " +
                                            "WHERE gvq_id = {1}", edit.Qualification, edit.gvqID);

            int affected = 0;

            try
            {
                using (conn)
                {
                    conn.Open();
                    cmd = new OleDbCommand(query, conn);
                    affected = cmd.ExecuteNonQuery();
                }
            }
            catch (Exception e)
            {
                result = false;
            }
            finally
            {
                if (rdr != null)
                    rdr.Close();
            }
            if (conn != null)
            {
                conn.Close();
            }

            // checks if rows were affected by the insert query
            if (affected > 0)
            {
                result = true;
            }

            return result;
        }
Ejemplo n.º 5
0
        public bool createQualification(vQualification create)
        {
            bool result = false;
            // Command
            string query = String.Format(@"INSERT INTO gfrc_volunteer_qualification (gvo_id, gvq_qual) " +
                                            "VALUES({0}, '{1}')",
                                            create.gvoID, create.Qualification);

            int affected = 0;

            try
            {
                using (conn)
                {
                    conn.Open();
                    cmd = new OleDbCommand(query, conn);
                    affected = cmd.ExecuteNonQuery();

                    // checks if rows were affected by the insert query
                    if (affected > 0)
                    {
                        result = true;

                        query = String.Format(@"SELECT gvq_id FROM gfrc_volunteer_qualification WHERE gvq_id = (SELECT MAX(gvq_id) FROM gfrc_volunteer_qualification)");
                        cmd = new OleDbCommand(query, conn);
                        rdr = cmd.ExecuteReader();

                        while (rdr.Read())
                        {
                            // Set gloID
                            UInt32.TryParse(rdr.GetValue(0).ToString(), out _gvqID);
                        }
                    }

                }
            }
            catch (Exception e)
            {
                result = false;
            }
            finally
            {
                if (rdr != null)
                    rdr.Close();
            }
            if (conn != null)
            {
                conn.Close();
            }

            return result;
        }
Ejemplo n.º 6
0
    protected void showQuals(uint qd)
    {
        GFRC.vQualification display = new GFRC.vQualification(qd);

        lbeShowQID.Text = display.gvqID.ToString();
        lbeShowID.Text = display.gvoID.ToString();
        txeQual.Text = display.Qualification;
    }