Пример #1
0
        protected void grvresultado_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            //EJECUTAR
            if (e.CommandName == "Ejecutar")
            {
                int idHoja = Utilidades.ToInt(e.CommandArgument.ToString());
                try
                {
                    DataSet data = AtencionPeluqueriaBuss.GetDatosHojaServicioEjecutar(idHoja);


                    if (data.Tables[0].Rows.Count > 0)
                    {
                        hfidHojaServicio.Value        = data.Tables[0].Rows[0]["idHojaServicio"].ToString();
                        txtfechaemisionalt.Text       = data.Tables[0].Rows[0]["fechaRegistro"].ToString();
                        txtobservacionesejecutar.Text = data.Tables[0].Rows[0]["Observaciones"].ToString();

                        //detalle

                        this.grvResultadoPopup.DataSource = data.Tables[1];
                        this.grvResultadoPopup.DataBind();


                        lblModalTitle.Text = "Ejecutar Hoja de servicio";
                        ScriptManager.RegisterStartupScript(Page, Page.GetType(), "myModal", "$('#myModal').modal();", true);
                        upModal.Update();
                    }
                    else
                    {
                        ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Mensaje", "alert('No existe servicios agregados en la Hoja de servicio')", true);
                    }
                }
                catch (Exception ex)
                {
                    //this.lblmsg.Text = ex.Message;
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Mensaje", "$.growl.warning({ title: 'Mensaje Sistema', message: 'Error interno del sistema.'});", true);
                }

                //EDITAR
            }

            else if (e.CommandName == "Anular")
            {
                try
                {
                    int         idHoja   = Utilidades.ToInt(e.CommandArgument.ToString());
                    GridViewRow gvr      = (GridViewRow)((ImageButton)e.CommandSource).NamingContainer;
                    int         RowIndex = gvr.RowIndex;

                    HojaServicio hoja = new HojaServicio()
                    {
                        idHojaServicio = idHoja
                    };
                    AtencionPeluqueriaBuss.GrabarHojaServicio(hoja, (new List <DetalleServicio>()), 3);
                    ListarHojas();
                }
                catch (Exception ex)
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Mensaje", "$.growl.warning({ title: 'Mensaje Sistema', message: 'Error interno del sistema.'});", true);
                }
            }
        }