Ejemplo n.º 1
0
        //GETTERS
        public static void setNames(ComboBox comb)
        {
            SqlConnection con = new DBConnection().getConnection();

            con.Open();
            SqlCommand cmd = con.CreateCommand();

            cmd.CommandType = CommandType.Text;
            cmd.CommandText = "SELECT * FROM Names";
            cmd.ExecuteNonQuery();
            DataTable      dt = new DataTable();
            SqlDataAdapter da = new SqlDataAdapter(cmd);

            da.Fill(dt);
            foreach (DataRow dr in dt.Rows)
            {
                comb.Items.Add(dr["First_Name"].ToString() + "  " + dr["Middle_Name"].ToString() + "  " + dr["Last_Name"].ToString());
            }
        }
Ejemplo n.º 2
0
        public static void setClassName(ComboBox text)
        {
            //SET THE YEAR OF THE SCHOOL SESSION THE LIST BOX CONTROL
            SqlConnection con = new DBConnection().getConnection();

            con.Open();
            SqlCommand cmd = con.CreateCommand();

            cmd.CommandType = CommandType.Text;
            cmd.CommandText = "SELECT DISTINCT ClassName FROM Class";
            cmd.ExecuteNonQuery();
            DataTable      dt = new DataTable();
            SqlDataAdapter da = new SqlDataAdapter(cmd);

            da.Fill(dt);
            foreach (DataRow dr in dt.Rows)
            {
                text.Items.Add((dr["ClassName"].ToString()));
            }
        }
Ejemplo n.º 3
0
        public static void setSessionYear(ListBox text)
        {
            //SET THE YEAR OF THE SCHOOL SESSION THE LIST BOX CONTROL
            SqlConnection con = new DBConnection().getConnection();

            con.Open();
            SqlCommand cmd = con.CreateCommand();

            cmd.CommandType = CommandType.Text;
            cmd.CommandText = "SELECT Session.Start_Year FROM Session";
            cmd.ExecuteNonQuery();
            DataTable      dt = new DataTable();
            SqlDataAdapter da = new SqlDataAdapter(cmd);

            da.Fill(dt);
            foreach (DataRow dr in dt.Rows)
            {
                text.Items.Add(string.Format("{0:MM/dd/yyy}", dr["Start_Year"]));
            }
        }
Ejemplo n.º 4
0
        public static void setFeeName(ComboBox Fee)
        {
            //GET THE FEE NAME FROM THE DATABASE
            SqlConnection con = new DBConnection().getConnection();

            con.Open();
            SqlCommand cmd = con.CreateCommand();

            cmd.CommandType = CommandType.Text;
            cmd.CommandText = "SELECT DISTINCT  Fee_Name FROM SetFees";
            cmd.ExecuteNonQuery();
            DataTable      dt = new DataTable();
            SqlDataAdapter da = new SqlDataAdapter(cmd);

            da.Fill(dt);
            foreach (DataRow dr in dt.Rows)
            {
                Fee.Items.Add(dr["Fee_Name"].ToString());
            }
        }
Ejemplo n.º 5
0
        public void promoteClass(ListBox text)
        {
            //SET THE YEAR OF THE SCHOOL SESSION THE LIST BOX CONTROL

            SqlConnection con = new DBConnection().getConnection();
            con.Open();
            SqlCommand cmd = con.CreateCommand();
            cmd.CommandType = CommandType.Text;
            cmd.CommandText = "SELECT DISTINCT ClassName FROM Class";
            cmd.ExecuteNonQuery();
            DataTable dt = new DataTable();
            SqlDataAdapter da = new SqlDataAdapter(cmd);
            da.Fill(dt);
            foreach (DataRow dr in dt.Rows)
            {
                var id = Convert.ToInt32(dr["Student_Id"]);
                setStudentId(id);
                text.Items.Add((dr["ClassName"].ToString()));
            }
        }
Ejemplo n.º 6
0
 void setEventClass(ListBox text)
 {
     try
     {
         //SET THE YEAR OF THE SCHOOL SESSION THE LIST BOX CONTROL
         SqlConnection con = new DBConnection().getConnection();
         con.Open();
         text.Items.Clear();
         SqlCommand cmd = con.CreateCommand();
         cmd.CommandType = CommandType.Text;
         cmd.CommandText = "SELECT Id,Class FROM EventClass WHERE Event_Id='" + dataAccess.eventId + "'";
         cmd.ExecuteNonQuery();
         DataTable      dt = new DataTable();
         SqlDataAdapter da = new SqlDataAdapter(cmd);
         da.Fill(dt);
         foreach (DataRow dr in dt.Rows)
         {
             // text.Items.Add((dr[0].ToString()));
             text.Items.Add((dr[1].ToString()));
         }
         con.Close();
     }
     catch (Exception) { }
 }
Ejemplo n.º 7
0
        public static void setEventClassName(ListBox text, TextBox Com)
        {
            SqlConnection con = new DBConnection().getConnection();

            text.Items.Clear();
            con.Open();
            SqlCommand cmd = con.CreateCommand();

            cmd.CommandType = CommandType.Text;
            cmd.CommandText = "SELECT *FROM EventClass WHERE EventClass.Event_Id in(SELECT Event_Id FROM Events WHERE Fee_Name =@feename)";
            cmd.Parameters.Add(new SqlParameter("@feename", SqlDbType.VarChar));
            cmd.Parameters["@feename"].Value = Com.Text;
            cmd.ExecuteNonQuery();
            DataTable      dt = new DataTable();
            SqlDataAdapter da = new SqlDataAdapter(cmd);

            da.Fill(dt);
            foreach (DataRow dr in dt.Rows)

            {
                text.Items.Add((dr["Class"].ToString()));
            }
            con.Close();
        }