public Disciplines FindDisciplineById(int id)
        {
            Disciplines DisciplineObj = new Disciplines();
            var         ConnectionObj = DatabaseConnection.CreateConnection();
            var         CommandObj    = DatabaseConnection.CreateCommand(ConnectionObj, "ELIB_Management_System.uspSelectDisciplineById", CommandType.StoredProcedure);

            var P1 = DatabaseConnection.CreateParameter(CommandObj, "@discipline_id", DbType.Int32);

            P1.Value = id;
            CommandObj.Parameters.Add(P1);
            try
            {
                DataTable TableObj = DatabaseConnection.ExecuteReader(CommandObj);
                if (TableObj != null && TableObj.Rows.Count > 0)
                {
                    foreach (DataRow row in TableObj.Rows)
                    {
                        DisciplineObj.DisciplineId   = (int)row[0];
                        DisciplineObj.DisciplineName = (string)row[1];
                    }
                }
            }
            catch (DbException ex)
            {
                throw new ELibException(ex.Message);
            }
            catch (Exception ex)
            {
                throw new ELibException(ex.Message);
            }
            return(DisciplineObj);
        }
Ejemplo n.º 2
0
        public Discipline GetDiscipline(DisciplineBasedProxy discipline)
        {
            var disciplineGroup = GetGroup(discipline.GroupName);

            return(Disciplines.First(d =>
                                     d.DisciplineName == discipline.DisciplineName && d.GroupId == disciplineGroup.GroupId));
        }
Ejemplo n.º 3
0
 public void ClearDictionaries()
 {
     Disciplines.Clear();
     Groups.Clear();
     Teachers.Clear();
     Time.Clear();
 }
Ejemplo n.º 4
0
    static void Main()
    {
        Disciplines disclineOne = new Disciplines("math", 10, 12);
           Disciplines[] discipline = new Disciplines[] { disclineOne};

           Teacher teacherOne = new Teacher("Ivan Ivanov", discipline);
           Teacher[] teachers = new Teacher[] { teacherOne };

           Student studentOne = new Student("Stoyan", 1);
           Student studentTwo = new Student("Daniel", 2);
           Student studentThree = new Student("Yavor", 3);
           Student studentFour = new Student("Pesho", 5);
           Student studentFive = new Student("Darin", 8);
           Student [] students = new Student[]{studentOne,studentTwo,studentThree,studentFour,studentFive};

           ClassesOfStudents classOne = new ClassesOfStudents(teachers, students, "6C");

           classOne.AddTeacher(teacherOne);
           classOne.AddStudent(studentOne);
           classOne.AddStudent(studentFour);

           foreach (var s in students)
           {
           Console.WriteLine("Name of student:{0}",s.Name);
           }

           studentOne.AddText("vacation is over");
           Console.WriteLine("The commnent of student is: {0}", studentOne.FreeTexts[0]);
    }
Ejemplo n.º 5
0
        private void RemoveDisciplineData_ButtonClick(object sender, RoutedEventArgs e)
        {
            try
            {
                if (SelectedDiscipline != null)
                {
                    var messageBoxResult = MessageBox.Show("Вы действительно удалить данную дисциплину?", "Подтверждение действия",
                                                           MessageBoxButton.YesNo, MessageBoxImage.Question);

                    if (messageBoxResult == MessageBoxResult.Yes)
                    {
                        Connection.Database.disciplines.Remove(SelectedDiscipline);
                        Disciplines.Remove(SelectedDiscipline);

                        Connection.Database.SaveChanges();
                    }
                }
                else
                {
                    MessageBox.Show("Дисциплина не выбрана.", "Выберите дисциплину.", MessageBoxButton.OK, MessageBoxImage.Warning);
                }
            }
            catch (Exception err)
            {
                MessageBox.Show(err.Message, "Ошибка сохранения", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
        }
        public List <Disciplines> GetDisciplines()
        {
            List <Disciplines> DisciplinesListObj = null;

            var ConnectionObj = DatabaseConnection.CreateConnection();
            var CommandObj    = DatabaseConnection.CreateCommand(ConnectionObj, "ELIB_Management_System.uspSelectAllDisciplines", CommandType.StoredProcedure);

            try
            {
                DataTable TableObj = DatabaseConnection.ExecuteReader(CommandObj);
                if (TableObj != null && TableObj.Rows.Count > 0)
                {
                    DisciplinesListObj = new List <Disciplines>();
                    foreach (DataRow row in TableObj.Rows)
                    {
                        var DisciplineObj = new Disciplines();
                        DisciplineObj.DisciplineId   = (int)row[0];
                        DisciplineObj.DisciplineName = (string)row[1];

                        DisciplinesListObj.Add(DisciplineObj);
                    }
                }
            }
            catch (DbException ex)
            {
                throw new ELibException("Error reading data", ex);
            }
            catch (Exception ex)
            {
                throw new ELibException("Unknown error", ex);
            }

            return(DisciplinesListObj);
        }
Ejemplo n.º 7
0
 public ActionResult EditDiscipline(Disciplines discipline)
 {
     if (ModelState.IsValid)
     {
         _repository.UpdateDiscipline(discipline);
     }
     return(View(discipline));
 }
Ejemplo n.º 8
0
 public ActionResult CreateDiscipline(Disciplines discipline)
 {
     if (ModelState.IsValid)
     {
         bool result = _repository.AddDiscipline(discipline);
         ViewBag.DisciplineAddResult = result;
     }
     return(View());
 }
Ejemplo n.º 9
0
        public void SetMark(Disciplines disciplines, int mark)
        {
            var indexOfDiscipline = (int)disciplines;

            if (_marks[indexOfDiscipline] != 0)
            {
                throw new Exception("The mark of the chosen discipline was entered twice");
            }
            _marks[indexOfDiscipline] = mark;
        }
Ejemplo n.º 10
0
 public EmployeeForDpm(Employee e, Recordbook?rc, Position?ps, List <Discipline> disc)
 {
     this.Id           = e.Id;
     this.Name         = e.Name;
     this.DepartmentId = e.DepartmentId;
     this.WorkHour     = e.Recordbook.Workload;
     this.Position     = ps.Name;
     this.PositionId   = e.PositionId;
     disc.ForEach(d => Disciplines.Add(d.DisciplineName));
     this.ContractStart = e.Recordbook.ContractStart;
     this.ContractEnd   = e.Recordbook.ContractEnd;
 }
Ejemplo n.º 11
0
        public void Teach(Discipline discipline)
        {
            Discipline disc = Disciplines.Find(d => d == discipline);

            if (disc != null)
            {
                OutputHandling.Message($"Teaching {discipline}", consoleColor: ConsoleColor.Green);
            }

            else
            {
                OutputHandling.Message($"Sorry, but I am not lisenced to teach {discipline}");
            }
        }
Ejemplo n.º 12
0
        public Disciplines FindDisciplineById(int id)
        {
            Disciplines DisciplineObj = null;

            if (id > 0)
            {
                DisciplineObj = DisciplinesDALObj.FindDisciplineById(id);
            }
            else
            {
                throw new ELibException("Unable to find discipline! Try again with proper id");
            }
            return(DisciplineObj);
        }
Ejemplo n.º 13
0
 public void ChangeListDisciplines(List <Discipline> disciplines)
 {
     Disciplines.Clear();
     foreach (var item in disciplines)
     {
         if (item is Exam)
         {
             Disciplines.Add(new Exam(item as Exam));
         }
         else
         {
             Disciplines.Add(new Credit(item as Credit));
         }
     }
 }
Ejemplo n.º 14
0
 } = new decimal[3][];                                          // Массив оценок
 // Установка оценки по предмету
 public void AddEstimates(Disciplines ds, decimal estimate)
 {
     // Если строка пустая
     if (estimates[(int)ds] == null)
     {
         estimates[(int)ds] = new decimal[1];
     }
     // Если уже существует, расширяем
     else
     {
         Array.Resize <decimal>(ref estimates[(int)ds], estimates[(int)ds].Length + 1);
     }
     // Присваиваем
     estimates[(int)ds][estimates[(int)ds].Length - 1] = estimate;
 }
Ejemplo n.º 15
0
 static void Main()
 {
     // creating teachers
        // we need e set of discip
     Disciplines disc1 = new Disciplines("Math", 23, 140);
     Disciplines disc2 = new Disciplines("Biology", 23, 140);
     Disciplines disc3 = new Disciplines("OOP", 23, 140);
     IList<Disciplines> disciplines = new List<Disciplines>();
     disciplines.Add(disc1);
     disciplines.Add(disc2);
     disciplines.Add(disc3);
     //disciplines can have comments
     disc1.Comment("I am free this week");
     // and that is the teacher with his disciplines
     Teachers teacher1 = new Teachers("Petrow",disciplines);
     //he can make comments
     teacher1.Comment("Ivancho is bad");
     //you can see his comment
     Console.WriteLine(teacher1.SayComment());
     //we can make second teacher and than a set of teachers
     Teachers teacher2 = new Teachers("Stoqnow", disciplines);
     IList<Teachers> setOfTeachers = new List<Teachers>();
     setOfTeachers.Add(teacher1);
     setOfTeachers.Add(teacher2);
     // to create a class we need and a set of students
     // first we create a few students
     Students student1 = new Students("Ivancho", 7);
     Students student2 = new Students("Mariika", 16);
     Students student3 = new Students("Qworcho",25);
     IList<Students> setOfStudents = new List<Students>();
     setOfStudents.Add(student1);
     setOfStudents.Add(student2);
     setOfStudents.Add(student3);
     // now we can ctreate class
     Classes class1 = new Classes("10b", setOfStudents, setOfTeachers);
     // the classes can make comments
     class1.Comment("We are happy class");
     // finaly we make a list of classes
     Classes class2 = new Classes("11v",setOfStudents,setOfTeachers);
     IList<Classes> setOfClasses = new List<Classes>();
     setOfClasses.Add(class1);
     setOfClasses.Add(class2);
     //school
     School school1 = new School(setOfClasses);
     Console.WriteLine(school1.ToString());
 }
Ejemplo n.º 16
0
 public void TroopFactory()
 {
     for (int i = 0; i < 3; i++)
     {
         Disciplines.Add(new Discipline(DaysArrival)
         {
             Name = i.ToString()
         });
         foreach (var item in Students)
         {
             foreach (var item2 in Disciplines[i].Theme)
             {
                 item.Assessments.Add(new Assessment(item.Id, item2));
             }
         }
     }
 }
Ejemplo n.º 17
0
        /// <summary>
        /// Add new discipline
        /// </summary>
        /// <param name="discipline"></param>
        /// <returns></returns>
        public bool AddDiscipline(Disciplines discipline)
        {
            using (var context = new CoursesOfChoiceEntities())
            {
                var valToReturn = true;
                if (context.Disciplines.Any(el => el.name == discipline.name))
                {
                    valToReturn = false;
                }
                else
                {
                    context.Disciplines.Add(discipline);
                    context.SaveChanges();
                }

                return(valToReturn);
            }
        }
Ejemplo n.º 18
0
        /// <summary>
        /// Update discipline with values from discipline param
        /// </summary>
        /// <param name="discipline"></param>
        public void UpdateDiscipline(Disciplines discipline)
        {
            using (var context = new CoursesOfChoiceEntities())
            {
                var disciplineToUpdate = context.Disciplines.SingleOrDefault(disc => disc.id == discipline.id);
                if (disciplineToUpdate != null)
                {
                    disciplineToUpdate.name        = discipline.name;
                    disciplineToUpdate.lecturer    = discipline.lecturer;
                    disciplineToUpdate.kafedra     = discipline.kafedra;
                    disciplineToUpdate.course      = discipline.course;
                    disciplineToUpdate.description = discipline.description;
                }


                context.SaveChanges();
            }
        }
Ejemplo n.º 19
0
        /// <summary>
        /// Create a list of EquippableJobs for an item.
        /// </summary>
        /// <param name="node">HtmlNode with information related to the jobs.</param>
        /// <returns>A List of EquippableJobs.</returns>
        public static List <EquippableJob> CreateList(HtmlNode node)
        {
            var list       = new List <EquippableJob>();
            var fullString = node.FirstChild.FirstChild.InnerText;
            var level      = int.Parse(node.LastChild.InnerText.Substring(node.LastChild.InnerText.LastIndexOf(" ") + 1));

            if (fullString == "All Classes")
            {
                foreach (JobEnum job in (JobEnum[])Enum.GetValues(typeof(JobEnum)))
                {
                    list.Add(new EquippableJob(job, level));
                }
            }
            else if (fullString == "Disciple of the Hand")
            {
                list.AddRange(CreateMultiple(Disciplines.GetDisciplesOfHand(), level));
            }
            else if (fullString == "Disciple of the Land")
            {
                list.AddRange(CreateMultiple(Disciplines.GetDisciplesOfLand(), level));
            }
            else if (fullString == "Disciple of War")
            {
                list.AddRange(CreateMultiple(Disciplines.GetDisciplesOfWar(), level));
            }
            else if (fullString == "Disciple of Magic")
            {
                list.AddRange(CreateMultiple(Disciplines.GetDisciplesOfMagic(), level));
            }
            else
            {
                var job = fullString.Split(' ');

                foreach (var j in job)
                {
                    JobEnum parsed;
                    Enum.TryParse(j, out parsed);

                    list.Add(new EquippableJob(parsed, level));
                }
            }

            return(list);
        }
Ejemplo n.º 20
0
 protected void LoadEntities()
 {
     Addresses.Load();
     Cathedras.Load();
     Citizenships.Load();
     CommandPermissions.Load();
     Commands.Load();
     Countries.Load();
     Directions.Load();
     DisciplineCycles.Load();
     Disciplines.Load();
     Districts.Load();
     EducationCompetences.Load();
     EducationForms.Load();
     EducationLevels.Load();
     EducationPlanCompoments.Load();
     EducationPlanGraphics.Load();
     EducationPlanItems.Load();
     EducationPlans.Load();
     EducationProgramTypes.Load();
     EducationStandartTypes.Load();
     Faculties.Load();
     FinanceSources.Load();
     Genders.Load();
     Groups.Load();
     IdentityDocuments.Load();
     IdentityOrganizations.Load();
     IdentityTypes.Load();
     InterfaceElements.Load();
     InterfacePermissions.Load();
     Localities.Load();
     Persons.Load();
     Regions.Load();
     Roles.Load();
     Streets.Load();
     StudentStates.Load();
     Students.Load();
     Teachers.Load();
     Towns.Load();
     Users.Load();
 }
Ejemplo n.º 21
0
 // Средний балл
 public decimal EstimAverage(Disciplines ds)
 {
     return(estimates[(int)ds].Average());
 }
Ejemplo n.º 22
0
 public Teachers(string name, Disciplines discipline)
     : base(name)
 {
     this.teachersObject = discipline;
 }
Ejemplo n.º 23
0
 //Teachers have name.
 //constuctor
 public Teacher(string name, Disciplines[] disciplines)
     : base(name)
 {
     this.disciplines = new List<Disciplines>(disciplines);
 }
Ejemplo n.º 24
0
 /// <summary>
 /// add record of achievements in discipline
 /// </summary>
 /// <param name="discipline"></param>
 /// <param name="achievements"></param>
 public void AddRecord(Discipline discipline, List <Achievement> achievements)
 {
     //Disciplines.FirstOrDefault(x => x.Equals(discipline))?.Achievements.AddRange(achievements);
     Disciplines.FirstOrDefault(x => x.Name.Equals(discipline.Name))?.Achievements?.AddRange(achievements);
     NotifyObservers();
 }
Ejemplo n.º 25
0
 public Teachers(string name, Disciplines discipline)
     : base(name)
 {
     this.teachersObject = discipline;
 }
Ejemplo n.º 26
0
 public void AddDiscipline(Disciplines discipline)
 {
     this.disciplines.Add(discipline);
 }
Ejemplo n.º 27
0
 public void DeleteDiscipline(Disciplines discipline)
 {
     this.disciplines.Remove(discipline);
 }
 public void RemoveDiscipline(Disciplines discipline)
 {
     this.Disciplines.Remove(discipline);
 }
Ejemplo n.º 29
0
        public void SynchEntities()
        {
            try
            {
                var scales = client.GetAllScales();
                foreach (var a in scales)
                {
                    var scale = Scales.SingleOrDefault(q => q.ID == a.Id);
                    if (scale == null)
                    {
                        Scales.Add(new Scale(a.Id, a.Name));
                    }
                    else
                    {
                        scale.Update(a.Name);
                    }
                }
                var sports = client.GetAllSports();
                foreach (var a in sports)
                {
                    var sport = Sports.SingleOrDefault(q => q.ID == a.Id);
                    if (sport == null)
                    {
                        sport = new Sport(a.Id, a.Name);
                        Sports.Add(sport);
                    }
                    else
                    {
                        sport.Update(a.Name);
                    }
                    var disciplines = client.GetDiscipliniesFromSport(a.Id);
                    foreach (var disc in disciplines)
                    {
                        var discipline = Disciplines.SingleOrDefault(q => q.ID == disc.Id);
                        if (discipline == null)
                        {
                            discipline = new Discipline(disc.Id, disc.Name, sport, Scales.Single(q => q.ID == disc.ScaleId), disc.Description);
                            Disciplines.Add(discipline);
                        }
                        else
                        {
                            discipline.Update(disc.Name, sport, Scales.Single(q => q.ID == disc.ScaleId), disc.Description);
                        }
                        var goals = client.GetGoalsFromDiscipline(disc.Id);
                        foreach (var g in goals)
                        {
                            var goal = Goals.SingleOrDefault(q => q.ID == g.Id);
                            if (goal == null)
                            {
                                goal = new Goal(g.Id, g.Value, discipline, g.PeriodDays, g.Description, Users.SingleOrDefault(q => q.ID == g.OwnerId));
                                Goals.Add(goal);
                            }
                            else
                            {
                                goal.Update(g.Value, discipline, g.PeriodDays, g.Description, Users.Single(q => q.ID == g.OwnerId));
                            }

                            var users_goals = client.GetUsers_GoalsFromUser(CurrentUser.ID, goal.ID);
                            foreach (var userg in users_goals)
                            {
                                var user_goal = Users_Goals.SingleOrDefault(q => q.ID == userg.Id);
                                if (user_goal == null)
                                {
                                    user_goal = new User_Goal(userg.Id, CurrentUser, goal, userg.DateStart);
                                    Users_Goals.Add(user_goal);
                                }
                                else
                                {
                                    user_goal.Update(CurrentUser, goal, userg.DateStart);
                                }
                                var stand_datas = client.GetStandart_DataFromGoal(user_goal.Goal.ID);
                                foreach (var s in stand_datas)
                                {
                                    var stand = Standarts_Datas.SingleOrDefault(q => q.ID == s.Id);
                                    if (stand == null)
                                    {
                                        stand = new Standart_Data(s.Id, s.Value, user_goal.Goal, s.Day);
                                        Standarts_Datas.Add(stand);
                                    }
                                    else
                                    {
                                        stand.Update(s.Value, user_goal.Goal, s.Day);
                                    }
                                }
                                var users_data = client.GetUsers_DataFromGoal(userg.GoalId);
                                foreach (var us in users_data)
                                {
                                    var user_data = Users_Datas.SingleOrDefault(q => q.ID == us.Id);
                                    if (user_data == null)
                                    {
                                        user_data = new User_Data(us.Id, user_goal, us.Value, us.Date);
                                        Users_Datas.Add(user_data);
                                    }
                                    else
                                    {
                                        user_data.Update(user_goal, us.Value, us.Date);
                                    }
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception e)
            {
            }
            SaveBinaryFormat();
        }
Ejemplo n.º 30
0
 public int GetMark(Disciplines disciplines)
 {
     return(_marks[(int)disciplines]);
 }
Ejemplo n.º 31
0
        public ActionResult DeleteDiscipline(Disciplines discipline)
        {
            ViewBag.DeleteDisciplineResult = _repository.DeleteDiscipline(discipline.id);

            return(View("DeleteDiscipline", discipline));
        }
 public void AddDiscipline(Disciplines discipline)
 {
     this.Disciplines.Add(discipline);
 }