public void ShowSchedule()
        {
            ScheduleView scheduleView = new ScheduleView();

            scheduleView.Show();
            CloseMainMenu();
        }
예제 #2
0
        private void BtnLogin_Click(object sender, RoutedEventArgs e)
        {
            PersonInfo user = Db.Login(SQL.ConString, TbAccount.Text, TbPassword.Password, Globals.AUTH_ADMINISTRATOR);

            if (user != null)
            {
                MessageBox.Show($"Welcome, { user.FullName }", "Welcome", MessageBoxButton.OK, MessageBoxImage.Information);
                ScheduleView sView = new ScheduleView();
                sView.Show();

                this.Close();
            }
            else
            {
                MessageBox.Show("Invalid Username/Password!");
            }
        }
예제 #3
0
        private void Schedule()
        {
            var newForm = new ScheduleView();

            newForm.Show();
        }
        private void getData()
        {
            Course data = new Course();
            string r    = "";

            try
            {
                if (String.IsNullOrEmpty(SelectedCourse))
                {
                    MessageBox.Show("Please Select a Course Work");
                }
                else
                {
                    data          = scrapeDataFromURL(URL, SelectedCourse);
                    CurrentCourse = data;
                    //CourseData = data.Name + " | " + data.SemesterList.SelectMany(p => p.SubjectList.Select(s => s.Name + " | " + s.Units+" | "+ p.SemesterName+" | "+p.TotalUnits));

                    /*var r = from sem in data.SemesterList
                     *      from sub in sem.SubjectList
                     *      select new { data = sem.SemesterName+" | "+sem.TotalUnits+" | "+sub.Name+" | "+sub.Units};*/

                    int index = Array.IndexOf(ApplicationConstants.SemesterList, SelectedSem);
                    if (index != 0)
                    {
                        index = index - 1;
                    }
                    foreach (var sem in data.SemesterList)
                    {
                        foreach (var sub in sem.SubjectList)
                        {
                            if (ApplicationConstants.CourseTitles.Any(s => sub.Name.ToUpper().Contains(s)))
                            {
                                //checking for GE-B2 type of string in the string for general education courses
                                var temp = (Regex.IsMatch(sub.Name, @"GE\-[A-Z]\d") || sub.Name.Contains("Written") || sub.Name.Contains("Oral"));

                                var subName = ApplicationConstants.CourseTitles.Where(s => sub.Name.ToUpper().Contains(s)).FirstOrDefault().ToUpper();

                                //if(subName.ToString()=="N")
                                //{
                                //    subName = "NRSG";
                                //}
                                if (!temp)
                                {
                                    //if subject is not GE course then extract string as follows
                                    //special accomodation for subjects like CHEM111A , MATH119A, PHYS100A, CHEM 320A, CHEM371A extract 4 length substring instead of three for usual subjects
                                    var tempCode = Regex.Replace(sub.Name, @"[^0-9]+", "").Substring(0, 3);
                                    if ((subName == "CHEM" && (tempCode == "111" || tempCode == "320" || tempCode == "371")) ||
                                        (subName == "MATH" && tempCode == "119") ||
                                        (subName == "PHYS" && tempCode == "100"))
                                    {
                                        var code = sub.Name.Substring(4, 4);
                                        sub.Title = subName + code;
                                    }
                                    else
                                    {
                                        var code = Regex.Replace(sub.Name, @"[^0-9]+", "").Substring(0, 3);
                                        sub.Title = subName + code;
                                    }
                                }
                                else
                                {
                                    // var code = "NA";
                                    sub.Title = "ALIEN";
                                }
                            }
                        }
                    }

                    //addGEDataToRoadmap();

                    foreach (var sub in data.SemesterList[index].SubjectList)
                    {
                        if (sub.Title != null)
                        {
                            r += data.SemesterList[index].SemesterName + " | " + data.SemesterList[index].TotalUnits + " | " + sub.Name + " | " + sub.Title + " | " + sub.Units + " \n ";
                        }
                    }



                    CourseData = data.Name + "\n" + " | " + r.ToString();

                    string path = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), @"New Job\schedule\" + SelectedSem + SelectedYear + ".csv");
                    using (CsvReader csv = new CsvReader(File.OpenText(path)))
                    {
                        csv.Configuration.RegisterClassMap <ScheduleMap>();
                        IEnumerable <ScheduleReportItem> dataReport = csv.GetRecords <ScheduleReportItem>().ToList();
                        Schedule = dataReport.ToList();

                        CurrentSchedule = new Schedule()
                        {
                            SemID = 1, SemScheduleReport = Schedule
                        };
                    }
                }


                Window schd = new ScheduleView();
                schd.DataContext = new ScheduleViewModel(CurrentSchedule);
                schd.Show();
                //Schedule = CSVHelper.getDataFromScheduleCSV(@"C:\Users\Neha\Desktop\ScheduleFall2006.csv");
            }
            catch (Exception ex)
            {
                string s = ex.Message;
            }
        }