コード例 #1
0
        public void Alterar(Nota nota)
        {
            try
            {
                Nota notaAux = new Nota();
                notaAux.ID = nota.ID;

                List<Nota> resultado = this.Consultar(notaAux, TipoPesquisa.E);

                if (resultado == null || resultado.Count == 0)
                    throw new NotaNaoAlteradaExcecao();

                notaAux = resultado[0];

                notaAux.ProfessorDisciplinaSalaID = nota.ProfessorDisciplinaSalaID;
                notaAux.Aprovado = nota.Aprovado;
                notaAux.Rec = nota.Rec;
                notaAux.RecFinal = nota.RecFinal;
                notaAux.Vc1 = nota.Vc1;
                notaAux.Vc2 = nota.Vc2;
                notaAux.Vp = nota.Vp;
                notaAux.Status = nota.Status;
                Confirmar();

            }
            catch (Exception)
            {

                throw new NotaNaoAlteradaExcecao();
            }
        }
コード例 #2
0
 public ICollection <Nota> Pesquisar(Nota t)
 {
     return(_notaRepository.Pesquisar(t));
 }
コード例 #3
0
 public void Deletar(Nota t)
 {
     _notaRepository.Deletar(t);
 }
コード例 #4
0
 public void Editar(Nota nota)
 {
     contexto.Entry(nota).State = Microsoft.EntityFrameworkCore.EntityState.Modified;
     contexto.Notas.Update(nota);
     contexto.SaveChanges();
 }
コード例 #5
0
        public ActionResult Excluir(Nota nota)
        {
            _nota.Deletar(nota);

            return(View());
        }
コード例 #6
0
 public void Executa(Nota nota)
 {
     WriteLine("Foi feito o backup dessa nota");
 }
コード例 #7
0
 private void Nota_Attach(Nota entity)
 {
     entity.Matricula = this;
 }
コード例 #8
0
        public void Incluir(Nota nota)
        {
            try
            {
                db.Nota.InsertOnSubmit(nota);
            }
            catch (Exception)
            {

                throw new NotaNaoIncluidaExcecao();
            }
        }
コード例 #9
0
        public bool BuscarNota(string tituloNota, out Nota nota)
        {
            bool busqueda = this.ListaNotas.TryGetValue(tituloNota, out nota);

            return(busqueda);
        }
コード例 #10
0
        private RetornoSimples EnviarEvento(StringBuilder eventoXml, string id, string arquivoEvento, string schema)
        {
            var documentXml = Assinar(eventoXml, id);
            var xmlDoc      = new XmlDocument();

            xmlDoc.Load(arquivoEvento);
            var conteudoXml = xmlDoc.OuterXml;
            var nota        = new Nota(NFeContexto)
            {
                CaminhoFisico = arquivoEvento
            };
            var bllXml    = new Xml();
            var xmlString = new StringBuilder();

            xmlString.Append("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
            xmlString.Append("<envEvento versao=\"1.00\" xmlns=\"http://www.portalfiscal.inf.br/nfe\">");
            xmlString.Append("	<idLote>0131318</idLote>");
            xmlString.Append(conteudoXml);
            xmlString.Append("</envEvento>");

            var sw2 = File.CreateText(arquivoEvento);

            sw2.Write(xmlString.ToString());
            sw2.Close();

            //Verifica se a nota está de acordo com o schema, se não estiver vai disparar um erro
            try
            {
                bllXml.ValidaSchema(arquivoEvento,
                                    Util.ContentFolderSchemaValidacao + "\\" + NFeContexto.Versao.PastaXml + "\\" + schema);
            }
            catch (Exception e)
            {
                throw new Exception("Erro ao validar Nota: " + e.Message);
            }

            if (_producao)
            {
                var recepcao  = new nfeRecepcaoEvento.RecepcaoEvento();
                var cabecalho = new nfeCabecMsg
                {
                    cUF         = _uf,
                    versaoDados = "1.00"
                };

                recepcao.nfeCabecMsgValue = cabecalho;
                recepcao.ClientCertificates.Add(NFeContexto.Certificado);

                var resposta = recepcao.nfeRecepcaoEvento(Xml.StringToXml(xmlString.ToString()));

                var status = resposta["retEvento"]["infEvento"]["xMotivo"].InnerText;
                var motivo = resposta["retEvento"]["infEvento"]["cStat"].InnerText;
                return(new RetornoSimples(status, motivo));
            }
            else
            {
                var recepcao  = new NfeRecepcaoEvento1.RecepcaoEvento();
                var cabecalho = new NfeRecepcaoEvento1.nfeCabecMsg
                {
                    cUF         = _uf,
                    versaoDados = "1.00"
                };

                recepcao.nfeCabecMsgValue = cabecalho;
                recepcao.ClientCertificates.Add(NFeContexto.Certificado);

                var resposta = recepcao.nfeRecepcaoEvento(Xml.StringToXml(xmlString.ToString()));

                var status = resposta["retEvento"]["infEvento"]["xMotivo"].InnerText;
                var motivo = resposta["retEvento"]["infEvento"]["cStat"].InnerText;
                return(new RetornoSimples(status, motivo));
            }
        }
コード例 #11
0
        public void Put(Guid id, [FromBody] Nota nota)
        {
            var contexto = new MongoDbContext();

            contexto.Notas.ReplaceOne(o => o.Id == id, nota);
        }
コード例 #12
0
        private void btnSalvar_Click(object sender, EventArgs e)
        {
            string  dataEmissao            = mskDtVenda.Text.Trim();
            int     numeroNota             = Convert.ToInt32(txtNunNota.Text.Trim());
            string  modeloNota             = "55";
            string  serie                  = txtSerie.Text;
            string  finalidadeNota         = comboBox1.SelectedIndex.ToString();
            int     cadastro               = Convert.ToInt32(txtcodFornecedor.Text.Trim());
            string  cfop                   = txtCodCfod.Text.Trim();
            string  nfeReferenciada        = txtNFEreferenciada.Text.Trim();
            decimal subtotal               = Convert.ToDecimal(txtsomaTudo.Text.Trim());
            decimal desconto               = Convert.ToDecimal(txtSomaDesconto.Text.Trim());
            decimal totaldaNotacomdesconto = Convert.ToDecimal(txtCdesconto.Text.Trim());
            string  obsNota                = txtObs.Text.Trim();
            string  transportador;

            if (txtCodTransp.Text == string.Empty)
            {
                transportador = "0";
            }
            else
            {
                transportador = txtCodTransp.Text.Trim();
            }
            string  vencimento = txtVenc.Text;
            string  chaveNfe;
            string  protocolo;
            string  recibo;
            string  statusNota;
            string  dataHoraProtocolo;
            int     notcancelada;
            int     notInutilizada;
            string  motivoCancel;
            string  peso;
            string  volumes;
            string  marca;
            decimal icmsBase;
            decimal icmsValor;
            decimal icmsPercentual;
            decimal icmsStValor;
            string  nfeXml;
            decimal ipiValor;

            string updateNota = "update nota set not_dtemissao = @not_dtemissao, not_numero = @not_numero, not_modelo = @not_modelo, not_serie = not_serie, not_finalidade = @not_finalidade, cadastro = @cadastro, cfo_codigo = @cfo_codigo, not_referenciada = @not_referenciada, not_subtotal = @not_subtotal, not_desconto = @not_desconto, not_nfetotal = @not_nfetotal, not_obs = @not_obs, cod_forncedor = @cad_fornecedor, not_vencimento = @not_vencimento, not_cancelada = @not_cancelada, not_inutilizada = @not_inutilizada, not_peso = @not_peso, not_volume = @not_volume, not_marca = @not_marca, not_icmsbase = @not_icmsbase, not_icmsvalor = @not_icmsvalor, not_icmspercentual = @not_icmspercentual, not_icmsstvalor = @not_icmsstvalor   where not_codigo = " + txtControle.Text;

            SqlConnection con = new SqlConnection();

            con.ConnectionString = Properties.Settings.Default.Ducaun;
            SqlCommand cmd = new SqlCommand(updateNota, con);

            cmd.CommandType = CommandType.Text;
            cmd.Parameters.Add("@not_dtemissao", SqlDbType.NVarChar).Value     = dataEmissao;
            cmd.Parameters.Add("@not_numero", SqlDbType.Int).Value             = numeroNota;
            cmd.Parameters.Add("@not_modelo", SqlDbType.NVarChar).Value        = modeloNota;
            cmd.Parameters.Add("@not_serie", SqlDbType.NVarChar).Value         = serie;
            cmd.Parameters.Add("@not_finalidade", SqlDbType.NVarChar).Value    = finalidadeNota;
            cmd.Parameters.Add("@cadastro", SqlDbType.Int).Value               = cadastro;
            cmd.Parameters.Add("@cfo_codigo", SqlDbType.Int).Value             = cfop;
            cmd.Parameters.Add("@not_referenciada", SqlDbType.NVarChar).Value  = nfeReferenciada;
            cmd.Parameters.Add("@not_subtotal", SqlDbType.Decimal).Value       = subtotal;
            cmd.Parameters.Add("@not_desconto", SqlDbType.Decimal).Value       = desconto;
            cmd.Parameters.Add("@not_nfetotal", SqlDbType.Decimal).Value       = totaldaNotacomdesconto;
            cmd.Parameters.Add("@not_obs", SqlDbType.NVarChar).Value           = obsNota;
            cmd.Parameters.Add("@cad_fornecedor", SqlDbType.Int).Value         = transportador;
            cmd.Parameters.Add("@not_vencimento", SqlDbType.NVarChar).Value    = vencimento;
            cmd.Parameters.Add("@not_cancelada", SqlDbType.Int).Value          = 0;
            cmd.Parameters.Add("@not_inutilizada", SqlDbType.Int).Value        = 0;
            cmd.Parameters.Add("@not_peso", SqlDbType.NVarChar).Value          = 1;
            cmd.Parameters.Add("@not_volume", SqlDbType.NVarChar).Value        = 1;
            cmd.Parameters.Add("@not_marca", SqlDbType.NVarChar).Value         = "marca";
            cmd.Parameters.Add("@not_icmsbase", SqlDbType.Decimal).Value       = 0;
            cmd.Parameters.Add("@not_icmsvalor", SqlDbType.Decimal).Value      = 0;
            cmd.Parameters.Add("@not_icmspercentual", SqlDbType.Decimal).Value = 0;
            cmd.Parameters.Add("@not_icmsstvalor", SqlDbType.Decimal).Value    = 0;


            con.Open();
            try
            {
                int i = cmd.ExecuteNonQuery();
                if (i > 0)
                {
                    u.messageboxSucesso();
                }
                var nfeContexto = new NFeContexto(false, NFeEletronica.Versao.NFeVersao.VERSAO_3_1_0, new GerenciadorDeCertificado());
                var nota        = new Nota(nfeContexto);
                // nota.ide.cUF = txtci continuar daqui, colocar campo oculto na tela pra salvar o estado da  nota fiscalzr
                nota.ide.natOp  = txtDescCfop.Text;
                nota.ide.indPag = "0";
                nota.ide.mod    = "55";
                nota.ide.serie  = txtSerie.Text;
                //"select a.cod_produto, b.des_produto, a.ITP_QTDE, a.ITP_VALOR, a.ITP_TOTAL from ITEMPEDIDO a join produtos b on a.cod_produto = b.cod_produto where ped_codigo
                string ultimoReg = "Select not_codigo From nota where not_codigo = (Select MAX(not_numero) From nota)";
                string filial    = "select * from filial where fil_codigo = ";

                SqlConnection con1 = new SqlConnection();
                con.ConnectionString = Properties.Settings.Default.Ducaun;
                SqlCommand cmd2 = new SqlCommand(ultimoReg, con1);
                SqlCommand cmd3 = new SqlCommand(filial, con1);


                con.Open();
                SqlDataReader dR  = cmd2.ExecuteReader();
                SqlDataReader dr1 = cmd3.ExecuteReader();


                if (dR.Read())
                {
                    txtNunNota.Text = 1 + dR[0].ToString();
                }
                con.Close();
                nota.ide.nNF      = txtNunNota.Text;
                nota.ide.dEmi     = mskDtVenda.Text;
                nota.ide.tpNF     = "1"; //normal contingencia
                nota.ide.cMunFG   = txtIbge.Text;
                nota.ide.tpImp    = "1";
                nota.ide.tpEmis   = "1";
                nota.ide.cDV      = "0";
                nota.ide.idDest   = "1";
                nota.ide.indFinal = "0";
                nota.ide.indPres  = "0";
                //nota.ide.tpAmb = "2";
                nota.ide.finNFe  = finalidadeNota;
                nota.ide.procEmi = "3";// soft utilizado

                if (dr1.Read())
                {
                    nota.emit.CNPJ    = dr1[9].ToString();
                    nota.emit.xNome   = dr1[1].ToString();
                    nota.emit.xLgr    = dr1[3].ToString();
                    nota.emit.nro     = dr1[10].ToString();
                    nota.emit.xBairro = dr1[4].ToString();
                    nota.emit.cMun    = dr1[13].ToString();
                    nota.emit.xMun    = "Maringá";
                    nota.emit.UF      = "PR";
                    nota.emit.CEP     = "87070300";
                    nota.emit.cPais   = "1058";
                    nota.emit.xPais   = "Brasil";
                    nota.emit.fone    = "449988316578";
                    nota.emit.IE      = dr1[12].ToString();
                    nota.emit.CRT     = "1";
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Erro: Erro Ao Gravar no banco de dados " + ex.ToString());
            }
            finally
            {
                con.Close();
            }
            Unovo();
        }
コード例 #13
0
ファイル: NotaController.cs プロジェクト: Alybb8/APIRESOLVIDO
 public ActionResult PostNotas(Nota nota)
 {
     new Util <Nota>().AddNota(nota);
     return(Ok());
 }
コード例 #14
0
        public void Eventos()
        {
            Load += (s, e) =>
            {
                var nota = new Model.Nota().FindById(idNota).FirstOrDefault <Model.Nota>();

                if (nota == null)
                {
                    return;
                }

                nsefaz.Text        = (!String.IsNullOrEmpty(nota.nr_Nota)) ? nota.nr_Nota : "";
                serie.Text         = (!String.IsNullOrEmpty(nota.Serie)) ? nota.Serie : "";
                status.Text        = (!String.IsNullOrEmpty(nota.Status)) ? nota.Status : "";
                chavedeacesso.Text = (!String.IsNullOrEmpty(nota.ChaveDeAcesso)) ? nota.ChaveDeAcesso : "";

                Emitir.Visible = false;
            };

            btnDetalhes.Click += (s, e) =>
            {
                //Nota.disableCampos = true;
                Nota.Id = idNota;
                Nota nota = new Nota();
                nota.TopMost = true;
                nota.ShowDialog();
            };

            Emitir.Click += (s, e) =>
            {
                //var checkNota = _modelNota.FindByIdPedido(idPedido).WhereNotNull("status").Where("nota.tipo", "NFe").FirstOrDefault();
                //var checkNota = _modelNota.FindByIdPedidoUltReg(idPedido, "", "NFe").FirstOrDefault<Model.Nota>();
                var checkNota = new Model.Nota().FindById(idNota).FirstOrDefault <Model.Nota>();
                if (checkNota == null)
                {
                    Model.Nota _modelNotaNova = new Model.Nota();

                    _modelNotaNova.Id        = 0;
                    _modelNotaNova.Tipo      = "NFe";
                    _modelNotaNova.Status    = "Pendente";
                    _modelNotaNova.id_pedido = idPedido;
                    _modelNotaNova.Save(_modelNotaNova, false);

                    checkNota = new Model.Nota().FindByIdPedidoUltReg(idPedido, "", "NFe").FirstOrDefault <Model.Nota>();
                }

                if (checkNota.Status == "Cancelada")
                {
                    if (Home.pedidoPage == "Notas")
                    {
                        Alert.Message("Atenção!", "Não é possível emitir uma nota Autorizada/Cancelada.", Alert.AlertType.warning);
                        return;
                    }

                    var result = AlertOptions.Message("Atenção!", "Existem registro(s) de nota(s) cancelada(s) a partir desta venda. Deseja gerar um nova nota?", AlertBig.AlertType.warning, AlertBig.AlertBtn.YesNo);
                    if (result)
                    {
                        Model.Nota _modelNotaNova = new Model.Nota();

                        _modelNotaNova.Id        = 0;
                        _modelNotaNova.Tipo      = "NFe";
                        _modelNotaNova.Status    = "Pendente";
                        _modelNotaNova.id_pedido = idPedido;
                        _modelNotaNova.Save(_modelNotaNova, false);

                        checkNota = new Model.Nota().FindByIdPedidoUltReg(idPedido, "", "NFe").FirstOrDefault <Model.Nota>();
                    }
                }

                if (checkNota.Status != "Pendente")
                {
                    Alert.Message("Atenção!", "Não é possível emitir uma nota Autorizada/Cancelada.", Alert.AlertType.warning);
                    return;
                }

                _modelNota = checkNota;

                retorno.Text = "Emitindo NF-e .......................................... (1/2)";

                if (p1 == 0)
                {
                    p1 = 1;
                    WorkerBackground.RunWorkerAsync();
                }
                else
                {
                    Alert.Message("Ação não permitida", "Aguarde processo finalizar", Alert.AlertType.warning);
                }
            };

            CartaCorrecao.Click += (s, e) =>
            {
                //var checkNota = new Model.Nota().FindByIdPedidoUltReg(idPedido, "", "NFe").FirstOrDefault<Model.Nota>();
                var checkNota = new Model.Nota().FindById(idNota).FirstOrDefault <Model.Nota>();
                if (checkNota == null || checkNota?.Status != "Autorizada")
                {
                    Alert.Message("Ação não permitida!", "Não é possível emitir uma Carta de Correção.", Alert.AlertType.warning);
                    return;
                }

                _modelNota = checkNota;

                CartaCorrecao cce = new CartaCorrecao();
                cce.TopMost = true;
                cce.Show();

                Application.OpenForms["OpcoesNfeRapida"].Close();
            };

            Cancelar.Click += (s, e) =>
            {
                //var checkNota = new Model.Nota().FindByIdPedidoUltReg(idPedido, "", "NFe").FirstOrDefault<Model.Nota>();
                var checkNota = new Model.Nota().FindById(idNota).FirstOrDefault <Model.Nota>();
                if (checkNota == null || checkNota?.Status != "Autorizada")
                {
                    Alert.Message("Ação não permitida!", "Não é possível cancelar uma nota Pendente/Cancelada.", Alert.AlertType.warning);
                    return;
                }

                _modelNota = checkNota;

                CartaCorrecaoAdd.tela = "Cancelar";
                CartaCorrecaoAdd f = new CartaCorrecaoAdd();
                f.TopMost = true;
                if (f.ShowDialog() == DialogResult.OK)
                {
                    CartaCorrecaoAdd.tela = "";
                    justificativa         = CartaCorrecaoAdd.justificativa;

                    retorno.Text = "Cancelando NF-e .......................................... (1/2)";

                    p1 = 4;
                    WorkerBackground.RunWorkerAsync();
                }
            };

            EnviarEmail.Click += (s, e) =>
            {
                //var checkNota = new Model.Nota().FindByIdPedidoUltReg(idPedido, "", "NFe").FirstOrDefault<Model.Nota>();
                var checkNota = new Model.Nota().FindById(idNota).FirstOrDefault <Model.Nota>();
                if (checkNota == null || checkNota?.Status == "Pendente")
                {
                    Alert.Message("Ação não permitida!", "Não é possível enviar uma nota Pendente.", Alert.AlertType.warning);
                    return;
                }

                _modelNota = checkNota;

                CartaCorrecaoAdd.tela   = "Email";
                CartaCorrecaoAdd.idNota = idNota;
                CartaCorrecaoAdd f = new CartaCorrecaoAdd();
                f.TopMost = true;
                if (f.ShowDialog() == DialogResult.OK)
                {
                    CartaCorrecaoAdd.tela = "";
                    justificativa         = CartaCorrecaoAdd.justificativa;

                    retorno.Text = "Enviando NF-e .......................................... (1/2)";

                    p1 = 5;
                    WorkerBackground.RunWorkerAsync();
                }
            };

            Imprimir.Click += (s, e) =>
            {
                var checkNota = new Model.Nota().FindByIdPedidoUltReg(idPedido, "", "NFe").FirstOrDefault <Model.Nota>();
                if (checkNota == null || checkNota?.Status == "Pendente")
                {
                    Alert.Message("Opps!", "Emita a nota para imprimir.", Alert.AlertType.warning);
                    return;
                }

                _modelNota = checkNota;

                retorno.Text = "Imprimindo NF-e .......................................... (1/2)";

                if (p1 == 0)
                {
                    p1 = 2;
                    WorkerBackground.RunWorkerAsync();
                }
                else
                {
                    Alert.Message("Ação não permitida", "Aguarde processo finalizar", Alert.AlertType.warning);
                }
            };

            using (var b = WorkerBackground)
            {
                b.DoWork += async(s, e) =>
                {
                    switch (p1)
                    {
                    case 1:

                        //_modelNota = _modelNota.FindByIdPedido(idPedido).FirstOrDefault<Model.Nota>();
                        //if (_modelNota == null)
                        //{
                        //    _modelNota.Id = 0;
                        //    _modelNota.id_pedido = idPedido;
                        //    _modelNota.Save(_modelNota);
                        //}

                        _msg = new Controller.Fiscal().Emitir(idPedido, "NFe", _modelNota.Id);
                        break;

                    case 2:

                        if (IniFile.Read("NFe", "APP") != "Uninfe")
                        {
                            var msg = new Controller.Fiscal().Imprimir(idPedido, "NFe", _modelNota.Id);
                            if (!msg.Contains(".pdf"))
                            {
                                _msg = msg;
                            }
                        }
                        else
                        {
                            EmissorImprimirDanfe();
                        }

                        break;

                    case 3:
                        //_msg = new Controller.Fiscal().EmitirCCe(idPedido, "Nota gerada com informacoes incorretas, por gentileza verificar as corretas");
                        break;

                    case 4:
                        if (justificativa.Length <= 15)
                        {
                            break;
                        }

                        _msg = new Controller.Fiscal().Cancelar(idPedido, "NFe", justificativa, _modelNota.Id);
                        break;

                    case 5:
                        _msg = new Controller.Fiscal().EnviarEmail(idPedido, justificativa, "NFe", _modelNota.Id);
                        break;
                    }
                };

                b.RunWorkerCompleted += async(s, e) =>
                {
                    p1 = 0;

                    if (!String.IsNullOrEmpty(_msg))
                    {
                        retorno.Text = _msg;
                    }
                };
            }

            FormClosing += (s, e) =>
            {
                OpcoesNfeRapida.idPedido = 0;
                OpcoesNfeRapida.idNota   = 0;
            };
        }
コード例 #15
0
 public void AdaugaNotaLaDisciplina(Disciplina disciplina, Nota nota)
 {
     Note.Adauga(disciplina,nota);
 }
コード例 #16
0
ファイル: gNotas.cs プロジェクト: urgamedev/VoaVivaldo
	void VerificarPercursoDePontuacao (Vector3 posNota, Nota nota)
	{
		if( nota.mInfo.tipo == TipoDeNota.PAUSA ) return;
		
		if( gPontuacao.s.VerificarPontuacao( nota, gGame.s.player ) == false )
		{
			if( (int)nota.mInfo.tipo >= (int)TipoDeNota.NOTA && gPontuacao.s.pontuandoNotaLonga )
			{
//				DestruirNota(nota);
			} 
			
			return;
		} 
		
		
		
		if( nota.VerificarZonaDePontuacao( areaDePontuacao, posNota ) && !nota.jaPontuei && !nota.kill  )
		{
			if( nota.mInfo.tipo == TipoDeNota.NOTA)
			{				
				gPontuacao.s.PontuarNotaComum( nota, gGame.s.player ) ;
				nota.jaPontuei = true;			
				nota.kill = true;
				gAudio.s.RecuperarAudio();
				DestruirNota(nota);
			}
			else
			{
				if( gPontuacao.s.pontuandoNotaLonga == false )
				{
					gPontuacao.s.PontuarNotaLonga( nota, gGame.s.player );				
					gAudio.s.RecuperarAudio();
				}
			}
		}
		else
		{
			if( nota.pontuando )
			{	
				nota.pontuando = false;
				gPontuacao.s.pontuandoNotaLonga = false;
				nota.kill = true;
				DestruirNota(nota);
			}
			
		}
	}
コード例 #17
0
ファイル: gNotas.cs プロジェクト: urgamedev/VoaVivaldo
	void DestruirNota (Nota nota)
	{
		if (notasNaPista.Contains (nota))
						notasNaPista.Remove (nota);

		currentNota++;// = Mathf.Clamp(currentNota++,0,notasNaPista.Count);

		gPontuacao.s.pontuandoNotaLonga = false;
		
		Destroy (nota.gameObject);
	}
コード例 #18
0
 public async void AddNote(Nota nota)
 {
     NotasService.AddNota(nota);
     await _navigation.PushModalAsync(new MainPage());
 }
コード例 #19
0
        public List<Nota> Consultar(Nota nota, TipoPesquisa tipoPesquisa)
        {
            List<Nota> resultado = Consultar();

            switch (tipoPesquisa)
            {
                #region Case E
                case TipoPesquisa.E:
                    {
                        if (nota.ID != 0)
                        {

                            resultado = ((from d in resultado
                                          where
                                          d.ID == nota.ID
                                          select d).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (nota.Aprovado.HasValue)
                        {

                            resultado = ((from d in resultado
                                          where
                                          d.Aprovado.HasValue && d.Aprovado.Value == nota.Aprovado.Value
                                          select d).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (nota.ProfessorDisciplinaSalaID.HasValue)
                        {

                            resultado = ((from d in resultado
                                          where
                                          d.ProfessorDisciplinaSalaID.HasValue && d.ProfessorDisciplinaSalaID.Value == nota.ProfessorDisciplinaSalaID.Value
                                          select d).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (nota.Rec.HasValue)
                        {

                            resultado = ((from d in resultado
                                          where
                                          d.Rec.HasValue && d.Rec.Value == nota.Rec.Value
                                          select d).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (nota.RecFinal.HasValue)
                        {

                            resultado = ((from d in resultado
                                          where
                                          d.RecFinal.HasValue && d.RecFinal.Value == nota.RecFinal.Value
                                          select d).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (nota.Vp.HasValue)
                        {
                            resultado = ((from d in resultado
                                          where
                                          d.Vp.HasValue && d.Vp.Value == nota.Vp.Value
                                          select d).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (nota.Vc1 <= 0)
                        {

                            resultado = ((from d in resultado
                                          where
                                          d.Vc1 == nota.Vc1
                                          select d).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (nota.Vc2 <= 0)
                        {

                            resultado = ((from d in resultado
                                          where
                                          d.Vc2 == nota.Vc2
                                          select d).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (nota.Status.HasValue)
                        {

                            resultado = ((from d in resultado
                                          where
                                          d.Status.HasValue && d.Status.Value == nota.Status.Value
                                          select d).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        break;
                    }
                #endregion
                #region Case Ou
                case TipoPesquisa.Ou:
                    {
                        if (nota.ID != 0)
                        {

                            resultado.AddRange((from d in Consultar()
                                                where
                                                d.ID == nota.ID
                                                select d).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (nota.Aprovado.HasValue)
                        {

                            resultado.AddRange((from d in Consultar()
                                                where
                                                d.Aprovado.HasValue && d.Aprovado.Value == nota.Aprovado.Value
                                                select d).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (nota.ProfessorDisciplinaSalaID.HasValue)
                        {

                            resultado.AddRange((from d in Consultar()
                                                where
                                                d.ProfessorDisciplinaSalaID.HasValue && d.ProfessorDisciplinaSalaID.Value == nota.ProfessorDisciplinaSalaID.Value
                                                select d).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (nota.Rec.HasValue)
                        {

                            resultado.AddRange((from d in Consultar()
                                                where
                                                d.Rec.HasValue && d.Rec.Value == nota.Rec.Value
                                                select d).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (nota.RecFinal.HasValue)
                        {

                            resultado.AddRange((from d in Consultar()
                                                where
                                                d.RecFinal.HasValue && d.RecFinal.Value == nota.RecFinal.Value
                                                select d).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (nota.Vp.HasValue)
                        {

                            resultado.AddRange((from d in Consultar()
                                                where
                                                d.Vp.HasValue && d.Vp.Value == nota.Vp.Value
                                                select d).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (nota.Vc1 <= 0)
                        {

                            resultado.AddRange((from d in Consultar()
                                                where
                                                d.Vc1 == nota.Vc1
                                                select d).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (nota.Vc2 <= 0)
                        {

                            resultado.AddRange((from d in Consultar()
                                                where
                                                d.Vc2 == nota.Vc2
                                                select d).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (nota.Status.HasValue)
                        {

                            resultado.AddRange((from d in Consultar()
                                                where
                                                d.Status.HasValue && d.Status.Value == nota.Status.Value
                                                select d).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        break;
                    }
                #endregion
                default:
                    break;
            }

            return resultado;
        }
コード例 #20
0
 public void Executa(Nota nota)
 {
     WriteLine("Essa nota foi gerada para o cliente tb");
 }
コード例 #21
0
 private void Nota_Attach(Nota entity)
 {
     entity.ProfessorDisciplinaSala = this;
 }
コード例 #22
0
 public Review()
 {
     Nota n = new Nota(1, "", "");
 }
コード例 #23
0
        public JsonResult AdicionarNota(Nota nota)
        {
            var data = _nota.Guardar(nota);

            return(Json(data, JsonRequestBehavior.AllowGet));
        }
コード例 #24
0
        //---------------------------Notas---------------------------------------------

        public Resultado AltaNota(Nota nota, Sala[] salas, Hijo[] hijos, UsuarioLogueado usuarioLogueado)
        {
            //Pregunto tiene permiso
            if (usuarioLogueado.RolSeleccionado == Roles.Directora || usuarioLogueado.RolSeleccionado == Roles.Docente)
            {
                LeerNotas();
                LeerHijos();

                Nota nuevaNota = nota;
                if (ListaNotas != null)
                {
                    nuevaNota.Id = ListaNotas.Count() + 1;
                }
                else
                {
                    nuevaNota.Id = 1;
                }

                if (hijos != null)
                {
                    foreach (var hijo in hijos)
                    {
                        foreach (var alumno in ListaHijos)
                        {
                            if (hijo.Id == alumno.Id)
                            {
                                List <Nota> auxiliar = alumno.Notas.ToList();
                                auxiliar.Add(nuevaNota);
                                alumno.Notas = auxiliar.ToArray();

                                nuevaNota.Id += 1;
                            }
                        }
                    }
                    GuardarHijos(ListaHijos);
                }
                else
                {
                    if (salas != null)
                    {
                        foreach (var sala in salas)
                        {
                            foreach (var alumno in ListaHijos)
                            {
                                if (sala.Id == alumno.Id)
                                {
                                    List <Nota> auxiliar = alumno.Notas.ToList();
                                    auxiliar.Add(nuevaNota);
                                    alumno.Notas = auxiliar.ToArray();

                                    nuevaNota.Id += 1;
                                }
                            }
                        }
                        GuardarHijos(ListaHijos);
                    }
                }
            }

            return(new Resultado());
        }
コード例 #25
0
 public void Adicionar(Nota nota)
 {
     contexto.Notas.Add(nota);
     contexto.SaveChanges();
 }
コード例 #26
0
        public Resultado ResponderNota(Nota nota, Comentario nuevoComentario, UsuarioLogueado usuarioLogueado)
        {
            Resultado NuevoResultado = new Resultado();

            //Se guarda en el archivo de notas
            LeerNotas();
            var n           = ListaNotas.Single(x => x.Id == nota.Id);
            var comentarios = n.Comentarios == null ? new List <Comentario>() : n.Comentarios.ToList();

            comentarios.Add(nuevoComentario);
            n.Comentarios = comentarios.ToArray();
            GuardarNotas(ListaNotas);

            LeerHijos();
            if (usuarioLogueado.RolSeleccionado == Roles.Padre)
            {
                var padreencontrado = LeerPadres().Single(x => x.Email == usuarioLogueado.Email);
                foreach (var item in ListaHijos)
                {
                    foreach (var item2 in padreencontrado.Hijos)
                    {
                        if (item2.Id == item.Id) //pregunto si el hijo que se encuentra en el padre es el mismo que esta en el archivo general de hijos
                        {
                            foreach (var item3 in item.Notas)
                            {
                                if (item3.Id == nota.Id)
                                {
                                    item3.Comentarios = n.Comentarios;
                                    GuardarHijos(ListaHijos);
                                }
                            }
                        }
                    }
                }
            }
            else
            {
                if (usuarioLogueado.RolSeleccionado == Roles.Docente)
                {
                    var docenteencontrado = LeerDocentes().Single(x => x.Email == usuarioLogueado.Email);
                    foreach (var item in ListaHijos)
                    {
                        foreach (var item2 in docenteencontrado.Salas)
                        {
                            if (item2.Id == item.Sala.Id) //pregunto si la sala que se encuentra en eldocente es el mismo que esta en el archivo general de hijos
                            {
                                foreach (var item3 in item.Notas)
                                {
                                    if (item3.Id == nota.Id)
                                    {
                                        item3.Comentarios = n.Comentarios;
                                        GuardarHijos(ListaHijos);
                                    }
                                }
                            }
                        }
                    }
                }
                else
                {
                    if (usuarioLogueado.RolSeleccionado == Roles.Directora)
                    {
                        foreach (var item in ListaHijos)
                        {
                            foreach (var item2 in item.Notas)
                            {
                                if (item2.Id == nota.Id)
                                {
                                    item2.Comentarios = n.Comentarios;
                                    GuardarHijos(ListaHijos);
                                }
                            }
                        }
                    }
                }
            }
            return(NuevoResultado);
        }
コード例 #27
0
 public Nota Atualizar(Nota t)
 {
     return(_notaRepository.Atualizar(t));
 }
コード例 #28
0
        static void Main(string[] args)
        {
            int nrStudenti;
            int nrGrupe;
            int nrMaterii;
            int nrProfesori;
            int nrGrupari;
            int nrCursuri;
            int nrOre;
            int nrNote;

            Console.WriteLine("Cati studenti vrei sa se adauge?");
            nrStudenti = int.Parse(Console.ReadLine());
            Console.WriteLine("Cate grupe vrei sa se adauge?");
            nrGrupe = int.Parse(Console.ReadLine());
            Console.WriteLine("Cate materii vrei sa se adauge?");
            nrMaterii = int.Parse(Console.ReadLine());
            Console.WriteLine("Cati profesori vrei sa se adauge?");
            nrProfesori = int.Parse(Console.ReadLine());
            Console.WriteLine("Cate grupari vrei sa se adauge?");
            nrGrupari = int.Parse(Console.ReadLine());
            Console.WriteLine("Cate cursuri vrei sa se adauge?");
            nrCursuri = int.Parse(Console.ReadLine());
            Console.WriteLine("Cate ore vrei sa se adauge?");
            nrOre = int.Parse(Console.ReadLine());
            Console.WriteLine("Cate note vrei sa se adauge");
            nrNote = int.Parse(Console.ReadLine());

            List <Student> studenti = new List <Student>();
            List <Adresa>  adrese   = new List <Adresa>();

            for (int i = 0; i < nrStudenti; i++)
            {
                Adresa adresa = GeneratorAdresaRandom.GenereazaAdresa();
                adrese.Add(adresa);
                Student student = GeneratorStudentRandom.GenereazaStudentRandom(adresa);
                studenti.Add(student);
            }
            List <Grupa> grupe = new List <Grupa>();

            for (int i = 0; i < nrGrupe; i++)
            {
                grupe.Add(GeneratorGrupaRandom.GenereazaGrupaRandom());
            }
            List <Materie> materii = new List <Materie>();

            for (int i = 0; i < nrMaterii; i++)
            {
                materii.Add(GeneratorMaterieRandom.GenereazaMaterieRandom());
            }
            List <Profesor> profesori = new List <Profesor>();

            for (int i = 0; i < nrProfesori; i++)
            {
                profesori.Add(GeneratorProfesorRandom.GenereazaProfesorRandom());
            }

            using (FacultateDbContext ctx = new FacultateDbContext())
            {
                foreach (var adresa in adrese.Distinct())
                {
                    ctx.Adrese.Add(adresa);
                }
                foreach (var student in studenti.Distinct())
                {
                    ctx.Add(student);
                }
                foreach (var grupa in grupe.Distinct())
                {
                    ctx.Add(grupa);
                }
                foreach (var materie in materii.Distinct())
                {
                    ctx.Add(materie);
                }
                foreach (var profesor in profesori.Distinct())
                {
                    ctx.Add(profesor);
                }
                ctx.SaveChanges();
            }

            List <GrupareStudenti> grupari = new List <GrupareStudenti>();

            for (int i = 0; i < nrGrupari; i++)
            {
                GrupareStudenti grupare = GeneratorGrupareStudent.GenereazaGrupareStudent();
                if (!(grupare is null))
                {
                    grupari.Add(grupare);
                }
            }

            List <Curs> cursuri = new List <Curs>();

            for (int i = 0; i < nrCursuri; i++)
            {
                Curs curs = GeneratorCursRandom.GenereazaCursRandom();
                if (!(curs is null))
                {
                    cursuri.Add(curs);
                }
            }

            using (FacultateDbContext ctx = new FacultateDbContext())
            {
                foreach (var grupare in grupari.Distinct())
                {
                    ctx.Add(grupare);
                }
                foreach (var curs in cursuri.Distinct())
                {
                    ctx.Add(curs);
                }
                ctx.SaveChanges();
            }

            List <Orar> ore = new List <Orar>();

            for (int i = 0; i < nrOre; i++)
            {
                Orar ora = GeneratorOrarRandom.GenereazaOrarRandom();
                if (!(ora is null))
                {
                    ore.Add(ora);
                }
            }
            using (FacultateDbContext ctx = new FacultateDbContext())
            {
                foreach (var ora in ore.Distinct())
                {
                    ctx.Add(ora);
                }
                ctx.SaveChanges();
            }
            List <Nota> note = new List <Nota>();

            for (int i = 0; i < nrNote; i++)
            {
                Nota nota = GeneratorNotaRandom.GenereazaNotaRandom();
                if (!(nota is null))
                {
                    note.Add(nota);
                }
            }
            using (FacultateDbContext ctx = new FacultateDbContext())
            {
                foreach (var nota in note.Distinct())
                {
                    ctx.Add(nota);
                }
                ctx.SaveChanges();
            }

            //using(FacultateDbContext ctx = new FacultateDbContext())
            //{

            //    foreach (var elem in ctx.Grupe) if (elem.Nume is null) ctx.Remove(elem);
            //    foreach (var elem in ctx.Materii) if (elem.Denumire is null) ctx.Remove(elem);
            //    foreach (var elem in ctx.Profesori) if (elem.Nume is null) ctx.Remove(elem);
            //    foreach (var elem in ctx.Students) if (elem.Nume is null) ctx.Remove(elem);
            //    ctx.SaveChanges();

            //}
        }
コード例 #29
0
 public Nota Guardar(Nota t)
 {
     return(_notaRepository.Guardar(t));
 }
コード例 #30
0
 public void Insert(Nota nota)
 {
     _context.Add(nota);
     _context.SaveChanges();
 }
コード例 #31
0
ファイル: gNotas.cs プロジェクト: urgamedev/VoaVivaldo
	void VerificarFimDePercurso (Vector3 posNota, Nota nota)
	{
		if( nota == null ) return;
	
		if( nota.VerificarZonaDeMorte( areaDeDead, posNota ) )
		{
			if( nota.mInfo.tipo != TipoDeNota.PAUSA )
			{
				gAudio.s.PararAudio();						
				gPontuacao.s.CancelarPontos();
			}
				DestruirNota(nota);
		}
	}
コード例 #32
0
        private async void CreaNotasDeArchivosTextoAlmacenamientoAislado()
        {
            try
            {
                ShowBusy(true);
                using (IsolatedStorageFile isoStore = IsolatedStorageFile.GetUserStoreForApplication())
                {
                    string[] fileNames = isoStore.GetFileNames("./MyNotes/*.txt");

                    if (fileNames.Length > 0)
                    {
                        for (int i = 0; i < fileNames.Length; ++i)
                        {
                            System.Diagnostics.Debug.WriteLine(await System.Threading.Tasks.Task.Run(delegate
                            {
                                return(traduce("MsgRestaurando") + " " + fileNames[i].Replace(".txt", ""));
                            }));


                            using (IsolatedStorageFileStream isoStream = new IsolatedStorageFileStream("MyNotes/" + fileNames[i], FileMode.Open, isoStore))
                            {
                                using (StreamReader reader = new StreamReader(isoStream))
                                {
                                    string   asunto  = fileNames[i].Replace(".txt", "");
                                    string   detalle = "";
                                    DateTime fecha   = DateTime.Now;
                                    int      fsize   = 10;
                                    string   temp;
                                    while (!reader.EndOfStream)
                                    {
                                        temp = reader.ReadLine();
                                        if (temp.StartsWith("[date:"))
                                        {
                                            try
                                            {
                                                fecha = Convert.ToDateTime(temp.Substring(7, temp.Length - 9));
                                            }
                                            catch
                                            {
                                                fecha = DateTime.Now;
                                            }
                                        }
                                        else if (temp.StartsWith("[fsize:"))
                                        {
                                            fsize = Convert.ToInt32(temp.Substring(8, temp.Length - 10));
                                        }
                                        else
                                        {
                                            if (temp != "")
                                            {
                                                detalle += temp + System.Environment.NewLine;
                                            }
                                        }
                                    }

                                    using (var conn = new SQLiteConnection(new SQLitePlatformWinRT(), App.DbConnectionString))
                                    {
                                        Nota nota = new Nota()
                                        {
                                            Id      = SearchNotaID(asunto, detalle),
                                            Asunto  = asunto,
                                            Fecha   = fecha,
                                            Detalle = detalle,
                                            FSize   = fsize,
                                            CFondo  = "#ED341D"
                                        };

                                        //conn.InsertOrReplace(new Nota() { Asunto=asunto, Detalle = detalle, Fecha = fecha, FSize = fsize, CFondo = "#ED341D" }, typeof(Nota));

                                        if (nota.Id.Equals(0))
                                        {
                                            conn.RunInTransaction(() =>
                                            {
                                                conn.Insert(nota);
                                            });
                                        }
                                        else
                                        {
                                            conn.RunInTransaction(() =>
                                            {
                                                conn.Update(nota);
                                            });
                                        }
                                    }
                                }
                            }
                        }
                        // Confirm that no files remain.
                        //fileNames = isoStore.GetFileNames("*.txt");

                        ShowBusy(false);
                        T_Info.Text         = traduce("MsgRestauracionFin");
                        T_ProgRestaura.Text = traduce("MsgFinalizado");
                        System.Diagnostics.Debug.WriteLine("Finalizado");
                    }
                }
            }
            catch (Exception ex)
            {
                var successDialog = new MessageDialog(traduce("MsgErrorGeneral") + " " + ex.Message, traduce("NameApp"));
                await successDialog.ShowAsync();
            }
        }
コード例 #33
0
ファイル: gNotas.cs プロジェクト: urgamedev/VoaVivaldo
	void VerificarBrilhoDaPista (Nota n)
	{
		if( (int) n.mInfo.timbre == gGame.s.player.mController.pista )
		{
			gPista.s.FeedbackPista( (int) n.mInfo.timbre );
		}
	}
コード例 #34
0
        /// <summary>
        /// Corrige o exercicio e retorna um objeto do tipo nota com configuração total de Usuario
        /// </summary>
        /// <param name="Realizado"> parametro do tipe Exercicio sendo o Exercicio realizado </param>
        /// <param name="Gabarito">parametro do tipe Exercicio sendo o Exercicio que servirá como gabarito</param>
        /// <returns></returns>
        public Nota Corrigir(Exercicio Realizado, Exercicio Gabarito)
        {
            decimal TotalQuestoes = Gabarito.Questao.Count;
            decimal acerto        = 0;

            if (Gabarito.Tipo == "C")
            {
                foreach (var itemGabaritoQ in Gabarito.Questao)
                {
                    foreach (var itemRealizadoQ in Realizado.Questao)
                    {
                        if (itemGabaritoQ.Ordem == itemRealizadoQ.Ordem)
                        {
                            foreach (var itemGabaritoA in itemGabaritoQ.Alternativa)
                            {
                                foreach (var itemRealizadoA in itemRealizadoQ.Alternativa)
                                {
                                    if (itemRealizadoA.Conteudo == itemGabaritoA.Conteudo)
                                    {
                                        acerto += 1;
                                    }
                                }
                            }
                        }
                    }
                }
            }
            else
            {
                foreach (var itemGabaritoQ in Gabarito.Questao)
                {
                    foreach (var itemRealizadoQ in Realizado.Questao)
                    {
                        if (itemGabaritoQ.Ordem == itemRealizadoQ.Ordem)
                        {
                            foreach (var itemGabaritoA in itemGabaritoQ.Alternativa)
                            {
                                foreach (var itemRealizadoA in itemRealizadoQ.Alternativa)
                                {
                                    if (itemRealizadoA.Ordem == itemGabaritoA.Ordem)
                                    {
                                        if (itemRealizadoA.Tipo == "R")
                                        {
                                            if (itemGabaritoA.Tipo == "C")
                                            {
                                                if (itemRealizadoA.Conteudo == itemGabaritoA.Conteudo)
                                                {
                                                    acerto += 1;
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            decimal pontoquestao = 10 / TotalQuestoes;
            decimal nota         = pontoquestao * acerto;
            Nota    n            = new Nota
            {
                _Nota     = nota,
                Exercicio = Realizado
            };
            Usuario    u   = new Usuario();
            UsuarioDAL dal = new UsuarioDAL();

            u         = dal.Consultar(Realizado.Usuario);
            n.Usuario = u;
            return(n);
        }
コード例 #35
0
        public void Excluir(Nota nota)
        {
            try
            {
                Nota notaAux = new Nota();
                notaAux.ID = nota.ID;

                List<Nota> resultado = this.Consultar(notaAux, TipoPesquisa.E);

                if (resultado == null || resultado.Count == 0)
                    throw new NotaNaoExcluidaExcecao();

                notaAux = resultado[0];

                db.Nota.DeleteOnSubmit(notaAux);
            }
            catch (Exception)
            {

                throw new NotaNaoExcluidaExcecao();
            }
        }
コード例 #36
0
 /// <summary>
 ///     Assina um arquivo Xml
 /// </summary>
 /// <param name="arquivoNome"></param>
 /// <param name="operacao"></param>
 /// <param name="x509Cert"></param>
 public String AssinarNota(Nota nota, X509Certificate2 x509Cert, String tagAssinatura, String uri = "")
 {
     //Abrir o arquivo XML a ser assinado e ler o seu conteúdo
     return(Assinar(nota, x509Cert, tagAssinatura, uri));
 }
コード例 #37
0
        private String Assinar(Nota nota, X509Certificate2 x509Cert, String TagAssinatura, String URI = "")
        {
            string xmlString;

            using (var srReader = File.OpenText(nota.CaminhoFisico))
            {
                xmlString = srReader.ReadToEnd();
            }

            // Create a new XML document.
            var doc = new XmlDocument();

            // Format the document to ignore white spaces.
            doc.PreserveWhitespace = false;
            doc.LoadXml(xmlString);

            XmlDocument xMLDoc;

            var reference = new Reference();

            if (!String.IsNullOrEmpty(nota.NotaId))
            {
                reference.Uri = "#" + TagAssinatura + nota.NotaId;
            }
            else if (!String.IsNullOrEmpty(URI))
            {
                reference.Uri = URI;
            }

            // Create a SignedXml object.
            var signedXml = new SignedXml(doc);

            // Add the key to the SignedXml document
            signedXml.SigningKey = x509Cert.PrivateKey;

            // Add an enveloped transformation to the reference.
            var env = new XmlDsigEnvelopedSignatureTransform();

            reference.AddTransform(env);

            var c14 = new XmlDsigC14NTransform();

            reference.AddTransform(c14);

            // Add the reference to the SignedXml object.
            signedXml.AddReference(reference);

            // Create a new KeyInfo object
            var keyInfo = new KeyInfo();

            // Load the certificate into a KeyInfoX509Data object
            // and add it to the KeyInfo object.
            keyInfo.AddClause(new KeyInfoX509Data(x509Cert));

            // Add the KeyInfo object to the SignedXml object.
            signedXml.KeyInfo = keyInfo;
            signedXml.ComputeSignature();

            // Get the XML representation of the signature and save
            // it to an XmlElement object.
            var xmlDigitalSignature = signedXml.GetXml();

            // Gravar o elemento no documento XML
            var assinaturaNodes = doc.GetElementsByTagName(TagAssinatura);

            foreach (XmlNode nodes in assinaturaNodes)
            {
                nodes.AppendChild(doc.ImportNode(xmlDigitalSignature, true));
                break;
            }

            xMLDoc = new XmlDocument();
            xMLDoc.PreserveWhitespace = false;
            xMLDoc = doc;

            // Atualizar a string do XML já assinada
            var StringXMLAssinado = xMLDoc.OuterXml;

            //Atualiza a nota assinada
            nota.ConteudoXml = StringXMLAssinado;

            // Gravar o XML Assinado no HD
            var SignedFile = nota.CaminhoFisico;
            var SW_2       = File.CreateText(SignedFile);

            SW_2.Write(StringXMLAssinado);
            SW_2.Close();

            return(SignedFile);
        }
コード例 #38
0
            public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedTableSchema(global::System.Xml.Schema.XmlSchemaSet xs)
            {
                global::System.Xml.Schema.XmlSchemaComplexType type     = new global::System.Xml.Schema.XmlSchemaComplexType();
                global::System.Xml.Schema.XmlSchemaSequence    sequence = new global::System.Xml.Schema.XmlSchemaSequence();
                Nota ds = new Nota();

                global::System.Xml.Schema.XmlSchemaAny any1 = new global::System.Xml.Schema.XmlSchemaAny();
                any1.Namespace       = "http://www.w3.org/2001/XMLSchema";
                any1.MinOccurs       = new decimal(0);
                any1.MaxOccurs       = decimal.MaxValue;
                any1.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax;
                sequence.Items.Add(any1);
                global::System.Xml.Schema.XmlSchemaAny any2 = new global::System.Xml.Schema.XmlSchemaAny();
                any2.Namespace       = "urn:schemas-microsoft-com:xml-diffgram-v1";
                any2.MinOccurs       = new decimal(1);
                any2.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax;
                sequence.Items.Add(any2);
                global::System.Xml.Schema.XmlSchemaAttribute attribute1 = new global::System.Xml.Schema.XmlSchemaAttribute();
                attribute1.Name       = "namespace";
                attribute1.FixedValue = ds.Namespace;
                type.Attributes.Add(attribute1);
                global::System.Xml.Schema.XmlSchemaAttribute attribute2 = new global::System.Xml.Schema.XmlSchemaAttribute();
                attribute2.Name       = "tableTypeName";
                attribute2.FixedValue = "Table1DataTable";
                type.Attributes.Add(attribute2);
                type.Particle = sequence;
                global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable();
                if (xs.Contains(dsSchema.TargetNamespace))
                {
                    global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream();
                    global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream();
                    try {
                        global::System.Xml.Schema.XmlSchema schema = null;
                        dsSchema.Write(s1);
                        for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext();)
                        {
                            schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current));
                            s2.SetLength(0);
                            schema.Write(s2);
                            if ((s1.Length == s2.Length))
                            {
                                s1.Position = 0;
                                s2.Position = 0;
                                for (; ((s1.Position != s1.Length) &&
                                        (s1.ReadByte() == s2.ReadByte()));)
                                {
                                    ;
                                }
                                if ((s1.Position == s1.Length))
                                {
                                    return(type);
                                }
                            }
                        }
                    }
                    finally {
                        if ((s1 != null))
                        {
                            s1.Close();
                        }
                        if ((s2 != null))
                        {
                            s2.Close();
                        }
                    }
                }
                xs.Add(dsSchema);
                return(type);
            }
コード例 #39
0
ファイル: MainWindow.xaml.cs プロジェクト: pedro518/NPI
        private void toca_nota(Nota nota)
        {
            String path = "..\\..\\Sounds/";

            if(!electrica){
                path += "Acustic/";
            }
            else
            {
                path += "Electric/";
            }

            if (mayors)
            {
                path += "Mayors/";
                //solucion.Content = "Mayor";
            }
            else
            {
                path += "Minors/";
                //solucion.Content = "Menor";
            }

            if(down){
                path += "Down/";
            }else{
                path += "Up/";
            }

            switch (nota)
            {
                case Nota.Aire:
                    path += "Aire";
                    //solucionP.Content = "Nota al aire";
                    break;

                case Nota.Do:
                    path += "C";

                   // solucionP.Content = "Nota Do";
                    break;

                case Nota.Re:
                   // solucionP.Content = "Nota Re";
                    path += "D";
                    break;

                case Nota.Mi:
                    path +="E";
                   // solucionP.Content = "Nota Mi";
                    break;

                case Nota.Fa:
                    path += "F";
                  //  solucionP.Content = "Nota Fa";
                    break;

                case Nota.Sol:
                    path += "G";
                   // solucionP.Content = "Nota Sol";
                    break;

                case Nota.La:
                    path +="A";
                  //  solucionP.Content = "Nota La";
                    break;

                case Nota.Si:
                    path += "B";
                  //  solucionP.Content = "Nota Si";
                    break;

                default:
                  //  solucionP.Content = "Fallo";
                    break;
            }

            if(!mayors)
            {
                path += "m";
            }

            path += ".wav";
            player.SoundLocation = path;
            player.Play();
        }
コード例 #40
0
 public ActionResult Eliminar(Nota nota)
 {
     _notasBL.EliminarNota();
     return(RedirectToAction("Index"));
 }
コード例 #41
0
 private void Nota_Detach(Nota entity)
 {
     entity.Matricula = null;
 }
コード例 #42
0
        public JsonResult Atualizar(Nota nota)
        {
            var data = _nota.Atualizar(nota);

            return(Json(data, JsonRequestBehavior.AllowGet));
        }
コード例 #43
0
 private void Nota_Detach(Nota entity)
 {
     entity.ProfessorDisciplinaSala = null;
 }
コード例 #44
0
        /// <summary>
        /// Método que recupera uma lista de Notas
        /// </summary>
        /// <param name="Nota">Parametro para recuperar Notas de uma empresa com o número Vencimento e empresa que pertence a nota</param>
        /// <returns>Retorna uma lista de Notas</returns>
        public IList <Nota> RecuperaNotas(Nota Nota)
        {
            IList <Nota> lstNotas = new List <Nota>();
            SqlCommand   cmd      = null;
            string       strQuery = string.Empty;

            try
            {
                cmd = Factory.AcessoDados();

                strQuery = "Select n.IdEmpresa, e.Nome As Empresa, n.NumeroNota, f.Nome As Fornecedor, f.Id As IdFornecedor, n.N_Parcela, n.Id As IdNota, n.ValorParcela, n.Vencimento, n.ContasPagar " +
                           "From TB_Notas n, TB_Empresa e, TB_Fornecedores f " +
                           "Where n.IdEmpresa = e.Id " +
                           "And n.IdFornecedor = f.Id " +
                           "And n.IdEmpresa = @varIdEmpresa ";



                if (Nota.NumeroDocumento != null)
                {
                    if (!Nota.NumeroDocumento.Equals(""))
                    {
                        strQuery += "And n.NumeroNota like @varNumeroNota ";
                        cmd.Parameters.AddWithValue("@varNumeroNota", SqlDbType.VarChar).Value = "%" + Nota.NumeroDocumento + "%";
                    }
                }

                if (Validacao.IsData(Nota.Vencimento.ToString("dd/MM/yyyy")))
                {
                    strQuery += "And Vencimento = @varVencimento ";
                    cmd.Parameters.AddWithValue("@varVencimento", Nota.Vencimento);
                }

                cmd.CommandText = strQuery;

                Nota isNota = null;
                using (SqlDataReader reader = cmd.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        isNota = new Nota(Convert.ToInt32(reader["IdNota"]));
                        isNota.NumeroDocumento = Convert.ToString(reader["NumeroNota"]);
                        isNota.NumeroParcela   = Convert.ToString(reader["N_Parcela"]);
                        isNota.Valor           = Convert.ToDecimal(reader["ValorParcela"]);
                        isNota.Vencimento      = Convert.ToDateTime(reader["Vencimento"]);
                        isNota.ContasPagar     = Convert.ToInt32(reader["ContasPagar"]);

                        Empresa empresa = new Empresa(Convert.ToInt32(reader["IdEmpresa"]));
                        empresa.Nome = Convert.ToString(reader["Empresa"]);

                        Fornecedor fornecedor = new Fornecedor(Convert.ToInt32(reader["IdFornecedor"]));
                        isNota.Fornecedor = fornecedor;

                        lstNotas.Add(isNota);
                    }
                }
                return((lstNotas != null) ? lstNotas : null);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (cmd != null)
                {
                    cmd.Dispose();
                }
            }
        }