Esempio n. 1
0
        protected void grvIngresoMateriales_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "Anular")
            {
                try
                {
                    int         Idkardex  = Utilidades.ToInt(e.CommandArgument.ToString());
                    GridViewRow Gvr       = (GridViewRow)((ImageButton)e.CommandSource).NamingContainer;
                    int         FilaIndex = Gvr.RowIndex;

                    KardexMaterial kardex = new KardexMaterial()
                    {
                        IdKardexMaterial = Idkardex
                    };
                    AtencionPeluqueriaBuss.GrabarKardexMaterial(kardex, 2);
                    ListarKardex();
                }
                catch (Exception ex)
                {
                    msgError.Clear();
                    msgError.AppendLine("Fecha:" + DateTime.Now.ToString());
                    msgError.AppendLine("Descripción:" + ex.Message);
                    msgError.AppendLine("Detalle:" + ex.StackTrace);
                    log.Error(msgError.ToString());
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Mensaje", "$.growl.warning({ title: 'Mensaje Sistema', message: 'Error interno del sistema contacte con su administrador.'});", true);
                }
            }
        }
        protected void btngrabar_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtnommaterial.Text == string.Empty)
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Mensaje", "$.growl.warning({ title: 'Mensaje Sistema', message: 'Primero debe realizar la busqueda del material.'});", true);
                    return;
                }

                int       idmaterial = Utilidades.ToInt(txtcodmaterial.Text);
                DataTable data       = AtencionPeluqueriaBuss.GetDatosMaterial(idmaterial);

                decimal cantidad = Utilidades.ToDecimal(txtcantidad.Text);

                if (cantidad == 0)
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Mensaje", "$.growl.warning({ title: 'Mensaje Sistema', message: 'Ingrese la cantidad.'});", true);
                    return;
                }

                if (data.Rows.Count > 0)
                {
                    this.txtnommaterial.Text    = data.Rows[0]["Nombre"].ToString();
                    this.txtDescripciónmat.Text = data.Rows[0]["Descripcion"].ToString();
                    this.txtcategoria.Text      = data.Rows[0]["Categoria"].ToString();
                    this.txtmodelo.Text         = data.Rows[0]["Modelo"].ToString();
                    this.txtundmedida.Text      = data.Rows[0]["UnidadMedida"].ToString();
                }
                else
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Mensaje", "alert('El material para el código ingresado no existe.')", true);
                    limpiarform();
                    return;
                }


                KardexMaterial kardex = new KardexMaterial();

                kardex.FechaMovimiento = txtfecharegistro.Text;
                kardex.Cantidad        = Utilidades.ToDecimal(txtcantidad.Text);
                kardex.PrecioCompra    = Utilidades.ToDecimal(txtpreciocompra.Text);
                kardex.TipoMovimiento  = cboTipoMov.SelectedValue;
                kardex.idMaterial      = Utilidades.ToInt(txtcodmaterial.Text);
                kardex.NumGuia         = txtnumguia.Text.ToUpper();
                AtencionPeluqueriaBuss.GrabarKardexMaterial(kardex, 1);
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Mensaje", "$.growl.warning({ title: 'Mensaje Sistema', message: 'Movimiento de kardex ingresado correctamente.'});", true);
                this.limpiarform();
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Mensaje", "$.growl.warning({ title: 'Mensaje Sistema', message: 'Error interno del sistema.'});", true);
            }
        }
Esempio n. 3
0
        protected void grvIngresoMateriales_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "Anular")
            {
                try
                {
                    int         idkardex = Utilidades.ToInt(e.CommandArgument.ToString());
                    GridViewRow gvr      = (GridViewRow)((ImageButton)e.CommandSource).NamingContainer;
                    int         RowIndex = gvr.RowIndex;

                    KardexMaterial kardex = new KardexMaterial()
                    {
                        idKardexMaterial = idkardex
                    };
                    AtencionPeluqueriaBuss.GrabarKardexMaterial(kardex, 2);
                    ListarKardex();
                }
                catch (Exception ex)
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Mensaje", "$.growl.warning({ title: 'Mensaje Sistema', message: 'Error interno del sistema.'});", true);
                }
            }
        }