private bool GetForgotPassword() { string strFromMail = GetAddressee(); if (!Mail.IsValidEmail(strFromMail)) { MessageBox.Show("L'indirizzo mail del destinatario non è valido. Verificare l'indirizzo inserito.", "Indirizzo Mail Non Valido", MessageBoxButtons.OK, MessageBoxIcon.Warning); return(false); } if (DialogResult.No == MessageBox.Show("Verrà inviata una mail all'indirizzo " + strFromMail + " con il codice di sicurezza che dovrà essere inserito nel campo preposto." + Environment.NewLine + "Vuoi proseguire ?", "Recupero Password", MessageBoxButtons.YesNo, MessageBoxIcon.Question)) { return(false); } var param1 = new Random(); string strCode = param1.Next(100, 10000).ToString(); ConfigDB.SaveConfig(Config.ParamValues.RANDOM_CODE, strCode); if (!Mail.SendMail("", strFromMail, "", strCode)) { return(false); } bool ret = false; using (var form = new FormForgotPass(txtUserID.Text)) { var result = form.ShowDialog(); if (result == DialogResult.OK) { ret = form.recoveryPassword; } } return(ret); }
private void btnFirma_Click(object sender, EventArgs e) { if (this.isModified) { if (DialogResult.No == MessageBox.Show("Per proseguire è necessario salvare i dati inseriti. Vuoi proseguire ?", "Firma documento", MessageBoxButtons.YesNo, MessageBoxIcon.Question)) { return; } if (!ValidateControls()) { return; } Save(); } //if (DialogResult.No == MessageBox.Show("Selezionare una directory in cui salvare il documento." + Environment.NewLine + "Vuoi proseguire ?", "Firma documento", MessageBoxButtons.YesNo, MessageBoxIcon.Question)) // return; //SaveFileDialog dlg = new SaveFileDialog //{ // Title = "Salvataggio Pdf", // AddExtension = true, // Filter = "PDF|*.pdf" //}; //if (dlg.ShowDialog() != DialogResult.OK) // return; //if (string.IsNullOrEmpty(dlg.FileName)) // return; if (cmbTemplate.SelectedIndex == 0) { MessageBox.Show("E' necessario selezionare un template valido !", "Firma documento", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); this.isModified = false; return; } string strFileNameOutput = $"{FileHelper.GetPath("pdfElab")}{user.COGNOME}" + " " + $"{user.NOME}" + " " + $"{DateTime.Today:yyyyMMdd}" + ".pdf"; string strFileName = PDFManager.RunSignPro(strFileNameOutput, cmbTemplate.SelectedIndex, user); if (string.IsNullOrEmpty(strFileName)) { return; } var pathString = FirmaInCloudDB.LoadTemplate(cmbTemplate.SelectedIndex, "").AsEnumerable().First(); FileNameParser fileNameParser = new FileNameParser(strFileName); TemplateLinq templateLinq = new TemplateLinq { KEY_USER = user.KEY_USER, DTSIGN = DateTime.Now, PATH = strFileName, DESCR = fileNameParser.DESCR, KEY_TEMPL = Convert.ToInt32(pathString.ItemArray[0]) }; FirmaInCloudDB.SaveTemplate_Linq(templateLinq, user); ConfigDB.SaveConfig(Config.ParamValues.COUNT, (int.Parse(ConfigDB.LoadConfig(Config.ParamValues.COUNT).CONF_VALUE) + 1).ToString()); LoadTemplate_Linq(templateLinq); if (DialogResult.No == MessageBox.Show("E' possibile inviare il documento appena firmato all'indirizzo mail: " + user.MAIL + Environment.NewLine + "Vuoi proseguire ?", "Firma documento", MessageBoxButtons.YesNo, MessageBoxIcon.Question)) { return; } Mail.SendMail(strFileName, txtMail.Text, user.NOME + " " + user.COGNOME, ""); }