/// <summary> /// Se envia el comando de acuerdo a los campos ingresados /// </summary> private void CommandsSend() { int row = 0; int col = 0; string result = string.Empty; string sabre = string.Empty; string change = string.Empty; bool notcontinue = false; string send = string.Concat("HB", txtNumberFirm.Text); sabre = string.Concat("H/AUTH BY ", txtAuthorization.Text); change = string.Concat("HH/A", txtAgentCode.Text); using (CommandsAPI objCommand = new CommandsAPI()) { result = objCommand.SendReceive(send); } CommandsQik.searchResponse(result, "NEW EMPLOYEE", ref row, ref col); if (row != 0 || col != 0) { using (CommandsAPI objCommand = new CommandsAPI()) { objCommand.SendReceive("I"); } MessageBox.Show(Resources.Reservations.LA_FIRMA_NO_EXISTE, Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Information); notcontinue = true; } if (!notcontinue) { using (CommandsAPI objCommand = new CommandsAPI()) { objCommand.SendReceive(sabre); result = objCommand.SendReceive(change); } CommandsQik.searchResponse(result, "DUP", ref row, ref col); if (row != 0 || col != 0) { row = 0; col = 0; MessageBox.Show(Resources.Reservations.INICIALES_YA_EXISTEN_INGRESE_OTRAS, Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Information); } CommandsQik.searchResponse(result, "DONE", ref row, ref col); if (row != 0 || col != 0) { using (CommandsAPI objCommand = new CommandsAPI()) { objCommand.SendReceive("I"); } CommandsAPI2.send_MessageToEmulator(string.Concat(Resources.Reservations.CODIGO_CAMBIADO_CON_EXITO)); UpdateUsersBL.UpdateUsers(txtNumberFirm.Text, txtPCC.Text, txtAgentCode.Text, null, null); MessageBox.Show(Resources.Reservations.CAMBIO_CODIGO_AGENTE_EXITOSO, Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Information); Loader.AddToPanel(Loader.Zone.Middle, this, Resources.Constants.UCWELCOME); } } }
private void btnAcept_Click(object sender, EventArgs e) { if (IsValidBusinessRules) { //LoginEAreaValidation(); if (!isMessageShown) { PresentRecordValidation(); if (!isMessageShown) { if (rdoGenerate.Checked.Equals(true)) { command = string.Concat("WFR", txtCommand.Text); EvaluateCommand(); CommandQREX = command; using (CommandsAPI objCommand = new CommandsAPI()) { CommandsAPI2.send_MessageToEmulator(Resources.TicketEmission.Constants.PLEASE_WAIT); objCommand.SendReceive(Resources.Constants.COMMANDS_PPO, 0, 0); string res = objCommand.SendReceive("*S", 0, 0); if (res.Substring(0, 4).Equals("3L64")) { objCommand.SendReceive(Resources.Constants.COMMANDS_PPS5, 0, 0); } else { objCommand.SendReceive(Resources.Constants.COMMANDS_PPS1, 0, 0); } } ucMenuReservations.qualityControls = true; Loader.AddToPanel(Loader.Zone.Middle, this, Resources.TicketEmission.Constants.UCFIRST_VALIDATIONS); } else { using (CommandsAPI objCommand = new CommandsAPI()) { command = string.Concat("WFR", txtCommand.Text); CommandsAPI2.send_MessageToEmulator(Resources.TicketEmission.Constants.PLEASE_WAIT); objCommand.SendReceive(Resources.Constants.COMMANDS_PTR_SLASH_END, 0, 0); objCommand.SendReceive(command); Loader.AddToPanel(Loader.Zone.Middle, this, Resources.Constants.UCWELCOME); } } } } } }
/// <summary> /// Validación del pcc /// </summary> private void PccValidation() { using (CommandsAPI objCommand = new CommandsAPI()) { CommandsAPI2.send_MessageToEmulator(Resources.TicketEmission.Constants.PLEASE_WAIT); objCommand.SendReceive(Resources.Constants.COMMANDS_PPO, 0, 0); string res = objCommand.SendReceive("*S", 0, 0); if (res.Substring(0, 4).Equals("3L64")) { objCommand.SendReceive(Resources.Constants.COMMANDS_PPS5, 0, 0); } else { objCommand.SendReceive(Resources.Constants.COMMANDS_PPS1, 0, 0); } } }
private void ucGetDIX_Load(object sender, EventArgs e) { ucAvailability.IsInterJetProcess = false; txtPNR.Focus(); string send = "*A"; string sabreAnswer = string.Empty; string pnr = string.Empty; using (CommandsAPI objCommand = new CommandsAPI()) { sabreAnswer = objCommand.SendReceive(send); } string resultAux = sabreAnswer.Replace("‡", "\n"); string[] sabreAnswerInfo = resultAux.Split(new char[] { '\n' }); int row = 0; int col = 0; CommandsQik.searchResponse(sabreAnswer, "NO DATA", ref row, ref col); if (row != 0 && col >= 0) { MessageBox.Show("NO EXISTE RECORD PRESENTE", Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Information); Loader.AddToPanel(Loader.Zone.Middle, this, Resources.Constants.UCWELCOME); } else if (sabreAnswerInfo.Length > 0 && sabreAnswerInfo[0].Length == 6 && ValidateRegularExpression.ValidatePNR(sabreAnswerInfo[0])) { CommandsAPI2.send_MessageToEmulator("CTP EDITS IN PROGRESS....PLEASE WAIT....\n" + "OK " + sabreAnswerInfo[0] + "\nEXPORT I AND I IN PROGRESS"); txtPNR.Text = sabreAnswerInfo[0]; using (CommandsAPI objCommand = new CommandsAPI()) { objCommand.SendReceive("I", 0, 0); } GetInformationDIX(); } else { MessageBox.Show("IGNORE Y RECUPERE EL RECORD", Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Information); Loader.AddToPanel(Loader.Zone.Middle, this, Resources.Constants.UCWELCOME); } }
/// <summary> /// Llamado al servicio web que va extraer los datos del /// record localizador del cual se este emitiendo un boleto /// </summary> public void GetValuesWebServices(string recLoc) { try { CommandsAPI2.send_MessageToEmulator("DOCUMENTANDO RESERVA, FAVOR DE ESPERAR.........."); using (WSSessionSabre obj = new WSSessionSabre()) { obj.OpenConnection(); if (obj.IsConnected) { myObject = new OTATravelItinerary().TravelItineraryMethod(obj.ConversationId, obj.IPcc, obj.SecurityToken, recLoc); if (myObject != null && myObject.Status) { InsertDetailsPNR(recLoc); } } } } catch { } }
private void SendMessageToHostCallBack(string command) { if (this.InvokeRequired) { this.Invoke(new SendMessageToHost(SendMessageToHostCallBack), command); } else { CommandsActions commandAction = ListCommandsActions.Find(delegate(CommandsActions c) { return(c.Command.Equals(command)); }); if (commandAction != null) { if (commandAction.CommandType.Equals(COMMANDTYPE_MSG)) { string msg = commandAction.Message; //MessageBox.Show(msg); CommandsAPI2.send_MessageToEmulator(msg); } else if (commandAction.CommandType.Equals(COMMANDTYPE_UC)) { pnlMiddle.Controls.Clear(); pnlMiddle.Controls.Add(Loader.GetReferenceUserControl(commandAction.ModuleSrc)); } } else { if (command.Contains("§")) { CommandsAPI2.send_MessageToEmulator("FORMATO NO DISPONIBLE"); } } } }
/// <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; }
/// <summary> /// Se envia el comando de acuerdo a los campos ingresados /// </summary> private void CommandsSend() { send = Resources.Constants.COMMANDS_WV + txtNumberLine.Text; using (CommandsAPI objCommand = new CommandsAPI()) { result = objCommand.SendReceive(send); } CommandsQik.searchResponse(result, Resources.ErrorMessages.VOID_MSG_SENT_WITHIN_BSP_APPROVED, ref row, ref col); if (row != 0 || col != 0) { cancelTicket = true; sendInfo = tktvoid; CancelTicket = true; if (!string.IsNullOrEmpty(tktvoid)) { existTKT = true; } row = 0; col = 0; } CommandsQik.searchResponse(result, Resources.ErrorMessages.VOID_MESSAGE_SENT, ref row, ref col); if (row != 0 || col != 0) { cancelTicket = true; sendInfo = tktvoid; CancelTicket = true; if (!string.IsNullOrEmpty(tktvoid)) { existTKT = true; } row = 0; col = 0; } CommandsQik.searchResponse(result, Resources.ErrorMessages.NUMBER_PREVIOUSLY_VOIDED, ref row, ref col); if (row != 0 || col != 0) { cont = cont - 1; cancelTicket = true; MessageBox.Show(Resources.Reservations.BOLETO_CANCELADO, Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Information); cancelTKT = true; txtNumberLine.Text = string.Empty; txtNumberLine.Focus(); row = 0; col = 0; } CommandsQik.searchResponse(result, Resources.ErrorMessages.REENT_IF, ref row, ref col); if (row != 0 || col != 0) { cancelTicket = true; if (ValidateVICACancelTicket()) { string body = Resources.BodyMailCancelTicketResources.BODY; body = body.Replace("[*usuario*]", Login.NombreCompleto); body = body.Replace("[*boleto*]", tickets[countTicket]); countTicket++; //SendEmail("*****@*****.**", "mirera01", "MyCTS", Login.Mail, "", "Cancelación de Boleto", body, "", true); } row = 0; col = 0; } CommandsQik.searchResponse(result, Resources.ErrorMessages.VOID_EXCHANGE_RESTRICTED_BYCARRIER, ref row, ref col); if (row != 0 || col != 0) { MessageBox.Show(Resources.Reservations.BOLETO_NO_PUEDE_SER_CANCELADO, Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Information); invalidCommand = false; Loader.AddToPanel(Loader.Zone.Middle, this, Resources.Constants.UCWELCOME); } else if (!cancelTicket) { cont = cont - 1; cancelTKT = true; MessageBox.Show(Resources.Reservations.OCURRIO_ERROR_CANCELAR_BOLETO, Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Information); ShowInformation(false); txtNumberLine.Focus(); } if (invalidCommand) { CommandsAPI2.send_MessageToEmulator(string.Concat("CANCELADO")); } cancelTicket = false; }
/// <summary> /// Se envia el comando de acuerdo a los campos ingresados /// </summary> private void CommandsSend() { User usuarioDto = null; usuarioDto = UserBL.GetUser(txtNumberFirm.Text, txtPCC.Text); if (rbnBoth.Checked) { int row = 0; int col = 0; string result = string.Empty; string sabre = string.Empty; using (CommandsAPI objCommand = new CommandsAPI()) { objCommand.SendReceive(string.Concat("QMOV/", usuarioDto.PCC, usuarioDto.Queue, "/", usuarioDto.PCC, "152")); } string send = string.Concat("HB", txtNumberFirm.Text); using (CommandsAPI objCommand = new CommandsAPI()) { result = objCommand.SendReceive(send); } CommandsQik.searchResponse(result, "NEW EMPLOYEE", ref row, ref col); if (row != 0 || col != 0) { row = 0; col = 0; MessageBox.Show(Resources.Reservations.LA_FIRMA_NO_EXISTE, Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Information); using (CommandsAPI objCommand = new CommandsAPI()) { result = objCommand.SendReceive("I"); } } else { send = string.Concat("H/AUTH BY ", txtAuthorization.Text); sabre = string.Concat("HX*REUSE"); using (CommandsAPI objCommand = new CommandsAPI()) { objCommand.SendReceive(send); result = objCommand.SendReceive(sabre); } CommandsQik.searchResponse(result, "DONE", ref row, ref col); if (row != 0 || col != 0) { send = string.Concat("QS/", txtPCC.Text, txtQueue.Text, "/D-", txtAgent.Text); using (CommandsAPI objCommand = new CommandsAPI()) { objCommand.SendReceive(send); } CommandsAPI2.send_MessageToEmulator(string.Concat(Resources.Reservations.FIRMA_ELIMINADA_EXITO)); //DeleteUsersBL.DeleteUsers(txtNumberFirm.Text, txtPCC.Text); EnableDisableFirmBL.EnableDisableFirm(txtNumberFirm.Text, txtPCC.Text, 2); Loader.AddToPanel(Loader.Zone.Middle, this, Resources.Constants.UCWELCOME); MessageBox.Show(Resources.Reservations.FIRMA_FUE_ELIMINADA_EXITO, Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show(Resources.Reservations.PRESENTO_ERROR, Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Information); using (CommandsAPI objCommand = new CommandsAPI()) { objCommand.SendReceive("I"); } } } if (!string.IsNullOrEmpty(usuarioDto.Firm)) { UpdateStatusAllFirmModulesBL.UpdateUnassignStatusTA(usuarioDto.TA); UpdateStatusAllFirmModulesBL.UpdateUnassignStatusQueue(usuarioDto.Queue); UpdateStatusAllFirmModulesBL.UpdateUnassignStatusAgent(usuarioDto.Agent); //UpdateStatusAllFirmModulesBL.UpdateUnassignStatusFirm(usuarioDto.Firm); } MessageBox.Show("FIRMA ELIMINADA CORRECTAMENTE", Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Information); } if (rbnMyCTS.Checked) { using (CommandsAPI objCommand = new CommandsAPI()) { objCommand.SendReceive(string.Concat("QMOV/", usuarioDto.PCC, usuarioDto.Queue, "/", usuarioDto.PCC, " 152")); } //DeleteUsersBL.DeleteUsers(txtNumberFirm.Text, txtPCC.Text); EnableDisableFirmBL.EnableDisableFirm(txtNumberFirm.Text, txtPCC.Text, 2); if (!string.IsNullOrEmpty(usuarioDto.Firm)) { UpdateStatusAllFirmModulesBL.UpdateUnassignStatusTA(usuarioDto.TA); UpdateStatusAllFirmModulesBL.UpdateUnassignStatusQueue(usuarioDto.Queue); UpdateStatusAllFirmModulesBL.UpdateUnassignStatusAgent(usuarioDto.Agent); //UpdateStatusAllFirmModulesBL.UpdateUnassignStatusFirm(usuarioDto.Firm); } MessageBox.Show("LA FIRMA FUE ELIMINADA CON ÉXITO DE MyCTS", Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Information); Loader.AddToPanel(Loader.Zone.Middle, this, Resources.Constants.UCWELCOME); } if (rbnSabre.Checked) { int row = 0; int col = 0; string result = string.Empty; string sabre = string.Empty; using (CommandsAPI objCommand = new CommandsAPI()) { objCommand.SendReceive(string.Concat("QMOV/", usuarioDto.PCC, usuarioDto.Queue, "/", usuarioDto.PCC, " 152")); } string send = string.Concat("HB", txtNumberFirm.Text); using (CommandsAPI objCommand = new CommandsAPI()) { result = objCommand.SendReceive(send); } CommandsQik.searchResponse(result, "NEW EMPLOYEE", ref row, ref col); if (row != 0 || col != 0) { row = 0; col = 0; MessageBox.Show(Resources.Reservations.LA_FIRMA_NO_EXISTE, Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Information); using (CommandsAPI objCommand = new CommandsAPI()) { result = objCommand.SendReceive("I"); } } else { send = string.Concat("H/AUTH BY ", txtAuthorization.Text); sabre = string.Concat("HX*REUSE"); using (CommandsAPI objCommand = new CommandsAPI()) { objCommand.SendReceive(send); result = objCommand.SendReceive(sabre); } CommandsQik.searchResponse(result, "DONE", ref row, ref col); if (row != 0 || col != 0) { send = string.Concat("QS/", txtPCC.Text, txtQueue.Text, "/D-", txtAgent.Text); using (CommandsAPI objCommand = new CommandsAPI()) { objCommand.SendReceive(send); } CommandsAPI2.send_MessageToEmulator(string.Concat(Resources.Reservations.FIRMA_ELIMINADA_EXITO)); Loader.AddToPanel(Loader.Zone.Middle, this, Resources.Constants.UCWELCOME); } else { MessageBox.Show(Resources.Reservations.PRESENTO_ERROR, Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Information); using (CommandsAPI objCommand = new CommandsAPI()) { objCommand.SendReceive("I"); } } } MessageBox.Show("FIRMA ELIMINADA CORRECTAMENTE", Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Armado del archivo excel(encabezado y contenido) y guardado en /// temporales /// </summary> private void CreateExcel() { if (SearchDQBAstETU) { ReportDBQBucle(); FixDQBETUReport(); Microsoft.VisualBasic.Devices.Computer MyComputer = new Microsoft.VisualBasic.Devices.Computer(); string fileName = string.Empty; int count = 0; #region Generacion documento Excel using (MyCTSExcel objExcel = new MyCTSExcel()) { objExcel.CreateExcelObject("MyCTS"); if (objExcel.IsObjectCreated) { fileName = MyComputer.FileSystem.SpecialDirectories.Temp; fileName = fileName + string.Format("\\TempFile_{0}.xls", Guid.NewGuid().ToString()); MyCTSExcel.Cell cell = null; cell = new MyCTSExcel.Cell(2, 2, titulo); cell.Bold = true; cell.Wide = 6; cell.Alignment = MyCTSExcel.Alignment.MiddleCenter; objExcel.CreateCell(cell); cell = new MyCTSExcel.Cell(3, 2, "ITM"); cell.Bold = true; objExcel.CreateCell(cell); cell = new MyCTSExcel.Cell(3, 3, "PASSENGER NAME"); cell.Bold = true; objExcel.CreateCell(cell); cell = new MyCTSExcel.Cell(3, 4, "TKT NUMBER"); cell.Bold = true; objExcel.CreateCell(cell); cell = new MyCTSExcel.Cell(3, 5, "DK NUMBER"); cell.Bold = true; objExcel.CreateCell(cell); cell = new MyCTSExcel.Cell(3, 6, "ORIGINAL DATE ISSUE"); cell.Bold = true; objExcel.CreateCell(cell); cell = new MyCTSExcel.Cell(3, 7, "DATE ADDED TO REPORT"); cell.Bold = true; objExcel.CreateCell(cell); cell = new MyCTSExcel.Cell(3, 8, "DATE TO BE PURGED FROM REPORT"); cell.Bold = true; objExcel.CreateCell(cell); #region Elementos2 count = 4; int numberPassengers = PassengerList.Count; progressBar1.Visible = true; progressBar1.Maximum = numberPassengers; progressBar1.Value = 0; CommandsAPI2.send_MessageToEmulator(Resources.TicketEmission.Constants.GENERATING_FILE_EXCEL); foreach (Passenger p in PassengerList) { cell = new MyCTSExcel.Cell(count, 2, p.Item); objExcel.CreateCell(cell); cell = new MyCTSExcel.Cell(count, 3, p.Name); objExcel.CreateCell(cell); cell = new MyCTSExcel.Cell(count, 4, p.TKTNumber); objExcel.CreateCell(cell); cell = new MyCTSExcel.Cell(count, 5, p.DKNumber); objExcel.CreateCell(cell); cell = new MyCTSExcel.Cell(count, 6, p.Original); objExcel.CreateCell(cell); cell = new MyCTSExcel.Cell(count, 7, p.DateAdd); objExcel.CreateCell(cell); cell = new MyCTSExcel.Cell(count, 8, p.DateToBe); objExcel.CreateCell(cell); progressBar1.Value = count - 3; if (count % 20 == 0) { CommandsAPI2.send_MessageToEmulator(Resources.TicketEmission.Constants.GENERATING_FILE_EXCEL); } count++; } #endregion objExcel.SaveFile(fileName); } } if (!string.IsNullOrEmpty(fileName)) { Process proc = new Process(); proc.StartInfo.Arguments = "\"" + fileName + "\""; proc.StartInfo.FileName = "EXCEL.EXE"; proc.Start(); } Loader.AddToPanel(Loader.Zone.Middle, this, Resources.Constants.UCWELCOME); #endregion } }
//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> /// Sends the message. /// </summary> /// <param name="msg">The MSG.</param> public void SendMessage(string msg) { CommandsAPI2.send_MessageToEmulator(msg); }
/// <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); }
/// <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); } }
//Evento click del Boton btnTicketEmission private void btnTicketEmission_Click(object sender, EventArgs e) { bool validAuthCode = true; string sabreAnswer = string.Empty; bool UsuarioValidoParaCargosPorServicio = false; // Validamos usuario para generar remark en el caso de las versiones anteriores UsuarioValidoParaCargosPorServicio = UsuarioValidoCargosPorServicio(); if (!UsuarioValidoParaCargosPorServicio) { for (int i = 0; i < ucServicesFeePayApply.lstDatosTarjeta.Count; i++) { if (ucServicesFeePayApply.lstDatosTarjeta[i].MontoCargo != 0) { string sError = string.Empty; ChargesPerService.BuilCommandToSendOld(ucServicesFeePayApply.lstDatosTarjeta[i].PaxNumber, ucServicesFeePayApply.lstDatosTarjeta[i]); } } } if (string.IsNullOrEmpty(ucTicketsEmissionInstructions.CodeAuth.Code)) { if (!string.IsNullOrEmpty(ucFormPayment.CommandGetAuthorizationCode)) { if (!string.IsNullOrEmpty(ucPromo.PromoCode)) { ucFormPayment.CommandGetAuthorizationCode = string.Concat(ucFormPayment.CommandGetAuthorizationCode, "*", ucPromo.PromoCode, "/*C", ucFormPayment.SecurityCode); } else { ucFormPayment.CommandGetAuthorizationCode = string.Concat(ucFormPayment.CommandGetAuthorizationCode, "/*C", ucFormPayment.SecurityCode); } using (CommandsAPI2 objCommand = new CommandsAPI2()) { sabreAnswer = objCommand.SendReceive(ucFormPayment.CommandGetAuthorizationCode, 0, 0, 4000); } ucPromo.PromoCode = string.Empty; if (sabreAnswer.Contains(Resources.TicketEmission.Constants.OK)) { string[] sabreArray = sabreAnswer.Replace("\n", "-").Split('-'); for (int i = 0; i < sabreArray.Length; i++) { int row = 0; int col = 0; CommandsQik.searchResponse(sabreArray[i], Resources.TicketEmission.Constants.OK, ref row, ref col, 1, 2); if (row != 0 || col != 0) { CommandsQik.CopyResponse(sabreArray[i], ref authCode, 1, 4, 6); } } if (!string.IsNullOrEmpty(authCode)) { if (ucTicketsEmissionInstructions.wayPayment == Resources.TicketEmission.Constants.PAYMENT_MIXPAYMENT) { ucFormPayment.FormPayment = string.Concat(ucFormPayment.FormPayment, Resources.TicketEmission.Constants.COMMANDS_AST_Z, authCode, Resources.TicketEmission.Constants.SLASH, ucFormPayment.Amount); } else { ucFormPayment.FormPayment = string.Concat(ucFormPayment.FormPayment, Resources.TicketEmission.Constants.COMMANDS_AST_Z, authCode); } } } else if (sabreAnswer.Contains(Resources.TicketEmission.Constants.INVALID)) { MessageBox.Show("TARJETA RECHAZADA \n" + sabreAnswer, Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Information); validAuthCode = false; } else if (sabreAnswer.Contains(Resources.TicketEmission.Constants.DECLINED)) { MessageBox.Show("TARJETA RECHAZADA \n" + sabreAnswer, Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Information); validAuthCode = false; } else if (sabreAnswer.Contains(Resources.TicketEmission.Constants.INCORRECT_CARD)) { MessageBox.Show("TARJETA RECHAZADA \n" + sabreAnswer, Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Information); validAuthCode = false; } else if (sabreAnswer.Contains(Resources.TicketEmission.Constants.PROCESSING_ERROR)) { MessageBox.Show("TARJETA RECHAZADA \n" + sabreAnswer, Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Information); validAuthCode = false; } else if (sabreAnswer.Contains(Resources.TicketEmission.Constants.REFERRAL)) { MessageBox.Show("TARJETA RECHAZADA \n" + sabreAnswer, Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Information); validAuthCode = false; } //Continua con el flujo de boleto, va al paso 8 if (!validAuthCode) { SetAuthCodeBL.SetErrorCK(ucFirstValidations.LocatorRecord, ucFormPayment.CardType, ucFormPayment.Amount, ucFormPayment.Bank, sabreAnswer, DateTime.Now, ucFormPayment.CommandGetAuthorizationCode); ucFormPayment.CommandGetAuthorizationCode = string.Empty; Loader.AddToPanel(Loader.Zone.Middle, this, Resources.TicketEmission.Constants.UCTICKETSEMISSIONINSTRUCTIONS); } else if (validatebusinessrules) { Loader.AddToPanel(Loader.Zone.Middle, this, Resources.TicketEmission.Constants.UC_ARMED_COMMANDS); } } else { if (validatebusinessrules) { // Aqui se actualizan los boletos en la tabla de log services fee Loader.AddToPanel(Loader.Zone.Middle, this, Resources.TicketEmission.Constants.UC_ARMED_COMMANDS); } } } else { if (validatebusinessrules) { AuthCode = ucTicketsEmissionInstructions.CodeAuth.Code; if (ucTicketsEmissionInstructions.wayPayment == Resources.TicketEmission.Constants.PAYMENT_MIXPAYMENT) { ucFormPayment.FormPayment = string.Concat(ucFormPayment.FormPayment, Resources.TicketEmission.Constants.COMMANDS_AST_Z, authCode, Resources.TicketEmission.Constants.SLASH, ucFormPayment.Amount); } else { ucFormPayment.FormPayment = string.Concat(ucFormPayment.FormPayment, Resources.TicketEmission.Constants.COMMANDS_AST_Z, authCode); } Loader.AddToPanel(Loader.Zone.Middle, this, Resources.TicketEmission.Constants.UC_ARMED_COMMANDS); } else { Loader.AddToPanel(Loader.Zone.Middle, this, Resources.TicketEmission.Constants.UCTICKETSEMISSIONINSTRUCTIONS); } } }
/// <summary> /// Se envia el comando de acuerdo a los campos ingresados /// </summary> private void CommandsSend() { int row = 0; int col = 0; string result = string.Empty; string sabre = string.Empty; string change = string.Empty; string name = string.Empty; string send = string.Concat("HB", txtNumberFirm.Text); using (CommandsAPI objCommand = new CommandsAPI()) { result = objCommand.SendReceive(send); } CommandsQik.searchResponse(result, "NOT ALLOWED IN", ref row, ref col); if (row != 0 || col != 0) { using (CommandsAPI objCommand = new CommandsAPI()) { objCommand.SendReceive("I"); result = objCommand.SendReceive(send); } CommandsQik.searchResponse(result, "NEW EMPLOYEE", ref row, ref col); if (row != 0 || col != 0) { MessageBox.Show(Resources.Reservations.LA_FIRMA_NO_EXISTE, Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Information); } } CommandsQik.searchResponse(result, "NEW EMPLOYEE", ref row, ref col); if (row != 0 || col != 0) { using (CommandsAPI objCommand = new CommandsAPI()) { objCommand.SendReceive("I"); } MessageBox.Show(Resources.Reservations.LA_FIRMA_NO_EXISTE, Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Information); } else { row = 0; col = 0; send = string.Empty; send = string.Concat("H/AUTH BY ", txtAuthorization.Text); sabre = string.Concat("H/NAM@", txtLastName.Text, "/", txtInitial.Text); change = string.Concat("HE"); using (CommandsAPI objCommand = new CommandsAPI()) { objCommand.SendReceive(send); objCommand.SendReceive(sabre); objCommand.SendReceive(change); objCommand.SendReceive("I"); } CommandsAPI2.send_MessageToEmulator(string.Concat(Resources.Reservations.CAMBIO_NOMBRE_SABRE_EXITOSO)); name = string.Concat(txtInitial.Text, " ", txtLastName.Text); UpdateUsersBL.UpdateUsers(txtNumberFirm.Text, txtPCC.Text, null, name, name.ToLower()); MessageBox.Show(Resources.Reservations.CAMBIO_NOMBRE_EXITOSO, Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Information); Loader.AddToPanel(Loader.Zone.Middle, this, Resources.Constants.UCWELCOME); } }
/// <summary> /// Obtiene la factura de un boleto en formato PDF y la guarda en /// archivos temporales del usuario /// </summary> private void GetInvoice() { linkInvoice = string.Empty; indexList.Clear(); GridViewFacturas.Visible = false; lblInfoFacturas.Visible = false; indexList = GetLinkByTktBL.GetLinkByTkt(txtInvoice.Text, Login.OrgId); if (indexList.Count > 0) { if (!string.IsNullOrEmpty(indexList[0].LinkInvoice) && indexList.Count == 1) { linkInvoice = indexList[0].LinkInvoice; Microsoft.VisualBasic.Devices.Computer MyComputer = new Microsoft.VisualBasic.Devices.Computer(); string fileName = string.Empty; fileName = MyComputer.FileSystem.SpecialDirectories.Temp; fileName = fileName + string.Format("\\TempFile_{0}.pdf", Guid.NewGuid().ToString()); if (DownloadFile(linkInvoice, fileName)) { try { Process.Start(fileName); Loader.AddToPanel(Loader.Zone.Middle, this, Resources.Constants.UCWELCOME); } catch { MessageBox.Show("NO CUENTA CON EL PROGRAMA CORRECTO PARA ABRIR ESTE ARCHIVO", Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Information); Loader.AddToPanel(Loader.Zone.Middle, this, Resources.Constants.UCWELCOME); } } } else if (string.IsNullOrEmpty(indexList[0].LinkInvoice)) { CommandsAPI2.send_MessageToEmulator("BUSCANDO FACTURA, FAVOR DE ESPERAR................."); Parameter timeOut = ParameterBL.GetParameterValue("TimeOutInvoice"); int time = Convert.ToInt32(timeOut.Values); AddLinksInvoicesPerTicketBL.AddLinksInvoicesPerTicket(txtInvoice.Text, time); indexList.Clear(); indexList = GetLinkByTktBL.GetLinkByTkt(txtInvoice.Text, Login.OrgId); if (string.IsNullOrEmpty(indexList[0].LinkInvoice)) { MessageBox.Show("LA INTERFASE AUN NO HA PROCESADO SU FACTURA, FAVOR DE VERIFICARLO MAS TARDE", Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Information); Loader.AddToPanel(Loader.Zone.Middle, this, Resources.Constants.UCWELCOME); } else if (!string.IsNullOrEmpty(indexList[0].LinkInvoice) && indexList.Count == 1) { linkInvoice = indexList[0].LinkInvoice; Microsoft.VisualBasic.Devices.Computer MyComputer = new Microsoft.VisualBasic.Devices.Computer(); string fileName = string.Empty; fileName = MyComputer.FileSystem.SpecialDirectories.Temp; fileName = fileName + string.Format("\\TempFile_{0}.pdf", Guid.NewGuid().ToString()); if (DownloadFile(linkInvoice, fileName)) { try { Process.Start(fileName); Loader.AddToPanel(Loader.Zone.Middle, this, Resources.Constants.UCWELCOME); } catch { MessageBox.Show("NO CUENTA CON EL PROGRAMA CORRECTO PARA ABRIR ESTE ARCHIVO", Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Information); Loader.AddToPanel(Loader.Zone.Middle, this, Resources.Constants.UCWELCOME); } } } else if (!string.IsNullOrEmpty(indexList[0].LinkInvoice) && indexList.Count > 1) { GridViewFacturas.Visible = true; GridViewFacturas.Rows.Clear(); int index = 0; int index2 = 0; for (int i = 0; i < indexList.Count; i++) { index = indexList[i].LinkInvoice.LastIndexOf("."); index2 = indexList[i].LinkInvoice.LastIndexOf("/"); GridViewFacturas.Rows.Add(indexList[i].LinkInvoice.Substring(54, (index - index2 - 1)), indexList[i].DescriptionType); } GridViewFacturas.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells; lblInfoFacturas.Visible = true; } } else if (!string.IsNullOrEmpty(indexList[0].LinkInvoice) && indexList.Count > 1) { GridViewFacturas.Visible = true; GridViewFacturas.Rows.Clear(); int index = 0; int index2 = 0; for (int i = 0; i < indexList.Count; i++) { index = indexList[i].LinkInvoice.LastIndexOf("."); index2 = indexList[i].LinkInvoice.LastIndexOf("/"); GridViewFacturas.Rows.Add(indexList[i].LinkInvoice.Substring(54, (index - index2 - 1)), indexList[i].DescriptionType); } GridViewFacturas.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells; lblInfoFacturas.Visible = true; } } else { MessageBox.Show("EL NÚMERO DE BOLETO NO EXISTE", Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Information); Loader.AddToPanel(Loader.Zone.Middle, this, Resources.Constants.UCWELCOME); } }
/// <summary> /// Genera el archivo excel que contiene la información de la sabana de vuelo /// </summary> private void BuildSabana() { List <GetInfoGroup> indexList = new List <GetInfoGroup>(); if (rdoPNR.Checked) { indexList = GetInfoGroupBL.GetInfoGroup(txtPNR.Text, Login.OrgId); } else { indexList = GetInfoGroupByIDGroupBL.GetInfoGroup(txtGroup.Text, Login.OrgId); } if (indexList.Count > 0) { CommandsAPI2.send_MessageToEmulator("GENERANDO SABANA DE VUELO, FAVOR DE ESPERAR........."); InfoGroupList = new List <InfoGroup>(); progressBar1.Maximum = indexList.Count; for (int i = 0; i < indexList.Count; i++) { InfoGroup info = new InfoGroup(); info.Name = string.Concat(indexList[i].PaxName, " ", indexList[i].PaxLastName); info.Origin = indexList[i].Origin; info.Destination = indexList[i].Destination; info.DepartureTime = indexList[i].DepartureTime; info.ArrivalTime = indexList[i].ArrivalTime; info.AirlineCode = indexList[i].AirlineCode; info.AirlineRef = indexList[i].AirlineRef; info.FlightNumber = indexList[i].FlightNumber; info.DepartureDate = Convert.ToString(indexList[i].DepartureDate); info.PaxNumber = Convert.ToString(indexList[i].PaxNumber); info.RecLoc = indexList[i].RecLoc; InfoGroupList.Add(info); } Microsoft.VisualBasic.Devices.Computer MyComputer = new Microsoft.VisualBasic.Devices.Computer(); string fileName = string.Empty; //Environment.GetFolderPath(Environment.SpecialFolder.InternetCache); int count = 7; int j = 3; using (MyCTSExcel objExcel = new MyCTSExcel()) { objExcel.CreateExcelObject("MyCTS"); if (objExcel.IsObjectCreated) { fileName = MyComputer.FileSystem.SpecialDirectories.Temp; fileName = fileName + string.Format("\\TempFile_{0}.xls", Guid.NewGuid().ToString()); MyCTSExcel.Cell cell = null; cell = new MyCTSExcel.Cell(2, 2, string.Concat("SABANA DE VUELO ", indexList[0].IDGroup, " / RECORD MAESTRO: ", indexList[0].MasterPNR)); cell.Wide = 8; cell.Bold = true; cell.Alignment = MyCTSExcel.Alignment.MiddleCenter; objExcel.CreateCell(cell); cell = new MyCTSExcel.Cell(3, 2, string.Concat("REPORTE EMITIDO EL ", DateTime.Now.ToString("dd/MMM/yyyy").ToUpper(), " a las ", DateTime.Now.ToString("HH:mm"), " Hrs.")); cell.Wide = 8; cell.Alignment = MyCTSExcel.Alignment.MiddleCenter; objExcel.CreateCell(cell); cell = new MyCTSExcel.Cell(5, 3, "SEGMENTO 1"); cell.Wide = 7; cell.Bold = true; cell.Alignment = MyCTSExcel.Alignment.MiddleCenter; objExcel.CreateCell(cell); cell = new MyCTSExcel.Cell(6, 2, "Nombre"); cell.Bold = true; cell.Alignment = MyCTSExcel.Alignment.MiddleCenter; objExcel.CreateCell(cell); cell = new MyCTSExcel.Cell(6, 3, "Origen"); cell.Bold = true; cell.Alignment = MyCTSExcel.Alignment.MiddleCenter; objExcel.CreateCell(cell); cell = new MyCTSExcel.Cell(6, 4, "Destino"); cell.Bold = true; cell.Alignment = MyCTSExcel.Alignment.MiddleCenter; objExcel.CreateCell(cell); cell = new MyCTSExcel.Cell(6, 5, "Salida"); cell.Bold = true; cell.Alignment = MyCTSExcel.Alignment.MiddleCenter; objExcel.CreateCell(cell); cell = new MyCTSExcel.Cell(6, 6, "LLegada"); cell.Bold = true; cell.Alignment = MyCTSExcel.Alignment.MiddleCenter; objExcel.CreateCell(cell); cell = new MyCTSExcel.Cell(6, 7, "LA"); cell.Bold = true; cell.Alignment = MyCTSExcel.Alignment.MiddleCenter; objExcel.CreateCell(cell); cell = new MyCTSExcel.Cell(6, 8, "Vuelo"); cell.Bold = true; cell.Alignment = MyCTSExcel.Alignment.MiddleCenter; objExcel.CreateCell(cell); cell = new MyCTSExcel.Cell(6, 9, "Fecha"); cell.Bold = true; cell.Alignment = MyCTSExcel.Alignment.MiddleCenter; objExcel.CreateCell(cell); cell = new MyCTSExcel.Cell(6, 10, "Clave Aerolínea"); cell.Bold = true; cell.Alignment = MyCTSExcel.Alignment.MiddleCenter; objExcel.CreateCell(cell); cell = new MyCTSExcel.Cell(6, 11, "Clave Aerolínea"); cell.Bold = true; cell.Alignment = MyCTSExcel.Alignment.MiddleCenter; objExcel.CreateCell(cell); cell = new MyCTSExcel.Cell(count, 2, InfoGroupList[0].Name); objExcel.CreateCell(cell); cell = new MyCTSExcel.Cell(count, 3, InfoGroupList[0].Origin); cell.Alignment = MyCTSExcel.Alignment.MiddleCenter; objExcel.CreateCell(cell); cell = new MyCTSExcel.Cell(count, 4, InfoGroupList[0].Destination); cell.Alignment = MyCTSExcel.Alignment.MiddleCenter; objExcel.CreateCell(cell); cell = new MyCTSExcel.Cell(count, 5, InfoGroupList[0].DepartureTime); cell.Alignment = MyCTSExcel.Alignment.MiddleCenter; objExcel.CreateCell(cell); cell = new MyCTSExcel.Cell(count, 6, InfoGroupList[0].ArrivalTime); cell.Alignment = MyCTSExcel.Alignment.MiddleCenter; objExcel.CreateCell(cell); cell = new MyCTSExcel.Cell(count, 7, InfoGroupList[0].AirlineCode); cell.Alignment = MyCTSExcel.Alignment.MiddleCenter; objExcel.CreateCell(cell); cell = new MyCTSExcel.Cell(count, 8, InfoGroupList[0].FlightNumber); cell.Alignment = MyCTSExcel.Alignment.MiddleCenter; objExcel.CreateCell(cell); cell = new MyCTSExcel.Cell(count, 9, InfoGroupList[0].DepartureDate.Substring(0, 10)); cell.Alignment = MyCTSExcel.Alignment.MiddleCenter; objExcel.CreateCell(cell); cell = new MyCTSExcel.Cell(count, 10, InfoGroupList[0].AirlineRef); cell.Alignment = MyCTSExcel.Alignment.MiddleCenter; objExcel.CreateCell(cell); cell = new MyCTSExcel.Cell(count, 11, InfoGroupList[0].RecLoc); cell.Alignment = MyCTSExcel.Alignment.MiddleCenter; objExcel.CreateCell(cell); progressBar1.Visible = true; progressBar1.Value = 1; int barValue = 1; int count2 = 0; int max = 0; int aux = 0; for (int i = 1; i < InfoGroupList.Count; i++) { if (InfoGroupList[i].PaxNumber == InfoGroupList[i - 1].PaxNumber) { j = j + 8; cell = new MyCTSExcel.Cell(count, j, InfoGroupList[i].Origin); cell.Alignment = MyCTSExcel.Alignment.MiddleCenter; objExcel.CreateCell(cell); cell = new MyCTSExcel.Cell(count, j + 1, InfoGroupList[i].Destination); cell.Alignment = MyCTSExcel.Alignment.MiddleCenter; objExcel.CreateCell(cell); cell = new MyCTSExcel.Cell(count, j + 2, InfoGroupList[i].DepartureTime); cell.Alignment = MyCTSExcel.Alignment.MiddleCenter; objExcel.CreateCell(cell); cell = new MyCTSExcel.Cell(count, j + 3, InfoGroupList[i].ArrivalTime); cell.Alignment = MyCTSExcel.Alignment.MiddleCenter; objExcel.CreateCell(cell); cell = new MyCTSExcel.Cell(count, j + 4, InfoGroupList[i].AirlineCode); cell.Alignment = MyCTSExcel.Alignment.MiddleCenter; objExcel.CreateCell(cell); cell = new MyCTSExcel.Cell(count, j + 5, InfoGroupList[i].FlightNumber); cell.Alignment = MyCTSExcel.Alignment.MiddleCenter; objExcel.CreateCell(cell); cell = new MyCTSExcel.Cell(count, j + 6, InfoGroupList[i].DepartureDate.Substring(0, 10)); cell.Alignment = MyCTSExcel.Alignment.MiddleCenter; objExcel.CreateCell(cell); cell = new MyCTSExcel.Cell(count, j + 7, InfoGroupList[i].AirlineRef); cell.Alignment = MyCTSExcel.Alignment.MiddleCenter; objExcel.CreateCell(cell); cell = new MyCTSExcel.Cell(count, j + 8, InfoGroupList[i].RecLoc); cell.Alignment = MyCTSExcel.Alignment.MiddleCenter; objExcel.CreateCell(cell); count2++; if (barValue % 19 == 0) { CommandsAPI2.send_MessageToEmulator("GENERANDO SABANA DE VUELO, FAVOR DE ESPERAR........."); } barValue++; progressBar1.Value = barValue; } else { aux = count2; if (aux > max) { max = aux; } else { max = count2; } count2 = 0; j = 3; count++; cell = new MyCTSExcel.Cell(count, 2, InfoGroupList[i].Name); objExcel.CreateCell(cell); cell = new MyCTSExcel.Cell(count, 3, InfoGroupList[i].Origin); cell.Alignment = MyCTSExcel.Alignment.MiddleCenter; objExcel.CreateCell(cell); cell = new MyCTSExcel.Cell(count, 4, InfoGroupList[i].Destination); cell.Alignment = MyCTSExcel.Alignment.MiddleCenter; objExcel.CreateCell(cell); cell = new MyCTSExcel.Cell(count, 5, InfoGroupList[i].DepartureTime); cell.Alignment = MyCTSExcel.Alignment.MiddleCenter; objExcel.CreateCell(cell); cell = new MyCTSExcel.Cell(count, 6, InfoGroupList[i].ArrivalTime); cell.Alignment = MyCTSExcel.Alignment.MiddleCenter; objExcel.CreateCell(cell); cell = new MyCTSExcel.Cell(count, 7, InfoGroupList[i].AirlineCode); cell.Alignment = MyCTSExcel.Alignment.MiddleCenter; objExcel.CreateCell(cell); cell = new MyCTSExcel.Cell(count, 8, InfoGroupList[i].FlightNumber); cell.Alignment = MyCTSExcel.Alignment.MiddleCenter; objExcel.CreateCell(cell); cell = new MyCTSExcel.Cell(count, 9, InfoGroupList[i].DepartureDate.Substring(0, 10)); cell.Alignment = MyCTSExcel.Alignment.MiddleCenter; objExcel.CreateCell(cell); cell = new MyCTSExcel.Cell(count, 10, InfoGroupList[i].AirlineRef); cell.Alignment = MyCTSExcel.Alignment.MiddleCenter; objExcel.CreateCell(cell); cell = new MyCTSExcel.Cell(count, 11, InfoGroupList[i].RecLoc); cell.Alignment = MyCTSExcel.Alignment.MiddleCenter; objExcel.CreateCell(cell); if (barValue % 19 == 0) { CommandsAPI2.send_MessageToEmulator("GENERANDO SABANA DE VUELO, FAVOR DE ESPERAR........."); } barValue++; progressBar1.Value = barValue; } } aux = count2; if (aux > max) { max = aux; } else { max = count2; } aux = 11; for (int k = 0; k < max; k++) { cell = new MyCTSExcel.Cell(5, aux, string.Concat(" SEGMENTO ", k + 2, " ")); cell.Wide = 7; cell.Bold = true; cell.Alignment = MyCTSExcel.Alignment.MiddleCenter; objExcel.CreateCell(cell); cell = new MyCTSExcel.Cell(6, aux, " Origen "); cell.Bold = true; cell.Alignment = MyCTSExcel.Alignment.MiddleCenter; objExcel.CreateCell(cell); cell = new MyCTSExcel.Cell(6, aux + 1, " Destino "); cell.Bold = true; cell.Alignment = MyCTSExcel.Alignment.MiddleCenter; objExcel.CreateCell(cell); cell = new MyCTSExcel.Cell(6, aux + 2, " Salida "); cell.Bold = true; cell.Alignment = MyCTSExcel.Alignment.MiddleCenter; objExcel.CreateCell(cell); cell = new MyCTSExcel.Cell(6, aux + 3, " Llegada "); cell.Bold = true; cell.Alignment = MyCTSExcel.Alignment.MiddleCenter; objExcel.CreateCell(cell); cell = new MyCTSExcel.Cell(6, aux + 4, " LA "); cell.Bold = true; cell.Alignment = MyCTSExcel.Alignment.MiddleCenter; objExcel.CreateCell(cell); cell = new MyCTSExcel.Cell(6, aux + 5, " Vuelo "); cell.Bold = true; cell.Alignment = MyCTSExcel.Alignment.MiddleCenter; objExcel.CreateCell(cell); cell = new MyCTSExcel.Cell(6, aux + 6, " Fecha "); cell.Bold = true; cell.Alignment = MyCTSExcel.Alignment.MiddleCenter; objExcel.CreateCell(cell); cell = new MyCTSExcel.Cell(6, aux + 7, " Clave Aerolínea "); cell.Bold = true; cell.Alignment = MyCTSExcel.Alignment.MiddleCenter; objExcel.CreateCell(cell); aux = aux + 8; } cell = new MyCTSExcel.Cell(6, aux, " Record "); cell.Bold = true; cell.Alignment = MyCTSExcel.Alignment.MiddleCenter; objExcel.CreateCell(cell); } objExcel.SaveFile(fileName); } if (!string.IsNullOrEmpty(fileName)) { Process proc = new Process(); proc.StartInfo.Arguments = "\"" + fileName + "\""; proc.StartInfo.FileName = "EXCEL.EXE"; proc.Start(); } Loader.AddToPanel(Loader.Zone.Middle, this, Resources.Constants.UCWELCOME); } else { if (rdoPNR.Checked) { MessageBox.Show("EL RECORD LOCALIZADOR NO VALIDO O INEXISTENTE", Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (!GetInfoGroupByIDGroupBL.Status) { MessageBox.Show("EL NOMBRE DE GRUPO NO EXISTE", Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("EL GRUPO AUN NO CONTIENE PASAJEROS", Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Information); } Loader.AddToPanel(Loader.Zone.Middle, this, Resources.Constants.UCWELCOME); } }
/// <summary> /// Se envia el comando de acuerdo a los campos ingresados /// </summary> private void CommandsSend() { int row = 0; int col = 0; int flag = 0; bool notcontinue = false; string result = string.Empty; string sabre = string.Empty; string change = string.Empty; string send = string.Concat("HB", txtNumberFirm.Text); using (CommandsAPI objCommand = new CommandsAPI()) { result = objCommand.SendReceive(send); } CommandsQik.searchResponse(result, "NEW EMPLOYEE", ref row, ref col); if (row != 0 || col != 0) { row = 0; col = 0; using (CommandsAPI objCommand = new CommandsAPI()) { objCommand.SendReceive("I"); } MessageBox.Show(Resources.Reservations.LA_FIRMA_NO_EXISTE, Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Information); txtNumberFirm.Focus(); notcontinue = true; } if (!notcontinue) { sabre = string.Concat("H/AUTH BY ", txtAuthorization.Text); if (rdoAdd.Checked) { change = string.Concat("H/UAT/A-"); } else { change = string.Concat("H/UAT/D-"); } if (!string.IsNullOrEmpty(Keyword1)) { change = string.Concat(change, Keyword1); flag = 1; } if (!string.IsNullOrEmpty(Keyword2)) { if (flag == 1) { change = string.Concat(change, ",", Keyword2); } else { change = string.Concat(change, Keyword2); flag = 1; } } if (!string.IsNullOrEmpty(Keyword3)) { if (flag == 1) { change = string.Concat(change, ",", Keyword3); } else { change = string.Concat(change, Keyword3); flag = 1; } } if (!string.IsNullOrEmpty(Keyword4)) { if (flag == 1) { change = string.Concat(change, ",", Keyword4); } else { change = string.Concat(change, Keyword4); flag = 1; } } if (!string.IsNullOrEmpty(Keyword5)) { if (flag == 1) { change = string.Concat(change, ",", Keyword5); } else { change = string.Concat(change, Keyword5); flag = 1; } } using (CommandsAPI objCommand = new CommandsAPI()) { objCommand.SendReceive(sabre); result = objCommand.SendReceive(change); } CommandsQik.searchResponse(result, "*", ref row, ref col); if (row != 0 || col != 0) { row = 0; col = 0; using (CommandsAPI objCommand = new CommandsAPI()) { result = objCommand.SendReceive("HE"); objCommand.SendReceive("I"); } CommandsQik.searchResponse(result, "DONE", ref row, ref col); if (row != 0 || col != 0) { row = 0; col = 0; CommandsAPI2.send_MessageToEmulator(string.Concat(Resources.Reservations.KEYWORDS_MODIFICADOS_EXITO)); MessageBox.Show(Resources.Reservations.FIRMA_MODIFICADA_EXITO, Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show(Resources.Reservations.PRESENTO_ERROR, Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Information); using (CommandsAPI objCommand = new CommandsAPI()) { objCommand.SendReceive("I"); } } } else { MessageBox.Show(Resources.Reservations.PRESENTO_ERROR, Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Information); using (CommandsAPI objCommand = new CommandsAPI()) { objCommand.SendReceive("I"); } } } }
/// <summary> /// Valiada que el corporativo sea valido /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnCorp_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(txtAttribute1.Text)) { MessageBox.Show("DEBE INGRESAR EL CORPORATIVO AL QUE SE LE APLICARA LA REGLA DE CARGO POR SERVICIO", Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Information); txtAttribute1.Focus(); } else { //string[] locationDK = null; WsMyCTS wsServ = new WsMyCTS(); MyCTS.Services.ValidateDKsAndCreditCards.GetOnlyAttribute1[] locationDK = null; try { locationDK = wsServ.GetLocationByAttribute1(txtAttribute1.Text); } catch { CommandsAPI2.send_MessageToEmulator("VALIDANDO CORPORATIVO, FAVOR DE ESPERAR........"); listAttribute1 = new List <MyCTS.Entities.GetOnlyAttribute1>(); listAttribute1 = GetOnlyAttribute1BL.GetAttribute1(txtAttribute1.Text); } if ((locationDK != null && locationDK.Length > 0) || (listAttribute1 != null && listAttribute1.Count > 0)) { if (listAttribute1 == null || listAttribute1.Count.Equals(0)) { listAttribute1 = new List <MyCTS.Entities.GetOnlyAttribute1>(); for (int i = 0; i < locationDK.Length; i++) { MyCTS.Entities.GetOnlyAttribute1 objAttribute1 = new MyCTS.Entities.GetOnlyAttribute1(); objAttribute1.LocationDK = locationDK[i].LocationDK; listAttribute1.Add(objAttribute1); } } listInfoFeeRule = GetInfoFeeRuleByAttribute1BL.GetInfoFeeRule(txtAttribute1.Text, 0, Login.OrgId); if (listInfoFeeRule.Count > 0) { //mostrar info de lo que contenga la lista string info = string.Empty; info = string.Concat("El corporativo ", txtAttribute1.Text, " cuenta con las siguientes reglas:"); for (int i = 0; i < listInfoFeeRule.Count; i++) { info = string.Concat(info, "\n"); info = string.Concat(info, "\n", "Regla: ", listInfoFeeRule[i].RuleNumber); info = string.Concat(info, "\n", "Nombre: ", listInfoFeeRule[i].Description); info = string.Concat(info, "\n", "Prioridad: ", listInfoFeeRule[i].Priority); info = string.Concat(info, "\n", "% De Tarifa Base: ", listInfoFeeRule[i].DefaultFee); info = string.Concat(info, "\n", "Cantidad Fija: ", listInfoFeeRule[i].DefaultMount.ToString("0.00")); info = string.Concat(info, "\n", "Monto: ", (listInfoFeeRule[i].Mandatory) ? "No Negociable" : "Negociable"); info = string.Concat(info, "\n", "Status: ", (listInfoFeeRule[i].ActivationSatate == true) ? "Activa" : "Inactiva"); if (listInfoFeeRule[i].StartDate != Types.DateNullValue) { info = string.Concat(info, "\n", "Inicio de regla: ", Convert.ToString(listInfoFeeRule[i].StartDate).Substring(0, 10)); } if (listInfoFeeRule[i].ExpirationDate != Types.DateNullValue) { info = string.Concat(info, "\n", "Fin de regla: ", Convert.ToString(listInfoFeeRule[i].ExpirationDate).Substring(0, 10)); } } infoattribute1 = info; string[] infoList = info.Split(new char[] { '\n' }); if (possition == true) { foreach (Control txt in this.Controls) { if (!(txt.TabIndex.Equals(0) || txt.TabIndex.Equals(1) || txt.Name == "btnCorp" || txt.Name == "txtInfoRuleByAttribute1")) { txt.Location = new Point(txt.Location.X, txt.Location.Y + 100); } } } possition = false; txtInfoRuleByAttribute1.Lines = infoList; ShowContols(true); txtDescription.Focus(); } else { if (possition == false) { foreach (Control txt in this.Controls) { if (!(txt.TabIndex.Equals(0) || txt.TabIndex.Equals(1) || txt.Name == "btnCorp" || txt.Name == "txtInfoRuleByAttribute1")) { txt.Location = new Point(txt.Location.X, txt.Location.Y - 100); } } } possition = true; ShowContols(true); txtInfoRuleByAttribute1.Visible = false; txtDescription.Focus(); } } else { MessageBox.Show("EL CORPORATIVO NO EXISTE EN INTEGRA", Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Information); txtAttribute1.Focus(); ShowContols(false); } } }
/// <summary> /// Valida la respuesta de mySabre cuando aparece la respuesta *PAC /// </summary> private void APIResponseDIN() { string result = string.Empty; string recordLocator = string.Empty; ERR_TicketsEmission.err_ticketsEmission(sabreAnswer); if (ERR_TicketsEmission.Status == false) { ERR_TicketsEmission.ok_ticketsEmission(sabreAnswer); if (ERR_TicketsEmission.StatusOk == true) { int row = 0; int col = 0; if (sabreAnswer.Contains(Resources.TicketEmission.ValitationLabels.ETR_MESSAGE_PROCESSED) || sabreAnswer.Contains(Resources.TicketEmission.ValitationLabels.ETR_EXCHANGE_PROCESSED)) { CommandsAPI2.send_MessageToEmulator(Resources.TicketEmission.Constants.MESSAGE_ISSUE); } CommandsQik.searchResponse(sabreAnswer, Resources.TicketEmission.ValitationLabels.INVOICED, ref row, ref col); if (row != 0 || col != 0) { int rowMessage = row - 2; recordLocator = string.Empty; CommandsQik.CopyResponse(sabreAnswer, ref recordLocator, rowMessage + 1, 9, 6); } Common.BeginManualCommandsTransactions(); try { //CommandsAPI2.send_MessageToEmulator(Resources.TicketEmission.Constants.MESSAGE_ISSUE); AddRecordsContainerBL.AddRecordsContainer(recordLocator, Login.Agent, true); send = string.Empty; send = string.Concat(Resources.TicketEmission.Constants.AST, recordLocator); using (CommandsAPI objCommand = new CommandsAPI()) { objCommand.SendReceive(send); } QueueAgent(); send = string.Empty; MyCTSAPI.SendReservationLog(Login.Firm, Login.PCC, recordLocator, 1); send = string.Concat(Resources.TicketEmission.Constants.AST, recordLocator); using (CommandsAPI objCommand = new CommandsAPI()) { objCommand.SendReceive(send); } SendValidationTicketCommand(); } catch { } //Common.EndManualCommandsTransactions(); ExecEndCommandTransaction(); //System.Threading.Thread.Sleep(1000); ClearValues(); if (ucTicketEmissionBuildCommand.emiting) { SetCSCLog(); ucTicketEmissionBuildCommand.emiting = false; } } else { MessageBox.Show("OCURRIO UN ERROR AL IMPRIMIR FACTURA. VERIFIQUE RESPUESTAS", Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Warning); if (ucTicketEmissionBuildCommand.emiting) { SetCSCLog(); ucTicketEmissionBuildCommand.emiting = false; } //UC = "sendTicketInvoice"; Loader.AddToPanel(Loader.Zone.Middle, this, Resources.TicketEmission.Constants.UC_SEND_TICKET_INVOICE); } } else if (ERR_TicketsEmission.StatusSendCommand == true) { sabreAnswer = string.Empty; using (CommandsAPI objCommand = new CommandsAPI()) { sabreAnswer = objCommand.SendReceive(send); } ERR_TicketsEmission.ok_ticketsEmission(sabreAnswer); if (ERR_TicketsEmission.StatusOk == true) { int row = 0; int col = 0; if (sabreAnswer.Contains(Resources.TicketEmission.ValitationLabels.ETR_MESSAGE_PROCESSED) || sabreAnswer.Contains(Resources.TicketEmission.ValitationLabels.ETR_EXCHANGE_PROCESSED)) { CommandsAPI2.send_MessageToEmulator(Resources.TicketEmission.Constants.MESSAGE_ISSUE); } CommandsQik.searchResponse(sabreAnswer, Resources.TicketEmission.ValitationLabels.INVOICED, ref row, ref col); if (row != 0 || col != 0) { int rowMessage = row - 2; recordLocator = string.Empty; CommandsQik.CopyResponse(sabreAnswer, ref recordLocator, rowMessage + 1, 9, 6); } Common.BeginManualCommandsTransactions(); try { //CommandsAPI2.send_MessageToEmulator(Resources.TicketEmission.Constants.MESSAGE_ISSUE); AddRecordsContainerBL.AddRecordsContainer(recordLocator, Login.Agent, true); send = string.Empty; send = string.Concat(Resources.TicketEmission.Constants.AST, recordLocator); using (CommandsAPI objCommand = new CommandsAPI()) { objCommand.SendReceive(send); } QueueAgent(); send = string.Empty; MyCTSAPI.SendReservationLog(Login.Firm, Login.PCC, recordLocator, 1); send = string.Concat(Resources.TicketEmission.Constants.AST, recordLocator); using (CommandsAPI objCommand = new CommandsAPI()) { objCommand.SendReceive(send); } SendValidationTicketCommand(); if (ucTicketEmissionBuildCommand.emiting) { SetCSCLog(); ucTicketEmissionBuildCommand.emiting = false; } } catch { } } //Common.EndManualCommandsTransactions(); ExecEndCommandTransaction(); //System.Threading.Thread.Sleep(1000); ClearValues(); } else { MessageBox.Show("OCURRIO UN ERROR AL IMPRIMIR FACTURA. VERIFIQUE RESPUESTAS", Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Warning); if (ucTicketEmissionBuildCommand.emiting) { SetCSCLog(); ucTicketEmissionBuildCommand.emiting = false; } //UC = "sendTicketInvoice";// Loader.AddToPanel(Loader.Zone.Middle, this, Resources.TicketEmission.Constants.UC_SEND_TICKET_INVOICE); } }
//Analiza el comando enviado, para crear la etiqueta de Quality Controls C80 private void EvaluateCommand() { string seg = string.Empty; string res = string.Empty; string itinerary = string.Empty; string bysegment = string.Empty; string commandSegment = string.Empty; string konnect = string.Empty; int lenght = 0; int resplenght = 0; int lenghtcommand = 0; int aux = 0; int row = 0; int col = 0; int row1 = 0; int col1 = 0; int i = 0; int j = 0; if (command.Contains("‡DPE")) { command = command.Replace("‡DPE", "‡DPB"); } else if (!command.Contains("‡DPB")) { command = string.Concat(command, "‡DPB"); } //Obtiene segmentos if (command.Contains("‡S")) { char[] charCommand = command.ToCharArray(); for (int x = 0; x <= charCommand.Length; x++) { int y = x + 1; if (charCommand[x] == '‡' & charCommand[x + 1] == 'S') { x++; while (x < charCommand.Length) { if (charCommand[x] != '‡') { segment = string.Concat(segment, charCommand[x]); x++; } else { break; } } break; } } } //Creación de la etiqueta C80 if (!string.IsNullOrEmpty(segment)) { segment = segment.Replace('-', '/'); bysegment = segment.Replace('S', ' ').Trim(); newlabel = string.Concat("5.</C80*"); seg = string.Concat("*IA"); using (CommandsAPI2 objCommand = new CommandsAPI2()) { res = objCommand.SendReceive(seg, 0, 0); } string[] segments1 = bysegment.Split(new char[] { '/' }); for (int a = 0; a < segments1.Length; a++) { col = 0; row = 0; CommandsQik.searchResponse(segments1[a], "-", ref row, ref col); if (col != 0 || row != 0) { int num1 = 0; int num2 = 0; string[] seg1 = segments1[a].Split(new char[] { '-' }); string replace = string.Empty; string bysegment2 = string.Empty; num1 = Convert.ToInt32(seg1[0]); num2 = Convert.ToInt32(seg1[1]); for (int f = num1; f <= num2; f++) { bysegment2 = string.Concat(bysegment2, f.ToString(), "/"); } bysegment2 = bysegment2.Remove(bysegment2.Length - 1, 1); replace = string.Concat(num1.ToString(), "-", num2.ToString()); bysegment = bysegment.Replace(replace, bysegment2); } } string[] segments = bysegment.Split(new char[] { '/' }); lenght = segments.Length - 1; string[] resp = res.Split(new char[] { '\n' }); resplenght = resp.Length; for (i = 0; i <= lenght; i++) { aux = 0; for (j = 1; j < resplenght; j++) { j = aux + 1; col = 0; row = 0; col1 = 0; row1 = 0; CommandsQik.searchResponse(resp[j], "ARNK", ref row, ref col); if (row == 0 || col == 0) { col = 0; row = 0; col1 = 0; row1 = 0; CommandsQik.searchResponse(resp[j], segments[i], ref row, ref col, 1, 3, 1, 3); if (row != 0 || col != 0) { CommandsQik.CopyResponse(resp[j], ref itinerary, row, 19, 8); itinerary = itinerary.Replace("*", "").Trim(); commandSegment = string.Concat(commandSegment, itinerary.Substring(0, 3), ".", itinerary.Substring(3, 3), "."); aux = j; break; } } aux = j; } } if (!string.IsNullOrEmpty(commandSegment)) { commandSegment = commandSegment.Remove(commandSegment.Length - 1); if (commandSegment.Length > 7) { string[] commands = commandSegment.Split(new char[] { '.' }); lenghtcommand = commands.Length - 1; for (int z = 0; z <= lenghtcommand - 1; z++) { if (commands[z] == commands[z + 1]) { commands[z] = string.Empty; } } commandSegment = string.Empty; for (int a = 0; a <= lenghtcommand; a++) { if (!string.IsNullOrEmpty(commands[a])) { commandSegment = string.Concat(commandSegment, commands[a].Trim(), "."); } } commandSegment = commandSegment.Remove(commandSegment.Length - 1); } newlabel = string.Concat(newlabel, commandSegment, "/>"); c80 = newlabel; } } }