コード例 #1
0
 public FeedbackForm(pacient pac)
 {
     item = pac;
     InitializeComponent();
     textBox1.Text = item.id_pacient.ToString();
     textBox2.Text = item.id_doctor.ToString();
 }
コード例 #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                StreamWriter s = new StreamWriter(@"pacients.txt", true);
                int          number_of_pacient = db.pacient.Max(n => n.id_pacient) + 1;

                pacient new_pacient = new pacient
                {
                    id_pacient = number_of_pacient,
                    surname    = textBox1.Text,
                    name       = textBox2.Text,
                    number     = textBox3.Text,
                    polis      = textBox4.Text,
                    passport   = textBox5.Text,
                    addres     = textBox6.Text,
                    login      = textBox7.Text,
                    pas        = textBox8.Text
                };

                db.pacient.Add(new_pacient);
                s.Write(textBox7.Text + " ");
                s.WriteLine(textBox8.Text);
                s.Close();
                db.SaveChanges();
                this.Close();
            }
            catch (Exception ee) { MessageBox.Show(ee.Message); }
        }
コード例 #3
0
        public EditPacientForm(pacient pac)
        {
            item = pac;
            InitializeComponent();

            textBox1.Text = item.surname.ToString();
            textBox2.Text = item.name.ToString();
            textBox3.Text = item.number.ToString();
            textBox4.Text = item.polis.ToString();
            textBox5.Text = item.passport.ToString();
            textBox6.Text = item.addres.ToString();
        }
コード例 #4
0
 public PacientsForm(pacient pac)
 {
     item = pac;
     InitializeComponent();
     try
     {
         textBox1.Text = item.surname.ToString() + " " + item.name.ToString();
         textBox2.Text = item.number.ToString();
         textBox3.Text = item.polis.ToString();
         textBox4.Text = item.passport.ToString();
         textBox5.Text = item.addres.ToString();
         textBox6.Text = item.status.ToString();
     }
     catch (Exception e) { MessageBox.Show(e.Message); }
 }
コード例 #5
0
        private void button3_Click(object sender, EventArgs e)
        {
            List <pacient> query = (from p in db.pacient
                                    select p).ToList();

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

                    FeedbackForm f = new FeedbackForm(item);
                    f.Owner = this;
                    f.Show();
                }
                else
                {
                    Application.OpenForms[2].Focus();
                }
            }
        }
コード例 #6
0
        private void button1_Click(object sender, EventArgs e)
        {
            List <pacient> query = (from p in db.pacient
                                    select p).ToList();

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

                    EditPacientForm editP = new EditPacientForm(item);
                    editP.Owner = this;
                    editP.Show();
                }
                else
                {
                    Application.OpenForms[1].Focus();
                }
            }
        }
コード例 #7
0
 public PacientStatusForm(pacient pac)
 {
     item = pac;
     InitializeComponent();
     textBox1.Text = item.status.ToString();
 }
コード例 #8
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