Esempio 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();
                }
            }
        }
Esempio 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();
            }
        }
Esempio 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);
        }
Esempio 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);
        }
Esempio 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);
        }
Esempio n. 6
0
 public bool DeleteStudent(tblStudent st)
 {
     return(dalST.DeleteStudent(st));
 }
Esempio n. 7
0
 public bool UpdateStudent(tblStudent st)
 {
     return(dalST.UpdateStudent(st));
 }
Esempio n. 8
0
 public bool InsertStudent(tblStudent st)
 {
     return(dalST.InsertStudent(st));
 }