Example #1
0
        /// <summary>
        ///  Obtención de record localizador, >DK y carga de quality controls para
        /// Corporativo
        /// </summary>
        private bool GetLocatorRecord()
        {
            bool IsValid = true;

            send        = string.Empty;
            sabreAnswer = string.Empty;
            send        = Resources.TicketEmission.Constants.COMMANDS_AST_A;
            using (CommandsAPI objCommand = new CommandsAPI())
            {
                sabreAnswer = objCommand.SendReceive(send);
            }
            sabreAnswer = sabreAnswer.Replace("‡", "\n");
            string[] sabreAnswerInfo = sabreAnswer.Split(new char[] { '\n' });
            if (sabreAnswerInfo[0].Length > 6)
            {
                locatorrecord = string.Empty;
            }
            else
            {
                locatorrecord = string.Empty;
                CommandsQik.CopyResponse(sabreAnswer, ref locatorrecord, 1, 1, 6);
            }
            send = Resources.TicketEmission.Constants.AST + locatorrecord;
            using (CommandsAPI objCommand = new CommandsAPI())
            {
                sabreAnswer = objCommand.SendReceive(send);
            }

            CommandsQik.searchResponse(sabreAnswer, Resources.TicketEmission.ValitationLabels.WARNING, ref row, ref col, 2, 3, 1, 64);
            string[] sabreAnswerWar = sabreAnswer.Split('\n');
            if (sabreAnswerWar[0] == Resources.TicketEmission.ValitationLabels.WARNING)
            {
                MessageBox.Show(Resources.TicketEmission.Tickets.WARNING___PNR_MODIFICATION_IN_PROGRESS, Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                //UC = "welcome";
                Loader.AddToPanel(Loader.Zone.Middle, this, Resources.Constants.UCWELCOME);
                IsValid = false;
            }

            else if (sabreAnswerWar[0] == Resources.TicketEmission.ValitationLabels.PNR_IGNORED_AND_REDISPLAYED)
            {
                MessageBox.Show(Resources.TicketEmission.Tickets.WARNING___PNR_MODIFICATION_IN_PROGRESS, Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                //UC = "welcome";
                Loader.AddToPanel(Loader.Zone.Middle, this, Resources.Constants.UCWELCOME);
                IsValid = false;
            }
            else if (sabreAnswerWar[0] == Resources.TicketEmission.ValitationLabels.SIMULTANEOUS_CHANGES)
            {
                MessageBox.Show(Resources.TicketEmission.Tickets.WARNING___PNR_MODIFICATION_IN_PROGRESS, Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                //UC = "welcome";
                Loader.AddToPanel(Loader.Zone.Middle, this, Resources.Constants.UCWELCOME);
                IsValid = false;
            }

            else
            {
                //locatorrecord = "hola";//solo para pruebas sin cerrar record
                if (string.IsNullOrEmpty(locatorrecord))
                {
                    MessageBox.Show(Resources.TicketEmission.Tickets.RECORD_NO_CERRADO, Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    //UC = "welcome";
                    Loader.AddToPanel(Loader.Zone.Middle, this, Resources.Constants.UCWELCOME);
                    IsValid = false;
                }

                send        = string.Empty;
                sabreAnswer = string.Empty;
                send        = Resources.TicketEmission.Constants.COMMANDS_AST_PDK;
                using (CommandsAPI objCommand = new CommandsAPI())
                {
                    sabreAnswer = objCommand.SendReceive(send);
                }

                col = 0;
                row = 0;
                CommandsQik.searchResponse(sabreAnswer, Resources.TicketEmission.ValitationLabels.CUSTOMER_NUMBER, ref row, ref col, 1, 2, 1, 64);
                if (row != 0 || col != 0)
                {
                    dk = string.Empty;
                    CommandsQik.CopyResponse(sabreAnswer, ref dk, row, 19, 6);
                }
                CommandsAPI2.send_MessageToEmulator(Resources.TicketEmission.Constants.MESSAGE_QUALITY_CONTROL_VALIDATION);

                WsMyCTS wsServ = new WsMyCTS();
                MyCTS.Services.ValidateDKsAndCreditCards.GetAttribute1 integraAttribute  = null;
                MyCTS.Services.ValidateDKsAndCreditCards.GetAttribute1 integraAttribute1 = null;

                MyCTS.Entities.SetQCByAttribute1 Attribute1 = null;
                if (!string.IsNullOrEmpty(dk))
                {
                    try
                    {
                        try
                        {
                            integraAttribute = wsServ.GetAttribute(dk, Login.OrgId);
                        }
                        catch
                        {
                            integraAttribute = wsServ.GetAttribute(dk, Login.OrgId);
                        }
                    }
                    catch
                    {
                        IsValid = LocationValidationBackup();
                    }
                }
                if (integraAttribute != null)
                {
                    if (!string.IsNullOrEmpty(integraAttribute.Attribute1.ToString()) &&
                        (integraAttribute.Attribute1.Contains("NO EXISTE LOCATION")))
                    {
                        MessageBox.Show(Resources.TicketEmission.Tickets.NO_LOCATION_INTEGRA, Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        //UC = "welcome";
                        Loader.AddToPanel(Loader.Zone.Middle, this, Resources.Constants.UCWELCOME);
                        IsValid = false;
                    }
                    else if (!string.IsNullOrEmpty(integraAttribute.Attribute1.ToString()) &&
                             integraAttribute.Attribute1.Contains("INACTIVO"))
                    {
                        MessageBox.Show(Resources.TicketEmission.Tickets.NUM_CLIENTE_O_LOCATION_INACTIVO, Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        //UC = "welcome";
                        Loader.AddToPanel(Loader.Zone.Middle, this, Resources.Constants.UCWELCOME);
                        IsValid = false;
                    }
                    else
                    {
                        Attribute1 = SetQCByAttribute1BL.GetAttribute(integraAttribute.Attribute1, integraAttribute.Status, integraAttribute.Status_Site);
                        attribute1 = Attribute1.Attribute1.ToString();
                        activeStepsCorporativeQC.CorporativeQualityControls = null;
                        activeStepsCorporativeQC.loadQualityControlsList();
                        CorporativeQualityControls = activeStepsCorporativeQC.CorporativeQualityControls;
                    }
                }
                else if (integraAttribute1 != null)
                {
                    if (!string.IsNullOrEmpty(integraAttribute1.Attribute1.ToString()) &&
                        (integraAttribute.Attribute1.Contains("NO EXISTE LOCATION")))
                    {
                        MessageBox.Show(Resources.TicketEmission.Tickets.NO_LOCATION_INTEGRA, Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        //UC = "welcome";
                        Loader.AddToPanel(Loader.Zone.Middle, this, Resources.Constants.UCWELCOME);
                        IsValid = false;
                    }
                    else if (!string.IsNullOrEmpty(integraAttribute1.Attribute1.ToString()) &&
                             integraAttribute.Attribute1.Contains("INACTIVO"))
                    {
                        MessageBox.Show(Resources.TicketEmission.Tickets.NUM_CLIENTE_O_LOCATION_INACTIVO, Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        //UC = "welcome";
                        Loader.AddToPanel(Loader.Zone.Middle, this, Resources.Constants.UCWELCOME);
                        IsValid = false;
                    }
                    else
                    {
                        Attribute1 = SetQCByAttribute1BL.GetAttribute(integraAttribute1.Attribute1, integraAttribute1.Status, integraAttribute1.Status_Site);
                        attribute1 = Attribute1.Attribute1.ToString();
                        activeStepsCorporativeQC.CorporativeQualityControls = null;
                        activeStepsCorporativeQC.loadQualityControlsList();
                        CorporativeQualityControls = activeStepsCorporativeQC.CorporativeQualityControls;
                    }
                }
                else
                {
                    IsValid = LocationValidationBackup();
                }
            }
            return(IsValid);
        }
Example #2
0
        /// <summary>
        /// Connects to back up server.
        /// </summary>
        /// <param name="reservation">The reservation.</param>
        private void ConnectToBackUpServer(VolarisReservation reservation)
        {
            try
            {
                WsMyCTS wsServ = new WsMyCTS();

                //var oracleConnection = new OracleConnection();
                MyCTS.Services.ValidateDKsAndCreditCards.GetAttribute1 integraAttribute = wsServ.GetAttribute(UserDK, LogOrId);
                //Services.MyCTSOracleConnectionDev.GetAttribute1 integraAttribute = oracleConnection.GetAttribute1Dev(UserDK, LogOrId);

                if (integraAttribute != null)
                {
                    SetCustomerAttributes(reservation, UserDK, integraAttribute.Status, integraAttribute.Status_Site,
                                          integraAttribute.Attribute1);
                }
                else
                {
                    SetCustomerAttributes(reservation, UserDK, string.Empty, string.Empty,
                                          string.Empty);
                }
            }
            catch (Exception exe)
            {
                SetCustomerAttributes(reservation, UserDK, string.Empty, string.Empty,
                                      string.Empty);
            }
        }
        /// <summary>
        /// Validaciones y envio de comandos
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnAccept_Click(object sender, EventArgs e)
        {
            #region ====== Validation of predictive ====

            CommandsAPI2.send_MessageToEmulator(string.Concat(Resources.Reservations.ESPERE_FAVOR_VALIDANDO_DK_INTEGRA));
            statusNoExistDK = false;
            statusInactive  = false;
            WsMyCTS wsServ = new WsMyCTS();
            MyCTS.Services.ValidateDKsAndCreditCards.GetAttribute1 integraAttribute  = null;
            MyCTS.Services.ValidateDKsAndCreditCards.GetAttribute1 integraAttribute1 = null;

            //OracleConnection OracleConnection = new OracleConnection();
            //MyCTS.Services.MyCTSOracleConnection.GetAttribute1 integraAttribute = null;
            //MyCTS.Services.MyCTSOracleConnectionDev.GetAttribute1 integraAttribute1 = null;

            try
            {
                try
                {
                    integraAttribute = wsServ.GetAttribute(txtDK.Text, Login.OrgId);
                    //integraAttribute = OracleConnection.GetAttribute1(txtDK.Text, Login.OrgId);
                }
                catch
                {
                    integraAttribute = wsServ.GetAttribute(txtDK.Text, Login.OrgId);
                    //integraAttribute1 = OracleConnection.GetAttribute1Dev(txtDK.Text, Login.OrgId);
                }
            }
            catch
            {
                MyCTS.Services.ValidateDKsAndCreditCards.GetAttribute1 AttributeBackup = wsServ.GetAttribute(txtDK.Text, Login.OrgId);
                //GetAndSetAttributeBackup AttributeBackup = GetAndSetAttributeBackupBL.GetAttribute(txtDK.Text, Login.OrgId);
                if (AttributeBackup != null)
                {
                    if (!string.IsNullOrEmpty(AttributeBackup.Attribute1.ToString()) &&
                        (AttributeBackup.Attribute1.Contains(Resources.Reservations.MESSAGE_NO)))
                    {
                        statusNoExistDK = true;
                    }
                    else if (!string.IsNullOrEmpty(AttributeBackup.Attribute1.ToString()) &&
                             AttributeBackup.Attribute1.Contains(Resources.Reservations.MESSAGE_INACTIVO))
                    {
                        statusInactive = true;
                    }
                }
            }
            if (integraAttribute != null)
            {
                if (!string.IsNullOrEmpty(integraAttribute.Attribute1) &&
                    (integraAttribute.Attribute1.Contains(Resources.Reservations.MESSAGE_NO)))
                {
                    statusNoExistDK = true;
                }
                else if (!string.IsNullOrEmpty(integraAttribute.Attribute1) &&
                         integraAttribute.Attribute1.Contains(Resources.Reservations.MESSAGE_INACTIVO))
                {
                    statusInactive = true;
                }
                else
                {
                    MyCTS.Services.ValidateDKsAndCreditCards.SetQCByAttribute1 tempAttribute = new MyCTS.Services.ValidateDKsAndCreditCards.SetQCByAttribute1();
                    tempAttribute = wsServ.SetQCGetAttribute(integraAttribute.Attribute1, integraAttribute.Status, integraAttribute.Status_Site);
                    Attribute1    = tempAttribute.Attribute1;

                    //SetQCByAttribute1 tempAttribute = new SetQCByAttribute1();
                    //tempAttribute = SetQCByAttribute1BL.GetAttribute(integraAttribute.Attribute1, integraAttribute.Status, integraAttribute.Status_Site);
                    //Attribute1 = tempAttribute.Attribute1;
                }
            }
            else if (integraAttribute1 != null)
            {
                if (!string.IsNullOrEmpty(integraAttribute1.Attribute1) &&
                    (integraAttribute1.Attribute1.Contains(Resources.Reservations.MESSAGE_NO)))
                {
                    statusNoExistDK = true;
                }
                else if (!string.IsNullOrEmpty(integraAttribute1.Attribute1) &&
                         integraAttribute1.Attribute1.Contains(Resources.Reservations.MESSAGE_INACTIVO))
                {
                    statusInactive = true;
                }
                else
                {
                    MyCTS.Services.ValidateDKsAndCreditCards.SetQCByAttribute1 tempAttribute = new MyCTS.Services.ValidateDKsAndCreditCards.SetQCByAttribute1();
                    tempAttribute = wsServ.SetQCGetAttribute(integraAttribute.Attribute1, integraAttribute.Status, integraAttribute.Status_Site);
                    Attribute1    = tempAttribute.Attribute1;

                    //SetQCByAttribute1 tempAttribute = new SetQCByAttribute1();
                    //tempAttribute = SetQCByAttribute1BL.GetAttribute(integraAttribute1.Attribute1, integraAttribute1.Status, integraAttribute1.Status_Site);
                    //Attribute1 = tempAttribute.Attribute1;
                }
            }
            else
            {
                MyCTS.Services.ValidateDKsAndCreditCards.GetAttribute1 AttributeBackup = wsServ.GetAttribute(txtDK.Text, Login.OrgId);

                //GetAndSetAttributeBackup AttributeBackup = GetAndSetAttributeBackupBL.GetAttribute(txtDK.Text, Login.OrgId);
                if (AttributeBackup != null)
                {
                    if (!string.IsNullOrEmpty(AttributeBackup.Attribute1.ToString()) &&
                        (AttributeBackup.Attribute1.Contains(Resources.Reservations.MESSAGE_NO)))
                    {
                        statusNoExistDK = true;
                    }
                    else if (!string.IsNullOrEmpty(AttributeBackup.Attribute1.ToString()) &&
                             AttributeBackup.Attribute1.Contains(Resources.Reservations.MESSAGE_INACTIVO))
                    {
                        statusInactive = true;
                    }
                }
            }

            List <CatAirlines> airList = CatAirlinesBL.GetAirlines(txtAirline.Text);
            if (airList.Count.Equals(0))
            {
                statusValidateAir = true;
            }
            else
            {
                statusValidateAir = false;
            }
            List <AirPortCityCountry> airPortList = AirPortCityCountryBL.GetAirPortCityCountry(txtOriginCity.Text);
            if (airPortList.Count.Equals(0))
            {
                statusValidateAirPort = true;
            }
            else
            {
                statusValidateAirPort = false;
            }

            #endregion

            if (IsValidateBusinessRules)
            {
                CommandsSend();
                Loader.AddToPanel(Loader.Zone.Middle, this, Resources.Constants.UCWELCOME);
            }
        }