Example #1
0
        public void NextParser(char type)
        {
            //type=='m'- колледж+мага
            //type=='b'- основное - бакалавры
            int     flag = 0; int inputcounter = 0;
            Teacher temp = new Teacher();

            for (int i = 0; i < mass.Count; i++)
            {
                if (mass[i] != null && mass[i].Length > 10)
                {
                    if (mass[i].Substring(0, 10) == "Расписание")
                    {
                        temp = new Teacher();
                        string tmpname = mass[i].Substring(mass[i].IndexOf(':') + 2, mass[i].Length - mass[i].IndexOf(':') - 2);
                        temp.setname(tmpname);
                        flag         = 1;
                        inputcounter = 0;
                    }
                }
                if (flag > 0)
                {
                    int plus;
                    if (flag == 1)
                    {
                        plus = 0;
                    }
                    else
                    {
                        plus = 6;
                    }
                    ////////////////////////////////////////////////
                    if (mass[i] == "Пнд" || mass[i] == "Втр" || mass[i] == "Срд" || mass[i] == "Чтв" || mass[i] == "Птн" || mass[i] == "Сбт")
                    {
                        int dayNumber = 0;
                        if (mass[i] == "Втр")
                        {
                            dayNumber = 1;
                        }
                        if (mass[i] == "Срд")
                        {
                            dayNumber = 2;
                        }
                        if (mass[i] == "Чтв")
                        {
                            dayNumber = 3;
                        }
                        if (mass[i] == "Птн")
                        {
                            dayNumber = 4;
                        }
                        if (mass[i] == "Сбт")
                        {
                            dayNumber = 5;
                        }

                        for (int tmpi = 0; tmpi < 6; tmpi++)
                        {
                            i++;
                            if (mass[i].Contains('_'))
                            {
                                mass[i] = "       ";
                            }
                            else
                            {
                                record temprec = takeapart(mass[i]);
                                try
                                {
                                    if ((temprec.group[0] == 'К' || temprec.group[0] == 'K' || temprec.group[1] == 'К' || temprec.group[1] == 'K') && colledge == false)
                                    {
                                        break;
                                    }
                                }
                                catch
                                {
                                    break;
                                }
                                temprec.teacher = temp.getname();
                                ////////////////////////////////
                                if (type == 'b')
                                {
                                    temp.setsubject(temprec.toTeacher(), dayNumber + plus, tmpi);
                                }
                                ///////////////////////////////
                                else if (temprec.group[0] == 'К' || temprec.group[0] == 'K' || temprec.group[1] == 'К' || temprec.group[1] == 'K' || temprec.group[0] == 'М' || temprec.group[1] == 'М')
                                {
                                    bool checkflag1 = true;


                                    for (int search = 0; search < Tmass.Count; search++)
                                    {
                                        if (temp.getname() == Tmass[search].getname())
                                        {
                                            Tmass[search].setsubject(temprec.toTeacher(), dayNumber + plus, tmpi);
                                            checkflag1 = false;
                                        }
                                    }

                                    if (checkflag1)
                                    {
                                        temp.setsubject(temprec.toTeacher(), dayNumber + plus, tmpi);
                                        inputcounter++;
                                    }
                                }
                                ///////////////////////////////////////////////////
                                if (type == 'b' || inputcounter > 0)
                                {
                                    /*   */
                                    if (Auditor.Contains(temprec.aud))
                                    {
                                        for (int tempi = 0; tempi < Aud.Count(); tempi++)
                                        {
                                            if (Aud[tempi].name == temprec.aud)
                                            {
                                                Aud[tempi].setsubject(temprec.toAud(), dayNumber + plus, tmpi);
                                                break;
                                            }
                                        }
                                    }
                                    else
                                    {
                                        Auditor tempaud = new Auditor();
                                        tempaud.setname(temprec.aud);
                                        tempaud.setsubject(temprec.toAud(), dayNumber + plus, tmpi);
                                        Aud.Add(tempaud);
                                    }
                                }

                                ///////////////////////////////////////////////////
                            }
                        }
                        /*  Record of a Teacher */
                        if (dayNumber == 5)
                        {
                            if (flag == 1)
                            {
                                flag = 2;
                            }
                            //else if(type=='b')
                            else if (inputcounter > 0 || type == 'b')
                            {
                                flag = 0;
                                Tmass.Add(temp);
                            }
                        }
                        /*  ------------------- */
                    }
                    ///////////////////////
                }
            }
        }