Exemple #1
0
 public Group(List <string> file)
 {
     string[] tmp = file[0].Split(';');
     for (int i = 3; i < tmp.Length; i++)
     {
         Subjects.Add(new Subject()
         {
             Name = tmp[i], Ball = 0
         });
     }
     file.RemoveAt(0);
     foreach (string p in file)
     {
         tmp = p.Split(";");
         Person person = new Person()
         {
             Surname = tmp[0], Name = tmp[1], Patronymic = tmp[2]
         };
         for (int i = 3; i < tmp.Length; i++)
         {
             person.Ball          += Convert.ToDouble(tmp[i]);
             Subjects[i - 3].Ball += Convert.ToDouble(tmp[i]);
         }
         person.Ball /= (tmp.Length - 3);
         Persons.Add(person);
     }
     foreach (Subject subject in Subjects)
     {
         subject.Ball /= Persons.Count;
     }
     Ball = Subjects.Sum(p => p.Ball) / Subjects.Count;
 }
Exemple #2
0
 internal void AddSubject(string subject)
 {
     if (!Subjects.ContainsKey(subject))
     {
         Subjects.Add(subject, new SubjectRow(subject));
     }
 }
Exemple #3
0
 /// <summary>
 /// Adds a subject name to the list of assigned subjects, if it is not already in the list.
 /// </summary>
 /// <param name="subject">The name of the subject to add.</param>
 public void AddSubject(string subject)
 {
     if (!Subjects.Contains(subject))
     {
         Subjects.Add(subject);
     }
 }
Exemple #4
0
 public ArtifactData(MainObject main)
 {
     LrsId               = main.MainId.Value;
     OwnerEmployeeId     = main.OwnerEmployeeId;
     OwnerName           = main.OwnerName;
     OwnerEmail          = main.OwnerEmail;
     ReviewStatus        = "Approved";//main.ReviewStatus;
     ReviewProgress      = (int)main.ReviewPercent;
     DocumentType        = main.DocumentType;
     Title               = main.Title;
     StiNumber           = main.StiNumber;
     Revision            = main.Revision;
     CreateDate          = main.CreateDate;
     ModifiedDate        = main.ActivityDate;
     ApprovedDate        = main.ApprovalDate;
     Abstract            = main.Abstract;
     ConferenceName      = main.ConferenceName;
     ConferenceSponsor   = main.ConferenceSponsor;
     ConferenceLocation  = main.ConferenceLocation;
     ConferenceBeginDate = main.ConferenceBeginDate;
     ConferenceEndDate   = main.ConferenceEndDate;
     JournalName         = main.JournalName;
     RelatedSti          = main.RelatedSti;
     main.Contacts.ForEach(n => Contacts.Add(new ContactData(n)));
     main.Authors.ForEach(n => Authors.Add(new AuthorData(n)));
     main.Funding.ForEach(n => Fundings.Add(new FundingData(n)));
     main.Reviewers.ForEach(n => Reviewers.Add(new ReviewerData(n)));
     main.SubjectCategories.ForEach(n => Subjects.Add(n.Data));
     main.KeyWordList.ForEach(n => Keywords.Add(n.Data));
     main.CoreCapabilities.ForEach(n => CoreCapabilities.Add(n.Data));
 }
        public void ScheduleEvent(string name, IEventSubject subject, TimeSpan when, Action <IMultiPlayerServer> action, [CallerMemberName] string source = null)
        {
            if (!Constants.IgnoredEvents.Contains(name))
            {
                var subjectLine = subject != null ? $" on subject {subject?.GetType().Name}" : string.Empty;
                var sourceLine  = source != null ? $" from '{source}'" : string.Empty;
                Server.Trace.TraceEvent(TraceEventType.Verbose, 0, $"scheduling event '{name}'{subjectLine}{sourceLine}");
            }

            if (DisabledEvents.Contains(name))
            {
                return;
            }

            var due = Stopwatch.ElapsedTicks + when.Ticks;

            if (subject != null && !Subjects.Contains(subject))
            {
                Subjects.Add(subject);
                subject.Disposed += Subject_Disposed;
            }

            var queue = when.TotalSeconds > 3 ? LaterEventQueue : ImmediateEventQueue;

            queue.Enqueue(new ScheduledEvent
            {
                Name    = name,
                Subject = subject,
                When    = due,
                Action  = action
            });
        }
Exemple #6
0
 public void ScheduleEvent(string name, IEventSubject subject, TimeSpan when, Action <IMultiplayerServer> action)
 {
     lock (EventLock)
     {
         long _when = Stopwatch.ElapsedTicks + when.Ticks;
         if (!Subjects.Contains(subject))
         {
             Subjects.Add(subject);
             subject.Disposed += Subject_Disposed;
         }
         int i;
         for (i = 0; i < Events.Count; i++)
         {
             if (Events[i].When > _when)
             {
                 break;
             }
         }
         Events.Insert(i, new ScheduledEvent
         {
             Name    = name,
             Subject = subject,
             When    = _when,
             Action  = action
         });
     }
 }
Exemple #7
0
 public void AddSubject(ISubject subject)
 {
     if (subject == null)
     {
         throw new ArgumentNullException(nameof(subject));
     }
     Subjects.Add(subject);
 }
        public override void AssignSubjects()
        {
            IUnitOfWork unitOfWork = new UnitOfWork(new LogDbContext());
            var         subjects   = unitOfWork.Subjects.GetAll().ToList();

            Subjects.Add(subjects[1]);
            Subjects.Add(subjects[3]);
        }
Exemple #9
0
        static void Main(string[] args)
        {
            Subjects subjects = new Subjects();

            try
            {
                Theory t1 = new Theory();
                t1.ID    = 1;
                t1.Name  = "Theory subject1";
                t1.Marks = 150;

                Lab l1 = new Lab();
                Console.WriteLine("Enter subject id");
                l1.ID        = Convert.ToInt32(Console.ReadLine());
                l1.Name      = "Lab1";
                l1.Internals = 30;

                subjects.Add(t1);
                subjects.Add(l1);

                foreach (Subject item in subjects.GetAllSubjets())
                {
                    Console.WriteLine(item.Name);
                }

                MyGenericClass <int, Subject> myGenericClass = new MyGenericClass <int, Subject>();
            }
            catch (DuplicateKeyException ex)
            {
                Console.WriteLine(ex.Message);
            }
            catch (FormatException ex)
            {
                Console.WriteLine(ex.Message);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }finally
            {
                Console.WriteLine("Always executed");
                Console.ReadLine();
            }
        }
Exemple #10
0
        public static Subjects MakeSubjectsFrom(this Table table)
        {
            var sub = new Subjects();

            foreach (var tSub in table.Values)
            {
                sub.Add(tSub.Table.MakeSubjectFrom());
            }
            return(sub);
        }
Exemple #11
0
        public async void add(Subject subject)
        {
            // Perform the save operation on the database,
            // and update the model with the newly created ID.
            subject.Id = await _databaseService.SaveSubject(subject);

            // Keep the observable collection up to date.
            Subjects.Add(subject);
            OnPropertyChanged("Subjects");
        }
        /// <summary>
        /// Fills all the Dropdown lists with Data from the database
        /// </summary>
        /// <param name="context"></param>
        /// <param name="logger"></param>
        public void FillAllDropdowns(DataContext context, ILogger logger)
        {
            List <DtFieldOfStudies> fieldsOfStudies = new List <DtFieldOfStudies>();
            List <DtSubject>        subjects        = new List <DtSubject>();
            List <DtFederalState>   federalStates   = new List <DtFederalState>();
            List <DtUniversity>     universities    = new List <DtUniversity>();

            try
            {
                // get entries from db
                fieldsOfStudies = context.FieldsOfStudies.OrderBy(f => f.FieldOfStudiesName).ToList();
                subjects        = context.Subjects.OrderBy(s => s.SubjectName).ToList();
                federalStates   = context.FederalStates.OrderBy(f => f.FederalStateName).ToList();
                universities    = context.Universities.OrderBy(u => u.UniversityName).ToList();
            }
            catch (Exception ex)
            {
                logger.LogError(ex, "Error while loading Dropdown entries from the Database");
            }

            // fill SelectLists
            foreach (var item in fieldsOfStudies)
            {
                FieldsOfStudies.Add(new SelectListItem
                {
                    Value = item.FieldOfStudiesID.ToString(),
                    Text  = item.FieldOfStudiesName
                });
            }
            foreach (var item in subjects)
            {
                Subjects.Add(new SelectListItem
                {
                    Value = item.SubjectID.ToString(),
                    Text  = item.SubjectName
                });
            }
            foreach (var item in federalStates)
            {
                FederalStates.Add(new SelectListItem
                {
                    Value = item.FederalStateID.ToString(),
                    Text  = item.FederalStateName
                });
            }
            foreach (var item in universities)
            {
                Universities.Add(new SelectListItem
                {
                    Value = item.UniversityID.ToString(),
                    Text  = item.UniversityName
                });
            }
        }
Exemple #13
0
        public void addSubjects(int numSubjects)
        {
            Random rGrade = new Random();

            for (int i = 1; i <= numSubjects; ++i)
            {
                int index = i;
                int grade = rGrade.Next(6, 11);
                Subjects.Add(new Subject(string.Format("Предмет {0}", index), grade));
            }
        }
 public void ClearData()
 {
     Teachers.Clear();
     Lessons.Clear();
     Forms.Clear();
     Groups.Clear();
     Subjects.Clear();
     YearGroups.Clear();
     YearGroups.Add(NoneYear);
     Subjects.Add(NoneSubject);
 }
Exemple #15
0
 public void AddSubject(ISubject subject)
 {
     if (subject == null)
     {
         throw new ArgumentNullException();
     }
     if (!Subjects.Contains(subject))
     {
         Subjects.Add(subject);
     }
 }
Exemple #16
0
 public void AddSubjects(List <ISubject> subjects)
 {
     if (subjects == null)
     {
         throw new ArgumentNullException(nameof(subjects));
     }
     foreach (var s in subjects)
     {
         Subjects.Add(new Subject(s.NameSubject, s.SubjectType, s.NameTeacher));
     }
 }
Exemple #17
0
        void ReplaceWorst(Subject ChildA, Subject ChildB)
        {
            Subjects.Remove(Subjects.First());
            Subjects.Remove(Subjects.First());

            ChildA.CalculateFitnessValue();
            ChildB.CalculateFitnessValue();
            Subjects.Add(ChildA);
            Subjects.Add(ChildB);
            OrderList();
        }
        private void Add(object param)
        {
            Subject newSubject = new Subject(_abbrevation, _weeks, _lectureHours, _exerciseHours, _semminarHours, _courseCompletionType, _language, _sizeOfGroup, SelectedGroups);

            Subjects.Add(newSubject);
            _selectedSubject = newSubject;


            _mainWindow.Subjects.Add(newSubject);
            _mainWindow.InputParameters.Subjects.Add(newSubject);
        }
        public SubjectDelivery AddSubjectDelivery(String name, string description, CourseDelivery courseDelivery)
        {
            if (this.Subjects.Select(s => s.Name).Contains(name, StringComparer.OrdinalIgnoreCase))
            {
                throw new InvalidOperationException("Subject with the same name already exists");
            }

            var subject = new SubjectDelivery(name, description, courseDelivery);

            Subjects.Add(subject);
            return(subject);
        }
        private async void NewSubjectOnClick(object obj)
        {
            var dialogViewModel = new CreateOrEditSubjectDialogViewModel();

            if (dialogViewModel.ShowDialog() == true)
            {
                var subject = new Subject(dialogViewModel.SubjectName, dialogViewModel.SubjectCredit);

                Subjects.Add(subject);
                await _subjectService.AddSubjectAsync(subject);
            }
        }
Exemple #21
0
 void GenerateRandomPopulation()
 {
     for (int i = 0; i < PopulationSize; i++)
     {
         Subject tempSubject = new Subject(BoardSize);
         tempSubject.Board = RandomGenerator();
         tempSubject.CalculateFitnessValue();
         Subjects.Add(tempSubject);
     }
     OrderList();
     CurrentEvaluation = PopulationSize;
 }
        public async Task <List <RozkladLesson>[]> GetTimetable()
        {
            try
            {
                await InitRequest();
            }
            catch (Exception e)
            {
            }
            //Group selection
            Timetable.AddNew("ctl00$MainContent$ctl00$txtboxGroup", Group);
            message = new HttpRequestMessage();
            SetHeaders();
            message.Headers.AddIfNotExists("Referer", "http://rozklad.kpi.ua/Schedules/ScheduleGroupSelection.aspx");
            message.Method     = HttpMethod.Post;
            message.RequestUri = new Uri("http://rozklad.kpi.ua/Schedules/ScheduleGroupSelection.aspx");
            Timetable.AddIfNotExists("ctl00$MainContent$ctl00$btnShowSchedule", "Розклад занять");
            message.Content = new FormUrlEncodedContent(Timetable);
            var response = await client.SendAsync(message).Result.Content.ReadAsStringAsync();

            var document = new HtmlDocument();

            document.LoadHtml(response);
            var result = new List <RozkladLesson> [2];

            result[0] = ParseTable(document.DocumentNode.SelectSingleNode($@"//table[@id='{FirstWeek}']"), true);
            result[1] = ParseTable(document.DocumentNode.SelectSingleNode($@"//table[@id='{SecondWeek}']"), false);
            foreach (var item in result[0])
            {
                if (!Teachers.Exists(t => t.Name == item.Teacher.Name))
                {
                    Teachers.Add(item.Teacher);
                }
                if (!Subjects.Exists(t => t.Title == item.Subject.Title))
                {
                    Subjects.Add(item.Subject);
                }
            }
            foreach (var item in result[1])
            {
                if (!Teachers.Exists(t => t.Name == item.Teacher.Name))
                {
                    Teachers.Add(item.Teacher);
                }
                if (!Subjects.Exists(t => t.Title == item.Subject.Title))
                {
                    Subjects.Add(item.Subject);
                }
            }
            RozkladTimeTable = result;
            return(result);
        }
        private void SubjectTextBox_DropDownOpened(object sender, EventArgs e)
        {
            var ownerEditorWindowInstance = (this.Owner as LessonsWindow).Owner as EditorWindow;
            var data = ownerEditorWindowInstance.HomePage.SubjectsWindowInstance?.SubjectsList.Items;

            if (data != null)
            {
                foreach (var item in data)
                {
                    Subjects.Add(item as SchoolSubject);
                }
            }
        }
Exemple #24
0
 private Subject(string name, Type type, string img)
 {
     if (type == null)
     {
         throw new ArgumentException("Type of subject class is null!");
     }
     Name    = name;
     Details = "Przejdź";
     Img     = img;
     Base    = (SubjectBase)Activator.CreateInstance(type, this);
     Subjects.Add(Base.SubjectType, this);
     CoreManager.Current.App.SubjectPages.Add(Base.SubjectType, new Dictionary <NavPageType, Page>());
 }
Exemple #25
0
 void GenerateRandomPopulation()
 {
     for (int i = 0; i < PopulationSize; i++)
     {
         Subject tempSubject = new Subject(DValue, FunctionValue);
         tempSubject.SeriesValues = RandomGenerator();
         tempSubject.CalculateFitnessValue();
         Subjects.Add(tempSubject);
         CurrentEvaluation++;
     }
     OrderList();
     CurrentEvaluation = PopulationSize;
 }
        public GradesWindowViewModel()
        {
            //Pobranie i wyświetlenie przedmiotów i ocen z BD
            using (var context = new StudentAppContext())
            {
                var subjects = context.DBSubjects.ToList();
                foreach (DBSubject dbs in subjects)
                {
                    BindableCollection <GradeModel> gm = new BindableCollection <GradeModel>();
                    if (dbs.Marks != null)
                    {
                        var dbmarks = context.DBMarks.ToList().Where(x => x.DBSubject == dbs);
                        foreach (DBMark mark in dbmarks)
                        {
                            gm.Add(new GradeModel
                            {
                                GradeId    = mark.DBMarkId,
                                Date       = mark.Date,
                                GradeValue = mark.Mark
                            });
                        }
                    }
                    Subjects.Add(new SubjectModel
                    {
                        SubjectName = dbs.SubjectName,
                        Grades      = gm
                    });
                }
            }

            TypesOfGrades.Add("sprawdzian");
            TypesOfGrades.Add("kartkówka");
            TypesOfGrades.Add("odpowiedź ustna");
            TypesOfGrades.Add("zadanie");
            TypesOfGrades.Add("aktywność");
            TypesOfGrades.Add("inne");

            Subjects.Add(new SubjectModel
            {
                SubjectName = "Fizyka",
                Grades      = new BindableCollection <GradeModel>()
                {
                    new GradeModel {
                        Date = DateTime.Now, GradeValue = 5
                    },
                    new GradeModel {
                        Date = DateTime.Now, GradeValue = 2
                    },
                }
            });
        }
Exemple #27
0
        /**
         * Add subject to database if it does not already exist
         * and returns their enumerated id.
         */
        public int AddSubject(string sname)
        {
            int i;

            for (i = 0; i < Subjects.Count; i++)
            {
                if (Subjects[i] == sname)
                {
                    return(i);
                }
            }

            Subjects.Add(sname);
            return(i);
        }
        private void UpdateChangeSubject(object sender, CancelEventArgs e)
        {
            List <Subject> collection = new List <Subject>();

            foreach (var item in Subjects)
            {
                collection.Add(item);
            }
            Subjects.Clear();
            foreach (var item in collection)
            {
                Subjects.Add(item);
            }
            DataManager.Save(Subjects, "Subjects.xml");
        }
        public ActionResult Add(string nameSubject, string description)
        {
            if (string.IsNullOrEmpty(nameSubject))
            {
                ViewBag.Error = "Vui lòng nhập tên môn học.";
                return(RedirectToAction("Index"));
            }

            string newId = this.GetNextIDSubject();

            description = description.Length == 0 ? nameSubject : description;

            subject.Add(newId, nameSubject.Trim(), description.Trim());
            subjecUser.Add(newId, Session["IDLogin"] + "");
            return(RedirectToAction("Index"));
        }
        private async Task LoadData()
        {
            if (_isLoaded)
            {
                return;
            }

            _isLoaded = true;

            var students = await _subjectManage.GetItemAsync();

            foreach (var s in students)
            {
                Subjects.Add(s);
            }
        }