Ejemplo n.º 1
0
		public void UpdateCannedText(CannedText cannedText, CannedTextDetail detail, Staff owner, IPersistenceContext context)
		{
			cannedText.Name = detail.Name;
			cannedText.Category = detail.Category;
			cannedText.Staff = detail.IsPersonal ? owner : null;
			cannedText.StaffGroup = detail.IsGroup ? context.Load<StaffGroup>(detail.StaffGroup.StaffGroupRef, EntityLoadFlags.Proxy) : null;
			cannedText.Text = detail.Text;
		}
Ejemplo n.º 2
0
		public CannedTextDetail GetCannedTextDetail(CannedText cannedText, IPersistenceContext context)
		{
			StaffGroupAssembler groupAssembler = new StaffGroupAssembler();

			return new CannedTextDetail(
				cannedText.Name,
				cannedText.Category,
				cannedText.StaffGroup == null ? null : groupAssembler.CreateSummary(cannedText.StaffGroup),
				cannedText.Text);
		}
Ejemplo n.º 3
0
		public CannedTextSummary GetCannedTextSummary(CannedText cannedText, IPersistenceContext context)
		{
			StaffAssembler staffAssembler = new StaffAssembler();
			StaffGroupAssembler groupAssembler = new StaffGroupAssembler();

			return new CannedTextSummary(
				cannedText.GetRef(),
				cannedText.Name,
				cannedText.Category,
				cannedText.Staff == null ? null : staffAssembler.CreateStaffSummary(cannedText.Staff, context),
				cannedText.StaffGroup == null ? null : groupAssembler.CreateSummary(cannedText.StaffGroup),
				cannedText.Text);
		}
Ejemplo n.º 4
0
		private static void CheckCannedTextWriteAccess(CannedText cannedText)
		{
			CheckCannedTextWriteAccess(cannedText.StaffGroup == null);
		}
Ejemplo n.º 5
0
		public CannedText CreateCannedText(CannedTextDetail detail, Staff owner, IPersistenceContext context)
		{
			CannedText newCannedText = new CannedText();
			UpdateCannedText(newCannedText, detail, owner, context);
			return newCannedText;
		}