Ejemplo n.º 1
0
        private void btnRemove_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("Do you really want to delete this student?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
            {
                tblStudent st = new tblStudent();

                st.studentId = ID;

                if (bllST.DeleteStudent(st))
                {
                    ShowAllStudent();
                }
            }
        }
Ejemplo n.º 2
0
        public void GETVALUEedit(string v1, string v2, string v3, string v4)
        {
            txtID.Text    = v1;
            txtName.Text  = v2;
            txtClass.Text = v3;
            txtScore.Text = v4;

            tblStudent st = new tblStudent();

            st.studentId    = ID;
            st.studentName  = txtName.Text.Trim();
            st.studentClass = txtClass.Text.Trim();
            st.studentScore = txtScore.Text.Trim();

            if (bllST.UpdateStudent(st))
            {
                ShowAllStudent();
            }
        }
Ejemplo n.º 3
0
        public bool DeleteStudent(tblStudent st)
        {
            string        sql = "DELETE tblStudent WHERE studentId = @studentId";
            SqlConnection con = dc.getConnect();

            try
            {
                cmd = new SqlCommand(sql, con);
                con.Open();
                cmd.Parameters.Add("@studentID", SqlDbType.NVarChar).Value = st.studentId;


                cmd.ExecuteNonQuery();
                con.Close();
            }

            catch (Exception e)
            {
                return(false);
            }
            return(true);
        }
Ejemplo n.º 4
0
        public bool UpdateStudent(tblStudent st)
        {
            string        sql = "UPDATE tblStudent SET  studentName = @studentName, studentClass = @studentClass, studentScore = @studentScore WHERE studentId = @studentId";
            SqlConnection con = dc.getConnect();

            try
            {
                cmd = new SqlCommand(sql, con);
                con.Open();
                cmd.Parameters.Add("@studentID", SqlDbType.NVarChar).Value    = st.studentId;
                cmd.Parameters.Add("@studentName", SqlDbType.NVarChar).Value  = st.studentName;
                cmd.Parameters.Add("@studentClass", SqlDbType.NVarChar).Value = st.studentClass;
                cmd.Parameters.Add("@studentScore", SqlDbType.NVarChar).Value = st.studentScore;

                cmd.ExecuteNonQuery();
                con.Close();
            }

            catch (Exception e)
            {
                return(false);
            }
            return(true);
        }
Ejemplo n.º 5
0
        public bool InsertStudent(tblStudent st)
        {
            string        sql = "INSERT INTO tblStudent(studentID, studentName, studentClass, studentScore) VALUES(@studentID, @studentName, @studentClass, @studentScore)";
            SqlConnection con = dc.getConnect();

            try
            {
                cmd = new SqlCommand(sql, con);
                con.Open();
                cmd.Parameters.Add("@studentID", SqlDbType.NVarChar).Value    = st.studentId;
                cmd.Parameters.Add("@studentName", SqlDbType.NVarChar).Value  = st.studentName;
                cmd.Parameters.Add("@studentClass", SqlDbType.NVarChar).Value = st.studentClass;
                cmd.Parameters.Add("@studentScore", SqlDbType.NVarChar).Value = st.studentScore;

                cmd.ExecuteNonQuery();
                con.Close();
            }

            catch (Exception e)
            {
                return(false);
            }
            return(true);
        }
Ejemplo n.º 6
0
 public bool DeleteStudent(tblStudent st)
 {
     return(dalST.DeleteStudent(st));
 }
Ejemplo n.º 7
0
 public bool UpdateStudent(tblStudent st)
 {
     return(dalST.UpdateStudent(st));
 }
Ejemplo n.º 8
0
 public bool InsertStudent(tblStudent st)
 {
     return(dalST.InsertStudent(st));
 }