public EmpresaTests()
 {
     _controller  = new EmpresaController();
     _testContext = new TestContext();
     client       = new HttpClient();
     urlBase      = new Uri($"https://localhost:44331/api");
 }
Esempio n. 2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     gpsCtrl     = new GpsController();
     empresaCtrl = new EmpresaController();
     if (!IsPostBack)
     {
         if (!SitePrincipal.IsIntruso())
         {
             imei = Request.QueryString["imei"];
             if (!String.IsNullOrEmpty(imei))
             {
                 lblimei.Text = imei;
                 GPS g = gpsCtrl.listar(imei);
                 lblid.Text         = g.ID;
                 lblmodelo.Text     = g.Modelo;
                 lbltelefono.Text   = g.NroTelefono.ToString();
                 lblusuarioreg.Text = g.UsuaReg.ToString();
                 lblfechareg.Text   = g.FechaReg.ToString();
             }
             else
             {
                 Response.Redirect("~/Vistas/GPSs/Index");
             }
         }
         else
         {
             Response.Redirect("~/Account/Login");
         }
     }
 }
Esempio n. 3
0
        private void _CargarControles()
        {
            //Empresa
            var empresa = EmpresaController.DatosEmpresa();

            lblEmpRazonSocial.Text       = empresa.RazonSocial;
            lblEmpDomicilio.Text         = empresa.Domicilio;
            lblEmpCodPostal.Text         = empresa.CodPostal;
            lblEmpLocalidad.Text         = empresa.Localidad;
            lblEmpProvincia.Text         = empresa.Provincia;
            lblEmpTel.Text               = empresa.Telefono;
            lblEmpFax.Text               = empresa.Fax;
            lblEmpPosicionIVA.Text       = empresa.CondicionIVA.ToString();
            lblEmpCuit.Text              = empresa.CUIT;
            lblEmpIngBrutos.Text         = empresa.IngBrutos;
            lblEmpInicioActividades.Text = empresa.InicioActividades.ToShortDateString();


            comboProvincia.DataSource    = LocalidadesController.ListarProvincias();
            comboProvincia.DisplayMember = "Provincia1";
            comboProvincia.ValueMember   = "idProvincia";

            //Clientes
            _RefrescarClientes();

            //Articulos
            var columnCodigo = (DataGridViewComboBoxColumn)grdDetallePresupuesto.Columns["Codigo"];

            columnCodigo.DataSource = ArticulosController.ListarCodigoYColorArticulos();

            var columnDescripcion = (DataGridViewComboBoxColumn)grdDetallePresupuesto.Columns["Descripcion"];

            columnDescripcion.DataSource = ArticulosController.ListarDescripcionArticulos();
        }
        private void Inicializa()
        {
            empresaController   = new EmpresaController();
            traspasoController  = new TraspasoController();
            loteController      = new LoteController();
            traspasoController  = new TraspasoController();
            traspasopController = new TraspasopController();
            productoController  = new ProductoController();
            movInvController    = new MovInvController();
            traspaso            = null;
            partidas            = new List <Traspasop>();
            empresa             = empresaController.SelectTopOne();
            Ambiente.BorrarFile(empresa.DirectorioTrabajo + @"\PH.XLSX");
            Ambiente.BorrarFile(empresa.DirectorioTrabajo + @"\PD.XLSX");
            //Ambiente.VaciarDirectorio(empresa.DirectorioTraspasos);

            TxtOrigen.Text     = "";
            TxtDestino.Text    = "";
            TxtDocumento.Text  = "";
            TxtFechaDoc.Text   = "";
            TxtEnviadoPor.Text = "";
            TxtSubtotal.Text   = "";
            TxtImpuesto.Text   = "";
            TxtTotal.Text      = "";
            Malla.Rows.Clear();
            CargaTraspasosPendientes();
        }
Esempio n. 5
0
        public static string getDatos(string data = "")
        {
            string            result      = String.Empty;
            EmpresaController empresaCtrl = new EmpresaController();
            //HomeController homeCtrl = new HomeController();
            List <EmpresaModel> lista = new List <EmpresaModel>();
            //if (SitePrincipal.ExisteActiva())
            //{
            var userName = HttpContext.Current.User.Identity.Name;

            userName = HttpContext.Current.User.Identity.Name;
            lista    = empresaCtrl.GetAll22(userName);

            //}
            //else
            //{
            //    //if (HttpContext.Current.User.IsInRole("SA"))
            //    //{
            //    //    lista = alarmaCtrl.GetAll();

            //    //}
            //}

            result = JsonConvert.SerializeObject(lista, Formatting.Indented);

            return(result);
        }
Esempio n. 6
0
        protected void btnExcluir_Click(object sender, EventArgs e)
        {
            EmpresaController  empresaController  = new EmpresaController();
            ClienteController  clienteController  = new ClienteController();
            VendedorController vendedorController = new VendedorController();
            UsuarioController  usuarioController  = new UsuarioController();
            ContratoController contratoController = new ContratoController();

            if (usuarioController.ObterTodosFuncionarios(Session["cnpjEmp"].ToString()).Count <= 0)
            {
                List <ClienteEntity> clientes = clienteController.ObterTodos(Session["cnpjEmp"].ToString());
                for (int i = 0; i < clientes.Count; i++)
                {
                    vendedorController.Remover(clientes[i].codCli);
                    clienteController.Remover(clientes[i].codCli);
                }

                contratoController.Remover(Session["cpfUsu"].ToString());

                if (empresaController.Remover(Session["cnpjEmp"].ToString()))
                {
                    this.ClientScript.RegisterClientScriptBlock(typeof(string), "alert", "<script>alert('Empresa removida com sucesso!'); window.location.href='Login.aspx';</script>");
                }
            }
            else
            {
                this.ClientScript.RegisterClientScriptBlock(typeof(string), "alert", "<script>alert('Erro na remoção do registro, sua empresa ainda possui funcionários!');</script>");
            }
        }
        /*
         * Método que genera el reporte de una factura, a partir de la id especificada
         * genera un el reporte, que es usado para representar el archivo
         */
        public bool generarReporte(int id)
        {
            try
            {
                DSFacturaDatos dsFacturaDatos = new DSFacturaDatos();
                vistaFactura  = new vFacturaDatosController().GetDatosFactura(id);
                empresa       = new EmpresaController().Get(1);
                boletoFactura = new BoletosFacturaController().getBoletosFactura(id);
                RPFacturaDatos rPFactura = new RPFacturaDatos();

                dsFacturaDatos.Empresa.AddEmpresaRow
                (
                    empresa.empresa_razon_social,
                    empresa.empresa_numero_contribuyente,
                    empresa.empresa_numero_autorizacion,
                    empresa.empresa_direccion,
                    empresa.empresa_telefono,
                    empresa.empresa_email,
                    empresa.empresa_website,
                    empresa.empresa_ambiente,
                    empresa.empresa_contabilidad
                );
                dsFacturaDatos.Vista_FacturaDatos.AddVista_FacturaDatosRow(
                    vistaFactura.id,
                    vistaFactura.cliente_cedula,
                    vistaFactura.cliente_apellidos,
                    vistaFactura.cliente_nombres,
                    vistaFactura.cliente_telefono,
                    vistaFactura.cliente_email,
                    vistaFactura.cliente_direccion,
                    vistaFactura.factura_numero,
                    vistaFactura.factura_fecha_emision,
                    vistaFactura.factura_metodo_pago,
                    vistaFactura.funcion_fecha_evento,
                    vistaFactura.funcion_precio_boleto,
                    vistaFactura.sala_nombre,
                    vistaFactura.horario_inicio,
                    vistaFactura.idioma_abreviatura,
                    vistaFactura.pelicula_titulo,
                    vistaFactura.pelicula_tipo_censura,
                    vistaFactura.pelicula_duracion
                    );
                dsFacturaDatos.SP_ObtenerBoletosFactura.AddSP_ObtenerBoletosFacturaRow(
                    boletoFactura.cantidad,
                    boletoFactura.asientos,
                    boletoFactura.concepto,
                    boletoFactura.precio_unitario,
                    boletoFactura.importe,
                    boletoFactura.iva,
                    boletoFactura.total
                    );
                rPFactura.SetDataSource(dsFacturaDatos);
                reporte = rPFactura; // añade a la propiedad el doc generado
                return(true);        // finalizo correct
            }
            catch (ControllerException ex)
            {
                throw new ControllerException("No se consiguío generar el reporte", ex);
            }
        }
Esempio n. 8
0
 public EmpresaTeste(ApplicationContext dbcontext, EmpresaRepositorio context, EmpresaController empresa, List <Empresa> result) : base()
 {
     this.dbcontext = dbcontext;
     this.context   = context;
     this.empresa   = empresa;
     this.result    = result;
 }
Esempio n. 9
0
        private void toolStripButtonFacturas_Click(object sender, EventArgs e)
        {
            var empresa = new EmpresaController().DatosEmpresa();

            if (empresa.PorcentajeIVA.HasValue && empresa.PorcentajeIVA.Value > 0)
            {
                new FrmFactura()
                {
                    MdiParent = this, PorcentajeIVA = empresa.PorcentajeIVA.Value
                }.Show();
            }
            else
            {
                var result =
                    MessageBox.Show(
                        "Para crear una factura primero debe indicar el porcentaje de IVA, desea hacerlo ahora?",
                        "Atención", MessageBoxButtons.YesNo);
                if (result == System.Windows.Forms.DialogResult.Yes)
                {
                    new FrmEmpresa()
                    {
                        MdiParent = this
                    }.Show();
                }
            }
        }
Esempio n. 10
0
        private void MdiConexco_Load(object sender, EventArgs e)
        {
            var empresa = new EmpresaController().DatosEmpresa();

            if (empresa == null)
            {
                MessageBox.Show("Bienvenido! Usted no tiene datos de su Empresa cargados, por favor ingreselos");
                new FrmEmpresa().ShowDialog();
            }
            else
            {
                bool correcto = false;
                for (int i = 0; i < 3; i++)
                {
                    var result = Inputbox.Show("Autenticación", "Ingrese su contraseña: ", FormStartPosition.CenterScreen);
                    if (result == empresa.Contrasenia)
                    {
                        correcto = true;
                        break;
                    }
                    MessageBox.Show("Contraseña incorrecta, inténtelo nuevamente");
                }
                if (!correcto)
                {
                    MessageBox.Show("Ha alcanzado el límite de intentos, el Sistema se cerrará");
                    _preguntaSalir = false;
                    this.Close();
                }
            }
        }
Esempio n. 11
0
        /// <summary>
        /// Descrição:  Listar empresa
        /// Autor:      Fabiano Gonçalves Elias
        /// Data:       30/10/2017
        /// **********************************************************************************************************
        /// Data Alteração      Autor       Descrição
        /// </summary>
        public List <EmpresaController> Empresas()
        {
            var retornoList = new List <EmpresaController>();

            try
            {
                var con  = new SqlConnection(ParametrosDAO.StringConexao);
                var sSql = new StringBuilder();
                sSql.Append(" SELECT * from TB001_Empresa ");
                var command = new SqlCommand(sSql.ToString(), con);
                command.CommandTimeout = 300;
                con.Open();
                var reader = command.ExecuteReader();

                var obj = new EmpresaController();

                while (reader.Read())
                {
                    obj.TB001_id           = Convert.ToInt64(reader["TB001_id"]);
                    obj.TB001_NomeFantasia = Convert.ToString(reader["TB001_NomeFantasia"]);

                    retornoList.Add(obj);
                }

                con.Close();
            }
            catch (Exception ex)
            {
                // ReSharper disable once PossibleIntendedRethrow
                throw ex;
            }
            return(retornoList);
        }
Esempio n. 12
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            EmpresaController empresaController = new EmpresaController();
            DataTable         empresas          = (DataTable)dataGridView.DataSource;

            empresaController.insertEmpresa(empresas);
            this.Close();
        }
Esempio n. 13
0
        public static string CargarEmpresas(string data = "")
        {
            var userName = HttpContext.Current.User.Identity.Name;
            EmpresaController empresaCtrl = new EmpresaController();
            var empresas = empresaCtrl.GetActivas(userName);

            return(empresas.Count > 0 ? empresas.FirstOrDefault().NIT : "-1");
        }
Esempio n. 14
0
        protected void btnGravar_Click(object sender, EventArgs e)
        {
            // Cria a instância
            EmpresaEntity     empresa           = new EmpresaEntity();
            EmpresaController empresaController = new EmpresaController();

            if (txtCnpj.Text == "" || txtRazao.Text == "" || txtNome.Text == "")
            {
                this.ClientScript.RegisterClientScriptBlock(typeof(string), "alert", "<script>alert('Preencha todos os campos!');</script>");
            }
            else
            {
                empresa.cnpjEmp = txtCnpj.Text;
                empresa.razEmp  = txtRazao.Text;
                empresa.nomEmp  = txtNome.Text;
                empresa.endEmp  = txtEndereco.Text;
                empresa.cidEmp  = txtCidade.Text;
                empresa.ufEmp   = txtUf.Text;
                empresa.telEmp  = txtTelefone.Text;

                string cnpjEmp = null;

                try
                {
                    cnpjEmp = Request.QueryString["cnpjEmp"].ToString();
                }
                catch
                { }

                // Chama método
                if (cnpjEmp != null)
                {
                    empresa.cnpjEmp = cnpjEmp;
                    if (empresaController.Atualizar(empresa))
                    {
                        this.ClientScript.RegisterClientScriptBlock(typeof(string), "alert", "<script>alert('Empresa alterada com sucesso!'); window.location.href='Empresa.aspx';</script>");
                    }
                    else
                    {
                        this.ClientScript.RegisterClientScriptBlock(typeof(string), "alert", "<script>alert('Erro na alteração do registro!');</script>");
                    }
                }
                else
                {
                    if (empresaController.Inserir(empresa, Session["cpf"].ToString()))
                    {
                        UsuarioController usuarioController = new UsuarioController();
                        usuarioController.InserirContrato(Session["cpf"].ToString(), empresa.cnpjEmp, 3); // 3 -> código de proprietário

                        this.ClientScript.RegisterClientScriptBlock(typeof(string), "alert", "<script>alert('Empresa salva com sucesso!'); window.location.href='Empresa.aspx';</script>");
                    }
                    else
                    {
                        this.ClientScript.RegisterClientScriptBlock(typeof(string), "alert", "<script>alert('Erro na inclusão do registro!');</script>");
                    }
                }
            }
        }
        public void DeveCalcularCorretamente(string qntdNotas, string qntdDebitos, string resultado)
        {
            EmpresaController controller = new EmpresaController();
            var resposta = "";

            resposta = controller.calculoDeConfiabilidade(qntdNotas, qntdDebitos);

            resultado.Should().Be(resultado, $"O Índice não corresponde ao valor esperado ({resultado})");
        }
Esempio n. 16
0
 public CFDI33()
 {
     //Controladores
     ventaController    = new VentaController();
     ventapController   = new VentapController();
     clienteController  = new ClienteController();
     empresaController  = new EmpresaController();
     dymErrorController = new DymErrorController();
 }
Esempio n. 17
0
        public EmpresaControllerTest()
        {
            _cacheMock   = new Mock <IDistributedCache>();
            _serviceMock = new Mock <IEmpresaService>();

            SetupInitialize();

            _controller = new EmpresaController(_cacheMock.Object, _serviceMock.Object);
        }
Esempio n. 18
0
        public static bool ExisteActiva()
        {
            if (empresaCtrl == null)
            {
                empresaCtrl = new EmpresaController();
            }

            return(empresaCtrl.GetActivas(userName).Count > 0);
        }
        public void DeveCalcularErroneamente(string qntdNotas, string qntdDebitos, string resultado)
        {
            EmpresaController controller = new EmpresaController();
            var resposta = "";

            resposta = controller.calculoDeConfiabilidade(qntdNotas, qntdDebitos);

            Assert.NotEqual(resultado, resposta);
        }
Esempio n. 20
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            if (_FaltaCampoRequerido())
            {
                return;
            }

            try
            {
                if (txtContrasenia.Text == "")
                {
                    MessageBox.Show("Debe ingresar una contraseña válida");
                    return;
                }
                if (txtContrasenia.Text != txtRepetirContrasenia.Text)
                {
                    MessageBox.Show("La contraseña y la confirmación de contraseña deben ser iguales");
                    return;
                }

                var empresa = new Empresa();
                empresa.idEmpresa         = IdEmpresa;
                empresa.RazonSocial       = txtRazonSocial.Text;
                empresa.Nombre            = txtNombre.Text;
                empresa.Apellido          = txtApellido.Text;
                empresa.Telefono          = txtTelefono.Text;
                empresa.Fax               = txtFax.Text;
                empresa.Email             = txtEmail.Text;
                empresa.Web               = txtWeb.Text;
                empresa.Domicilio         = txtDomicilio.Text;
                empresa.Provincia         = cmbProvincia.Text;
                empresa.Localidad         = txtLocalidad.Text;
                empresa.CodPostal         = txtCodPostal.Text;
                empresa.CUIT              = txtCuit.Text;
                empresa.idCondicionIVA    = Convert.ToInt32(cmbCondicionIva.SelectedValue);
                empresa.InicioActividades = dtpInicioActividades.Value;
                empresa.IngBrutos         = txtIngresosBrutos.Text;
                empresa.PorcentajeIVA     = Convert.ToDecimal(txtPorcentajeIVA.Text);
                empresa.Contrasenia       = txtContrasenia.Text;

                if (EmpresaController.CrearOActualizarEmpresa(empresa))
                {
                    MessageBox.Show("Datos guardados correctamente");
                    this.Close();
                }
                else
                {
                    MessageBox.Show("Ocurrio un problema al guardar los datos de la Empresa, inténtelo nuevamente");
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Ocurrio un problema al guardar los datos de la Empresa, inténtelo nuevamente");
                this.Close();
            }
        }
        public RetornoNotaFiscalEntity ReceberNotaFiscalAvulso(Consulta model)
        {
            DataBase.SystemEnvironment = model.Homologacao ? SystemEnvironment.Development : SystemEnvironment.Production;

            NfeEntity nfe = new NfeController().ConsultarNotaFiscal(model.IdentificadorNota);

            model.NfeId = nfe.NfeId;

            #region Empresa
            EmpresaEntity Empresa;

            if ((Empresa = new EmpresaController().Selecionar(new EmpresaEntity {
                Cnpj = model.Cnpj
            })) == null)
            {
                throw new Exception("Empresa associada não encontrada");
            }

            if (Empresa.Token == null)
            {
                throw new Exception("O Token não foi configurado");
            }
            #endregion Empresa

            string json;

Outer:

            try
            {
                json = new Tools().GetNfse(new NfeConfiguracao().GetRemoteServer() + "/" + model.IdentificadorNota, Empresa.Token);
            }
            catch (Exception ex)
            {
                if (ex.Message.Contains("por minuto"))
                {
                    goto Outer;
                }

                AtualizarNotaFiscal(nfe);

                throw new Exception("Ocorreu um erro ao receber a Nota Fiscal (" + model.IdentificadorNota + "): " + ex.Message);
            }

            try
            {
                return(ProcessarRetornoAvulso(nfe, model, json));
            }
            catch (Exception ex)
            {
                AtualizarNotaFiscal(nfe);

                throw new Exception("Ocorreu um erro ao cadastrar a Nota Fiscal (" + model.IdentificadorNota + "): " + ex.Message);
            }
        }
Esempio n. 22
0
        private void FrmRemito_Load(object sender, EventArgs e)
        {
            ClientesController    = new ClientesController();
            LocalidadesController = new LocalidadesController();
            FiscalesController    = new FiscalesController();
            EmpresaController     = new EmpresaController();
            ArticulosController   = new ArticulosController();
            RemitosController     = new RemitosController();

            _CargarControles();
        }
Esempio n. 23
0
 protected void Page_Load(object sender, EventArgs e)
 {
     emp = new EmpresaController();
     if (!IsPostBack)
     {
         if (SitePrincipal.IsIntruso())
         {
             Response.Redirect("~/Account/Login");
         }
     }
 }
Esempio n. 24
0
        private void FrmPresupuesto_Load(object sender, EventArgs e)
        {
            ClientesController    = new ClientesController();
            LocalidadesController = new LocalidadesController();
            FiscalesController    = new FiscalesController();
            EmpresaController     = new EmpresaController();
            ArticulosController   = new ArticulosController();
            FacturasController    = new FacturasController();
            PresupuestoController = new PresupuestoController();

            _CargarControles();
        }
        private void SplitButton_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            EmpresaController  emp     = new EmpresaController();
            Cl_ConvenioEmpresa empresa = (Cl_ConvenioEmpresa)spbtnEmpresas.SelectedItem;

            dgListaPlanillas.ItemsSource = (IEnumerable)emp.PlanillasEmpresa(empresa.Id);
            txtNombreEmpresa.Text        = empresa.Nombre;
            txtRutEmpresa.Text           = Convert.ToString(empresa.Rut);
            txtDireccionEmpresa.Text     = empresa.Direccion;
            txtFechaInicio.Text          = empresa.FechaInicio.ToString("dd-MM-yyyy");
            txtFechaTermino.Text         = empresa.FechaTermino.ToString("dd-MM-yyyy");
        }
Esempio n. 26
0
 public FrmFacturas()
 {
     InitializeComponent();
     ventaController    = new VentaController();
     clienteController  = new ClienteController();
     empresaController  = new EmpresaController();
     reporteController  = new ReporteController();
     dymErrorController = new DymErrorController();
     oCFDI   = new CFDI();
     cliente = null;
     empresa = empresaController.SelectTopOne();
     reporte = reporteController.SelectOneByName(empresa.FormatoParaFacturas);
 }
        private void ResetPDT()
        {
            productoController  = new ProductoController();
            sucursalController  = new SucursalController();
            loteController      = new LoteController();
            traspasoController  = new TraspasoController();
            traspasopController = new TraspasopController();
            movInvController    = new MovInvController();
            empresaController   = new EmpresaController();
            //listas
            partidas = new List <Traspasop>();

            // Objetos
            traspaso  = null;
            empresa   = empresaController.SelectTopOne();
            producto  = null;
            sucursalO = null;
            lote      = null;

            //Variables
            Subtotal   = 0;
            Impuesto   = 0;
            sobreGrid  = false;
            SigPartida = 0;

            TxtOrigen.Text      = "";
            TxtDestino.Text     = "";
            TxtDocumento.Text   = "";
            TxtProductoId.Text  = "";
            NCantidad.Value     = 1;
            TxtImpuestos.Text   = "";
            TxtSubtotal.Text    = "";
            TxtTotal.Text       = "";
            TxtDescripcion.Text = "";
            TxtLoteId.Text      = "";
            TxtNoLote.Text      = "";
            TxtCaducidad.Text   = "";

            Malla.Rows.Clear();
            MallaLote.Rows.Clear();
            for (int i = 0; i < NPARTIDAS; i++)
            {
                Malla.Rows.Add();
                Malla.Rows[i].Cells[3].Style.BackColor = Color.Yellow;
                Malla.Rows[i].Cells[4].Style.BackColor = Color.Yellow;
                Malla.Rows[i].Cells[6].Style.BackColor = Color.Yellow;
                Malla.Rows[i].Cells[8].Style.BackColor = Color.Yellow;
            }

            CreaTraspaso();
        }
Esempio n. 28
0
        public string CancelarNotaFiscalAvulso(Cancelamento model)
        {
            DataBase.SystemEnvironment = model.Homologacao ? SystemEnvironment.Development : SystemEnvironment.Production;

            var nfe = new NfeController().ConsultarNotaFiscal(model.IdentificadorNota);

            if (nfe == null)
            {
                new NfeWsErroController().CadastrarErroGenerico(model.GrvId, model.UsuarioId, model.IdentificadorNota, OrigemErro.MobLink, Acao.Retorno, "Nota Fiscal não encontrada");

                throw new Exception("Nota Fiscal não encontrada");
            }

            #region Empresa
            EmpresaEntity Empresa;

            if ((Empresa = new EmpresaController().Selecionar(new EmpresaEntity {
                Cnpj = model.Cnpj
            })) == null)
            {
                throw new Exception("Empresa associada não encontrada");
            }
            #endregion Empresa

            var tools = new Tools();

            string jsonEnvio = tools.ObjToJSON(new Dictionary <string, string>()
            {
                {
                    "justificativa",
                    model.Justificativa
                }
            });

            string jsonRetorno;

            try
            {
                jsonRetorno = tools.CancelarNfse(new NfeConfiguracao().GetRemoteServer() + "/" + model.IdentificadorNota, jsonEnvio, Empresa.Token);
            }
            catch (Exception ex)
            {
                throw new Exception("Ocorreu um erro ao cancelar a Nota Fiscal (" + model.IdentificadorNota + "): " + ex.Message);
            }

            nfe.Status = 'N';

            new NfeController().Atualizar(nfe);

            return(jsonRetorno);
        }
Esempio n. 29
0
        static void Main(string[] args)
        {
            Console.WriteLine("\nSISTEMA DE CONTROLE DE EMPRESAS E FUNCIONÁRIOS\n");

            var empresaController = new EmpresaController();

            Console.WriteLine("(1) Cadastrar empresa");
            Console.WriteLine("(2) Atualizar empresa");
            Console.WriteLine("(3) Excluir empresa");
            Console.WriteLine("(4) Consultar empresas");
            Console.WriteLine("(0) Sair");

            try
            {
                Console.Write("\nEscolha a opção desejada: ");
                var opcao = int.Parse(Console.ReadLine());

                switch (opcao)
                {
                case 1:
                    empresaController.CadastrarEmpresa();
                    Main(args);     //recursividade
                    break;

                case 2:
                    empresaController.AtualizarEmpresa();
                    Main(args);     //recursividade
                    break;

                case 3:
                    empresaController.ExcluirEmpresa();
                    Main(args);     //recursividade
                    break;

                case 4:
                    empresaController.ConsultarEmpresas();
                    Main(args);     //recursividade
                    break;

                case 0:
                    Console.WriteLine("\nFIM DO PROGRAMA!");
                    break;
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("\nErro: " + e.Message);
            }

            Console.ReadKey();
        }
Esempio n. 30
0
        protected void Page_Load(object sender, EventArgs e)
        {
            vehiculoCtrl = new VehiculoController();
            empresaCtrl  = new EmpresaController();

            if (!IsPostBack)
            {
                if (!SitePrincipal.IsIntruso())
                {
                    placa = Request.QueryString["placa"];
                    if (!String.IsNullOrEmpty(placa))
                    {
                        var ve = vehiculoCtrl.listar(placa);
                        lblplaca.Text      = ve.NroPlaca;
                        lblanio.Text       = ve.Año.ToString();
                        lblpatente.Text    = ve.Patente.ToString();
                        lblchasis.Text     = ve.NroChasis.ToString();
                        lblfechareg.Text   = ve.FechaReg.ToShortDateString();
                        lblmodelo.Text     = ve.Modelo;
                        lblmotor.Text      = ve.NroMotor;
                        lblusuarioreg.Text = ve.UsuaReg;
                        //string idempresa = ve.idempresa;
                        //if (!String.IsNullOrEmpty(idempresa))
                        //{
                        //    var empresa = empresaCtrl.listar(idempresa);
                        //    lblnite.Text = empresa.NIT;
                        //    lblrazonse.Text = empresa.RazonSocial;
                        //    lblemaile.Text = empresa.email;
                        //}
                        string nroplaca = ve.NroPlaca;
                        if (!String.IsNullOrEmpty(nroplaca))
                        {
                            //var empresa = empresaCtrl.listar(idempresa);
                            var empresa = empresaCtrl.getEmpresaXNroPlaca(nroplaca);
                            lblnite.Text    = empresa.NIT;
                            lblrazonse.Text = empresa.RazonSocial;
                            lblemaile.Text  = empresa.email;
                        }
                    }
                    else
                    {
                        Response.Redirect("~/Vistas/Vehiculos/Index");
                    }
                }
                else
                {
                    Response.Redirect("~/Account/Login");
                }
            }
        }