Example #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);
        }
Example #2
0
        public static WorkerSize rebuildWorkerSize(WorkerSize inWorkerSize)
        {
            NomBodyPartSize nbs = rebuildNomBodyPartSize(inWorkerSize.NomBodyPartSize);
            Worker          wk  = rebuildWorker(inWorkerSize.Worker);
            WorkerSize      ws  = new WorkerSize(inWorkerSize.Id, wk, nbs, inWorkerSize.IsActive);

            return(ws);
        }
Example #3
0
        private Storage getStorageForWorkerNorma(NormaContent normaContent, Worker worker)
        //private Storage getStorageForWorkerNorma(NormaContent normaContent, IList<NomBodyPartSize> NomBodyPartSizes)
        {
            //Storage storage = null;
            List <Storage>  storages           = null;
            NomBodyPart     normaBodyPart      = normaContent.NomGroup.NomBodyPart;
            NomBodyPartSize workerBodyPartSize = null;

            foreach (var item in worker.NomBodyPartSizes)
            //foreach (var item in NomBodyPartSizes)
            {
                if (item.NomBodyPart.Id == normaBodyPart.Id)
                {
                    workerBodyPartSize = item;
                    break;
                }
            }

            Dictionary <string, object> query = new Dictionary <string, object>();

            query.Add("StorageName.Organization.Id", int.Parse(getCurrentEnterpriseId()));
            query.Add("Nomenclature.NomGroup.Id", normaContent.NomGroup.Id);
            query.Add("NomBodyPartSize.NomBodyPart.Id", normaBodyPart.Id);
            if (workerBodyPartSize != null && DataGlobals.SIZ_SIZE_ID != normaBodyPart.Id)
            {
                query.Add("NomBodyPartSize.SizeNumber", workerBodyPartSize.SizeNumber);
            }
            if (DataGlobals.CLOTH_SIZE_ID == normaBodyPart.Id)
            {
                query.Add("Growth.SizeNumber", worker.Growth);
            }
            storages = (List <Storage>)storageRepository.GetByCriteria(query);

            if (storages == null || storages.Count == 0)
            {
                query.Clear();
                query.Add("StorageName.Organization.Id", int.Parse(getCurrentEnterpriseId()));
                foreach (var normaNomGroup in normaContent.NormaNomGroups)
                {
                    query.Add("Nomenclature.NomGroup.Id", normaNomGroup.NomGroup.Id);
                    storages.AddRange(storageRepository.GetByLikeCriteria(query));
                    query.Remove("Nomenclature.NomGroup.Id");
                }
            }

            if (storages == null || storages.Count == 0)
            {
                storages.Add(new Storage());
            }

            return(storages[0]);
        }
Example #4
0
        public ActionResult _Insert_WorkerSizes(string id)
        {
            int             nomBodyPart = System.Int32.Parse(id);
            NomBodyPartSize nbps        = nomBodyPartSizeRepository.Get(nomBodyPart);
            //string workerId = HttpContext.Cache.Get("WorkerId").ToString();
            string     workerId = Session["WorkerId"].ToString();
            Worker     w        = workerRepository.Get(int.Parse(workerId));
            WorkerSize sw       = new WorkerSize();

            sw.Worker          = w;
            sw.NomBodyPartSize = nbps;
            sw.IsActive        = true;
            workerSizesRepository.SaveOrUpdate(sw);
            return(new JsonResult());
        }
Example #5
0
        public ActionResult _Update_WorkerSizes(string id, string oldId)
        {
            //string workerId = HttpContext.Cache.Get("WorkerId").ToString();
            string workerId = Session["WorkerId"].ToString();
            Dictionary <string, object> queryParams = new Dictionary <string, object>();

            queryParams.Add("Worker.Id", int.Parse(workerId));
            queryParams.Add("Id", int.Parse(oldId));
            WorkerSize      ws          = workerSizesRepository.FindOne(queryParams);
            int             nomBodyPart = System.Int32.Parse(id);
            NomBodyPartSize nbps        = nomBodyPartSizeRepository.Get(nomBodyPart);

            ws.NomBodyPartSize = nbps;
            workerSizesRepository.SaveOrUpdate(ws);
            return(new JsonResult());
        }
Example #6
0
 public static NomBodyPartSize rebuildNomBodyPartSize(NomBodyPartSize inNomBodyPartSize, List <string> excludeProperty)
 {
     try
     {
         if (inNomBodyPartSize != null)
         {
             NomBodyPartSize nbps = new NomBodyPartSize(inNomBodyPartSize.Id);
             nbps.SizeNumber = inNomBodyPartSize.SizeNumber;
             nbps.IsActive   = inNomBodyPartSize.IsActive;
             if (!isExclude(excludeProperty, "NomBodyPart"))
             {
                 nbps.NomBodyPart = rebuildNomBodyPart(inNomBodyPartSize.NomBodyPart);
             }
             return(nbps);
         }
     }
     catch { }
     return(null);
 }
Example #7
0
 public static NomBodyPartSize rebuildNomBodyPartSize(NomBodyPartSize inNomBodyPartSize)
 {
     return(rebuildNomBodyPartSize(inNomBodyPartSize, null));
 }