protected void RadGrid1_NeedDataSource(object sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e) { AbcDAL MyDAL = new AbcDAL(""); DataTable ResultTable = MyDAL.PopulateStudent(); RadGrid1.DataSource = ResultTable; }
protected void RBSubmit_Click(object sender, EventArgs e) { int count = 0; int countStopper = 0; string StudentID = ""; string SubjectID = ""; string SubjectName = ""; AbcDAL MyDAL = new AbcDAL(""); DataTable ResultTable = MyDAL.PopulateClass(); DataTable ResultTableSubject = MyDAL.SelectSubjectMasterByID(RCBSubject.SelectedValue.ToString().Trim()); foreach (DataRow row in ResultTable.Rows) { SubjectName = ResultTableSubject.Rows[0]["SubjectName"].ToString().Trim(); SubjectID = ResultTable.Rows[count]["SubjectID"].ToString().Trim(); StudentID = ResultTable.Rows[count]["StudentID"].ToString().Trim(); if (StudentID == RCBStudent.SelectedValue.ToString().Trim() && SubjectID == RCBSubject.SelectedValue.ToString().Trim()) { countStopper++; } count++; } if (countStopper >= 1) { Response.Redirect("EnrollSubject.aspx?MsgPos=5&MsgType=warning&MsgContent=Student already exists in " + SubjectName.Trim()); } else { MyDAL.AddClassMaster("Classs A", RCBSubject.SelectedValue, RCBStudent.SelectedValue); Response.Redirect("EnrollSubject.aspx?MsgPos=5&MsgType=warning&MsgContent=Success in Enrollment"); } }
public void PopulateSubjectGrid() { AbcDAL MyDAL = new AbcDAL(""); RGSubjectGrid.DataSource = MyDAL.PopulateSubject(); RGSubjectGrid.DataBind(); }
protected void RBEnrollStudent_Click(object sender, EventArgs e) { AbcDAL MyDAL = new AbcDAL(""); MyDAL.AddStudentMaster(RTBStudentName.Text, RTBPhoneNo.Text, RTBAddress.Text, RDPDob.SelectedDate.Value, "Tommy"); Response.Redirect("saDefault.aspx"); }
protected void RBUpdate_Click(object sender, EventArgs e) { AbcDAL MyDAL = new AbcDAL(""); MyDAL.UpdateSubjectMaster(RCBSubjectName.SelectedValue, RTBUpdateName.Text); MyDAL.BindSubjectComboBox(RCBSubjectName); PopulateSubjectGrid(); }
public void StudentSearchBox() { AbcDAL MyDAL = new AbcDAL(""); DataTable ResultTable = MyDAL.PopulateStudent(); MyDAL.BindStudentCombobox(RCBStudentName); }
public void DisplayData() { AbcDAL MyDAL = new AbcDAL(""); DataTable ResultTable = MyDAL.PopulateStudent(); RadGrid1.DataSource = ResultTable; RadGrid1.DataBind(); }
protected void RBCreateSubject_Click(object sender, EventArgs e) { AbcDAL MyDAL = new AbcDAL(""); MyDAL.AddSubjectMaster(RTBSubjectName.Text.Trim()); PopulateSubjectGrid(); MyDAL.BindSubjectComboBox(RCBSubjectName); }
protected void Page_Load(object sender, EventArgs e) { //PopulateStudentName(); if (!IsPostBack) { AbcDAL MyDAL = new AbcDAL(""); MyDAL.BindSubjectComboBox(RCBSubject); } }
protected void Page_Load(object sender, EventArgs e) { AbcDAL MyDAL = new AbcDAL(""); if (!IsPostBack) { PopulateStudentName(); } }
public void Piechart() { int A = 0; int B = 0; int C = 0; int D = 0; int E = 0; int count = 0; AbcDAL MyDAL = new AbcDAL(""); DataTable ResultTable = MyDAL.SelectStudentByAuthID(1); string StudentID = ResultTable.Rows[0]["StudentID"].ToString().Trim(); DataTable ResultTableClass = MyDAL.PopulateClassByStudentID(StudentID); RadChart radChart = new RadChart(); radChart.ChartTitle.TextBlock.Text = "My RadChart"; ChartSeries chartSeries = new ChartSeries(); chartSeries.Name = "Overall Grade"; chartSeries.Type = ChartSeriesType.Bar; // add new items to the series, // passing a value and a label string foreach (DataRow row in ResultTableClass.Rows) { if (ResultTableClass.Rows[count]["Grade"].ToString().Trim() == "A") { A++; } else if (ResultTableClass.Rows[count]["Grade"].ToString().Trim() == "B") { B++; } else if (ResultTableClass.Rows[count]["Grade"].ToString().Trim() == "C") { C++; } else if (ResultTableClass.Rows[count]["Grade"].ToString().Trim() == "D") { D++; } else if (ResultTableClass.Rows[count]["Grade"].ToString().Trim() == "E") { E++; } count++; } chartSeries.AddItem(A, "A"); chartSeries.AddItem(B, "B"); chartSeries.AddItem(C, "C"); chartSeries.AddItem(D, "D"); chartSeries.AddItem(E, "E"); RCStudent.AddChartSeries(chartSeries); }
public void PopulateStudentName() { int Present = 0; int Absent = 0; int count = 0; AbcDAL MyDAL = new AbcDAL(""); DataTable ResultTable = MyDAL.SelectStudentByAuthID(1); if (ResultTable.Rows.Count != 0) { Piechart(); string StudentID = ResultTable.Rows[0]["StudentID"].ToString().Trim(); RLName.Text = ResultTable.Rows[0]["StudentName"].ToString(); RLPhoneNo.Text = ResultTable.Rows[0]["PhoneNo"].ToString(); RLAddress.Text = ResultTable.Rows[0]["Address"].ToString(); DataTable ResultTableClass = MyDAL.PopulateClassByStudentID(StudentID); //string Attendance = ResultTableClass.Rows[0]["Attendance"].ToString().Trim(); foreach (DataRow row in ResultTableClass.Rows) { if (ResultTableClass.Rows[count]["Attendance"].ToString().Trim() == "Present") { Present++; } else { Absent++; } count++; } if (Present == Absent) { RLAttendance.Text = "Fair"; } else if (Present > Absent) { RLAttendance.Text = "Good"; } else { RLAttendance.Text = "Poor"; } } else { RLName.Text = "Super Admin"; RLAttendance.Text = "Super Admin has Logged in"; } }
protected void RadGrid1_UpdateCommand(object sender, GridCommandEventArgs e) { GridEditableItem editedItem = e.Item as GridEditableItem; string StudentID = editedItem.GetDataKeyValue("StudentID").ToString().Trim(); // Works if you set the DataKeyValue as CustomerID string name = (editedItem["StudentName"].Controls[0] as TextBox).Text; string address = (editedItem["Address"].Controls[0] as TextBox).Text; string DOB = (editedItem["DOB"].Controls[0] as TextBox).Text; string phoneNo = (editedItem["PhoneNo"].Controls[0] as TextBox).Text; AbcDAL MyDAL = new AbcDAL(""); MyDAL.UpdStudentMaster(StudentID, name, phoneNo, address, Convert.ToDateTime(DOB)); }
protected void RBModify_Click(object sender, EventArgs e) { AbcDAL MyDAL = new AbcDAL(""); if (ClassID != null) { MyDAL.UpdateClassGradeByStudentID(RCBStudentName.SelectedValue.ToString().Trim(), RDDLAttendance.SelectedText, RDDLGrade.SelectedText, ClassID); Response.Redirect("Progress.aspx?MsgPos=5&MsgType=warning&MsgContent=Data successfully modified"); } else { Response.Redirect("Progress.aspx?MsgPos=5&MsgType=warning&MsgContent=ERROR LAH WALAO"); } }
protected void RGSubjectGrid_DeleteCommand(object sender, GridCommandEventArgs e) { AbcDAL MyDAL = new AbcDAL(""); Telerik.Web.UI.GridDataItem MyGridDataItem = e.Item as Telerik.Web.UI.GridDataItem; if (MyGridDataItem != null) { string SubjectID = (string)((GridDataItem)e.Item).GetDataKeyValue("SubjectID"); MyDAL.DeleteSubjectMaster(SubjectID); } MyDAL.BindSubjectComboBox(RCBSubjectName); }
public void DropdownlistGrade() { AbcDAL MyDAL = new AbcDAL(""); DataTable ResultTable = new DataTable(); ResultTable = MyDAL.PopulateClassByStudentID(RCBStudentName.SelectedValue.ToString().Trim()); string grade; int count = 0; foreach (DataRow row in ResultTable.Rows) { grade = ResultTable.Rows[count]["Grade"].ToString().Trim(); if (RCBSubject.SelectedValue.ToString().Trim() == ResultTable.Rows[count]["SubjectID"].ToString().Trim()) { if (grade == "A") { RDDLGrade.SelectedIndex = 1; break; } else if (grade == "B") { RDDLGrade.SelectedIndex = 2; break; } else if (grade == "C") { RDDLGrade.SelectedIndex = 3; break; } else if (grade == "D") { RDDLGrade.SelectedIndex = 4; break; } else if (grade == "E") { RDDLGrade.SelectedIndex = 5; break; } else if (grade == "F") { RDDLGrade.SelectedIndex = 6; break; } } count++; } }
protected void RCBStudentName_SelectedIndexChanged(object sender, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs e) { string Attendance = ""; RLStudentName.Text = RCBStudentName.Text; AbcDAL MyDAL = new AbcDAL(""); DataTable ResultTable = new DataTable(); ResultTable = MyDAL.PopulateClassByStudentID(RCBStudentName.SelectedValue.ToString().Trim()); int count = 0; int countStop = 0; foreach (DataRow row in ResultTable.Rows) { Attendance = ResultTable.Rows[count]["Attendance"].ToString().Trim(); if (RCBSubject.SelectedValue.ToString().Trim() == ResultTable.Rows[count]["SubjectID"].ToString().Trim()) { DropdownlistGrade(); ClassID = ResultTable.Rows[count]["ClassID"].ToString(); if (Attendance == "Present") { countStop++; RDDLAttendance.SelectedIndex = 0; break; } else if (Attendance == "Absent") { countStop++; RDDLAttendance.SelectedIndex = 1; break; } else { countStop++; RDDLAttendance.SelectedIndex = 2; break; } } count++; } if (countStop == 0) { RDDLAttendance.SelectedIndex = 2; } }
protected void Page_Load(object sender, EventArgs e) { int AuthorityID = 0; if (!IsPostBack) { AbcDAL MyDAL = new AbcDAL(""); DataTable ResultTable = MyDAL.PopulateStudent(); AuthorityID = Convert.ToInt32(ResultTable.Rows[0]["AuthorityID"]); //Getting my field value if (AuthorityID != 1002) { Response.Redirect("~/default.aspx?MsgPos=5&MsgType=warning&MsgContent=You are not authorised to this function, No students allowed !!!!"); } } }
public void PopulateStudentName() { AbcDAL MyDAL = new AbcDAL(""); DataTable ResultTable = MyDAL.SelectStudentByAuthID(1); string StudentID = ResultTable.Rows[0]["StudentID"].ToString().Trim(); RLStudentName.Text = ResultTable.Rows[0]["StudentName"].ToString(); DataTable ResultTableClass = MyDAL.PopulateClassByStudentIDSubjectID(StudentID, RCBSubject.SelectedValue.ToString().Trim()); if (ResultTableClass.Rows.Count != 0) { RLGrade.Text = ResultTableClass.Rows[0]["Grade"].ToString(); RLAttendance.Text = ResultTableClass.Rows[0]["Attendance"].ToString().Trim(); } else { RLGrade.Text = "No record yet"; RLAttendance.Text = "No record yet"; } }
protected void RBLogin_Click(object sender, EventArgs e) { string Login = "******"; AbcDAL MyDal = new AbcDAL(""); string Username = ""; if (RTBUsername.Text == "user" && RTBPassword.Text == "123") { MyDal.UpdateStudentAuth("STU1000001", 1002); Response.Redirect("~/default.aspx"); } else { DataTable ResultTable = MyDal.SelectStudentByUserPass(RTBUsername.Text, RTBPassword.Text); for (int i = 0; i < ResultTable.Rows.Count; i++) //Looping through rows { Username = ResultTable.Rows[i]["Username"].ToString().Trim(); //Getting my field value var Password = ResultTable.Rows[i]["Password"]; //Getting my field value Login = "******"; } if (Login == "123") { MyDal.UpdateStudentAuth(Username, 1); Response.Redirect("~/default.aspx"); } else { Response.Redirect("login.aspx?MsgPos=5&MsgType=warning&MsgContent=You are not authorised to this function, User Wrong Login !!!!"); } } }
public void SubjectCombobox() { AbcDAL MyDAL = new AbcDAL(""); MyDAL.BindSubjectComboBox(RCBSubject); }
protected void RCBSubject_SelectedIndexChanged(object sender, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs e) { //after selection student combobox will populate student that havent registered in this subject AbcDAL MyDAL = new AbcDAL(""); //MyDAL.BindSubjectComboBox(RCBStudent); }
protected void RGClassMaster_NeedDataSource(object sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e) { AbcDAL MyDAL = new AbcDAL(""); RGClassMaster.DataSource = MyDAL.PopulateClass(); }
protected void RGSubjectGrid_NeedDataSource(object sender, GridNeedDataSourceEventArgs e) { AbcDAL MyDAL = new AbcDAL(""); RGSubjectGrid.DataSource = MyDAL.PopulateSubject(); }