Beispiel #1
0
 private void Eliminar_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(this.comboBoxMotivo.Text) || string.IsNullOrWhiteSpace(this.comboBoxMotivo.Text))
     {
         MessageBox.Show("Debe especificar un motivo de baja");
     }
     else
     {
         if (DBConnection.getInstance().executeQuery(QueryProvider.SELECT_VIAJES_REPLANIFICACION(this.txtCodigo.Text, Convert.ToDateTime(System.Configuration.ConfigurationManager.AppSettings["fechaSistema"]).ToString(), Convert.ToDateTime(this.dateTimePickerBaja.Text).ToString())).Tables[0].Rows.Count > 0)
         {
             DecisionReplanificacion dr = new DecisionReplanificacion(this.txtCodigo.Text, this.comboBoxMotivo.Text, Convert.ToDateTime(this.dateTimePickerBaja.Value));
             dr.ShowDialog();
             if (dr.reemplazoOk)
             {
                 DBAdapter.actualizarDatosEnTabla("crucero_estado", this.id, this.comboBoxMotivo.Text, Convert.ToDateTime(this.dateTimePickerBaja.Value), Convert.ToDateTime(System.Configuration.ConfigurationManager.AppSettings["fechaSistema"]));
             }
             else
             {
                 MessageBox.Show("Ups! Algo fallo, estamos trabajando para solucionarlo");
             }
         }
         else
         {
             DBAdapter.actualizarDatosEnTabla("crucero_estado", this.id, this.comboBoxMotivo.Text, Convert.ToDateTime(this.dateTimePickerBaja.Value), Convert.ToDateTime(System.Configuration.ConfigurationManager.AppSettings["fechaSistema"]));
         }
         MessageBox.Show("Crucero " + id + " dado de baja");
         this.Close();
     }
 }
Beispiel #2
0
        private void button2_Click(object sender, EventArgs e)
        {
            DBConnection dbConnection = DBConnection.getInstance();
            DataSet      ds           = dbConnection.executeQuery(QueryProvider.SELECT_VIAJES_REPLANIFICACION(this.crucero, Convert.ToDateTime(System.Configuration.ConfigurationManager.AppSettings["fechaSistema"]).ToString(), this.fechaReactivacion.ToString()));

            if (string.Equals("Fuera de Servicio", this.motivo))
            {
                CantidadDiasCorrimiento cdc = new CantidadDiasCorrimiento(Convert.ToInt32((this.fechaReactivacion - Convert.ToDateTime(System.Configuration.ConfigurationManager.AppSettings["fechaSistema"])).TotalDays));
                cdc.ShowDialog();
                foreach (DataRow row in ds.Tables[0].Rows)
                {
                    DBAdapter.ejecutarProcedure("correr_fecha_reserva", Convert.ToInt32(row["viaj_id"]), cdc.dias);
                }
                MessageBox.Show("Viajes replanificados");
                this.reemplazoOk = true;
            }
            else
            {
                try
                {
                    foreach (DataRow row in ds.Tables[0].Rows)
                    {
                        DBAdapter.actualizarDatosEnTabla("reemplazar_crucero", this.crucero, Convert.ToInt32(row["viaj_id"]));
                    }
                    MessageBox.Show("Viajes replanificados");
                    this.reemplazoOk = true;
                }
                catch {
                    MessageBox.Show("No se pueden reemplazar los viajes. Debera dar de alta un crucero nuevo");

                    CruceroAlta car = new CruceroAlta(this.crucero);
                    car.ShowDialog();
                    if (!String.IsNullOrEmpty(car.codigo))
                    {
                        this.cruceroNuevo = car.codigo;
                        DBAdapter.ejecutarProcedure("replicar_cabinas", cruceroNuevo, this.crucero);

                        foreach (DataRow row in ds.Tables[0].Rows)
                        {
                            DBAdapter.ejecutarProcedure("reemplazar_crucero_reserva", cruceroNuevo, row["viaj_id"], this.crucero);
                        }
                        MessageBox.Show("Viajes replanificados");
                        this.reemplazoOk = true;
                    }
                    else
                    {
                        MessageBox.Show("Replanificacion abortada");
                        this.Close();
                    }
                }
            }

            this.Close();
        }
Beispiel #3
0
        private void actualizarCliente(DataRow row)
        {
            DataSet dsDoc;

            dsDoc = dbConnection.executeQuery("SELECT * FROM [GD1C2019].[EYE_OF_THE_TRIGGER].[TipoDocumento] WHERE descripcion='" + this.comboBoxTipoDoc.Text + "'");

            DBAdapter.actualizarDatosEnTabla("cliente", Convert.ToInt32(row["clie_id"]), this.Nombre.Text, this.Apellido.Text,
                                             Convert.ToInt32(dsDoc.Tables[0].Rows[0]["id"]), Convert.ToInt32(this.Documento.Text),
                                             this.Calle.Text, Convert.ToInt32(this.Nro.Text), this.Piso.Text, this.Dpto.Text, this.Ciudad.Text,
                                             this.Pais.Text, this.Telefono.Text, this.email.Text, Convert.ToDateTime(this.dateTimePicker1.Text));
            MessageBox.Show("Datos cargados correctamente");
        }
 private void Modificar_Click(object sender, EventArgs e)
 {
     if (!string.IsNullOrWhiteSpace(this.Codigo.Text) && !string.IsNullOrWhiteSpace(this.Precio.Text))
     {
         DBAdapter.actualizarDatosEnTabla("recorrido", id, Convert.ToInt32(Codigo.Text), textBox1.Text, textBox2.Text,
                                          Convert.ToDouble(Precio.Text));
         MessageBox.Show("Recorrido " + id + " modificado");
     }
     else
     {
         MessageBox.Show("Debe completar todos los campos");
     }
 }
        private void Modificar_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(this.txtCodigo.Text) || string.IsNullOrWhiteSpace(this.txtCodigo.Text) ||
                string.IsNullOrEmpty(this.txtNombre.Text) || string.IsNullOrWhiteSpace(this.txtNombre.Text) ||
                string.IsNullOrEmpty(this.txtModelo.Text) || string.IsNullOrWhiteSpace(this.txtModelo.Text) ||
                string.IsNullOrEmpty(this.comboServicio.Text) || string.IsNullOrWhiteSpace(this.comboServicio.Text) ||
                string.IsNullOrEmpty(this.comboMarcas.Text) || string.IsNullOrWhiteSpace(this.comboMarcas.Text) ||
                string.IsNullOrEmpty(this.txtCabinas.Text) || string.IsNullOrWhiteSpace(this.txtCabinas.Text))
            {
                MessageBox.Show("Debe completar todos los campos");
            }

            else
            {
                DBAdapter.actualizarDatosEnTabla("crucero", this.txtCodigo.Text, this.txtNombre.Text, this.txtModelo.Text, this.comboServicio.Text, this.comboMarcas.Text);
                MessageBox.Show("Crucero " + id + " modificado");
                this.cargarDatos();
            }
        }