Ejemplo n.º 1
0
    protected void btnEditPosition_Click(object sender, EventArgs e)
    {
        string position = txePosition.Text, drivercat = dreDriverCat.SelectedItem.Value, drivertrans = dreDriverTrans.SelectedItem.Value;
        string drivercatdoc = feDriverCatDoc.PostedFile.FileName;
        uint gvoid = Convert.ToUInt32(lbeShowID.Text), gvpid = Convert.ToUInt32(lbeShowPID.Text);

        if (drivercat == null || drivercat == "")
            drivercat = " ";
        if (drivertrans == null || drivertrans == "")
            drivertrans = " ";
        if (drivercatdoc == null || drivercatdoc == "")
            drivercatdoc = txtDCDoc.Text;

        GFRC.Position update = new GFRC.Position(gvpid, gvoid, position, drivercat, drivercatdoc, drivertrans);
        update.editPosition(update);
        Response.Redirect("/VolunteerPosition.aspx?form=view&ID=" + update.gvoID);
    }
Ejemplo n.º 2
0
    protected void btnAddPosition_Click(object sender, EventArgs e)
    {
        string position = txtPosition.Text, drivercat = drpDriverCat.SelectedItem.Value, drivertrans = drpDriverTrans.SelectedItem.Value;
        string drivercatdoc = null;
        if (fDriverCatDoc.HasFile)
            drivercatdoc = fDriverCatDoc.PostedFile.FileName;
        uint gvoid = Convert.ToUInt32(Session["Selected"]);

        if (drivercat == null || drivercat == "")
            drivercat = " ";
        if (drivertrans == null || drivertrans == "")
            drivertrans = " ";
        if (drivercatdoc == null || drivercatdoc == "")
            drivercatdoc = " ";

        GFRC.Position create = new GFRC.Position(gvoid, position, drivercat, drivercatdoc, drivertrans);
        create.createPosition(create);
        Response.Redirect("/VolunteerPosition.aspx?form=view&ID=" + create.gvoID);
    }
Ejemplo n.º 3
0
    protected string displayPosition(uint id)
    {
        string result = "";

        GFRC.Position display = new GFRC.Position(id, 'o');

        if (display.PositionA == null || display.PositionA == "")
            result = "There is no position record for volunteer ID " + id + ". <a href=\"/VolunteerPosition.aspx?form=add&ID=" + id + "\">Add a record now.</a>";
        else
        {
            result = "<table class=\"display\"><tr><td>";
            result += string.Format("Position ID: </td><td>{0}</td></tr><tr><td>", display.gvpID);
            result += string.Format("Volunteer ID: </td><td>{0}</td></tr><tr><td>", display.gvoID);
            result += string.Format("Position: </td><td>{0}</td></tr><tr><td>", display.PositionA);
            result += string.Format("Driver Category: </td><td>{0}</td></tr><tr><td>", display.DriverCat);
            result += string.Format("Supporting Document: </td><td>{0}</td></tr><tr><td>", display.DriverCatDoc);
            result += string.Format("Driver Transmission: </td><td>{0}</td></tr></table>", display.DriverTrans);
        }

        return result;
    }
Ejemplo n.º 4
0
        public bool editPosition(Position edit)
        {
            bool result = false;
            // Command
            string query = String.Format(@"UPDATE gfrc_volunteer_position SET gvp_position = '{0}', gvp_driver_cat = '{1}', gvp_driver_cat_doc = '{2}', gvp_driver_trans = '{3}' " +
                                            "WHERE gvo_id = {4} AND gvp_id = {5}", edit.PositionA, edit.DriverCat, edit.DriverCatDoc, edit.DriverTrans, edit.gvoID, edit.gvpID);

            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 createPosition(Position create)
        {
            bool result = false;
            // Command
            string query = String.Format(@"INSERT INTO gfrc_volunteer_position (gvo_id, gvp_position, gvp_driver_cat, gvp_driver_cat_doc, gvp_driver_trans) " +
                                            "VALUES({0}, '{1}', '{2}', '{3}', '{4}')",
                                            create.gvoID, create.PositionA, create.DriverCat, create.DriverCatDoc, create.DriverTrans);

            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 gvp_id FROM gfrc_volunteer_position WHERE gvp_id = (SELECT MAX(gvp_id) FROM gfrc_volunteer_position)");
                        cmd = new OleDbCommand(query, conn);
                        rdr = cmd.ExecuteReader();

                        while (rdr.Read())
                        {
                            // Set gloID
                            _gvpID = Convert.ToUInt32(rdr.GetInt32(0));
                        }
                    }

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

            return result;
        }
Ejemplo n.º 6
0
    protected void showPosition(uint id)
    {
        GFRC.Position display = new GFRC.Position(id, 'o');

        lbeShowPID.Text = display.gvpID.ToString();
        lbeShowID.Text = display.gvoID.ToString();
        txePosition.Text = display.PositionA;
        dreDriverCat.Items.FindByValue(display.DriverCat).Selected = true;
        txtDCDoc.Text = display.DriverCatDoc;
        dreDriverTrans.Items.FindByValue(display.DriverTrans).Selected = true;
    }