Beispiel #1
0
        public void actualizarRecinto(Recinto recinto)
        {
            SqlConnection connection = new SqlConnection(connectionString);
            SqlCommand    sqlCommand = new SqlCommand("sp_actualizar_recinto", connection);

            sqlCommand.CommandType = System.Data.CommandType.StoredProcedure;
            sqlCommand.Parameters.Add(new SqlParameter("@idRecinto", recinto.IdRecinto));
            sqlCommand.Parameters.Add(new SqlParameter("@nombreRecinto", recinto.NombreRecinto));
            sqlCommand.Parameters.Add(new SqlParameter("@correoElectronicoRecinto", recinto.CorreoEectronicoRecinto));
            sqlCommand.Parameters.Add(new SqlParameter("@telefonoRecinto", recinto.TelefonoRecinto));
            sqlCommand.Parameters.Add(new SqlParameter("@direccionRecinto", recinto.DireccionRecinto));
            try
            {
                connection.Open();
                sqlCommand.ExecuteNonQuery();
            }
            catch (SqlException ex)
            {
                throw ex;
            }
            if (connection != null)
            {
                connection.Close();
            }
        }
 protected void btnModificar_Click(object sender, EventArgs e)
 {
     try
     {
         Recinto partida = new Recinto();
         partida.Id          = Convert.ToInt32(ViewState["id"]);
         partida.Descripcion = txtDescripcion.Text;
         partida.Estado      = chkEstado.Checked ? 1 : 0;
         if (DatosRecinto.ModificarRecinto(partida))
         {
             lblMensaje.Text     = "Recinto Modificada";
             lblMensaje.CssClass = "correcto";
         }
         else
         {
             lblMensaje.Text     = "Error al Modificar";
             lblMensaje.CssClass = "error";
         }
         llenarGrid();
     }
     catch (Exception ex)
     {
         lblMensaje.Text = ex.Message;
     }
 }
 protected void btnIngresar_Click(object sender, EventArgs e)
 {
     try
     {
         Recinto obj = new Recinto();
         if (txtDescripcion.Equals(""))
         {
             txtDescripcion.Focus();
         }
         obj.Descripcion = txtDescripcion.Text;
         if (DatosRecinto.AgregarRecinto(obj))
         {
             lblMensaje.Text     = "Recinto agregada";
             lblMensaje.CssClass = "correcto";
         }
         else
         {
             lblMensaje.Text     = "Error al Agregar";
             lblMensaje.CssClass = "error";
         }
         llenarGrid();
     }
     catch (Exception ex)
     {
         lblMensaje.Text = ex.Message;
     }
 }
Beispiel #4
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         Recinto         recinto         = null;
         RecintoBusiness recintoBusiness = new RecintoBusiness(WebConfigurationManager.ConnectionStrings["PRA_DFGKP"].ConnectionString);
         recinto          = recintoBusiness.obtenerRecinto();
         tbNombre.Text    = recinto.NombreRecinto;
         tbDireccion.Text = recinto.DireccionRecinto;
         tbTelefono.Text  = recinto.TelefonoRecinto;
         tbCorreo.Text    = recinto.CorreoEectronicoRecinto;
     }
 }
Beispiel #5
0
        protected void btnActualizar_Click(object sender, EventArgs e)
        {
            Recinto recinto = new Recinto();

            recinto.IdRecinto               = 1;
            recinto.NombreRecinto           = tbNombre.Text;
            recinto.DireccionRecinto        = tbDireccion.Text;
            recinto.CorreoEectronicoRecinto = tbCorreo.Text;
            recinto.TelefonoRecinto         = tbTelefono.Text;

            RecintoBusiness recintoBusiness = new RecintoBusiness(WebConfigurationManager.ConnectionStrings["PRA_DFGKP"].ConnectionString);

            recintoBusiness.actualizarRecinto(recinto);
        }
Beispiel #6
0
    public static bool ModificarRecinto(Recinto 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_RECINTO"
                }
                       )
                {
                    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 Recinto");
                    }
                    agregado = true;
                }
            }
            return(agregado);
        }
        catch (Exception ex)
        {
            throw new Exception(ex.Message);
        }
    }
Beispiel #7
0
    public static Recinto BuscarRecinto(int codigo)
    {
        try
        {
            Recinto obj = new Recinto();

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

            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);
        }
    }
Beispiel #8
0
        public Recinto obtenerRecintoPorCodigo(int codigo)
        {
            String         queryString        = "SELECT TOP(1) * FROM Recinto WHERE idRecinto=" + codigo;
            SqlConnection  connection         = new SqlConnection(this.connectionString);
            DataSet        dataSetRecinto     = new DataSet();
            SqlDataAdapter dataAdapterRecinto = new SqlDataAdapter();

            dataAdapterRecinto.SelectCommand = new SqlCommand(queryString, connection);
            dataAdapterRecinto.Fill(dataSetRecinto, "Recinto");

            DataRowCollection rows = dataSetRecinto.Tables["Recinto"].Rows;

            Recinto recinto = new Recinto();

            foreach (DataRow row in rows)
            {
                recinto.IdRecinto               = Int32.Parse(row["idRecinto"].ToString());
                recinto.NombreRecinto           = row["nombreRecinto"].ToString();
                recinto.TelefonoRecinto         = row["telefonoRecinto"].ToString();
                recinto.CorreoEectronicoRecinto = row["correoElectronicoRecinto"].ToString();
                recinto.DireccionRecinto        = row["direccionRecinto"].ToString();
            }
            return(recinto);
        }
Beispiel #9
0
        public LinkedList <Recinto> getAllRecintos()
        {
            String sqlSelect = "SELECT id_recinto,nombre_recinto" +
                               " FROM Recinto r";

            SqlConnection  connection = new SqlConnection(this.connectionString);
            DataSet        dsRecinto  = new DataSet();
            SqlDataAdapter daRecinto  = new SqlDataAdapter();

            daRecinto.SelectCommand = new SqlCommand(sqlSelect, connection);
            daRecinto.Fill(dsRecinto, "Recinto");

            DataRowCollection rows = dsRecinto.Tables["Recinto"].Rows;

            LinkedList <Recinto> recintos = new LinkedList <Recinto>();

            foreach (DataRow row in rows)
            {
                Recinto r = new Recinto(Int32.Parse(row["id_recinto"].ToString()), row["nombre_recinto"].ToString());
                recintos.AddLast(r);
            }

            return(recintos);
        }
Beispiel #10
0
        protected void btnEncargadoDe_Click(object sender, EventArgs e)
        {
            EncargadoEvaluacion encargado = Session["Encargado"] as EncargadoEvaluacion;
            AreaTematica        area      = new AreaTematica();

            area.IdAreaTematica             = Int32.Parse(ddlAreas.SelectedValue.ToString());
            encargado.EncargadoAreaTematica = area;

            Evaluacion eval = new Evaluacion();

            eval.IdEvaluacion = Int32.Parse(gvEncargadoDe.SelectedRow.Cells[1].Text);

            Recinto recinto = new Recinto();

            recinto.IdRecinto = Int32.Parse(gvEncargadoDe.SelectedRow.Cells[4].Text);
            eval.Recinto      = recinto;

            GuiaReconocimiento guia = new GuiaReconocimiento();

            guia.IdGuiaReconocimiento = Int32.Parse(gvEncargadoDe.SelectedRow.Cells[6].Text);
            eval.GuiaReconocimiento   = guia;

            encargado.Evaluaciones.AddLast(eval);
        }
 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);
             Recinto     partida = DatosRecinto.BuscarRecinto(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;
     }
 }
 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;
 }
Beispiel #13
0
 public void actualizarRecinto(Recinto recinto)
 {
     recintoData.actualizarRecinto(recinto);
 }