Пример #1
0
		private void reportThisErrorToolStripMenuItem_Click(
			object sender,
			EventArgs e )
		{
			if ( MessageBox.Show(
				this,
				"Do you want to send the error message to zeta software now?\r\n\r\nPlease note: You must be connected to the internet.",
				"zeta HelpDesk UpdateCopier",
				MessageBoxButtons.YesNo,
				MessageBoxIcon.Question,
				MessageBoxDefaultButton.Button2 ) == DialogResult.Yes )
			{
				using ( new ZetaLib.Windows.Common.WaitCursor( this ) )
				{
					ZetaUploader.Communication ws =
						new ZetaUploader.Communication();

					ZetaUploader.SendFileInformation sendInfo =
						new ZetaUploader.SendFileInformation();
					sendInfo.EMailSubject = "[zeta HelpDesk UpdateCopier] Error occured";
					sendInfo.FileName = "ZetaHelpDeskUpdateCopierError.zip";
					sendInfo.ReceiverEMailAddresses =
						new string[]
						{
							"*****@*****.**"
						};

					CompressionHelper.CompressStringsInfo compressInfo =
						new CompressionHelper.CompressStringsInfo();

					compressInfo.AddString(
						LogCentral.MakeTraceMessage(
						exception ),
						"ZetaHelpDeskUpdateCopierError.txt" );
					compressInfo.AddString(
						LoggingInformation.All,
						"EnvironmentInfo.txt" );

					sendInfo.FileContent =
						CompressionHelper.CompressStrings(
						compressInfo );

					ws.SendFileEx( sendInfo );

					reportThisErrorToolStripMenuItem.Enabled = false;
					MessageBox.Show(
						this,
						"The error message was successfully sent to zeta software. Thank you!",
						"zeta HelpDesk UpdateCopier",
						MessageBoxButtons.OK,
						MessageBoxIcon.Information );
				}
			}
		}
Пример #2
0
		private void sendLogfilesToZetaSoftwareToolStripMenuItem_Click( object sender, EventArgs e )
		{
			if ( MessageBox.Show(
				this,
				"Do you want to send the zeta HelpDesk logfiles to zeta software now?\r\n\r\nPlease note: You must be connected to the internet.",
				"zeta HelpDesk UpdateCopier",
				MessageBoxButtons.YesNo,
				MessageBoxIcon.Question,
				MessageBoxDefaultButton.Button2 ) == DialogResult.Yes )
			{
				using ( new ZetaLib.Windows.Common.WaitCursor( this ) )
				{
					string[] logFilePaths = GetLogFilesPaths();

					if ( logFilePaths == null || logFilePaths.Length <= 0 )
					{
						MessageBox.Show(
							this,
							"No logfiles were found.",
							"zeta HelpDesk UpdateCopier",
							MessageBoxButtons.OK,
							MessageBoxIcon.Information );
					}
					else
					{
						ZetaUploader.Communication ws =
							new ZetaUploader.Communication();

						ArrayList tempLogFilePaths = new ArrayList();

						int index = 1;
						foreach ( string logFilePath in logFilePaths )
						{
							string tempLogFilePath =
								Path.Combine(
								Path.GetTempPath(),
								StringHelper.AddZerosPrefix( index, 2 ) + "-" +
								Guid.NewGuid() + ".log" );

							File.Copy(
								logFilePath,
								tempLogFilePath );

							tempLogFilePaths.Add( tempLogFilePath );

							index++;
						}

						try
						{
							ws.SendFile(
								"zeta HelpDesk UpdateCopier logfiles.zip",
								CompressionHelper.CompressFiles(
								(string[])tempLogFilePaths.ToArray( typeof( string ) ) ),
								"*****@*****.**",
								"Logfile(s) for zeta HelpDesk UpdateCopier" );
						}
						finally
						{
							foreach ( string tempLogFilePath in tempLogFilePaths )
							{
								if ( File.Exists( tempLogFilePath ) )
								{
									File.Delete( tempLogFilePath );
								}
							}
						}

						MessageBox.Show(
							this,
							"The logfiles were successfully sent to zeta software.",
							"zeta HelpDesk UpdateCopier",
							MessageBoxButtons.OK,
							MessageBoxIcon.Information );
					}
				}
			}
		}