コード例 #1
0
    //EVENTOS CLICK
    protected void lnkModificarExpediente_Click(object sender, EventArgs e)
    {
        Juzgado oJuzgado = new Juzgado();

        oJuzgado.Nombre = ((Label)GridViewExpedientes.SelectedRow.FindControl("Juzgado")).Text;

        Secretaria oSecretaria = new Secretaria();

        oSecretaria.Nombre = ((Label)GridViewExpedientes.SelectedRow.FindControl("Secretaria")).Text;

        Expediente oExpediente = new Expediente();

        oExpediente.Id          = int.Parse(GridViewExpedientes.SelectedRow.Cells[2].Text);
        oExpediente.Caratula    = GridViewExpedientes.SelectedRow.Cells[3].Text;
        oExpediente.Descripcion = GridViewExpedientes.SelectedRow.Cells[4].Text;
        oExpediente.Actores     = GridViewExpedientes.SelectedRow.Cells[5].Text;
        oExpediente.Consulta    = Controller.traerConsultaAsociada(oExpediente.Id);
        oExpediente.Juzgado     = oJuzgado;
        oExpediente.Secretaria  = oSecretaria;
        oExpediente.FechaInicio = Convert.ToDateTime(GridViewExpedientes.SelectedRow.Cells[8].Text);

        Session["Expediente"] = oExpediente;

        Response.Redirect("~/Abogado/NuevoExpediente.aspx");
    }
コード例 #2
0
    //EVENTOS CLICK
    protected void btnCargarJuzgado_Click(object sender, EventArgs e)
    {
        try
        {
            Juzgado oJuzgado = new Juzgado();

            oJuzgado.Nombre    = txtNombreJuzgado.Text;
            oJuzgado.Juez      = txtJuez.Text;
            oJuzgado.Direccion = txtDireccion.Text;
            oJuzgado.Telefono  = Convert.ToInt32(txtTelefono.Text);

            Controller.guardarJuzgado(oJuzgado, "Insert");

            lblError.Visible   = true;
            lblError.ForeColor = Color.Green;
            lblError.Text      = "Los Datos Del Juzgado Se Cargaron Exitosamente";

            GridViewJuzgados.DataBind();
        }
        catch (Exception)
        {
            lblError.Visible   = true;
            lblError.ForeColor = Color.Red;
            lblError.Text      = "Ocurrio Un Error Al Cargar Los Datos Del Juzgado";
        }
    }
コード例 #3
0
        // POST: odata/Juzgadoes
        public async Task <IHttpActionResult> Post(Juzgado juzgado)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.Juzgado.Add(juzgado);
            await db.SaveChangesAsync();

            return(Created(juzgado));
        }
コード例 #4
0
    //EVENTOS CLICK
    protected void btnCargar_Click(object sender, EventArgs e)
    {
        if (lblExpedienteId.Text != string.Empty)
        {
            pOperacion = "Update";
        }
        else
        {
            pOperacion           = "Insert";
            lblExpedienteId.Text = "0";
        }

        try
        {
            Consulta oConsulta = Controller.consultaPorId(Convert.ToInt32(lblConsultaId.Text));
            oConsulta.Estado = 2;
            //oConsulta.Id = Convert.ToInt32(lblConsultaId.Text);

            Juzgado oJuzgado = new Juzgado();
            oJuzgado.Id = Convert.ToInt32(ddlJuzgados.SelectedValue);

            Secretaria oSecretaria = new Secretaria();
            oSecretaria.Id = Convert.ToInt32(ddlSecretarias.SelectedValue);

            Expediente oExpediente = new Expediente();
            oExpediente.Id          = Convert.ToInt32(lblExpedienteId.Text);
            oExpediente.Caratula    = txtCaratula.Text;
            oExpediente.Descripcion = txtDescripcionExpediente.Text;
            oExpediente.Actores     = txtActores.Text;
            oExpediente.Consulta    = oConsulta;
            oExpediente.Juzgado     = oJuzgado;
            oExpediente.Secretaria  = oSecretaria;
            oExpediente.FechaInicio = Convert.ToDateTime(txtFechaInicio.Text);

            Controller.guardarExpediente(oExpediente, pOperacion);

            Controller.guardarConsulta(oConsulta, "Update");

            Clean();

            lblError.Visible   = true;
            lblError.ForeColor = Color.Green;
            lblError.Text      = "Los Datos Del Expediente Se Han Cargado Exitosamente";
        }
        catch (Exception)
        {
            lblError.Visible   = true;
            lblError.ForeColor = Color.Red;
            lblError.Text      = "Ocurrio Un Error Al Cargar El Expediente";
        }
    }
コード例 #5
0
 //EVENTOS CLICK
 protected void btnCargarJuzgado_Click(object sender, EventArgs e)
 {
     try
     {
         Juzgado oJuzgado = new Juzgado();
     }
     catch (Exception)
     {
         Panel1.Visible     = true;
         lblError.Visible   = true;
         lblError.ForeColor = Color.Red;
         lblError.Text      = "Ocurrio Un Error Al Cargar Los Datos Del Juzgado";
     }
 }
コード例 #6
0
        // DELETE: odata/Juzgadoes(5)
        public async Task <IHttpActionResult> Delete([FromODataUri] int key)
        {
            Juzgado juzgado = await db.Juzgado.FindAsync(key);

            if (juzgado == null)
            {
                return(NotFound());
            }

            db.Juzgado.Remove(juzgado);
            await db.SaveChangesAsync();

            return(StatusCode(HttpStatusCode.NoContent));
        }
コード例 #7
0
        public void UpdateJuzgado(Juzgado pJuzgado)
        {
            using (SqlConnection cnn = new SqlConnection(GetConnectionString()))
            {
                SqlCommand cmd = new SqlCommand();
                cmd.Connection  = cnn;
                cmd.CommandText = "UPDATE Juzgados SET Nombre=@Nombre, Juez=@Juez, Direccion=@Direccion, Telefono=@Telefono";

                cmd.Parameters.Add(new SqlParameter("@Nombre", pJuzgado.Nombre));
                cmd.Parameters.Add(new SqlParameter("@Juez", pJuzgado.Juez));
                cmd.Parameters.Add(new SqlParameter("@Direccion", pJuzgado.Direccion));
                cmd.Parameters.Add(new SqlParameter("@Telefono", pJuzgado.Telefono));

                cnn.Open();
                cmd.ExecuteNonQuery();
            }
        }
コード例 #8
0
        //METODOS JUZGADOS
        public void InsertJuzgado(Juzgado pJuzgado)
        {
            using (SqlConnection cnn = new SqlConnection(GetConnectionString()))
            {
                SqlCommand cmd = new SqlCommand();
                cmd.Connection  = cnn;
                cmd.CommandText = "INSERT INTO Juzgados VALUES (@Nombre, @Juez, @Direccion, @Telefono)";

                cmd.Parameters.Add(new SqlParameter("@Nombre", pJuzgado.Nombre));
                cmd.Parameters.Add(new SqlParameter("@Juez", pJuzgado.Juez));
                cmd.Parameters.Add(new SqlParameter("@Direccion", pJuzgado.Direccion));
                cmd.Parameters.Add(new SqlParameter("@Telefono", pJuzgado.Telefono));

                cnn.Open();
                cmd.ExecuteNonQuery();
            }
        }
コード例 #9
0
        //JUZGADOS
        public static void guardarJuzgado(Juzgado pJuzgado, string pOperacion)
        {
            DataAccessLayerAuxiliar oDAL = new SQLAuxiliar();

            if (pOperacion == "Insert")
            {
                oDAL.InsertJuzgado(pJuzgado);
            }
            else if (pOperacion == "Update")
            {
                oDAL.UpdateJuzgado(pJuzgado);
            }
            else
            {
                throw new Exception();
            }
        }
コード例 #10
0
        public List <Juzgado> GetAllJuzgados()
        {
            List <Juzgado> listJuzgados = null;

            using (SqlConnection cnn = new SqlConnection(GetConnectionString()))
            {
                SqlCommand cmd = new SqlCommand();
                cmd.Connection  = cnn;
                cmd.CommandText = "SELECT Id, Nombre, Juez, Direccion, Telefono FROM Juzgados";
                cnn.Open();
                SqlDataReader dr = cmd.ExecuteReader();

                if (dr != null && dr.HasRows)
                {
                    int idIndex        = dr.GetOrdinal("Id");
                    int nombreIndex    = dr.GetOrdinal("Nombre");
                    int juezIndex      = dr.GetOrdinal("Juez");
                    int direccionIndex = dr.GetOrdinal("Direccion");
                    int telefonoIndex  = dr.GetOrdinal("Telefono");

                    listJuzgados = new List <Juzgado>();

                    while (dr.Read())
                    {
                        Juzgado oJuzgado = new Juzgado();

                        object[] values = new object[dr.FieldCount];
                        dr.GetValues(values);

                        oJuzgado.Id        = (int)values[idIndex];
                        oJuzgado.Nombre    = (string)dr[nombreIndex];
                        oJuzgado.Juez      = (string)dr[juezIndex];
                        oJuzgado.Direccion = (string)dr[direccionIndex];
                        oJuzgado.Telefono  = (int)dr[telefonoIndex];

                        listJuzgados.Add(oJuzgado);
                    }
                }
            }
            return(listJuzgados);
        }
コード例 #11
0
        // PUT: odata/Juzgadoes(5)
        public async Task <IHttpActionResult> Put([FromODataUri] int key, Delta <Juzgado> patch)
        {
            Validate(patch.GetEntity());

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            Juzgado juzgado = await db.Juzgado.FindAsync(key);

            if (juzgado == null)
            {
                return(NotFound());
            }

            patch.Put(juzgado);

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!JuzgadoExists(key))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(Updated(juzgado));
        }
コード例 #12
0
        public List <Expediente> SearchExpedientesCerrados(string pAbogado, string pJuzgado)
        {
            List <Expediente> listExpedientes = null;
            string            query           = "SELECT E.Id, E.Caratula, E.Descripcion, E.Actores, E.Consulta, C.Abogado as AbogadoId, A.Nombre as AbogadoNombre, A.Apellido as AbogadoApellido, " +
                                                "E.Juzgado, J.Nombre as JuzgadoNombre, E.Secretaria, S.Nombre as SecretariaNombre, E.FechaInicio " +
                                                "FROM Expedientes E, Consultas C, Abogados A, Juzgados J, Secretarias S, ExpedientesCerrados EC " +
                                                "WHERE E.Consulta = C.Id and C.Abogado = A.Id and E.Juzgado = J.Id and E.Secretaria = S.Id and E.Id = EC.Expediente";

            using (SqlConnection cnn = new SqlConnection(GetConnectionString()))
            {
                SqlCommand cmd = new SqlCommand();
                cmd.Connection = cnn;

                if (!string.IsNullOrEmpty(pAbogado))
                {
                    query += " and (A.Nombre LIKE '%' + @Abogado + '%' OR A.Apellido LIKE '%' + @Abogado + '%')";
                    cmd.Parameters.Add(new SqlParameter("@Abogado", pAbogado));
                }
                else if (!string.IsNullOrEmpty(pJuzgado))
                {
                    query += " and J.Nombre LIKE '%' + @Juzgado + '%'";
                    cmd.Parameters.Add(new SqlParameter("@Juzgado", pJuzgado));
                }

                cmd.CommandText = query;
                cnn.Open();
                SqlDataReader dr = cmd.ExecuteReader();

                if (dr != null && dr.HasRows)
                {
                    int idIndex               = dr.GetOrdinal("Id");
                    int caratulaIndex         = dr.GetOrdinal("Caratula");
                    int descripcionIndex      = dr.GetOrdinal("Descripcion");
                    int actoresIndex          = dr.GetOrdinal("Actores");
                    int consultaIndex         = dr.GetOrdinal("Consulta");
                    int abogadoIdIndex        = dr.GetOrdinal("AbogadoId");
                    int abogadoNombreIndex    = dr.GetOrdinal("AbogadoNombre");
                    int abogadoApellidoIndex  = dr.GetOrdinal("AbogadoApellido");
                    int juzgadoIndex          = dr.GetOrdinal("Juzgado");
                    int juzgadoNombreIndex    = dr.GetOrdinal("JuzgadoNombre");
                    int secretariaIndex       = dr.GetOrdinal("Secretaria");
                    int secretariaNombreIndex = dr.GetOrdinal("SecretariaNombre");
                    int fechaInicioIndex      = dr.GetOrdinal("FechaInicio");

                    listExpedientes = new List <Expediente>();

                    while (dr.Read())
                    {
                        Abogado oAbogado = new Abogado();
                        oAbogado.Id       = (int)dr[abogadoIdIndex];
                        oAbogado.Nombre   = (string)dr[abogadoNombreIndex];
                        oAbogado.Apellido = (string)dr[abogadoApellidoIndex];

                        Consulta oConsulta = new Consulta();
                        oConsulta.Id      = (int)dr[consultaIndex];
                        oConsulta.Abogado = oAbogado;

                        Juzgado oJuzgado = new Juzgado();
                        oJuzgado.Id     = (int)dr[juzgadoIndex];
                        oJuzgado.Nombre = (string)dr[juzgadoNombreIndex];

                        Secretaria oSecretaria = new Secretaria();
                        oSecretaria.Id     = (int)dr[secretariaIndex];
                        oSecretaria.Nombre = (string)dr[secretariaNombreIndex];


                        Expediente oExpediente = new Expediente();

                        object[] values = new object[dr.FieldCount];
                        dr.GetValues(values);

                        oExpediente.Id          = (int)values[idIndex];
                        oExpediente.Caratula    = (string)dr[caratulaIndex];
                        oExpediente.Descripcion = (string)dr[descripcionIndex];
                        oExpediente.Actores     = (string)dr[actoresIndex];
                        oExpediente.Consulta    = oConsulta;
                        oExpediente.Juzgado     = oJuzgado;
                        oExpediente.Secretaria  = oSecretaria;
                        oExpediente.FechaInicio = (DateTime)dr[fechaInicioIndex];

                        listExpedientes.Add(oExpediente);
                    }
                }
            }
            return(listExpedientes);
        }