private void Dan_DragDrop(object sender, DragEventArgs e) { var formats = e.Data.GetFormats(); var data = e.Data.GetData(typeof(Predmet)); Predmet p = data as Predmet; data = e.Data.GetData(typeof(Termin)); Termin t = data as Termin; DateTime pocetakTermina = getDateTimeFromMousePoint((Panel)sender, e.X, e.Y); if (p != null) { Termin termin = new Termin(pocetakTermina, p.BrCasova, p, GuiObject); if (GuiObject.isSlobodan(termin)) { DataControllercs.addAction(new CreateAction(termin)); } } if (t != null) { Termin termin = t; TimeSpan ts = t.KrajTermina - t.PocetakTermina; DateTime krajTermina = pocetakTermina.Add(ts); if (GuiObject.isSlobodan(pocetakTermina, krajTermina, t)) { transferTerminToNewDate((Panel)sender, termin, pocetakTermina, krajTermina); } } }
private void buttonObisati_Click(object sender, EventArgs e) { Action action; action = new DeleteAction(termin); DataControllercs.addAction(action); }
public Action GetAction() { Action action; if (isCreate) { smer.ID = textBoxID.Text; smer.Ime = textBoxIme.Text; smer.DatumUvodjenja = Convert.ToDateTime(dateTimePicker1.Value); smer.Opis = richTextBoxOpis.Text; smer.Predmeti = listBoxPredmeti.Items.Cast <Predmet>().ToList(); action = new CreateAction(smer); } else { action = editAction; smer.ID = textBoxID.Text; smer.Ime = textBoxIme.Text; smer.DatumUvodjenja = Convert.ToDateTime(dateTimePicker1.Value); smer.Opis = richTextBoxOpis.Text; smer.Predmeti = listBoxPredmeti.Items.Cast <Predmet>().ToList(); } if (!actionAdded) { DataControllercs.addAction(action); } return(action); }
public Action GetAction() { Action action; if (predmet == null) { predmet = new Predmet(textBoxID.Text, textBoxNaziv.Text, smer, richTextBoxOpis.Text, Convert.ToInt32(numericUpDownBrojLjudi.Value), Convert.ToInt32(numericUpDownDuzinaTermina.Value), Convert.ToInt32(numericUpDownBrojTermina.Value)); predmet.Assets = getUcionicaAssets(); action = new CreateAction(predmet); } else { action = new EditAction(predmet); predmet.ID = textBoxID.Text; predmet.Ime = textBoxNaziv.Text; predmet.BrLjudi = Convert.ToInt32(numericUpDownBrojLjudi.Value); predmet.BrCasova = Convert.ToInt32(numericUpDownDuzinaTermina.Value); predmet.BrTermina = Convert.ToInt32(numericUpDownBrojTermina.Value); predmet.Opis = richTextBoxOpis.Text; predmet.Assets = getUcionicaAssets(); predmet.SmerPredmeta = smer; predmet.InstalledSoftware = getInstalledSoft(); } if (rezimRada == Rezim.Izmena || rezimRada == Rezim.Dodavanje) { DataControllercs.addAction(action); } return(action); }
private void transferTerminToNewDate(Panel currentPanel, Termin termin, DateTime pocetakTermina, DateTime krajTermina) { ChainAction chainAction = new ChainAction(termin); Termin novi = new Termin(pocetakTermina, krajTermina, termin.Predmet, GuiObject); chainAction.actions.Add(new DeleteAction(termin)); chainAction.actions.Add(new CreateAction(novi)); DataControllercs.addAction(chainAction); }
private void buttonOrisi_Click(object sender, EventArgs e) { try { int index = dataGridView1.CurrentCell.RowIndex; DataGridViewRow selectedRow = dataGridView1.Rows[index]; string id = selectedRow.Cells[0].Value.ToString(); System.Diagnostics.Debug.WriteLine(id); //brisanje ovde Software software = DataManger.GetSoftverID(id); DeleteAction d = new DeleteAction(software); DataControllercs.addAction(d); } catch { } }
private void buttonObrisi_Click(object sender, EventArgs e) { try { int index = dataGridView1.CurrentCell.RowIndex; DataGridViewRow selectedRow = dataGridView1.Rows[index]; string id = selectedRow.Cells[0].Value.ToString(); System.Diagnostics.Debug.WriteLine(id); Predmet predmet = DataManger.getPredmetByID(id); DeleteAction d = new DeleteAction(predmet); DataControllercs.addAction(d); } catch { } }
private void buttonObrisiPredmet_Click(object sender, EventArgs e) { Predmet p = listBoxPredmeti.SelectedItem as Predmet; if (p != null) { listBoxPredmeti.Items.Remove(p); if (!isCreate) { if (!actionAdded) { DataControllercs.addAction(editAction); actionAdded = true; } DeleteAction d = new DeleteAction(p); DataControllercs.addAction(d); } } }
private Action GetAction() { Action action; if (software == null) { software = new Software(textBoxID.Text, textBoxIme.Text, textBoxProizvodjac.Text, textBoxURL.Text, textBoxGodina.Text, Convert.ToDouble(textBoxCena.Text), richTextBoxOpis.Text); if (checkBox1.Checked) { software.Assets.Add(UcionicaAssets.windows); } if (checkBox2.Checked) { software.Assets.Add(UcionicaAssets.linux); } action = new CreateAction(software); } else { action = new EditAction(software); software.ID = textBoxID.Text; software.Ime = textBoxIme.Text; software.Proizvodjac = textBoxProizvodjac.Text; software.URL = textBoxURL.Text; software.Godina = textBoxGodina.Text; software.Cena = Convert.ToDouble(textBoxCena.Text); software.Opis = richTextBoxOpis.Text; if (checkBox1.Checked) { software.Assets.Add(UcionicaAssets.windows); } if (checkBox2.Checked) { software.Assets.Add(UcionicaAssets.linux); } } DataControllercs.addAction(action); return(action); }
private void button1_Click(object sender, EventArgs e) { DateTime krajTermina = dateTimePicker1.Value.AddMinutes(45 * (int)numericUpDown1.Value); if (termin.Nedelja.isSlobodan(dateTimePicker1.Value, krajTermina, termin)) { Action action; action = new EditAction(termin); termin.PocetakTermina = dateTimePicker1.Value; termin.KrajTermina = krajTermina; termin.DuzinaTermina = (int)numericUpDown1.Value; DataControllercs.addAction(action); } else { DialogResult = DialogResult.None; MessageBox.Show("Izabrano vreme je zauzeto", "Upozorenje", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1); return; } }
private Action GetAction() { Action action; if (ucionica == null) { ucionica = new Ucionica(textBoxID.Text, richTextBox1.Text, Convert.ToInt32(numericUpDown1.Value), getUcionicaAssets(), getInstalledSoft()); action = new CreateAction(ucionica); } else { action = new EditAction(ucionica); ucionica.ID = textBoxID.Text; ucionica.Opis = richTextBox1.Text; ucionica.BrRadnihMesta = Convert.ToInt32(numericUpDown1.Value); ucionica.Assets = getUcionicaAssets(); ucionica.InstalledSoftware = getInstalledSoft(); } DataControllercs.addAction(action); return(action); }