Пример #1
0
 private void getLicense_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         if (e.ColumnIndex == this.LicencesTable.Columns["action"].Index)
         {
             try
             {
                 object name = this.LicencesTable.Rows[e.RowIndex].Cells["Licencja"].Value;
                 string filepath = this.path + "\\Licenses\\" + name.ToString();
                 Commit com = new Commit(filepath, this);
                 com.ShowDialog();
                 if (this.goodcertificate)
                 {
                     this.komSend = "";
                     Connection con = new Connection();
                     if (con.IsAvailableNetworkActive())
                     {
                         Eksport ex = new Eksport(this.savePath, true, this, this.licensePath, this.password);
                         try
                         {
                             ex.ShowDialog();
                         }
                         catch (System.Exception)
                         {
                         }
                         if (this.goodcertificate)
                         {
                             try
                             {
                                 System.IO.StreamReader sr = new System.IO.StreamReader(this.savePath);
                                 string file = sr.ReadToEnd();
                                 sr.Close();
                                 file = file.Replace("<status>podpisany</status>", "<status>wysłany</status>");
                                 System.IO.StreamWriter sw = new System.IO.StreamWriter(this.savePath, false);
                                 sw.Write(file);
                                 sw.Close();
                             }
                             catch (System.Exception ex2)
                             {
                                 MessageBox.Show("Protokół został wysłany, ale nie można zmienić jego statusu. " + ex2.Message, "Uwaga");
                                 base.Close();
                             }
                         }
                     }
                     else
                     {
                         this.komSend = "Protokół nie został wysłany na serwer z powodu braku internetu";
                     }
                     MessageBox.Show(this.komSend, "Uwaga");
                     base.Close();
                 }
             }
             catch (System.ArgumentOutOfRangeException)
             {
             }
         }
     }
     catch (System.Exception)
     {
     }
 }
Пример #2
0
 private void eksportujZSieciToolStripMenuItem_Click(object sender, System.EventArgs e)
 {
     if (this.currentStep != 0)
     {
         this.validateExportedXml(this.currentStep);
         Eksport imp = new Eksport(this.savePath, this.licensePath);
         imp.ShowDialog();
     }
     else
     {
         MessageBox.Show("Nie można wyeksportować podpisanego protokołu. Aby wysłać podpisany protokół proszę wybrać odpowiednią licencje.");
     }
 }
Пример #3
0
 private void getLicense_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         if (e.RowIndex >= 0)
         {
             if (e.ColumnIndex == this.LicencesTable.Columns["action"].Index)
             {
                 try
                 {
                     object name = this.LicencesTable.Rows[e.RowIndex].Cells["Licencja"].Value;
                     string filepath = this.path + "\\Licenses\\" + name.ToString();
                     this.wait.setWaitPanel("Trwa autozapis protokołu", "Prosimy czekać");
                     this.wait.setVisible(true);
                     this.saves(4);
                     this.wait.setWaitPanel("Trwa przygotowanie do podpisania protokołu", "Prosimy czekać");
                     this.wait.setVisible(true);
                     string xmlTMP = this.generateSaves(0);
                     Commit com = new Commit(filepath, this, xmlTMP);
                     com.ShowDialog();
                     if (this.goodcertificate)
                     {
                         this.wait.setWaitPanel("Trwa generowanie kodu kreskowego dla protokołu", "Prosimy czekać");
                         this.wait.setVisible(true);
                         string docXml = "";
                         this.currentStep = 0;
                         string xml = xmlTMP;
                         this.save.LoadXml(xml);
                         XmlNode header = this.save.SelectSingleNode("/save/header");
                         if (header != null)
                         {
                             docXml += header.OuterXml;
                         }
                         XmlNode step = this.save.SelectSingleNode("/save/step");
                         if (step != null)
                         {
                             docXml += step.OuterXml;
                         }
                         XmlNode form = this.save.SelectSingleNode("/save/form");
                         if (form != null)
                         {
                             docXml += form.OuterXml;
                         }
                         XmlNode komisja_sklad = this.save.SelectSingleNode("/save/komisja_sklad");
                         if (komisja_sklad != null)
                         {
                             docXml += komisja_sklad.OuterXml;
                         }
                         XmlNode hardWarningCode = this.save.SelectSingleNode("/save/hardWarningCode");
                         if (hardWarningCode != null)
                         {
                             docXml += hardWarningCode.OuterXml;
                         }
                         XmlNode softError = this.save.SelectSingleNode("/save/softError");
                         if (softError != null)
                         {
                             docXml += softError.OuterXml;
                         }
                         XmlNode hardError = this.save.SelectSingleNode("/save/hardError");
                         if (hardError != null)
                         {
                             docXml += hardError.OuterXml;
                         }
                         XmlNode hardWarning = this.save.SelectSingleNode("/save/hardWarning");
                         if (hardWarning != null)
                         {
                             docXml += hardWarning.OuterXml;
                         }
                         ClassMd5 i = new ClassMd5();
                         string controlSum = i.CreateMD5Hash(docXml);
                         codeBar code = new codeBar();
                         code.generateCode(controlSum);
                         this.codeBarCode = code.getCode();
                         this.codeBarText = code.getTextReadable();
                         this.wait.setWaitPanel("Trwa podpisywanie protokołu", "Prosimy czekać");
                         this.wait.setVisible(true);
                         xml = this.generateSaves(this.currentStep);
                         try
                         {
                             Certificate cer = new Certificate();
                             cer.SignXmlText(xml, this.savePath, this.password, filepath);
                         }
                         catch (System.Exception ex)
                         {
                             MessageBox.Show("Sign: " + ex.Message, "Uwaga");
                         }
                         try
                         {
                             this.komSend = "";
                             Connection con = new Connection();
                             if (con.IsAvailableNetworkActive())
                             {
                                 this.wait.setWaitPanel("Trwa wysyłanie protokołu", "Prosimy czekać");
                                 this.wait.setVisible(true);
                                 this.goodcertificate = false;
                                 this.error = false;
                                 Eksport ex2 = new Eksport(this.savePath, true, this, filepath, this.password);
                                 try
                                 {
                                     ex2.ShowDialog();
                                 }
                                 catch (System.Exception)
                                 {
                                 }
                                 if (this.goodcertificate)
                                 {
                                     try
                                     {
                                         System.IO.StreamReader sr = new System.IO.StreamReader(this.savePath);
                                         string file = sr.ReadToEnd();
                                         sr.Close();
                                         file = file.Replace("<status>podpisany</status>", "<status>wysłany</status>");
                                         System.IO.StreamWriter sw = new System.IO.StreamWriter(this.savePath, false);
                                         sw.Write(file);
                                         sw.Close();
                                     }
                                     catch (System.Exception ex3)
                                     {
                                         MessageBox.Show("Protokół został wysłany, ale nie można zmienić jego statusu. " + ex3.Message, "Uwaga");
                                     }
                                 }
                                 if (!this.goodcertificate && this.error)
                                 {
                                     this.codeBarCode = "";
                                     this.codeBarText = "";
                                     this.saves(4);
                                 }
                             }
                             else
                             {
                                 this.komSend = "Protokół nie został wysłany na serwer z powodu braku internetu. Z poziomu listy protokołów bedzie można ponowić operacje.";
                             }
                             this.password = "";
                         }
                         catch (System.Exception ex)
                         {
                             MessageBox.Show("Send: " + ex.Message, "Uwaga");
                         }
                         try
                         {
                             this.wait.setWaitPanel("Trwa zapisywanie protokołu na dysk", "Prosimy czekać");
                             this.wait.setVisible(true);
                             SaveProtocol saveP = new SaveProtocol(this.komSend, this.savePath);
                             saveP.ShowDialog();
                         }
                         catch (System.Exception ex)
                         {
                             MessageBox.Show("Save: " + ex.Message, "Uwaga");
                         }
                         try
                         {
                             this.wait.setWaitPanel("Trwa przygotowanie protokołu do druku", "Prosimy czekać");
                             this.wait.setVisible(true);
                             this.drukToolStripMenuItem_Click(sender, e);
                             this.wait.setVisible(false);
                         }
                         catch (System.Exception ex)
                         {
                             MessageBox.Show("Print: " + ex.Message, "Uwaga");
                         }
                     }
                 }
                 catch (System.ArgumentOutOfRangeException ex_5C5)
                 {
                 }
             }
         }
     }
     catch (System.Exception ex)
     {
     }
 }
Пример #4
0
 private void getProtocol_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         if (e.ColumnIndex == this.protocolsTable.Columns["fill"].Index)
         {
             if (e.RowIndex >= 0)
             {
                 try
                 {
                     int result = System.DateTime.Compare(this.electionData, System.DateTime.Now);
                     result = -1;
                     if (result <= 0)
                     {
                         try
                         {
                             object st = this.protocolsTable.Rows[e.RowIndex].Cells["Status"].Value;
                             if (st != null && st.ToString().ToLower() != "podpisany" && st.ToString().ToLower() != "wysłany")
                             {
                                 object protokol = this.protocolsTable.Rows[e.RowIndex].Cells["Protokol"].Value;
                                 object jns = this.protocolsTable.Rows[e.RowIndex].Cells["Gmina"].Value;
                                 object obw = this.protocolsTable.Rows[e.RowIndex].Cells["Obwód"].Value;
                                 object inst = this.protocolsTable.Rows[e.RowIndex].Cells["Instytucja"].Value;
                                 object okr = this.protocolsTable.Rows[e.RowIndex].Cells["Okręg"].Value;
                                 if (jns != null && obw != null && inst != null && okr != null && protokol != null)
                                 {
                                     try
                                     {
                                         string save = "";
                                         string[] protocolpart = protokol.ToString().Split(new char[]
                                         {
                                             '-'
                                         });
                                         string instJNS = protocolpart[4];
                                         string[] okr2 = okr.ToString().Split(new char[]
                                         {
                                             ' '
                                         });
                                         save = this.path + "\\saves\\" + protokol.ToString();
                                         string candidates = string.Concat(new string[]
                                         {
                                             this.path,
                                             "\\ProtocolsDef\\",
                                             this.electoralEampaignSave,
                                             "-",
                                             inst.ToString(),
                                             "-",
                                             instJNS,
                                             "-",
                                             okr2[0],
                                             ".xml"
                                         });
                                         string protocolDefinition = string.Concat(new string[]
                                         {
                                             this.path,
                                             "\\ProtocolsDef\\",
                                             this.electoralEampaignSave,
                                             "-",
                                             inst.ToString(),
                                             ".xml"
                                         });
                                         string committee = string.Concat(new string[]
                                         {
                                             this.path,
                                             "\\ProtocolsDef\\",
                                             this.electoralEampaignSave,
                                             "-",
                                             this.jns,
                                             "-",
                                             obw.ToString(),
                                             ".xml"
                                         });
                                         string validateDefinition = string.Concat(new string[]
                                         {
                                             this.path,
                                             "\\ProtocolsDef\\",
                                             this.electoralEampaignSave,
                                             "-",
                                             inst.ToString(),
                                             "_Walidacja.xml"
                                         });
                                         string OU = "";
                                         if (this.role == "P" || this.role == "Z")
                                         {
                                             OU = string.Concat(new object[]
                                             {
                                                 this.electoralEampaignURL.Trim(new char[]
                                                 {
                                                     ' '
                                                 }),
                                                 "-",
                                                 jns,
                                                 "-",
                                                 this.role,
                                                 "-",
                                                 this.circuit
                                             });
                                         }
                                         if (this.role == "O" || this.role == "A")
                                         {
                                             OU = string.Concat(new object[]
                                             {
                                                 this.electoralEampaignURL.Trim(new char[]
                                                 {
                                                     ' '
                                                 }),
                                                 "-",
                                                 jns,
                                                 "-",
                                                 this.role
                                             });
                                         }
                                         ProtocolForm pf = new ProtocolForm(this, this.header, protocolDefinition, candidates, committee, validateDefinition, save, OU, this.licensepath, this.version);
                                         try
                                         {
                                             pf.ShowDialog();
                                         }
                                         catch (System.Exception ex)
                                         {
                                             this.createProtocols();
                                         }
                                         this.refreshListOfProtocols();
                                     }
                                     catch (XmlException)
                                     {
                                         MessageBox.Show("Nieprawidłowy XML", "Error");
                                     }
                                 }
                             }
                         }
                         catch (System.Exception ex)
                         {
                             MessageBox.Show(ex.Message, "Error");
                         }
                     }
                     else
                     {
                         MessageBox.Show("Protokoły wypełniać można od " + this.electionData.ToShortDateString(), "Komunikat");
                     }
                 }
                 catch (System.Exception ex)
                 {
                     MessageBox.Show("Fill: " + ex.Message, "Error");
                 }
             }
         }
         if (e.ColumnIndex == this.protocolsTable.Columns["new"].Index)
         {
             try
             {
                 if (e.RowIndex >= 0)
                 {
                     object protokol = this.protocolsTable.Rows[e.RowIndex].Cells["Protokol"].Value;
                     object jns = this.protocolsTable.Rows[e.RowIndex].Cells["Gmina"].Value;
                     object obw = this.protocolsTable.Rows[e.RowIndex].Cells["Obwód"].Value;
                     object inst = this.protocolsTable.Rows[e.RowIndex].Cells["Instytucja"].Value;
                     object okr = this.protocolsTable.Rows[e.RowIndex].Cells["Okręg"].Value;
                     object status = this.protocolsTable.Rows[e.RowIndex].Cells["Status"].Value;
                     if (jns != null && obw != null && inst != null && okr != null)
                     {
                         try
                         {
                             if (protokol != null && status != null && (status.ToString().ToLower() == "podpisany" || status.ToString().ToLower() == "wysłany"))
                             {
                                 DialogResult dr = MessageBox.Show("Utworzenie nowego protokołu spowoduje nadpisanie wcześniej zachowanych danych. Czy kontynuować?", "Nowy protokół", MessageBoxButtons.YesNo);
                                 DialogResult dialogResult = dr;
                                 if (dialogResult == DialogResult.No)
                                 {
                                     return;
                                 }
                                 string protokolname = protokol.ToString();
                                 string[] partname = protokol.ToString().Split(new char[]
                                 {
                                     ' '
                                 });
                                 if (partname.Length >= 2)
                                 {
                                     protokolname = partname[0];
                                 }
                                 int num = System.IO.Directory.GetFiles(this.path + "\\saves", protokolname + "*.xml").Length;
                                 string namefile = protokolname.Replace(".xml", "");
                                 namefile = namefile + " " + (num + 1).ToString();
                                 System.IO.File.Move(this.path + "\\saves\\" + protokol.ToString(), this.path + "\\saves\\" + namefile + ".xml");
                             }
                             System.IO.StreamWriter sw = new System.IO.StreamWriter(this.path + "\\saves\\" + protokol.ToString(), false);
                             sw.Write("<?xml version=\"1.0\"?><save><status>niewypełniony</status></save>");
                             sw.Close();
                             this.getProtocols(false);
                             if (jns != null && obw != null && inst != null && okr != null)
                             {
                                 try
                                 {
                                     string save = "";
                                     string[] protocolpart = protokol.ToString().Split(new char[]
                                     {
                                         '-'
                                     });
                                     string instJNS = protocolpart[4];
                                     string[] okr2 = okr.ToString().Split(new char[]
                                     {
                                         ' '
                                     });
                                     save = this.path + "\\saves\\" + protokol.ToString();
                                     string candidates = string.Concat(new string[]
                                     {
                                         this.path,
                                         "\\ProtocolsDef\\",
                                         this.electoralEampaignSave,
                                         "-",
                                         inst.ToString(),
                                         "-",
                                         instJNS,
                                         "-",
                                         okr2[0],
                                         ".xml"
                                     });
                                     string protocolDefinition = string.Concat(new string[]
                                     {
                                         this.path,
                                         "\\ProtocolsDef\\",
                                         this.electoralEampaignSave,
                                         "-",
                                         inst.ToString(),
                                         ".xml"
                                     });
                                     string committee = string.Concat(new string[]
                                     {
                                         this.path,
                                         "\\ProtocolsDef\\",
                                         this.electoralEampaignSave,
                                         "-",
                                         this.jns,
                                         "-",
                                         obw.ToString(),
                                         ".xml"
                                     });
                                     string validateDefinition = string.Concat(new string[]
                                     {
                                         this.path,
                                         "\\ProtocolsDef\\",
                                         this.electoralEampaignSave,
                                         "-",
                                         inst.ToString(),
                                         "_Walidacja.xml"
                                     });
                                     string OU = "";
                                     if (this.role == "P" || this.role == "Z")
                                     {
                                         OU = string.Concat(new object[]
                                         {
                                             this.electoralEampaignURL.Trim(new char[]
                                             {
                                                 ' '
                                             }),
                                             "-",
                                             jns,
                                             "-",
                                             this.role,
                                             "-",
                                             this.circuit
                                         });
                                     }
                                     if (this.role == "O")
                                     {
                                         OU = string.Concat(new object[]
                                         {
                                             this.electoralEampaignURL.Trim(new char[]
                                             {
                                                 ' '
                                             }),
                                             "-",
                                             jns,
                                             "-",
                                             this.role
                                         });
                                     }
                                     ProtocolForm pf = new ProtocolForm(this, this.header, protocolDefinition, candidates, committee, validateDefinition, save, OU, this.licensepath, this.version);
                                     try
                                     {
                                         pf.ShowDialog();
                                     }
                                     catch (System.Exception)
                                     {
                                         this.createProtocols();
                                     }
                                     this.refreshListOfProtocols();
                                 }
                                 catch (XmlException)
                                 {
                                     MessageBox.Show("Nieprawidłowy XML", "Error");
                                 }
                             }
                         }
                         catch (XmlException)
                         {
                             MessageBox.Show("Nieprawidłowy XML", "Error");
                         }
                     }
                 }
             }
             catch (System.Exception ex)
             {
                 MessageBox.Show(ex.Message, "Error");
             }
         }
         if (e.ColumnIndex == this.protocolsTable.Columns["print"].Index | e.ColumnIndex == this.protocolsTable.Columns["pdf"].Index)
         {
             try
             {
                 if (e.RowIndex >= 0)
                 {
                     object protokol = this.protocolsTable.Rows[e.RowIndex].Cells["Protokol"].Value;
                     object jns = this.protocolsTable.Rows[e.RowIndex].Cells["Gmina"].Value;
                     object obw = this.protocolsTable.Rows[e.RowIndex].Cells["Obwód"].Value;
                     object inst = this.protocolsTable.Rows[e.RowIndex].Cells["Instytucja"].Value;
                     object okr = this.protocolsTable.Rows[e.RowIndex].Cells["Okręg"].Value;
                     if (jns != null && obw != null && inst != null && okr != null && protokol != null)
                     {
                         this.wait.setWaitPanel("Trwa przygotowanie do druku", "Druk");
                         if (e.ColumnIndex == this.protocolsTable.Columns["pdf"].Index)
                         {
                             this.wait.setWaitPanel("Trwa generowanie PDF", "PDF");
                         }
                         this.wait.setVisible(true);
                         try
                         {
                             string save = "";
                             string[] protocolpart = protokol.ToString().Split(new char[]
                             {
                                 '-'
                             });
                             string instJNS = protocolpart[4];
                             string[] okr2 = okr.ToString().Split(new char[]
                             {
                                 ' '
                             });
                             save = this.path + "\\saves\\" + protokol.ToString();
                             string candidates = string.Concat(new string[]
                             {
                                 this.path,
                                 "\\ProtocolsDef\\",
                                 this.electoralEampaignSave,
                                 "-",
                                 inst.ToString(),
                                 "-",
                                 instJNS,
                                 "-",
                                 okr2[0],
                                 ".xml"
                             });
                             string protocolDefinition = string.Concat(new string[]
                             {
                                 this.path,
                                 "\\ProtocolsDef\\",
                                 this.electoralEampaignSave,
                                 "-",
                                 inst.ToString(),
                                 ".xml"
                             });
                             string docDefinition = protocolDefinition.Replace(".xml", ".docx");
                             XmlDocument protocolDefinition2 = new XmlDocument();
                             XmlDocument save2 = new XmlDocument();
                             XmlDocument candidates2 = new XmlDocument();
                             protocolDefinition2.Load(protocolDefinition);
                             save2.Load(save);
                             candidates2.Load(candidates);
                             string controlSum = "";
                             XmlNode saveStep = save2.SelectSingleNode("/save/step");
                             if (saveStep != null && saveStep.InnerText == "0")
                             {
                                 string docXml = "";
                                 XmlNode header = save2.SelectSingleNode("/save/header");
                                 if (header != null)
                                 {
                                     docXml += header.OuterXml;
                                 }
                                 XmlNode step = save2.SelectSingleNode("/save/step");
                                 if (step != null)
                                 {
                                     docXml += step.OuterXml;
                                 }
                                 XmlNode form = save2.SelectSingleNode("/save/form");
                                 if (form != null)
                                 {
                                     docXml += form.OuterXml;
                                 }
                                 XmlNode komisja_sklad = save2.SelectSingleNode("/save/komisja_sklad");
                                 if (komisja_sklad != null)
                                 {
                                     docXml += komisja_sklad.OuterXml;
                                 }
                                 XmlNode hardWarningCode = save2.SelectSingleNode("/save/hardWarningCode");
                                 if (hardWarningCode != null)
                                 {
                                     docXml += hardWarningCode.OuterXml;
                                 }
                                 XmlNode softError = save2.SelectSingleNode("/save/softError");
                                 if (softError != null)
                                 {
                                     docXml += softError.OuterXml;
                                 }
                                 XmlNode hardError = save2.SelectSingleNode("/save/hardError");
                                 if (hardError != null)
                                 {
                                     docXml += hardError.OuterXml;
                                 }
                                 XmlNode hardWarning = save2.SelectSingleNode("/save/hardWarning");
                                 if (hardWarning != null)
                                 {
                                     docXml += hardWarning.OuterXml;
                                 }
                                 ClassMd5 i = new ClassMd5();
                                 controlSum = i.CreateMD5Hash(docXml);
                             }
                             printProtocolNew p = new printProtocolNew();
                             if (e.ColumnIndex == this.protocolsTable.Columns["print"].Index)
                             {
                                 p.ProtocolPrint(this.header, save2, candidates2, docDefinition, controlSum, false, obw.ToString(), inst.ToString(), okr.ToString(), candidates, instJNS);
                             }
                             else
                             {
                                 p.ProtocolPrint(this.header, save2, candidates2, docDefinition, controlSum, true, obw.ToString(), inst.ToString(), okr.ToString(), candidates, instJNS);
                             }
                         }
                         catch (XmlException)
                         {
                             MessageBox.Show("Nieprawidłowy XML", "Error");
                         }
                     }
                     this.wait.setVisible(false);
                 }
             }
             catch (System.Exception ex)
             {
                 MessageBox.Show("Print: " + ex.Message, "Error");
             }
         }
         if (e.ColumnIndex == this.protocolsTable.Columns["send"].Index)
         {
             try
             {
                 if (e.RowIndex >= 0)
                 {
                     object st = this.protocolsTable.Rows[e.RowIndex].Cells["Status"].Value;
                     if (st != null && (st.ToString().ToLower() == "podpisany" || st.ToString().ToLower() == "wysłany"))
                     {
                         object protokol = this.protocolsTable.Rows[e.RowIndex].Cells["Protokol"].Value;
                         object jns = this.protocolsTable.Rows[e.RowIndex].Cells["Gmina"].Value;
                         object obw = this.protocolsTable.Rows[e.RowIndex].Cells["Obwód"].Value;
                         object inst = this.protocolsTable.Rows[e.RowIndex].Cells["Instytucja"].Value;
                         object okr = this.protocolsTable.Rows[e.RowIndex].Cells["Okręg"].Value;
                         if (jns != null && obw != null && inst != null && okr != null && protokol != null)
                         {
                             try
                             {
                                 string save = "";
                                 string[] okr2 = okr.ToString().Split(new char[]
                                 {
                                     ' '
                                 });
                                 save = this.path + "\\saves\\" + protokol.ToString();
                                 System.IO.StreamReader sr = new System.IO.StreamReader(save);
                                 string fileXML = sr.ReadToEnd();
                                 sr.Close();
                                 fileXML = fileXML.Replace("<status>wysłany</status>", "<status>podpisany</status>");
                                 if (this.con.IsAvailableNetworkActive())
                                 {
                                     this.erros = false;
                                     this.send = false;
                                     Eksport ex2 = new Eksport(fileXML, true, this);
                                     try
                                     {
                                         ex2.ShowDialog();
                                     }
                                     catch (System.Exception)
                                     {
                                     }
                                     if (this.send)
                                     {
                                         this.send = false;
                                         fileXML = fileXML.Replace("<status>podpisany</status>", "<status>wysłany</status>");
                                         System.IO.StreamWriter sw = new System.IO.StreamWriter(save);
                                         sw.Write(fileXML);
                                         sw.Close();
                                         this.refreshListOfProtocols();
                                     }
                                     if (!this.send && this.erros)
                                     {
                                         XmlDocument saveTmp = new XmlDocument();
                                         fileXML = fileXML.Replace("<status>podpisany</status>", "<status>roboczy</status>");
                                         fileXML = fileXML.Replace("<status>wysłany</status>", "<status>roboczy</status>");
                                         saveTmp.LoadXml(fileXML);
                                         XmlNode root = saveTmp.DocumentElement;
                                         try
                                         {
                                             root.RemoveChild(root.SelectSingleNode("/save/codeBar"));
                                         }
                                         catch (System.Exception)
                                         {
                                         }
                                         try
                                         {
                                             root.RemoveChild(root.SelectSingleNode("/save/Signature"));
                                         }
                                         catch (System.Exception)
                                         {
                                         }
                                         saveTmp.Save(save);
                                         this.refreshListOfProtocols();
                                     }
                                 }
                                 else
                                 {
                                     MessageBox.Show("Protokół nie został wysłany z powodu braku Internetu.");
                                 }
                             }
                             catch (XmlException)
                             {
                                 MessageBox.Show("Nieprawidłowy XML", "Error");
                             }
                             catch (System.NullReferenceException)
                             {
                                 MessageBox.Show("Podanno inny xml niz header", "Error");
                             }
                         }
                     }
                     if (st != null && (st.ToString().ToLower() == "roboczy" || (st != null && st.ToString().ToLower() == "niewypełniony")))
                     {
                         MessageBox.Show("Nie można wysłać protokołu o statusie: \"" + st.ToString().ToLower() + "\"", "Komunikat");
                     }
                 }
             }
             catch (System.Exception ex)
             {
                 MessageBox.Show(ex.Message, "Error");
             }
         }
         if (e.ColumnIndex == this.protocolsTable.Columns["save1"].Index)
         {
             if (e.RowIndex >= 0)
             {
                 object protokol = this.protocolsTable.Rows[e.RowIndex].Cells["Protokol"].Value;
                 string savePath = this.path + "\\saves\\" + protokol.ToString();
                 System.IO.StreamReader sr = new System.IO.StreamReader(savePath);
                 string file = sr.ReadToEnd();
                 sr.Close();
                 string[] nameFile = savePath.Split(new char[]
                 {
                     '\\'
                 });
                 SaveFileDialog wnd = new SaveFileDialog();
                 wnd.Filter = "(*.xml)|*.xml";
                 wnd.FileName = nameFile[nameFile.Length - 1];
                 if (wnd.ShowDialog() != DialogResult.Cancel)
                 {
                     this.wait.setWaitPanel("Trwa eksportowanie protokołu", "Proszę czekać");
                     this.wait.setVisible(true);
                     if (wnd.CheckPathExists)
                     {
                         string name = wnd.FileName;
                         try
                         {
                             if (name != null && name != "" && name != nameFile[nameFile.Length - 1])
                             {
                                 System.IO.StreamWriter sw = new System.IO.StreamWriter(name, false);
                                 sw.Write(file);
                                 sw.Close();
                             }
                             this.wait.setVisible(false);
                         }
                         catch (System.UnauthorizedAccessException)
                         {
                             MessageBox.Show("Nie jestes uprawniony do zapisania pliku we wskazanym miejscu", "Uwaga");
                         }
                     }
                 }
             }
         }
     }
     catch (System.ArgumentOutOfRangeException ex_17A7)
     {
     }
     catch (System.Exception ex)
     {
     }
 }