Пример #1
0
        private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
        {
            Call    call = calls.Find(x => x.id.ToString() == h_dgv_calls.SelectedCells[0].OwningRow.Cells[0].Value.ToString());
            Doc     d    = docs.Find(x => x.id.ToString() == call.idd.ToString());
            MedPers mp   = mPerss.Find(x => x.id.ToString() == call.idm.ToString());
            Mash    m    = mashs.Find(x => x.id.ToString() == call.idmash.ToString());
            Boln    b    = bolns.Find(x => x.id.ToString() == call.idb.ToString());

            e.Graphics.DrawString("Номер вызова: " + call.id + "\n" +
                                  "Причина: " + call.prichina + "\n" +
                                  "Помощь: " + call.pomosh + "\n" +
                                  "Адрес доставки: " + call.dostavka + "\n" +
                                  "Дата: " + call.data + "\n" +
                                  "----------------------------" + "\n" +
                                  "Врач: " + d.name + ". " + d.spec + ", " + d.dolj + "\n" +
                                  "Мед персонал: " + mp.name + "\n" +
                                  "Машина: " + m.num + ", " + m.gosNum + ", " + m.godVip + ", " + m.driverName + ", " + m.vodUdost + "\n" +
                                  "Больной: " + b.name + ". " + b.date + ", " + b.address + "\n"

                                  , DefaultFont, Brushes.Black, 50, 50);
        }
Пример #2
0
        void Update()
        {
            h_dgv_calls.Rows.Clear();
            object[] res = new object[2];

            c.Open();
            cmd.CommandText = "select IDV, Data from visov";
            r = cmd.ExecuteReader();
            while (r.Read())
            {
                for (int i = 0; i < 2; i++)
                {
                    res[i] = r[i];
                }
                h_dgv_calls.Rows.Add(res);
            }
            r.Close();
            c.Close();

            //get visov
            c.Open();
            cmd.CommandText = "select * from visov";
            r = cmd.ExecuteReader();
            Call cl;

            calls.Clear();
            while (r.Read())
            {
                cl          = new Call();
                cl.id       = r[0];
                cl.prichina = r[1];
                cl.pomosh   = r[2];
                cl.dostavka = r[3];
                cl.data     = r[4];
                cl.idd      = r[5];
                cl.idm      = r[6];
                cl.idmash   = r[7];
                cl.idb      = r[8];

                calls.Add(cl);
            }
            r.Close();
            c.Close();

            //get docs
            c.Open();
            cmd.CommandText = "select * from doctor";
            r = cmd.ExecuteReader();
            Doc dc;

            docs.Clear();
            while (r.Read())
            {
                dc      = new Doc();
                dc.id   = r[0];
                dc.name = r[1];
                dc.spec = r[2];
                dc.dolj = r[3];

                docs.Add(dc);
            }
            r.Close();
            c.Close();

            //get medperss
            c.Open();
            cmd.CommandText = "select * from medpersonal";
            r = cmd.ExecuteReader();
            MedPers mp;

            mPerss.Clear();
            while (r.Read())
            {
                mp      = new MedPers();
                mp.id   = r[0];
                mp.name = r[1];

                mPerss.Add(mp);
            }
            r.Close();
            c.Close();

            //get mashs
            c.Open();
            cmd.CommandText = "select * from mashina";
            r = cmd.ExecuteReader();
            Mash msh;

            mashs.Clear();
            while (r.Read())
            {
                msh            = new Mash();
                msh.id         = r[0];
                msh.num        = r[1];
                msh.gosNum     = r[2];
                msh.godVip     = r[3];
                msh.driverName = r[4];
                msh.vodUdost   = r[5];

                mashs.Add(msh);
            }
            r.Close();
            c.Close();

            //get bolns
            c.Open();
            cmd.CommandText = "select * from boln";
            r = cmd.ExecuteReader();
            Boln b;

            bolns.Clear();
            while (r.Read())
            {
                b         = new Boln();
                b.id      = r[0];
                b.name    = r[1];
                b.date    = r[2];
                b.address = r[3];

                bolns.Add(b);
            }
            r.Close();
            c.Close();

            cb_vrach.Items.Clear();
            foreach (var v in docs)
            {
                cb_vrach.Items.Add(v.name);
            }
            cb_medPersonal.Items.Clear();
            foreach (var v in mPerss)
            {
                cb_medPersonal.Items.Add(v.name);
            }
            cb_nBorta.Items.Clear();
            foreach (var v in mashs)
            {
                cb_nBorta.Items.Add(v.num);
            }

            cb_fio.Items.Clear();
            foreach (var v in bolns)
            {
                cb_fio.Items.Add(v.name);
            }
        }