public static entConceptoCobro BuscarConcepto(int id) { entConceptoCobro obj = null; SqlCommand cmd = null; SqlDataReader dr = null; try { Conexion cn = new Conexion(); SqlConnection cnx = cn.Conectar(); cmd = new SqlCommand("CCobroRead", cnx); cmd.Parameters.AddWithValue("@inID_CC", id); cmd.CommandType = CommandType.StoredProcedure; cnx.Open(); dr = cmd.ExecuteReader(); obj = new entConceptoCobro(); dr.Read(); obj.ID_CC = Convert.ToInt32(dr["ID_CC"].ToString()); obj.DiaCobro = Convert.ToInt32(dr["DiaCobro"].ToString()); obj.DiaVencimiento = Convert.ToInt32(dr["DiaVencimiento"].ToString()); obj.Concepto = dr["Concepto"].ToString(); obj.TipoCC = dr["TipoCC"].ToString(); } catch { obj = null; } finally { cmd.Connection.Close(); } return(obj); }
protected void Page_Load(object sender, EventArgs e) { int ID_Propiedad = Convert.ToInt32(Request.QueryString["ID_Propiedad"]); if (Request.QueryString["ID_Propiedad"] != null) { GridView1.DataSource = negRecibos.ListarRecibos(ID_Propiedad); GridView1.DataBind(); for (int i = 0; i < GridView1.Rows.Count; i++) { int id = Convert.ToInt32(GridView1.Rows[i].Cells[2].Text); entConceptoCobro tipo = negConceptoCobro.BuscarConcepto(id); if (tipo != null) { GridView1.Rows[0].Cells[3].Text = tipo.Concepto; } else { lblerror.Text = "No se encontro un concepto de cobro asociado."; lblerror.Visible = true; } } } else { lblerror.Text = "No se encuentra el ID de la propiedad"; lblerror.Visible = true; } }
protected void Page_Load(object sender, EventArgs e) { int ID_Comprobante = Convert.ToInt32(Request.QueryString["ID_Comprobante"]); if (Request.QueryString["ID_Comprobante"] != null) { entComprobante obj = negComprobante.ReadComprobante(ID_Comprobante); if (obj != null) { numero.Text = Convert.ToString(obj.ID_Comprobante); propiedad.Text = Convert.ToString(obj.NumFinca); Fecha.Text = Convert.ToString(obj.Fecha); medio.Text = Convert.ToString(obj.MedioPago);//eSTE DEBO CAMBIARLO monto.Text = Convert.ToString(obj.Monto); //tira los recibos que son asociados con el comprobante GridView1.DataSource = negRecibos.ListarReciboxCom(obj.ID_Comprobante); GridView1.DataBind(); for (int i = 0; i < GridView1.Rows.Count; i++) { int id = Convert.ToInt32(GridView1.Rows[i].Cells[2].Text); entConceptoCobro tipo = negConceptoCobro.BuscarConcepto(id); if (tipo != null) { GridView1.Rows[0].Cells[3].Text = tipo.Concepto; GridView1.Rows[0].Cells[4].Text = Convert.ToString(tipo.DiaVencimiento); } else { lblError.Text = "No se encontro un concepto de cobro asociado."; lblError.Visible = true; } } } else { lblError.Text = "No se encontro el comprobante"; lblError.Visible = true; } } else { lblError.Text = "Error al buscar el ID del comprobante"; lblError.Visible = true; } }
protected void Page_Load(object sender, EventArgs e) { entUsuario obj0 = (entUsuario)Session["nombre"]; int ID_Propiedad = Convert.ToInt32(Request.QueryString["ID_Propiedad"]); if (obj0 != null) { if (Request.QueryString["ID_Propiedad"] != null) { entProUsuario obj2 = negProUsuario.BuscarProUsuario(ID_Propiedad, obj0.ID_Usuario); if (obj2 != null) { GridView1.DataSource = negRecibos.ListarRecibos(ID_Propiedad); GridView1.DataBind(); for (int i = 0; i < GridView1.Rows.Count; i++) { int id = Convert.ToInt32(GridView1.Rows[i].Cells[2].Text); entConceptoCobro tipo = negConceptoCobro.BuscarConcepto(id); if (tipo != null) { GridView1.Rows[0].Cells[3].Text = tipo.Concepto; } else { lblerror.Text = "No se encontro un concepto de cobro asociado."; lblerror.Visible = true; } } } else { lblerror.Text = "Dicha Propiedad no corresponde a este usuario"; lblerror.Visible = true; } } else { lblerror.Text = "Error al buscar el ID de la propiedad"; lblerror.Visible = true; } } else { lblerror.Text = "Esta vacio el objeto"; lblerror.Visible = true; } }
protected void btnGuardar_Click(object sender, EventArgs e) { if (TextBox1.Text != "" && NumPropiedad.Text != "") { entPropiedad obj = negPropiedad.BuscarPropiedad(Convert.ToInt32(NumPropiedad.Text)); entConceptoCobro obj1 = negConceptoCobro.BuscarConcepto(Convert.ToInt32(TextBox1.Text)); if (obj != null && obj1 != null) { int concepto = obj1.ID_CC; int prop = obj.ID_Propiedad; entProCC obj2 = new entProCC(); obj2.ID_Propiedad = prop; obj2.ID_CC = concepto; if (negProCC.AgregarProCC(obj2) == 1) { Response.Redirect("frmPrincipal.aspx"); } else { lblError.Text = "No se unieron correctamente,error del sistema"; lblError.Visible = true; } } else { lblError.Text = "Datos incorrectos"; lblError.Visible = true; } } else { lblError.Text = "Faltan datos por ingresar"; lblError.Visible = true; } }
protected void btnBuscar_Click(object sender, EventArgs e) { if (txtPropiedad.Text != "" && txtId.Text != "") { entPropiedad obj = negPropiedad.BuscarPropiedad(Convert.ToInt32(txtPropiedad.Text)); entConceptoCobro obj1 = negConceptoCobro.BuscarConcepto(Convert.ToInt32(txtId.Text)); if (obj != null && obj1 != null) { entProCC obj2 = negProCC.BuscarProCC(obj.ID_Propiedad, obj1.ID_CC); if (obj2 != null) { Numero.Text = Convert.ToString(obj.NumPropiedad); Direccion.Text = obj.Direccion; Tipo.Text = Convert.ToString(obj1.TipoCC); Concepto.Text = obj1.Concepto; FechaVencimiento.Text = Convert.ToString(obj1.DiaVencimiento); Fecha.Text = Convert.ToString(obj1.DiaCobro); } else { lblerror.Text = "No se logró encontrar esta union "; //Sino tira error lblerror.Visible = true; } } else { lblerror.Text = "No se encontraron los datos ingresados "; //Sino tira error lblerror.Visible = true; } } else { lblerror.Text = "Debe ingresar todos los datos solicitados "; //Sino tira error lblerror.Visible = true; } }
protected void btnEliminar_Click(object sender, EventArgs e) { entConceptoCobro obj = negConceptoCobro.BuscarConcepto(Convert.ToInt32(txtId.Text)); entPropiedad obj1 = negPropiedad.BuscarPropiedad(Convert.ToInt32(txtPropiedad.Text)); if (obj != null && obj1 != null) { int delete = negProCC.DeleteProxCC(obj.ID_CC, obj1.ID_Propiedad); if (delete == 1) { Response.Redirect("frmPrincipal.aspx"); } else { lblerror.Text = "No se logró borrar correctamente el concepto cobro"; //Sino tira error lblerror.Visible = true; } } else { lblerror.Text = "No se encuentran los datos ingresados"; //Sino tira error lblerror.Visible = true; } }
protected void btnModificar_Click(object sender, EventArgs e) { if (txtID.Text != "" && txtPropiedad.Text != "") { entPropiedad obj = negPropiedad.BuscarPropiedad(Convert.ToInt32(txtPropiedad.Text)); entConceptoCobro obj1 = negConceptoCobro.BuscarConcepto(Convert.ToInt32(txtID.Text)); if (obj != null && obj1 != null) { entProCC obj2 = negProCC.BuscarProCC(obj.ID_Propiedad, obj1.ID_CC); if (obj2 != null) { entProCC obj3 = new entProCC(); obj3.ID_PxC = obj2.ID_PxC; if (txtConcepto.Text != "") { entConceptoCobro obj4 = negConceptoCobro.BuscarConcepto(Convert.ToInt32(txtConcepto.Text)); if (obj4 != null) { obj3.ID_CC = obj4.ID_CC; if (txtNumeroProp.Text != "") { entPropiedad obj5 = negPropiedad.BuscarPropiedad(Convert.ToInt32(txtPropiedad.Text)); if (obj5 != null) { obj3.ID_Propiedad = obj5.ID_Propiedad; if (negProCC.ModificarProCC(obj3) == 1) { Response.Redirect("frmPrincipal.aspx"); } else { lblerror.Text = "No se pudo modificar la union"; lblerror.Visible = true; } } else { lblerror.Text = "No se encontro la propiedad"; lblerror.Visible = true; } } else { obj3.ID_Propiedad = obj.ID_Propiedad; if (negProCC.ModificarProCC(obj3) == 1) { Response.Redirect("frmPrincipal.aspx"); } else { lblerror.Text = "No se pudo modificar la union"; lblerror.Visible = true; } } } else { lblerror.Text = "No se encontro el propietario"; lblerror.Visible = true; } } else { obj3.ID_CC = obj1.ID_CC; if (txtNumeroProp.Text != "") { entPropiedad obj5 = negPropiedad.BuscarPropiedad(Convert.ToInt32(txtPropiedad.Text)); if (obj5 != null) { obj3.ID_Propiedad = obj5.ID_Propiedad; if (negProCC.ModificarProCC(obj3) == 1) { Response.Redirect("frmPrincipal.aspx"); } else { lblerror.Text = "No se pudo modificar la union"; lblerror.Visible = true; } } else { lblerror.Text = "No se pudo enocontrar la propiedad"; lblerror.Visible = true; } } else { obj3.ID_Propiedad = obj.ID_Propiedad; if (negProCC.ModificarProCC(obj3) == 1) { Response.Redirect("frmPrincipal.aspx"); } else { lblerror.Text = "No se pudo modificar la union"; lblerror.Visible = true; } } } } else { lblerror.Text = "No se encuentra una union entre ellos"; lblerror.Visible = true; } } else { lblerror.Text = "Datos incorrectos"; lblerror.Visible = true; } } else { lblerror.Text = "Ingrese un numero de propiedad y un propietario"; lblerror.Visible = true; } }