Ejemplo n.º 1
0
        private async Task <ResponseHelper> Actualizar(frmCategoria frm)
        {
            var rh = new ResponseHelper();

            try
            {
                await _unitOfWork.BeginTransactionAsync();

                var modelCategoria = await _unitOfWork._categoriaRepo.FindAsync(x => x.Id == frm.Id);

                modelCategoria.Nombre = frm.Nombre;

                await _unitOfWork._categoriaRepo.UpdateAsync(modelCategoria, frm.Id);

                await _unitOfWork.SaveAsync();

                _unitOfWork.Commit();

                rh.SetResponse(true, m: "Ok", TraId: modelCategoria.Id.ToString(), ErrorCode: 200);
            }
            catch (Exception e)
            {
                _logger.LogError(e.Message, e);
                rh.Message = e.Message;
            }

            return(rh);
        }
Ejemplo n.º 2
0
        //private void timer1_Tick(object sender etccccccccc)
        //{
        //    staHora.Text = DateTime.Now.ToString();
        //}
        private void toolStripButton6_Click(object sender, EventArgs e)
        {
            frmCategoria frmCategoria = new frmCategoria();

            frmCategoria.MdiParent = this;
            frmCategoria.Show();
        }
Ejemplo n.º 3
0
        private async Task <ResponseHelper> Crear(frmCategoria frm)
        {
            var rh = new ResponseHelper();

            try
            {
                await _unitOfWork.BeginTransactionAsync();

                var model = _mapper.Map <Categoria>(frm);

                await _unitOfWork._categoriaRepo.AddAsync(model);

                await _unitOfWork.SaveAsync();

                _unitOfWork.Commit();

                rh.SetResponse(true, m: "Ok", TraId: model.Id.ToString(), ErrorCode: 200);
            }
            catch (Exception e)
            {
                _logger.LogError(e.Message, e);
                rh.Message = e.Message;
            }

            return(rh);
        }
Ejemplo n.º 4
0
        private void picAgregar_Click(object sender, EventArgs e)
        {
            frmCategoria frm = new frmCategoria(operation.CREAR, null);

            frm.ShowDialog(this);
            getCategorias();
        }
Ejemplo n.º 5
0
        //26 nuevos formularios
        private void btnCategoria_Click(object sender, EventArgs e)
        {
            mostrarCategoria();
            frmCategoria categoriafrm = new frmCategoria();

            categoriafrm.enviado += new frmCategoria.pasarCategoria(realizar);
            categoriafrm.Show();
        }
Ejemplo n.º 6
0
 public async Task <ResponseHelper> CrearActualizar(frmCategoria frm)
 {
     if (frm.Id.ToString() == "00000000-0000-0000-0000-000000000000")
     {
         return(await Crear(frm));
     }
     else
     {
         return(await Actualizar(frm));
     }
 }
Ejemplo n.º 7
0
        private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
        {
            string op = treeView1.SelectedNode.Text;

            switch (op)
            {
            case "Administrar Proveedores":
                frmProveedor fp = new frmProveedor();
                addPanel(fp);
                break;

            case "Administrar Producto":
                frmProducto fpr = new frmProducto();
                addPanel(fpr);
                break;

            case "Administrar Categoria":
                frmCategoria fcr = new frmCategoria();
                addPanel(fcr);
                break;

            case "Administrar Local":
                frmLocal flr = new frmLocal();
                addPanel(flr);
                break;

            case "Administrar Usuarios":
                frmUsuarios fur = new frmUsuarios();
                addPanel(fur);
                break;

            case "Factura":
                frmFacturacion fac = new frmFacturacion();
                addPanel(fac);
                break;

            case "Reporte Proveedores":
                FrmCRProveedores i = new FrmCRProveedores();
                addPanel(i);
                break;

            case "Reporte Producto":
                FrmCRProductosFiltro l = new FrmCRProductosFiltro();
                addPanel(l);
                break;

            case "Transportista":
                frmTransportista t = new frmTransportista();
                addPanel(t);
                break;
            }
        }
Ejemplo n.º 8
0
 private void gestionDeCategoriasToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (!comprobar(FormCategorias))
     {
         FormCategorias           = new frmCategoria();
         FormCategorias.MdiParent = this;
         FormCategorias.Show();
     }
     else
     {
         FormCategorias.Activate();
     }
 }
Ejemplo n.º 9
0
 private void categoriasToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (Application.OpenForms["frmCategoria"] == null)
     {
         frmCategoria frm = new frmCategoria
         {
             MdiParent = this
         };
         frm.Show();
     }
     else
     {
         Application.OpenForms["frmCategoria"].BringToFront();
     }
 }
Ejemplo n.º 10
0
 private void mCategorias_Click(object sender, EventArgs e)
 {
     try
     {
         if (!FormularioExiste("frmCategoria"))
         {
             var formulario = new frmCategoria();
             formulario.MdiParent = this;
             Tela.AbrirFormulario(formulario);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Ejemplo n.º 11
0
        private void cmdCategoria_Click(object sender, EventArgs e)
        {
            frmCategoria categoria = new frmCategoria();

            categoria.ShowDialog();
        }
Ejemplo n.º 12
0
 public async Task <IActionResult> Put(frmCategoria model)
 {
     return(Ok(await _categoriaService.CrearActualizar(model)));
 }
Ejemplo n.º 13
0
        private void categoriasToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmCategoria categoria = new frmCategoria();

            categoria.Show();
        }
Ejemplo n.º 14
0
        public CategoriaViewModel Pesquisar(int codigo, string descricao, TipoPesquisa tipoPesquisa)
        {
            if (codigo == 0 && tipoPesquisa == TipoPesquisa.Id)
            {
                return(null);
            }

            if (string.IsNullOrEmpty(descricao) && tipoPesquisa == TipoPesquisa.Descricao)
            {
                return(null);
            }

            if (tipoPesquisa == TipoPesquisa.Tela)
            {
                frmCategoria formulario = new frmCategoria("");
                if (Tela.AbrirFormularioModal(formulario))
                {
                    if (Funcoes.IdSelecionado == 0)
                    {
                        return(null);
                    }

                    return(_categoriaApp.ObterPorId(Funcoes.IdSelecionado));
                }
            }

            if (tipoPesquisa == TipoPesquisa.Id && codigo > 0)
            {
                var model = _categoriaApp.ObterPorCodigo(codigo);
                if (model == null || model.Codigo == 0)
                {
                    throw new Exception("Registro não encontrado!");
                }
                return(model);
            }

            if (tipoPesquisa == TipoPesquisa.Descricao && descricao.Length > 0)
            {
                var model = _categoriaApp.Filtrar("Cat_Nome", descricao);
                if (model == null)
                {
                    frmCategoria formulario = new frmCategoria();
                    if (Tela.AbrirFormularioModal(formulario))
                    {
                        return(_categoriaApp.ObterPorId(Funcoes.IdSelecionado));
                    }
                    return(null);
                }
                else
                {
                    if (model.Count() == 1)
                    {
                        return(_categoriaApp.ObterPorId(model.First().Id));
                    }
                    else
                    {
                        frmCategoria formulario = new frmCategoria(descricao);
                        if (Tela.AbrirFormularioModal(formulario))
                        {
                            return(_categoriaApp.ObterPorId(Funcoes.IdSelecionado));
                        }
                    }
                    return(null);
                }
            }
            else
            {
                return(null);
            }
        }