protected void Page_Load(object sender, EventArgs e) { if (Session["CCFNUser"] == null) { Response.Redirect("~/login.aspx"); } if (!IsPostBack) { try { var lstParameters = ParameterBL.GetParameters(); txtRegistrationSuccessMessage.Text = lstParameters.Where(p => p.Name.Equals("RegistrationSuccessMessage")).FirstOrDefault().Value; txtFilesPath.Text = lstParameters.Where(p => p.Name.Equals("FilesPath")).FirstOrDefault().Value; cmbSendEmails.SelectedValue = lstParameters.Where(p => p.Name.Equals("SendEmails")).FirstOrDefault().Value; txtEmailFrom.Text = lstParameters.Where(p => p.Name.Equals("EmailFrom")).FirstOrDefault().Value; txtEmailFromName.Text = lstParameters.Where(p => p.Name.Equals("EmailFromName")).FirstOrDefault().Value; txtEmailIP.Text = lstParameters.Where(p => p.Name.Equals("EmailIP")).FirstOrDefault().Value; txtEmailPort.Text = lstParameters.Where(p => p.Name.Equals("EmailPort")).FirstOrDefault().Value; cmbSSL.SelectedValue = lstParameters.Where(p => p.Name.Equals("EmailSSL")).FirstOrDefault().Value; txtEmailPassword.Text = lstParameters.Where(p => p.Name.Equals("EmailPassword")).FirstOrDefault().Value; txtForgotPasswordSubject.Text = lstParameters.Where(p => p.Name.Equals("ForgotPasswordSubject")).FirstOrDefault().Value; txtForgotPasswordBody.Text = lstParameters.Where(p => p.Name.Equals("ForgotPasswordBody")).FirstOrDefault().Value; txtPasswordSentText.Text = lstParameters.Where(p => p.Name.Equals("PasswordSentText")).FirstOrDefault().Value; } catch (Exception ex) { Trace.Write(ex.Message + " " + ex.StackTrace); } } }
/// <summary> /// Gets the configure telephones. /// </summary> /// <returns></returns> public List <VolarisContactTelephone> GetConfigureTelephones() { var configuredTelephoneParameter = ParameterBL.GetParameterValue("VolarisConfiguredTelephones"); var telephones = new List <VolarisContactTelephone>(); if (configuredTelephoneParameter != null && !string.IsNullOrEmpty(configuredTelephoneParameter.Values)) { var phonesStrings = configuredTelephoneParameter.Values.Split('|'); foreach (var phoneString in phonesStrings) { if (!string.IsNullOrEmpty(phoneString)) { var phone = phoneString.Split('-'); if (phone.Length == 2) { var email = new VolarisContactTelephone() { TelephoneCityCode = phone[0], Telephone = phone[1] }; telephones.Add(email); } } } } return(telephones); }
/// <summary> /// Handles the DoWork event of the MailerWorker control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.ComponentModel.DoWorkEventArgs"/> instance containing the event data.</param> void MailerWorker_DoWork(object sender, DoWorkEventArgs e) { MyCTS.Entities.Parameter parameter = ParameterBL.GetParameterValue("InterJetConfirmationMails"); if (parameter != null && !string.IsNullOrEmpty(parameter.Values)) { string[] mails = parameter.Values.Split('|'); if (mails.Length > 0) { var htmlGenerator = new InterJetMailContentGenerator { Ticket = (InterJetTicket)e.Argument }; foreach (string mail in mails) { if (!string.IsNullOrEmpty(mail)) { string subject = string.Format( "Reservación de InterJet - {0} - Codigo de Confirmación: {1}", Ticket.Contact.FullName, Ticket.RecordLocator); SendMail(mail, htmlGenerator.GetResplacement(), htmlGenerator.GetHtmlContent(), subject); } } } } }
protected void RadAjaxManager1_AjaxRequest(object sender, Telerik.Web.UI.AjaxRequestEventArgs e) { lblError.Text = ""; lblError.Visible = false; lblPasswordSent.Visible = false; if (!UserBL.ExistsUsername(txtUsername.Text)) { lblError.Visible = true; lblError.Text = "Usuario no encontrado."; return; } else { var user = UserBL.GetUserByUsername(txtUsername.Text); var lstParameters = ParameterBL.GetParameters(); var ForgotPasswordSubject = lstParameters.Where(p => p.Name.Equals("ForgotPasswordSubject")).FirstOrDefault().Value; var ForgotPasswordBody = lstParameters.Where(p => p.Name.Equals("ForgotPasswordBody")).FirstOrDefault().Value.Replace("{Password}", user.Password); EmailBL.SendEmails(new DA.MailMessageDA() { ToAddresses = new string[] { user.Email }, Subject = ForgotPasswordSubject, Body = ForgotPasswordBody }); var PasswordSent = lstParameters.Where(p => p.Name.Equals("PasswordSentText")).FirstOrDefault().Value; lblPasswordSent.Text = PasswordSent; lblPasswordSent.Visible = true; } }
//****************************************** private void ucMCO_PTAAccountingLine_Load(object sender, EventArgs e) { ucAvailability.IsInterJetProcess = false; if (!Convert.ToBoolean(ParameterBL.GetParameterValue("AllowDecimalNumbers").Values)) { txtQuantity.CharsIncluded = null; txtBasisFare.Text = "0"; txtBasisFare.CharsIncluded = null; txtTaxe1.Text = "0"; txtTaxe1.CharsIncluded = null; txtTaxe2.Text = "0"; txtTaxe2.CharsIncluded = null; allowDecimal = false; } HideListboxControls(); foreach (Control txt in this.Controls) { if (txt is SmartTextBox && !txt.Enabled) { txt.BackColor = SystemColors.Control; } } rdoMCO.Checked = true; rdoMCO.Focus(); }
/// <summary> /// Carga el catalogo de perfiles por codigo y carga la primer pantalla dependiendo si es por flujo /// o por opcion del menu /// </summary> private void InitialProcess() { if (IsReservationFlow) { toolStripDropDownOptionProfiles.Enabled = false; pnlProfiles.TabIndex = 1; toolStripProfileMenu.TabIndex = 2; LoaderProfiles.AddToPanel(LoaderProfiles.Zone.Modal_Profile, this, Resources.Profiles.Constants.UC_WELCOME_PROFILES); } else { string activeProfiles = ParameterBL.GetParameterValue(Resources.Profiles.Constants.ACTIVE_PROFILES).Values; if (Convert.ToBoolean(activeProfiles)) { toolStriptxtSearch.Enabled = true; toolStripTextDK.Enabled = true; ToolStripMenuItemCreateProfile2ndLevel.Enabled = true; ToolStripMenuItemNewProfile.Enabled = true; } else { ToolStripMenuItemCreateProfile2ndLevel.Enabled = false; ToolStripMenuItemNewProfile.Enabled = false; } LoaderProfiles.AddToPanel(LoaderProfiles.Zone.Modal_Profile, this, Resources.Profiles.Constants.UC_WELCOME_PROFILES); } }
private void InitialValidations() { try { if (this.Parameters != null) { if (this.Parameters.Length.Equals(1)) { lblTA.Text = this.Parameters[0]; BannerImageList.Clear(); lblStateConection.Text = "No Conectado"; lblStateConection.ForeColor = Color.Red; string sabreAnswer = string.Empty; string ta = string.Empty; string send = "‡J"; using (CommandsAPI objCommand = new CommandsAPI()) { sabreAnswer = objCommand.SendReceive(send); } CommandsQik.CopyResponse(sabreAnswer, ref ta, 1, 21, 6); SetTABL.SetTa(Login.Firm, ta); } else if (this.Parameters.Length.Equals(3)) { lblTA.Text = this.Parameters[0]; lblBienvenido.Text = this.Parameters[1]; lblInformacion.Text = this.Parameters[2]; lblStateConection.Visible = false; } } else { if (string.IsNullOrEmpty(activeBanner)) { activeBanner = ParameterBL.GetParameterValue("ActiveBanner").Values; } if (Convert.ToBoolean(activeBanner)) { try { if (BannerImageList != null) { if (BannerImageList.Count.Equals(0)) { BannerImageList = GetBannerImageBL.GetBannerImageList("1"); } if (BannerImageList.Count > 0) { SetDinamicImages(); } } } catch { } } } } catch { } }
private void btnSave_Click(object sender, EventArgs e) { if (CacheBL.parameterList != null) { ParameterBL.GetInstance().SetParameters(CacheBL.parameterList); KryptonMessageBox.Show("Değişiklikler kayıt edildi", "Başarılı", MessageBoxButtons.OK); } }
private void FillList() { var parameter = ParameterBL.GetParameterValue("VolarisMessage"); if (parameter != null && !string.IsNullOrEmpty(parameter.Values)) { messageList = parameter.Values.Split('|').ToList(); } }
private void btnOK_Click(object sender, System.EventArgs e) { InputResponse = this.txtInput.Text; Parameter pass = ParameterBL.GetParameterValue("PasswordProfilesDelete"); if (InputResponse.Equals(pass.Values)) { if (!string.IsNullOrEmpty(firstStarName) && string.IsNullOrEmpty(secondStarName)) { DialogResult result = MessageBox.Show(string.Format("¿DESEAS BORRAR LA ESTRELLA DE PRIMER NIVEL {0}?", firstStarName), Resources.Constants.MYCTS, MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (result.Equals(DialogResult.Yes)) { Delete1stLevelBL.Delete1stLevel(pcc, firstStarName); //Active1stLevelBL.Active1stLevel(pcc, firstStarName); SetProfileChangesBL.SetProfile(Login.PCC, Login.Agent, firstStarName, string.Empty, DateTime.Now); CatAllStarsBL.ListAllStars.Clear(); LoaderProfiles.AddToPanel(LoaderProfiles.Zone.Modal_Profile, this, Resources.Profiles.Constants.UC_WELCOME_PROFILES); } } else if (!string.IsNullOrEmpty(firstStarName) && !string.IsNullOrEmpty(secondStarName)) { DialogResult result = MessageBox.Show(string.Format("¿DESEAS BORRAR LA ESTRELLA DE SEGUNDO NIVEL {0}?", secondStarName), Resources.Constants.MYCTS, MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (result.Equals(DialogResult.Yes)) { Delete2ndLevelBL.Delete2ndLevel(secondStarName); //Active2ndLevelBL.Active2ndLevel(pcc, firstStarName, secondStarName); SetProfileChangesBL.SetProfile(Login.PCC, Login.Agent, firstStarName, secondStarName, DateTime.Now); bool noSecondStar = true; List <CatAllStars> Star2Count = CatAllStarsBL.GetAll2ndStarDetailed_Profile(ucProfileSearch.star1Info[0].Pccid, ucProfileSearch.star1Info[0].Level1, Login.OrgId); if (Star2Count != null) { foreach (CatAllStars item in Star2Count) { if (item.Active) { noSecondStar = false; break; } } } if (noSecondStar) { Update1stLevelBL.Update1stLevel(pcc, firstStarName, string.Empty, 2); } LoaderProfiles.AddToPanel(LoaderProfiles.Zone.Modal_Profile, this, Resources.Profiles.Constants.UC_WELCOME_PROFILES); } } } else { MessageBox.Show(Resources.Profiles.Constants.PASSWORD_ERROR, Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Information); } this.Close(); }
private void ucPlaceRecordQueue_Load(object sender, EventArgs e) { string sabreAnswer = String.Empty; string QueueBritish = ParameterBL.GetParameterValue("QueueBritish").Values; using (CommandsAPI objCommand = new CommandsAPI()) { sabreAnswer = objCommand.SendReceive(QueueBritish); CommandsQik.CopyResponse(sabreAnswer, ref ucFirstValidations.dk, 1, 19, 6); } Loader.AddToPanel(Loader.Zone.Middle, this, Resources.Constants.UCWELCOME); }
public static void ReSendPDFDocumnets(string ticketNumber, string urlVirtuallyThere, string ccMail) { Parameter mailToSend = ParameterBL.GetParameterValue("MailThatSendFeeRule"); Parameter mailPassword = ParameterBL.GetParameterValue("PasswordThatMailToSend"); Parameter displyName = ParameterBL.GetParameterValue("NameSendEmail"); try { BuildElectronicTicketContract ws = new BuildElectronicTicketContract(); ws.SendPDFDocuments(ticketNumber, Login.Mail, ccMail, urlVirtuallyThere, mailToSend.Values, mailPassword.Values, displyName.Values); } catch { } }
private void ActivateCalculateChargeService() { if (this.InvokeRequired) { SenderCallBack scb = new SenderCallBack(ActivateCalculateChargeService); this.Invoke(scb); } else { activateFormOfPaymentCS = ParameterBL.GetParameterValue("ActivateFormOfPaymentCS"); activateOldRemarkCS = ParameterBL.GetParameterValue("ActivateOldRemarkCS"); CalculateChargeService(); } }
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) { if (e.Item is GridDataItem) { var dataItem = (GridDataItem)e.Item; var lstParameters = ParameterBL.GetParameters(); var filesPath = lstParameters.Where(p => p.Name.Equals("FilesPath")).FirstOrDefault().Value; if (!File.Exists(filesPath + dataItem["colPDFFILE"].Text)) { dataItem["colPDF"].Controls.Clear(); } if (!File.Exists(filesPath + dataItem["colXMLFILE"].Text)) { dataItem["colXML"].Controls.Clear(); } } }
protected void Page_Load(object sender, EventArgs e) { try { var invoiceId = int.Parse(Request["FacturaId"].ToString()); var invoice = GeneralBL.GetInvoice(invoiceId); var lstParameters = ParameterBL.GetParameters(); var filesPath = lstParameters.Where(p => p.Name.Equals("FilesPath")).FirstOrDefault().Value; if (Request["FileType"].ToString() == "PDF") { GeneralBL.Log((int)Constants.Actions.DESCARGA_PDF, ((Users)Session["CCFNUser"]).UserId, "", invoiceId); var fileInfo = new FileInfo(filesPath + "\\" + invoice.PDF); Response.Clear(); Response.ClearHeaders(); Response.ClearContent(); Response.AddHeader("Content-Disposition", "attachment; filename=" + invoice.PDF); Response.AddHeader("Content-Length", fileInfo.Length.ToString()); Response.ContentType = "text/plain"; Response.Flush(); Response.TransmitFile(filesPath + "\\" + invoice.PDF); Response.End(); } else if (Request["FileType"].ToString() == "XML") { GeneralBL.Log((int)Constants.Actions.DESCARGA_XML, ((Users)Session["CCFNUser"]).UserId, "", invoiceId); var fileInfo = new FileInfo(filesPath + "\\" + invoice.XML); Response.Clear(); Response.ClearHeaders(); Response.ClearContent(); Response.AddHeader("Content-Disposition", "attachment; filename=" + invoice.XML); Response.AddHeader("Content-Length", fileInfo.Length.ToString()); Response.ContentType = "text/plain"; Response.Flush(); Response.TransmitFile(filesPath + "\\" + invoice.XML); Response.End(); } } catch (Exception ex) { Console.WriteLine(ex.Message); } }
/// <summary> /// Gets the agent contact. /// </summary> /// <returns></returns> private InterJetAgentContact GetAgentContact() { Parameter parameter = ParameterBL.GetParameterValue("DireccionCTS"); if (parameter != null) { string[] addresithPI = parameter.Values.Split('|'); string[] names = Login.NombreCompleto.Split(' '); string name = ""; string lastName = ""; if (names.Length >= 3) { name = names[0]; lastName = names[2]; } else { name = names[0]; lastName = names[1]; } return(new InterJetAgentContact { Name = name, LastName = lastName, Email = Login.Mail, Address1 = addresithPI[0], Address2 = addresithPI[1], Address3 = addresithPI[2], City = addresithPI[3], State = addresithPI[4], Country = addresithPI[5], PrimaryTelephone = addresithPI[6], PostalCode = addresithPI[7] }); } return(new InterJetAgentContact()); }
protected void Page_Load(object sender, EventArgs e) { Response.Cache.SetCacheability(HttpCacheability.NoCache); try { if (!IsPostBack) { var lstParameters = ParameterBL.GetParameters(); var OkMessage = lstParameters.Where(p => p.Name.Equals("RegistrationSuccessMessage")).FirstOrDefault().Value; lblRegistered.Text = OkMessage; } Session["CCFNUser"] = null; Session["CCFNRoles"] = null; txtUsername.Focus(); } catch (Exception ex) { Response.Write("Error: " + ex.Message); } }
//Establece el estado de los controles private void ucRevisedCharge_Load(object sender, EventArgs e) { ucAvailability.IsInterJetProcess = false; if (!Convert.ToBoolean(ParameterBL.GetParameterValue("AllowDecimalNumbers").Values)) { txtBaseAmount.CharsIncluded = null; txtTax1.CharsIncluded = null; txtTax2.CharsIncluded = null; txtTax3.CharsIncluded = null; } Previousvalues(); lbGeneric.BringToFront(); if (ucTicketsEmissionInstructions.WithCharge) { EnableDisableControls(true); txtBaseAmount.BackColor = Color.White; txtTax1.BackColor = Color.White; txtTax2.BackColor = Color.White; txtTax3.BackColor = Color.White; txtCode1.BackColor = Color.White; txtCode2.BackColor = Color.White; txtCode3.BackColor = Color.White; txtBaseAmount.Focus(); } else if (ucTicketsEmissionInstructions.WithoutCharge) { EnableDisableControls(false); txtBaseAmount.BackColor = SystemColors.Control; txtTax1.BackColor = SystemColors.Control; txtTax2.BackColor = SystemColors.Control; txtTax3.BackColor = SystemColors.Control; txtCode1.BackColor = SystemColors.Control; txtCode2.BackColor = SystemColors.Control; txtCode3.BackColor = SystemColors.Control; txtAirlineTicket.Focus(); } txtAirlineTicke2.BackColor = SystemColors.Control; }
public List <VolarisContactEmail> GetConfiguredEmails() { var configuredEmailParameter = ParameterBL.GetParameterValue("VolarisConfiguredEmail"); var emails = new List <VolarisContactEmail>(); if (configuredEmailParameter != null && !string.IsNullOrEmpty(configuredEmailParameter.Values)) { var emailsStrings = configuredEmailParameter.Values.Split('|'); foreach (var emailString in emailsStrings) { if (!string.IsNullOrEmpty(emailString)) { var email = new VolarisContactEmail() { Email = emailString }; emails.Add(email); } } } return(emails); }
private void btnAccept_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(txtUrl.Text)) { try { System.Diagnostics.Process.Start(txtUrl.Text); } catch { MessageBox.Show( "La URL ingresada no es válida", Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Information); txtUrl.Text = string.Empty; return; } DialogResult result = MessageBox.Show( "¿Se desplego Correctamente el archivo?", Resources.Constants.MYCTS, MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (result.Equals(DialogResult.Yes)) { ParameterBL.UpdateComissionBoardURL("TablaComisiones", txtUrl.Text); MessageBox.Show( "Actualización Completada", Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Information); Loader.AddToPanel(Loader.Zone.Middle, this, Resources.Constants.UCWELCOME); } else { MessageBox.Show( "Vuelva a ingresar la URL", Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Information); txtUrl.Text = string.Empty; } } }
private void toolStripButtonQueues_Click(object sender, EventArgs e) { string messageQueue = ParameterBL.GetParameterValue("MessageQueue").Values; string numQueue = Login.Queue; string sabreAnswer = string.Empty; string commandQueue = string.Format("QC/{0}", numQueue); using (CommandsAPI command = new CommandsAPI()) { sabreAnswer = command.SendReceive(commandQueue, 0, 0); } if (string.IsNullOrEmpty(sabreAnswer) | sabreAnswer.Equals("NOTHING")) { return; } int row = 0; int col = 0; string result = string.Empty; try { CommandsQik.searchResponse(sabreAnswer, "HAS", ref row, ref col, 2); col += 4; CommandsQik.CopyResponse(sabreAnswer, ref result, row, col, 9); int queues = 0; Int32.TryParse(result, out queues); if (queues > 0) { lblQueue.Text = string.Format(messageQueue, Login.Queue, queues); } } catch { } }
/// <summary> /// Envia comando para desplegar los numeros de boletos generados /// </summary> private void SendValidationTicketCommand() { TktNumber = new List <string>(); PaxName = new List <string>(); LinkVT = new List <string>(); sabreAnswer = string.Empty; sabreConcat = string.Empty; string emitedPCC = string.Empty; string command = Resources.TicketEmission.Constants.COMMANDS_AST_T; using (CommandsAPI objCommands = new CommandsAPI()) { sabreAnswer = objCommands.SendReceive(command); } //return; sabreConcat = sabreAnswer; SearchTKT(); sabreConcat = sabreConcat.Replace('‡', '\n'); string[] numbersOfTkt = sabreConcat.Split(new char[] { '\n' }); foreach (string tkt in numbersOfTkt) { if (tkt.Length > 30 && ValidateRegularExpression.ValidateThirteenNumbers(tkt.Substring(7, 13)) && tkt.Substring(4, 2) != "TV") { emitedPCC = recoverEmitedPCC(tkt); TktNumber.Add(tkt.Substring(7, 13)); if (tkt.Substring(20, 1) == "/") { PaxName.Add(tkt.Substring(27, 7).Trim()); } else { PaxName.Add(tkt.Substring(24, 7).Trim()); } } } sabreAnswer = string.Empty; sabreConcat = string.Empty; //********************************************************************** string recordLocalizator = ucFirstValidations.LocatorRecord; if (string.IsNullOrEmpty(recordLocalizator)) { recordLocalizator = ucTicketEmissionBuildCommand.RecordLocator; } Parameter activateTicketPrinter = ParameterBL.GetParameterValue("ActivateTicketPrinter"); if (Convert.ToBoolean(activateTicketPrinter.Values)) { List <string> listTicketsByPNR = GetTicketsByPNRBL.GetTKTByPNR(recordLocalizator); for (int j = 0; j < TktNumber.Count; j++) { if (!listTicketsByPNR.Contains(TktNumber[j].Substring(3, 10))) { listNewTickets.Add(TktNumber[j]); } } } //************************************************************************** for (int i = 0; i < TktNumber.Count; i++) { string[] names = PaxName[i].Split(new char[] { '/' }); LinkVT.Add(string.Concat("https://services.tripcase.com/new/eticketPrint.html?pnr=", recordLocalizator, "&hostID=1W&ETTOT=1&ETNBR1=", TktNumber[i], "&pcc=", emitedPCC, "&action=printEticket")); AddDetailsTktsLinksBL.AddDetailsTktsLinks(Login.Agent, recordLocalizator, TktNumber[i].Substring(3, 10), PaxName[i], LinkVT[i], DateTime.Now); } //*********************************************** if (Convert.ToBoolean(activateTicketPrinter.Values)) { GetInfoTicketDelegate(listNewTickets); } //*********************************************** }
private void btnActivation_Click(object sender, EventArgs e) { DialogResult yesNo = MessageBox.Show("¿SEGURO QUE DESEA ACTIVAR LA REGLA " + txtRuleNumber.Text + " PARA EL CORPORATIVO " + attribute1 + "?", Resources.Constants.MYCTS, MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (yesNo.Equals(DialogResult.Yes)) { ActivationFeeRuleBL.ActivationFeeRule(Convert.ToInt32(txtRuleNumber.Text)); try { List <GetMailByUser> mailAndUserList = GetMailByUserBL.GetMailAndUser(agent); string info = string.Concat("Hola ", mailAndUserList[0].FamilyName, "\n\n", "MyCTS te informa que la regla de cargo por servicio número ", txtRuleNumber.Text, " ya se encuentra activa para el corporativo ", corp, "\n\n", "Te recordamos que los criterios para su aplicación son los siguientes:", "\n\n"); info = string.Concat(info, " -", "PORCENTAJE DE LA TARIFA BASE: ".ToUpper().PadRight(35, ' '), listInformationRule[0].DefaultFee, "\n\n"); info = string.Concat(info, " -", "Cantidad Fija:".ToUpper().PadRight(35, ' '), "$", listInformationRule[0].DefaultMount.ToString("0.00"), "\n\n"); info = string.Concat(info, " -", "Monto: ".ToUpper().PadRight(35, ' '), (listInformationRule[0].Mandatory) ? "No Negociable" : "Negociable", "\n\n"); if (listInfoFeeRule[aux].StartDate != Types.DateNullValue) { info = string.Concat(info, " -", "Inicio de regla: ".ToUpper().PadRight(35, ' '), listInfoFeeRule[aux].StartDate.ToString("dd-MM-yyyy"), "\n\n"); } if (listInfoFeeRule[aux].ExpirationDate != Types.DateNullValue) { info = string.Concat(info, " -", "Fin de regla: ".ToUpper().PadRight(35, ' '), listInfoFeeRule[aux].ExpirationDate.ToString("dd-MM-yyyy"), "\n\n"); } if (!string.IsNullOrEmpty(listInformationRule[0].Value2) && !string.IsNullOrEmpty(listInformationRule[0].Target)) { for (int i = 0; i < listInformationRule.Count; i++) { info = string.Concat(info, " -", string.Concat( listInformationRule[i].Target, ": ").ToUpper().PadRight(35, ' '), listInformationRule[i].Value2, "\n\n"); } } if (listLocationDK.Count > 0) { string locationDKNotAccepted = string.Empty; for (int j = 0; j < listLocationDK.Count; j++) { locationDKNotAccepted = string.Concat(locationDKNotAccepted, listLocationDK[j].LocationDK, ", "); } locationDKNotAccepted = locationDKNotAccepted.Trim().TrimEnd(new char[] { ',' }); info = string.Concat(info, " -", "Location(DK) Excluyente:".ToUpper().PadRight(35, ' '), locationDKNotAccepted, "\n"); } info = string.Concat(info, "\n\n", "Gracias por haber creado esta regla"); Parameter mailToSend = ParameterBL.GetParameterValue("MailThatSendFeeRule"); Parameter mailPassword = ParameterBL.GetParameterValue("PasswordThatMailToSend"); Parameter displyName = ParameterBL.GetParameterValue("NameSendEmail"); MailProvider ws = new MailProvider(); ws.SendEmail2(mailToSend.Values, mailPassword.Values, displyName.Values, mailAndUserList[0].UserMail, null, "Activación de Regla Cargo por Servicio", info); } catch { } MessageBox.Show("LA REGLA " + txtRuleNumber.Text + " QUEDO ACTIVA PARA EL CORPORATIVO " + attribute1, Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Information); Loader.AddToPanel(Loader.Zone.Middle, this, Resources.Constants.UCWELCOME); } else { btnClear.Focus(); } }
/// <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 { } } }
private void LoadControl() { //Carga el nombre del Splash en caso de que ocurra un //error para registrarlo en el log Common.LogApplicationItem.UserControlName = "Splash"; #region Datos Usuario User usuarioDto = m_userDto; string password = m_password; Login.Firm = usuarioDto.Firm; Login.passWord = password; Login.PCC = usuarioDto.PCC; Login.TA = usuarioDto.TA; Login.UserId = usuarioDto.UserId; Login.Queue = usuarioDto.Queue; Login.Mail = usuarioDto.UserMail; Login.NombreCompleto = usuarioDto.FamilyName; Login.IsMySabreBlocked = usuarioDto.IsMySabreBlocked; Login.Agent = usuarioDto.Agent; Login.IsFramework35Installed = usuarioDto.IsFramework35Installed; Login.ProfileAllAccess = usuarioDto.ProfileAllAccess; Login.ApplicationName = usuarioDto.ApplicationName; Login.OrgId = usuarioDto.OrgId; UserBL.OrgIdBL = usuarioDto.OrgId; Login.Supervisor = usuarioDto.Supervisor; Login.UpgradeStatus = usuarioDto.UpgradeStatus; //Crear perfil de properties de mySABRE por default #endregion if (Login.UpgradeStatus.Equals(0) && Login.ByParameters) { MessageBox.Show("Acción Cancelada. Ejecutar la aplicación MyCTS que se encuentra en el escritorio."); CloseApp(); } else if (Login.UpgradeStatus.Equals(0) && !Login.ByParameters) { GlobalConstants.PATH_SABRE_USER = string.Format(ConfigurationManager.AppSettings["PATH_MYSABRE_USER"] + "{0}", Login.Firm); GlobalConstants.PATH_SABRE_COMPILED = ConfigurationManager.AppSettings["PATH_MYSABRE_COMPILED"]; } else if (Login.UpgradeStatus.Equals(2) && !Login.ByParameters) { bool exists = File.Exists(Path.Combine(ConfigurationManager.AppSettings["PATH_SABRERED_USER"], @"Profiles\3L64_1571\mysabre.exe")); if (!exists) { MessageBox.Show("Su usuario no puede trabajar con la versión instalada en este equipo, se empezara a actualizar a MyCTS2"); Login.UpgradeStatus = 1; UpdateSRW(); } } GlobalConstants.PATH_SABRE_USER = ConfigurationManager.AppSettings["PATH_SABRERED_USER"]; GlobalConstants.PATH_SABRE_COMPILED = ConfigurationManager.AppSettings["PATH_SABRERED_COMPILED"]; try { SendMessages("Inicializando . . ."); Parameters.ServerDateTime = MyCTS.Services.Contracts.Productivity.GetCurrentDateTime(); Parameters.LocalDateTime = DateTime.Now; //Verifica que el usuario tenga framework 3.5 instalado if (usuarioDto.InstallFramework35) { SilentInstaller.CheckFrameworkVersion(); } DeleteInitialFiles(); GlobalConstants.FilesDBList = CatalogsBL.GetCatalogsFileNames(); try { MyCTSAPI.EnabledBrowser(true); } catch {} // Actualizar a SRW UpdateSRW(); //Tiempos de respuesta del API para comandos manuales y comandos extendidos try { Parameters.CurrentTimeAPINormal = ParameterBL.GetParameterValue("CurrentTimeAPINormal").Values; Parameters.CurrentTimeAPIExtended = ParameterBL.GetParameterValue("CurrentTimeAPIExtended").Values; } catch { Parameters.CurrentTimeAPINormal = "29"; Parameters.CurrentTimeAPIExtended = "240"; } Parameters.TimeExtendedAPI = false; } catch { } #region Verificando configuración . . . string[] driversPath = new string[] { "c:\\", "d:\\" }; string strPath = string.Empty; string strPathTurbo = string.Empty; string strTA = null; try { SendMessages("Verificando configuración . . ."); if (string.IsNullOrEmpty(usuarioDto.TA)) { Login.IsFirstTime = true; foreach (string myDrive in driversPath) { //Obtener la TA de cada maquina. strPath = myDrive + Resources.Constants.PATH_TA_FILE; strTA = GetTAUserMachine(strPath); usuarioDto.TA = strTA; if (!string.IsNullOrEmpty(strTA)) { break; } } } //Update la TA UserBL.UpdateUser(usuarioDto.ApplicationId, usuarioDto.UserId, usuarioDto.UserName, usuarioDto.LoweredUserName, usuarioDto.UserMail, DateTime.Now, usuarioDto.Firm, password, usuarioDto.FamilyName, usuarioDto.Agent, usuarioDto.Queue, usuarioDto.PCC, usuarioDto.TA); //Obtiene el profile del usuario. Profile profileDto = m_userDto.ProfileUser; //Cambiar el nombre del archivo de TurboSABRE if (profileDto != null) { string bannerText = Common.GetProfileElement("BANNER", profileDto.PropertyNames, profileDto.PropertyValuesString); if (string.IsNullOrEmpty(bannerText)) { bannerText = Resources.Constants.BANNER_TEXT; } Login.BannerText = bannerText; Login.UserProfile = profileDto; if (!profileDto.LastUpdatedDate.Equals(DateTime.MinValue)) { foreach (string myDrive in driversPath) { //Obtener la TA de cada maquina. strPathTurbo = myDrive + Resources.Constants.PATH_TURBO_FILE; ChangeTurboSABREFile(strPathTurbo); } } } } catch (Exception ex) { Common.AddMessageToLog(ex); MessageBox.Show("No ha sido posible verificar la información del perfil, por favor contacte con el área de soporte.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Stop); CloseApp(); } #endregion ActualizaVersionDeMyCTS(); #region Creando datos del perfil . . . SendMessages("Cargando datos del perfil . . ."); try { SetSettingsUser(); } catch (Exception ex) { Common.AddMessageToLog(ex); MessageBox.Show("No ha sido posible copiar los archivos de configuración, por favor contacte con el área de soporte.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Stop); CloseApp(); } #endregion #region Cargando archivos de inicio . . . SendMessages("Cargando archivos de inicio . . ."); try { LoadMissingCatalogs(); } catch (Exception ex) { Common.AddMessageToLog(ex); MessageBox.Show("No ha sido posible descargar la información, por favor contacte con el área de soporte.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Stop); CloseApp(); } #endregion //Obtiene la contraseña para poder ingresar comandos de forma manual Parameter parameter = ParameterBL.GetParameterValue("ManualCommands"); Parameters.PasswordManualCommands = (parameter != null) ? parameter.Values : string.Empty; parameter = ParameterBL.GetParameterValue("SecondsLogs"); Parameters.SecondsLogs = (parameter != null) ? parameter.Values : "60000"; parameter = ParameterBL.GetParameterValue("NumCommandsToInsertLogs"); Parameters.NumCommandsToInsertLogs = (parameter != null) ? parameter.Values : "15"; CloseThisWin(); }
private void toolStripButtonEinvoice_Click(object sender, EventArgs e) { string url = ParameterBL.GetParameterValue("eInvoicedButtonURL").Values; System.Diagnostics.Process.Start(url); }
/// <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); } }
public void OpenConnection() { if (this.IsConnected) { return; } try { Parameter parameterFirm = ParameterBL.GetParameterValue("FirmWS"); Parameter parameterPassword = ParameterBL.GetParameterValue("PasswordWS"); Parameter parameterPCC = ParameterBL.GetParameterValue("PCCWS"); string username = parameterFirm.Values; string password = parameterPassword.Values; string domain = "DEFAULT"; this.IPcc = parameterPCC.Values; this.ConversationId = "TestSession"; DateTime dt = DateTime.UtcNow; string tstamp = dt.ToString("s") + "Z"; serviceOpen.MessageHeader msgHeader = GetOpenMessageHeader(); serviceOpen.Security security = new serviceOpen.Security(); serviceOpen.SecurityUsernameToken securityUserToken = new serviceOpen.SecurityUsernameToken(); securityUserToken.Username = username; securityUserToken.Password = password; securityUserToken.Organization = this.IPcc; securityUserToken.Domain = domain; security.UsernameToken = securityUserToken; serviceOpen.SessionCreateRQ req = new serviceOpen.SessionCreateRQ(); serviceOpen.SessionCreateRQPOS pos = new serviceOpen.SessionCreateRQPOS(); serviceOpen.SessionCreateRQPOSSource source = new serviceOpen.SessionCreateRQPOSSource(); source.PseudoCityCode = this.IPcc; pos.Source = source; req.POS = pos; serviceOpen.SessionCreateRQService serviceObj = new serviceOpen.SessionCreateRQService(); serviceObj.MessageHeaderValue = msgHeader; serviceObj.SecurityValue = security; serviceOpen.SessionCreateRS resp = serviceObj.SessionCreateRQ(req); // Send the request if (resp.Errors != null && resp.Errors.Error != null) { string x = "Error : " + resp.Errors.Error.ErrorInfo.Message; } else { msgHeader = serviceObj.MessageHeaderValue; security = serviceObj.SecurityValue; this.ConversationId = msgHeader.ConversationId; // ConversationId to a string this.SecurityToken = security.BinarySecurityToken; // BinarySecurityToken to a string this.DateReference = DateTime.Now; this.isConnected = true; } } catch { this.isConnected = false; } }
public static void CreateFilesPDF(List <string> tickets) { Parameter mailToSend = ParameterBL.GetParameterValue("MailThatSendFeeRule"); Parameter mailPassword = ParameterBL.GetParameterValue("PasswordThatMailToSend"); Parameter displyName = ParameterBL.GetParameterValue("NameSendEmail"); string[] tiketsArray = new string[tickets.Count]; string[] virtuallyThere = new string[tickets.Count]; List <GetLinkByTkt> indexList = null; for (int j = 0; j < tickets.Count; j++) { tiketsArray[j] = tickets[j]; indexList = new List <GetLinkByTkt>(); indexList = GetLinkByTktBL.GetLinkByTkt(tickets[j].Substring(3, 10), Login.OrgId); if (indexList.Count > 0) { virtuallyThere[j] = indexList[0].LinkVirtuallyThere; } else { virtuallyThere[j] = "http://www.google.com.mx"; } } if (tickets.Count > 0) { try { string mail = Login.Mail; if (!string.IsNullOrEmpty(ucSendTicketPrinter.TempCCMail)) { mail = string.Concat(mail, ";", ucSendTicketPrinter.TempCCMail); ucSendTicketPrinter.TempCCMail = string.Empty; } if (ucFirstValidations.Attribute1 != null) { if (ucFirstValidations.Attribute1.Equals(Resources.TicketEmission.Constants.ATTRIBUTE1_CFE100)) { BuildElectronicTicketCFEContract ws = new BuildElectronicTicketCFEContract(); ws.SendInfoToBuilPDF(tiketsArray, virtuallyThere, ucTicketsEmissionInstructions.Airline, mailToSend.Values, mailPassword.Values, mail, displyName.Values); } else { BuildElectronicTicketContract ws = new BuildElectronicTicketContract(); ws.SendInfoToBuilPDF(tiketsArray, virtuallyThere, ucTicketsEmissionInstructions.Airline, mailToSend.Values, mailPassword.Values, mail, displyName.Values); } } else { if (!string.IsNullOrEmpty(ucSendTicketPrinter.DK)) { GetAttribute1 attribute1 = GetAttribute1BL.GetAttribute(ucSendTicketPrinter.DK, Login.OrgId); if (attribute1.Attribute1.Equals(Resources.TicketEmission.Constants.ATTRIBUTE1_CFE100)) { BuildElectronicTicketCFEContract ws = new BuildElectronicTicketCFEContract(); ws.SendInfoToBuilPDF(tiketsArray, virtuallyThere, ucTicketsEmissionInstructions.Airline, mailToSend.Values, mailPassword.Values, mail, displyName.Values); } else { BuildElectronicTicketContract ws = new BuildElectronicTicketContract(); ws.SendInfoToBuilPDF(tiketsArray, virtuallyThere, ucTicketsEmissionInstructions.Airline, mailToSend.Values, mailPassword.Values, mail, displyName.Values); } ucSendTicketPrinter.DK = string.Empty; } else { BuildElectronicTicketContract ws = new BuildElectronicTicketContract(); ws.SendInfoToBuilPDF(tiketsArray, virtuallyThere, ucTicketsEmissionInstructions.Airline, mailToSend.Values, mailPassword.Values, mail, displyName.Values); } } } catch { } } }
protected void Page_Load(object sender, EventArgs e) { try { var lstFacturas = Request["Facturas"]; var files = GeneralBL.GetInvoiceFiles(lstFacturas, ((Users)Session["CCFNUser"]).UserId); if (files.Rows.Count > 0) { var lstParameters = ParameterBL.GetParameters(); var filesPath = lstParameters.Where(p => p.Name.Equals("FilesPath")).FirstOrDefault().Value; var memStream = new MemoryStream(); using (var archive = new ZipArchive(memStream, ZipArchiveMode.Create, true, null)) { foreach (DataRow row in files.Rows) { if (File.Exists(filesPath + row["RFC"] + "\\" + row["PDF"])) { using (var entry = archive.CreateEntry(row["PDF"].ToString())) { using (var stream = new MemoryStream(File.ReadAllBytes(filesPath + row["RFC"] + "\\" + row["PDF"]))) { var writer = new BinaryWriter(entry.Open()); writer.Write(stream.ToArray()); writer.Flush(); } } } if (File.Exists(filesPath + row["RFC"] + "\\" + row["XML"])) { using (var entry = archive.CreateEntry(row["XML"].ToString())) { using (var stream = new MemoryStream(File.ReadAllBytes(filesPath + row["RFC"] + "\\" + row["XML"]))) { var writer = new BinaryWriter(entry.Open()); writer.Write(stream.ToArray()); writer.Flush(); } } } } } memStream.Seek(0, SeekOrigin.Begin); if (memStream != null && memStream.Length > 0) { Response.Clear(); Response.AddHeader("content-disposition", "attachment; filename=facturas.zip"); Response.ContentType = "application/zip"; Response.BinaryWrite(memStream.ToArray()); Response.End(); } } } catch (Exception ex) { Console.WriteLine(ex.Message); } }