public void AddNewFormat() { IPaperFormats paperFormats = TiskarnaVosahlo.PaperFormats; IPaperFormat newPaperformat = paperFormats.AddFormat(NEW_FORMAT, EXPECTED_WIDTH, EXPECTED_HEIGHT); Assert.AreEqual(NEW_FORMAT, newPaperformat.Name); Assert.AreEqual(EXPECTED_WIDTH, newPaperformat.Size.Width); Assert.AreEqual(EXPECTED_HEIGHT, newPaperformat.Size.Height); }
private void DeleteAllCustomFormats() { IList <IPaperFormat> paperFormatsToDelete = FetchFormatsToDelete(); while (paperFormatsToDelete.Count > 0) { IPaperFormat formatToDelete = paperFormatsToDelete[0]; TiskarnaVosahlo.PaperFormats.DeleteFormat(formatToDelete); paperFormatsToDelete.Remove(formatToDelete); } }
public IPaperFormat GetFormat(string name) { IPaperFormat paperFormat = TryFindPaperFormat(name); if (paperFormat != null) { return(paperFormat); } AppliactionContext.Log.Error(this, String.Format(Resources.PaperFormatAlreadyExist, paperFormat.Name)); throw new TvException(String.Format(Resources.PaperFormatNotFound, paperFormat.Name)); }
public void DeleteFormat(IPaperFormat paperformat) { CheckRights(); if (paperformat.IsBuildIn) { AppliactionContext.Log.Error(this, "Format can't be deleted."); AppliactionContext.Log.Error(this, String.Format(Resources.PapeFormatIsBuildinFormat, paperformat.Name)); throw new TvException(String.Format(Resources.PapeFormatIsBuildinFormat, paperformat.Name)); } PaperFormat deletedPaperFormat = paperformat as PaperFormat; _paperFormats.Remove(deletedPaperFormat); deletedPaperFormat.Delete(); }
public void DeleteFormat(IPaperFormat paperformat) { CheckRights(); if (paperformat.IsBuildIn) { AppliactionContext.Log.Error(this, "Format can't be deleted."); AppliactionContext.Log.Error(this, String.Format(Resources.PapeFormatIsBuildinFormat, paperformat.Name)); throw new TvException(String.Format(Resources.PapeFormatIsBuildinFormat, paperformat.Name)); } PaperFormat deletedPaperFormat = paperformat as PaperFormat; _paperFormats.Remove(deletedPaperFormat); deletedPaperFormat.Delete(); }
public IPaperFormat AddFormat(string name, int width, int height) { CheckRights(); IPaperFormat paperFormat = TryFindPaperFormat(name); if (paperFormat != null) { AppliactionContext.Log.Error(this, String.Format(Resources.PaperFormatAlreadyExist, paperFormat.Name)); throw new TvException(String.Format(Resources.PaperFormatAlreadyExist, paperFormat.Name)); } PaperFormat newPaperFormat = new PaperFormat(); newPaperFormat.Name = name; newPaperFormat.Size = new Size(width, height); newPaperFormat.Save(); _paperFormats.Add(newPaperFormat); return(newPaperFormat); }