protected void cmbProgram_ValueChanged(object sender, EventArgs e) { btnRefreshReg.Visible = true; reloadLessonSchudel(); getStudRegistration(); UpdateRegistration.Update(); }
protected void cmbSearchStud_ItemRequestedByValue(object source, ListEditItemRequestedByValueEventArgs e) { if (e.Value != null && e.Value.ToString().Trim() != "") { Student selected = new Student(); ASPxComboBox comboBox = (ASPxComboBox)source; comboBox.DataSource = new StudentService().GetStudentResult(e.Value.ToString().Trim(), user_id); comboBox.DataBind(); } UpdateRegistration.Update(); }
protected void gvRegisterStud_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e) { e.Cancel = true; ASPxGridView g = (ASPxGridView)sender; Registration i = new Registration(); i.ModuleID = int.Parse(cmbProgram.Value.ToString()); i.ClassID = int.Parse(gvRegisterStud.GetRowValuesByKeyValue(e.Keys["ID"], "ID").ToString()); //i.ID = int.Parse(e.Keys["ID"].ToString()); i.ClassScheduleID = int.Parse(Session["classid"].ToString()); i.StudID = int.Parse(cmbSearchStud.Value.ToString()); GridViewDataColumn c = gvClassLessons.DataColumns["ClassShud"] as GridViewDataColumn; i.DateModified = DateTime.Now; i.DateReg = DateTime.Now; if (Session["classid"].ToString() == "0") { ScriptManager.RegisterStartupScript(this, GetType(), ",toastr", "toastr.info('You must select a Class Schedule or Create one to use','Message')", true); } else { if (new RegistrationService().AddRegistration(i, new SessionManager().GetUserId(this.Session))) { List <Lesson> allLessons = new LessonService().GetAllLessonsByClassID(int.Parse(gvRegisterStud.GetRowValuesByKeyValue(e.Keys["ID"], "ID").ToString()), new SessionManager().GetUserId(Session)); foreach (Lesson allLesson in allLessons) { Attendance l = new Attendance(); l.ClassID = allLesson.ClassID; l.ModuleID = allLesson.ModuleID; l.LessonID = allLesson.ID; l.ClassSchedID = int.Parse(Session["classid"].ToString()); l.DateCreted = DateTime.Now; l.IndexNo = int.Parse(cmbSearchStud.Value.ToString()); l.Attended = "No"; l.Completed = "Not Completed"; new AttendanceServices().AddAttendance(l, new SessionManager().GetUserId(Session)); } } } gvRegisterStud.CancelEdit(); reloadLessonSchudel(); UpdateRegistration.Update(); }
protected void gvRegisterStud_CellEditorInitialize(object sender, ASPxGridViewEditorEventArgs e) { if (cmbProgram.SelectedIndex >= 0) { if (e.Column.Name == "ClassShud") { ASPxComboBox c = e.Editor as ASPxComboBox; //gvClassLessons.FindEditRowCellTemplateControl(gvClassLessons.Columns["TutorName"] as GridViewDataComboBoxColumn, "lbTutorList2") c.TextField = "Title"; c.ValueField = "ID"; //*******var lessonID = gvClassLessons.GetRowValuesByKeyValue(e.KeyValue,"LessonID"); c.DataSource = new ClassSchedulerServices().GetAllClassSchedulerByClassIDAvailable(int.Parse(gvRegisterStud.GetRowValuesByKeyValue(e.KeyValue, "ID").ToString()), new SessionManager().GetUserId(Session)); c.DataBind(); } } UpdateRegistration.Update(); }
private void reloadLessonSchudel() { //List<int> studClassID = new List<int>(); //List<Registration> studRegs = new RegistrationService().GetAllRegistrationByStudIDByModID(int.Parse(cmbSearchStud.Value.ToString()), int.Parse(cmbProgram.Value.ToString()), new SessionManager().GetUserId(Session)); //foreach (Registration studReg in studRegs) //{ // studClassID.Add(studReg.ClassID); //} //string studRegsList = string.Join(",",studClassID); int programID = int.Parse(cmbProgram.Value.ToString()); gvRegisterStud.DataSource = new ClassABCServices().GetAllClassNotStudReg(int.Parse(cmbSearchStud.Value.ToString()), programID, new SessionManager().GetUserId(Session)); gvRegisterStud.DataBind(); UpdateRegistration.Update(); }
protected void btnRefreshReg_Click(object sender, EventArgs e) { reloadLessonSchudel(); getStudRegistration(); UpdateRegistration.Update(); }