public CrearAnexo(Anexo aAnexo) { InitializeComponent(); this.aAnexo = aAnexo; bCrearAnexo.Text = "Actualizar anexo"; tNumeroAnexo.SelectedText = aAnexo.SNumeroAnexo; tFechaAnexo.SelectedText = Data.formatearFecha(aAnexo.SFecha); tCif.SelectedText = aAnexo.SCif; tRazonSocial.SelectedText = aAnexo.SRazonSocial; tRepresentante.SelectedText = aAnexo.SRepresentanteNombre; tDniRepresentante.SelectedText = aAnexo.SRepresentanteDni; tCargo.SelectedText = aAnexo.SRepresentantePuesto; for (int i = 0; i < cbTipoVia.Items.Count; i++) { if (cbTipoVia.Items[i].Equals(aAnexo.STipoVia)) { cbTipoVia.SelectedIndex = i; } } tDireccionAnexo.SelectedText = aAnexo.SDireccion; tNumero.SelectedText = aAnexo.SNumero; tPiso.SelectedText = aAnexo.SPiso; tProvincia.SelectedText = aAnexo.SProvincia; tMunicipio.SelectedText = aAnexo.SMunicipio; tCp.SelectedText = aAnexo.SCp; tFirma.SelectedText = aAnexo.SFirma; }
private void BCrearAnexo_Click(object sender, EventArgs e) { try { if (!bCrearAnexo.Text.Equals("Actualizar anexo")) { Anexo anexo = Anexo.create(tNumeroAnexo.Text, tCif.Text, "CONTRATO DE TRATAMIENTO DE DATOS DE CARÁCTER PERSONAL POR CUENTA DE TERCEROS", Data.formatearFecha(tFechaAnexo.Text), tRazonSocial.Text, cbTipoVia.SelectedItem.ToString(), tDireccionAnexo.Text, tNumero.Text, tPiso.Text, tCp.Text, tMunicipio.Text, tProvincia.Text, tRepresentante.Text, tCargo.Text, tDniRepresentante.Text, tFirma.Text); MessageBox.Show("Anexo creado satisfactoriamente"); this.Close(); } else { Anexo anexo = Anexo.actualizar(aAnexo.IId, tNumeroAnexo.Text, tCif.Text, "CONTRATO DE TRATAMIENTO DE DATOS DE CARÁCTER PERSONAL POR CUENTA DE TERCEROS", Data.formatearFecha(tFechaAnexo.Text), tRazonSocial.Text, cbTipoVia.SelectedItem.ToString(), tDireccionAnexo.Text, tNumero.Text, tPiso.Text, tCp.Text, tMunicipio.Text, tProvincia.Text, tRepresentante.Text, tCargo.Text, tDniRepresentante.Text, tFirma.Text); MessageBox.Show("Anexo actualizado satisfactoriamente"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public CrearContrato(Contrato cContrato) { try { InitializeComponent(); ajustarPantalla(); dgElementos.ColumnCount = 4; dgElementos.Columns[0].Name = "Nombre"; dgElementos.Columns[1].Name = "Código"; dgElementos.Columns[2].Name = "Cantidad"; dgElementos.Columns[3].Name = "id"; dgElementos.Columns[3].Visible = false; dgElementos.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; contrato = cContrato; tNContrato.SelectedText = contrato.INumeroContrato.ToString(); tNAbonado.SelectedText = contrato.SNumeroAbonado.ToString(); tFechaContrato.SelectedText = Data.formatearFecha(contrato.SFechaContrato); bCerrarContrato.Text = "Actualizar contrato"; if (contrato.EEmpresa == null) { tabControl1.TabPages.Remove(tabPage2); } c = new Cliente(contrato.IIdCliente); Fill_Cliente(); if (c.getTipoCliente().Equals("Empresa")) { eEmpresa = new Empresa(contrato.IIdEmpresa); Fill_Empresa(); } aAnexo = new Anexo(contrato.IIdAnexo); Fill_Condiciones(contrato); Fill_Anexo(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public CrearContrato(ContratoPlantilla contratoPlantilla) { try { InitializeComponent(); ajustarPantalla(); dgElementos.ColumnCount = 4; dgElementos.Columns[0].Name = "Nombre"; dgElementos.Columns[1].Name = "Código"; dgElementos.Columns[2].Name = "Cantidad"; dgElementos.Columns[3].Name = "id"; dgElementos.Columns[3].Visible = false; dgElementos.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; bPlantilla.Text = "Actualizar borrador"; this.contratoPlantilla = contratoPlantilla; tFechaContrato.SelectedText = Data.formatearFecha(contratoPlantilla.SFechaContrato); tNContrato.SelectedText = contratoPlantilla.INumeroContrato.ToString();; tNAbonado.SelectedText = contratoPlantilla.SNumeroAbonado; if (contratoPlantilla.Id_cliente != 0) { c = new Cliente(contratoPlantilla.Id_cliente); Fill_Cliente(); } if (contratoPlantilla.Id_empresa != 0) { eEmpresa = new Empresa(contratoPlantilla.Id_empresa); Fill_Empresa(); } Fill_Condiciones(contratoPlantilla); if (contratoPlantilla.Id_anexo != 0) { aAnexo = new Anexo(contratoPlantilla.Id_anexo); } Fill_Anexo(); } catch (Exception ex) { throw ex; } }
private void BAnexo_Click(object sender, EventArgs e) { ConsultarAnexo consultarAnexo = new ConsultarAnexo(); consultarAnexo.Size = new Size(Screen.PrimaryScreen.Bounds.Width - 300, Screen.PrimaryScreen.Bounds.Height - (int)(Screen.PrimaryScreen.Bounds.Height * 0.11)); consultarAnexo.ShowDialog(); if (consultarAnexo.AAnexo != null) { tAnexo.Clear(); aAnexo = consultarAnexo.AAnexo; tAnexo.SelectedText = (aAnexo.SRazonSocial == null) ? aAnexo.SRepresentanteNombre : aAnexo.SRazonSocial; Fill_Anexo(); } }
private void BCerrarContrato_Click_1(object sender, EventArgs e) { try { if (!bCerrarContrato.Text.Equals("Actualizar contrato")) { int id = 0; if (c != null) { id = c.getId(); } int iIdEmpresa = 0; if (eEmpresa != null) { iIdEmpresa = eEmpresa.IId; } if (aAnexo == null) { Anexo.error_test(tNumeroAnexo.Text, tCif.Text, "CONTRATO DE TRATAMIENTO DE DATOS DE CARÁCTER PERSONAL POR CUENTA DE TERCEROS", tFechaAnexo.Text, tRazonSocialAnexo.Text, cbTipoViaAnexo.Text, tDireccionAnexo.Text, tNumeroDireccionAnexo.Text, tPisoAnexo.Text, tCpAnexo.Text, tMunicipioAnexo.Text, tProvinciaAnexo.Text, tRepresentante.Text, tCargo.Text, tDniRepresentante.Text, tFirma.Text, eEmpresa != null); } Contrato.error_test(tNContrato.Text, tNAbonado.Text, id, (aAnexo == null)?0:aAnexo.IId, iIdEmpresa, tFechaContrato.Text, cbInstalacion.Checked, cbMantenimiento.Checked, Data.formatearFecha(dtpFechaVigor.Text), Convert.ToInt32(nudDuracion.Value), tInstalacion.Text, tFPInstalacion.Text, tMantenimiento.Text, tFPMantenimiento.Text, cMensualidad.Text, tLugar.Text, tCalle.Text, tCpCondiciones.Text, cbProvinciasCondiciones.Text, cbProvinciasCondiciones.Text, tPersonaContacto.Text, tTelefonoCondiciones.Text, cRobo.Checked, cCctv.Checked, tRepresentante.Text, cInstalar.Checked, cMantener.Checked, cbCustodia.Checked, cbIban.Text, Data.formatearFecha(tFechaVisado.Text), tCC.Text, tCS.Text); if (aAnexo == null) { aAnexo = Anexo.create(tNumeroAnexo.Text, tCif.Text, "CONTRATO DE TRATAMIENTO DE DATOS DE CARÁCTER PERSONAL POR CUENTA DE TERCEROS", tFechaAnexo.Text, tRazonSocialAnexo.Text, cbTipoViaAnexo.Text, tDireccionAnexo.Text, tNumeroDireccionAnexo.Text, tPisoAnexo.Text, tCpAnexo.Text, tMunicipioAnexo.Text, tProvinciaAnexo.Text, tRepresentante.Text, tCargo.Text, tDniRepresentante.Text, tFirma.Text); } Contrato cContrato = Contrato.create(tNContrato.Text, tNAbonado.Text, id, aAnexo.IId, iIdEmpresa, tFechaContrato.Text, cbInstalacion.Checked, cbMantenimiento.Checked, Data.formatearFecha(dtpFechaVigor.Text), Convert.ToInt32(nudDuracion.Value), Convert.ToDouble(tInstalacion.Text), tFPInstalacion.Text, Convert.ToDouble(tMantenimiento.Text), tFPMantenimiento.Text, cMensualidad.Text, tLugar.Text, tCalle.Text, tCpCondiciones.Text, cbProvinciasCondiciones.Text, cbProvinciasCondiciones.Text, tPersonaContacto.Text, tTelefonoCondiciones.Text, cRobo.Checked, cCctv.Checked, aAnexo.SRepresentanteNombre, cInstalar.Checked, cMantener.Checked, cbCustodia.Checked, cbIban.SelectedItem.ToString(), Data.formatearFecha(tFechaVisado.Text), tCC.Text, tCS.Text); ArrayList aIdElementos = new ArrayList(); ArrayList aCantidad = new ArrayList(); for (int i = 0; i < dgElementos.RowCount - 1; i++) { aIdElementos.Add(dgElementos[3, i].Value); aCantidad.Add(dgElementos[2, i].Value); } Contrato_Elemento.create(cContrato.Id, aIdElementos, aCantidad); MessageBox.Show("Contrato cerrado.", "Operación realizada correctamente"); this.Close(); } else { int idEmpresa = 0; if (eEmpresa != null) { idEmpresa = eEmpresa.IId; } Contrato.error_test(tNContrato.Text, tNAbonado.Text, (c != null)?c.getId():0, aAnexo.IId, idEmpresa, Data.formatearFecha(tFechaContrato.Text), cbInstalacion.Checked, cbMantenimiento.Checked, Data.formatearFecha(dtpFechaVigor.Text), Convert.ToInt32(nudDuracion.Value), tInstalacion.Text, tFPInstalacion.Text, tMantenimiento.Text, tFPMantenimiento.Text, cMensualidad.Text, tLugar.Text, tCalle.Text, tCpCondiciones.Text, cbMunicipiosCondiciones.Text, cbProvinciasCondiciones.Text, tPersonaContacto.Text, tTelefonoCondiciones.Text, cRobo.Checked, cCctv.Checked, tAnexo.Text, cInstalar.Checked, cMantener.Checked, cbCustodia.Checked, cbIban.Text, Data.formatearFecha(tFechaVisado.Text), tCC.Text, tCS.Text); Contrato cContrato = Contrato.actualizar(contrato.Id, tNContrato.Text, tNAbonado.Text, c.getId(), aAnexo.IId, idEmpresa, Data.formatearFecha(tFechaContrato.Text), cbInstalacion.Checked, cbMantenimiento.Checked, Data.formatearFecha(dtpFechaVigor.Text), Convert.ToInt32(nudDuracion.Value), Convert.ToDouble(tInstalacion.Text), tFPInstalacion.Text, Convert.ToDouble(tMantenimiento.Text), tFPMantenimiento.Text, cMensualidad.SelectedItem.ToString(), tLugar.Text, tCalle.Text, tCpCondiciones.Text, cbMunicipiosCondiciones.Text, cbProvinciasCondiciones.Text, tPersonaContacto.Text, tTelefonoCondiciones.Text, cRobo.Checked, cCctv.Checked, tAnexo.Text, cInstalar.Checked, cMantener.Checked, cbCustodia.Checked, cbIban.SelectedItem.ToString(), Data.formatearFecha(tFechaVisado.Text), tCC.Text, tCS.Text); Contrato_Elemento.delete(cContrato.Id); ArrayList aIdElementos = new ArrayList(); ArrayList aCantidad = new ArrayList(); for (int i = 0; i < dgElementos.RowCount - 1; i++) { aIdElementos.Add(dgElementos[3, i].Value); aCantidad.Add(dgElementos[2, i].Value); } Contrato_Elemento.create(cContrato.Id, aIdElementos, aCantidad); MessageBox.Show("Contrato actualizado.", "Operación realizada correctamente"); this.Close(); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error de formulario", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void Fill_Condiciones(Object o) { if (o.GetType() == typeof(Contrato)) { cbInstalacion.Checked = contrato.BInstalacion; cbMantenimiento.Checked = contrato.BMantenimiento; dtpFechaVigor.Clear(); dtpFechaVigor.SelectedText = Data.formatearFecha(contrato.SFechaVigor); nudDuracion.Value = contrato.IDuracion; tInstalacion.Clear(); tInstalacion.SelectedText = contrato.IPrecioInstalacion.ToString(); tMantenimiento.Clear(); tMantenimiento.SelectedText = contrato.IPrecioMantenimiento.ToString(); tFPInstalacion.Clear(); tFPInstalacion.SelectedText = contrato.SFormaPagoInstalacion; tFPMantenimiento.Clear(); tFPMantenimiento.SelectedText = contrato.SFormaPagoMantenimiento; for (int i = 0; i < cMensualidad.Items.Count; i++) { if (cMensualidad.Items[i].Equals(contrato.SMensualidad)) { cMensualidad.SelectedIndex = i; } } tLugar.Clear(); tLugar.SelectedText = contrato.SLugar; tCalle.Clear(); tCalle.SelectedText = contrato.SCalle; tCpCondiciones.Clear(); tCpCondiciones.SelectedText = contrato.SCp; cbProvinciasCondiciones.Items.Clear(); Data.ListaProvincias(cbProvinciasCondiciones); cbProvinciasCondiciones.SelectedIndex = cbProvinciasCondiciones.FindStringExact(contrato.SProvincia); cbMunicipiosCondiciones.Items.Clear(); Data.ListaMunicipios(cbMunicipiosCondiciones, contrato.SProvincia); cbMunicipiosCondiciones.SelectedIndex = cbMunicipiosCondiciones.FindStringExact(contrato.SPoblacion); tPersonaContacto.Clear(); tPersonaContacto.SelectedText = contrato.SPersonaContacto; tTelefonoCondiciones.Clear(); tTelefonoCondiciones.SelectedText = contrato.STelefono; cRobo.Checked = contrato.BRobo; cCctv.Checked = contrato.BCctv; cMantener.Checked = contrato.BPrecioVisita; cInstalar.Checked = contrato.BPeriodicidadAnual; tFechaVisado.Clear(); tFechaVisado.SelectedText = Data.formatearFecha(contrato.SFechaVisado); tCC.Clear(); tCC.SelectedText = contrato.SCC; tCS.Clear(); tCS.SelectedText = contrato.SCS; if (cbIban.FindStringExact(contrato.SIban) != -1) { cbIban.SelectedIndex = cbIban.FindStringExact(contrato.SIban); } Contrato_Elemento contrato_Elemento = new Contrato_Elemento(contrato.Id); ArrayList aElementosId = contrato_Elemento.AIdElementos; ArrayList aElementosCant = contrato_Elemento.ACantidad; for (int i = 0; i < aElementosId.Count; i++) { Elemento e = new Elemento((int)aElementosId[i]); String[] row = { e.SNombre, e.SCodigo, aElementosCant[i].ToString(), e.IId.ToString() }; dgElementos.Rows.Add(row); } } else { cbInstalacion.Checked = contratoPlantilla.BInstalacion; cbMantenimiento.Checked = contratoPlantilla.BMantenimiento; dtpFechaVigor.Clear(); if (!contratoPlantilla.SFechaVigor.Equals("")) { dtpFechaVigor.SelectedText = Data.formatearFecha(contratoPlantilla.SFechaVigor); } nudDuracion.Value = contratoPlantilla.IDuracion; tInstalacion.Clear(); tInstalacion.SelectedText = contratoPlantilla.IPrecioInstalacion.ToString(); tMantenimiento.Clear(); tMantenimiento.SelectedText = contratoPlantilla.IPrecioMantenimiento.ToString(); tFPInstalacion.Clear(); tFPInstalacion.SelectedText = contratoPlantilla.SFormaPagoInstalacion; tFPMantenimiento.Clear(); tFPMantenimiento.SelectedText = contratoPlantilla.SFormaPagoMantenimiento; for (int i = 0; i < cMensualidad.Items.Count; i++) { if (cMensualidad.Items[i].Equals(contratoPlantilla.Mensualidad)) { cMensualidad.SelectedIndex = i; } } tLugar.Clear(); tLugar.SelectedText = contratoPlantilla.SLugar; tCalle.Clear(); tCalle.SelectedText = contratoPlantilla.SCalle; tCpCondiciones.Clear(); tCpCondiciones.SelectedText = contratoPlantilla.SCp; cbProvinciasCondiciones.Items.Clear(); Data.ListaProvincias(cbProvinciasCondiciones); cbProvinciasCondiciones.SelectedIndex = cbProvinciasCondiciones.FindStringExact(contratoPlantilla.SProvincia); cbMunicipiosCondiciones.Items.Clear(); Data.ListaMunicipios(cbMunicipiosCondiciones, contratoPlantilla.SProvincia); cbMunicipiosCondiciones.SelectedIndex = cbMunicipiosCondiciones.FindStringExact(contratoPlantilla.SPoblacion); tPersonaContacto.Clear(); tPersonaContacto.SelectedText = contratoPlantilla.SPersonaContacto; tTelefonoCondiciones.Clear(); tTelefonoCondiciones.SelectedText = contratoPlantilla.STelefono; cRobo.Checked = contratoPlantilla.BRobo; cCctv.Checked = contratoPlantilla.BCctv; cMantener.Checked = contratoPlantilla.BPrecioVisita; cInstalar.Checked = contratoPlantilla.BPeriodicidadAnual; tFechaVisado.Clear(); tFechaVisado.SelectedText = Data.formatearFecha(contratoPlantilla.SFechaVisado); tCC.Clear(); tCC.SelectedText = contratoPlantilla.SCC; tCS.Clear(); tCS.SelectedText = contratoPlantilla.SCS; if (cbIban.FindStringExact(contratoPlantilla.SIban) != -1) { cbIban.SelectedIndex = cbIban.FindStringExact(contratoPlantilla.SIban); } ElementoPlantilla contrato_Elemento = new ElementoPlantilla(contratoPlantilla.Id); if (contrato_Elemento != null) { ArrayList aElementosId = contrato_Elemento.Id_elemento; ArrayList aElementosCant = contrato_Elemento.Cantidad; for (int i = 0; i < aElementosId.Count; i++) { Elemento e = new Elemento((int)aElementosId[i]); String[] row = { e.SNombre, e.SCodigo, aElementosCant[i].ToString(), e.IId.ToString() }; dgElementos.Rows.Add(row); } } if (contratoPlantilla.Id_anexo != 0) { aAnexo = new Anexo(contratoPlantilla.Id_anexo); tAnexo.Clear(); tAnexo.SelectedText = (aAnexo.SRazonSocial.Equals("")) ? aAnexo.SRepresentanteNombre : aAnexo.SRazonSocial; } cbCustodia.Checked = contratoPlantilla.BCustodia; for (int i = 0; i < cIban.Items.Count; i++) { if (cIban.Items[i].Equals(contratoPlantilla.SIban)) { cIban.SelectedIndex = i; } } } }
private void BQuitarAnexo_Click(object sender, EventArgs e) { aAnexo = null; ClearTextBoxes(tabPage4); Fill_Anexo(); }