Esempio n. 1
0
 protected void btnModificar_Click(object sender, EventArgs e)
 {
     try
     {
         TipoObservacion partida = new TipoObservacion();
         partida.Id          = Convert.ToInt32(ViewState["id"]);
         partida.Descripcion = txtDescripcion.Text;
         partida.Estado      = chkEstado.Checked ? 1 : 0;
         if (DatosTipoObservacion.ModificarTipoObservacion(partida))
         {
             lblMensaje.Text     = "Tipo de observacion Modificada";
             lblMensaje.CssClass = "correcto";
         }
         else
         {
             lblMensaje.Text     = "Error al Modificar";
             lblMensaje.CssClass = "error";
         }
         llenarGrid();
     }
     catch (Exception ex)
     {
         lblMensaje.Text = ex.Message;
     }
 }
Esempio n. 2
0
 protected void btnIngresar_Click(object sender, EventArgs e)
 {
     try
     {
         TipoObservacion obj = new TipoObservacion();
         if (txtDescripcion.Equals(""))
         {
             txtDescripcion.Focus();
         }
         obj.Descripcion = txtDescripcion.Text;
         if (DatosTipoObservacion.AgregarTipoObservacion(obj))
         {
             lblMensaje.Text     = "Tipo de observacion agregado";
             lblMensaje.CssClass = "correcto";
         }
         else
         {
             lblMensaje.Text     = "Error al Agregar";
             lblMensaje.CssClass = "error";
         }
         llenarGrid();
     }
     catch (Exception ex)
     {
         lblMensaje.Text = ex.Message;
     }
 }
Esempio n. 3
0
    public static TipoObservacion BuscarTipoObservacion(string nombre)
    {
        try
        {
            TipoObservacion obj = new TipoObservacion();

            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_TIPO_OBSERVACION_POR_NOMBRE"
            };

            SqlParameter parametro = new SqlParameter
            {
                ParameterName = "@PIN_NOMBRE",
                SqlDbType     = SqlDbType.VarChar,
                Value         = nombre
            };

            comando.Parameters.Add(parametro);
            SqlDataAdapter myDA = new SqlDataAdapter(comando);
            DataTable      dt   = new DataTable();
            myDA.Fill(dt);
            if (dt.Rows.Count == 0)
            {
                throw new Exception("Tipo de observacion no Existe");
            }
            else
            {
                obj.Id = Convert.ToInt16(dt.Rows[0][0].ToString());

                obj.Descripcion = dt.Rows[0][1].ToString();

                obj.Estado = Convert.ToInt16(dt.Rows[0][2].ToString());
            }
            return(obj);
        }
        catch (Exception ex)
        {
            throw new Exception(ex.Message);
        }
    }
Esempio n. 4
0
    public static bool ModificarTipoObservacion(TipoObservacion 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_TIPO_OBSERVACION"
                }
                       )
                {
                    cmd.Parameters.AddWithValue("@PIN_CODIGO", SqlDbType.Int).Value        = obj.Id;
                    cmd.Parameters.AddWithValue("@PIN_DESCRIPCION", SqlDbType.NChar).Value = obj.Descripcion;
                    cmd.Parameters.AddWithValue("@PIN_ESTADO", SqlDbType.TinyInt).Value    = obj.Estado;

                    conn.Open();
                    if (cmd.ExecuteNonQuery() > 0)
                    {
                        agregado = true;
                    }
                    else
                    {
                        throw new Exception("Error al modificar el tipo de observacion");
                    }
                    agregado = true;
                }
            }
            return(agregado);
        }
        catch (Exception ex)
        {
            throw new Exception(ex.Message);
        }
    }
Esempio n. 5
0
    public static TipoObservacion BuscarTipoObservacion(int codigo)
    {
        try
        {
            TipoObservacion obj = new TipoObservacion();

            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_TIPO_OBSERVACION"
            };

            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          = Convert.ToInt16(dt.Rows[0][0].ToString());
            obj.Descripcion = dt.Rows[0][1].ToString();
            obj.Estado      = Convert.ToInt16(dt.Rows[0][2].ToString());

            return(obj);
        }
        catch (Exception ex)
        {
            throw new Exception(ex.Message);
        }
    }
Esempio n. 6
0
 protected void GridView_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     try
     {
         if (e.CommandName.Equals("Editar"))
         {
             int             index   = Convert.ToInt32(e.CommandArgument);
             GridViewRow     row     = GridView.Rows[index];
             Label           codigo  = (Label)row.FindControl("CODIGO");
             int             id      = Convert.ToInt32(codigo.Text);
             TipoObservacion partida = DatosTipoObservacion.BuscarTipoObservacion(id);
             ViewState["id"]      = id;
             txtDescripcion.Text  = partida.Descripcion;
             chkEstado.Enabled    = true;
             chkEstado.Checked    = partida.Estado == 1 ? true : false;
             btnIngresar.Visible  = false;
             btnModificar.Visible = true;
         }
     }
     catch (Exception ex)
     {
         lblMensaje.Text = ex.Message;
     }
 }
Esempio n. 7
0
        public static ITipoObservacion GetTipoObservacionFactory()
        {
            TipoObservacion tipoObs = new TipoObservacion();

            return((ITipoObservacion)tipoObs);
        }
 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;
 }