Ejemplo n.º 1
0
        void dgRoom_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            SystemProperties.Cleared(this, false, true, true);

            if (dgRoom.Rows.Count > 0)
            {
                using (Maintenance _maintain = new Maintenance())
                {
                    var value = _maintain.GetRoom().Where(x => x.ID == Convert.ToInt64(dgRoom.SelectedRows[0].Cells[0].Value)).FirstOrDefault();
                    if (value != null)
                    {
                        cmbRoomType.Text        = value.RoomType;
                        txtRoomCode.Text        = value.RoomCode;
                        txtDescription.Text     = value.Description;
                        cmbBuildingCode.Text    = value.BuildingCode;
                        txtLocationAddress.Text = _maintain.GetBuildingCode().Where(x => x.BuildingCode == value.BuildingCode).FirstOrDefault().BuildingName;
                        txtCapacity.Value       = value.Capacity.Value;
                        cbActive.Checked        = value.Active.Value;
                        LoadTime(value.RoomCode);
                        btnDelete = SystemProperties.BtnProperties(btnDelete, true, Imagename.Delete.ToString(), Imagename._delete.ToString());
                        btnEdit   = SystemProperties.BtnProperties(btnEdit, true, Imagename.Edit.ToString(), Imagename._edit.ToString());
                        GetRoomDevice(value.RoomCode);
                    }
                }
            }
        }
 void GetRoomDescription(string RoomCode)
 {
     txtRoomDesc.Text = "";
     using (Maintenance maintain = new Maintenance())
     {
         txtRoomDesc.Text = maintain.GetRoom().Where(x => x.Active == true && x.RoomCode == RoomCode).FirstOrDefault().Description;
     }
 }
 private int GetCapacity(string RoomCode)
 {
     using (Maintenance maintain = new Maintenance())
     {
         int retCap = 0;
         retCap = maintain.GetRoom().Where(x => x.RoomCode == RoomCode).FirstOrDefault().Capacity.Value;
         lblMessageCheckRecord.Text = string.Format("Room capacity: {0} ", retCap);
         return(retCap);
     }
 }
 void LoadRoom()
 {
     cmbRoomCode.Items.Clear();
     using (Maintenance maintain = new Maintenance())
     {
         maintain.GetRoom().Where(x => x.Active == true).OrderBy(o => o.RoomCode).ToList().ForEach(f =>
         {
             cmbRoomCode.Items.Add(f.RoomCode);
         });
     }
 }
 void LoadRoomCode()
 {
     cmbRoomCode.Items.Clear();
     using (Maintenance maintain = new Maintenance())
     {
         maintain.GetRoom().ForEach(x =>
         {
             cmbRoomCode.Items.Add(x.RoomCode);
         });
     }
 }
Ejemplo n.º 6
0
        void loadRoom()
        {
            int i = 1;

            dgRoom.Rows.Clear();
            using (Maintenance _maintain = new Maintenance())
            {
                _maintain.GetRoom().OrderBy(o => o.RoomCode).ToList().ForEach(x =>
                {
                    dgRoom.Rows.Add(x.ID, i, x.RoomCode, x.Description, x.RoomType, x.BuildingCode, x.Capacity, x.Active);
                    i++;
                });
            }
            ObjEnable(false);
            dgTime.Enabled = false;
        }
        void LoadRoomRecord()
        {
            int i = 1;

            dgRoomRecord.Rows.Clear();
            using (SMSNotification notify = new SMSNotification())
            {
                notify.GetRegisterStudent().OrderBy(o => o.TimeStart).ToList().ForEach(x =>
                {
                    using (Maintenance maintain = new Maintenance())
                    {
                        using (Students stud = new Students())
                        {
                            var studs     = stud.GetStudentInfo().Where(s => s.StudentID == x.StudentID).FirstOrDefault();
                            var valueBldg = maintain.GetRoom().Where(xx => xx.RoomCode == x.RoomCode).FirstOrDefault();
                            dgRoomRecord.Rows.Add(x.ID, i, x.StudentID, studs.LastName + "," + studs.FirstName, x.Semester, valueBldg.BuildingCode, x.RoomCode, valueBldg.Description, x.TimeStart.ToShortTimeString() + " to " + x.TImeEnd.ToShortTimeString());
                            i++;
                        }
                    }
                });
            }
        }
 void GetRoomSubjectMessage()
 {
     cmbMessage.Items.Clear();
     cmbRoomCode.Items.Clear();
     cmbSubjectCode.Items.Clear();
     using (Maintenance maintain = new Maintenance())
     {
         maintain.GetRoom().Where(x => x.Active == true).OrderBy(o => o.RoomCode).ToList().ForEach(y =>
         {
             cmbRoomCode.Items.Add(y.RoomCode);
         });
         maintain.GetSubject().Where(x => x.Active == true).OrderBy(o => o.Code).ToList().ForEach(y =>
         {
             cmbSubjectCode.Items.Add(y.Code);
         });
     }
     using (SMSNotification smsNotify = new SMSNotification())
     {
         smsNotify.GetSMS().Where(x => x.Active == true).ToList().ForEach(s =>
         {
             cmbMessage.Items.Add(s.Code);
         });
     }
 }
        void LoadSearch(bool Year, bool Semester, bool Room, bool Subject)
        {
            dgRoomRecord.Rows.Clear();
            int i = 1;

            using (SMSNotification notify = new SMSNotification())
            {
                using (Maintenance maintain = new Maintenance())
                {
                    using (Students stud = new Students())
                    {
                        if (!Year && !Semester && !Room && !Subject)
                        {
                            LoadRoomRecord();
                        }
                        if (Year && Semester && Room && Subject)//four
                        {
                            dgRoomRecord.Rows.Clear();
                            var value = notify.GetRegisterStudent().Where(x => x.YearClass == cmbYearClass.Text && x.Semester == cmbSemester.Text && x.RoomCode == cmbRoomCode.Text && x.SubjectCode == cmbSubCode.Text).OrderBy(o => o.TimeStart).ToList();
                            if (value.Count > 0)
                            {
                                value.ForEach(x =>
                                {
                                    var studs     = stud.GetStudentInfo().Where(s => s.StudentID == x.StudentID).FirstOrDefault();
                                    var valueBldg = maintain.GetRoom().Where(xx => xx.RoomCode == x.RoomCode).FirstOrDefault();
                                    dgRoomRecord.Rows.Add(x.ID, i, x.StudentID, studs.LastName + "," + studs.FirstName, x.Semester, valueBldg.BuildingCode, x.RoomCode, valueBldg.Description, x.TimeStart.ToShortTimeString() + " to " + x.TImeEnd.ToShortTimeString());
                                    i++;
                                });
                            }
                        }
                        if (Year) //four
                        {
                            dgRoomRecord.Rows.Clear();
                            var value = notify.GetRegisterStudent().Where(x => x.YearClass == cmbYearClass.Text).OrderBy(o => o.TimeStart).ToList();
                            if (value.Count > 0)
                            {
                                value.ForEach(x =>
                                {
                                    var studs     = stud.GetStudentInfo().Where(s => s.StudentID == x.StudentID).FirstOrDefault();
                                    var valueBldg = maintain.GetRoom().Where(xx => xx.RoomCode == x.RoomCode).FirstOrDefault();
                                    dgRoomRecord.Rows.Add(x.ID, i, x.StudentID, studs.LastName + "," + studs.FirstName, x.Semester, valueBldg.BuildingCode, x.RoomCode, valueBldg.Description, x.TimeStart.ToShortTimeString() + " to " + x.TImeEnd.ToShortTimeString());
                                    i++;
                                });
                            }
                        }
                        if (Semester) //four
                        {
                            dgRoomRecord.Rows.Clear();
                            var value = notify.GetRegisterStudent().Where(x => x.Semester == cmbSemester.Text).OrderBy(o => o.TimeStart).ToList();
                            if (value.Count > 0)
                            {
                                value.ForEach(x =>
                                {
                                    var studs     = stud.GetStudentInfo().Where(s => s.StudentID == x.StudentID).FirstOrDefault();
                                    var valueBldg = maintain.GetRoom().Where(xx => xx.RoomCode == x.RoomCode).FirstOrDefault();
                                    dgRoomRecord.Rows.Add(x.ID, i, x.StudentID, studs.LastName + "," + studs.FirstName, x.Semester, valueBldg.BuildingCode, x.RoomCode, valueBldg.Description, x.TimeStart.ToShortTimeString() + " to " + x.TImeEnd.ToShortTimeString());
                                    i++;
                                });
                            }
                        }
                        if (Room) //four
                        {
                            dgRoomRecord.Rows.Clear();
                            var value = notify.GetRegisterStudent().Where(x => x.RoomCode == cmbRoomCode.Text).OrderBy(o => o.TimeStart).ToList();
                            if (value.Count > 0)
                            {
                                value.ForEach(x =>
                                {
                                    var studs     = stud.GetStudentInfo().Where(s => s.StudentID == x.StudentID).FirstOrDefault();
                                    var valueBldg = maintain.GetRoom().Where(xx => xx.RoomCode == x.RoomCode).FirstOrDefault();
                                    dgRoomRecord.Rows.Add(x.ID, i, x.StudentID, studs.LastName + "," + studs.FirstName, x.Semester, valueBldg.BuildingCode, x.RoomCode, valueBldg.Description, x.TimeStart.ToShortTimeString() + " to " + x.TImeEnd.ToShortTimeString());
                                    i++;
                                });
                            }
                        }
                        if (Subject)//four
                        {
                            dgRoomRecord.Rows.Clear();
                            var value = notify.GetRegisterStudent().Where(x => x.SubjectCode == cmbSubCode.Text).OrderBy(o => o.TimeStart).ToList();
                            if (value.Count > 0)
                            {
                                value.ForEach(x =>
                                {
                                    var studs     = stud.GetStudentInfo().Where(s => s.StudentID == x.StudentID).FirstOrDefault();
                                    var valueBldg = maintain.GetRoom().Where(xx => xx.RoomCode == x.RoomCode).FirstOrDefault();
                                    dgRoomRecord.Rows.Add(x.ID, i, x.StudentID, studs.LastName + "," + studs.FirstName, x.Semester, valueBldg.BuildingCode, x.RoomCode, valueBldg.Description, x.TimeStart.ToShortTimeString() + " to " + x.TImeEnd.ToShortTimeString());
                                    i++;
                                });
                            }
                        }
                        if (Year && Semester && Room)
                        {
                            dgRoomRecord.Rows.Clear();
                            var value = notify.GetRegisterStudent().Where(x => x.YearClass == cmbYearClass.Text && x.Semester == cmbSemester.Text && x.RoomCode == cmbRoomCode.Text).OrderBy(o => o.TimeStart).ToList();
                            if (value.Count > 0)
                            {
                                value.ForEach(x =>
                                {
                                    var studs     = stud.GetStudentInfo().Where(s => s.StudentID == x.StudentID).FirstOrDefault();
                                    var valueBldg = maintain.GetRoom().Where(xx => xx.RoomCode == x.RoomCode).FirstOrDefault();
                                    dgRoomRecord.Rows.Add(x.ID, i, x.StudentID, studs.LastName + "," + studs.FirstName, x.Semester, valueBldg.BuildingCode, x.RoomCode, valueBldg.Description, x.TimeStart.ToShortTimeString() + " to " + x.TImeEnd.ToShortTimeString());
                                    i++;
                                });
                            }
                        }
                        if (Year && Semester && Subject)
                        {
                            dgRoomRecord.Rows.Clear();
                            var value = notify.GetRegisterStudent().Where(x => x.YearClass == cmbYearClass.Text && x.Semester == cmbSemester.Text && x.SubjectCode == cmbSubCode.Text).OrderBy(o => o.TimeStart).ToList();
                            if (value.Count > 0)
                            {
                                value.ForEach(x =>
                                {
                                    var studs     = stud.GetStudentInfo().Where(s => s.StudentID == x.StudentID).FirstOrDefault();
                                    var valueBldg = maintain.GetRoom().Where(xx => xx.RoomCode == x.RoomCode).FirstOrDefault();
                                    dgRoomRecord.Rows.Add(x.ID, i, x.StudentID, studs.LastName + "," + studs.FirstName, x.Semester, valueBldg.BuildingCode, x.RoomCode, valueBldg.Description, x.TimeStart.ToShortTimeString() + " to " + x.TImeEnd.ToShortTimeString());
                                    i++;
                                });
                            }
                        }

                        if (Semester && Room && Subject)
                        {
                            dgRoomRecord.Rows.Clear();
                            var value = notify.GetRegisterStudent().Where(x => x.Semester == cmbSemester.Text && x.RoomCode == cmbRoomCode.Text && x.SubjectCode == cmbSubCode.Text).OrderBy(o => o.TimeStart).ToList();
                            if (value.Count > 0)
                            {
                                value.ForEach(x =>
                                {
                                    var studs     = stud.GetStudentInfo().Where(s => s.StudentID == x.StudentID).FirstOrDefault();
                                    var valueBldg = maintain.GetRoom().Where(xx => xx.RoomCode == x.RoomCode).FirstOrDefault();
                                    dgRoomRecord.Rows.Add(x.ID, i, x.StudentID, studs.LastName + "," + studs.FirstName, x.Semester, valueBldg.BuildingCode, x.RoomCode, valueBldg.Description, x.TimeStart.ToShortTimeString() + " to " + x.TImeEnd.ToShortTimeString());
                                    i++;
                                });
                            }
                        }
                        if (Year && Room && Subject)
                        {
                            dgRoomRecord.Rows.Clear();
                            var value = notify.GetRegisterStudent().Where(x => x.YearClass == cmbYearClass.Text && x.RoomCode == cmbRoomCode.Text && x.SubjectCode == cmbSubCode.Text).OrderBy(o => o.TimeStart).ToList();
                            if (value.Count > 0)
                            {
                                value.ForEach(x =>
                                {
                                    var studs     = stud.GetStudentInfo().Where(s => s.StudentID == x.StudentID).FirstOrDefault();
                                    var valueBldg = maintain.GetRoom().Where(xx => xx.RoomCode == x.RoomCode).FirstOrDefault();
                                    dgRoomRecord.Rows.Add(x.ID, i, x.StudentID, studs.LastName + "," + studs.FirstName, x.Semester, valueBldg.BuildingCode, x.RoomCode, valueBldg.Description, x.TimeStart.ToShortTimeString() + " to " + x.TImeEnd.ToShortTimeString());
                                    i++;
                                });
                            }
                        }

                        if (Year && Semester)
                        {
                            dgRoomRecord.Rows.Clear();
                            var value = notify.GetRegisterStudent().Where(x => x.YearClass == cmbYearClass.Text && x.Semester == cmbSemester.Text).OrderBy(o => o.TimeStart).ToList();
                            if (value.Count > 0)
                            {
                                value.ForEach(x =>
                                {
                                    var studs     = stud.GetStudentInfo().Where(s => s.StudentID == x.StudentID).FirstOrDefault();
                                    var valueBldg = maintain.GetRoom().Where(xx => xx.RoomCode == x.RoomCode).FirstOrDefault();
                                    dgRoomRecord.Rows.Add(x.ID, i, x.StudentID, studs.LastName + "," + studs.FirstName, x.Semester, valueBldg.BuildingCode, x.RoomCode, valueBldg.Description, x.TimeStart.ToShortTimeString() + " to " + x.TImeEnd.ToShortTimeString());
                                    i++;
                                });
                            }
                        }
                        if (Year && Room)
                        {
                            dgRoomRecord.Rows.Clear();
                            var value = notify.GetRegisterStudent().Where(x => x.YearClass == cmbYearClass.Text && x.RoomCode == cmbRoomCode.Text).OrderBy(o => o.TimeStart).ToList();
                            if (value.Count > 0)
                            {
                                value.ForEach(x =>
                                {
                                    var studs     = stud.GetStudentInfo().Where(s => s.StudentID == x.StudentID).FirstOrDefault();
                                    var valueBldg = maintain.GetRoom().Where(xx => xx.RoomCode == x.RoomCode).FirstOrDefault();
                                    dgRoomRecord.Rows.Add(x.ID, i, x.StudentID, studs.LastName + "," + studs.FirstName, x.Semester, valueBldg.BuildingCode, x.RoomCode, valueBldg.Description, x.TimeStart.ToShortTimeString() + " to " + x.TImeEnd.ToShortTimeString());
                                    i++;
                                });
                            }
                        }
                        if (Year && Subject)
                        {
                            dgRoomRecord.Rows.Clear();
                            var value = notify.GetRegisterStudent().Where(x => x.YearClass == cmbYearClass.Text && x.SubjectCode == cmbSubCode.Text).OrderBy(o => o.TimeStart).ToList();
                            if (value.Count > 0)
                            {
                                value.ForEach(x =>
                                {
                                    var studs     = stud.GetStudentInfo().Where(s => s.StudentID == x.StudentID).FirstOrDefault();
                                    var valueBldg = maintain.GetRoom().Where(xx => xx.RoomCode == x.RoomCode).FirstOrDefault();
                                    dgRoomRecord.Rows.Add(x.ID, i, x.StudentID, studs.LastName + "," + studs.FirstName, x.Semester, valueBldg.BuildingCode, x.RoomCode, valueBldg.Description, x.TimeStart.ToShortTimeString() + " to " + x.TImeEnd.ToShortTimeString());
                                    i++;
                                });
                            }
                        }

                        if (Semester && Room)
                        {
                            dgRoomRecord.Rows.Clear();
                            var value = notify.GetRegisterStudent().Where(x => x.Semester == cmbSemester.Text && x.RoomCode == cmbRoomCode.Text).OrderBy(o => o.TimeStart).ToList();
                            if (value.Count > 0)
                            {
                                value.ForEach(x =>
                                {
                                    var studs     = stud.GetStudentInfo().Where(s => s.StudentID == x.StudentID).FirstOrDefault();
                                    var valueBldg = maintain.GetRoom().Where(xx => xx.RoomCode == x.RoomCode).FirstOrDefault();
                                    dgRoomRecord.Rows.Add(x.ID, i, x.StudentID, studs.LastName + "," + studs.FirstName, x.Semester, valueBldg.BuildingCode, x.RoomCode, valueBldg.Description, x.TimeStart.ToShortTimeString() + " to " + x.TImeEnd.ToShortTimeString());
                                    i++;
                                });
                            }
                        }
                        if (Semester && Subject)
                        {
                            dgRoomRecord.Rows.Clear();
                            var value = notify.GetRegisterStudent().Where(x => x.Semester == cmbSemester.Text && x.SubjectCode == cmbSubCode.Text).OrderBy(o => o.TimeStart).ToList();
                            if (value.Count > 0)
                            {
                                value.ForEach(x =>
                                {
                                    var studs     = stud.GetStudentInfo().Where(s => s.StudentID == x.StudentID).FirstOrDefault();
                                    var valueBldg = maintain.GetRoom().Where(xx => xx.RoomCode == x.RoomCode).FirstOrDefault();
                                    dgRoomRecord.Rows.Add(x.ID, i, x.StudentID, studs.LastName + "," + studs.FirstName, x.Semester, valueBldg.BuildingCode, x.RoomCode, valueBldg.Description, x.TimeStart.ToShortTimeString() + " to " + x.TImeEnd.ToShortTimeString());
                                    i++;
                                });
                            }
                        }
                        if (Room && Subject)
                        {
                            dgRoomRecord.Rows.Clear();
                            var value = notify.GetRegisterStudent().Where(x => x.RoomCode == cmbRoomCode.Text && x.SubjectCode == cmbSubCode.Text).OrderBy(o => o.TimeStart).ToList();
                            if (value.Count > 0)
                            {
                                value.ForEach(x =>
                                {
                                    var studs     = stud.GetStudentInfo().Where(s => s.StudentID == x.StudentID).FirstOrDefault();
                                    var valueBldg = maintain.GetRoom().Where(xx => xx.RoomCode == x.RoomCode).FirstOrDefault();
                                    dgRoomRecord.Rows.Add(x.ID, i, x.StudentID, studs.LastName + "," + studs.FirstName, x.Semester, valueBldg.BuildingCode, x.RoomCode, valueBldg.Description, x.TimeStart.ToShortTimeString() + " to " + x.TImeEnd.ToShortTimeString());
                                    i++;
                                });
                            }
                        }
                    }
                }
            }
        }