コード例 #1
0
 private void FillComboBox()
 {
     using (AcademyEntities1 db = new AcademyEntities1())
     {
         cbSpecGroup.DataSource = db.Education_Proqrams.Where(g => g.Status == true).Select(g => g.Name).ToList();
     }
 }
コード例 #2
0
 private void FillComboBox()
 {
     using (AcademyEntities1 db = new AcademyEntities1())
     {
         cbCheckedGroup.DataSource = db.Groups.Where(g => g.Status == true).Select(g => g.Name).ToList();
     }
 }
コード例 #3
0
        private bool CreateTask()
        {
            int affectedRows = 0;

            using (AcademyEntities1 db = new AcademyEntities1())
            {
                int  groupID = (db.Groups.Where(g => g.Name == cbTaskGroup.SelectedItem.ToString()).FirstOrDefault()).ID;
                Task task    = new Task
                {
                    Name     = TaskNameTxt.Text,
                    Deadline = dtpTaskCreate.Value,
                    GroupİD  = groupID,
                    Status   = true
                };

                db.Tasks.Add(task);

                affectedRows = db.SaveChanges();
            }
            if (affectedRows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #4
0
        private void FilterByDeadlineOffToolStripMenuItem_Click_1(object sender, EventArgs e)
        {
            dgvTaskSrch.Rows.Clear();

            using (AcademyEntities1 db = new AcademyEntities1())
            {
                List <Models.Task> Task = db.Tasks.Where(su => su.Status == true).ToList();

                foreach (var ts in Task)
                {
                    dgvTaskSrch.Rows.Add(ts.İd,
                                         ts.Name,
                                         ts.Deadline,
                                         ts.Group.Name
                                         );
                    if (ts.Deadline > DateTime.Now)
                    {
                        dgvTaskSrch.Rows[dgvTaskSrch.Rows.Count - 1].DefaultCellStyle.BackColor = Color.Red;
                    }
                    if (ts.Deadline <= DateTime.Now)
                    {
                        dgvTaskSrch.Rows[dgvTaskSrch.Rows.Count - 1].DefaultCellStyle.BackColor = Color.Green;
                    }
                }
            }
        }
コード例 #5
0
        private bool CreateMarks()
        {
            int affectedRows = 0;

            using (AcademyEntities1 db = new AcademyEntities1())
            {
                int        studentID = (db.Students.Where(c => c.Name == cbMarkStudentID.SelectedItem.ToString()).FirstOrDefault()).İd;
                int        taskID    = (db.Tasks.Where(m => m.Name == cbMarkTaskID.SelectedItem.ToString()).FirstOrDefault()).İd;
                Task_Marks mark      = new Task_Marks
                {
                    StudentİD = studentID,
                    TaskİD    = taskID,
                    Mark      = Convert.ToInt32(MarkTxt.Text),
                    Status    = true
                };

                db.Task_Marks.Add(mark);

                affectedRows = db.SaveChanges();
            }
            if (affectedRows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #6
0
        private bool CreateEmployee()
        {
            int affectedRows = 0;

            using (AcademyEntities1 db = new AcademyEntities1())
            {
                int      posID    = (db.Positions.Where(g => g.Name == cbPositionGroup.SelectedItem.ToString()).FirstOrDefault()).İd;
                Employee employee = new Employee
                {
                    Name       = EmployeeNameTxt.Text,
                    Surname    = EmployeeSurnameTxt.Text,
                    Email      = EmployeeEmailTxt.Text,
                    Phone      = EmployeePhoneTxt.Text,
                    PositionİD = posID,
                    Start_Time = Convert.ToDateTime(dtpEmployeeCreate.Text),
                    Salary     = Convert.ToDouble(EmployeeSalaryTxt.Text),
                    Status     = true
                };

                db.Employees.Add(employee);

                affectedRows = db.SaveChanges();
            }
            if (affectedRows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #7
0
        private bool UpdateEmployee()
        {
            int affectedRows = 0;

            using (AcademyEntities1 db = new AcademyEntities1())
            {
                int posID = (db.Positions.Where(g => g.Name == cbPositionGroup.SelectedItem.ToString()).FirstOrDefault()).İd;

                Employee newEmp = db.Employees.Where(s => s.İd == EmployeesCRUD.İd).FirstOrDefault();

                newEmp.Name       = EmployeeNameTxt.Text;
                newEmp.Surname    = EmployeeSurnameTxt.Text;
                newEmp.PositionİD = posID;
                newEmp.Email      = EmployeeEmailTxt.Text;
                newEmp.Phone      = EmployeePhoneTxt.Text;
                newEmp.Start_Time = Convert.ToDateTime(dtpEmployeeCreate.Text);
                newEmp.Salary     = Convert.ToDouble(EmployeeSalaryTxt.Text);
                affectedRows      = db.SaveChanges();
            }
            if (affectedRows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        private bool CreateClass()
        {
            int affectedRows = 0;

            using (AcademyEntities1 db = new AcademyEntities1())
            {
                Classroom clas = new Classroom
                {
                    Name   = ClassNameTxt.Text,
                    Status = true
                };

                db.Classrooms.Add(clas);

                affectedRows = db.SaveChanges();
            }
            if (affectedRows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #9
0
        private void FilterByStudentWhoHasToolStripMenuItem_Click(object sender, EventArgs e)
        {
            dgvStudentSrch.Rows.Clear();

            using (AcademyEntities1 db = new AcademyEntities1())
            {
                List <Models.Student> Task = db.Students.Where(su => su.Status == true).ToList();

                foreach (var ts in Task)
                {
                    dgvStudentSrch.Rows.Add(ts.İd,
                                            ts.Name,
                                            ts.Surname,
                                            ts.Email,
                                            ts.Phone,
                                            ts.Fee,
                                            ts.Group.Name
                                            );
                    if (ts.Fee < 3500)
                    {
                        dgvStudentSrch.Rows[dgvStudentSrch.Rows.Count - 1].DefaultCellStyle.BackColor = Color.Red;
                    }
                }
            }
        }
        private void GroupSearchBtn_Click_1(object sender, EventArgs e)
        {
            string GroupSrcTxt = GroupSearchText.Text.Trim().ToLower();

            using (AcademyEntities1 db = new AcademyEntities1())
            {
                List <Models.Group> employeeList = db.Groups.Where(gro =>
                                                                   gro.Name.ToLower().Contains(GroupSrcTxt) ||
                                                                   gro.Classroom.Name.ToLower().Contains(GroupSrcTxt) ||
                                                                   gro.Teacher.Name.ToLower().Contains(GroupSrcTxt) ||
                                                                   gro.Employee.Name.ToLower().Contains(GroupSrcTxt) ||
                                                                   gro.Capacity.ToString().Contains(GroupSrcTxt) ||
                                                                   gro.Education_Proqrams.Name.ToLower().Contains(GroupSrcTxt)

                                                                   ).ToList();

                dgvGroupSrch.Rows.Clear();

                foreach (var item in employeeList)
                {
                    dgvGroupSrch.Rows.Add(item.ID,
                                          item.Name,
                                          item.Classroom.Name,
                                          item.Teacher.Name,
                                          item.Employee.Name,
                                          item.Capacity,
                                          item.Education_Proqrams.Name
                                          );
                }
            }
        }
コード例 #11
0
        private bool UpdateStudent()
        {
            int affectedRows = 0;

            using (AcademyEntities1 db = new AcademyEntities1())
            {
                int specID = (db.Education_Proqrams.Where(g => g.Name == cbSpecGroup.SelectedItem.ToString()).FirstOrDefault()).İd;

                Teacher newTeach = db.Teachers.Where(s => s.İd == TeachersCRUD.İd).FirstOrDefault();

                newTeach.Name         = TeacherNameTxt.Text;
                newTeach.Surname      = TeacherSurnameTxt.Text;
                newTeach.SpecialityID = specID;
                newTeach.Email        = TeacherEmailTxt.Text;
                newTeach.Phone        = TeacherPhoneTxt.Text;
                affectedRows          = db.SaveChanges();
            }
            if (affectedRows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #12
0
        private bool UpdateTask()
        {
            int affectedRows = 0;

            using (AcademyEntities1 db = new AcademyEntities1())
            {
                int groupID = (db.Groups.Where(g => g.Name == cbTaskGroup.SelectedItem.ToString()).FirstOrDefault()).ID;

                Task newTask = db.Tasks.Where(s => s.İd == TasksCRUD.İd).FirstOrDefault();

                newTask.Name     = TaskNameTxt.Text;
                newTask.Deadline = Convert.ToDateTime(dtpTaskCreate.Value);
                newTask.GroupİD  = groupID;

                affectedRows = db.SaveChanges();
            }
            if (affectedRows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #13
0
        private bool CreateEdu()
        {
            int affectedRows = 0;

            using (AcademyEntities1 db = new AcademyEntities1())
            {
                Education_Proqrams edu = new Education_Proqrams
                {
                    Name   = EduNameTxt.Text,
                    Price  = Convert.ToDouble(EduPriceTxt.Text),
                    Status = true
                };

                db.Education_Proqrams.Add(edu);

                affectedRows = db.SaveChanges();
            }
            if (affectedRows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #14
0
        private bool CreateGroup()
        {
            int affectedRows = 0;

            using (AcademyEntities1 db = new AcademyEntities1())
            {
                int   classID = (db.Classrooms.Where(c => c.Name == cbGroupClassroom.SelectedItem.ToString()).FirstOrDefault()).İd;
                int   teachID = (db.Teachers.Where(t => t.Name == cbGroupTeacher.SelectedItem.ToString()).FirstOrDefault()).İd;
                int   mentID  = (db.Employees.Where(m => m.Name == cbGroupMentor.SelectedItem.ToString()).FirstOrDefault()).İd;
                int   eduID   = (db.Education_Proqrams.Where(e => e.Name == cbGroupEducation.SelectedItem.ToString()).FirstOrDefault()).İd;
                Group group   = new Group
                {
                    Name                = GroupNameTxt.Text,
                    ClassroomİD         = classID,
                    TeacherID           = teachID,
                    MentorİD            = mentID,
                    Capacity            = Convert.ToInt32(GroupCapacityTxt.Text),
                    Education_ProgramİD = eduID,
                    Status              = true
                };

                db.Groups.Add(group);

                affectedRows = db.SaveChanges();
            }
            if (affectedRows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #15
0
        private bool UpdateGroup()
        {
            int affectedRows = 0;

            using (AcademyEntities1 db = new AcademyEntities1())
            {
                int classID = (db.Classrooms.Where(g => g.Name == cbGroupClassroom.SelectedItem.ToString()).FirstOrDefault()).İd;
                int teachID = (db.Teachers.Where(g => g.Name == cbGroupTeacher.SelectedItem.ToString()).FirstOrDefault()).İd;
                int mentID  = (db.Employees.Where(g => g.Name == cbGroupMentor.SelectedItem.ToString()).FirstOrDefault()).İd;
                int eduID   = (db.Education_Proqrams.Where(g => g.Name == cbGroupEducation.SelectedItem.ToString()).FirstOrDefault()).İd;

                Group newGroup = db.Groups.Where(s => s.ID == GroupsCRUD.ID).FirstOrDefault();
                newGroup.Name        = GroupNameTxt.Text;
                newGroup.ClassroomİD = classID;
                newGroup.TeacherID   = teachID;
                newGroup.MentorİD    = mentID;
                newGroup.Capacity    = Convert.ToInt32(GroupCapacityTxt.Text);
                affectedRows         = db.SaveChanges();
            }
            if (affectedRows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        private bool CreateStudent()
        {
            int affectedRows = 0;

            using (AcademyEntities1 db = new AcademyEntities1())
            {
                int     groupID = (db.Groups.Where(g => g.Name == cbStudentGroup.SelectedItem.ToString()).FirstOrDefault()).ID;
                Student student = new Student
                {
                    Name    = StudentNameTxt.Text,
                    Surname = StudentSurnameTxt.Text,
                    Email   = StudentEmailTxt.Text,
                    Phone   = StudentPhoneTxt.Text,
                    Fee     = Convert.ToDouble(StudentFeeTxt.Text),
                    GroupID = groupID,
                    Status  = true
                };

                db.Students.Add(student);

                affectedRows = db.SaveChanges();
            }
            if (affectedRows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #17
0
        private bool CreateStudent()
        {
            int affectedRows = 0;

            using (AcademyEntities1 db = new AcademyEntities1())
            {
                int     specID  = (db.Education_Proqrams.Where(g => g.Name == cbSpecGroup.SelectedItem.ToString()).FirstOrDefault()).İd;
                Teacher teacher = new Teacher
                {
                    Name         = TeacherNameTxt.Text,
                    Surname      = TeacherSurnameTxt.Text,
                    SpecialityID = specID,
                    Email        = TeacherEmailTxt.Text,
                    Phone        = TeacherPhoneTxt.Text,
                    Status       = true
                };

                db.Teachers.Add(teacher);

                affectedRows = db.SaveChanges();
            }
            if (affectedRows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #18
0
        private bool CreatePos()
        {
            int affectedRows = 0;

            using (AcademyEntities1 db = new AcademyEntities1())
            {
                Position pos = new Position
                {
                    Name   = PositionNameTxt.Text,
                    Status = true
                };

                db.Positions.Add(pos);

                affectedRows = db.SaveChanges();
            }
            if (affectedRows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #19
0
 private void FillComboBox()
 {
     using (AcademyEntities1 db = new AcademyEntities1())
     {
         cbMarkStudentID.DataSource = db.Students.Where(g => g.Status == true).Select(g => g.Name).ToList();
         cbMarkTaskID.DataSource    = db.Tasks.Where(g => g.Status == true).Select(g => g.Name).ToList();
     }
 }
コード例 #20
0
 private void FillComboBox()
 {
     using (AcademyEntities1 db = new AcademyEntities1())
     {
         cbGroupClassroom.DataSource = db.Classrooms.Where(g => g.Status == true).Select(g => g.Name).ToList();
         cbGroupTeacher.DataSource   = db.Teachers.Where(g => g.Status == true).Select(g => g.Name).ToList();
         cbGroupMentor.DataSource    = db.Employees.Where(g => g.Status == true).Where(ju => ju.Position.Name == "Mentor").Select(g => g.Name).ToList();
         cbGroupEducation.DataSource = db.Education_Proqrams.Where(g => g.Status == true).Select(g => g.Name).ToList();
     }
 }
コード例 #21
0
        private void GenerateClass()
        {
            using (AcademyEntities1 db = new AcademyEntities1())
            {
                List <Academy> aca = db.Academies.ToList();

                foreach (var item in aca)
                {
                    AddressText.Text = ("Unvan: " + item.Street);
                    PhoneText.Text   = ("Elaqe Nomresi: " + item.Phone);
                }
            }
        }
コード例 #22
0
        private void DgvPositionCreate_CellMouseDoubleClick_1(object sender, DataGridViewCellMouseEventArgs e)
        {
            int posID = (int)dgvPositionCreate.Rows[e.RowIndex].Cells[0].Value;

            using (AcademyEntities1 db = new AcademyEntities1())
            {
                PosCRUD = db.Positions.Where(s => s.İd == posID).FirstOrDefault();
                if (PosCRUD != null)
                {
                    PositionNameTxt.Text = PosCRUD.Name;
                }
            }
            PositionCreateBtn.Enabled = false;
            PositionDeleteBtn.Enabled = true;
            PositionUpdateBtn.Enabled = true;
        }
        private void DgvClassCreate_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            int classID = (int)dgvClassCreate.Rows[e.RowIndex].Cells[0].Value;

            using (AcademyEntities1 db = new AcademyEntities1())
            {
                ClassCRUD = db.Classrooms.Where(s => s.İd == classID).FirstOrDefault();
                if (ClassCRUD != null)
                {
                    ClassNameTxt.Text = ClassCRUD.Name;
                }
            }
            ClassroomCreateBtn.Enabled = false;
            ClassroomDeleteBtn.Enabled = true;
            ClassroomUpdateBtn.Enabled = true;
        }
        private void SearchFromEducation()
        {
            dgvEducationSrch.Rows.Clear();

            using (AcademyEntities1 db = new AcademyEntities1())
            {
                List <Models.Education_Proqrams> Educ = db.Education_Proqrams.Where(su => su.Status == true).ToList();

                foreach (var edu in Educ)
                {
                    dgvEducationSrch.Rows.Add(edu.İd,
                                              edu.Name,
                                              edu.Price
                                              );
                }
            }
        }
コード例 #25
0
        private void DgvEduCreate_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            int eduID = (int)dgvEduCreate.Rows[e.RowIndex].Cells[0].Value;

            using (AcademyEntities1 db = new AcademyEntities1())
            {
                EdusCRUD = db.Education_Proqrams.Where(s => s.İd == eduID).FirstOrDefault();
                if (EdusCRUD != null)
                {
                    EduNameTxt.Text  = EdusCRUD.Name;
                    EduPriceTxt.Text = Convert.ToString(EdusCRUD.Price);
                }
            }
            EduCreateBtn.Enabled = false;
            EduDeleteBtn.Enabled = true;
            EduUpdateBtn.Enabled = true;
        }
コード例 #26
0
        private void FillDept()
        {
            dgvStudentSrch.Rows.Clear();

            using (AcademyEntities1 db = new AcademyEntities1())
            {
                List <Models.Student> Task = db.Students.Where(su => su.Status == true).ToList();

                foreach (var ts in Task)
                {
                    dgvStudentSrch.Rows.Add(ts.İd,
                                            (ts.Name + " " + ts.Surname),
                                            (3500 - ts.Fee)
                                            );
                }
            }
        }
コード例 #27
0
        private void SearchFromTask()
        {
            dgvTaskSrch.Rows.Clear();

            using (AcademyEntities1 db = new AcademyEntities1())
            {
                List <Models.Task> Task = db.Tasks.Where(su => su.Status == true).ToList();

                foreach (var ts in Task)
                {
                    dgvTaskSrch.Rows.Add(ts.İd,
                                         ts.Name,
                                         ts.Deadline,
                                         ts.Group.Name
                                         );
                }
            }
        }
コード例 #28
0
        private void DgvTaskCreate_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            int taskID = (int)dgvTaskCreate.Rows[e.RowIndex].Cells[0].Value;

            using (AcademyEntities1 db = new AcademyEntities1())
            {
                TasksCRUD = db.Tasks.Where(s => s.İd == taskID).FirstOrDefault();
                if (TasksCRUD != null)
                {
                    TaskNameTxt.Text         = TasksCRUD.Name;
                    dtpTaskCreate.Value      = TasksCRUD.Deadline;
                    cbTaskGroup.SelectedItem = TasksCRUD.Group.Name;
                }
            }
            TaskCreateBtn.Enabled = false;
            TaskDeleteBtn.Enabled = true;
            TaskUpdateBtn.Enabled = true;
        }
        private void GenerateClass()
        {
            dgvClassCreate.Rows.Clear();

            using (AcademyEntities1 db = new AcademyEntities1())
            {
                List <Classroom> classes = db.Classrooms.Where(su => su.Status == true).ToList();

                foreach (var clas in classes)
                {
                    dgvClassCreate.Rows.Add(clas.İd,
                                            clas.Name
                                            );
                }
            }
            ClassroomUpdateBtn.Enabled = false;
            ClassroomDeleteBtn.Enabled = false;
        }
コード例 #30
0
        private void DgvMarkCreate_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            int markID = (int)dgvMarkCreate.Rows[e.RowIndex].Cells[0].Value;

            using (AcademyEntities1 db = new AcademyEntities1())
            {
                MarksCRUD = db.Task_Marks.Where(s => s.İd == markID).FirstOrDefault();
                if (MarksCRUD != null)
                {
                    cbMarkStudentID.SelectedItem = MarksCRUD.Student.Name;
                    cbMarkTaskID.SelectedItem    = MarksCRUD.Task.Name;
                    MarkTxt.Text = Convert.ToString(MarksCRUD.Mark);
                }
            }
            MarkCreateBtn.Enabled = false;
            MarkDeleteBtn.Enabled = true;
            MarkUpdateBtn.Enabled = true;
        }