Esempio n. 1
0
        public void Add()
        {
            int countTextBox  = 0;
            int countCombobox = 0;

            foreach (var item in this.Controls)
            {
                if (item is TextBox)
                {
                    if ((item as TextBox).Text == string.Empty)
                    {
                        if ((item as TextBox).Name != "label10")
                        {
                            countTextBox++;
                        }
                    }
                }
                if (item is ComboBox)
                {
                    if ((item as ComboBox).Text == string.Empty)
                    {
                        countCombobox++;
                    }
                }
            }
            if (countTextBox != 0 || countCombobox != 0)
            {
                MessageBox.Show("Не все поля заполнены");
            }
            else
            {
                var field = new string[]
                {
                    "Шифр",
                    "КодПредмета",
                    "Оценка",
                    "НаличиеКР",
                    "ОценкаКР"
                };
                var values = new string[]
                {
                    ozenkiChipher.Text,
                    Datebase.GetSubjectID(ozenkiSubject.Text).ToString(),
                    ozenkiOzenka.Text,
                    thisIsKR.Checked ? "Да" : "Нет",
                    ozenkiCourse.Text
                };
                Datebase.InsertData("Успеваемость", field, values);
                (this.Owner as MainForm).LoadDataInOzenkiDataTable();
                this.Close();
            }
        }
Esempio n. 2
0
        public void Add()
        {
            int countTextBox  = 0;
            int countCombobox = 0;

            foreach (var item in this.Controls)
            {
                if (item is TextBox)
                {
                    if ((item as TextBox).Text == string.Empty)
                    {
                        countTextBox++;
                    }
                }
                if (item is ComboBox)
                {
                    if ((item as ComboBox).Text == string.Empty)
                    {
                        countCombobox++;
                    }
                }
            }
            if (countTextBox != 0 || countCombobox != 0)
            {
                MessageBox.Show("Не все поля заполнены");
            }
            else
            {
                var field = new string[]
                {
                    "Шифр",
                    "Тема",
                    "Руководитель",
                    "СрокиСдачи",
                    "Выдан",
                    "Сдан"
                };
                var values = new string[]
                {
                    diplomShifr.Text,
                    diplomName.Text,
                    Datebase.GetPrepodID(diplomPropod.Text).ToString(),
                    diplomSroki.Text,
                    diplomOut.Text,
                    diplomIn.Text
                };
                Datebase.InsertData("Диплом", field, values);
                (this.Owner as MainForm).LoadDataInDiplomDataTable();
                this.Close();
            }
        }
Esempio n. 3
0
        public void Add()
        {
            int countTextBox  = 0;
            int countCombobox = 0;

            foreach (var item in this.Controls)
            {
                if (item is TextBox)
                {
                    if ((item as TextBox).Text == string.Empty)
                    {
                        countTextBox++;
                    }
                }
                if (item is ComboBox)
                {
                    if ((item as ComboBox).Text == string.Empty)
                    {
                        countCombobox++;
                    }
                }
            }
            if (countTextBox != 0 || countCombobox != 0)
            {
                MessageBox.Show("Не все поля заполнены");
            }
            else
            {
                var field = new string[]
                {
                    "НаименованиеПредмета",
                    "КоличествоЧасов",
                    "КодПреподавателя",
                    "Курс"
                };
                var values = new string[]
                {
                    subjectName.Text,
                    subjectHours.Text,
                    Datebase.GetPrepodID(subjectPropod.Text).ToString(),
                    subjectCourse.Text
                };
                Datebase.InsertData("Предметы", field, values);
                (this.Owner as MainForm).LoadDataInSubjectDataTable();
                this.Close();
            }
        }
Esempio n. 4
0
        public void Add()
        {
            int countTextBox  = 0;
            int countCombobox = 0;

            foreach (var item in this.Controls)
            {
                if (item is TextBox)
                {
                    if ((item as TextBox).Text == string.Empty)
                    {
                        countTextBox++;
                    }
                }
                if (item is ComboBox)
                {
                    if ((item as ComboBox).Text == string.Empty)
                    {
                        countCombobox++;
                    }
                }
            }
            if (countTextBox != 0 || countCombobox != 0)
            {
                MessageBox.Show("Не все поля заполнены");
            }
            else
            {
                var field = new string[]
                {
                    "НомерГруппы",
                    "КодСпециальности",
                    "ГодПоступления"
                };
                var values = new string[]
                {
                    groupNumber.Text,
                    Datebase.GetSpecID(groupSpec.Text).ToString(),
                    groupYearIn.Text
                };
                Datebase.InsertData("Группы", field, values);
                (this.Owner as Groups).LoadDataInGroupsDataTable();
                this.Close();
            }
        }
Esempio n. 5
0
        public void Add()
        {
            int countTextBox = 0;

            foreach (var item in this.Controls)
            {
                if (item is TextBox)
                {
                    if ((item as TextBox).Text == string.Empty)
                    {
                        countTextBox++;
                    }
                }
            }
            if (countTextBox != 0)
            {
                MessageBox.Show("Не все поля заполнены");
            }
            else
            {
                var field = new string[]
                {
                    "Шифр",
                    "УчебныйГод",
                    "Курс",
                    "НомерПриказа",
                    "ДатаПриказа"
                };
                var values = new string[]
                {
                    shi.Text,
                    moveLearningYear.Text,
                    moveCourse.Text,
                    moveNumber.Text,
                    Convert.ToDateTime(moveDate.Text).ToString()
                };
                Datebase.InsertData("Движение", field, values);
                (this.Owner as MainForm).LoadDataInMoveDataTable();
                this.Close();
            }
        }
Esempio n. 6
0
        public CronJobRepository(MongoClient mongoClient) : base(mongoClient)
        {
            Context = Datebase.GetCollection <CronJob>("CronJobs");

            //如果每次实例化仓储都要执行这个,感觉也是性能不够好,所以还是让dba去创建把。或者把这个写到程序Start up位置
            //var indexBuilder = Builders<CronJob>.IndexKeys;
            //var keys = indexBuilder.Ascending("Name");
            //var options = new CreateIndexOptions
            //{
            //    Name = "idx_name",
            //};
            //var indexModel = new CreateIndexModel<CronJob>(keys, options);
            //Context.Indexes.CreateOneAsync(indexModel).ConfigureAwait(false).GetAwaiter().GetResult();

            //var notificationLogBuilder = Builders<CronJob>.IndexKeys;
            //var indexModel1 = new CreateIndexModel<CronJob>(notificationLogBuilder.Ascending(x => x.Name));
            //var a = Context.Indexes.CreateOneAsync(indexModel1).ConfigureAwait(false).GetAwaiter().GetResult();

            //var indexModel = Builders<CronJob>.IndexKeys.Ascending(_ => _.Name);
            //var a = Context.Indexes.CreateOneAsync(indexModel).ConfigureAwait(false).GetAwaiter().GetResult();
        }
Esempio n. 7
0
 private void save_Click(object sender, EventArgs e)
 {
     (this.Owner as MainForm).UpdateDataInSelfDataTable(
         new string[]
     {
         "Шифр",
         "КодГруппы",
         "ФИО",
         "Пол",
         "ДатаРождения",
         "ДомашнийАдрес",
         "Телефон",
         "МестоРаботы",
         "ИзучаемыйЯзык",
         "Образование",
         "Статус"
     },
         new string[]
     {
         cipher.Text,
         Datebase.GetGroupID(group.Text).ToString(),
         fio.Text,
         genderF.Checked ? genderF.Text : genderM.Text,
         Convert.ToDateTime(birthday.Text).ToString(),
         adress.Text,
         phone.Text,
         jobPlace.Text,
         languageE.Checked ? languageE.Text : (languageF.Checked ? languageF.Text : languageN.Text),
         education.Text,
         status.Text
     },
         new string[]
     {
         this.ID
     }
         );
     (this.Owner as MainForm).LoadDataInSelfDataTable();
     this.Close();
 }
Esempio n. 8
0
        public void Add()
        {
            int countTextBox = 0;

            foreach (var item in this.Controls)
            {
                if (item is TextBox)
                {
                    if ((item as TextBox).Text == string.Empty)
                    {
                        countTextBox++;
                    }
                }
            }
            if (countTextBox != 0)
            {
                MessageBox.Show("Не все поля заполнены");
            }
            else
            {
                var field = new string[]
                {
                    "Фамилия",
                    "Имя",
                    "Отчество"
                };
                var values = new string[]
                {
                    prepodLastName.Text,
                    prepodName.Text,
                    prepodMiddleName.Text,
                };
                Datebase.InsertData("Преподаватели", field, values);
                (this.Owner as Prepod).LoadDataInPrepodDataTable();
                this.Close();
            }
        }
Esempio n. 9
0
        public EditDiplomData(string[] values)
        {
            InitializeComponent();

            this.Load += (f, a) =>
            {
                diplomPropod.Items.Clear();

                using (var connec = new OleDbConnection(Properties.Settings.Default.connect))
                {
                    connec.Open();
                    using (var cmd = connec.CreateCommand())
                    {
                        cmd.CommandText = "SELECT [Фамилия], [Имя], [Отчество] " +
                                          "FROM [Преподаватели]";
                        using (var reader = cmd.ExecuteReader())
                        {
                            while (reader.Read())
                            {
                                diplomPropod.Items.Add(reader[0].ToString() + " " + reader[1].ToString() + " " + reader[2].ToString());
                            }
                        }
                    }
                }
            };
            this.Load += (f, a) =>
            {
                this.ID = values[0];

                diplomName.Text   = values[1];
                diplomPropod.Text = values[2];
                diplomSroki.Text  = values[3];
                diplomIn.Text     = values[4];
                diplomOut.Text    = values[5];
            };

            save.Click += (f, a) =>
            {
                (this.Owner as MainForm).UpdateDataInDiplomDataTable(
                    new string[]
                {
                    "Тема",
                    "Руководитель",
                    "СрокиСдачи",
                    "Выдан",
                    "Сдан"
                },
                    new string[]
                {
                    diplomName.Text,
                    Datebase.GetPrepodID(diplomPropod.Text).ToString(),
                    diplomSroki.Text,
                    diplomIn.Text,
                    diplomOut.Text
                },
                    new string[]
                {
                    this.ID
                }
                    );
                (this.Owner as MainForm).LoadDataInDiplomDataTable();
                this.Close();
            };
            cancel.Click += (f, a) => this.Close();
        }
Esempio n. 10
0
        public EditSubjectData(string[] values)
        {
            InitializeComponent();

            this.Load += (f, a) =>
            {
                subjectPropod.Items.Clear();

                using (var connec = new OleDbConnection(Properties.Settings.Default.connect))
                {
                    connec.Open();
                    using (var cmd = connec.CreateCommand())
                    {
                        cmd.CommandText = "SELECT [Фамилия], [Имя], [Отчество] " +
                                          "FROM [Преподаватели]";
                        using (var reader = cmd.ExecuteReader())
                        {
                            while (reader.Read())
                            {
                                subjectPropod.Items.Add(reader[0].ToString() + " " + reader[1].ToString() + " " + reader[2].ToString());
                            }
                        }
                    }
                }
            };
            this.Load += (f, a) =>
            {
                this.ID = values[0];

                subjectName.Text   = values[1];
                subjectHours.Text  = values[2];
                subjectPropod.Text = values[3];
                subjectCourse.Text = values[4];
            };

            save.Click += (f, a) =>
            {
                (this.Owner as MainForm).UpdateDataInSubjectDataTable(
                    new string[]
                {
                    "НаименованиеПредмета",
                    "КоличествоЧасов",
                    "КодПреподавателя",
                    "Курс"
                },
                    new string[]
                {
                    subjectName.Text,
                    subjectHours.Text,
                    Datebase.GetPrepodID(subjectPropod.Text).ToString(),
                    subjectCourse.Text
                },
                    new string[]
                {
                    this.ID
                }
                    );
                (this.Owner as MainForm).LoadDataInSubjectDataTable();
                this.Close();
            };
            cancel.Click += (f, a) => this.Close();
        }
Esempio n. 11
0
        public EditOzenkiData(string[] values)
        {
            InitializeComponent();

            this.Load += (f, a) =>
            {
                ozenkiSubject.Items.Clear();

                using (var connec = new OleDbConnection(Properties.Settings.Default.connect))
                {
                    connec.Open();
                    using (var cmd = connec.CreateCommand())
                    {
                        cmd.CommandText = "SELECT [НаименованиеПредмета], [КоличествоЧасов], [Курс] " +
                                          "FROM [Предметы]";
                        using (var reader = cmd.ExecuteReader())
                        {
                            while (reader.Read())
                            {
                                ozenkiSubject.Items.Add(reader[0].ToString() + " " + reader[1].ToString() + "ч" + reader[2].ToString() + "к");
                            }
                        }
                    }
                }
            };
            this.Load += (f, a) =>
            {
                this.ID = values[0];

                ozenkiChipher.Text = values[1];
                ozenkiCourse.Text  = values[2];
                ozenkiSubject.Text = values[3];
                ozenkiOzenka.Text  = values[4];
                KRIsTrue.Checked   = values[5] == "Да" ? true : false;
                KRIsOzenka.Text    = values[6];
            };

            save.Click += (f, a) =>
            {
                (this.Owner as MainForm).UpdateDataInOzenkiDataTable(
                    new string[]
                {
                    "Шифр",
                    "КодПредмета",
                    "Оценка",
                    "НаличиеКР",
                    "ОценкаКР"
                },
                    new string[]
                {
                    ozenkiChipher.Text,
                    Datebase.GetSubjectID(ozenkiSubject.Text).ToString(),
                    ozenkiOzenka.Text,
                    KRIsTrue.Checked == true ? "Да" : "Нет",
                    KRIsOzenka.Text
                },
                    new string[]
                {
                    this.ID
                }
                    );
                (this.Owner as MainForm).LoadDataInOzenkiDataTable();
                this.Close();
            };
            cancel.Click += (f, a) => this.Close();
        }
Esempio n. 12
0
 public UserRepository(MongoClient mongoClient) : base(mongoClient)
 {
     Context = Datebase.GetCollection <User>("users");
 }
Esempio n. 13
0
        public void Add()
        {
            int countTextBox  = 0;
            int countCombobox = 0;

            foreach (var item in this.Controls)
            {
                if (item is TextBox)
                {
                    if ((item as TextBox).Text == string.Empty)
                    {
                        countTextBox++;
                    }
                }
                if (item is ComboBox)
                {
                    if ((item as ComboBox).Text == string.Empty)
                    {
                        countCombobox++;
                    }
                }
            }
            if (countTextBox != 0 || countCombobox != 0 || !genderF.Checked && !genderM.Checked ||
                !languageE.Checked && !languageF.Checked && !languageN.Checked)
            {
                MessageBox.Show("Не все поля заполнены");
            }
            else
            {
                var field = new string[]
                {
                    "Шифр",
                    "КодГруппы",
                    "ФИО",
                    "Пол",
                    "ДатаРождения",
                    "ДомашнийАдрес",
                    "Телефон",
                    "МестоРаботы",
                    "ИзучаемыйЯзык",
                    "Образование",
                    "Статус"
                };
                var values = new string[]
                {
                    cipher.Text,
                    Datebase.GetGroupID(group.Text).ToString(),
                    fio.Text,
                    genderF.Checked ? genderF.Text : genderM.Text,
                    Convert.ToDateTime(birthday.Text).ToString(),
                    adress.Text,
                    phone.Text,
                    jobPlace.Text,
                    languageE.Checked ? languageE.Text : (languageF.Checked ? languageF.Text : languageN.Text),
                    education.Text,
                    status.Text
                };
                Datebase.InsertData("Личные данные", field, values);
                (this.Owner as MainForm).LoadDataInSelfDataTable();
                this.Close();
            }
        }