//BL get student list to grid
 public dalStudentdet getStudentListToGrid(dalStudentdet obj)
 {
     try
     {
         cmd.CommandText = "loadTaksToGrid";
         ada.Fill(obj.MyProperty_dsStudent, "loadStudents");
         ada.Fill(obj.MyProperty_dtStudent);
         return obj;
     }
     catch (Exception ex)
     {
         obj.MyProperty_Exception = ex.Message;
         return obj;
     }
 }
        //BL add temp students
        public void SaveStudentInfo(dalStudentdet obj)
        {
            try
            {
                cmd.CommandText = "SaveStudentInfo";

                cmd.Parameters.AddWithValue("@studentID", obj.MyProperty_StudenrID);
                cmd.Parameters.AddWithValue("@stName", obj.MyProperty_StudentName);
                cmd.Parameters.AddWithValue("@DOB", obj.MyProperty_DOB);
                cmd.Parameters.AddWithValue("@GPA", obj.MyProperty_GPA);
                cmd.Parameters.AddWithValue("@Active", obj.MyProperty_active);
                cmd.ExecuteNonQuery();
                cmd.Parameters.Clear();
            }
            catch (Exception ex)
            {

                obj.MyProperty_Exception = ex.Message;
            }
        }
        //This is for save student info
        private void SaveStudentTmp()
        {
            blStudentdet bl = new blStudentdet();
            dalStudentdet dal = new dalStudentdet();
            dal.MyProperty_Exception = "";

            dal.MyProperty_StudenrID = txtStudentID.Text;
            dal.MyProperty_StudentName= txtStName.Text;
            dal.MyProperty_DOB = DTPDOB.Value;
            dal.MyProperty_GPA = decimal.Parse(txtGPA.Text);
            string cbActiv;
            if(cbActive.Checked == true)
            {
                cbActiv = "Active";
            }
            else
            {
                 cbActiv = "false";
            }
            dal.MyProperty_active = cbActiv;

            bl.SaveStInfoTmp(dal);

            if (dal.MyProperty_Exception == "")
            {
                this.Close();

            }
        }
        //This set a boolean value For get existance Category Names From Database
        private bool getStudentsNamesToGrid()
        {
            bool bVal = true;

            blStudentdet bl = new blStudentdet();
            dalStudentdet dal = new dalStudentdet();

            dal.MyProperty_Exception = "";

            bl.getStudentListToGrid(dal);

            if (dal.MyProperty_Exception == "")
            {
                //if there are records in temp table setting the datagrid's data source
                if (dal.MyProperty_dsStudent.Tables["loadStudents"].Rows.Count > 0)
                {
                    dgvStDetails.DataSource = dal.MyProperty_dsStudent.Tables["loadStudents"];
                    bVal = true;
                }
                else
                    bVal = false;
            }
            else
            {
                bVal = false;
            }

            return bVal;
        }
        //This is for save student info
        private void SaveStudentDetails()
        {
            blStudentdet bl = new blStudentdet();
            dalStudentdet dal = new dalStudentdet();
            dal.MyProperty_Exception = "";

            for (int i = 0; i < dgvStDetails.Rows.Count; i++)
            {
                dal.MyProperty_StudenrID = dgvStDetails.Rows[i].Cells["StudentID"].Value.ToString();
                dal.MyProperty_StudentName = dgvStDetails.Rows[i].Cells["StudentName"].Value.ToString();
                dal.MyProperty_DOB = DateTime.Parse(dgvStDetails.Rows[i].Cells["DOB"].Value.ToString());
                dal.MyProperty_GPA = decimal.Parse(dgvStDetails.Rows[i].Cells["GPAVG"].Value.ToString());
                dal.MyProperty_active = dgvStDetails.Rows[i].Cells["Active"].Value.ToString();

                bl.SaveStudentInfo(dal);
            }
            if (dal.MyProperty_Exception == "")
            {
                MessageBox.Show("Student Details Saved Successfuly", "Success");
                dgvStDetails.DataSource = null;

            }
        }