Exemplo n.º 1
0
 private void ad_bcup_Click(object sender, EventArgs e)
 {
     tbl.tblCourse c = new tbl.tblCourse(txtCourseID.Text, txtCoursename.Text);
     if (course.UpdateCourse(c) == false)
     {
         MessageBox.Show("Can not update this course !!!", "Error");
     }
     else
     {
         MessageBox.Show("Successfully Updated!!!");
     }
     ad_dgv_c.DataSource = course.getAllCourses();
     ad_dgv_c.Show();
 }
Exemplo n.º 2
0
 private void ad_cc_Click(object sender, EventArgs e)
 {
     if (Check_Fill())
     {
         tbl.tblCourse c = new tbl.tblCourse(txtCourseID.Text, txtCoursename.Text);
         if (course.InsertCourse(c) == false)
         {
             MessageBox.Show("Can not insert this course !!!", "Error");
         }
         else
         {
             MessageBox.Show("Successfully Inserted!!!");
         }
         ad_dgv_c.DataSource = course.getAllCourses();
         ad_dgv_c.Show();
         Binding();
     }
 }
Exemplo n.º 3
0
        public bool DeleteCourse(tbl.tblCourse c)
        {
            string        sql = "DELETE COURSES WHERE COURSE_ID = @COURSE_ID COLLATE SQL_Latin1_General_CP1_CS_AS ";
            SqlConnection con = dc.getConnect();

            try
            {
                cmd = new SqlCommand(sql, con);
                con.Open();
                cmd.Parameters.Add("@COURSE_ID", SqlDbType.VarChar).Value = c.COURSE_ID;
                cmd.ExecuteNonQuery();
                con.Close();
            }
            catch (Exception e)
            {
                return(false);
            }
            return(true);
        }
Exemplo n.º 4
0
        public bool InsertCourse(tbl.tblCourse c)
        {
            string        sql = "INSERT INTO COURSES VALUES(@COURSE_ID,@COURSENAME)";
            SqlConnection con = dc.getConnect();

            try
            {
                cmd = new SqlCommand(sql, con);
                con.Open();
                cmd.Parameters.Add("@COURSE_ID", SqlDbType.VarChar).Value   = c.COURSE_ID;
                cmd.Parameters.Add("@COURSENAME", SqlDbType.NVarChar).Value = c.COURSENAME;
                cmd.ExecuteNonQuery();
                con.Close();
            }
            catch (Exception e)
            {
                return(false);
            }
            return(true);
        }
Exemplo n.º 5
0
 public bool DeleteCourse(tbl.tblCourse c)
 {
     return(dalC.DeleteCourse(c));
 }
Exemplo n.º 6
0
 public bool UpdateCourse(tbl.tblCourse c)
 {
     return(dalC.UpdateCourse(c));
 }
Exemplo n.º 7
0
 public bool InsertCourse(tbl.tblCourse c)
 {
     return(dalC.InsertCourse(c));
 }