public DataTransfer<GetOutput> Get(string id)
        {
            DataTransfer<GetOutput> tranfer = new DataTransfer<GetOutput>();
            System.Int32 eventlogid=0;
            if (!string.IsNullOrEmpty(id) && System.Int32.TryParse(id,out eventlogid))
            {
                SystemEventLog systemeventlog = _iSystemEventLogRepository.GetSystemEventLog(eventlogid);
                if(systemeventlog!=null)
                {
                    tranfer.IsSuccess = true;
                    GetOutput output = new GetOutput();
                    output.CopyFrom(systemeventlog);
                    tranfer.Data=output ;

                }
                else
                {
                    tranfer.IsSuccess = false;
                    tranfer.Errors = new string[1];
                    tranfer.Errors[0] = "Error: No record found.";
                }

            }
            else
            {
                tranfer.IsSuccess = false;
                tranfer.Errors = new string[1];
                tranfer.Errors[0] = "Error: Invalid request.";
            }
            return tranfer;
        }
        public DataTransfer<string> Delete(string _id)
        {
            DataTransfer<string> tranfer = new DataTransfer<string>();
            System.Int32 drivestatisticid=0;
            if (!string.IsNullOrEmpty(_id) && System.Int32.TryParse(_id,out drivestatisticid))
            {
                 bool IsDeleted = _iDriveStatisticRepository.DeleteDriveStatistic(drivestatisticid);
                if(IsDeleted)
                {
                    tranfer.IsSuccess = true;
                    tranfer.Data=IsDeleted.ToString().ToLower() ;

                }
                else
                {
                    tranfer.IsSuccess = false;
                    tranfer.Errors = new string[1];
                    tranfer.Errors[0] = "Error: No record found.";
                }

            }
            else
            {
                tranfer.IsSuccess = false;
                tranfer.Errors = new string[1];
                tranfer.Errors[0] = "Error: Invalid request.";
            }
            return tranfer;
        }
        public static string GetUpdatedSystemPerformanceNetworkStatistic(string ThreadLastUpdateDateStr)
        {
            DataTransfer<List<ControlPanel.Core.Entities.NetworkStatistic>> dt = new DataTransfer<List<ControlPanel.Core.Entities.NetworkStatistic>>();
            try
            {
                NetworkStatisticRepository repo = new NetworkStatisticRepository();
                DateTime date = DateTime.UtcNow;
                if (!DateTime.TryParse(ThreadLastUpdateDateStr, out date))
                    date = DateTime.UtcNow;
                List<ControlPanel.Core.Entities.NetworkStatistic> stats = repo.GetNetworkPerformanceStatisticThreadByLastUpdatedDate(date.ToUniversalTime());

                for(int i=0;i<stats.Count;i++)
                {
                    if (stats[i].TotalUsage == 0 || stats[i].TotalUsage == 0.0)
                    {
                        stats[i].TotalUsage = 1;
                    }
                }
                if (stats != null) stats = stats.OrderBy(x => x.CreationDate).ToList();
                dt.Data = stats;
            }
            catch (Exception exp)
            {
                dt.IsSuccess = false;
                dt.Errors = new string[] { exp.Message };
            }

            return JSONhelper.GetString(dt);
        }
 public override void Run(DataTransfer data)
 {
     Card vanguard = game.getEnemyDeck().DrawCard();
     game.getDB().FillCardWithData(vanguard, data.getID());
     game.getEnemyField().Ride(vanguard);
     vanguard.TurnDown();
 }
        public DataTransfer<string> Delete(string id)
        {
            DataTransfer<string> tranfer = new DataTransfer<string>();
            System.Int32 eventlogid=0;
            if (!string.IsNullOrEmpty(id) && System.Int32.TryParse(id,out eventlogid))
            {
                 bool IsDeleted = _iSystemEventLogRepository.DeleteSystemEventLog(eventlogid);
                if(IsDeleted)
                {
                    tranfer.IsSuccess = true;
                    tranfer.Data=IsDeleted.ToString().ToLower() ;

                }
                else
                {
                    tranfer.IsSuccess = false;
                    tranfer.Errors = new string[1];
                    tranfer.Errors[0] = "Error: No record found.";
                }

            }
            else
            {
                tranfer.IsSuccess = false;
                tranfer.Errors = new string[1];
                tranfer.Errors[0] = "Error: Invalid request.";
            }
            return tranfer;
        }
        public DataTransfer<GetOutput> Get(string _id)
        {
            DataTransfer<GetOutput> tranfer = new DataTransfer<GetOutput>();
            System.Int32 drivestatisticid=0;
            if (!string.IsNullOrEmpty(_id) && System.Int32.TryParse(_id,out drivestatisticid))
            {
                DriveStatistic drivestatistic = _iDriveStatisticRepository.GetDriveStatistic(drivestatisticid);
                if(drivestatistic!=null)
                {
                    tranfer.IsSuccess = true;
                    GetOutput output = new GetOutput();
                    output.CopyFrom(drivestatistic);
                    tranfer.Data=output ;

                }
                else
                {
                    tranfer.IsSuccess = false;
                    tranfer.Errors = new string[1];
                    tranfer.Errors[0] = "Error: No record found.";
                }

            }
            else
            {
                tranfer.IsSuccess = false;
                tranfer.Errors = new string[1];
                tranfer.Errors[0] = "Error: Invalid request.";
            }
            return tranfer;
        }
    public void ExecuteDataTransfer(DataTransfer dataTransfer)
    {
        if(gameActions[dataTransfer.getGameAction()] == null)
        {
            return;
        }

        gameActions[dataTransfer.getGameAction()].Run(dataTransfer);
    }
Пример #8
0
    public void UpdatePlatform(DataTransfer.Platform dto) {
      roleVerifier.AuthenticateForAllRoles(OKBRoles.OKBAdministrator);

      using (OKBDataContext okb = new OKBDataContext()) {
        DataAccess.Platform entity = okb.Platforms.FirstOrDefault(x => x.Id == dto.Id);
        Convert.ToEntity(dto, entity);
        okb.SubmitChanges();
      }
    }
Пример #9
0
    public long AddPlatform(DataTransfer.Platform dto) {
      roleVerifier.AuthenticateForAllRoles(OKBRoles.OKBAdministrator);

      using (OKBDataContext okb = new OKBDataContext()) {
        DataAccess.Platform entity = Convert.ToEntity(dto); entity.Id = 0;
        okb.Platforms.InsertOnSubmit(entity);
        okb.SubmitChanges();
        return entity.Id;
      }
    }
        public static void ProcessData(Connection conn, DataTransfer transfer)
        {
            if (conn == null || transfer == null)
                return;

            if (transfer is AuthenticationRequest) {
                AuthenticationRequest authenticationRequest = (AuthenticationRequest)transfer;
                PlayerAccount player = new PlayerAccount(authenticationRequest.Username, authenticationRequest.Password);
                string authenticationResponseMessage = AccountFileHandler.ReadAccount(player);

                if (authenticationResponseMessage == null)
                    PlayerHandler.AddPlayer(player);

                conn.SendData(new AuthenticationResponse(authenticationResponseMessage));
            }
        }
Пример #11
0
 public ValueNameFilter(DataTransfer.StringComparison comparison, string value) {
   Comparison = comparison;
   Value = value;
 }
Пример #12
0
 public TimeSpanValueFilter(DataTransfer.NameOrdinalComparisonTimeSpanFilter filter) {
   Name = filter.Name;
   Comparison = filter.Comparison;
   Value = filter.Value;
 }
Пример #13
0
 public TimeSpanValueFilter(string name, DataTransfer.OrdinalComparison comparison, long value) {
   Name = name;
   Comparison = comparison;
   Value = value;
 }
Пример #14
0
 public ProblemClassNameFilter(DataTransfer.StringComparisonFilter filter) {
   Comparison = filter.Comparison;
   Value = filter.Value;
 }
Пример #15
0
 public OrFilter(DataTransfer.CombinedFilter filter) {
   Filters = new List<IFilter>(filter.Filters.Select(x => (IFilter)Activator.CreateInstance(Type.GetType(x.FilterTypeName), x)));
 }
        public DataTransfer<List<GetOutput>> GetAll()
        {
            DataTransfer<List<GetOutput>> tranfer = new DataTransfer<List<GetOutput>>();
            List<SystemEventLog> systemeventloglist = _iSystemEventLogRepository.GetAllSystemEventLog();
            if (systemeventloglist != null && systemeventloglist.Count>0)
            {
                tranfer.IsSuccess = true;
                List<GetOutput> outputlist = new List<GetOutput>();
                outputlist.CopyFrom(systemeventloglist);
                tranfer.Data = outputlist;

            }
            else
            {
                tranfer.IsSuccess = false;
                tranfer.Errors = new string[1];
                tranfer.Errors[0] = "Error: No record found.";
            }
            return tranfer;
        }
 public DataTransfer<PostOutput> Insert(PostInput Input)
 {
     DataTransfer<PostOutput> transer = new DataTransfer<PostOutput>();
     IList<string> errors = Validator.Validate(Input);
     if(errors.Count==0)
     {
         DriveStatistic drivestatistic = new DriveStatistic();
         PostOutput output = new PostOutput();
         drivestatistic.CopyFrom(Input);
         drivestatistic = _iDriveStatisticRepository.InsertDriveStatistic(drivestatistic);
         output.CopyFrom(drivestatistic);
         transer.IsSuccess = true;
         transer.Data = output;
     }
     else
     {
         transer.IsSuccess = false;
         transer.Errors = errors.ToArray<string>();
     }
     return transer;
 }
 public AlgorithmPlatformNameFilter(DataTransfer.StringComparison comparison, string value) {
   Comparison = comparison;
   Value = value;
 }
Пример #19
0
 public BinaryValueFilter(string name, DataTransfer.EqualityComparison comparison, byte[] value) {
   Name = name;
   Comparison = comparison;
   Value = value;
 }
 public static void ProcessData(Connection conn, DataTransfer transfer)
 {
     if (conn == null || transfer == null)
         return;
 }
 public override void Run(DataTransfer data)
 {
     Card card = game.getEnemyField().GetCardFromSoulByID(data.getID());
     game.getEnemyField().RemoveFromSoul(card);
     game.getEnemyField().Ride(card);
 }
Пример #22
0
 public ValueNameFilter(DataTransfer.StringComparisonFilter filter) {
   Comparison = filter.Comparison;
   Value = filter.Value;
 }
        public DataTransfer<List<GetOutput>> GetAll()
        {
            DataTransfer<List<GetOutput>> tranfer = new DataTransfer<List<GetOutput>>();
            List<DriveStatistic> drivestatisticlist = _iDriveStatisticRepository.GetAllDriveStatistic();
            if (drivestatisticlist != null && drivestatisticlist.Count>0)
            {
                tranfer.IsSuccess = true;
                List<GetOutput> outputlist = new List<GetOutput>();
                outputlist.CopyFrom(drivestatisticlist);
                tranfer.Data = outputlist;

            }
            else
            {
                tranfer.IsSuccess = false;
                tranfer.Errors = new string[1];
                tranfer.Errors[0] = "Error: No record found.";
            }
            return tranfer;
        }
Пример #24
0
 public FloatValueFilter(DataTransfer.NameOrdinalComparisonFloatFilter filter) {
   Name = filter.Name;
   Comparison = filter.Comparison;
   Value = filter.Value;
 }
 public DataTransfer<PutOutput> Update(PutInput Input)
 {
     DataTransfer<PutOutput> transer = new DataTransfer<PutOutput>();
     IList<string> errors = Validator.Validate(Input);
     if (errors.Count == 0)
     {
         DriveStatistic drivestatisticinput = new DriveStatistic();
         DriveStatistic drivestatisticoutput = new DriveStatistic();
         PutOutput output = new PutOutput();
         drivestatisticinput.CopyFrom(Input);
         DriveStatistic drivestatistic = _iDriveStatisticRepository.GetDriveStatistic(drivestatisticinput.DriveStatisticId);
         if (drivestatistic!=null)
         {
             drivestatisticoutput = _iDriveStatisticRepository.UpdateDriveStatistic(drivestatisticinput);
             if(drivestatisticoutput!=null)
             {
                 output.CopyFrom(drivestatisticoutput);
                 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;
 }
Пример #26
0
 public ProblemClassNameFilter(DataTransfer.StringComparison comparison, string value) {
   Comparison = comparison;
   Value = value;
 }
Пример #27
0
 public BinaryValueFilter(DataTransfer.NameEqualityComparisonByteArrayFilter filter) {
   Name = filter.Name;
   Comparison = filter.Comparison;
   Value = filter.Value;
 }
        public DataTransfer<PutOutput> Update(PutInput Input)
        {
            DataTransfer<PutOutput> transer = new DataTransfer<PutOutput>();

            SystemEventLog systemeventloginput = new SystemEventLog();
            SystemEventLog systemeventlogoutput = new SystemEventLog();
            PutOutput output = new PutOutput();
            systemeventloginput.CopyFrom(Input);
            SystemEventLog systemeventlog = _iSystemEventLogRepository.GetSystemEventLog(systemeventloginput.EventLogId);
            if (systemeventlog != null)
            {
                systemeventlogoutput = _iSystemEventLogRepository.UpdateSystemEventLog(systemeventloginput);
                if (systemeventlogoutput != null)
                {
                    output.CopyFrom(systemeventlogoutput);
                    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 AlgorithmPlatformNameFilter(DataTransfer.StringComparisonFilter filter) {
   Comparison = filter.Comparison;
   Value = filter.Value;
 }
Пример #30
0
 public FloatValueFilter(string name, DataTransfer.OrdinalComparison comparison, float value) {
   Name = name;
   Comparison = comparison;
   Value = value;
 }