Esempio n. 1
0
 public void Delete(BasicAssignmentType entity)
 {
     if (!entity.IsNew())
     {
         _termStyleRepository.MakeTransient(entity);
     }
 }
Esempio n. 2
0
        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;
        }
Esempio n. 3
0
        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);
        }
Esempio n. 4
0
 public void Reload(ref BasicAssignmentType entity)
 {
     if (entity.SaftyGetProperty<bool, IEditingObject>(o => o.IsNew))
     {
         _termStyleRepository.Evict(entity);
     }
     else
     {
         _termStyleRepository.Refresh(ref entity);
         entity.Rebuild();
     }
 }
Esempio n. 5
0
 public void Reload(ref BasicAssignmentType entity)
 {
     if (entity.SaftyGetProperty <bool, IEditingObject>(o => o.IsNew))
     {
         _termStyleRepository.Evict(entity);
     }
     else
     {
         _termStyleRepository.Refresh(ref entity);
         entity.Rebuild();
     }
 }
Esempio n. 6
0
 public void Save(BasicAssignmentType entity)
 {
     //if (entity.IsNew())
     _termStyleRepository.MakePersistent(entity);
 }
Esempio n. 7
0
 public void Delete(BasicAssignmentType entity)
 {
     if (!entity.IsNew())
     {
         _termStyleRepository.MakeTransient(entity);
     }
 }
Esempio n. 8
0
 public void Save(BasicAssignmentType entity)
 {
     //if (entity.IsNew())
     _termStyleRepository.MakePersistent(entity);
 }