public static bool ModificarEstadoReparacion(EstadoReparacion obj)
    {
        try
        {
            bool     agregado = false;
            Conexion c        = new Conexion();
            string   servidor = c.cadena();

            using (SqlConnection conn = new SqlConnection(servidor))
            {
                using (SqlCommand cmd = new SqlCommand
                {
                    Connection = conn,
                    CommandType = CommandType.StoredProcedure,
                    CommandText = "P_MODIFICAR_ESTADOREPARACION"
                }
                       )
                {
                    cmd.Parameters.AddWithValue("@PIN_CODIGO", SqlDbType.VarChar).Value      = obj.Id;
                    cmd.Parameters.AddWithValue("@PIN_DESCRIPCION", SqlDbType.VarChar).Value = obj.Descripcion;
                    cmd.Parameters.AddWithValue("@PIN_ESTADO", SqlDbType.TinyInt).Value      = obj.Estado;

                    conn.Open();
                    cmd.ExecuteNonQuery();
                    agregado = true;
                }
            }
            return(agregado);
        }
        catch (Exception ex)
        {
            throw new Exception(ex.Message);
        }
    }
    protected void cboEstadoReparacion_SelectedIndexChanged(object sender, EventArgs e)
    {
        int estadoReparacion    = Convert.ToInt32(cboEstadoReparacion.SelectedValue);
        EstadoReparacion estado = DatosEstadoReparacion.BuscarEstadoReparacion(estadoReparacion);

        if (estado.Estado == 0)
        {
            cboEstadoReparacion.SelectedValue = "0";
            lblMensajePopUp.Text = "Este estado de reparación no es accesible";
            divMensajePopUp.Attributes.Add("class", "alert alert-danger");
        }
        else
        {
            if (estadoReparacion == 7 || estadoReparacion == 8 || estadoReparacion == 10)
            {
                if (cboTipoObservacion.SelectedValue != "1" && cboTipoObservacion.SelectedValue != "2")
                {
                    btnModificar.CssClass = "btn btn-danger";
                    cboTipoObservacion.Focus();
                    lblMensajePopUp.Text = "Debe seleccionar un Tipo de observacion";
                    divMensajePopUp.Attributes.Add("class", "alert alert-danger");
                }
                txtFecha.Enabled = true;
            }
        }
    }
示例#3
0
    protected void btnModificar_Click(object sender, EventArgs e)
    {
        try
        {
            EstadoReparacion obj = new EstadoReparacion();
            if (txtDescripcion.Equals(""))
            {
                txtDescripcion.Focus();
            }

            obj.Id          = Convert.ToInt32(ViewState["id"]);
            obj.Descripcion = txtDescripcion.Text;
            obj.Estado      = chkEstado.Checked ? 1 : 0;
            if (DatosEstadoReparacion.ModificarEstadoReparacion(obj))
            {
                lblMensaje.Text     = "Estado de reparacion Modificado";
                lblMensaje.CssClass = "correcto";
            }
            else
            {
                lblMensaje.Text     = "Error al Modificar";
                lblMensaje.CssClass = "error";
            }
            llenarGrid();
        }
        catch (Exception ex)
        {
            lblMensaje.Text = ex.Message;
        }
    }
示例#4
0
    protected void btnIngresar_Click(object sender, EventArgs e)
    {
        try
        {
            EstadoReparacion obj = new EstadoReparacion();
            if (txtDescripcion.Equals(""))
            {
                txtDescripcion.Focus();
            }

            obj.Descripcion = txtDescripcion.Text;

            if (DatosEstadoReparacion.AgregarEstadoReparacion(obj))
            {
                lblMensaje.Text     = "Estado de reparacion agregado";
                lblMensaje.CssClass = "correcto";
            }
            else
            {
                lblMensaje.Text     = "Error al Agregar";
                lblMensaje.CssClass = "error";
            }
            llenarGrid();
        }
        catch (Exception ex)
        {
            lblMensaje.Text = ex.Message;
        }
    }
    public static EstadoReparacion BuscarEstadoReparacion(int codigo)
    {
        try
        {
            EstadoReparacion obj = new EstadoReparacion();

            Conexion c = new Conexion();

            string servidor = c.cadena();

            SqlConnection conexion = new SqlConnection(servidor);
            SqlCommand    comando  = new SqlCommand
            {
                Connection  = conexion,
                CommandType = CommandType.StoredProcedure,
                CommandText = "P_BUSCAR_ESTADOREPARACION"
            };

            SqlParameter parametro = new SqlParameter
            {
                ParameterName = "@PIN_CODIGO",
                SqlDbType     = SqlDbType.Int,
                Value         = codigo
            };

            comando.Parameters.Add(parametro);
            SqlDataAdapter myDA = new SqlDataAdapter(comando);
            DataTable      dt   = new DataTable();
            myDA.Fill(dt);
            obj.Id          = int.Parse(dt.Rows[0][0].ToString());
            obj.Descripcion = dt.Rows[0][1].ToString();
            obj.Estado      = int.Parse(dt.Rows[0][2].ToString());
            return(obj);
        }
        catch (Exception ex)
        {
            throw new Exception(ex.Message);
        }
    }
示例#6
0
 protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     try
     {
         if (e.CommandName.Equals("Editar"))
         {
             int              index  = Convert.ToInt32(e.CommandArgument);
             GridViewRow      row    = GridView1.Rows[index];
             Label            codigo = (Label)row.FindControl("CODIGO");
             int              id     = Convert.ToInt32(codigo.Text);
             EstadoReparacion obj    = DatosEstadoReparacion.BuscarEstadoReparacion(id);
             ViewState["id"]      = id;
             txtDescripcion.Text  = obj.Descripcion;
             chkEstado.Enabled    = true;
             chkEstado.Checked    = obj.Estado == 1 ? true : false;
             btnIngresar.Visible  = false;
             btnModificar.Visible = true;
         }
     }
     catch (Exception ex)
     {
         lblMensaje.Text = ex.Message;
     }
 }
 public Observacion(int id, Supervisor supervisorConstructora, Supervisor supervisorInmobiliaria, Maestro maestro, Partida partida, Causa causa, Recinto recinto, Propietario propietario, int estado, EstadoReparacion estadoReparacion, string fechaObservacion, int secuencia, Inmueble numDepto, string descObservacion, string rutResidente, string fechaEntrega, string nombreResidente, string telefonoResidente, string fechaCoordinacion, Hora horaInicio, Hora horaTermino, int corrActa, string reparacion, int estatus, string fechaCierre, TipoObservacion tipoObservacion, string fechaCoordinacion2, Hora horaInicio2, Hora horaTermino2, string fechaCreacion)
 {
     this.Id = id;
     this.SupervisorConstructora = supervisorConstructora;
     this.SupervisorInmobiliaria = supervisorInmobiliaria;
     this.Maestro            = maestro;
     this.Partida            = partida;
     this.Causa              = causa;
     this.Recinto            = recinto;
     this.Propietario        = propietario;
     this.Estado             = estado;
     this.EstadoReparacion   = estadoReparacion;
     this.FechaObservacion   = fechaObservacion;
     this.Secuencia          = secuencia;
     this.Inmueble           = numDepto;
     this.DescObservacion    = descObservacion;
     this.RutPropietario     = rutResidente;
     this.FechaEntrega       = fechaEntrega;
     this.NombreResidente    = nombreResidente;
     this.TelefonoResidente  = telefonoResidente;
     this.FechaCoordinacion  = fechaCoordinacion;
     this.HoraInicio         = horaInicio;
     this.HoraTermino        = horaTermino;
     this.CorrActa           = corrActa;
     this.Reparacion         = reparacion;
     this.Estatus            = estatus;
     this.FechaCierre        = fechaCierre;
     this.TipoObservacion    = tipoObservacion;
     this.FechaCoordinacion2 = fechaCoordinacion2;
     this.HoraInicio2        = horaInicio2;
     this.HoraTermino2       = horaTermino2;
     this.FechaCreacion      = fechaCreacion;
 }