Example #1
0
 private void btnAceptar_Click(object sender, EventArgs e)
 {
     if (_accion == "Agregar")
     {
         _proveedor              = new Proveedor();
         _proveedor["nombre"]    = new QueryExecutor.QueryResultData(tbNombre.Text, QueryExecutor.DataType.STRING);
         _proveedor["domingo"]   = new QueryExecutor.QueryResultData(chkDomingo.Checked, QueryExecutor.DataType.BOOL);
         _proveedor["lunes"]     = new QueryExecutor.QueryResultData(chkLunes.Checked, QueryExecutor.DataType.BOOL);
         _proveedor["martes"]    = new QueryExecutor.QueryResultData(chkMartes.Checked, QueryExecutor.DataType.BOOL);
         _proveedor["miercoles"] = new QueryExecutor.QueryResultData(chkMiercoles.Checked, QueryExecutor.DataType.BOOL);
         _proveedor["jueves"]    = new QueryExecutor.QueryResultData(chkJueves.Checked, QueryExecutor.DataType.BOOL);
         _proveedor["viernes"]   = new QueryExecutor.QueryResultData(chkViernes.Checked, QueryExecutor.DataType.BOOL);
         _proveedor["sabado"]    = new QueryExecutor.QueryResultData(chkSabado.Checked, QueryExecutor.DataType.BOOL);
         _proveedor["activo"]    = new QueryExecutor.QueryResultData(chkActivo.Checked, QueryExecutor.DataType.BOOL);
         DBQueriesGeneral.InsertaProveedor(_proveedor);
         DialogResult = System.Windows.Forms.DialogResult.OK;
         Close();
     }
     if (_accion == "Editar")
     {
         _proveedor.Update(DBQueriesGeneral.executor);
         DialogResult = System.Windows.Forms.DialogResult.OK;
         Close();
     }
 }
Example #2
0
 private void btnAceptar_Click(object sender, EventArgs e)
 {
     if (_accion == "Agregar")
     {
         _cliente           = new Cliente();
         _cliente["rfc"]    = new QueryExecutor.QueryResultData(tbRFC.Text, QueryExecutor.DataType.STRING);
         _cliente["nombre"] = new QueryExecutor.QueryResultData(tbNombre.Text, QueryExecutor.DataType.STRING);
         DBQueriesGeneral.InsertaCliente(_cliente);
         DialogResult = System.Windows.Forms.DialogResult.OK;
         Close();
     }
     if (_accion == "Editar")
     {
         _cliente.Update(DBQueriesGeneral.executor);
         DialogResult = System.Windows.Forms.DialogResult.OK;
         Close();
     }
 }
Example #3
0
 private void btnAceptar_Click(object sender, EventArgs e)
 {
     if (_accion == "Agregar")
     {
         _dep            = new Departamento();
         _dep["nombre"]  = new QueryExecutor.QueryResultData(tbNombre.Text, QueryExecutor.DataType.STRING);
         _dep["agranel"] = new QueryExecutor.QueryResultData(chkAgranel.Checked, QueryExecutor.DataType.BOOL);
         _dep["activo"]  = new QueryExecutor.QueryResultData(chkActivo.Checked, QueryExecutor.DataType.BOOL);
         DBQueriesGeneral.InsertaDepartamento(_dep);
         DialogResult = System.Windows.Forms.DialogResult.OK;
         Close();
     }
     if (_accion == "Editar")
     {
         _dep["nombre"]  = new QueryExecutor.QueryResultData(tbNombre.Text, QueryExecutor.DataType.STRING);
         _dep["agranel"] = new QueryExecutor.QueryResultData(chkAgranel.Checked, QueryExecutor.DataType.BOOL);
         _dep["activo"]  = new QueryExecutor.QueryResultData(chkActivo.Checked, QueryExecutor.DataType.BOOL);
         _dep.Update(DBQueriesGeneral.executor);
         DialogResult = System.Windows.Forms.DialogResult.OK;
         Close();
     }
 }
Example #4
0
 private void btnAceptar_Click(object sender, EventArgs e)
 {
     //Producto _producto = null;
     if (_accion == "Agregar")
     {
         producto = DBQueriesGeneral.ConsultaProductoPorCodigo(tbCodigo.Text);
         if (producto != null)
         {
             if (MessageBox.Show(this, string.Format("Ya existe un producto registrado con el código: {0}, ¿Desea reemplazarlo?", tbCodigo.Text), Application.ProductName, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
             {
                 producto["codigo"]               = new QueryExecutor.QueryResultData(tbCodigo.Text, QueryExecutor.DataType.STRING);
                 producto["descripcion"]          = new QueryExecutor.QueryResultData(tbDescripcion.Text, QueryExecutor.DataType.STRING);
                 producto["preciocosto"]          = new QueryExecutor.QueryResultData(ntbCosto.Text, QueryExecutor.DataType.DOUBLE);
                 producto["precioventa"]          = new QueryExecutor.QueryResultData(ntbPrecio.Text, QueryExecutor.DataType.DOUBLE);
                 producto["existencia"]           = new QueryExecutor.QueryResultData(ntbExistencia.Text, QueryExecutor.DataType.DOUBLE);
                 producto["minimo"]               = new QueryExecutor.QueryResultData(ntbMinimo.Text, QueryExecutor.DataType.DOUBLE);
                 producto["departamento"]         = new QueryExecutor.QueryResultData(departamento["iddepartamento"].ToIn32(), QueryExecutor.DataType.INTEGER);
                 producto["nombredepartamento"]   = new QueryExecutor.QueryResultData(departamento["nombre"].ToString(), QueryExecutor.DataType.STRING);
                 producto["proveedor"]            = new QueryExecutor.QueryResultData(proveedor["idproveedor"].ToIn32(), QueryExecutor.DataType.INTEGER);
                 producto["nombreproveedor"]      = new QueryExecutor.QueryResultData(proveedor["nombre"].ToString(), QueryExecutor.DataType.STRING);
                 producto["unidadproducto"]       = new QueryExecutor.QueryResultData(unidad["idunidadproducto"].ToIn32(), QueryExecutor.DataType.INTEGER);
                 producto["nombreunidadproducto"] = new QueryExecutor.QueryResultData(unidad["nombre"].ToString(), QueryExecutor.DataType.STRING);
                 producto["inventario"]           = new QueryExecutor.QueryResultData(chkInventario.Checked, QueryExecutor.DataType.BOOL);
                 producto["agranel"]              = new QueryExecutor.QueryResultData(chkAgranel.Checked, QueryExecutor.DataType.BOOL);
                 producto["activo"]               = new QueryExecutor.QueryResultData(chkActivo.Checked, QueryExecutor.DataType.BOOL);
                 producto.Update(DBQueriesGeneral.executor);
                 DialogResult = System.Windows.Forms.DialogResult.OK;
                 Close();
             }
         }
         else
         {
             _producto                         = new Producto();
             _producto["codigo"]               = new QueryExecutor.QueryResultData(tbCodigo.Text, QueryExecutor.DataType.STRING);
             _producto["descripcion"]          = new QueryExecutor.QueryResultData(tbDescripcion.Text, QueryExecutor.DataType.STRING);
             _producto["preciocosto"]          = new QueryExecutor.QueryResultData(ntbCosto.Text, QueryExecutor.DataType.DOUBLE);
             _producto["precioventa"]          = new QueryExecutor.QueryResultData(ntbPrecio.Text, QueryExecutor.DataType.DOUBLE);
             _producto["existencia"]           = new QueryExecutor.QueryResultData(ntbExistencia.Text, QueryExecutor.DataType.DOUBLE);
             _producto["minimo"]               = new QueryExecutor.QueryResultData(ntbMinimo.Text, QueryExecutor.DataType.DOUBLE);
             _producto["departamento"]         = new QueryExecutor.QueryResultData(departamento["iddepartamento"].ToIn32(), QueryExecutor.DataType.INTEGER);
             _producto["nombredepartamento"]   = new QueryExecutor.QueryResultData(departamento["nombre"].ToString(), QueryExecutor.DataType.STRING);
             _producto["proveedor"]            = new QueryExecutor.QueryResultData(proveedor["idproveedor"].ToIn32(), QueryExecutor.DataType.INTEGER);
             _producto["nombreproveedor"]      = new QueryExecutor.QueryResultData(proveedor["nombre"].ToString(), QueryExecutor.DataType.STRING);
             _producto["unidadproducto"]       = new QueryExecutor.QueryResultData(unidad["idunidadproducto"].ToIn32(), QueryExecutor.DataType.INTEGER);
             _producto["nombreunidadproducto"] = new QueryExecutor.QueryResultData(unidad["nombre"].ToString(), QueryExecutor.DataType.STRING);
             _producto["inventario"]           = new QueryExecutor.QueryResultData(chkInventario.Checked, QueryExecutor.DataType.BOOL);
             _producto["agranel"]              = new QueryExecutor.QueryResultData(chkAgranel.Checked, QueryExecutor.DataType.BOOL);
             _producto["activo"]               = new QueryExecutor.QueryResultData(chkActivo.Checked, QueryExecutor.DataType.BOOL);
             DBQueriesGeneral.InsertaProducto(_producto);
             DialogResult = System.Windows.Forms.DialogResult.OK;
             Close();
         }
     }
     if (_accion == "Editar")
     {
         _producto["departamento"]         = new QueryExecutor.QueryResultData(departamento["iddepartamento"].ToIn32(), QueryExecutor.DataType.INTEGER);
         _producto["nombredepartamento"]   = new QueryExecutor.QueryResultData(departamento["nombre"].ToString(), QueryExecutor.DataType.STRING);
         _producto["proveedor"]            = new QueryExecutor.QueryResultData(proveedor["idproveedor"].ToIn32(), QueryExecutor.DataType.INTEGER);
         _producto["nombreproveedor"]      = new QueryExecutor.QueryResultData(proveedor["nombre"].ToString(), QueryExecutor.DataType.STRING);
         _producto["unidadproducto"]       = new QueryExecutor.QueryResultData(unidad["idunidadproducto"].ToIn32(), QueryExecutor.DataType.INTEGER);
         _producto["nombreunidadproducto"] = new QueryExecutor.QueryResultData(unidad["nombre"].ToString(), QueryExecutor.DataType.STRING);
         _producto.Update(DBQueriesGeneral.executor);
         DialogResult = System.Windows.Forms.DialogResult.OK;
         Close();
     }
 }