public static void addTermin(Termin termin) { if (!termin.Nedelja.Termini.Contains(termin)) { termin.Nedelja.Termini.Add(termin); } }
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 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 CreateTerminControl(Termin termin) { int danBr = termin.PocetakTermina.Day - GuiObject.Ponedeljak.Day; Panel dan = getPanelFromDan(danBr); TerminControl t = new TerminControl(termin, dan); dan.Controls.Add(t); t.Width = dan.Width; t.Location = new Point(3, getYFromDateTime(termin.PocetakTermina)); t.Size = new Size(dan.Width - 3, getYFromDateTime(termin.KrajTermina) - getYFromDateTime(termin.PocetakTermina)); }
public TerminForm(Nedelja nedelja, Predmet predmet, DateTime dan, Termin termin) { this.termin = termin; this.predmet = predmet; this.nedelja = nedelja; InitializeComponent(); InicijalizacijaCasovaUnos(); InicijalizacijaUnosVremena(); DateTime ponedeljak = (nedelja == null) ? dan : nedelja.Ponedeljak; dateTimePicker1.MinDate = new DateTime(ponedeljak.Year, ponedeljak.Month, dan.Day, 7, 0, 0); dateTimePicker1.MaxDate = new DateTime(ponedeljak.Year, ponedeljak.Month, dan.Day, 22, 0, 0); KeyPreview = true; KeyDown += (object sender, KeyEventArgs e) => { if (e.KeyCode == Keys.F1) { DataManger.goToHelp("termin"); } }; }
private void ActionExcuted(object sender, Action e) { if (e is CreateAction) { Termin t = e.getGUIObject() as Termin; if (t != null) { if (t.Nedelja.Equals(GuiObject)) { CreateTerminControl(t); } } } else if (e is EditAction || e is RestoreAction)// OVO OVDE ZBOG EDITA GORE DOLE NAMESTITI da se pomera { Termin t = e.getGUIObject() as Termin; if (t != null) { t.OnDelete(null); CreateTerminControl(t); } } }
static public void removeTermin(Termin termin) { termin.Nedelja.Termini.Remove(termin); }
public bool IsTerminIntersec(Termin t) { return(DateBetween(t.pocetakTermina, t.krajTermina, pocetakTermina, krajTermina) || DateBetween(pocetakTermina, krajTermina, t.pocetakTermina, t.krajTermina)); }
private Termin getTerminFromFields() { termin = new Termin(dateTimePicker1.Value, (int)numericUpDown1.Value, predmet, nedelja); return(termin); }
public TerminForm(Termin termin) : this(termin.Nedelja, termin.Predmet, termin.PocetakTermina, termin) { this.termin = termin; }