public void Delete(BasicAssignmentType entity) { if (!entity.IsNew()) { _termStyleRepository.MakeTransient(entity); } }
public BasicAssignmentType SaveAsNew(string newName, Type type, ref BasicAssignmentType source) { var newEntity = _entityFactory.Create<BasicAssignmentType>(type); newEntity.GapGuaranteed = source.GapGuaranteed; newEntity.Occupied = source.Occupied; newEntity.IgnoreAdherence = source.IgnoreAdherence; newEntity.AsAWork = source.AsAWork; newEntity.AsARest = source.AsARest; newEntity.Name = newName; newEntity.Type = source.Type; newEntity.Background = source.Background; newEntity.SetNewTime(source.Start, source.End); foreach (var o in source.GetSubEventInsertRules()) { var copy = o; _entityFactory.Create<SubEventInsertRule>().Self( n => { n.TimeRange = copy.TimeRange; n.SubEvent = copy.SubEvent; n.SubEventLength = copy.SubEventLength; newEntity.AddSubEventInsertRule(n); }); } if (type == typeof(AssignmentType)) { var copy = source.As<AssignmentType>(); newEntity.Self<AssignmentType>(n => { n.ServiceQueue = copy == null ? null: copy.ServiceQueue; n.EstimationPriority = copy == null ? 1 : copy.EstimationPriority; n.Template1 = copy == null ? null : copy.Template1; n.Template2 = copy == null ? null : copy.Template2; n.Template3 = copy == null ? null : copy.Template3; n.TimeZoneInfoId = copy == null ? "Taipei Standard Time" : copy.TimeZone.Id; n.Country = copy == null ? "Taiwan" : copy.Country; if (copy != null) { n.WorkingDayMask.Weekdays = copy.WorkingDayMask.Weekdays; n.WorkingDayMask.Weekdays2 = copy.WorkingDayMask.Weekdays2; n.WorkingDayMask.Monthdays = copy.WorkingDayMask.Monthdays; } }); } //_termStyleRepository.MakePersistent(newEntity); //Reload(ref source); return newEntity; }
public BasicAssignmentType SaveAsNew(string newName, Type type, ref BasicAssignmentType source) { var newEntity = _entityFactory.Create <BasicAssignmentType>(type); newEntity.GapGuaranteed = source.GapGuaranteed; newEntity.Occupied = source.Occupied; newEntity.IgnoreAdherence = source.IgnoreAdherence; newEntity.AsAWork = source.AsAWork; newEntity.AsARest = source.AsARest; newEntity.Name = newName; newEntity.Type = source.Type; newEntity.Background = source.Background; newEntity.SetNewTime(source.Start, source.End); foreach (var o in source.GetSubEventInsertRules()) { var copy = o; _entityFactory.Create <SubEventInsertRule>().Self( n => { n.TimeRange = copy.TimeRange; n.SubEvent = copy.SubEvent; n.SubEventLength = copy.SubEventLength; newEntity.AddSubEventInsertRule(n); }); } if (type == typeof(AssignmentType)) { var copy = source.As <AssignmentType>(); newEntity.Self <AssignmentType>(n => { n.ServiceQueue = copy == null ? null: copy.ServiceQueue; n.EstimationPriority = copy == null ? 1 : copy.EstimationPriority; n.Template1 = copy == null ? null : copy.Template1; n.Template2 = copy == null ? null : copy.Template2; n.Template3 = copy == null ? null : copy.Template3; n.TimeZoneInfoId = copy == null ? "Taipei Standard Time" : copy.TimeZone.Id; n.Country = copy == null ? "Taiwan" : copy.Country; if (copy != null) { n.WorkingDayMask.Weekdays = copy.WorkingDayMask.Weekdays; n.WorkingDayMask.Weekdays2 = copy.WorkingDayMask.Weekdays2; n.WorkingDayMask.Monthdays = copy.WorkingDayMask.Monthdays; } }); } //_termStyleRepository.MakePersistent(newEntity); //Reload(ref source); return(newEntity); }
public void Reload(ref BasicAssignmentType entity) { if (entity.SaftyGetProperty<bool, IEditingObject>(o => o.IsNew)) { _termStyleRepository.Evict(entity); } else { _termStyleRepository.Refresh(ref entity); entity.Rebuild(); } }
public void Reload(ref BasicAssignmentType entity) { if (entity.SaftyGetProperty <bool, IEditingObject>(o => o.IsNew)) { _termStyleRepository.Evict(entity); } else { _termStyleRepository.Refresh(ref entity); entity.Rebuild(); } }
public void Save(BasicAssignmentType entity) { //if (entity.IsNew()) _termStyleRepository.MakePersistent(entity); }