Esempio n. 1
0
        private void button3_Click(object sender, EventArgs e)
        {
            Formularios datos = new Formularios();

            this.lectura = datos.datos_user(Convert.ToInt32(maskedTextBox1.Text));

            if (this.lectura == null)
            {
                MessageBox.Show("No hay ningun cliente cargado");
            }
            else
            {
                complete_textbox();
            }
        }
Esempio n. 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            funciones func_user = new funciones();
            Formularios datos = new Formularios();
            Formularios datos_new = new Formularios();
            SqlDataReader lectura_new;
            string cliente;
            if (this.textBox1.Text != string.Empty ||
                this.textBox2.Text != string.Empty ||
                this.textBox3.Text != string.Empty ||
                this.textBox4.Text != string.Empty ||
                this.maskedTextBox1.Text != string.Empty ||
                this.maskedTextBox2.Text != string.Empty
                )
            {

                if (is_client)
                {
                    if (this.textBox1.Text != this.lectura["Cli_Nombre"].ToString() ||
                        this.textBox2.Text != this.lectura["Cli_Apellido"].ToString() ||
                        this.textBox3.Text != this.lectura["Cli_Dir"].ToString() ||
                        this.maskedTextBox2.Text != this.lectura["Cli_Telefono"].ToString() ||
                        this.textBox4.Text != this.lectura["Cli_Mail"].ToString() ||
                        this.dateTimePicker1.Value != Convert.ToDateTime(this.lectura["Cli_Fecha_Nac"].ToString()))
                    {
                        func_user.modClient(Convert.ToInt32(this.lectura["Cli_id"].ToString()), Convert.ToInt32(this.maskedTextBox1.Text), this.textBox1.Text, this.textBox2.Text, this.textBox3.Text, Convert.ToInt32(this.maskedTextBox2.Text), this.textBox4.Text, this.dateTimePicker1.Value);
                    }
                    cliente = this.lectura["Cli_id"].ToString();

                }
                else
                {
                    this.lectura = datos.datos_user(Convert.ToInt32(maskedTextBox1.Text));

                    if (this.lectura == null)
                    {
                        func_user.newClient(Convert.ToInt32(this.maskedTextBox1.Text), this.textBox1.Text, this.textBox2.Text, this.textBox3.Text, Convert.ToInt32(this.maskedTextBox2.Text), this.textBox4.Text, this.dateTimePicker1.Value);
                        lectura_new = datos_new.datos_user(Convert.ToInt32(maskedTextBox1.Text));
                        lectura_new.Read();
                        cliente = lectura_new["Cli_id"].ToString();

                    }
                    else
                    {
                        complete_textbox();
                        cliente = this.lectura["Cli_id"].ToString();
                    }

                }
                if (func_user.check_viaje_dup(Convert.ToInt32(cliente), this.viaje_id) && func_user.check_is_traveling(Convert.ToInt32(cliente), this.viaje_id))
                {
                    this.pasaje_cli_id.Add(cliente);
                    if (checkBox1.Checked)
                    {
                        this.discapacitado = true;
                        this.has_discapacitado = Convert.ToInt32(cliente);
                    }
                    if (has_kg)
                    {
                        this.has_kg = false;
                        MessageBox.Show("Ya ha ingresado la encomienda", "Ingreso de Encomienda");

                    }
                    else
                    {
                        this.add_psj = this.add_psj + 1;
                        if ((func_user.Ahora() - this.dateTimePicker1.Value).TotalDays > 23360) this.pasaje_65.Add(Convert.ToInt32(cliente));
                        MessageBox.Show("Gracias, ya ha ingresado un nuevo pasaje", "Ingreso de pasajeros");
                    }

                    if (this.cant_pasj == this.add_psj && this.has_kg == false)
                    {
                        BuscarButaca busq = new BuscarButaca();

                        busq.cantidad = add_psj;
                        busq.kg = cant_kg;
                        busq.pasaje_cli_id = this.pasaje_cli_id;
                        busq.viaje_id = this.viaje_id;
                        busq.admin = this.admin;
                        busq.discapacitado = this.discapacitado;
                        busq.pasaje_65 = this.pasaje_65;
                        busq.has_discapacitado = this.has_discapacitado;
                        busq.Show();

                        this.Close();
                    }
                    else
                    {
                        Usuario_datos_Load();
                    }

                }
                else
                {
                    MessageBox.Show("El usuario ya posee pasajes o esta en viaje en esa fecha", "Error operacion");
                    Usuario_datos_Load();
                }
            }
            else
            {
                MessageBox.Show("No estan todos los campos completos", "Error operacion");

            }
        }
Esempio n. 3
0
        private void button3_Click(object sender, EventArgs e)
        {
            Formularios datos = new Formularios();

            this.lectura = datos.datos_user(Convert.ToInt32(maskedTextBox1.Text));

            if (this.lectura == null)
            {
                MessageBox.Show("No hay ningun cliente cargado");

            }
            else
            {
                complete_textbox();
            }
        }
Esempio n. 4
0
        private void button1_Click(object sender, EventArgs e)
        {
            funciones func_user = new funciones();
            Formularios datos = new Formularios();
            Formularios datos_new = new Formularios();
            SqlDataReader lectura_new;
            string cliente;
            Int32 voucher_id;
            double precio_butaca = func_user.getPasjasjePrecio(this.viaje_id);
            double precio_encomienda = func_user.getEncomiendaPrecio(this.viaje_id);

            if (this.textBox1.Text != string.Empty &&
                 this.textBox2.Text != string.Empty &&
                 this.textBox3.Text != string.Empty &&
                 this.textBox4.Text != string.Empty &&
                 this.maskedTextBox1.Text != string.Empty &&
                 this.maskedTextBox2.Text != string.Empty
                 )
            {
                if (this.maskedTextBox3.Text != string.Empty
                    && this.maskedTextBox4.Text != string.Empty
                    && this.maskedTextBox5.Text != string.Empty
                    && this.maskedTextBox6.Text != string.Empty
                    || this.opcion == "Efectivo")
                {
                    if (this.is_client)
                    {
                        if (this.textBox1.Text != this.lectura["Cli_Nombre"].ToString() ||
                            this.textBox2.Text != this.lectura["Cli_Apellido"].ToString() ||
                            this.textBox3.Text != this.lectura["Cli_Dir"].ToString() ||
                            this.maskedTextBox2.Text != this.lectura["Cli_Telefono"].ToString() ||
                            this.textBox4.Text != this.lectura["Cli_Mail"].ToString() ||
                            this.dateTimePicker1.Value != Convert.ToDateTime(this.lectura["Cli_Fecha_Nac"].ToString()))
                        {
                            func_user.modClient(Convert.ToInt32(this.lectura["Cli_id"].ToString()), Convert.ToInt32(this.maskedTextBox1.Text), this.textBox1.Text, this.textBox2.Text, this.textBox3.Text, Convert.ToInt32(this.maskedTextBox2.Text), this.textBox4.Text, this.dateTimePicker1.Value);
                        }
                        cliente = this.lectura["Cli_id"].ToString();

                    }
                    else
                    {
                        this.lectura = datos.datos_user(Convert.ToInt32(maskedTextBox1.Text));

                        if (this.lectura == null)
                        {
                            func_user.newClient(Convert.ToInt32(this.maskedTextBox1.Text), this.textBox1.Text, this.textBox2.Text, this.textBox3.Text, Convert.ToInt32(this.maskedTextBox2.Text), this.textBox4.Text, this.dateTimePicker1.Value);
                            lectura_new = datos_new.datos_user(Convert.ToInt32(maskedTextBox1.Text));
                            lectura_new.Read();
                            cliente = lectura_new["Cli_id"].ToString();

                        }
                        else
                        {
                            complete_textbox();
                            cliente = this.lectura["Cli_id"].ToString();
                        }

                    }

                    if (this.discapacitado)
                    {
                        if (this.cant_psj > 2)
                        {
                            if ((this.pasaje_65.Count - 2) > 0)
                            {
                                this.discount = 4 + (this.pasaje_65.Count - 2);
                            }
                        }
                        else { this.discount = 4; }

                    }
                    else
                    {
                        this.discount = this.pasaje_65.Count;
                    }

                    voucher_id = func_user.realizar_compra(Convert.ToInt32(cliente), this.kg, this.viaje_id, this.cant_psj, this.discount);

                    if (this.kg > 0)
                    {
                        func_user.crear_pasaje(this.viaje_id, voucher_id, this.butaca_cli_id[0], Convert.ToInt32(this.pasaje_cli_id[0]), this.kg, 0, precio_encomienda);
                        this.butaca_cli_id.Remove(butaca_cli_id[0]);
                        this.pasaje_cli_id.Remove(pasaje_cli_id[0]);

                        foreach (string cliente_id in this.pasaje_cli_id)
                        {
                            if (Convert.ToInt32(cliente_id) == has_discapacitado)
                            {
                                func_user.crear_pasaje(this.viaje_id, voucher_id, this.butaca_cli_id[this.pasaje_cli_id.IndexOf(cliente_id)], Convert.ToInt32(cliente), 0, 1, 0);
                                this.butaca_cli_id.Remove(butaca_cli_id[this.pasaje_cli_id.IndexOf(cliente_id)]);
                                this.pasaje_cli_id.Remove(cliente_id);
                                if (this.butaca_cli_id.Count > 0)
                                {
                                    func_user.crear_pasaje(this.viaje_id, voucher_id, butaca_cli_id[0], Convert.ToInt32(this.pasaje_cli_id[0]), 0, 1, 0);
                                    this.butaca_cli_id.Remove(butaca_cli_id[0]);
                                    this.pasaje_cli_id.Remove(pasaje_cli_id[0]);
                                    break;
                                }
                                else
                                { break; }
                            }
                        }
                        ingresar_pasaje(voucher_id);
                        this.Close();
                    }
                    else
                    {
                        ingresar_pasaje(voucher_id);
                        this.Close();
                    }
                }
                else
                {
                    MessageBox.Show("No estan todos los campos de tarjeta  completos", "Error operacion");

                }
            }
            else
            {
                MessageBox.Show("No estan todos los campos completos", "Error operacion");

            }
        }
Esempio n. 5
0
        private void button1_Click(object sender, EventArgs e)
        {
            funciones     func_user = new funciones();
            Formularios   datos     = new Formularios();
            Formularios   datos_new = new Formularios();
            SqlDataReader lectura_new;
            string        cliente;

            if (this.textBox1.Text != string.Empty ||
                this.textBox2.Text != string.Empty ||
                this.textBox3.Text != string.Empty ||
                this.textBox4.Text != string.Empty ||
                this.maskedTextBox1.Text != string.Empty ||
                this.maskedTextBox2.Text != string.Empty
                )
            {
                if (is_client)
                {
                    if (this.textBox1.Text != this.lectura["Cli_Nombre"].ToString() ||
                        this.textBox2.Text != this.lectura["Cli_Apellido"].ToString() ||
                        this.textBox3.Text != this.lectura["Cli_Dir"].ToString() ||
                        this.maskedTextBox2.Text != this.lectura["Cli_Telefono"].ToString() ||
                        this.textBox4.Text != this.lectura["Cli_Mail"].ToString() ||
                        this.dateTimePicker1.Value != Convert.ToDateTime(this.lectura["Cli_Fecha_Nac"].ToString()))
                    {
                        func_user.modClient(Convert.ToInt32(this.lectura["Cli_id"].ToString()), Convert.ToInt32(this.maskedTextBox1.Text), this.textBox1.Text, this.textBox2.Text, this.textBox3.Text, Convert.ToInt32(this.maskedTextBox2.Text), this.textBox4.Text, this.dateTimePicker1.Value);
                    }
                    cliente = this.lectura["Cli_id"].ToString();
                }
                else
                {
                    this.lectura = datos.datos_user(Convert.ToInt32(maskedTextBox1.Text));

                    if (this.lectura == null)
                    {
                        func_user.newClient(Convert.ToInt32(this.maskedTextBox1.Text), this.textBox1.Text, this.textBox2.Text, this.textBox3.Text, Convert.ToInt32(this.maskedTextBox2.Text), this.textBox4.Text, this.dateTimePicker1.Value);
                        lectura_new = datos_new.datos_user(Convert.ToInt32(maskedTextBox1.Text));
                        lectura_new.Read();
                        cliente = lectura_new["Cli_id"].ToString();
                    }
                    else
                    {
                        complete_textbox();
                        cliente = this.lectura["Cli_id"].ToString();
                    }
                }
                if (func_user.check_viaje_dup(Convert.ToInt32(cliente), this.viaje_id) && func_user.check_is_traveling(Convert.ToInt32(cliente), this.viaje_id))
                {
                    this.pasaje_cli_id.Add(cliente);
                    if (checkBox1.Checked)
                    {
                        this.discapacitado     = true;
                        this.has_discapacitado = Convert.ToInt32(cliente);
                    }
                    if (has_kg)
                    {
                        this.has_kg = false;
                        MessageBox.Show("Ya ha ingresado la encomienda", "Ingreso de Encomienda");
                    }
                    else
                    {
                        this.add_psj = this.add_psj + 1;
                        if ((func_user.Ahora() - this.dateTimePicker1.Value).TotalDays > 23360)
                        {
                            this.pasaje_65.Add(Convert.ToInt32(cliente));
                        }
                        MessageBox.Show("Gracias, ya ha ingresado un nuevo pasaje", "Ingreso de pasajeros");
                    }

                    if (this.cant_pasj == this.add_psj && this.has_kg == false)
                    {
                        BuscarButaca busq = new BuscarButaca();

                        busq.cantidad          = add_psj;
                        busq.kg                = cant_kg;
                        busq.pasaje_cli_id     = this.pasaje_cli_id;
                        busq.viaje_id          = this.viaje_id;
                        busq.admin             = this.admin;
                        busq.discapacitado     = this.discapacitado;
                        busq.pasaje_65         = this.pasaje_65;
                        busq.has_discapacitado = this.has_discapacitado;
                        busq.Show();

                        this.Close();
                    }
                    else
                    {
                        Usuario_datos_Load();
                    }
                }
                else
                {
                    MessageBox.Show("El usuario ya posee pasajes o esta en viaje en esa fecha", "Error operacion");
                    Usuario_datos_Load();
                }
            }
            else
            {
                MessageBox.Show("No estan todos los campos completos", "Error operacion");
            }
        }
Esempio n. 6
0
        private void button1_Click(object sender, EventArgs e)
        {
            funciones     func_user = new funciones();
            Formularios   datos     = new Formularios();
            Formularios   datos_new = new Formularios();
            SqlDataReader lectura_new;
            string        cliente;
            Int32         voucher_id;
            double        precio_butaca     = func_user.getPasjasjePrecio(this.viaje_id);
            double        precio_encomienda = func_user.getEncomiendaPrecio(this.viaje_id);

            if (this.textBox1.Text != string.Empty &&
                this.textBox2.Text != string.Empty &&
                this.textBox3.Text != string.Empty &&
                this.textBox4.Text != string.Empty &&
                this.maskedTextBox1.Text != string.Empty &&
                this.maskedTextBox2.Text != string.Empty
                )
            {
                if (this.maskedTextBox3.Text != string.Empty &&
                    this.maskedTextBox4.Text != string.Empty &&
                    this.maskedTextBox5.Text != string.Empty &&
                    this.maskedTextBox6.Text != string.Empty ||
                    this.opcion == "Efectivo")
                {
                    if (this.is_client)
                    {
                        if (this.textBox1.Text != this.lectura["Cli_Nombre"].ToString() ||
                            this.textBox2.Text != this.lectura["Cli_Apellido"].ToString() ||
                            this.textBox3.Text != this.lectura["Cli_Dir"].ToString() ||
                            this.maskedTextBox2.Text != this.lectura["Cli_Telefono"].ToString() ||
                            this.textBox4.Text != this.lectura["Cli_Mail"].ToString() ||
                            this.dateTimePicker1.Value != Convert.ToDateTime(this.lectura["Cli_Fecha_Nac"].ToString()))
                        {
                            func_user.modClient(Convert.ToInt32(this.lectura["Cli_id"].ToString()), Convert.ToInt32(this.maskedTextBox1.Text), this.textBox1.Text, this.textBox2.Text, this.textBox3.Text, Convert.ToInt32(this.maskedTextBox2.Text), this.textBox4.Text, this.dateTimePicker1.Value);
                        }
                        cliente = this.lectura["Cli_id"].ToString();
                    }
                    else
                    {
                        this.lectura = datos.datos_user(Convert.ToInt32(maskedTextBox1.Text));

                        if (this.lectura == null)
                        {
                            func_user.newClient(Convert.ToInt32(this.maskedTextBox1.Text), this.textBox1.Text, this.textBox2.Text, this.textBox3.Text, Convert.ToInt32(this.maskedTextBox2.Text), this.textBox4.Text, this.dateTimePicker1.Value);
                            lectura_new = datos_new.datos_user(Convert.ToInt32(maskedTextBox1.Text));
                            lectura_new.Read();
                            cliente = lectura_new["Cli_id"].ToString();
                        }
                        else
                        {
                            complete_textbox();
                            cliente = this.lectura["Cli_id"].ToString();
                        }
                    }



                    if (this.discapacitado)
                    {
                        if (this.cant_psj > 2)
                        {
                            if ((this.pasaje_65.Count - 2) > 0)
                            {
                                this.discount = 4 + (this.pasaje_65.Count - 2);
                            }
                        }
                        else
                        {
                            this.discount = 4;
                        }
                    }
                    else
                    {
                        this.discount = this.pasaje_65.Count;
                    }

                    voucher_id = func_user.realizar_compra(Convert.ToInt32(cliente), this.kg, this.viaje_id, this.cant_psj, this.discount);

                    if (this.kg > 0)
                    {
                        func_user.crear_pasaje(this.viaje_id, voucher_id, this.butaca_cli_id[0], Convert.ToInt32(this.pasaje_cli_id[0]), this.kg, 0, precio_encomienda);
                        this.butaca_cli_id.Remove(butaca_cli_id[0]);
                        this.pasaje_cli_id.Remove(pasaje_cli_id[0]);

                        foreach (string cliente_id in this.pasaje_cli_id)
                        {
                            if (Convert.ToInt32(cliente_id) == has_discapacitado)
                            {
                                func_user.crear_pasaje(this.viaje_id, voucher_id, this.butaca_cli_id[this.pasaje_cli_id.IndexOf(cliente_id)], Convert.ToInt32(cliente), 0, 1, 0);
                                this.butaca_cli_id.Remove(butaca_cli_id[this.pasaje_cli_id.IndexOf(cliente_id)]);
                                this.pasaje_cli_id.Remove(cliente_id);
                                if (this.butaca_cli_id.Count > 0)
                                {
                                    func_user.crear_pasaje(this.viaje_id, voucher_id, butaca_cli_id[0], Convert.ToInt32(this.pasaje_cli_id[0]), 0, 1, 0);
                                    this.butaca_cli_id.Remove(butaca_cli_id[0]);
                                    this.pasaje_cli_id.Remove(pasaje_cli_id[0]);
                                    break;
                                }
                                else
                                {
                                    break;
                                }
                            }
                        }
                        ingresar_pasaje(voucher_id);
                        this.Close();
                    }
                    else
                    {
                        ingresar_pasaje(voucher_id);
                        this.Close();
                    }
                }
                else
                {
                    MessageBox.Show("No estan todos los campos de tarjeta  completos", "Error operacion");
                }
            }
            else
            {
                MessageBox.Show("No estan todos los campos completos", "Error operacion");
            }
        }