Exemple #1
0
        public order(string id, dataBase _connector, int _type)
        {
            InitializeComponent();
            idPatients = new List <string>();
            idDoctors  = new List <string>();
            connector  = _connector;
            orderData ord = connector.loadOrder(id);

            idOrder = id;
            comboBox2.Items.Add(ord.FioPatient);
            comboBox1.Items.Add(ord.FioDoctor);
            idDoctors.Add(ord.IdDoctor);
            idPatients.Add(ord.IdPatient);
            dateTimePicker1.Value = System.Convert.ToDateTime(ord.DateVisit);

            needAdd = false;
            type    = _type;
            if (type == 0)
            {
                button2.Visible = false;
                button1.Visible = false;
                button4.Visible = true;
            }
            else
            {
                dateTimePicker1.Enabled = false;
                comboBox1.Enabled       = false;
                comboBox2.Enabled       = false;
                button1.Visible         = false;
            }
        }
Exemple #2
0
        public orderData loadOrder(string idOrder)
        {
            string    tmp;
            orderData ord = new orderData();

            command.CommandText = "Select * from [order Запрос] where [order_Код] = " + idOrder;
            using (OleDbDataReader reader = command.ExecuteReader())
            {
                reader.Read();
                tmp = "";
                for (int i = 0; i < 3; i++)
                {
                    tmp += reader.GetValue(i + 2).ToString().Trim() + " ";
                }
                ord.FioPatient = tmp;
                ord.IdPatient  = reader.GetValue(1).ToString().Trim();

                tmp = "";
                for (int i = 0; i < 3; i++)
                {
                    tmp += reader.GetValue(i + 6).ToString().Trim() + " ";
                }
                ord.FioDoctor = tmp;
                ord.IdDoctor  = reader.GetValue(5).ToString().Trim();
                ord.DateVisit = reader.GetValue(10).ToString().Trim();
            }
            return(ord);
        }
Exemple #3
0
        public List <string> loadList(string _id)
        {
            List <string> data = new List <string>();

            data = connector.loadListOrder(_id);

            return(data);
        }
Exemple #4
0
        public List <string> loadList(int _type)
        {
            List <string> data = new  List <string>();

            data = connector.loadListOrder(_type);

            return(data);
        }
Exemple #5
0
        public string addOrder(orderData order)
        {
            string idOrder = "";

            command.CommandText = "Insert into [order] ([idPatient],[idDoctor],[dateOrder],[correct]) Values (" + order.IdPatient + "," + order.IdDoctor + ",#" + getDate(order.DateVisit) + "#,0)";
            command.ExecuteNonQuery();
            command.CommandText = "Select max(Код) from [order]";
            using (OleDbDataReader reader = command.ExecuteReader())
            {
                reader.Read();
                idOrder = reader.GetValue(0).ToString().Trim();
            }
            return(idOrder);
        }
Exemple #6
0
 void save()
 {
     if (comboBox1.Items.Count > 0 && comboBox2.Items.Count > 0)
     {
         orderData order = new orderData();
         order.IdDoctor  = idDoctors[comboBox1.SelectedIndex];
         order.IdPatient = idPatients[comboBox1.SelectedIndex];
         order.DateVisit = dateTimePicker1.Value.ToShortDateString();
         if (needAdd)
         {
             idOrder = connector.addOrder(order);
         }
         else
         if (type == 0)
         {
             connector.updateOrder(order);
         }
     }
 }
Exemple #7
0
 public void updateOrder(orderData update)
 {
     command.CommandText = "Update  [order] set [idPatient] = " + update.IdPatient + ", [idDoctor] = " + update.IdDoctor + ",[dateOrder] = #" + getDate(update.DateVisit) + "# where Код = " + update.ID;
     command.ExecuteNonQuery();
 }
Exemple #8
0
 public orderControl()
 {
     data      = new orderData();
     connector = new dataBase();
 }