示例#1
0
 private void ShowDataMass_SelectedIndexChanged(object sender, EventArgs e)
 {
     Names.Items.Clear();
     DataMass.setData(ShowDataMass.SelectedIndex);
     for (int i = 0; i < Data.teacher.Count; i++)
     {
         Names.Items.Add(Data.teacher[i].name);
     }
     Names.SelectedIndex = 0;
 }
示例#2
0
        private void DeletData_Click(object sender, EventArgs e)
        {
            DialogResult result = MessageBox.Show("Данные будут потеряны. Удалить?", "удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (result == DialogResult.Yes)
            {
                DataMass.pop(ShowDataMass.SelectedIndex);
            }

            setShowDatatMass();
        }
示例#3
0
        public static void read()
        {
            if (!online)
            {
                return;
            }

            DataMass.saveAndClear("SQL");
            string reqest = "select id_user,pair,iseven, mon, tue, wed, thu, fri from _timeTable order by id_user;";
            List <List <string> > mass = sendRequest(reqest);
            int id = -1;
            int N  = -1;

            for (int i = 0; i < mass.Count; i++)
            {
                if (id.ToString() != mass[i][0])
                {
                    id = Convert.ToInt32(mass[i][0]);
                    string reqest2             = "select surname, name, secname from _users where id=" + id;
                    List <List <string> > name = sendRequest(reqest2);
                    if (name.Count > 0)
                    {
                        Data.teacher.Add(new formatTimeTable(name[0][0] + " " + name[0][1][0] + "." + name[0][2][0] + ".", 6));
                    }
                    N++;
                    for (int j = 0; j < 6; j++)
                    {
                        for (int k = 0; k < 6; k++)
                        {
                            Data.teacher[N].lesson[j, k] = new Lesson(0);
                        }
                    }
                }

                string chet = (Convert.ToInt32(mass[i][2]) + 1).ToString();
                for (int j = 3; j < 3 + 5; j++)
                {
                    Data.teacher[N].lesson[j - 3, Convert.ToInt32(mass[i][1]) - 1].fromString(chet + " " + mass[i][j]);
                }
            }
        }
示例#4
0
        public static void ReadFromFile(Object filename)
        {
            // String[] Names = new String[34] { "Александров А.А.", "Амосов А.А.", "Амосова О.А.", "Ахметшин А.А", "Бредихин Р.Н.", "Булычева О.Н.", " Вестфальский А.Е.", "Горелов В.А.", "Горицкий Ю.А.", "Григорьев В.П.", "Дубинский Ю.А.", "Дубовицкая Н.В.", "Жилейкин Я.М.", "Заславский А.А.", "Злотник А.А.", "Зубков П.В.", "Зубов В.С.", "Игнатьева Н.У.", "Ишмухаметов А.З.", "Казенкин К.О.", "Кирсанов М.Н.", "Князев А.В.", "Крупин Г.В.", "Кубышин С.Ю.", "Ляшенко Л.И.", "Мамонтов А.И.", "Макаров П.В.", "Мещанинов Д.Г.", "Набебин А.А.", "Перескоков А.В.", "Титов Д.А.", "Фролов А.Б.", "Черепова М.Ф.", "Шевченко И.В." };
            Form1.form.SetProc(0);

            Word.Application app = new Word.ApplicationClass();
            Word.Document    doc = new Word.DocumentClass();

            Object confirmConversions    = Type.Missing;
            Object readOnly              = Type.Missing;
            Object addToRecentFiles      = Type.Missing;
            Object passwordDocument      = Type.Missing;
            Object passwordTemplate      = Type.Missing;
            Object revert                = Type.Missing;
            Object writePasswordDocument = Type.Missing;
            Object writePasswordTemplate = Type.Missing;
            Object format                = Type.Missing;
            Object encoding              = Type.Missing;
            Object visible               = Type.Missing;
            Object openConflictDocument  = Type.Missing;
            Object openAndRepair         = Type.Missing;
            Object documentDirection     = Type.Missing;
            Object noEncodingDialog      = Type.Missing;

            doc = app.Documents.Open(ref filename, ref confirmConversions, ref readOnly, ref addToRecentFiles,
                                     ref passwordDocument, ref passwordTemplate, ref revert, ref writePasswordDocument, ref writePasswordTemplate,
                                     ref format, ref encoding, ref visible, ref openConflictDocument, ref openAndRepair, ref documentDirection, ref noEncodingDialog);

            if (doc.Tables.Count == 0)
            {
                //Err. TODOk
            }
            else
            {
                DataMass.saveAndClear(".doc");

                for (int i = 1; i <= doc.Tables.Count; i++)
                {
                    Form1.form.SetProc(i * 5 / doc.Tables.Count);
                    formatTimeTable buf = new formatTimeTable("", 6);
                    Word.Table      t   = doc.Tables[i];
                    for (int k = 2; k <= t.Columns.Count; k++)
                    {
                        for (int j = 2; j <= t.Rows.Count; j++)
                        {
                            string str = t.Cell(j, k).Range.Text;
                            Lesson A   = new Lesson(0);
                            A.italy = (t.Cell(j, k).Range.Italic != -1);
                            A.fromString(str);
                            if (j <= 6 && k < 7)
                            {
                                buf.lesson[k - 2, j - 2] = A;
                            }
                            //Записано.

                            if (t.Rows.Count < 8)
                            {
                                A = new Lesson(0);
                            }
                            A.fromString("");
                            buf.lesson[k - 2, j - 1] = A;
                        }
                    }

                    Data.teacher.Add(buf);
                }
            }
            //считывания имен
            int    StrI = 0;
            string txt;

            for (int i = 1; i <= doc.Paragraphs.Count; i++)
            {
                Form1.form.SetProc(5 + i * 95 / doc.Paragraphs.Count);
                txt = doc.Paragraphs[i].Range.Text;
                txt = FindName(txt);
                if (txt != "")
                {
                    Data.teacher[StrI++].name = txt;
                    i += 39;
                }
                //  if (Data.teacher.Count == StrI) break;
            }

            for (int i = 0; i < Data.teacher.Count; i++)
            {
                if (Data.teacher[i].name == "")
                {
                    Data.teacher.RemoveAt(i); i--;
                }
            }

            Object saveChanges    = Word.WdSaveOptions.wdSaveChanges;
            Object originalFormat = Type.Missing;
            Object routeDocument  = Type.Missing;

            app.Quit(ref saveChanges, ref originalFormat, ref routeDocument);

            return;
        }