public printProtocol() { this.path = System.IO.Path.GetTempPath() + "KBW"; this.header = "<!DOCTYPE HTML><html><head><meta charset='UTF-8'><title></title><link rel='stylesheet' type='text/css' href='" + System.IO.Path.GetDirectoryName(Application.StartupPath) + "\\tmp\\printTmp\\css\\styl.css'>"; this.header = this.header + "<script type=\"text/javascript\" src=\"" + System.IO.Path.GetDirectoryName(Application.StartupPath) + "\\tmp\\printTmp\\jquery-1.11.1.min.js\"></script>"; this.header += "</head><body>"; this.footer = "</body></html>"; this.body = ""; this.additionaContent = ""; this.code = new codeBar(); this.isSigned = false; this.setErrorsTab(); }
public Commit(string filepath, ProtocolForm pf, string xml) { this.InitializeComponent(); this.filepath = filepath; this.form2 = pf; this.LoginNext.Click -= new System.EventHandler(this.LoginNext_Click); this.LoginNext.Click += new System.EventHandler(this.LoginNext2_Click); this.loggin = false; string[] filepathpart = filepath.Split(new char[] { '\\' }); this.label1.Text = filepathpart[filepathpart.Length - 1].Replace(".pem", ""); this.form2.goodcertificate = false; string docXml = ""; XmlDocument save = new XmlDocument(); save.LoadXml(xml); XmlNode header = save.SelectSingleNode("/save/header"); if (header != null) { docXml += header.OuterXml; } XmlNode step = save.SelectSingleNode("/save/step"); if (step != null) { docXml += step.OuterXml; } XmlNode form = save.SelectSingleNode("/save/form"); if (form != null) { docXml += form.OuterXml; } XmlNode komisja_sklad = save.SelectSingleNode("/save/komisja_sklad"); if (komisja_sklad != null) { docXml += komisja_sklad.OuterXml; } XmlNode hardWarningCode = save.SelectSingleNode("/save/hardWarningCode"); if (hardWarningCode != null) { docXml += hardWarningCode.OuterXml; } XmlNode softError = save.SelectSingleNode("/save/softError"); if (softError != null) { docXml += softError.OuterXml; } XmlNode hardError = save.SelectSingleNode("/save/hardError"); if (hardError != null) { docXml += hardError.OuterXml; } XmlNode hardWarning = 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.codeBarLabel.Text = "Podpisywanie protokołu o kodzie kreskowym: " + '\n'.ToString() + code.getTextReadable(); this.codeBarLabel.Visible = true; }
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) { } }