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); }
public string Execute(string argument) { SystemEventLogService logService = new SystemEventLogService(); PerformanceStatisticRepository pStatisticRepo = new PerformanceStatisticRepository(); try { PerformanceStatistic stats = new PerformanceStatistic(); stats = GetPCPerformance(); PerformanceStatistic input = new PerformanceStatistic(); input.CopyFrom(stats); if (input != null) { pStatisticRepo.InsertPerformanceStatistic(input); } List <NetworkStatistic> Networkstats = new List <NetworkStatistic>(); Networkstats = GetSystemNetworkStatistic(); if (Networkstats.Count > 0 && Networkstats != null) { foreach (NetworkStatistic nstatistic in Networkstats) { if (nstatistic.IpAddress != null) { //nstatistic.IpAddress = Convert.ToString(0); InsertNetworkStatistic(nstatistic); } } } return("Success"); } catch (Exception exp) { logService.InsertSystemEventLog(string.Format("Error in PerformanceStatisticThread: {0}", exp.Message), exp.StackTrace, EventCodes.Error); return("Error"); } }
public DataTransfer <PostOutput> Insert(PostInput Input) { DataTransfer <PostOutput> transer = new DataTransfer <PostOutput>(); IList <string> errors = Validator.Validate(Input); if (errors.Count == 0) { PerformanceStatistic performancestatistic = new PerformanceStatistic(); PostOutput output = new PostOutput(); performancestatistic.CopyFrom(Input); performancestatistic = _iPerformanceStatisticRepository.InsertPerformanceStatistic(performancestatistic); output.CopyFrom(performancestatistic); transer.IsSuccess = true; transer.Data = output; } else { transer.IsSuccess = false; transer.Errors = errors.ToArray <string>(); } return(transer); }
public string Execute(string argument) { SystemEventLogService logService = new SystemEventLogService(); PerformanceStatisticRepository pStatisticRepo = new PerformanceStatisticRepository(); try { PerformanceStatistic stats = new PerformanceStatistic(); stats = GetPCPerformance(); PerformanceStatistic input = new PerformanceStatistic(); input.CopyFrom(stats); if (input != null) { pStatisticRepo.InsertPerformanceStatistic(input); } List<NetworkStatistic> Networkstats = new List<NetworkStatistic>(); Networkstats = GetSystemNetworkStatistic(); if (Networkstats.Count > 0 && Networkstats != null) { foreach (NetworkStatistic nstatistic in Networkstats) { if (nstatistic.IpAddress != null) { //nstatistic.IpAddress = Convert.ToString(0); InsertNetworkStatistic(nstatistic); } } } return "Success"; } catch (Exception exp) { logService.InsertSystemEventLog(string.Format("Error in PerformanceStatisticThread: {0}", exp.Message), exp.StackTrace, EventCodes.Error); return "Error"; } }
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; }
public DataTransfer<PostOutput> Insert(PostInput Input) { DataTransfer<PostOutput> transer = new DataTransfer<PostOutput>(); IList<string> errors = Validator.Validate(Input); if(errors.Count==0) { PerformanceStatistic performancestatistic = new PerformanceStatistic(); PostOutput output = new PostOutput(); performancestatistic.CopyFrom(Input); performancestatistic = _iPerformanceStatisticRepository.InsertPerformanceStatistic(performancestatistic); output.CopyFrom(performancestatistic); transer.IsSuccess = true; transer.Data = output; } else { transer.IsSuccess = false; transer.Errors = errors.ToArray<string>(); } return transer; }