Esempio n. 1
0
 /// <summary>
 /// Se validan que existan los datos que son obligatorios y que
 /// sean los datos correctos
 /// </summary>
 private void ValidateBusinessRulesForNumberFlight()
 {
     validatebusinessrules = false;
     if (string.IsNullOrEmpty(txtDataExit.Text))
     {
         MessageBox.Show(Resources.Reservations.INGRESA_FECHA_SALIDA_VUELO, Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Information);
         txtDataExit.Focus();
     }
     else if (string.IsNullOrEmpty(txtCity.Text))
     {
         MessageBox.Show(Resources.Reservations.INGRESA_CÓDIGO_CIUDAD, Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Information);
         txtCity.Focus();
     }
     else if (txtCity.Text.Length <= 2)
     {
         MessageBox.Show(Resources.Reservations.CIUDAD_DEBE_TENER_3_CARAC, Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Information);
         txtCity.Focus();
     }
     else if (string.IsNullOrEmpty(txtAeroline.Text))
     {
         MessageBox.Show(Resources.Reservations.INGRESA_CÓDIGO_AEROLÍNEA, Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Information);
         txtAeroline.Focus();
     }
     else if (txtAeroline.Text.Length <= 1)
     {
         MessageBox.Show(Resources.Reservations.CÓDIGO_AEROLÍNEA_DEBE_TENER_2_DÍG, Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Information);
         txtAeroline.Focus();
     }
     else if (string.IsNullOrEmpty(txtNumberFlight.Text))
     {
         MessageBox.Show(Resources.Reservations.INGRESA_NÚEMRO_VUELO, Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Information);
         txtNumberFlight.Focus();
     }
     else if (string.IsNullOrEmpty(txtLastName1.Text))
     {
         MessageBox.Show(Resources.Reservations.INGRESE_APELLIDO_PASAJERO, Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Information);
         txtLastName1.Focus();
     }
     else if (!ValidateRegularExpression.ValidateDateFormat(txtDataExit.Text))
     {
         MessageBox.Show(Resources.Reservations.FORMAT_FECHA_DOS_NUM_TRES_ALFA, Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Information);
         txtDataExit.Focus();
     }
     else if (statusDate)
     {
         MessageBox.Show(Resources.Reservations.FECHA_SELEC_MENOR_ACTUAL, Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Information);
         txtDataExit.Focus();
     }
     else
     {
         validatebusinessrules = true;
     }
 }
Esempio n. 2
0
        /// <summary>
        /// Esta función lo que hace es extraer una fecha
        /// se manda un comando primero y busca la fecha en ERR__BoletageDateAndReceived,
        /// sino la encuentra,se manda otro comando distinto igual se busca la fecha,
        /// sino la vuelve a encontrar se manda un tercer comando y vuelve a buscar
        /// la fecha si en esta no la vuelva a encontrar, se termina la busqueda y el
        /// textbox de fecha se queda en blanco.
        /// </summary>
        private void LookNewDate()
        {
            string   date;
            string   dateinitial;
            string   dateoptional;
            string   dates_Suitable;
            string   date_compare;
            int      datefinal;
            int      chagedate;
            DateTime today = DateTime.Today;

            using (CommandsAPI objCommands = new CommandsAPI())
            {
                result = objCommands.SendReceive(Resources.Constants.COMMANDS_AST_PQ);
                PQ     = true;
            }
            ERR__BoletageDateAndReceived.err_boletagedataandreceived(result);
            PQ = false;
            if (ERR__BoletageDateAndReceived.Status)
            {
                date = ERR__BoletageDateAndReceived.Fecha;
                if (ValidateRegularExpression.ValidateDateFormat(date))
                {
                    dateinitial  = (date.Substring(0, 2));
                    dateoptional = (date.Substring(2, 3));
                    datefinal    = Convert.ToInt32(dateinitial);
                    chagedate    = datefinal - 2;
                    if (chagedate == 00)
                    {
                        chagedate = 2;
                    }
                    if (chagedate == -1)
                    {
                        chagedate = 1;
                    }
                    dates_Suitable = chagedate + dateoptional;
                    if (dates_Suitable.Length < 5)
                    {
                        date_compare = Resources.Constants.ZERO + dates_Suitable;
                    }
                    else
                    {
                        date_compare = dates_Suitable;
                    }
                    if (Convert.ToDateTime(date_compare) >= today)
                    {
                        txtDateSelected.Text = date_compare;
                    }
                    else
                    {
                        txtDateSelected.Text = dateinitial + dateoptional;
                    }
                }
            }
            else
            {
                using (CommandsAPI objCommands = new CommandsAPI())
                {
                    result = objCommands.SendReceive(Resources.Constants.COMMANDS_WP);
                    WP     = true;
                }
                ERR__BoletageDateAndReceived.err_boletagedataandreceived(result);
                WP = false;
                ERR__BoletageDateAndReceived.IA = false;
                if (ERR__BoletageDateAndReceived.Status)
                {
                    date = ERR__BoletageDateAndReceived.Fecha;
                    if (ValidateRegularExpression.ValidateDateFormat(date))
                    {
                        dateinitial  = (date.Substring(0, 2));
                        dateoptional = (date.Substring(2, 3));
                        datefinal    = Convert.ToInt32(dateinitial);
                        chagedate    = datefinal - 2;
                        if (chagedate == 00)
                        {
                            chagedate = 2;
                        }
                        if (chagedate == -1)
                        {
                            chagedate = 1;
                        }
                        dates_Suitable = chagedate + dateoptional;
                        if (dates_Suitable.Length < 5)
                        {
                            date_compare = Resources.Constants.ZERO + dates_Suitable;
                        }
                        else
                        {
                            date_compare = dates_Suitable;
                        }
                        if (Convert.ToDateTime(date_compare) >= today)
                        {
                            txtDateSelected.Text = date_compare;
                        }
                        else
                        {
                            txtDateSelected.Text = dateinitial + dateoptional;
                        }
                    }
                }
                else
                {
                    using (CommandsAPI objCommands = new CommandsAPI())
                    {
                        result = objCommands.SendReceive(Resources.Constants.COMMANDS_AST_IA);
                    }
                    ERR__BoletageDateAndReceived.err_boletagedataandreceived(result);
                    if (ERR__BoletageDateAndReceived.IA)
                    {
                        date = ERR__BoletageDateAndReceived.Fecha;
                        if (ValidateRegularExpression.ValidateDateFormat(date))
                        {
                            dateinitial  = (date.Substring(0, 2));
                            dateoptional = (date.Substring(2, 3));
                            datefinal    = Convert.ToInt32(dateinitial);
                            chagedate    = datefinal - 2;
                            if (chagedate == 00)
                            {
                                chagedate = 2;
                            }
                            if (chagedate == -1)
                            {
                                chagedate = 1;
                            }
                            dates_Suitable = chagedate + dateoptional;
                            if (dates_Suitable.Length < 5)
                            {
                                date_compare = Resources.Constants.ZERO + dates_Suitable;
                            }
                            else
                            {
                                date_compare = dates_Suitable;
                            }
                            if (Convert.ToDateTime(date_compare) >= today)
                            {
                                txtDateSelected.Text = date_compare;
                            }
                            else
                            {
                                txtDateSelected.Text = dateinitial + dateoptional;
                            }
                        }
                    }
                }
            }
        }