示例#1
0
        public DataTransfer <PutOutput> Update(PutInput Input)
        {
            DataTransfer <PutOutput> transer             = new DataTransfer <PutOutput>();
            SystemProcess            systemprocessinput  = new SystemProcess();
            SystemProcess            systemprocessoutput = new SystemProcess();
            PutOutput output = new PutOutput();

            systemprocessinput.CopyFrom(Input);
            SystemProcess systemprocess = _iSystemProcessRepository.GetSystemProcess(systemprocessinput.SystemProcessId);

            if (systemprocess != null)
            {
                systemprocessoutput = _iSystemProcessRepository.UpdateSystemProcess(systemprocessinput);
                if (systemprocessoutput != null)
                {
                    output.CopyFrom(systemprocessoutput);
                    transer.IsSuccess = true;
                    transer.Data      = output;
                }
                else
                {
                    transer.IsSuccess = false;
                    transer.Errors    = new string[1];
                    transer.Errors[0] = "Error: Could not update.";
                }
            }
            else
            {
                transer.IsSuccess = false;
                transer.Errors    = new string[1];
                transer.Errors[0] = "Error: Record not found.";
            }
            return(transer);
        }
        public DataTransfer <PutOutput> Update(PutInput Input)
        {
            DataTransfer <PutOutput> transer = new DataTransfer <PutOutput>();
            IList <string>           errors  = Validator.Validate(Input);

            if (errors.Count == 0)
            {
                PerformanceStatistic performancestatisticinput  = new PerformanceStatistic();
                PerformanceStatistic performancestatisticoutput = new PerformanceStatistic();
                PutOutput            output = new PutOutput();
                performancestatisticinput.CopyFrom(Input);
                PerformanceStatistic performancestatistic = _iPerformanceStatisticRepository.GetPerformanceStatistic(performancestatisticinput.PerformanceStatisticId);
                if (performancestatistic != null)
                {
                    performancestatisticoutput = _iPerformanceStatisticRepository.UpdatePerformanceStatistic(performancestatisticinput);
                    if (performancestatisticoutput != null)
                    {
                        output.CopyFrom(performancestatisticoutput);
                        transer.IsSuccess = true;
                        transer.Data      = output;
                    }
                    else
                    {
                        transer.IsSuccess = false;
                        transer.Errors    = new string[1];
                        transer.Errors[0] = "Error: Could not update.";
                    }
                }
                else
                {
                    transer.IsSuccess = false;
                    transer.Errors    = new string[1];
                    transer.Errors[0] = "Error: Record not found.";
                }
            }
            else
            {
                transer.IsSuccess = false;
                transer.Errors    = errors.ToArray <string>();
            }
            return(transer);
        }