public static void processarXml(string dataHora) { IArquivoXML arquivo1 = new ArquivoXML("esporte-alunos"); ControllerXML.CarregarXML(arquivo1); XmlNodeList listaAlunos = ControllerXML.LerXML("aluno"); for (int i = 0; i < listaAlunos.Count; i++) { Aluno aluno = new Aluno() { Nome = listaAlunos[i]["nome"].InnerText, CPF = listaAlunos[i]["cpf"].InnerText, Nascimento = Convert.ToDateTime(listaAlunos[i]["datadenascimento"].InnerText), Matricula = listaAlunos[i]["matricula"].InnerText, Ativo = parseStringToBool(listaAlunos[i]["ativo"].InnerText) }; Aluno alunoDB = _alunoRepository.ObterPorMatricula(aluno.Matricula); if (alunoDB != null) { if (aluno.Ativo != alunoDB.Ativo) { alunoDB.Ativo = aluno.Ativo; _alunoRepository.Atualizar(alunoDB); _logger.Mensagem($"matricula>{aluno.Matricula}; nome>{aluno.Nome}; ativo>{!aluno.Ativo}; Alterado: ativo>{aluno.Ativo}", dataHora); } else { _logger.Mensagem($"matricula>{aluno.Matricula}; nome>{aluno.Nome}; ativo>{aluno.Ativo}; OK", dataHora); } } else { _alunoRepository.Adicionar(aluno); _logger.Mensagem($"matricula>{aluno.Matricula}; nome>{aluno.Nome}; ativo>{aluno.Ativo}; Adicionado", dataHora); } } arquivo1.Renomear(arquivo1.Nome + "-" + dataHora); }
private void Awake() { instance = this; if (Application.platform == RuntimePlatform.Android) { dataPathComportamento = Application.persistentDataPath + "/comportamento.xml"; dataPathEventos = Application.persistentDataPath + "/eventos.xml"; } else { dataPathComportamento = "comportamento.xml"; dataPathEventos = "eventos.xml"; } ReadXMLComportamentos(); ReadXMLEventos(); DontDestroyOnLoad(gameObject); }
public override string GetControllerName(HttpRequestMessage request) { ContractUtility.Requires <ArgumentNullException>(request.IsNotNull(), "request cannot be null"); if (_controllerNameInRequestObject.IsNullOrEmpty()) { _controllerNameInRequestObject = GetControllerNameFromRequest(request); if (_controllerNameInRequestObject.IsNullOrEmpty()) { HttpResponseUtility.ThrowHttpResponseError(HttpStatusCode.NotFound, "Controller not found", request); } } if (_controllerVersionInRequestObject == 0) { _controllerVersionInRequestObject = GetControllerVersion(request); } IEnumerable <ControllerXML> controllerXMLsInControllersXML = _controllersXML.ControllerXMLs.Where(x => x.EntityName.Equals(_controllerNameInRequestObject, StringComparison.InvariantCultureIgnoreCase)); if (controllerXMLsInControllersXML.IsNullOrEmpty()) { return(string.Empty); } controllerXMLsInControllersXML.ToList().ForEach(x => { x.Version = x.Version.Replace("v", string.Empty).Replace("V", string.Empty); } ); ControllerXML controllerXMLForSuppliedVersionNumber = null; if (_controllerVersionInRequestObject == 0) { double maxVersionNumber = controllerXMLsInControllersXML.Max(x => Convert.ToDouble(x.Version.IsNotNullOrEmpty() ? x.Version : "0")); controllerXMLForSuppliedVersionNumber = _controllersXML.ControllerXMLs.SingleOrDefault(x => x.EntityName == _controllerNameInRequestObject && (x.Version.IsNotNullOrEmpty() ? x.Version : "0") == maxVersionNumber.ToString()); } else { controllerXMLForSuppliedVersionNumber = _controllersXML.ControllerXMLs.SingleOrDefault(x => x.EntityName == _controllerNameInRequestObject && x.Version == _controllerVersionInRequestObject.ToString()); } if (controllerXMLForSuppliedVersionNumber.IsNull()) { return(string.Empty); } return(controllerXMLForSuppliedVersionNumber.ControllerName.IsNotNullOrEmpty() ? controllerXMLForSuppliedVersionNumber.ControllerName : _controllerNameInRequestObject); }