//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 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 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; } }