Exemple #1
0
        private void MP_Habilitar()
        {
            try
            {
                Tb_Id.ReadOnly                = false;
                Tb_CodProducto.ReadOnly       = false;
                Tb_Descripcion.ReadOnly       = false;
                Tb_CodBarras.ReadOnly         = false;
                Tb_Peso.IsInputReadOnly       = false;
                Cb_UnidadVenta.Enabled        = true;
                Cb_UniPeso.Enabled            = true;
                Cb_Grupo1.Enabled             = true;
                Cb_Grupo2.Enabled             = true;
                Cb_Grupo3.Enabled             = true;
                Cb_Grupo4.Enabled             = true;
                Cb_Grupo5.Enabled             = true;
                BtAdicionar.Enabled           = true;
                sw_TipoPro.IsReadOnly         = false;
                Tb_IdProducto.IsInputReadOnly = false;
                Tb_Descripcion.ReadOnly       = false;
                Tb_Cantidad.IsInputReadOnly   = false;
                UTGlobal.MG_CrearCarpetaImagenes(EnCarpeta.Imagen, ENSubCarpetas.ImagenesProducto);
                UTGlobal.MG_CrearCarpetaTemporal();
                Dgv_Buscardor.Enabled = false;
                Tb_CodProducto.Focus();

                Tb_Producto.ReadOnly          = false;
                Tb_IdProducto.IsInputReadOnly = false;
                Tb_Cantidad.IsInputReadOnly   = false;
            }
            catch (Exception ex)
            {
                MP_MostrarMensajeError(ex.Message);
            }
        }
Exemple #2
0
 private void MP_Limpiar()
 {
     Tb_Id.Clear();
     Tb_CodProducto.Clear();
     Tb_Descripcion.Clear();
     Tb_CodBarras.Clear();
     Tb_Peso.Value       = 0;
     Tb_IdProducto.Value = 0;
     Tb_Cantidad.Value   = 0;
     Tb_Producto.Clear();
     if (_Limpiar == false)
     {
         UTGlobal.MG_SeleccionarCombo(Cb_UnidadVenta);
         UTGlobal.MG_SeleccionarCombo(Cb_UniPeso);
         UTGlobal.MG_SeleccionarCombo(Cb_Grupo1);
         UTGlobal.MG_SeleccionarCombo(Cb_Grupo2);
         UTGlobal.MG_SeleccionarCombo(Cb_Grupo3);
         UTGlobal.MG_SeleccionarCombo(Cb_Grupo4);
         UTGlobal.MG_SeleccionarCombo(Cb_Grupo5);
     }
 }
Exemple #3
0
 public override bool MH_NuevoRegistro()
 {
     try
     {
         int    id = 0;
         bool   resultado;
         string mensaje = "";
         //Llena el objeto
         VProducto Producto = new VProducto()
         {
             IdProd      = Tb_CodProducto.Text,
             Estado      = Convert.ToInt32(ENProductoEstado.Activo),
             Descripcion = Tb_Descripcion.Text,
             CodBar      = Tb_CodBarras.Text,
             Peso        = string.Empty == Tb_Peso.Text ? 0 : Convert.ToDecimal(Tb_Peso.Text),
             UniVenta    = Convert.ToInt32(Cb_UnidadVenta.Value),
             UniPeso     = Convert.ToInt32(Cb_UniPeso.Value),
             Grupo1      = Convert.ToInt32(Cb_Grupo1.Value),
             Grupo2      = Convert.ToInt32(Cb_Grupo2.Value),
             Grupo3      = Convert.ToInt32(Cb_Grupo3.Value),
             Grupo4      = Convert.ToInt32(Cb_Grupo4.Value),
             Grupo5      = Convert.ToInt32(Cb_Grupo5.Value),
             Tipo        = sw_TipoPro.Value == true ? 1 : 2,
             Imagen      = _imagen,
             IdProducto  = Tb_IdProducto.Text == string.Empty ? 0 : Convert.ToInt32(Tb_IdProducto.Value),
             Producto2   = Tb_Producto.Text == string.Empty ? "": Tb_Producto.Text,
             Cantidad    = Tb_Cantidad.Text == string.Empty ? 0 : Convert.ToDecimal(Tb_Cantidad.Text),
             Fecha       = DateTime.Now.Date,
             Hora        = DateTime.Now.ToString("hh:mm"),
             Usuario     = UTGlobal.Usuario,
         };
         if (VM_Nuevo) //Registro
         {
             resultado = new ServiceDesktop.ServiceDesktopClient().ProductoGuardar(Producto, ref id);
             if (resultado)
             {
                 UTGlobal.MG_MoverImagenRuta(Path.Combine(ConexionGlobal.gs_CarpetaRaiz, EnCarpeta.Imagen, ENSubCarpetas.ImagenesProducto), _imagen, Pc_ImgProducto);
                 MP_Filtrar(1);
                 MP_Limpiar();
                 Tb_Descripcion.Focus();
                 _Limpiar         = true;
                 _imagen          = "Default.jpg";
                 _ModificarImagen = false;
                 mensaje          = GLMensaje.Nuevo_Exito(_NombreFormulario, id.ToString());
             }
         }
         else//Modificar
         {
             id        = Convert.ToInt32(Tb_Id.Text);
             resultado = new ServiceDesktop.ServiceDesktopClient().ProductoModificar(Producto, id);
             if (resultado)
             {
                 if (_ModificarImagen)
                 {
                     UTGlobal.MG_MoverImagenRuta(Path.Combine(ConexionGlobal.gs_CarpetaRaiz, EnCarpeta.Imagen, ENSubCarpetas.ImagenesProducto), _imagen, Pc_ImgProducto);
                     _ModificarImagen = false;
                 }
                 Tb_CodProducto.Focus();
                 MP_Filtrar(2);
                 MP_InHabilitar();
                 _Limpiar = true;
                 _imagen  = "Default.jpg";
                 mensaje  = GLMensaje.Modificar_Exito(_NombreFormulario, id.ToString());
                 MH_Inhanbilitar();
             }
         }
         //Mensaje resultado de transaccion
         if (resultado)
         {
             ToastNotification.Show(this, mensaje, PRESENTER.Properties.Resources.GRABACION_EXITOSA, (int)GLMensajeTamano.Chico, eToastGlowColor.Green, eToastPosition.TopCenter);
         }
         else
         {
             mensaje = GLMensaje.Registro_Error(_NombreFormulario);
             ToastNotification.Show(this, mensaje, PRESENTER.Properties.Resources.CANCEL, (int)GLMensajeTamano.Chico, eToastGlowColor.Green, eToastPosition.TopCenter);
         }
         return(resultado);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.StackTrace, GLMensaje.Error);
         return(false);
     }
 }