private void Inicializar() { socios oSocios = new socios(); SocioImplement oSociosImplement = new SocioImplement(); socios_lote oSocioLote = new socios_lote(); SocioLoteImplement oSocioLoteImplement = new SocioLoteImplement(); oSocioLote = oSocioLoteImplement.Get(_idSocio); socios_conexion oSocioConexion = new socios_conexion(); SocioConexionImplement oSocioConexionImplement = new SocioConexionImplement(); oSocioConexion = oSocioConexionImplement.Get(_idSocio); socios_varios oSocioVarios = new socios_varios(); SocioVariosImplement oSocioVariosImplement = new SocioVariosImplement(); oSocioVarios = oSocioVariosImplement.Get(_idSocio); oSocios = oSociosImplement.Get(_idSocio); txtCodigo.Text = oSocios.codigo_socio; txtFechaConvenio.Text = _FechaConvenio.ToShortDateString(); txtNombre.Text = oSocios.nombre; cod_documentos oCodDocumentos = new cod_documentos(); DocumentoImplement oDocumentosImplement = new DocumentoImplement(); if (oSocios.tipo_documento != null) { txtTipoDocumento.Text = oDocumentosImplement.Get((int)oSocios.tipo_documento).documento; } txtDocumento.Text = oSocios.documento.ToString(); CalleImplement oCalleImplement = new CalleImplement(); BarrioImplement oBarrioImplement = new BarrioImplement(); LocalidadImplement oLocalidadImplement = new LocalidadImplement(); if (oSocioConexion.calle != null & (int)oSocioConexion.calle != 0) { txtDomicilioReal.Text = oCalleImplement.Get((int)oSocioConexion.calle).calle + " " + oSocioConexion.calle_altura; } if (oSocioLote.localidad != null & (int)oSocioLote.localidad != 0) { txtCiudadReal.Text = oLocalidadImplement.Get((int)oSocioLote.localidad).localidad; } if (oSocioLote.calle != null & (int)oSocioLote.calle != 0) { txtDomicilioLegal.Text = oCalleImplement.Get((int)oSocioLote.calle).calle + " " + oSocioLote.calle_altura; } if (oSocioLote.localidad != null & (int)oSocioLote.localidad != 0) { txtCiudadLegal.Text = oLocalidadImplement.Get((int)oSocioLote.localidad).localidad; } txtLote.Text = oSocioLote.lote; txtManzana.Text = oSocioLote.manzana; if (oSocioLote.barrio != null & (int)oSocioLote.barrio != 0) { txtBarrio.Text = oBarrioImplement.Get((int)oSocioLote.barrio).barrio; } txtImporteDeuda.Text = _ImporteDeuda.ToString(); txtValorCuotas.Text = _ImporteCuota.ToString(); txtCantidadCuotas.Text = _CantidadCuotas.ToString(); txtImporteCanonMunicipal.Text = _CanonMunicipal.ToString(); FacturasImplement oFacturasImplement = new FacturasImplement(); string sPeriodo = oFacturasImplement.GetUltimoPeriodoFacturadoBySocio(_idSocio); int anio = int.Parse(sPeriodo.Substring(0, 3)); int mes = int.Parse(sPeriodo.Substring(4, 5)); DateTime fechaPeriodo = new DateTime(anio, mes, 1); DateTime fechaDesde = fechaPeriodo.AddMonths(1); DateTime fechaHasta = fechaPeriodo.AddMonths(_CantidadCuotas); Meses mesDesde = (Meses)fechaDesde.Month; Meses mesHasta = (Meses)fechaHasta.Month; txtDesdeMes.Text = mesDesde.ToString(); txtMesHasta.Text = mesHasta.ToString(); txtDesdeAnio.Text = fechaDesde.Year.ToString(); txtAnioHasta.Text = fechaHasta.Year.ToString(); }
public override string ToString() => $"{Anos.ToString("00")}a {Meses.ToString("00")}m {Dias.ToString("00")}d - Total {TotalDeDias.ToString("0000")} dias";
public string ToShortString() => $"{Anos.ToString("00")}a {Meses.ToString("00")}m {Dias.ToString("00")}d";
public void GuardarXML() { XmlDocument doc = new XmlDocument(); // Si el archivo no existe debe crearlo // con la estructura raiz if (File.Exists(Ruta) == false) { // LoadXml carga un string con formato xml doc.LoadXml("<VehiculosAgencias></VehiculosAgencias>"); } else { File.Delete(Ruta); doc.LoadXml("<VehiculosAgencias></VehiculosAgencias>"); } // DocumentElement = raiz (solo puede existir 1) XmlElement root = doc.DocumentElement; XmlElement NodoAgencia = doc.CreateElement("Agencia"); NodoAgencia.SetAttribute("Nombre", Agencia.Nombre.ToString()); root.AppendChild(NodoAgencia); XmlElement NodoCliente = doc.CreateElement("Cliente"); XmlElement NodoEmail = doc.CreateElement("Email"); NodoEmail.InnerText = Cliente.Email; XmlElement NodoTelefono = doc.CreateElement("Telefono"); NodoTelefono.InnerText = Cliente.Telefono.ToString(); NodoCliente.AppendChild(NodoEmail); NodoCliente.AppendChild(NodoTelefono); root.AppendChild(NodoCliente); XmlElement NodoVehiculo = doc.CreateElement("Vehiculo"); NodoVehiculo.SetAttribute("Combustible", Vehiculo.Combustible.ToString()); NodoVehiculo.SetAttribute("Transmision", Vehiculo.Trasmision.ToString()); XmlElement NodoCategoria = doc.CreateElement("Categoria"); NodoCategoria.InnerText = Vehiculo.Categoria.ToString(); NodoVehiculo.AppendChild(NodoCategoria); XmlElement NodoPrecioBase = doc.CreateElement("PrecioBase"); NodoPrecioBase.InnerText = Vehiculo.PrecioBase.ToString("C2"); NodoVehiculo.AppendChild(NodoPrecioBase); XmlElement NodoExtras = doc.CreateElement("Extras"); foreach (Extra item in Extras) { XmlElement NodoExtra = doc.CreateElement("Extra"); NodoExtra.SetAttribute("Descripcion", item.Descripcion); NodoExtra.SetAttribute("Costo", item.ObtenerCosto().ToString()); NodoExtras.AppendChild(NodoExtra); } NodoVehiculo.AppendChild(NodoExtras); root.AppendChild(NodoVehiculo); XmlElement NodoCotizacion = doc.CreateElement("Cotizacion"); XmlElement NodoMeses = doc.CreateElement("Meses"); NodoMeses.InnerText = Meses.ToString(); NodoCotizacion.AppendChild(NodoMeses); XmlElement NodoCuotaMensual = doc.CreateElement("CuotaMensual"); NodoCuotaMensual.InnerText = CalcularTotal().ToString("C3"); NodoCotizacion.AppendChild(NodoCuotaMensual); root.AppendChild(NodoCotizacion); XmlElement NodoPagos = doc.CreateElement("Pagos"); double monto = CalcularTotal(); for (int i = 1; i <= Meses; i++) { XmlElement NodoPago = doc.CreateElement("Pago"); NodoPago.SetAttribute("Mes", i.ToString()); NodoPago.SetAttribute("Monto", monto.ToString("C3")); NodoPagos.AppendChild(NodoPago); } root.AppendChild(NodoPagos); // Salvar doc.Save(Ruta); }