private void buttonIzbrisiStanicu_Click(object sender, EventArgs e) { if (this.comboBoxStanice.SelectedIndex > 0) { int idTrasaStanica = Int32.Parse(this.comboBoxStanice.SelectedValue.ToString()); int idStanica = Int32.Parse(this.textBoxIdStanice.Text); AdminService.Ekarta_AdminPortClient veza = new AdminService.Ekarta_AdminPortClient(); try { veza.unsetTrasaStanica(idTrasaStanica);} catch (Exception ex) { } try { veza.unsetStanica(idStanica); } catch (Exception ex) { } this.textBoxIdStanice.Text = ""; this.textBoxImeStanice.Text = ""; this.textBoxKmDo.Text = ""; this.textBoxKmOd.Text = ""; this.comboBoxTrase.SelectedIndex = 0; this.comboBoxStanice.SelectedIndex = 0; this.popuniStanice(); this.popuniTrase(this.comboBoxTrase); this.sveStanice(this.comboBoxPocetnaStanica); this.sveStanice(this.comboBoxKrajnjaStanica); } else { MessageBox.Show("Izaberite stanicu prvo","Obavestenje",MessageBoxButtons.OK,MessageBoxIcon.Exclamation); } }
private void buttonDodajvoznju_Click(object sender, EventArgs e) { if (this.comboBoxTrasa.SelectedIndex != 0 && this.comboBoxDan.SelectedIndex != 0 && this.textBoxSat.Text != "" && this.textBoxMinut.Text != "") { if (Int32.Parse(this.textBoxSat.Text) >= 0 && Int32.Parse(this.textBoxSat.Text) < 24 && Int32.Parse(this.textBoxMinut.Text) >= 0 && Int32.Parse(this.textBoxMinut.Text) < 60) { AdminService.Ekarta_AdminPortClient veza = new AdminService.Ekarta_AdminPortClient(); int idTrasa = Int32.Parse(this.comboBoxTrasa.SelectedValue.ToString()); int dan = Int32.Parse(this.comboBoxDan.SelectedValue.ToString()); string sat = this.textBoxSat.Text; string minut = this.textBoxMinut.Text; string zaSlanje = idTrasa + "_" + dan + "_" + sat + "_" + minut; if (Int32.Parse(this.comboBoxTrasaIzmeni.SelectedValue.ToString()) != 0) { zaSlanje += "_" + this.comboBoxTrasaIzmeni.SelectedValue.ToString(); } try{veza.setRedVoznje(zaSlanje);} catch (Exception ex){} this.popuniRedVoznje(); } else { MessageBox.Show("Sat i minut moraju da budu u odgovarajucem opssegu!.", "Obavestenje", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } else { MessageBox.Show("Morate popuniti sva polja.", "Obavestenje", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
private void buttonIzbrisiOtkazanaVoznja_Click(object sender, EventArgs e) { if (this.comboBoxOtkazaneVoznje.SelectedIndex != 0) { int idOtkazanaVoznja = Int32.Parse(this.comboBoxOtkazaneVoznje.SelectedValue.ToString()); AdminService.Ekarta_AdminPortClient veza = new AdminService.Ekarta_AdminPortClient(); try { veza.unsetOtkazanaVoznja(idOtkazanaVoznja); } catch (Exception ex) { } this.popuniOtkazaneVoznje(); this.popuniRedVoznje(); this.ocistiOtkazaneVoznje(); } else { MessageBox.Show("Izaberite otkazanu voznju!", "Obavestenje", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
private void buttonIzbrisiTrasu_Click(object sender, EventArgs e) { if (this.comboBoxIzaberiTrasu.SelectedIndex > 0) { int idTrasa = Int32.Parse(this.comboBoxIzaberiTrasu.SelectedValue.ToString()); AdminService.Ekarta_AdminPortClient veza = new AdminService.Ekarta_AdminPortClient(); try { veza.unsetTrasa(idTrasa); } catch (Exception ex) { } this.popuniStanice(); this.ponistiTrase(); this.popuniTrase(this.comboBoxIzaberiTrasu); this.popuniTrase(this.comboBoxTrase); } else { MessageBox.Show("Izaberite trasu prvo", "Obavestenje", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
public RedVoznje() { InitializeComponent(); AdminService.Ekarta_AdminPortClient veza = new AdminService.Ekarta_AdminPortClient(); Dictionary<int, string> dani = new Dictionary<int, string>(); dani.Add(0, "Izaberi..."); dani.Add(1, "Radni dani"); dani.Add(2, "Subota"); dani.Add(3, "Nedelja"); this.comboBoxDan.DataSource = new BindingSource(dani, null); this.comboBoxDan.DisplayMember = "Value"; this.comboBoxDan.ValueMember = "Key"; this.popuniRedVoznje(); this.popuniTrase(this.comboBoxTrasa); this.popuniTrase(this.comboBoxTrasaOtkazi); this.popuniOtkazaneVoznje(); }
public Form1() { InitializeComponent(); this.dateTimePickerDatumPutovanja.MinDate = DateTime.Now; AdminService.Ekarta_AdminPortClient veza = new AdminService.Ekarta_AdminPortClient(); string result = veza.getTrase(); string[] array = result.Split('#'); int count = array.Count(); Dictionary<int, string> trase = new Dictionary<int, string>(); trase.Add(0, "Izaberi..."); for (int i = 0; i < count - 1; i++) { string[] elements = array[i].Split('_'); trase.Add(Convert.ToInt32(elements[0]), elements[1] + " - " + elements[2]); } this.comboBoxTrasa.DataSource = new BindingSource(trase, null); this.comboBoxTrasa.DisplayMember = "Value"; this.comboBoxTrasa.ValueMember = "Key"; popuniPopuste(); }
private void popuniStanice(ComboBox cb, int idTrasa, int idStanica = 0) { AdminService.Ekarta_AdminPortClient veza = new AdminService.Ekarta_AdminPortClient(); string result = ""; if (idStanica == 0) { result = veza.getStaniceZaTrasu(idTrasa); } else { result = veza.getStaniceZaTrasuPosle(idTrasa, idStanica); } string[] array = result.Split('#'); int count = array.Count(); Dictionary<int, string> trase = new Dictionary<int, string>(); trase.Add(0, "Izaberi..."); for (int i = 0; i < count - 1; i++) { string[] elements = array[i].Split('_'); trase.Add(Convert.ToInt32(elements[1]), elements[0]); } cb.DataSource = new BindingSource(trase, null); cb.DisplayMember = "Value"; cb.ValueMember = "Key"; }
private void buttonSacuvajTrasu_Click(object sender, EventArgs e) { string pocetna = this.comboBoxPocetnaStanica.Text; string krajnja = this.comboBoxKrajnjaStanica.Text; string ukupnoKm = this.textBoxUkupnoKm.Text; string zaSlanje = pocetna + "_" + krajnja + "_" + ukupnoKm; if (this.comboBoxIzaberiTrasu.SelectedIndex != 0) { int idTrasa = Int32.Parse(this.comboBoxIzaberiTrasu.SelectedValue.ToString()); zaSlanje += "_" + idTrasa; } AdminService.Ekarta_AdminPortClient veza = new AdminService.Ekarta_AdminPortClient(); try { veza.setTrasa(zaSlanje); } catch (Exception ex) {} this.ponistiTrase(); this.popuniTrase(this.comboBoxIzaberiTrasu); this.popuniTrase(this.comboBoxTrase); }
private void dateTimePickerDatumPutovanja_ValueChanged(object sender, EventArgs e) { if (this.comboBoxTrasa.SelectedIndex > 0) { this.comboBoxVremePolaska.Enabled = true; this.checkBoxPopust.Enabled = true; string datum = this.dateTimePickerDatumPutovanja.Value.Day + "_" + this.dateTimePickerDatumPutovanja.Value.Month + "_" + this.dateTimePickerDatumPutovanja.Value.Year; string zaSlanje = this.comboBoxTrasa.SelectedValue.ToString() + "_" + datum; AdminService.Ekarta_AdminPortClient veza = new AdminService.Ekarta_AdminPortClient(); string result = veza.getVremeZaDatum(zaSlanje); string[] array = result.Split('#'); int count = array.Count(); Dictionary<int, string> trase = new Dictionary<int, string>(); trase.Add(0, "Izaberi..."); for (int i = 0; i < count - 1; i++) { string[] elements = array[i].Split('_'); trase.Add(Convert.ToInt32(elements[0]), elements[1]); } this.comboBoxVremePolaska.DataSource = new BindingSource(trase, null); this.comboBoxVremePolaska.DisplayMember = "Value"; this.comboBoxVremePolaska.ValueMember = "Key"; } }
private void popuniPopuste() { AdminService.Ekarta_AdminPortClient veza = new AdminService.Ekarta_AdminPortClient(); string result = veza.getPopust(0); string[] array = result.Split('#'); int count = array.Count(); Dictionary<int, string> trase = new Dictionary<int, string>(); trase.Add(0, "Izaberi..."); for (int i = 0; i < count - 1; i++) { string[] elements = array[i].Split('_'); trase.Add(Convert.ToInt32(elements[0]), elements[1]); } this.comboBoxVrstaPopust.DataSource = new BindingSource(trase, null); this.comboBoxVrstaPopust.DisplayMember = "Value"; this.comboBoxVrstaPopust.ValueMember = "Key"; }
private void comboBoxStanice_SelectedIndexChanged(object sender, EventArgs e) { if (this.comboBoxStanice.SelectedIndex == 0) { this.textBoxImeStanice.Text = ""; this.textBoxKmOd.Text = ""; this.textBoxKmDo.Text = ""; this.comboBoxTrase.SelectedValue = 0; this.textBoxIdStanice.Text = ""; } else { AdminService.Ekarta_AdminPortClient veza = new AdminService.Ekarta_AdminPortClient(); string result = veza.getTrasaStanica(Int32.Parse(this.comboBoxStanice.SelectedValue.ToString())); this.textBoxImeStanice.Text = result.Split('_')[0].Split('@')[0]; this.comboBoxTrase.SelectedValue = Int32.Parse(result.Split('_')[5]); this.textBoxKmOd.Text = result.Split('_')[3]; this.textBoxKmDo.Text = result.Split('_')[4]; this.textBoxIdStanice.Text = result.Split('_')[6]; } }
private void buttonIzbrisiRedVoznje_Click(object sender, EventArgs e) { if (this.comboBoxTrasaIzmeni.SelectedIndex != 0) { int idRedVoznje = Int32.Parse(this.comboBoxTrasaIzmeni.SelectedValue.ToString()); AdminService.Ekarta_AdminPortClient veza = new AdminService.Ekarta_AdminPortClient(); try { veza.unsetRedVoznje(idRedVoznje); } catch(Exception ex){} this.comboBoxTrasa.SelectedValue = 0; this.comboBoxDan.SelectedValue = 0; this.textBoxSat.Text = ""; this.textBoxMinut.Text = ""; string result = veza.getRedVoznje(); string[] array = result.Split('#'); int count = array.Count(); Dictionary<int, string> redoviVoznje = new Dictionary<int, string>(); redoviVoznje.Add(0, "Izaberi..."); string[] niz = new string[100]; for (int i = 0; i < count - 1; i++) { string[] elements = array[i].Split('_'); redoviVoznje.Add(Convert.ToInt32(elements[0]), elements[4] + " " + elements[3]); } this.comboBoxTrasaIzmeni.DataSource = new BindingSource(redoviVoznje, null); this.comboBoxTrasaIzmeni.DisplayMember = "Value"; this.comboBoxTrasaIzmeni.ValueMember = "Key"; } else { MessageBox.Show("Izaberite red voznje!", "Obavestenje", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
private void popuniRedVoznje() { AdminService.Ekarta_AdminPortClient veza = new AdminService.Ekarta_AdminPortClient(); string result = veza.getRedVoznje(); string[] array = result.Split('#'); int count = array.Count(); Dictionary<int, string> redoviVoznje = new Dictionary<int, string>(); redoviVoznje.Add(0, "Izaberi..."); string[] niz = new string[100]; for (int i = 0; i < count - 1; i++) { string[] elements = array[i].Split('_'); redoviVoznje.Add(Convert.ToInt32(elements[0]), elements[4] + " " + elements[3]); } this.comboBoxTrasaIzmeni.DataSource = new BindingSource(redoviVoznje, null); this.comboBoxTrasaIzmeni.DisplayMember = "Value"; this.comboBoxTrasaIzmeni.ValueMember = "Key"; }
private void sveStanice(ComboBox cb) { AdminService.Ekarta_AdminPortClient veza = new AdminService.Ekarta_AdminPortClient(); string result = veza.getStanice(); string[] array = result.Split('#'); Dictionary<int, string> trase = new Dictionary<int, string>(); trase.Add(0, "Izaberi..."); int count = array.Count(); for (int i = 0; i < count - 1; i++) { string[] elements = array[i].Split('_'); trase.Add(Int32.Parse(elements[0]), elements[1]); } cb.DataSource = new BindingSource(trase, null); cb.DisplayMember = "Value"; cb.ValueMember = "Key"; }
private void comboBoxTrasaIzmeni_SelectedIndexChanged(object sender, EventArgs e) { if (this.comboBoxTrasaIzmeni.SelectedIndex == 0) { this.comboBoxTrasa.SelectedValue = 0; this.comboBoxDan.SelectedValue = 0; this.textBoxSat.Text = ""; this.textBoxMinut.Text = ""; } else { int selectedId = Int32.Parse(this.comboBoxTrasaIzmeni.SelectedValue.ToString()); AdminService.Ekarta_AdminPortClient veza = new AdminService.Ekarta_AdminPortClient(); string result=veza.getJedanRedVoznje(selectedId); string[] array = result.Split('_'); this.comboBoxTrasa.SelectedValue = Int32.Parse(array[1]); this.comboBoxDan.SelectedValue = Int32.Parse(array[2]); this.textBoxSat.Text = array[3].Split(':')[0]; this.textBoxMinut.Text = array[3].Split(':')[1]; } }
private void comboBoxIzaberiTrasu_SelectedIndexChanged(object sender, EventArgs e) { if (this.comboBoxIzaberiTrasu.SelectedIndex == 0) { this.ponistiTrase(); } else { AdminService.Ekarta_AdminPortClient veza = new AdminService.Ekarta_AdminPortClient(); string result = veza.getTrasu(Int32.Parse(this.comboBoxIzaberiTrasu.SelectedValue.ToString())); this.comboBoxPocetnaStanica.SelectedValue = Int32.Parse(result.Split('_')[0]); this.comboBoxKrajnjaStanica.SelectedValue = Int32.Parse(result.Split('_')[1]); this.textBoxUkupnoKm.Text = result.Split('_')[2]; } }
private void comboBoxOtkazaneVoznje_SelectedIndexChanged_1(object sender, EventArgs e) { if (this.comboBoxOtkazaneVoznje.SelectedIndex == 0) { this.comboBoxTrasaOtkazi.SelectedIndex = 0; this.dateTimePickerDatum.Value = DateTime.Now; this.textBoxMinutOtkazi.Text = ""; this.textBoxSatOtkazi.Text = ""; } else { int id=Int32.Parse(this.comboBoxOtkazaneVoznje.SelectedValue.ToString()); AdminService.Ekarta_AdminPortClient veza = new AdminService.Ekarta_AdminPortClient(); string result = veza.getOtkazanaVoznja(id); string[] array = result.Split('_'); this.comboBoxTrasaOtkazi.SelectedValue = Int32.Parse(array[0]); dateTimePickerDatum.Value = new DateTime(Int32.Parse(array[3]), Int32.Parse(array[2]), Int32.Parse(array[1])); this.textBoxSatOtkazi.Text = array[4].Split(':')[0]; this.textBoxMinutOtkazi.Text = array[4].Split(':')[1]; } }
private void buttonSacuvajOtkazaneVoznje_Click(object sender, EventArgs e) { string idTrasa = this.comboBoxTrasaOtkazi.SelectedValue.ToString(); string dan = this.dateTimePickerDatum.Value.Day.ToString(); string mesec = this.dateTimePickerDatum.Value.Month.ToString(); string godina = this.dateTimePickerDatum.Value.Year.ToString(); string sat = this.textBoxSatOtkazi.Text; string minut = this.textBoxMinutOtkazi.Text; string zaSlanje = idTrasa + "_" + dan + "_" + mesec + "_" + godina + "_" + sat + "_" + minut; if (this.comboBoxOtkazaneVoznje.SelectedIndex != 0) { zaSlanje += "_" + this.comboBoxOtkazaneVoznje.SelectedValue.ToString(); } AdminService.Ekarta_AdminPortClient veza = new AdminService.Ekarta_AdminPortClient(); try { veza.setOtkazanaVoznja(zaSlanje); } catch (Exception ex) { } this.ocistiOtkazaneVoznje(); this.popuniOtkazaneVoznje(); }
private void buttonSacuvajStanicu_Click(object sender, EventArgs e) { if (this.textBoxImeStanice.Text != "" && this.comboBoxTrase.SelectedIndex != 0 && this.textBoxKmOd.Text != "" && this.textBoxKmDo.Text != "") { string imeStanice = this.textBoxImeStanice.Text; string zaSlanje = ""; try { int kmOd = Int32.Parse(this.textBoxKmOd.Text); int kmDo = Int32.Parse(this.textBoxKmDo.Text); int idTrasa = Int32.Parse(this.comboBoxTrase.SelectedValue.ToString()); zaSlanje = imeStanice + "_" + idTrasa + "_" + kmOd + "_" + kmDo; if (this.textBoxIdStanice.Text == ""){zaSlanje += "_0";} else{zaSlanje += "_" + this.textBoxIdStanice.Text;} if (this.comboBoxStanice.SelectedIndex != 0){zaSlanje += "_" + this.comboBoxStanice.SelectedValue.ToString();} } catch (FormatException ex){MessageBox.Show(ex.Message, "Obavestenje", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);} AdminService.Ekarta_AdminPortClient veza = new AdminService.Ekarta_AdminPortClient(); try { veza.setTrasaStanica(zaSlanje); } catch (Exception ex) { } this.textBoxIdStanice.Text = ""; this.textBoxImeStanice.Text = ""; this.textBoxKmDo.Text = ""; this.textBoxKmOd.Text = ""; this.comboBoxTrase.SelectedIndex = 0; this.comboBoxStanice.SelectedIndex = 0; this.popuniStanice(); this.popuniTrase(this.comboBoxTrase); this.sveStanice(this.comboBoxPocetnaStanica); this.sveStanice(this.comboBoxKrajnjaStanica); } else if (this.textBoxImeStanice.Text != "") { string zaSlanje = this.textBoxImeStanice.Text; if (this.textBoxIdStanice.Text != "") { zaSlanje += "_"+this.textBoxIdStanice.Text; } AdminService.Ekarta_AdminPortClient veza = new AdminService.Ekarta_AdminPortClient(); try { veza.setStanica(zaSlanje); } catch (Exception ex) { } this.textBoxIdStanice.Text = ""; this.textBoxImeStanice.Text = ""; this.textBoxKmDo.Text = ""; this.textBoxKmOd.Text = ""; this.comboBoxTrase.SelectedIndex = 0; this.comboBoxStanice.SelectedIndex = 0; this.popuniStanice(); } else { MessageBox.Show("Sva polja moraju biti popunjena.", "Obavestenje", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }