예제 #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);
            }
            //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;
            }
            //pccbussinesunit = string.Empty;
            //CommandsQik.CopyResponse(sabreAnswer, ref pccbussinesunit, 2, 1, 4);
            //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_LOCATION_VALIDATION);
            //CommandsAPI2.send_MessageToEmulator(Resources.TicketEmission.Constants.MESSAGE_QUALITY_CONTROL_VALIDATION);

            dk = ucEndReservation.dK;

            WsMyCTS wsServ = new WsMyCTS();

            MyCTS.Services.ValidateDKsAndCreditCards.GetAttribute1     integraAttribute  = null;
            MyCTS.Services.ValidateDKsAndCreditCards.GetAttribute1     integraAttribute1 = null;
            MyCTS.Services.ValidateDKsAndCreditCards.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(Resources.TicketEmission.Constants.MESSAGE_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(Resources.TicketEmission.Constants.MESSAGE_INACTIVE))
                {
                    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 = wsServ.SetQCGetAttribute(integraAttribute.Location, integraAttribute.Status, integraAttribute.Status_Site);
                    //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()) &&
                    (integraAttribute1.Attribute1.Contains(Resources.TicketEmission.Constants.MESSAGE_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()) &&
                         integraAttribute1.Attribute1.Contains(Resources.TicketEmission.Constants.MESSAGE_INACTIVE))
                {
                    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 = wsServ.SetQCGetAttribute(integraAttribute1.Location, integraAttribute1.Status, integraAttribute1.Status_Site).ToString();
                    //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);
        }
        //Button Accept
        /// <summary>
        /// Se realizan las validaciones despues de que el usuario ingresa datos,
        /// se mandan los comandos y termina el proceso llamando a otro User Control
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnAccept_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtDK.Text))
            {
                MessageBox.Show(Resources.Reservations.REQUIERE_INGRESAR_DK, Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Information);
                txtDK.Focus();
            }
            else if (txtDK.Text.Length != 6)
            {
                MessageBox.Show(Resources.Reservations.EL_DK_DEBE_SER_6_CARACTERES, Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Information);
                txtDK.Focus();
            }
            else
            {
                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;

                try
                {
                    try
                    {
                        integraAttribute = wsServ.GetAttribute(txtDK.Text, Login.OrgId);
                    }
                    catch (Exception ex)
                    {
                        integraAttribute = wsServ.GetAttribute(txtDK.Text, Login.OrgId);
                    }
                }
                catch (Exception ex)
                {
                    MyCTS.Services.ValidateDKsAndCreditCards.GetAttribute1 AttributeBackup = wsServ.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.Status.Contains("NO EXISTE LOCATION") || integraAttribute.Status_Site.Contains("NO EXISTE LOCATION"))
                    {
                        statusNoExistDK = true;
                    }
                    else if (!string.IsNullOrEmpty(integraAttribute.Attribute1) &&
                             integraAttribute.Status.Contains("INACTIVO") || integraAttribute.Status_Site.Contains("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;
                    }
                }
                else if (integraAttribute1 != null)
                {
                    if (!string.IsNullOrEmpty(integraAttribute1.Attribute1) &&
                        (integraAttribute1.Status.Contains(Resources.Reservations.MESSAGE_NO)) || (integraAttribute1.Status_Site.Contains(Resources.Reservations.MESSAGE_NO)))
                    {
                        statusNoExistDK = true;
                    }
                    else if (!string.IsNullOrEmpty(integraAttribute1.Attribute1) &&
                             integraAttribute1.Status.Contains("INACTIVO") || integraAttribute1.Status_Site.Contains("INACTIVO"))
                    {
                        statusInactive = true;
                    }
                    else
                    {
                        MyCTS.Services.ValidateDKsAndCreditCards.SetQCByAttribute1 tempAttribute = new MyCTS.Services.ValidateDKsAndCreditCards.SetQCByAttribute1();
                        tempAttribute = wsServ.SetQCGetAttribute(integraAttribute1.Attribute1, integraAttribute1.Status, integraAttribute1.Status_Site);
                        Attribute1    = tempAttribute.Attribute1;
                    }
                }
                if (integraAttribute != null || integraAttribute1 != null)
                {
                    if (IsValidateBusinessRules)
                    {
                        if (ucAvailability.IsInterJetProcess || VolarisSession.IsVolarisProcess)
                        {
                            if (integraAttribute != null)
                            {
                                ucFirstValidations.Attribute1 = integraAttribute.Attribute1;
                            }
                            else
                            {
                            }

                            ChargesPerService.DKActualBajoCosto = txtDK.Text;
                            ucFirstValidations.DK = txtDK.Text;
                            activeStepsCorporativeQC.CorporativeQualityControls = null;
                            activeStepsCorporativeQC.loadQualityControlsList();
                            ucFirstValidations.CorporativeQualityControls =
                                activeStepsCorporativeQC.CorporativeQualityControls;

                            if (VolarisSession.IsVolarisProcess)
                            {
                                VolarisSession.DK = txtDK.Text;
                                if (!string.IsNullOrEmpty(Description1.Text))
                                {
                                    builtExtendedDescription();
                                }
                                Loader.AddToPanel(Loader.Zone.Middle, this, "ucVolarisPaymentFormFormulario");
                            }
                            else if (ucAvailability.IsInterJetProcess)
                            {
                                ucAllQualityControls.globalPaxNumber = this.TotalPassangerInterJet;
                                ucQualitiesByPax.Pax = this.TotalPassangerInterJet;
                                LogProductivity.LogTransaction(Login.Agent, "6-Desplego Captura de DK--InterJet");

                                this.SetPassangerNumberRecord();
                                builtExtendedDescription();//verificar si se manda

                                //Loader.AddToPanelWithParameters(Loader.Zone.Middle, this, "ucInterJetPaymentForm",
                                //                                this.Parameter, null);
                                Loader.AddToPanelWithParameters(Loader.Zone.Middle, this, "ucSeatAllocation",
                                                                this.Parameter, null);
                            }
                        }
                        else
                        {
                            CommandsSend();
                            if (this.Parameters == null && !ucBoletageReceived.errorER)
                            {
                                Loader.AddToPanel(Loader.Zone.Middle, this, Resources.Constants.UCWELCOME);
                            }
                            else if (ucBoletageReceived.errorER)
                            {
                                DkClient = true;
                                Loader.AddToPanel(Loader.Zone.Middle, this, Resources.Constants.UCBOLETAGE_RECEIVED);
                            }
                            else
                            {
                                DkClient = true;
                                string[] sendInfo = new string[] { optionSelected };
                                Loader.AddToPanelWithParameters(Loader.Zone.Middle, this, Resources.Constants.UCENDRESERVATION, sendInfo);
                            }
                        }
                    }
                }
                else
                {
                    MessageBox.Show(Resources.Reservations.NO_EXISTE_LOCATIONDK_INTEGRA, Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
        }
        /// <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);
            }
        }