Beispiel #1
0
        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);
            }
        }
Beispiel #2
0
        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);
            }
        }