Beispiel #1
0
        public DoctorsForm(doctor doc)
        {
            item = doc;
            InitializeComponent();

            textBox1.Text = item.surname.ToString() + " " + item.name.ToString();
            textBox2.Text = item.number.ToString();
            textBox3.Text = item.hours.ToString();

            FillForm show = new FillForm();

            pacients = (from p in db.pacient
                        select p).ToList();

            var query1 = (from p in pacients
                          where p.id_doctor == item.id_doctor
                          orderby p.id_pacient
                          select new { p.surname, p.name, p.number, p.polis, p.passport, p.addres, p.status }).ToList();

            dataGridView1.DataSource = query1;
            dataGridView1.ReadOnly   = true;

            dataGridView1.Columns[0].HeaderText = "Фамилия";
            dataGridView1.Columns[1].HeaderText = "Имя";
            dataGridView1.Columns[2].HeaderText = "Номер телефона";
            dataGridView1.Columns[3].HeaderText = "Полис";
            dataGridView1.Columns[4].HeaderText = "Серия номер пасспорта";
            dataGridView1.Columns[5].HeaderText = "Адрес проживания";
            dataGridView1.Columns[6].HeaderText = "Лечение";
        }
Beispiel #2
0
 public AppointmentForm(doctor doc)
 {
     item = doc;
     InitializeComponent();
     textBox1.Text = item.name + " " + item.surname;
     textBox2.Text = item.number;
 }
        public EditDoctorForm(doctor doc)
        {
            item = doc;
            InitializeComponent();

            textBox1.Text = item.surname.ToString();
            textBox2.Text = item.name.ToString();
            textBox3.Text = item.number.ToString();
        }
Beispiel #4
0
        private void button1_Click(object sender, EventArgs e)
        {
            List <doctor> query = (from d in db.doctor
                                   select d).ToList();

            if (dataGridView1.SelectedCells.Count == 1)
            {
                if (Application.OpenForms.Count == 3)
                {
                    doctor item = query.First(w => w.surname.ToString() == dataGridView1.SelectedCells[0].OwningRow.Cells[0].Value.ToString());

                    AppointmentForm f = new AppointmentForm(item);
                    f.Owner = this;
                    f.Show();
                }
                else
                {
                    Application.OpenForms[2].Focus();
                }
            }
        }
        private void button1_Click(object sender, EventArgs e)
        {
            StreamWriter s = new StreamWriter(@"doctors.txt", true);
            int          number_of_doctor = db.doctor.Max(n => n.id_doctor) + 1;

            doctor new_doctor = new doctor
            {
                id_doctor = number_of_doctor,
                surname   = textBox1.Text,
                name      = textBox2.Text,
                number    = textBox3.Text,
                login     = textBox4.Text,
                pas       = textBox5.Text
            };

            db.doctor.Add(new_doctor);
            s.Write(textBox4.Text + " ");
            s.WriteLine(textBox5.Text);
            s.Close();
            db.SaveChanges();
            this.Close();
        }
Beispiel #6
0
        public void CheckUser()
        {
            bool check = false;

            if (login == "admin" && pas == "admin")
            {
                check = true;
                AdminForm f6 = new AdminForm();
                f6.Show();
            }

            else if (login == "buhgalter" && pas == "buhgalter")
            {
                check = true;
                BuhgalterForm f5 = new BuhgalterForm();
                f5.Show();
            }

            else
            {
                List <pacient> query = (from p in db.pacient
                                        select p).ToList();
                StreamReader pac = new StreamReader(@"pacients.txt");
                string       str;
                while ((str = pac.ReadLine()) != null)
                {
                    Autorization user = new Autorization(str);
                    if ((user.login == this.login) && (user.pas == this.pas))
                    {
                        check = true;
                        pacient      item = query.First(w => w.login.ToString() == login);
                        PacientsForm f3   = new PacientsForm(item);
                        f3.Show();
                        break;
                    }
                }
                pac.Close();


                List <doctor> query1 = (from d in db.doctor
                                        select d).ToList();
                StreamReader doc = new StreamReader(@"doctors.txt");
                string       str1;
                while ((str1 = doc.ReadLine()) != null)
                {
                    Autorization user = new Autorization(str1);
                    if ((user.login == this.login) && (user.pas == this.pas))
                    {
                        check = true;
                        doctor      item = query1.First(w => w.login.ToString() == login);
                        DoctorsForm f8   = new DoctorsForm(item);
                        f8.Show();
                        break;
                    }
                }
                doc.Close();
            }//else

            if (!check)
            {
                MessageBox.Show("Неверный логин и/или пароль");
            }
        }//CheckUser