protected void searchButton_Click(object sender, EventArgs e) { try { if (isFormValid()) { AddStudentEntryDao addStudentEntryDao = new AddStudentEntryDao(); addStudentEntryDao.RegistraionNo = registrationNoTextBox.Text; SearchStudentByRegistrationNoDal searchStudentByRegistrationNo = new SearchStudentByRegistrationNoDal(); DataTable dt = searchStudentByRegistrationNo.StudentSearchByRegistrationNoDB(addStudentEntryDao); if (dt.Rows.Count == 1) { studentRecordsGrid.DataSource = dt; studentRecordsGrid.DataBind(); } else { studentRecordsGrid.Visible = false; Response.Write("There are no student found!"); } } } catch (Exception r) { Response.Write(r.Message); } }
public string GetRegistrationSerialDB(AddStudentEntryDao addStudentEntryDao) { int cnt = 0; string totalCnt = ""; ConnectionClass connection = new ConnectionClass(); string query = "select Count(*) cnt from StudentManagement_T where Selected_Course='" + addStudentEntryDao.SelectedCourse + "' and Selected_Teacher='" + addStudentEntryDao.SelectedTeacher + "'"; try { SqlCommand cmd = new SqlCommand(query, connection.GetOpen()); int temp = (int)cmd.ExecuteScalar(); cnt = temp + 1; if (cnt <= 15) { totalCnt = cnt.ToString(); if (totalCnt.Length <= 1) { totalCnt = "0" + totalCnt; } } else { totalCnt = "Maximux Number Of Student"; } } catch { totalCnt = ""; } finally { connection.GetClose(); } return(totalCnt); }
public string InsertStudentFeeDB(AddStudentEntryDao addStudentEntryDao) { ConnectionClass connection = new ConnectionClass(); string query = ""; return("kjk"); }
public string GetStudentRegistraionNo(AddStudentEntryDao addStudentDao) { addStudentDao.CodeCourse = addStudentDao.SelectedCourse.Substring(0, 2); addStudentDao.CodeDate = addStudentDao.Date.Substring(8, 2); addStudentDao.RegistraionNo = addStudentDao.CodeCourse + addStudentDao.CodeDate; CountStudentSerialDal countStudentSeralDal = new CountStudentSerialDal(); addStudentDao.RegistraionNo += countStudentSeralDal.GetRegistrationSerialDB(addStudentDao); return(addStudentDao.RegistraionNo); }
protected void studentRecordsGridView_RowDeleting(object sender, GridViewDeleteEventArgs e) { AddStudentEntryDao addStudentEntryDao = new AddStudentEntryDao(); int index = e.RowIndex; addStudentEntryDao.Id = ((Label)(studentRecordsGridView.Rows[index].FindControl("sIdLabel"))).Text; StudentDeletedByIdDal studentDeletedByIdDal = new StudentDeletedByIdDal(); string delete = studentDeletedByIdDal.GetStudentDeleteById(addStudentEntryDao); if (delete != null) { LoadInStudentRecordGrid(); } }
protected void studentRecordsGridView_RowUpdating(object sender, GridViewUpdateEventArgs e) { AddStudentEntryDao addStudentEntryDao = new AddStudentEntryDao(); int index = e.RowIndex; addStudentEntryDao.Id = ((Label)(studentRecordsGridView.Rows[index].FindControl("sIdLabel"))).Text; addStudentEntryDao.StudentName = ((TextBox)(studentRecordsGridView.Rows[index].FindControl("studentNameTextBox"))).Text; addStudentEntryDao.Address = ((TextBox)(studentRecordsGridView.Rows[index].FindControl("addressTextBox"))).Text; addStudentEntryDao.Email = ((TextBox)(studentRecordsGridView.Rows[index].FindControl("emailTextBox"))).Text; UpdateStudentByValueDal updateStudentByValueDal = new UpdateStudentByValueDal(); string update = updateStudentByValueDal.GetUpdateStudentByValue(addStudentEntryDao); if (update != null) { studentRecordsGridView.EditIndex = -1; LoadInStudentRecordGrid(); } }
protected void startDateTextBox_TextChanged(object sender, EventArgs e) { AddStudentEntryDao addStudentDao = new AddStudentEntryDao(); addStudentDao.SelectedCourse = courseListDdList.SelectedItem.Text; addStudentDao.Date = startDateTextBox.Text; addStudentDao.SelectedTeacher = teachersDdList.SelectedItem.Text; StudentRegstraionNoBll studentRegistrationBll = new StudentRegstraionNoBll(); addStudentDao.RegistraionNo = studentRegistrationBll.GetStudentRegistraionNo(addStudentDao); if (addStudentDao.RegistraionNo != null) { registrationNumberLabel.Text = addStudentDao.RegistraionNo; } else { registrationNumberLabel.Text = "Error Occoured!"; } }
public void LoadInStudentRecordGrid() { AddStudentEntryDao addStudentEntryDao = new AddStudentEntryDao(); addStudentEntryDao.RegistraionNo = registrationNoTextBox.Text; SearchStudentByRegistrationNoDal searchStudentByRegistrationNoDal = new SearchStudentByRegistrationNoDal(); DataTable searchStudent = searchStudentByRegistrationNoDal.StudentSearchByRegistrationNoDB(addStudentEntryDao); if (searchStudent.Rows.Count > 0) { studentRecordsGridView.Visible = true; studentRecordsGridView.DataSource = searchStudent; studentRecordsGridView.DataBind(); } else { Response.Write("No Student Record Found!"); studentRecordsGridView.Visible = false; } }
public DataTable StudentSearchByRegistrationNoDB(AddStudentEntryDao addStudentEntryDao) { DataTable dt = new DataTable(); ConnectionClass connection = new ConnectionClass(); string query = "Select *from StudentManagement_T Where Registration_No='" + addStudentEntryDao.RegistraionNo + "'"; try { SqlDataAdapter da = new SqlDataAdapter(query, connection.GetOpen()); da.Fill(dt); } catch { dt = null; } finally { connection.GetClose(); } return(dt); }
protected void saveButton_Click(object sender, EventArgs e) { try { if (isFormValid()) { AddStudentEntryDao addStudentEntryDao = new AddStudentEntryDao(); addStudentEntryDao.StudentName = studentNameTextBox.Text; addStudentEntryDao.Address = addressTextBox.Text; addStudentEntryDao.Email = emailTextBox.Text; addStudentEntryDao.Date = startDateTextBox.Text; addStudentEntryDao.SelectedCourse = courseListDdList.SelectedItem.Text; addStudentEntryDao.SelectedTeacher = teachersDdList.SelectedItem.Text; addStudentEntryDao.RegistraionNo = registrationNumberLabel.Text; addStudentEntryDao.CourseFee = Convert.ToInt32(courseFeeLabel.Text); AddStudentEntryDal addStudentEntryDal = new AddStudentEntryDal(); string save = addStudentEntryDal.AddstudentDB(addStudentEntryDao); if (save != null) { studentNameTextBox.Text = ""; addressTextBox.Text = ""; emailTextBox.Text = ""; courseListDdList.ClearSelection(); teachersDdList.ClearSelection(); startDateTextBox.Text = ""; registrationNumberLabel.Text = "Registration Number Will Be Display Here"; courseFeeLabel.Text = "Course Fee Will Be Display Here"; } else { Response.Write("There are some problem fixed! Please try again later..."); } } } catch (Exception r) { Response.Write(r.Message); } }
public string GetUpdateStudentByValue(AddStudentEntryDao addStudentEntryDao) { string isUpdate = ""; ConnectionClass connection = new ConnectionClass(); string query = "update StudentManagement_T set Student_Name='" + addStudentEntryDao.StudentName + "', Address='" + addStudentEntryDao.Address + "',Email='" + addStudentEntryDao.Email + "' where id='" + addStudentEntryDao.Id + "'"; try { SqlCommand cmd = new SqlCommand(query, connection.GetOpen()); cmd.ExecuteNonQuery(); isUpdate = "Update Successful."; } catch { isUpdate = "Update Fialed!"; } finally { connection.GetClose(); } return(isUpdate); }
public string GetStudentDeleteById(AddStudentEntryDao addStudentEntryDao) { string isDelete = ""; ConnectionClass connection = new ConnectionClass(); string query = "delete from StudentManagement_T where id=" + addStudentEntryDao.Id + ""; try { SqlCommand cmd = new SqlCommand(query, connection.GetOpen()); cmd.ExecuteNonQuery(); isDelete = "Delete Successful."; } catch (Exception r) { isDelete = "Delete Failed!"; } finally { connection.GetClose(); } return(isDelete); }
public string GetUpdateStudentFeeDB(AddStudentEntryDao addStudentEntryDao) { string isSuccess = ""; ConnectionClass connection = new ConnectionClass(); string query = "Update StudentManagement_T Set Paid_Fee='" + addStudentEntryDao.PaidFee + "',Remaining_Fee='" + addStudentEntryDao.RemainingFee + "' Where Registration_No='" + addStudentEntryDao.RegistraionNo + "'"; try { SqlCommand cmd = new SqlCommand(query, connection.GetOpen()); cmd.ExecuteNonQuery(); isSuccess = "Upate Successful."; } catch { isSuccess = "Update Failed!"; } finally { connection.GetClose(); } return(isSuccess); }
public string AddstudentDB(AddStudentEntryDao addStudentEntryDao) { string isSuccess = ""; ConnectionClass connection = new ConnectionClass(); string query = "Insert Into StudentManagement_T (Student_Name,Address,Email,Date,Selected_Course,Course_Fee,Selected_Teacher,Registration_No) values('" + addStudentEntryDao.StudentName + "','" + addStudentEntryDao.Address + "','" + addStudentEntryDao.Email + "','" + addStudentEntryDao.Date + "','" + addStudentEntryDao.SelectedCourse + "','" + addStudentEntryDao.CourseFee + "','" + addStudentEntryDao.SelectedTeacher + "','" + addStudentEntryDao.RegistraionNo + "')"; try { SqlCommand cmd = new SqlCommand(query, connection.GetOpen()); cmd.ExecuteNonQuery(); isSuccess = "Save Successful."; } catch { isSuccess = "Not Saved!"; } finally { connection.GetClose(); } return(isSuccess); }
public int GetRemainingFee(AddStudentEntryDao addStudentDao) { return(0); }