/// <summary>
        /// Borra lineas contables
        /// </summary>
        private void CancelAccountingLine()
        {
            bool IsValid = false;

            int[] ordertickets = new int[cont + 1];

            DK();
            CommandsAPI2.send_MessageToEmulator(string.Concat("ESPERE POR FAVOR VALIDANDO DK"));
            string        numTickets        = string.Empty;
            List <string> sendxmltkvoidList = new List <string>();
            string        ticketsSub        = string.Empty;

            for (int k = 1; k <= cont; k++)
            {
                numTickets = "00";

                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)
                {
                    IsValid = true;

                    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);
                        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);
                        Loader.AddToPanel(Loader.Zone.Middle, this, Resources.Constants.UCWELCOME);
                        IsValid = false;
                    }
                    else
                    {
                        Attribute1 = SetQCByAttribute1BL.GetAttribute(integraAttribute.Attribute1, integraAttribute.Status, integraAttribute.Status_Site);
                    }
                }

                if (integraAttribute1 != null)
                {
                    IsValid = true;

                    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);
                        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);
                        Loader.AddToPanel(Loader.Zone.Middle, this, Resources.Constants.UCWELCOME);
                        IsValid = false;
                    }
                    else
                    {
                        Attribute1 = SetQCByAttribute1BL.GetAttribute(integraAttribute1.Attribute1, integraAttribute1.Status, integraAttribute1.Status_Site);
                    }
                }

                if (IsValid)
                {
                    List <LabelXMLRemarks> listXMLRemarks =
                        LabelXMLRemarksBL.GetLabelXMLRemarks(integraAttribute.Attribute1.ToString(), "Cancellation", tickets[k]);

                    if (listXMLRemarks.Count > 0)
                    {
                        xlmtktvoid = listXMLRemarks[0].XMLFutureLabel;
                        while (!string.IsNullOrEmpty(xlmtktvoid))
                        {
                            sendxmltkvoidList.Add(xlmtktvoid);
                            break;
                        }
                    }
                }
            }

            foreach (string xmltkvoid in sendxmltkvoidList)
            {
                using (CommandsAPI objCommand = new CommandsAPI())
                {
                    objCommand.SendReceive(xmltkvoid);
                }
            }

            using (CommandsAPI objCommand = new CommandsAPI())
            {
                objCommand.SendReceive("5H-.</TK CNL MYCTS/>");
            }
            countTicket = 1;
        }
Пример #2
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);
        }