コード例 #1
0
        public void Editar(object sender, GridViewCommandEventArgs e)
        {
            Label label;
            Label label3;

            this.gridViewRow = ((Control)e.CommandSource).BindingContainer as GridViewRow;
            if (e.CommandName.CompareTo("Editar") == 0)
            {
                label  = (Label)this.gridViewRow.FindControl("lblIDGASTO");
                label3 = (Label)this.gridViewRow.FindControl("lblEstadogasto");
                if (label3.Text.ToString() == "RECEPCION_BOLETA")
                {
                    ScriptManager.RegisterStartupScript(this.Page, base.GetType(), "", "alert('Estado Recepci\x00f3n Boleta no puede ser eliminado');", true);
                }
                else
                {
                    Transaccion.EliminarGastoReconst(label.Text.ToString());
                    ScriptManager.RegisterStartupScript(this.Page, base.GetType(), "Error", "alert('Gasto eliminado satisfactoriamente');window.location.href='ReconstitucionGastosEdicion.aspx" + ("?OT=" + this.hddOT.Value.ToString() + "&rut=" + this.txtRut.Text.ToString() + "&nrooperacion=" + this.txtnrooperacion.Text.ToString() + "&nombre=" + this.txtnombre.Text.ToString()) + "';", true);
                }
            }
            if (e.CommandName.CompareTo("EditaGasto") == 0)
            {
                label = (Label)this.gridViewRow.FindControl("lblIDGASTO");
                Label label2 = (Label)this.gridViewRow.FindControl("lblOBSERVACION");
                label3 = (Label)this.gridViewRow.FindControl("lblEstadogasto");
                Label label4 = (Label)this.gridViewRow.FindControl("lblNroDocumento");
                Label label5 = (Label)this.gridViewRow.FindControl("lblIdTipoGastoss");
                Label label6 = (Label)this.gridViewRow.FindControl("lblforPAGO");
                if (label3.Text.ToString() == "RECEPCION_BOLETA")
                {
                    ScriptManager.RegisterStartupScript(this.Page, base.GetType(), "", "alert('Estado Recepci\x00f3n Boleta no puede ser editado');", true);
                }
                else
                {
                    this.lblestado.Visible       = true;
                    this.cbxEstadoGasto.Visible  = true;
                    this.cbxTipoGastos.Visible   = true;
                    this.lblObservacion.Visible  = true;
                    this.lblNroDoc.Visible       = true;
                    this.lblTipodeGasto.Visible  = true;
                    this.txtObservacion.Visible  = true;
                    this.txtNrodocumento.Visible = true;
                    this.btnnuevoEstado.Visible  = true;
                    this.lblFormaPago.Visible    = true;
                    this.cbxFormaPago.Visible    = true;
                    if (label6.Text.ToUpper() == "EFECTIVO")
                    {
                        this.cbxFormaPago.SelectedValue = "1";
                    }
                    if (label6.Text.ToUpper() == "CHEQUE")
                    {
                        this.cbxFormaPago.SelectedValue = "2";
                    }
                    if (label6.Text.ToUpper() == "TRANSFERENCIA ELECTRONICA")
                    {
                        this.cbxFormaPago.SelectedValue = "3";
                    }
                    this.ComboEstados();
                    this.cbxTipoGastos.SelectedValue  = label5.Text.ToString();
                    this.cbxEstadoGasto.SelectedValue = label3.Text.ToString();
                    this.txtNrodocumento.Text         = label4.Text.ToString();
                    this.hddNroDocumento.Value        = label4.Text.ToString();
                    this.hddidGasto.Value             = label.Text.ToString();
                    this.hddobservacion.Value         = label2.Text.ToString();
                    this.hddEstadoGasto.Value         = label3.Text.ToString();
                    this.hddTipoGasto.Value           = label5.Text.ToString();
                }
            }
        }