Beispiel #1
0
        public virtual void Copy(TaskExecutor to)
        {
            //All properties of object
            //and pointer of sons
            to.CodTaskExecutor = this.CodTaskExecutor;
            to.CodTypeOfTask = this.CodTypeOfTask;
            to.TaskExecutorName = this.TaskExecutorName;
            to.TimeStampTable = this.TimeStampTable;
            to.Version = this.Version;
            to.FormatMin = this.FormatMin;
            to.FormatMax = this.FormatMax;
            to.WeightMax = this.WeightMax;
            to.WeightMin = this.WeightMin;
            to.Pinza = this.Pinza;
            to.ControPinza = this.ControPinza;
            to.Laterale = this.Laterale;
            to.SetTaskExecutorEstimatedOn = this.SetTaskExecutorEstimatedOn;

        }
Beispiel #2
0
        private void SaveTaskExecutorInDictionary(TaskExecutor c)
        {
            CheckExistDic();
            TaskExecutor val;
            if (TaskExecutorsDic.TryGetValue(c.CodTaskExecutor, out val))
            {
                // yay, value exists!
                TaskExecutorsDic[c.CodTaskExecutor] = c;
            }
            else
            {
                // darn, lets add the value
                TaskExecutorsDic.Add(c.CodTaskExecutor, c);
            }

        }
        //SAREBBE MEGLIO FARE IL POLIMORFISMO A SECONDA DEL TASKEXECUTOR
        private void GenEmptyStep(TaskExecutor taskExecutor)
        {
            taskExecutor = taskExecutorRepository.GetSingle(taskExecutor.CodTaskExecutor);

            foreach (var tskEst in taskExecutor.SetTaskExecutorEstimatedOn)
            {

                Step newStep;

                //look for to=0 from=0
                newStep = tskEst.steps.OfType<AvarageRunPerRunStep>().FirstOrDefault(x => x.FromUnit == 9999999999 && x.ToUnit == 9999999999);

                if (newStep == null)
                {
                    newStep = new AvarageRunPerRunStep();
                    newStep.FromUnit = 9999999999;
                    newStep.ToUnit = 9999999999;
                    newStep.CodTaskEstimatedOn = tskEst.CodTaskEstimatedOn;
                    newStep.TimeStampTable = DateTime.Now;
                    tskEst.steps.Add(newStep);
                }

                //look for to=0 from=0
                newStep = tskEst.steps.OfType<DeficitForWeightStep>().FirstOrDefault(x => x.FromUnit == 9999999999 && x.ToUnit == 9999999999);

                if (newStep == null)
                {
                    newStep = new DeficitForWeightStep();
                    newStep.FromUnit = 9999999999;
                    newStep.ToUnit = 9999999999;
                    newStep.CodTaskEstimatedOn = tskEst.CodTaskEstimatedOn;
                    newStep.TimeStampTable = DateTime.Now;
                    tskEst.steps.Add(newStep);
                }


                //look for to=0 from=0
                newStep = tskEst.steps.OfType<DeficitOnCostForWeightStep>().FirstOrDefault(x => x.FromUnit == 9999999999 && x.ToUnit == 9999999999);

                if (newStep == null)
                {
                    newStep = new DeficitOnCostForWeightStep();
                    newStep.FromUnit = 9999999999;
                    newStep.ToUnit = 9999999999;
                    newStep.CodTaskEstimatedOn = tskEst.CodTaskEstimatedOn;
                    newStep.TimeStampTable = DateTime.Now;
                    tskEst.steps.Add(newStep);
                }

                //look for to=0 from=0
                newStep = tskEst.steps.OfType<BindingAvarageRunPerRunStep>().FirstOrDefault(x => x.FromUnit == 9999999999 && x.ToUnit == 9999999999);

                if (newStep == null)
                {
                    newStep = new BindingAvarageRunPerRunStep();
                    newStep.FromUnit = 9999999999;
                    newStep.ToUnit = 9999999999;
                    newStep.CodTaskEstimatedOn = tskEst.CodTaskEstimatedOn;
                    newStep.TimeStampTable = DateTime.Now;
                    tskEst.steps.Add(newStep);
                }

                //look for to=0 from=0
                newStep = tskEst.steps.OfType<BindingCostPerRunStep>().FirstOrDefault(x => x.FromUnit == 9999999999 && x.ToUnit == 9999999999);

                if (newStep == null)
                {
                    newStep = new BindingCostPerRunStep();
                    newStep.FromUnit = 9999999999;
                    newStep.ToUnit = 9999999999;
                    newStep.CodTaskEstimatedOn = tskEst.CodTaskEstimatedOn;
                    newStep.TimeStampTable = DateTime.Now;
                    tskEst.steps.Add(newStep);
                }

                //look for to=0 from=0
                newStep = tskEst.steps.OfType<CostPerMqStep>().FirstOrDefault(x => x.FromUnit == 9999999999 && x.ToUnit == 9999999999);

                if (newStep == null)
                {
                    newStep = new CostPerMqStep();
                    newStep.FromUnit = 9999999999;
                    newStep.ToUnit = 9999999999;
                    newStep.CodTaskEstimatedOn = tskEst.CodTaskEstimatedOn;
                    newStep.TimeStampTable = DateTime.Now;
                    tskEst.steps.Add(newStep);
                }


                //look for to=0 from=0
                newStep = tskEst.steps.OfType<CostPerRunStep>().FirstOrDefault(x => x.FromUnit == 9999999999 && x.ToUnit == 9999999999);

                if (newStep == null)
                {
                    newStep = new CostPerRunStep();
                    newStep.FromUnit = 9999999999;
                    newStep.ToUnit = 9999999999;
                    newStep.CodTaskEstimatedOn = tskEst.CodTaskEstimatedOn;
                    newStep.TimeStampTable = DateTime.Now;
                    tskEst.steps.Add(newStep);
                }


                //look for to=0 from=0
                newStep = tskEst.steps.OfType<CostPerColorStep>().FirstOrDefault(x => x.FromUnit == 9999999999 && x.ToUnit == 9999999999);

                if (newStep == null)
                {
                    newStep = new CostPerColorStep();
                    newStep.FromUnit = 9999999999;
                    newStep.ToUnit = 9999999999;
                    newStep.CodTaskEstimatedOn = tskEst.CodTaskEstimatedOn;
                    newStep.TimeStampTable = DateTime.Now;
                    tskEst.steps.Add(newStep);
                }


                //look for to=0 from=0
                newStep = tskEst.steps.OfType<CostPerRunStepBW>().FirstOrDefault(x => x.FromUnit == 9999999999 && x.ToUnit == 9999999999);

                if (newStep == null)
                {
                    newStep = new CostPerRunStepBW();
                    newStep.FromUnit = 9999999999;
                    newStep.ToUnit = 9999999999;
                    newStep.CodTaskEstimatedOn = tskEst.CodTaskEstimatedOn;
                    newStep.TimeStampTable = DateTime.Now;
                    tskEst.steps.Add(newStep);
                }



                //look for to=0 from=0
                newStep = tskEst.steps.OfType<BindingAvarageRunPerRunStep>().FirstOrDefault(x => x.FromUnit == 9999999999 && x.ToUnit == 9999999999);

                if (newStep == null)
                {
                    newStep = new BindingAvarageRunPerRunStep();
                    newStep.FromUnit = 9999999999;
                    newStep.ToUnit = 9999999999;
                    newStep.CodTaskEstimatedOn = tskEst.CodTaskEstimatedOn;
                    newStep.TimeStampTable = DateTime.Now;
                    tskEst.steps.Add(newStep);
                }

            }

            taskExecutorRepository.Edit(taskExecutor);
            taskExecutorRepository.Save();

        }