Exemple #1
0
        private void Button1_Click(object sender, EventArgs e)
        {
            using (Test11Entities2 db = new Test11Entities2())
            {
                var Name           = textBox1.Text;
                var Familia        = textBox5.Text;
                var Otchestvo      = textBox4.Text;
                var DateOfDitdhday = dateTimePicker1.Value;
                var Adress         = textBox2.Text;


                List <Pachienti> pachientis = new List <Pachienti>();
                pachientis.Add(new Pachienti {
                    Name = Name, Familia = Familia, Otchestvo = Otchestvo, DateOfBirthday = DateOfDitdhday, Adress = Adress
                });

                db.Pachienti.AddRange(pachientis);
                db.SaveChanges();

                MessageBox.Show("Данные сохранены");

                this.Hide();
                Form5 m = new Form5();
                m.Show();
            }
        }
Exemple #2
0
        private void ComboBox2_SelectedIndexChanged(object sender, EventArgs e)
        {
            using (Test11Entities2 db = new Test11Entities2())
            {
                var Doctors = db.Doctor;

                foreach (Doctor tl in Doctors)
                {
                    int Iid = comboBox1.SelectedIndex + 1;

                    if (tl.id == Iid)
                    {
                        label6.Text = tl.Specialnost;
                    }
                }
            }
        }
Exemple #3
0
        public Form3()
        {
            InitializeComponent();
            using (IDbConnection connection = new SqlConnection())
            {
            }

            using (Test11Entities2 db = new Test11Entities2())
            {
                var pacients = db.Pachienti;
                var Doctors  = db.Doctor;
                foreach (Pachienti pl in pacients)
                {
                    comboBox1.Items.Add(pl.Familia + " " + pl.Name + " " + pl.Otchestvo);
                }
                foreach (Doctor tl in Doctors)
                {
                    comboBox2.Items.Add(tl.FIO + ", " + tl.Specialnost);
                }
            }
        }
Exemple #4
0
        private void Button1_Click(object sender, EventArgs e)
        {
            using (Test11Entities2 db = new Test11Entities2())
            {
                var Doctor       = comboBox2.Text;
                var Pachient     = comboBox1.Text;
                var DatePriema   = dateTimePicker1.Value;
                var Spechialnost = label6.Text;

                List <PriemPacientov> PriemPacientovs = new List <PriemPacientov>();
                PriemPacientovs.Add(new PriemPacientov {
                    Doctor = Doctor, Pacient = Pachient, Date_of_priema = DatePriema, Specialnost = Spechialnost
                });

                db.PriemPacientov.AddRange(PriemPacientovs);
                db.SaveChanges();

                MessageBox.Show("Данные сохранены");

                this.Hide();
                Form5 m = new Form5();
                m.Show();
            }
        }
Exemple #5
0
        private void Button1_Click(object sender, EventArgs e)
        {
            using (Test11Entities2 db = new Test11Entities2())
            {
                var Login  = textBox1.Text;
                var Pass   = textBox2.Text;
                var Admins = db.admin.AsNoTracking().FirstOrDefault(u => u.Name == Login && u.Password == Pass);

                if (Admins == null)
                {
                    MessageBox.Show("Введен неверный логин или пароль");
                    return;
                }

                else
                {
                    MessageBox.Show("Добро Поржаловать");

                    this.Hide();
                    Form5 k = new Form5();
                    k.Show();
                }
            }
        }
Exemple #6
0
        private void Button1_Click(object sender, EventArgs e)
        {
            using (Test11Entities2 db = new Test11Entities2())
            {
                var Login = textBox1.Text;
                var Pass1 = textBox2.Text;
                var Pass2 = textBox3.Text;
                if (Pass1 != Pass2)
                {
                    MessageBox.Show("Введите пароль еще раз");
                    return;
                }
                if (Pass1.Length < 4)
                {
                    MessageBox.Show("Пароль должен собержать 4 и более символов");
                    return;
                }
                var hasDigits    = false;
                var hasUpperCase = false;
                var hasLowers    = false;
                var specChars    = "!@#$%^&*()_+";
                var hasSpecChars = false;
                for (var i = 0; i < Pass1.Length; i++)
                {
                    var ch = Pass1[i];
                    if (Char.IsLower(ch))
                    {
                        hasLowers = true;
                    }
                    if (Char.IsUpper(ch))
                    {
                        hasUpperCase = true;
                    }
                    if (specChars.Contains(ch))
                    {
                        hasSpecChars = true;
                    }
                    if (Char.IsDigit(ch))
                    {
                        hasDigits = true;
                    }
                }
                if (!(hasUpperCase || hasSpecChars || hasLowers || hasDigits))
                {
                    MessageBox.Show("Введите другой пароль");
                    return;
                }
                if (Login.Length == 0 || Pass1.Length == 0)
                {
                    MessageBox.Show("Введите логин и пароль");
                    return;
                }

                List <admin> admins = new List <admin>();
                admins.Add(new admin {
                    Name = Login, Password = Pass1
                });

                db.admin.AddRange(admins);
                db.SaveChanges();

                MessageBox.Show("Данные сохранены");

                this.Hide();
                Form2 m = new Form2();
                m.Show();
            }
        }
Exemple #7
0
        private void Button1_Click(object sender, EventArgs e)
        {
            using (Test11Entities2 db = new Test11Entities2())
            {
                var Doctor       = comboBox2.Text;
                var Pachient     = comboBox1.Text;
                var DatePriema   = dateTimePicker1.Value;
                var Spechialnost = label6.Text;

                List <PriemPacientov> PriemPacientovs = new List <PriemPacientov>();
                PriemPacientovs.Add(new PriemPacientov {
                    Doctor = Doctor, Pacient = Pachient, Date_of_priema = DatePriema, Specialnost = Spechialnost
                });

                db.PriemPacientov.AddRange(PriemPacientovs);
                db.SaveChanges();

                MessageBox.Show("Данные сохранены");


                int IDPriema         = 0;
                var PrienPachientovs = db.PriemPacientov; //Находим айди талона

                foreach (PriemPacientov tl in PrienPachientovs)
                {
                    if (tl.Pacient == Pachient && tl.Doctor == Doctor && tl.Date_of_priema == DatePriema)
                    {
                        IDPriema = tl.id;
                    }
                }

                object missing = Type.Missing;

                Object Pa = "E:\\Durka.docx";                      // Путь к шаблону

                Word.Application wordApp = new Word.Application(); // Создаём объект приложения

                Word.Document wordDoc = new Word.Document();

                wordDoc = wordApp.Documents.Add(ref Pa, ref missing, ref missing, ref missing);


                Word.Bookmarks wBookmarks = wordDoc.Bookmarks;

                wordDoc.Bookmarks["PACHIENT"].Range.Text     = Pachient; // источник текста(может быть элемент массива)
                wordDoc.Bookmarks["DOCTOR"].Range.Text       = Doctor;
                wordDoc.Bookmarks["SPECHIALNOST"].Range.Text = Spechialnost;
                wordDoc.Bookmarks["DATEP"].Range.Text        = Convert.ToString(DatePriema);

                object mi     = "E:\\VisualStudioWorks\\Шаблоны ворд для заполнения дурки\\Талон на прием к доктору " + Doctor + " № " + IDPriema + ".docx"; // путь куда и под каким именем будет сохраняться файл
                string WayDoc = "E:\\VisualStudioWorks\\Шаблоны ворд для заполнения дурки\\Талон на прием к доктору " + Doctor + " № " + IDPriema + ".docx";
                wordDoc.SaveAs(ref mi, ref missing, ref missing,

                               ref missing, ref missing, ref missing, ref missing,

                               ref missing, ref missing, ref missing, ref missing,

                               ref missing, ref missing, ref missing, ref missing,

                               ref missing);


                wordDoc.Close();

                System.Diagnostics.Process myProcess = new Process();
                myProcess.StartInfo.FileName = WayDoc; //имя своего файла(может быть exe файл)

                myProcess.StartInfo.Verb = "Open";

                myProcess.StartInfo.CreateNoWindow = false;

                myProcess.Start();


                this.Hide();
                Form5 m = new Form5();
                m.Show();
            }
        }