Пример #1
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",
				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",
							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 logfiles.zip",
								CompressionHelper.CompressFiles(
								(string[])tempLogFilePaths.ToArray( typeof( string ) ) ),
								"*****@*****.**",
								"Logfile(s) for zeta HelpDesk" );
						}
						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",
							MessageBoxButtons.OK,
							MessageBoxIcon.Information );
					}
				}
			}
		}
Пример #2
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",
				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] Error occured";
					sendInfo.FileName = "ZetaHelpDeskError.zip";
					sendInfo.ReceiverEMailAddresses =
						new string[]
						{
							"*****@*****.**"
						};

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

					compressInfo.AddString(
						LogCentral.MakeTraceMessage(
						exception ),
						"ZetaHelpDeskError.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",
						MessageBoxButtons.OK,
						MessageBoxIcon.Information );
				}
			}
		}