Exemple #1
0
    //EVENTO PAGE LOAD
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["Expediente"] != null)
        {
            oExpedienteSession = (Expediente)Session["Expediente"];

            lblExpedienteId.Text = oExpedienteSession.Id.ToString();
            txtNumeroExpediente.Text = oExpedienteSession.Id.ToString();
            txtFechaInicio.Text = oExpedienteSession.FechaInicio.ToString();
            txtCaratula.Text = oExpedienteSession.Caratula;
        }
    }
Exemple #2
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";
        }
    }
Exemple #3
0
        public void Close(Expediente pExpediente)
        {
            using (SqlConnection cnn = new SqlConnection(GetConnectionString()))
            {
                SqlCommand cmd = new SqlCommand();
                cmd.Connection = cnn;
                cmd.CommandText = "INSERT INTO ExpedientesCerrados " +
                                  "VALUES (@Expediente, @FechaCierre)";

                cmd.Parameters.Add(new SqlParameter("@Expediente", pExpediente.Id));
                cmd.Parameters.Add(new SqlParameter("@FechaCierre", DateTime.Now));

                cnn.Open();
                cmd.ExecuteNonQuery();
            }
        }
Exemple #4
0
        public void Update(Expediente pExpediente)
        {
            using (SqlConnection cnn = new SqlConnection(GetConnectionString()))
            {
                SqlCommand cmd = new SqlCommand();
                cmd.Connection = cnn;
                cmd.CommandText = "UPDATE Expedientes " +
                                  "SET Caratula=@Caratula, Descripcion=@Descripcion, Actores=@Actores, Consulta=@Consulta, Juzgado=@Juzgado, " +
                                      "Secretaria=@Secretaria, FechaInicio=@FechaInicio " +
                                  "WHERE Id=@Id";

                cmd.Parameters.Add(new SqlParameter("@Id", pExpediente.Id));
                cmd.Parameters.Add(new SqlParameter("@Caratula", pExpediente.Caratula));
                cmd.Parameters.Add(new SqlParameter("@Descripcion", pExpediente.Descripcion));
                cmd.Parameters.Add(new SqlParameter("@Actores", pExpediente.Actores));
                cmd.Parameters.Add(new SqlParameter("@Consulta", pExpediente.Consulta.Id));
                cmd.Parameters.Add(new SqlParameter("@Juzgado", pExpediente.Juzgado.Id));
                cmd.Parameters.Add(new SqlParameter("@Secretaria", pExpediente.Secretaria.Id));
                cmd.Parameters.Add(new SqlParameter("@FechaInicio", pExpediente.FechaInicio));

                cnn.Open();
                cmd.ExecuteNonQuery();
            }
        }
Exemple #5
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;
        }
Exemple #6
0
        public Expediente LoadById(int pId)
        {
            Expediente oExpediente = null;
            using (SqlConnection cnn = new SqlConnection(GetConnectionString()))
            {
                SqlCommand cmd = new SqlCommand();
                cmd.Connection = cnn;
                cmd.CommandText = "SELECT Id, Caratula, Descripcion, Consulta, Juzgado, Secretaria, FechaInicio " +
                                  "FROM Expedientes" +
                                  "WHERE Id = @Id";

                cmd.Parameters.Add(new SqlParameter("@Id", pId));

                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 consultaIndex = dr.GetOrdinal("Consulta");
                    int juzgadoIndex = dr.GetOrdinal("Juzgado");
                    int secretariaIndex = dr.GetOrdinal("Secretaria");
                    int fechaInicioIndex = dr.GetOrdinal("FechaInicio");

                    if (dr.Read())
                    {
                        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.Juzgado.Id = (int)dr[juzgadoIndex];
                        oExpediente.Secretaria.Id = (int)dr[secretariaIndex];
                        oExpediente.FechaInicio = (DateTime)dr[fechaInicioIndex];
                    }
                }
            }
            return oExpediente;
        }
Exemple #7
0
        public void Insert(Expediente pExpediente)
        {
            using (SqlConnection cnn = new SqlConnection(GetConnectionString()))
            {
                SqlCommand cmd = new SqlCommand();
                cmd.Connection = cnn;
                cmd.CommandText = "INSERT INTO Expedientes " +
                                  "VALUES (@Caratula, @Descripcion, @Actores, @Consulta, @Juzgado, @Secretaria, @FechaInicio)";

                cmd.Parameters.Add(new SqlParameter("@Caratula", pExpediente.Caratula));
                cmd.Parameters.Add(new SqlParameter("@Descripcion", pExpediente.Descripcion));
                cmd.Parameters.Add(new SqlParameter("@Actores", pExpediente.Actores));
                cmd.Parameters.Add(new SqlParameter("@Consulta", pExpediente.Consulta.Id));
                cmd.Parameters.Add(new SqlParameter("@Juzgado", pExpediente.Juzgado.Id));
                cmd.Parameters.Add(new SqlParameter("@Secretaria", pExpediente.Secretaria.Id));
                cmd.Parameters.Add(new SqlParameter("@FechaInicio", pExpediente.FechaInicio));

                cnn.Open();
                cmd.ExecuteNonQuery();
            }
        }
Exemple #8
0
 public void Delete(Expediente pExpediente)
 {
     Delete(pExpediente.Id);
 }
Exemple #9
0
 public ExpedienteCerrado(int pId, Expediente pExpediente, DateTime pFechaCierre)
 {
     id          = pId;
     expediente  = pExpediente;
     fechaCierre = pFechaCierre;
 }
Exemple #10
0
 //CONSTRUCTORES
 public ExpedienteCerrado()
 {
     id          = 0;
     expediente  = null;
     fechaCierre = DateTime.Now;
 }
Exemple #11
0
    //EVENTO PAGE LOAD
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            if (Session["Consulta"] != null || Session["Expediente"] != null)
            {
                if (Session["Expediente"] != null)
                {
                    oExpedienteSession = (Expediente)Session["Expediente"];

                    lblConsultaId.Text = oExpedienteSession.Consulta.Id.ToString();
                    txtNombreCliente.Text = oExpedienteSession.Consulta.Cliente.Nombre;
                    txtAbogadoConsulta.Text = oExpedienteSession.Consulta.Abogado.Nombre;
                    txtFechaConsulta.Text = oExpedienteSession.Consulta.Fecha.ToString();
                    txtTemaConsulta.Text = oExpedienteSession.Consulta.TemaConsulta.Descripcion;
                    txtDescripcionConsulta.Text = oExpedienteSession.Consulta.Descripcion;

                    lblExpedienteId.Text = oExpedienteSession.Id.ToString();
                    txtCaratula.Text = oExpedienteSession.Caratula;
                    txtActores.Text = oExpedienteSession.Actores;
                    txtDescripcionExpediente.Text = oExpedienteSession.Descripcion;
                    txtFechaInicio.Text = oExpedienteSession.FechaInicio.ToShortDateString();
                }
                else
                {
                    oConsultaSession = (Consulta)Session["Consulta"];

                    lblConsultaId.Text = oConsultaSession.Id.ToString();
                    txtNombreCliente.Text = oConsultaSession.Cliente.Nombre;
                    txtAbogadoConsulta.Text = oConsultaSession.Abogado.Nombre;
                    txtFechaConsulta.Text = oConsultaSession.Fecha.ToString();
                    txtTemaConsulta.Text = oConsultaSession.TemaConsulta.Descripcion;
                    txtDescripcionConsulta.Text = oConsultaSession.Descripcion;

                    txtFechaInicio.Text = DateTime.Now.ToShortDateString();
                }
            }

            Session.Abandon();
        }
    }
Exemple #12
0
 public static void cerrarExpediente(Expediente pExpediente)
 {
     DataAccessLayerExpediente oDAL = new SQLExpediente();
     oDAL.Close(pExpediente);
 }
Exemple #13
0
 //EXPEDIENTES
 public static void guardarExpediente(Expediente pExpediente, string pOperacion)
 {
     DataAccessLayerExpediente oDAL = new SQLExpediente();
     if (pOperacion == "Insert")
     {
         oDAL.Insert(pExpediente);
     }
     else if (pOperacion == "Update")
     {
         oDAL.Update(pExpediente);
     }
     else
     {
         throw new Exception();
     }
 }
Exemple #14
0
    protected void lnkVerEscritos_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.Juzgado = oJuzgado;
        oExpediente.Secretaria = oSecretaria;
        oExpediente.FechaInicio = Convert.ToDateTime(GridViewExpedientes.SelectedRow.Cells[8].Text);

        Session["Expediente"] = oExpediente;

        Response.Redirect("~/Abogado/VerEscritos.aspx");
    }
Exemple #15
0
 public ExpedienteCerrado(int pId, Expediente pExpediente, DateTime pFechaCierre)
 {
     id = pId;
     expediente = pExpediente;
     fechaCierre = pFechaCierre;
 }
Exemple #16
0
 //CONSTRUCTORES
 public ExpedienteCerrado()
 {
     id = 0;
     expediente = null;
     fechaCierre = DateTime.Now;
 }