public Lab(int id, string role) : this() { whoami = id; myrole = role; textBox1.Text = myrole; string startowadata = dateTimePicker1.Value.Year.ToString(); startowadata += "-"; startowadata += dateTimePicker1.Value.Month.ToString(); startowadata += "-"; startowadata += dateTimePicker1.Value.Day.ToString(); startowadata += " 00:00:00.000"; listView1.Items.Clear(); if (myrole == "Lab") { var temp = SQLLab.GetExamination_Laboratories("", "ZLE", startowadata); foreach (var order in temp) { ListViewItem lvi = new ListViewItem(order.Table1.Id_Examination.ToString()); lvi.SubItems.Add(order.Table2.Name.ToString()); lvi.SubItems.Add(order.Table1.Date_Of_Order.ToString()); lvi.SubItems.Add(order.Table1.Date_Exec_Cancel.ToString()); lvi.SubItems.Add(order.Table1.State.ToString()); lvi.SubItems.Add(order.Table1.Result); listView1.Items.Add(lvi); } comboBox1.Text = "Zlecone"; } if (myrole == "MLab") { var temp = SQLLab.GetExamination_Laboratories("", "ZAK", startowadata); foreach (var order in temp) { ListViewItem lvi = new ListViewItem(order.Table1.Id_Examination.ToString()); lvi.SubItems.Add(order.Table2.Name.ToString()); lvi.SubItems.Add(order.Table1.Date_Of_Order.ToString()); lvi.SubItems.Add(order.Table1.Date_Exec_Cancel.ToString()); lvi.SubItems.Add(order.Table1.State.ToString()); lvi.SubItems.Add(order.Table1.Result); listView1.Items.Add(lvi); } comboBox1.Text = "Zakonczone"; } listView1.FullRowSelect = true; listView1.GridLines = true; }
private void refreshlistview() { listView1.Items.Clear(); if (dateTimePicker1.Checked == true) { string tmp = dateTimePicker1.Text; tmp += " 00:00:00.000"; var temp = SQLLab.GetExamination_Laboratories(textBox2.Text, SQLLab.translateRoleDB(comboBox1.Text), tmp); foreach (var order in temp) { ListViewItem lvi = new ListViewItem(order.Table1.Id_Examination.ToString()); lvi.SubItems.Add(order.Table2.Name.ToString()); lvi.SubItems.Add(order.Table1.Date_Of_Order.ToString()); lvi.SubItems.Add(order.Table1.Date_Exec_Cancel.ToString()); lvi.SubItems.Add(SQLLab.translateRolePL(order.Table1.State.ToString())); lvi.SubItems.Add(order.Table1.Result); listView1.Items.Add(lvi); } } else { var temp = SQLLab.GetExamination_Laboratories2(textBox2.Text, SQLLab.translateRoleDB(comboBox1.Text)); foreach (var order in temp) { ListViewItem lvi = new ListViewItem(order.Table1.Id_Examination.ToString()); lvi.SubItems.Add(order.Table2.Name.ToString()); lvi.SubItems.Add(order.Table1.Date_Of_Order.ToString()); lvi.SubItems.Add(order.Table1.Date_Exec_Cancel.ToString()); lvi.SubItems.Add(SQLLab.translateRolePL(order.Table1.State.ToString())); lvi.SubItems.Add(order.Table1.Result); listView1.Items.Add(lvi); } } }