//Envía las instrucciones a MySabre private void CommandsSend() { int row = 0; int col = 0; string send = string.Empty; string res = string.Empty; string sabre = "QS/"; send = string.Concat(sabre, txtPCC.Text, txtQueue.Text, "/D-", txtAgentCode.Text); using (CommandsAPI objCommand = new CommandsAPI()) { res = objCommand.SendReceive(send); } CommandsQik.searchResponse(res, string.Concat("UPDATE PROCESSED"), ref row, ref col); if (row != 0 || col != 0) { if (AssignQueueFirmBL.AssignQueueFirm("152", txtAgentCode.Text, txtPCC.Text)) { UpdateStatusAllFirmModulesBL.UpdateUnassignStatusQueue(txtQueue.Text); MessageBox.Show("QUEUE CANCELADA", Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("HA OCURRIDO UN ERROR AL ACTUALIZAR", Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { MessageBox.Show("ERROR EN LA CONEXIÓN CON MySABRE", Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Se envia el comando de acuerdo a los campos ingresados /// </summary> private void CommandsSend() { int row = 0; int col = 0; string sendPCC = string.Empty; string res = string.Empty; bool conected = false; if (rbnBoth.Checked) { sendPCC = string.Concat(sendPCC, "AAA", txtPCC.Text); using (CommandsAPI objCommand = new CommandsAPI()) { res = objCommand.SendReceive(sendPCC); } CommandsQik.searchResponse(res, txtPCC.Text, ref row, ref col); if (row != 0 || col != 0) { conected = true; } else { MessageBox.Show("ERROR EN LA CONEXIÓN CON MySABRE", Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Information); } if (conected) { string result = string.Empty; string send = string.Empty; string sabre = string.Empty; string authorization = string.Empty; string keywords = string.Empty; string pass = string.Empty; string codeagent = string.Empty; row = 0; col = 0; if (!onlyagent) { send = string.Concat(send, "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; send = string.Empty; send = string.Concat("H/NAM", txtLastName.Text, "/", txtInitial.Text); sabre = "H/DTY6*/"; if (chkDutyCode.Checked) { sabre = string.Concat(sabre, "9"); } authorization = string.Concat(authorization, "H/AUTH BY", txtAuthorization.Text); keywords = "H/UAT/A-24TIME,SUBAAA,PFKAGT,PTRAGT"; if (chkMINIOPR.Checked) { keywords = string.Concat(keywords, ",MINOPR"); } if (chkCreate.Checked) { keywords = string.Concat(keywords, ",CREATE"); } if (chkAccess.Checked) { keywords = string.Concat(keywords, ",ACCESS"); } if (chkCIIMGR.Checked) { keywords = string.Concat(keywords, ",CIIMGR"); } if (chkSUBMGR.Checked) { keywords = string.Concat(keywords, ",SUBMGR"); } if (chkPNRREL.Checked) { keywords = string.Concat(keywords, ",PNRREL"); } if (chkSUBACC.Checked) { keywords = string.Concat(keywords, ",SUBACC"); } if (cmbKeyWord8.SelectedIndex > 0) { keywords = string.Concat(keywords, ",", cmbKeyWord8.Text); } if (cmbKeyWord9.SelectedIndex > 0) { keywords = string.Concat(keywords, ",", cmbKeyWord9.Text); } if (cmbKeyWord10.SelectedIndex > 0) { keywords = string.Concat(keywords, ",", cmbKeyWord10.Text); } if (cmbKeyWord11.SelectedIndex > 0) { keywords = string.Concat(keywords, ",", cmbKeyWord11.Text); } if (cmbKeyWord12.SelectedIndex > 0) { keywords = string.Concat(keywords, ",", cmbKeyWord12.Text); } pass = string.Concat(pass, "H/PASS", txtPassCode.Text); codeagent = string.Concat(codeagent, "HH/A", txtCodeAgent.Text); using (CommandsAPI objCommand = new CommandsAPI()) { objCommand.SendReceive(send); objCommand.SendReceive(sabre); objCommand.SendReceive("H/ASO240"); objCommand.SendReceive(authorization); objCommand.SendReceive(keywords); objCommand.SendReceive(pass); result = objCommand.SendReceive(codeagent); } } else { MessageBox.Show("LA FIRMA YA EXISTE, INGRESE AL MODULO DE MODIFICACIONES PARA CAMBIOS", Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Information); using (CommandsAPI objCommand = new CommandsAPI()) { result = objCommand.SendReceive("I"); } CommandsQik.searchResponse(result, "IGN", ref row, ref col); } } else { codeagent = string.Concat(codeagent, "HH/A", txtCodeAgent.Text); using (CommandsAPI objCommand = new CommandsAPI()) { result = objCommand.SendReceive(codeagent); } } CommandsQik.searchResponse(result, "DUP", ref row, ref col); if (row != 0 || col != 0) { MessageBox.Show("EL CODIGO DE AGENTE YA EXISTE, INGRESE OTRO!", Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Information); txtCodeAgent.Focus(); onlyagent = true; row = 0; col = 0; } CommandsQik.searchResponse(result, "DONE", ref row, ref col); if (row != 0 || col != 0) { row = 0; col = 0; sabre = string.Empty; sabre = string.Concat("QS/", txtPCC.Text, txtQueue.Text, "/A-", txtCodeAgent.Text); using (CommandsAPI objCommand = new CommandsAPI()) { result = objCommand.SendReceive(sabre); } CommandsQik.searchResponse(result, "ITEM ALREADY IN TABLE", ref row, ref col); if (row != 0 || col != 0) { MessageBox.Show("FIRMA CREADA CORRECTAMENTE, ERROR EN LA ASIGNACIÓN DE LA QUEUE", Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("FIRMA CREADA Y ASIGNACION A LA QUEUE CON EXITO", Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Information); } string username = string.Concat(txtInitial.Text, " ", txtLastName.Text); string cc = string.Empty; Parameter copy = ParameterBL.GetParameterValue("MailToCreateFirm"); cc = copy.Values; AddNewUserBL.AddNewUser(username, username.ToLower(), txtEmail.Text.ToLower(), textAgentMail.Text.ToLower(), DateTime.Today.ToString().Substring(0, 10), txtNumberFirm.Text, txtPassCode.Text, txtName.Text.ToLower(), txtCodeAgent.Text, txtQueue.Text, txtPCC.Text, txtTA.Text, "SA"); SendEMail(cc); if (!txtQueue.Text.Equals("152")) { DialogResult yesNo = MessageBox.Show("Este usuario recibirá reporte de productividad semanal?", Resources.Constants.MYCTS, MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (yesNo.Equals(DialogResult.Yes)) { SetProductivityMailStatusBL setStatus = new SetProductivityMailStatusBL(); setStatus.SetProductivityMailStatus(txtNumberFirm.Text, txtPCC.Text); } } UpdateStatusAllFirmModulesBL.UpdateStatusTA(txtTA.Text); UpdateStatusAllFirmModulesBL.UpdateStatusQueue(txtQueue.Text); UpdateStatusAllFirmModulesBL.UpdateStatusAgent(txtCodeAgent.Text); UpdateStatusAllFirmModulesBL.UpdateStatusFirm(txtNumberFirm.Text); MessageBox.Show("CUENTA DE MyCTS CREADA EXITOSAMENTE", Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Information); row = 0; col = 0; Loader.AddToPanel(Loader.Zone.Middle, this, Resources.Constants.UCWELCOME); } } } else if (rbnMyCTS.Checked) { try { User usuarioDto = null; User ValidAgentMail = null; usuarioDto = UserBL.GetUser(txtNumberFirm.Text, txtPCC.Text); ValidAgentMail = UserBL.ValidAgentMail(textAgentMail.Text); if (usuarioDto == null) { if (ValidAgentMail == null) { string username = string.Concat(txtInitial.Text, " ", txtLastName.Text); string cc = string.Empty; Parameter copy = ParameterBL.GetParameterValue("MailToCreateFirm"); cc = copy.Values; AddNewUserBL.AddNewUser(username, username.ToLower(), txtEmail.Text.ToLower(), textAgentMail.Text.ToLower(), DateTime.Today.ToString().Substring(0, 10), txtNumberFirm.Text, txtPassCode.Text, txtName.Text.ToLower(), txtCodeAgent.Text, txtQueue.Text, txtPCC.Text, txtTA.Text, "SA"); SendEMail(cc); if (!txtQueue.Text.Equals("152")) { DialogResult yesNo = MessageBox.Show("Este usuario recibirá reporte de productividad semanal?", Resources.Constants.MYCTS, MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (yesNo.Equals(DialogResult.Yes)) { SetProductivityMailStatusBL setStatus = new SetProductivityMailStatusBL(); setStatus.SetProductivityMailStatus(txtNumberFirm.Text, txtPCC.Text); } } UpdateStatusAllFirmModulesBL.UpdateStatusTA(txtTA.Text); UpdateStatusAllFirmModulesBL.UpdateStatusQueue(txtQueue.Text); UpdateStatusAllFirmModulesBL.UpdateStatusAgent(txtCodeAgent.Text); UpdateStatusAllFirmModulesBL.UpdateStatusFirm(txtNumberFirm.Text); MessageBox.Show("CUENTA DE MyCTS CREADA EXITOSAMENTE", Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Information); Loader.AddToPanel(Loader.Zone.Middle, this, Resources.Constants.UCWELCOME); } else { MessageBox.Show("EL AGENTMAIL YA EXISTE EN MyCTS", Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { MessageBox.Show("EL USUARIO YA EXISTE EN MyCTS", Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch { } } else if (rbnSabre.Checked) { try { string result = string.Empty; string send = string.Empty; string sabre = string.Empty; string authorization = string.Empty; string keywords = string.Empty; string pass = string.Empty; string codeagent = string.Empty; body = string.Empty; row = 0; col = 0; sendPCC = string.Concat(sendPCC, "AAA", txtPCC.Text); using (CommandsAPI objCommand = new CommandsAPI()) { res = objCommand.SendReceive(sendPCC); } CommandsQik.searchResponse(res, txtPCC.Text, ref row, ref col); if (row != 0 || col != 0) { conected = true; } else { MessageBox.Show("ERROR EN LA CONEXIÓN CON MySABRE", Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Information); } if (conected) { if (!onlyagent) { send = string.Concat(send, "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; send = string.Empty; send = string.Concat("H/NAM", txtLastName.Text, "/", txtInitial.Text); sabre = "H/DTY6*/"; if (chkDutyCode.Checked) { sabre = string.Concat(sabre, "9"); } authorization = string.Concat(authorization, "H/AUTH BY", txtAuthorization.Text); keywords = "H/UAT/A-24TIME,SUBAAA,PFKAGT,PTRAGT"; if (chkMINIOPR.Checked) { keywords = string.Concat(keywords, ",MINOPR"); } if (chkCreate.Checked) { keywords = string.Concat(keywords, ",CREATE"); } if (chkAccess.Checked) { keywords = string.Concat(keywords, ",ACCESS"); } if (chkCIIMGR.Checked) { keywords = string.Concat(keywords, ",CIIMGR"); } if (chkSUBMGR.Checked) { keywords = string.Concat(keywords, ",SUBMGR"); } if (chkPNRREL.Checked) { keywords = string.Concat(keywords, ",PNRREL"); } if (chkSUBACC.Checked) { keywords = string.Concat(keywords, ",SUBACC"); } if (cmbKeyWord8.SelectedIndex > 0) { keywords = string.Concat(keywords, ",", cmbKeyWord8.Text); } if (cmbKeyWord9.SelectedIndex > 0) { keywords = string.Concat(keywords, ",", cmbKeyWord9.Text); } if (cmbKeyWord10.SelectedIndex > 0) { keywords = string.Concat(keywords, ",", cmbKeyWord10.Text); } if (cmbKeyWord11.SelectedIndex > 0) { keywords = string.Concat(keywords, ",", cmbKeyWord11.Text); } if (cmbKeyWord12.SelectedIndex > 0) { keywords = string.Concat(keywords, ",", cmbKeyWord12.Text); } pass = string.Concat(pass, "H/PASS", txtPassCode.Text); codeagent = string.Concat(codeagent, "HH/A", txtCodeAgent.Text); using (CommandsAPI objCommand = new CommandsAPI()) { objCommand.SendReceive(send); objCommand.SendReceive(sabre); objCommand.SendReceive("H/ASO240"); objCommand.SendReceive(authorization); objCommand.SendReceive(keywords); objCommand.SendReceive(pass); result = objCommand.SendReceive(codeagent); } } else { MessageBox.Show("LA FIRMA YA EXISTE, INGRESE AL MODULO DE MODIFICACIONES PARA CAMBIOS", Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Information); using (CommandsAPI objCommand = new CommandsAPI()) { result = objCommand.SendReceive("I"); } //CommandsQik.searchResponse(result, "IGN", ref row, ref col); } } else { codeagent = string.Concat(codeagent, "HH/A", txtCodeAgent.Text); using (CommandsAPI objCommand = new CommandsAPI()) { result = objCommand.SendReceive(codeagent); } } CommandsQik.searchResponse(result, "DUP", ref row, ref col); if (row != 0 || col != 0) { MessageBox.Show("EL CODIGO DE AGENTE YA EXISTE, INGRESE OTRO!", Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Information); txtCodeAgent.Focus(); onlyagent = true; row = 0; col = 0; } CommandsQik.searchResponse(result, "DONE", ref row, ref col); if (row != 0 || col != 0) { row = 0; col = 0; sabre = string.Empty; sabre = string.Concat("QS/", txtPCC.Text, txtQueue.Text, "/A-", txtCodeAgent.Text); using (CommandsAPI objCommand = new CommandsAPI()) { result = objCommand.SendReceive(sabre); } CommandsQik.searchResponse(result, "ITEM ALREADY IN TABLE", ref row, ref col); if (row != 0 || col != 0) { MessageBox.Show("FIRMA CREADA CORRECTAMENTE, ERROR EN LA ASIGNACIÓN DE LA QUEUE", Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("FIRMA CREADA Y ASIGNACION A LA QUEUE CON EXITO", Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Information); } } } } catch { } } }
/// <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); } }