void GetAttendanceLogs() { dgAttendanceLogs.Rows.Clear(); int i = 1; using (SMSNotification notify = new SMSNotification()) { var value = notify.GetUserTime(); if (value.Count > 0) { value.ForEach(x => { using (Students stud = new Students()) { var valueStud = stud.GetStudentInfo().Where(xx => xx.StudentID == x.StudentID).FirstOrDefault(); dgAttendanceLogs.Rows.Add(x.ID, i, x.StudentID, valueStud != null?valueStud.LastName + ", " + valueStud.FirstName:"Student name are not found", x.SubjectCode, x.RoomCode, x.Day, x.TimeIN, x.TimeOUT); i++; } }); } } }
void LoadSelected(bool Date, bool Time, bool Day, bool SubCode, bool RoomCode) { int i = 1; dgAttendanceLogs.Rows.Clear(); using (SMSNotification notify = new SMSNotification()) { #region 1 //Start 1 if (Date && Time && Day && SubCode && RoomCode) { dgAttendanceLogs.Rows.Clear(); var value = notify.GetUserTime().Where(x => (ConvertDates(x.TimeIN.Value) >= ConvertDates(dtDateStart.Value) && (ConvertDates(x.TimeIN.Value)) <= ConvertDates(dtDateEnd.Value)) && (ConvertTimes(x.TimeIN.Value) >= ConvertTimes(dtTimeIN.Value) && ConvertTimes(x.TimeIN.Value) <= ConvertTimes(dtTimeOUT.Value)) && x.Day == cmbDays.Text && x.SubjectCode == cmbSubCode.Text && x.RoomCode == cmbRoomCode.Text).ToList(); if (value.Count > 0) { value.ForEach(x => { using (Students stud = new Students()) { var valueStud = stud.GetStudentInfo().Where(xx => xx.StudentID == x.StudentID).FirstOrDefault(); dgAttendanceLogs.Rows.Add(x.ID, i, x.StudentID, valueStud != null ? valueStud.LastName + ", " + valueStud.FirstName : "Student name are not found", x.SubjectCode, x.RoomCode, x.Day, x.TimeIN, x.TimeOUT); i++; } }); } } //End #endregion #region 2 //Start 1 if (Time && Day && SubCode && RoomCode) { dgAttendanceLogs.Rows.Clear(); var value = notify.GetUserTime().Where(x => (ConvertTimes(x.TimeIN.Value) >= ConvertTimes(dtTimeIN.Value) && ConvertTimes(x.TimeIN.Value) <= ConvertTimes(dtTimeOUT.Value)) && x.Day == cmbDays.Text && x.SubjectCode == cmbSubCode.Text && x.RoomCode == cmbRoomCode.Text).ToList(); if (value.Count > 0) { value.ForEach(x => { using (Students stud = new Students()) { var valueStud = stud.GetStudentInfo().Where(xx => xx.StudentID == x.StudentID).FirstOrDefault(); dgAttendanceLogs.Rows.Add(x.ID, i, x.StudentID, valueStud != null ? valueStud.LastName + ", " + valueStud.FirstName : "Student name are not found", x.SubjectCode, x.RoomCode, x.Day, x.TimeIN, x.TimeOUT); i++; } }); } } //End #endregion #region 3 //Start 1 if (Date && Day && SubCode && RoomCode) { dgAttendanceLogs.Rows.Clear(); var value = notify.GetUserTime().Where(x => (ConvertDates(x.TimeIN.Value) >= ConvertDates(dtDateStart.Value) && (ConvertDates(x.TimeIN.Value)) <= ConvertDates(dtDateEnd.Value)) && x.Day == cmbDays.Text && x.SubjectCode == cmbSubCode.Text && x.RoomCode == cmbRoomCode.Text).ToList(); if (value.Count > 0) { value.ForEach(x => { using (Students stud = new Students()) { var valueStud = stud.GetStudentInfo().Where(xx => xx.StudentID == x.StudentID).FirstOrDefault(); dgAttendanceLogs.Rows.Add(x.ID, i, x.StudentID, valueStud != null ? valueStud.LastName + ", " + valueStud.FirstName : "Student name are not found", x.SubjectCode, x.RoomCode, x.Day, x.TimeIN, x.TimeOUT); i++; } }); } } //End #endregion #region 4 //Start 1 if (Date && Time && SubCode && RoomCode) { dgAttendanceLogs.Rows.Clear(); var value = notify.GetUserTime().Where(x => (ConvertDates(x.TimeIN.Value) >= ConvertDates(dtDateStart.Value) && (ConvertDates(x.TimeIN.Value)) <= ConvertDates(dtDateEnd.Value)) && (ConvertTimes(x.TimeIN.Value) >= ConvertTimes(dtTimeIN.Value) && ConvertTimes(x.TimeIN.Value) <= ConvertTimes(dtTimeOUT.Value)) && x.SubjectCode == cmbSubCode.Text && x.RoomCode == cmbRoomCode.Text).ToList(); if (value.Count > 0) { value.ForEach(x => { using (Students stud = new Students()) { var valueStud = stud.GetStudentInfo().Where(xx => xx.StudentID == x.StudentID).FirstOrDefault(); dgAttendanceLogs.Rows.Add(x.ID, i, x.StudentID, valueStud != null ? valueStud.LastName + ", " + valueStud.FirstName : "Student name are not found", x.SubjectCode, x.RoomCode, x.Day, x.TimeIN, x.TimeOUT); i++; } }); } } //End #endregion #region 5 //Start 1 if (Date && Time && Day && SubCode && RoomCode) { dgAttendanceLogs.Rows.Clear(); var value = notify.GetUserTime().Where(x => (ConvertDates(x.TimeIN.Value) >= ConvertDates(dtDateStart.Value) && (ConvertDates(x.TimeIN.Value)) <= ConvertDates(dtDateEnd.Value)) && (ConvertTimes(x.TimeIN.Value) >= ConvertTimes(dtTimeIN.Value) && ConvertTimes(x.TimeIN.Value) <= ConvertTimes(dtTimeOUT.Value)) && x.Day == cmbDays.Text && x.SubjectCode == cmbSubCode.Text && x.RoomCode == cmbRoomCode.Text).ToList(); if (value.Count > 0) { value.ForEach(x => { using (Students stud = new Students()) { var valueStud = stud.GetStudentInfo().Where(xx => xx.StudentID == x.StudentID).FirstOrDefault(); dgAttendanceLogs.Rows.Add(x.ID, i, x.StudentID, valueStud != null ? valueStud.LastName + ", " + valueStud.FirstName : "Student name are not found", x.SubjectCode, x.RoomCode, x.Day, x.TimeIN, x.TimeOUT); i++; } }); } } //End #endregion #region 6 //Start 1 if (Date && Time && Day) { dgAttendanceLogs.Rows.Clear(); var value = notify.GetUserTime().Where(x => (ConvertDates(x.TimeIN.Value) >= ConvertDates(dtDateStart.Value) && (ConvertDates(x.TimeIN.Value)) <= ConvertDates(dtDateEnd.Value)) && (ConvertTimes(x.TimeIN.Value) >= ConvertTimes(dtTimeIN.Value) && ConvertTimes(x.TimeIN.Value) <= ConvertTimes(dtTimeOUT.Value))).ToList(); if (value.Count > 0) { value.ForEach(x => { using (Students stud = new Students()) { var valueStud = stud.GetStudentInfo().Where(xx => xx.StudentID == x.StudentID).FirstOrDefault(); dgAttendanceLogs.Rows.Add(x.ID, i, x.StudentID, valueStud != null ? valueStud.LastName + ", " + valueStud.FirstName : "Student name are not found", x.SubjectCode, x.RoomCode, x.Day, x.TimeIN, x.TimeOUT); i++; } }); } } //End #endregion #region 7 //Start 1 if (Time && Day && SubCode) { dgAttendanceLogs.Rows.Clear(); var value = notify.GetUserTime().Where(x => (ConvertTimes(x.TimeIN.Value) >= ConvertTimes(dtTimeIN.Value) && ConvertTimes(x.TimeIN.Value) <= ConvertTimes(dtTimeOUT.Value)) && x.Day == cmbDays.Text && x.SubjectCode == cmbSubCode.Text).ToList(); if (value.Count > 0) { value.ForEach(x => { using (Students stud = new Students()) { var valueStud = stud.GetStudentInfo().Where(xx => xx.StudentID == x.StudentID).FirstOrDefault(); dgAttendanceLogs.Rows.Add(x.ID, i, x.StudentID, valueStud != null ? valueStud.LastName + ", " + valueStud.FirstName : "Student name are not found", x.SubjectCode, x.RoomCode, x.Day, x.TimeIN, x.TimeOUT); i++; } }); } } //End #endregion #region 8 //Start 1 if (Day && SubCode && RoomCode) { dgAttendanceLogs.Rows.Clear(); var value = notify.GetUserTime().Where(x => x.Day == cmbDays.Text && x.SubjectCode == cmbSubCode.Text && x.RoomCode == cmbRoomCode.Text).ToList(); if (value.Count > 0) { value.ForEach(x => { using (Students stud = new Students()) { var valueStud = stud.GetStudentInfo().Where(xx => xx.StudentID == x.StudentID).FirstOrDefault(); dgAttendanceLogs.Rows.Add(x.ID, i, x.StudentID, valueStud != null ? valueStud.LastName + ", " + valueStud.FirstName : "Student name are not found", x.SubjectCode, x.RoomCode, x.Day, x.TimeIN, x.TimeOUT); i++; } }); } } //End #endregion #region 9 //Start 1 if (Date && SubCode && RoomCode) { dgAttendanceLogs.Rows.Clear(); var value = notify.GetUserTime().Where(x => (ConvertDates(x.TimeIN.Value) >= ConvertDates(dtDateStart.Value) && (ConvertDates(x.TimeIN.Value)) <= ConvertDates(dtDateEnd.Value)) && x.SubjectCode == cmbSubCode.Text && x.RoomCode == cmbRoomCode.Text).ToList(); if (value.Count > 0) { value.ForEach(x => { using (Students stud = new Students()) { var valueStud = stud.GetStudentInfo().Where(xx => xx.StudentID == x.StudentID).FirstOrDefault(); dgAttendanceLogs.Rows.Add(x.ID, i, x.StudentID, valueStud != null ? valueStud.LastName + ", " + valueStud.FirstName : "Student name are not found", x.SubjectCode, x.RoomCode, x.Day, x.TimeIN, x.TimeOUT); i++; } }); } } //End #endregion #region 10 //Start 1 if (Date && Time && RoomCode) { dgAttendanceLogs.Rows.Clear(); var value = notify.GetUserTime().Where(x => (ConvertDates(x.TimeIN.Value) >= ConvertDates(dtDateStart.Value) && (ConvertDates(x.TimeIN.Value)) <= ConvertDates(dtDateEnd.Value)) && (ConvertTimes(x.TimeIN.Value) >= ConvertTimes(dtTimeIN.Value) && ConvertTimes(x.TimeIN.Value) <= ConvertTimes(dtTimeOUT.Value)) && x.RoomCode == cmbRoomCode.Text).ToList(); if (value.Count > 0) { value.ForEach(x => { using (Students stud = new Students()) { var valueStud = stud.GetStudentInfo().Where(xx => xx.StudentID == x.StudentID).FirstOrDefault(); dgAttendanceLogs.Rows.Add(x.ID, i, x.StudentID, valueStud != null ? valueStud.LastName + ", " + valueStud.FirstName : "Student name are not found", x.SubjectCode, x.RoomCode, x.Day, x.TimeIN, x.TimeOUT); i++; } }); } } //End #endregion #region 11 //Start 1 if (Date && Time) { dgAttendanceLogs.Rows.Clear(); var value = notify.GetUserTime().Where(x => (ConvertDates(x.TimeIN.Value) >= ConvertDates(dtDateStart.Value) && (ConvertDates(x.TimeIN.Value)) <= ConvertDates(dtDateEnd.Value)) && (ConvertTimes(x.TimeIN.Value) >= ConvertTimes(dtTimeIN.Value) && ConvertTimes(x.TimeIN.Value) <= ConvertTimes(dtTimeOUT.Value))).ToList(); if (value.Count > 0) { value.ForEach(x => { using (Students stud = new Students()) { var valueStud = stud.GetStudentInfo().Where(xx => xx.StudentID == x.StudentID).FirstOrDefault(); dgAttendanceLogs.Rows.Add(x.ID, i, x.StudentID, valueStud != null ? valueStud.LastName + ", " + valueStud.FirstName : "Student name are not found", x.SubjectCode, x.RoomCode, x.Day, x.TimeIN, x.TimeOUT); i++; } }); } } //End #endregion #region 12 //Start 1 if (Time && Day) { dgAttendanceLogs.Rows.Clear(); var value = notify.GetUserTime().Where(x => (ConvertTimes(x.TimeIN.Value) >= ConvertTimes(dtTimeIN.Value) && ConvertTimes(x.TimeIN.Value) <= ConvertTimes(dtTimeOUT.Value)) && x.Day == cmbDays.Text).ToList(); if (value.Count > 0) { value.ForEach(x => { using (Students stud = new Students()) { var valueStud = stud.GetStudentInfo().Where(xx => xx.StudentID == x.StudentID).FirstOrDefault(); dgAttendanceLogs.Rows.Add(x.ID, i, x.StudentID, valueStud != null ? valueStud.LastName + ", " + valueStud.FirstName : "Student name are not found", x.SubjectCode, x.RoomCode, x.Day, x.TimeIN, x.TimeOUT); i++; } }); } } //End #endregion #region 13 //Start 1 if (SubCode && RoomCode) { dgAttendanceLogs.Rows.Clear(); var value = notify.GetUserTime().Where(x => x.SubjectCode == cmbSubCode.Text && x.RoomCode == cmbRoomCode.Text).ToList(); if (value.Count > 0) { value.ForEach(x => { using (Students stud = new Students()) { var valueStud = stud.GetStudentInfo().Where(xx => xx.StudentID == x.StudentID).FirstOrDefault(); dgAttendanceLogs.Rows.Add(x.ID, i, x.StudentID, valueStud != null ? valueStud.LastName + ", " + valueStud.FirstName : "Student name are not found", x.SubjectCode, x.RoomCode, x.Day, x.TimeIN, x.TimeOUT); i++; } }); } } //End #endregion #region 14 //Start 1 if (Date && RoomCode) { dgAttendanceLogs.Rows.Clear(); var value = notify.GetUserTime().Where(x => (ConvertDates(x.TimeIN.Value) >= ConvertDates(dtDateStart.Value) && (ConvertDates(x.TimeIN.Value)) <= ConvertDates(dtDateEnd.Value)) && x.RoomCode == cmbRoomCode.Text).ToList(); if (value.Count > 0) { value.ForEach(x => { using (Students stud = new Students()) { var valueStud = stud.GetStudentInfo().Where(xx => xx.StudentID == x.StudentID).FirstOrDefault(); dgAttendanceLogs.Rows.Add(x.ID, i, x.StudentID, valueStud != null ? valueStud.LastName + ", " + valueStud.FirstName : "Student name are not found", x.SubjectCode, x.RoomCode, x.Day, x.TimeIN, x.TimeOUT); i++; } }); } } //End #endregion #region 15 //Start 1 if (Date) { dgAttendanceLogs.Rows.Clear(); var value = notify.GetUserTime().Where(x => (ConvertDates(x.TimeIN.Value) >= ConvertDates(dtDateStart.Value) && (ConvertDates(x.TimeIN.Value)) <= ConvertDates(dtDateEnd.Value))).ToList(); if (value.Count > 0) { value.ForEach(x => { using (Students stud = new Students()) { var valueStud = stud.GetStudentInfo().Where(xx => xx.StudentID == x.StudentID).FirstOrDefault(); dgAttendanceLogs.Rows.Add(x.ID, i, x.StudentID, valueStud != null ? valueStud.LastName + ", " + valueStud.FirstName : "Student name are not found", x.SubjectCode, x.RoomCode, x.Day, x.TimeIN, x.TimeOUT); i++; } }); } } //End #endregion #region 16 //Start 1 if (Time) { dgAttendanceLogs.Rows.Clear(); var value = notify.GetUserTime().Where(x => (ConvertTimes(x.TimeIN.Value) >= ConvertTimes(dtTimeIN.Value) && ConvertTimes(x.TimeIN.Value) <= ConvertTimes(dtTimeOUT.Value))).ToList(); if (value.Count > 0) { value.ForEach(x => { using (Students stud = new Students()) { var valueStud = stud.GetStudentInfo().Where(xx => xx.StudentID == x.StudentID).FirstOrDefault(); dgAttendanceLogs.Rows.Add(x.ID, i, x.StudentID, valueStud != null ? valueStud.LastName + ", " + valueStud.FirstName : "Student name are not found", x.SubjectCode, x.RoomCode, x.Day, x.TimeIN, x.TimeOUT); i++; } }); } } //End #endregion #region 17 //Start 1 if (Day) { dgAttendanceLogs.Rows.Clear(); var value = notify.GetUserTime().Where(x => x.Day == cmbDays.Text).ToList(); if (value.Count > 0) { value.ForEach(x => { using (Students stud = new Students()) { var valueStud = stud.GetStudentInfo().Where(xx => xx.StudentID == x.StudentID).FirstOrDefault(); dgAttendanceLogs.Rows.Add(x.ID, i, x.StudentID, valueStud != null ? valueStud.LastName + ", " + valueStud.FirstName : "Student name are not found", x.SubjectCode, x.RoomCode, x.Day, x.TimeIN, x.TimeOUT); i++; } }); } } //End #endregion #region 18 //Start 1 if (SubCode) { dgAttendanceLogs.Rows.Clear(); var value = notify.GetUserTime().Where(x => x.SubjectCode == cmbSubCode.Text).ToList(); if (value.Count > 0) { value.ForEach(x => { using (Students stud = new Students()) { var valueStud = stud.GetStudentInfo().Where(xx => xx.StudentID == x.StudentID).FirstOrDefault(); dgAttendanceLogs.Rows.Add(x.ID, i, x.StudentID, valueStud != null ? valueStud.LastName + ", " + valueStud.FirstName : "Student name are not found", x.SubjectCode, x.RoomCode, x.Day, x.TimeIN, x.TimeOUT); i++; } }); } } //End #endregion #region 19 //Start 1 if (RoomCode) { dgAttendanceLogs.Rows.Clear(); var value = notify.GetUserTime().Where(x => x.RoomCode == cmbRoomCode.Text).ToList(); if (value.Count > 0) { value.ForEach(x => { using (Students stud = new Students()) { var valueStud = stud.GetStudentInfo().Where(xx => xx.StudentID == x.StudentID).FirstOrDefault(); dgAttendanceLogs.Rows.Add(x.ID, i, x.StudentID, valueStud != null ? valueStud.LastName + ", " + valueStud.FirstName : "Student name are not found", x.SubjectCode, x.RoomCode, x.Day, x.TimeIN, x.TimeOUT); i++; } }); } } //End #endregion } }