protected override int GetHashCodeCore() { unchecked { var hashcode = Inicio.GetHashCode(); hashcode = (hashcode * 397) ^ Fim.GetHashCode(); return(hashcode); } }
public void AdicionaFim(T elemento) { Celula nova = new Celula(elemento); if (TamanhoLista == 0) { Inicio = Fim = nova; TamanhoLista++; } else { Fim.SetProximo(nova); Fim = nova; TamanhoLista++; } }
//Método que remove do fim da lista public void RemoveFim() { if (Tamanho() == 0) { throw new Exception("A lista está vazia!"); } else if (Inicio == Fim) { Inicio = Fim = null; TamanhoLista--; } else { Fim = Fim.GetAnterior(); TamanhoLista--; } }
public void AdicionaFim(T elemento) { CelulaDupla nova = new CelulaDupla(elemento); if (TamanhoLista == 0) { Inicio = Fim = nova; TamanhoLista++; } else { nova.SetAnterior(Fim); //O anterior do novo Nó será o atual ultimo Fim.SetProximo(nova); //O proximo do atual ultimo será o novo Nó Fim = nova; // Atualiza-se o ultimo para o novo Nó TamanhoLista++; // incrementa o tamanho da lista } }
public void FinalTurno() { anim.SetTrigger("finaliza"); texto.GetComponent <Text>().color = corFim; texto.GetComponent <Text>().text = "Vez do Oponente"; anim.SetTrigger("espera"); meuTurn = false; vezNormal = true; SlotsCards.SetActive(false); ReservaTazos.SetActive(false); Regatar.GetComponent <Button>().interactable = false; EmJogo.GetComponent <Button>().interactable = false; Ativando.GetComponent <Button>().interactable = false; Ataque.GetComponent <Button>().interactable = false; Defende.GetComponent <Button>().interactable = false; Fim.GetComponent <Button>().interactable = false; }
//Método que remove do fim da lista public void RemoveFim() { if (Tamanho() == 0) { throw new Exception("A lista está vazia!"); } else if (Inicio == Fim) { Inicio = Fim = null; TamanhoLista--; } else { Celula penultimaPos = new Celula(Recupera(TamanhoLista - 2)); Fim = Fim.GetProximo(); Fim = penultimaPos; TamanhoLista--; } }
// Método para enviar os dados. public static void Enviar() { WWWForm form = new WWWForm(); // Comportamento form.AddField("id", jogador); form.AddField("dia", Data.ObterData()); form.AddField("dinheiro", Dinheiro.ObterValor()); form.AddField("despesa", Financeiro.ObterDespesa()); form.AddField("tempoDia", Comportamento.ObterTempo()); form.AddField("socializacao", Sentimento.ObterSocializacao()); form.AddField("cliqueGeral", Comportamento.ObterGeral()); form.AddField("cliqueEmail", Comportamento.ObterEmail()); form.AddField("cliqueProjeto", Comportamento.ObterProjeto()); form.AddField("cliqueTrabalho", Comportamento.ObterTrabalho()); form.AddField("cliqueNavegador", Comportamento.ObterNavegador()); form.AddField("cliqueComputador", Comportamento.ObterComputador()); Comportamento.Reiniciar(); // Desempenho foreach (Desempenho.Projeto projeto in Desempenho.Lista()) { form.AddField("desempenho_projeto[]", projeto.id); form.AddField("desempenho_progresso[]", projeto.progresso); form.AddField("desempenho_situacao[]", projeto.situacao.ToString()); } Desempenho.Reiniciar(); // Conclusao if (Fim.getCenario() != null) { form.AddField("conclusao", Fim.getCenario()); } // Enviando os dados do form através do método post. WWW envio = new WWW(url, form.data, form.headers); }
public IList <SAFX201> SAFX201() { var hora_inicio = "00:00:00"; var hora_fim = "23:59:59"; var data_inicio = Inicio.ToString("yyyy-MM-dd"); var data_fim = Fim.ToString("yyyy-MM-dd"); var filter = new BsonDocument() { { "$match", new BsonDocument() { { "activated_at", new BsonDocument() { { "$gte", DateTime.Parse($"{data_inicio}T{hora_inicio}.000-03:00") }, { "$lt", DateTime.Parse($"{data_fim}T{hora_fim}.000-03:00") } } }, { "company_uuid", Company } } } }; var pipeline = new[] { filter, new BsonDocument() { { "$lookup", new BsonDocument() { { "from", "companies" }, { "localField", "company_uuid" }, { "foreignField", "uuid" }, { "as", "company" } } } }, new BsonDocument() { { "$project", new BsonDocument() { { "device_info.pos_id", 1 }, { "document.number", 1 }, { "activated_at", 1 }, { "document.status", 1 }, { "customer.name", 1 }, { "customer.identification.cnpj", 1 }, { "document.qrcode_url", 1 }, { "document.access_key", 1 }, { "document.type", 1 }, { "payments", 1 }, { "company", 1 }, { "cart_items", 1 } } } } }; var results = collection.Aggregate <BsonDocument>(pipeline).ToList(); var list = new List <SAFX201>(); var estabelecimentos = new EmpresaEstabelecimento().GetAll(); foreach (var document in results) { //device info var hasNumEquip = document.TryGetElement("device_info", out BsonElement numEquip); var hasPosId = false; if (hasNumEquip) { var deviceInfoDoc = document.GetElement("device_info").Value.AsBsonDocument; hasPosId = deviceInfoDoc.TryGetElement("pos_id", out numEquip); } //device info var hasCompany = document.TryGetElement("company", out BsonElement comnpany); Company company = null; if (hasCompany) { company = BsonSerializer.Deserialize <Company>(document.GetElement("company").Value.AsBsonArray.First().AsBsonDocument); } //document var hasDocument = document.TryGetElement("document", out BsonElement documentElement); var hasDocStatus = false; var hasDocQrCode = false; var hasDocNumber = false; var hasDocAccessKey = false; var hasType = false; BsonElement documentStatus; BsonElement documentQrCode; BsonElement documentNumber; BsonElement documentAccessKey; BsonElement documentType; if (hasDocument) { var documentDoc = document.GetElement("document").Value.AsBsonDocument; hasDocStatus = documentDoc.TryGetElement("status", out documentStatus); hasDocQrCode = documentDoc.TryGetElement("qrcode_url", out documentQrCode); hasDocNumber = documentDoc.TryGetElement("number", out documentNumber); hasDocAccessKey = documentDoc.TryGetElement("access_key", out documentAccessKey); hasType = documentDoc.TryGetElement("type", out documentType); } if (hasType && documentType.Value.BsonType != BsonType.Null) { var type = documentType.Value.ToString(); if (type.Equals("devolution")) { continue; } } //customer var hasCustomer = document.TryGetElement("customer", out BsonElement customerElement); var hasCustomerName = false; var hasCustomerIdentification = false; BsonElement customerName; BsonElement customerIdentification; if (hasCustomer) { var customerDoc = document.GetElement("customer").Value.AsBsonDocument; hasCustomerName = customerDoc.TryGetElement("name", out customerName); hasCustomerIdentification = customerDoc.TryGetElement("identification", out customerIdentification); } //payments var hasPayments = document.TryGetElement("payments", out BsonElement payments); var hasRealAmount = false; var hasAmount = false; BsonArray paymentsList; BsonElement paymentRealAmount; BsonElement paymentAmount; if (hasPayments) { paymentsList = payments.Value.AsBsonArray; hasRealAmount = paymentsList.First().AsBsonDocument.TryGetElement("real_amount", out paymentRealAmount); hasAmount = paymentsList.First().AsBsonDocument.TryGetElement("amount", out paymentAmount); } //cart_item var hasCartItems = document.TryGetElement("cart_items", out BsonElement cartItens); BsonArray itemList; double valorDiscount = 0; if (hasCartItems) { itemList = cartItens.Value.AsBsonArray; var s = itemList .GroupBy(x => Convert.ToDouble(x.AsBsonDocument.GetElement("discount").Value)) .Select(n => n.Sum(s => Convert.ToDouble(s.AsBsonDocument.GetElement("discount").Value))).ToList(); if (s.Any()) { valorDiscount = s.FirstOrDefault(); } } var empresaEstabelecimento = estabelecimentos.FirstOrDefault(x => x.CNPJ == company.fiscal_informations.cnpj); if (empresaEstabelecimento != null) { var model = new SAFX201 { COD_EMPRESA = empresaEstabelecimento != null ? empresaEstabelecimento.COD_EMPRESA : "H00", COD_ESTAB = empresaEstabelecimento != null ? empresaEstabelecimento.COD_ESTAB : "H001", NUM_EQUIP = hasPosId ? numEquip.Value.ToString().Replace("-", "") : "0", NUM_CUPOM = hasDocNumber ? documentNumber.Value.ToString() : "0", DATA_EMISSAO = document.GetElement("activated_at").Value.BsonType == BsonType.Null ? DateTime.Now.ToString("yyyyMMdd") : DateTime.Parse(document.GetElement("activated_at").Value.ToString()).ToString("yyyyMMdd"), COD_MODELO = "59", IND_SITUACAO_CUPOM = hasDocStatus ? (documentStatus.Value.ToString().Equals("cancelled") ? "02" : documentStatus.Value.ToString().Equals("rejected") ? "04" : "00") : "00", NOME_CLIENTE = (hasCustomerName ? customerName.Value.ToString() : ""), CPF_CNPJ_CLIENTE = (hasCustomerIdentification ? customerIdentification.Value.ToString() : "").PadLeft(14, ' '), NUM_AUTENTIC_NFE = "0", VLR_TOT_LIQ = (hasAmount ? paymentAmount.Value.ToString() : "0"), VLR_ACRES = "0", VLR_DESC = valorDiscount.ToString(), VLR_DESP_ACS = "0", }; model.VLR_TOT = (double.Parse(model.VLR_TOT_LIQ) + valorDiscount).ToString(); if (hasDocAccessKey && documentAccessKey.Value.BsonType != BsonType.Null) { var key = documentAccessKey.Value.ToString(); if (key.Contains("CFe")) { if (key.Length > 3) { model.NUM_AUTENTIC_NFE = key.Remove(0, 3); } } else { model.NUM_AUTENTIC_NFE = key; } } model.NUM_AUTENTIC_NFE.PadLeft(44, '0'); list.Add(model); } } return(list); }
public async Task <IList <SAFX202Csv> > SAFX202CSV() { var hora_inicio = "00:00:00"; var hora_fim = "23:59:59"; var data_inicio = Inicio.ToString("yyyy-MM-dd"); var data_fim = Fim.ToString("yyyy-MM-dd"); var filter = new BsonDocument() { { "$match", new BsonDocument() { { "activated_at", new BsonDocument() { { "$gte", DateTime.Parse($"{data_inicio}T{hora_inicio}.000-03:00") }, { "$lt", DateTime.Parse($"{data_fim}T{hora_fim}.000-03:00") } } }, { "company_uuid", Company } } } }; //var pipeline = new[] { filter, new BsonDocument() { var pipeline = new[] { filter, new BsonDocument() { { "$lookup", new BsonDocument() { { "from", "companies" }, { "localField", "company_uuid" }, { "foreignField", "uuid" }, { "as", "company" } } } }, new BsonDocument() { { "$project", new BsonDocument() { { "device_info.pos_id", 1 }, { "document.number", 1 }, { "activated_at", 1 }, { "document.status", 1 }, { "customer.name", 1 }, { "customer.identification.cnpj", 1 }, { "document.qrcode_url", 1 }, { "document.xml", 1 }, { "payments", 1 }, { "company", 1 }, { "cart_items", 1 } } } } }; var results = await collection.Aggregate <SAFX202Model>(pipeline).ToListAsync(); var estabelecimentos = new EmpresaEstabelecimento().GetAll(); List <SAFX202Csv> listToFile = new List <SAFX202Csv>(); var data = results.Where(x => x.company != null && x.document != null && x.document.xml != null); foreach (var itemSale in data) //Parallel.ForEach(data, itemSale => { var estabelecimento = estabelecimentos .FirstOrDefault(x => x.CNPJ == itemSale.company[0].fiscal_informations.cnpj); if (estabelecimento != null) { itemSale.document.DealXml(); foreach (var cartItem in itemSale.cart_items) { //var model = new SAFX202Csv(itemSale, cartItem, estabelecimento); var model = new SAFX202Csv(); var list = model.DataGen(itemSale, cartItem, estabelecimento); if (list.Any()) { if (list.Any()) { list.ToList().ForEach(x => listToFile.Add(x)); } } } } }//); return(listToFile); }
public override string ToString() { return($"Início: {Inicio.ToShortDateString()} - Fim: {Fim.ToShortDateString()}"); }
/// <summary> /// Ajusta data Fim para último segundo do dia 23:59:59 /// </summary> public void AjustarHorarioFinal() { Fim = Fim.AddDays(1).AddSeconds(-1); }
/// <summary> /// Returns a <see cref="System.String" /> that represents this instance. /// </summary> /// <returns>A <see cref="System.String" /> that represents this instance.</returns> public override string ToString() { return("Inicio : " + Inicio.ToString() + "\nFim : " + Fim.ToString() + "\nNome : " + Nome.ToString()); }
/// <summary> /// Ajusta data Fim para último segundo do dia 23:59:59 /// </summary> public Periodo AjustarHorarioFinal() { Fim = Fim.AddDays(1).AddSeconds(-1); return(this); }
/// <summary> /// Returns a <see cref="System.String" /> that represents this instance. /// </summary> /// <returns>A <see cref="System.String" /> that represents this instance.</returns> public override string ToString() { return("Assunto : " + Assunto.ToString() + "\nLocal : " + Local.ToString() + "\nArea : " + Area.ToString() + "\nIDSessao : " + IdSessao.ToString() + "\nInicio : " + Inicio.ToString() + "\nFim : " + Fim.ToString()); }
// Update is called once per frame void Update() { if (c1 == true) { cronometro1 += Time.deltaTime; if (cronometro1 > Tlimite) { c1 = false; cronometro1 = 0; meuTurn = true; } } if (meuTurn == true) { anim.SetTrigger("seuTurno"); texto.GetComponent <Text>().text = "Sua Vez"; texto.GetComponent <Text>().color = corPadrao; anim.SetTrigger("espera"); meuTurn = false; c2 = true; } if (c2 == true) { cronometro2 += Time.deltaTime; if (cronometro2 > Tlimite) { c2 = false; cronometro2 = 0; Play = true; } } if (Play == true) { anim.SetTrigger("Play"); texto.GetComponent <Text>().text = "Jogue"; texto.GetComponent <Text>().color = corPadrao; anim.SetTrigger("espera"); Play = false; podePuxar = true; Regatar.GetComponent <Button>().interactable = true; EmJogo.GetComponent <Button>().interactable = true; Ativando.GetComponent <Button>().interactable = true; Ataque.GetComponent <Button>().interactable = true; Defende.GetComponent <Button>().interactable = true; Fim.GetComponent <Button>().interactable = true; } if (primeiraVez == true) { controlCard = 5; controlTazo = 3; } if (vezNormal == true) { controlCard = 1; controlTazo = 3; } if (podePuxar == true) { cartasPlayer.GetComponent <CardsDeck>().CartaSacada = controlCard; tazosPlayer.GetComponent <GuardianTazo>().SacandoTazo = controlTazo; podePuxar = false; } //ativarSelecao if (ativar == true) { if (Input.GetMouseButtonDown(0)) { RaycastHit hit; if (Physics.Raycast(kamera.ScreenPointToRay(Input.mousePosition), out hit)) { if (hit.collider.gameObject.tag == "Tazos" && Input.GetMouseButtonDown(0) && emSelecao == 0 && esperAlvo == false) { ativaTazo = hit.transform.gameObject; ativaTazo.GetComponent <Tazos1>().circuloDeSelecao.SetActive(true); //ativaTazo.GetComponent<Tazos1>().Emissor.SetActive (true); efeitoTazo = ativaTazo.GetComponent <Tazos1>().emitBase; efeitoTazo.GetComponent <EfeitoEmissores>().reinstancia = true; Debug.Log("AtivaTazo"); emSelecao = emSelecao + 2; Debug.Log(emSelecao); esperAlvo = true; Camin = efeitoTazo.GetComponent <EfeitoEmissores>().Caminho; } //se for tipo caminho if (Input.GetMouseButtonDown(0) && hit.collider.gameObject.tag == "Degrau") { receptorAlvo = hit.transform.gameObject; if (Camin == true) { //emSelecao = emSelecao -1; receptorAlvo.GetComponent <ReceptarEmissor>().acao = true; Debug.Log("Degrau"); // faz var do receptor ficar true } } if (Input.GetMouseButtonDown(0) && hit.collider.gameObject.tag == "Tazos" && esperAlvo == true) { int x = emSelecao; Debug.Log("Desativa Seleçao"); Debug.Log(x); emSelecao = emSelecao - 1; } if (emSelecao == 0) { ativaTazo.GetComponent <Tazos1>().circuloDeSelecao.SetActive(false); //ativaTazo.GetComponent<Tazos1>().Emissor.SetActive (false); efeitoTazo = ativaTazo.GetComponent <Tazos1>().emitBase; efeitoTazo.GetComponent <EfeitoEmissores>().consome = true; esperAlvo = false; } } } } }
// Metodo chamado para alterar o periodo public static void MudarPeriodo() { tempo++; if (Personagem.isDormindo) { if (Data.ObterData() >= 7) { Fim.setCenario(Fim.Cenario.CONCLUIDO); } if (Sentimento.ObterSocializacao() == 0) { Fim.setCenario(Fim.Cenario.SOCIAL); } if (Financeiro.ObterDespesa() >= 4) { Fim.setCenario(Fim.Cenario.FINANCEIRO); } } if (GameObject.Find("WebService") && !Data.Tutorial()) { if (tempo == 4 || Fim.getCenario() != null) { Projeto.AvaliarDesempenho(); WebService.Enviar(); } } if (tempo == 4) { tempo = 0; Data.MudaData(); if (SceneManager.GetActiveScene().name.Equals("Casa") && Data.dia > 1) { Interacao.Email(); isInteracao = true; } if (GameObject.Find("TelaNavegador")) { if (SceneManager.GetActiveScene().name.Equals("Casa") && Data.dia > 1 && Navegador.ListaSize() != 0) { Interacao.Noticia(); isInteracao = true; } Navegador.GerarNoticias("ProjetoRecusado", 0); GameObject.Find("TelaNavegador").GetComponent <Navegador>().DescontarDuracaoNoticia(); } if (isInteracao) { isInteracao = false; GameObject.Find("Personagem").GetComponent <Interacao>().aparecer(); } } if (Fim.getCenario() != null) { Personagem.isInicio = false; //GameObject.Find("Personagem").GetComponent<Personagem>().isInicio = true; SceneManager.LoadScene("Fim"); } Relogio.AlterarImagem(); Janela.alterarPaisagem(tempo); MovimentacaoCamila.mudarLocal(); }