private void BtnSend_Click(object sender, EventArgs e)
 {
     try
     {
         ComputerInformation ci = new ComputerInformation();
         Pgs.SendReport(ci.GetOs(), chosenComputerName, reporttype, selectedItem, selectedEquipementType, tbFio.Text, rtbComment.Text);
         var result = MessageBox.Show("Заявка успешно отправлена! Желаете сохранить ее в виде текстового файла?", "Успех", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
         if (result == DialogResult.Yes)
         {
             SaveFileDialog sv = new SaveFileDialog();
             sv.FileName = "result";
             sv.Filter   = "Тексовый файл|*.txt";
             result      = sv.ShowDialog();
             if (result == DialogResult.OK)
             {
                 System.IO.StreamWriter sw = new System.IO.StreamWriter(sv.FileName, false);
                 sw.WriteLine("ФИО: " + tbFio.Text);
                 sw.WriteLine("Компьютер: " + chosenComputerName);
                 sw.WriteLine("Тип заявки: " + reporttype.ToString());
                 sw.WriteLine("Комментарий:" + rtbComment.Text);
                 sw.Close();
                 MessageBox.Show("Успешно сохранено.", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
         }
         if (onReportFinished != null)
         {
             onReportFinished();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Ошибка отправки заявки: " + ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Beispiel #2
0
        private void CreateComputer()
        {
            ComputerInformation nw = new ComputerInformation();

            currentComputer._MAC  = nw.GetMACAddress();
            currentComputer._Name = nw.GetName();
            currentComputer._Ip   = nw.GetIp();
            currentComputer._Os   = nw.GetOs();
        }