Ejemplo n.º 1
0
        public static Worker rebuildWorker(Worker inWorker, List <string> excludeProperty)
        {
            Sex s = null;

            if (!isExclude(excludeProperty, "Sex"))
            {
                if (inWorker.Sex != null)
                {
                    s      = new Sex(inWorker.Sex.Id);
                    s.Name = inWorker.Sex.Name;
                }
            }
            Worker w = new Worker(inWorker.Id, inWorker.TabN, inWorker.Fio, s, inWorker.IsActive);

            w.WorkDate       = inWorker.WorkDate;
            w.ChildcareBegin = inWorker.ChildcareBegin;
            w.ChildcareEnd   = inWorker.ChildcareEnd;
            w.IsTabu         = inWorker.IsTabu;
            if (!w.IsActive)
            {
                w.DateZ = inWorker.DateZ;
            }
            w.BeginDate = inWorker.BeginDate;
            if (!isExclude(excludeProperty, "nomBodyPartSizes"))
            {
                IList <NomBodyPartSize> nomBodyPartSizes = new List <NomBodyPartSize>();
                foreach (var item in inWorker.NomBodyPartSizes)
                {
                    NomBodyPartSize nomBodyPartSize = rebuildNomBodyPartSize(item);
                    nomBodyPartSizes.Add(nomBodyPartSize);
                }
                w.NomBodyPartSizes = nomBodyPartSizes;
            }
            if (!isExclude(excludeProperty, "WorkerCategory"))
            {
                if (inWorker.WorkerCategory != null)
                {
                    if (!isExclude(excludeProperty, "WorkerCategory"))
                    {
                        WorkerCategory wc = new WorkerCategory(inWorker.WorkerCategory.Id, inWorker.WorkerCategory.Name);
                        w.WorkerCategory = wc;
                    }
                }
            }

            if (!isExclude(excludeProperty, "WorkerGroup"))
            {
                if (inWorker.WorkerGroup != null)
                {
                    if (!isExclude(excludeProperty, "WorkerGroup"))
                    {
                        WorkerGroup wg = new WorkerGroup(inWorker.WorkerGroup.Id, inWorker.WorkerGroup.Name);
                        w.WorkerGroup = wg;
                    }
                }
            }

            return(w);
        }
 /// <summary>
 /// 初始化一个<see cref="WorkerCategoryOutputDto"/>类型的新实例
 /// </summary>
 public WorkerCategoryOutputDto(WorkerCategory entity)
 {
     Id              = entity.Id;
     Cn              = entity.Cn;
     Name            = entity.Name;
     CreatedTime     = entity.CreatedTime;
     LastUpdaterId   = entity.LastUpdaterId;
     LastUpdatedTime = entity.LastUpdatedTime;
 }