private void reload() { var doc = docs.AsEnumerable <Staff>(); if (dateTimePicker1.Checked == true) { if (comboBox3.SelectedIndex >= 0) { int docid = doc.ElementAt <Staff>(comboBox3.SelectedIndex).Id_Staff; var temp = SQLRec.GetApo(patid, SQLRec.translateRoleDB(comboBox1.Text.ToString()), docid, datetostring()); listupdate(temp); } else { var temp = SQLRec.GetApo(patid, SQLRec.translateRoleDB(comboBox1.Text.ToString()), datetostring()); listupdate(temp); } } else { if (comboBox3.SelectedIndex >= 0) { int docid = doc.ElementAt <Staff>(comboBox3.SelectedIndex).Id_Staff; var temp = SQLRec.GetApo(patid, SQLRec.translateRoleDB(comboBox1.Text.ToString()), docid); listupdate(temp); } else { var temp = SQLRec.GetApo(patid, SQLRec.translateRoleDB(comboBox1.Text.ToString())); listupdate(temp); } } }
private void button2_Click(object sender, EventArgs e) {//zapisz i zamknij if (comboBox1.Text != "" && comboBox2.Text != "") { var doc = docs.AsEnumerable <Staff>(); int docid = doc.ElementAt <Staff>(comboBox1.SelectedIndex).Id_Staff; string culture = "mn-MN"; Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(culture); string datetosql = monthCalendar1.SelectionStart.ToShortDateString(); datetosql += " " + comboBox2.Text; DateTime dt = DateTime.Parse(datetosql); { SQLRec.updateApo(apoid, SQLRec.translateRoleDB(comboBox3.Text.ToString()), docid, dt); } this.Controls.Clear(); this.Visible = false; this.Parent.Hide(); textb.Text = "changed"; } else { MessageBox.Show("Wprowadz poprawne informacje"); } }