public DataSet.DsPSMS.ST_STUDENT_DATADataTable selectStudentData(DataSet.DsPSMS.ST_STUDENT_DATARow dr, out string msg) { DataSet.DsPSMS.ST_STUDENT_DATADataTable result = new DataSet.DsPSMS.ST_STUDENT_DATADataTable(); if (dr == null) { msg = "data is empty"; return(null); } try { db.Open(); result = db.selectStudentData(dr); if (result != null) { msg = result.Rows.Count + " student found"; } else { result = null; msg = "attendance not found"; } } catch { msg = "error has occure when select data"; return(null); } finally { db.Close(); } return(result); }
public DataSet.DsPSMS.ST_STUDENT_DATADataTable selectStudentData(DataSet.DsPSMS.ST_STUDENT_DATARow dr) { if (dr == null) { return(null); } string query = "SELECT * FROM ST_STUDENT_DATA WHERE"; if (dr.EDU_YEAR.ToString().Trim().Length != 0) { query += " EDU_YEAR = '" + dr.EDU_YEAR + "'"; } if (!dr.IsGRADE_IDNull()) { query += "AND GRADE_ID = '" + dr.GRADE_ID + "'"; } if (!dr.IsROOM_IDNull()) { query += " AND ROOM_ID = '" + dr.ROOM_ID + "'"; } SqlCommand cmd = new SqlCommand(query, conn); SqlDataAdapter da = new SqlDataAdapter(cmd); DataSet.DsPSMS.ST_STUDENT_DATADataTable dt = new DataSet.DsPSMS.ST_STUDENT_DATADataTable(); da.Fill(dt); return(dt); }
public DataSet.DsPSMS.ST_STUDENT_DATADataTable selectStudentId(DataSet.DsPSMS.ST_STUDENT_DATARow dr) { string query = "SELECT * FROM ST_STUDENT_DATA WHERE STUDENT_NAME = '" + dr.STUDENT_NAME + "' AND GRADE_ID = '" + dr.GRADE_ID + "' AND ROOM_ID = '" + dr.ROOM_ID + "'"; SqlCommand cmd = new SqlCommand(query, conn); SqlDataAdapter da = new SqlDataAdapter(cmd); DataSet.DsPSMS.ST_STUDENT_DATADataTable dt = new DataSet.DsPSMS.ST_STUDENT_DATADataTable(); da.Fill(dt); return(dt); }
//Select all Student data public DataSet.DsPSMS.ST_STUDENT_DATADataTable selectAllData() { Open(); string query = "SELECT * FROM ST_STUDENT_DATA WHERE DEL_FLG =" + 0; SqlCommand cmd = new SqlCommand(query, conn); SqlDataAdapter da = new SqlDataAdapter(cmd); DataSet.DsPSMS.ST_STUDENT_DATADataTable dt = new DataSet.DsPSMS.ST_STUDENT_DATADataTable(); da.Fill(dt); Close(); return(dt); }
public DataSet.DsPSMS.ST_STUDENT_DATADataTable selectStudentId(DataSet.DsPSMS.ST_STUDENT_DATARow sr) { DataSet.DsPSMS.ST_STUDENT_DATADataTable result = new DataSet.DsPSMS.ST_STUDENT_DATADataTable(); try { db.Open(); result = db.selectStudentId(sr); } catch { return(null); } finally { db.Close(); } return(result); }
// Get all student data public DataSet.DsPSMS.ST_STUDENT_DATADataTable getAllData(out string msg) { DataSet.DsPSMS.ST_STUDENT_DATADataTable dt = new DataSet.DsPSMS.ST_STUDENT_DATADataTable(); try { Open(); dt = stu.selectAllData(); msg = "Student found"; } catch { msg = "error has occure when select data"; return(null); } finally { Close(); } return(dt); }
//Student Image //public DataSet.DsPSMS.ST_STUDENT_DATADataTable studentimage(string photoselect) //{ // string msg; // DataSet.DsPSMS.ST_STUDENT_DATADataTable namegyear = new DataSet.DsPSMS.ST_STUDENT_DATADataTable(); // try // { // Open(); // namegyear = stu.selectImage(photoselect); // msg = "Have Data"; // } // catch // { // msg = "error occurs when searching name, grade and education year"; // return null; // } // finally // { // Close(); // } // return namegyear; //} // Get student by option public DataSet.DsPSMS.ST_STUDENT_DATADataTable getAllDataByOption(DataSet.DsPSMS.ST_STUDENT_DATARow dr) { DataSet.DsPSMS.ST_STUDENT_DATADataTable dt = new DataSet.DsPSMS.ST_STUDENT_DATADataTable(); try { Open(); dt = stu.selectDataOption(dr); } catch { return(null); } finally { Close(); } return(dt); }
public DsPSMS.ST_STUDENT_DATARow getStuName(DsPSMS.ST_STUDENT_DATARow dr, out string msg) { DataSet.DsPSMS.ST_STUDENT_DATARow stuDr = new DataSet.DsPSMS.ST_STUDENT_DATADataTable().NewST_STUDENT_DATARow(); try { Open(); stuDr = stu.selectStuName(dr); msg = "Have data"; } catch { msg = "error occurs when selecting name"; return(null); } finally { Close(); } return(stuDr); }
// Select active student data by option public DataSet.DsPSMS.ST_STUDENT_DATADataTable selectDataOption(DataSet.DsPSMS.ST_STUDENT_DATARow dr) { Open(); string query = "SELECT * FROM ST_STUDENT_DATA WHERE DEL_FLG=" + 0; if (!dr.IsGRADE_IDNull()) { query += "AND GRADE_ID =" + dr.GRADE_ID + "'"; } if (!dr.IsROOM_IDNull()) { query += "AND ROOM_ID =" + dr.ROOM_ID + "'"; } SqlCommand cmd = new SqlCommand(query, conn); SqlDataAdapter da = new SqlDataAdapter(cmd); DataSet.DsPSMS.ST_STUDENT_DATADataTable dt = new DataSet.DsPSMS.ST_STUDENT_DATADataTable(); da.Fill(dt); Close(); return(dt); }
public DataSet.DsPSMS.ST_STUDENT_DATARow searchIdNaEdGd(DataSet.DsPSMS.ST_STUDENT_DATARow dr) { string msg; DataSet.DsPSMS.ST_STUDENT_DATADataTable gyear = new DataSet.DsPSMS.ST_STUDENT_DATADataTable(); try { Open(); gyear = stu.selectIdNaEdGd(dr); msg = "Have Data"; } catch { msg = "error occurs when searching grade and education year"; return(null); } finally { Close(); } return(gyear[0]); }
public DataSet.DsPSMS.ST_STUDENT_DATADataTable searchgradeyear(string grade, string eduyear) { string msg; DataSet.DsPSMS.ST_STUDENT_DATADataTable gyear = new DataSet.DsPSMS.ST_STUDENT_DATADataTable(); try { Open(); gyear = stu.selectgyear(grade, eduyear); msg = "Have Data"; } catch { msg = "error occurs when searching grade and education year"; return(null); } finally { Close(); } return(gyear); }
protected void btnSearch_Click(object sender, EventArgs e) { if (!checkValidation()) { gridViewAttendance.DataSource = null; gridViewAttendance.DataBind(); studentRow = new DataSet.DsPSMS.ST_STUDENT_DATADataTable().NewST_STUDENT_DATARow(); studentRow.EDU_YEAR = Convert.ToInt16(eduYearList.Text); studentRow.GRADE_ID = gradeList.Text; studentRow.ROOM_ID = roomList.Text; studentRow.ROLL_NO = ""; studentRow.STUDENT_NAME = ""; if (attendDate.Text.Trim().Length == 0) { DataSet.DsPSMS.ST_STUDENT_DATADataTable resultDt = attService.selectStudentData(studentRow, out msg); if (resultDt == null || resultDt.Count == 0) { ModelState.AddModelError(string.Empty, "Data doesn't found"); gridViewAttendance.DataSource = null; gridViewAttendance.DataBind(); } else { gridViewAttendance.DataSource = resultDt; gridViewAttendance.DataBind(); } } else { DataSet.DsPSMS.ST_ATTENDANCE_DATARow adr = new DataSet.DsPSMS.ST_ATTENDANCE_DATADataTable().NewST_ATTENDANCE_DATARow(); adr.ATTENDANCE_DATE = attendDate.Text; DataSet.DsPSMS.ATTENDANCE_RESULTDataTable resultDt = attService.selectAttendanceData(studentRow, adr, out msg); if (resultDt.Count != 0) { gridViewAttendance.DataSource = resultDt; gridViewAttendance.DataBind(); for (int i = 0; i < resultDt.Count; i++) { Label date = (Label)gridViewAttendance.Rows[i].FindControl("Date"); date.Text = resultDt.Rows[i]["ATTENDANCE_DATE"].ToString(); CheckBox chkAM = (CheckBox)gridViewAttendance.Rows[i].FindControl("AM"); chkAM.Checked = false; if (Convert.ToInt16(resultDt.Rows[i]["MORNING"]) == 1) { chkAM.Checked = true; } else { chkAM.Checked = false; } CheckBox chkPM = (CheckBox)gridViewAttendance.Rows[i].FindControl("PM"); chkPM.Checked = false; if (Convert.ToInt16(resultDt.Rows[i]["EVENING"]) == 1) { chkPM.Checked = true; } else { chkPM.Checked = false; } } } } showAllButton(); } }
protected void btnSearch_Click(object sender, EventArgs e) { if (!checkValidation()) { studentRow = new DataSet.DsPSMS.ST_STUDENT_DATADataTable().NewST_STUDENT_DATARow(); stdResult = new DataSet.DsPSMS.ST_STUDENT_DATADataTable(); studentRow.GRADE_ID = ddlGrade.Text; studentRow.ROOM_ID = ddlClass.Text; studentRow.STUDENT_NAME = txtName.Text; stdResult = attService.selectStudentId(studentRow); attRow = new DataSet.DsPSMS.ST_ATTENDANCE_DATADataTable().NewST_ATTENDANCE_DATARow(); attResult = new DataSet.DsPSMS.ST_ATTENDANCE_DATADataTable(); if (ddlDay.SelectedIndex != 0) { attRow.ATTENDANCE_DATE = ddlDay.Text + "/"; } else { attRow.ATTENDANCE_DATE = "00/"; } if (ddlMonth.SelectedIndex != 0) { attRow.ATTENDANCE_DATE += ddlMonth.Text + "/"; } else { attRow.ATTENDANCE_DATE += "00/"; } if (ddlYear.SelectedIndex != 0) { attRow.ATTENDANCE_DATE += ddlYear.Text; } else { attRow.ATTENDANCE_DATE += "0000"; } if (stdResult.Count > 0) { if (stdResult.Count == 1) { attRow.STUDENT_ID = stdResult.Rows[0]["STUDENT_ID"].ToString(); } else { attRow.STUDENT_ID = ""; for (int i = 0; i < stdResult.Count; i++) { attRow.STUDENT_ID += stdResult.Rows[i]["STUDENT_ID"] + ","; } attRow.STUDENT_ID = attRow.STUDENT_ID.Substring(0, attRow.STUDENT_ID.Length - 1); } attResult = attService.selectAttendanceList(attRow); } if (attResult.Count == 0) { ModelState.AddModelError(string.Empty, "Data does not exist!"); } gvAttendanceList.DataSource = attResult; gvAttendanceList.DataBind(); } }
protected void btnupdate_Click(object sender, EventArgs e) { dr = new DataSet.DsPSMS.ST_STUDENT_DATADataTable().NewST_STUDENT_DATARow(); dt = new DataSet.DsPSMS.ST_STUDENT_DATADataTable(); if (stuid.Text.Trim().Length != 0) { if (education.Text != null) { string edu = education.Text; dr[0] = edu; } else { Response.Write("<script>alert('Please Enter Education Year !')</script>"); } if (stuid.Text.Trim().Length != 0) { dr[1] = Convert.ToString(stuid.Text); } else { Response.Write("<script>alert('Please Enter Student ID !')</script>"); } if (stuname.Text.Trim().Length != 0) { dr[2] = stuname.Text; } else { Response.Write("<script>alert('Please Enter Student Name !')</script>"); } if (rollno.Text.Trim().Length != 0) { dr[3] = rollno.Text; } else { Response.Write("<script>alert('Please Enter Roll No. !')</script>"); } if (Female.Checked == true) { dr[4] = "Female "; } if (Male.Checked == true) { dr[4] = " Male "; } string upFile = (string)(Session["PHOTO_PATH"] ?? " "); if (FileUpload1.FileName == "") { dr[5] = upFile; } else { if (!upFile.Equals(FileUpload1.FileName)) { string str = getFilePath(); dr[5] = FileUpload1.FileName; } else { dr[5] = FileUpload1.FileName; } } if (dob.Text.Trim().Length != 0) { dr[6] = dob.Text; } else { Response.Write("<script>alert('Please Enter DOB !')</script>"); } if (phone.Text.Trim().Length != 0) { dr[7] = stuphone.Text; } else { Response.Write("<script>alert('Please Enter Student Phone !')</script>"); } if (nrcno.Text.Trim().Length != 0) { dr[8] = nrcno.Text; } else { Response.Write("<script>alert('Please Enter Student NRC No. !')</script>"); } if (password.Text.Trim().Length != 0) { dr[9] = password.Text; } else { Response.Write("<script>alert('Please Enter Password !')</script>"); } if (grade.Text.Trim().Length != 0) { dr[10] = grade.Text; } else { Response.Write("<script>alert('Please Enter Grade !')</script>"); } if (roomid.Text.Trim().Length != 0) { dr[11] = roomid.Text; } else { Response.Write("<script>alert('Please Enter Room !')</script>"); } if (cashtype.Text.Length == 0) { Response.Write("<script>alert('Please Select Cash Type !')</script>"); } else { dr[12] = cashtype.Text; if (cashtype.Text == "Monthly") { if (firstmonth.Checked == true) { dr[13] = "1"; } if (thirdmonth.Checked == true) { dr[13] = "3"; } if (fourmonth.Checked == true) { dr[13] = "4"; } } else { dr[13] = ""; } } if (father.Text.Trim().Length != 0) { dr[14] = father.Text; } else { Response.Write("<script>alert('Please Enter Father Name !')</script>"); } if (mother.Text.Trim().Length != 0) { dr[15] = mother.Text; } else { Response.Write("<script>alert('Please Enter Mother Name !')</script>"); } if (address.Text.Trim().Length != 0) { dr[16] = address.Text; } else { Response.Write("<script>alert('Please Enter Address !')</script>"); } if (phone.Text.Trim().Length != 0) { dr[17] = phone.Text; } else { Response.Write("<script>alert('Please Enter Phone !')</script>"); } if (email.Text.Trim().Length == 0) { dr[18] = ""; dr[19] = ""; dr[20] = ""; dr[21] = ""; bool result = stuentry.updatedata(this.dr, out msg); } else { dr[18] = email.Text; dr[19] = ""; dr[20] = ""; dr[21] = ""; bool result = stuentry.updatedata(this.dr, out msg); } } }