private void btnsEliminaglb_Click(object sender, System.EventArgs e) { Classi.MailSend _MailSend = new TheSite.Classi.MailSend(); S_Controls.Collections.S_ControlsCollection _SColl = new S_Controls.Collections.S_ControlsCollection(); S_Controls.Collections.S_Object s_email = new S_Controls.Collections.S_Object(); s_email.ParameterName = "p_email_Id"; s_email.DbType = ApplicationDataLayer.DBType.CustomDBType.Integer; s_email.Direction = ParameterDirection.Input; s_email.Index = 0; s_email.Value = itemId; S_Controls.Collections.S_Object s_Operazione = new S_Object(); s_Operazione.ParameterName = "p_Operazione"; s_Operazione.DbType = ApplicationDataLayer.DBType.CustomDBType.VarChar; s_Operazione.Direction = ParameterDirection.Input; s_Operazione.Index = 1; s_Operazione.Value = "Delete"; S_Controls.Collections.S_Object s_IdOut = new S_Object(); s_IdOut.ParameterName = "p_IdOut"; s_IdOut.DbType = ApplicationDataLayer.DBType.CustomDBType.Integer; s_IdOut.Direction = ParameterDirection.Output; s_IdOut.Index = 2; _SColl.Add(s_email); _SColl.Add(s_Operazione); _SColl.Add(s_IdOut); _MailSend.UpdateEmailEdificiServiziglb(_SColl); lblMessage.Text = "Elimina Associazione Email Edifici Servizi Globale"; }
private void CaricaListaRight() { Classi.MailSend _MailSend = new TheSite.Classi.MailSend(); DataSet _MyDs = _MailSend.GetEmailEdifici(itemId); // Imposto la chiave primaria _MyDs.Tables[0].Columns["id"].Unique = true; _MyDs.Tables[0].PrimaryKey = new DataColumn[] { _MyDs.Tables[0].Columns["id"] }; Session.Add("Edifici", _MyDs.Tables[0]); if (_MyDs.Tables[0].Rows.Count > 0) { DataView o_DvEdifici = new DataView(_MyDs.Tables[0]); this.ListBoxRightF.DataTextField = "descrizione"; this.ListBoxRightF.DataValueField = "id"; this.ListBoxRightF.DataSource = o_DvEdifici; this.ListBoxRightF.DataBind(); } string totrecord = _MyDs.Tables[0].Rows.Count.ToString(); LblEdificiAssociati.Text = totrecord; }
private void DeleteItem(string id) { Console.WriteLine(id); if (id == "") { return; } S_ControlsCollection _SColl = new S_ControlsCollection(); S_Controls.Collections.S_Object s_email_id = new S_Object(); s_email_id.ParameterName = "p_email_id"; s_email_id.DbType = CustomDBType.Integer; s_email_id.Direction = ParameterDirection.Input; s_email_id.Index = 0; s_email_id.Value = int.Parse(id); _SColl.Add(s_email_id); try { TheSite.Classi.MailSend _MailSend = new TheSite.Classi.MailSend(); _MailSend.DelEMail(_SColl); // DataGridRicerca.CurrentPageIndex =0; DataGridRicerca.CurrentPageIndex = 0; Ricerca(); } catch (Exception ex) { Console.WriteLine(ex.Message); this.Page.RegisterStartupScript("messaggio", "<script language'javascript'>alert(\"Impossibile cancellare email perchè è utilizzata in altre tabelle\");</script>"); } }
private void inviaSGA() { HSga = LblSga.Text; string formatdate = DateTime.Now.Millisecond.ToString() + DateTime.Now.Second.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Hour.ToString() + DateTime.Now.Day.ToString() + DateTime.Now.Month.ToString() + DateTime.Now.Year.ToString(); string fileName = ""; if (hidprog.Value == "2") // vodafone { fileName = @"\XSLT\XSLsgaRptVod04.xslt"; } else { fileName = @"\XSLT\XSLsgaRpt04.xslt"; } string PathSgaXlst = Server.MapPath(Request.ApplicationPath + fileName); TheSite.Classi.RptRtf.SGARTF trs = new TheSite.Classi.RptRtf.SGARTF(); trs.FileXlst = PathSgaXlst; int wr_id = Convert.ToInt32(this.txtWrHidden.Text); string[] Files = trs.GeneraRtf(wr_id, formatdate); TheSite.Classi.MailSend mail = new TheSite.Classi.MailSend(); SaveInvio(Files[1], DocType.SGA); mail.SendMail(Files[0], wr_id, DocType.SGA); //recupero data di invio sga DataSet DsData = _ClManCorrettiva.GetDataInvioSga(itemId, DocType.SGA); if (DsData.Tables[0].Rows.Count == 1) { DataRow _DrData = DsData.Tables[0].Rows[0]; LblInvioSga.Text = _DrData["data_invio"].ToString(); } // }
private void BindEmailEsistenti() { Classi.MailSend _MailSend = new TheSite.Classi.MailSend(); this.cmbCopiaEmail.DataSource = Classi.GestoreDropDownList.ItemBlankDataSource( _MailSend.GetEmailTranneMe(i_RowsAffected).Tables[0], "DESCRIZIONE", "ID", "--Email --", "0"); this.cmbCopiaEmail.DataTextField = "DESCRIZIONE"; this.cmbCopiaEmail.DataValueField = "ID"; this.cmbCopiaEmail.DataBind(); }
private void BtSalvaSGA_Click(object sender, System.EventArgs e) { //CreaCodSGA(); //inviaSGA(); Classi.MailSend mail = new TheSite.Classi.MailSend(); mail.SendMailSGA(itemId, "SGA"); // //Recupero i dati della RDL // DataSet _Ds= _ClManCorrettiva.GetSingleRdl_DEMO(itemId); // DataRow riga=_Ds.Tables[0].Rows[0]; // //Recupero l'id dell'edificio // int bl_id=int.Parse(riga["ID_BL"].ToString()); // int servizio_id=int.Parse(riga["servizio_id"].ToString()); // //Recupero i destinatari legati all'edificio // ArrayList li= GetDestinatariSGA(bl_id,servizio_id,"SGA"); // string edificio=riga["bl_id"].ToString(); // string RdL =itemId.ToString(); // string DataRdl =riga["DataRdl"].ToString(); // string Corpo=riga["Corpo"].ToString(); // foreach(string il in li) // { // maillist+=il +";"; // } // // // mailMessage.BodyFormat = MailFormat.Html; // mailMessage.BodyEncoding=System.Text.Encoding.UTF8; // mailMessage.From = ConfigurationSettings.AppSettings["MailFrom"].ToString(); // mailMessage.To =maillist; // mailMessage.Cc="*****@*****.**"; // mailMessage.Subject="Edificio: "+ edificio + " RdL: "+ RdL+ "Data Richiesta: "+ DataRdl; // string Body=""; // Body="<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">"; // Body+="<HTML><HEAD><META http-equiv=Content-Type content=\"text/html; charset=iso-8859-1\">"; // Body+=s; // // // Body+=Lk1; // // Body+=Lk; // // Body+="<DIV> </DIV>"; // mailMessage.Body=Body; // mailMessage.Fields["http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"] = 1; // mailMessage.Fields["http://schemas.microsoft.com/cdo/configuration/sendusername"] = ConfigurationSettings.AppSettings["usersmtp2"].ToString(); // mailMessage.Fields["http://schemas.microsoft.com/cdo/configuration/sendpassword"] = ConfigurationSettings.AppSettings["pwdsmtp2"].ToString(); // SmtpMail.SmtpServer = ConfigurationSettings.AppSettings["SmtpServer2"].ToString(); // SmtpMail.Send(mailMessage); string VarApp = ""; if (Request["VarApp"] != null) { VarApp = "&VarApp=" + Request["VarApp"]; } Response.Redirect("CreazioneSGA_CRM.aspx?FunId=" + FunId + VarApp); }
private void CaricaAlbero() { this.txtsCampus.DBDefaultValue = "%"; this.txtsCodice.DBDefaultValue = "%"; this.cmbsProvincia.DBDefaultValue = "0"; this.cmbsComune.DBDefaultValue = "0"; this.cmbsServizi.DBDefaultValue = "0"; this.txtsCampus.Text = this.txtsCampus.Text.Trim(); this.txtsCodice.Text = this.txtsCodice.Text.Trim(); S_ControlsCollection _SCollection = new S_ControlsCollection(); _SCollection.AddItems(this.PanelEdit.Controls); Classi.MailSend _MailSend = new TheSite.Classi.MailSend(); DataSet _MyDs = null; if (OptFiltro.Items[0].Selected) { _MyDs = _MailSend.GetEmailEdifici(_SCollection, itemId, "Tutti"); } if (OptFiltro.Items[1].Selected) { _MyDs = _MailSend.GetEmailEdifici(_SCollection, itemId, "Associati"); } if (OptFiltro.Items[2].Selected) { _MyDs = _MailSend.GetEmailEdifici(_SCollection, itemId, "NonAssociati"); } if (_MyDs.Tables[0].Rows.Count > 0) { TreeCtrl.Visible = true; ChkSelezionaLeft.Visible = true; PopolaTreeview(_MyDs); } else { TreeCtrl.Visible = false; ChkSelezionaLeft.Visible = false; } string totrecord = _MyDs.Tables[0].Rows.Count.ToString(); LblEdifici.Text = totrecord; ImpostaCheck(); }
// private void inviaSGA() // { // HSga=LblSga.Text; // string formatdate=DateTime.Now.Millisecond.ToString() + DateTime.Now.Second.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Hour.ToString() +DateTime.Now.Day.ToString() + DateTime.Now.Month.ToString() +DateTime.Now.Year.ToString(); // string fileName=""; // if (hidprog.Value=="2") // vodafone // fileName = @"\XSLT\XSLsgaRptVod04.xslt"; // else // fileName = @"\XSLT\XSLsgaRpt04.xslt"; // string PathSgaXlst = Server.MapPath(Request.ApplicationPath + fileName); // TheSite.Classi.RptRtf.SGARTF trs = new TheSite.Classi.RptRtf.SGARTF(); // trs.FileXlst = PathSgaXlst; // int wr_id = Convert.ToInt32(this.txtWrHidden.Text); // string[] Files=trs.GeneraRtf(wr_id,formatdate); // TheSite.Classi.MailSend mail=new TheSite.Classi.MailSend(); // SaveInvio(Files[1],DocType.SGA); // mail.SendMail(Files[0],wr_id,DocType.SGA); // //recupero data di invio sga // DataSet DsData = _ClManCorrettiva.GetDataInvioSga(itemId,DocType.SGA); // // if (DsData.Tables[0].Rows.Count == 1) // { // DataRow _DrData = DsData.Tables[0].Rows[0]; // LblInvioSga.Text=_DrData["data_invio"].ToString(); // } // // // } private void inviaDie() { HSga = LblSga.Text; int wr_id = Convert.ToInt32(this.txtWrHidden.Text); string formatdate = DateTime.Now.Millisecond.ToString() + DateTime.Now.Second.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Hour.ToString() + DateTime.Now.Day.ToString() + DateTime.Now.Month.ToString() + DateTime.Now.Year.ToString(); TheSite.XSLT.DIE die = new TheSite.XSLT.DIE(wr_id, formatdate); string[] Files = die.GenerateDIE(); TheSite.Classi.MailSend mail = new TheSite.Classi.MailSend(); mail.SendMail(Files[0], wr_id, DocType.DIE); SaveInvio(Files[1], DocType.DIE); }
private void EliminaAssociazioni(int bl_id) { Classi.MailSend _MailSend = new TheSite.Classi.MailSend(); S_Controls.Collections.S_ControlsCollection _SColl = new S_Controls.Collections.S_ControlsCollection(); S_Controls.Collections.S_Object s_email = new S_Controls.Collections.S_Object(); s_email.ParameterName = "p_email_Id"; s_email.DbType = ApplicationDataLayer.DBType.CustomDBType.Integer; s_email.Direction = ParameterDirection.Input; s_email.Index = 0; s_email.Value = itemId; S_Controls.Collections.S_Object s_Edificio_Id = new S_Controls.Collections.S_Object(); s_Edificio_Id.ParameterName = "p_Edificio_Id"; s_Edificio_Id.DbType = ApplicationDataLayer.DBType.CustomDBType.Integer; s_Edificio_Id.Direction = ParameterDirection.Input; s_Edificio_Id.Index = 1; s_Edificio_Id.Value = bl_id; S_Controls.Collections.S_Object s_Servizio_Id = new S_Controls.Collections.S_Object(); s_Servizio_Id.ParameterName = "p_Servizio_Id"; s_Servizio_Id.DbType = ApplicationDataLayer.DBType.CustomDBType.Integer; s_Servizio_Id.Direction = ParameterDirection.Input; s_Servizio_Id.Index = 2; s_Servizio_Id.Value = 0; S_Controls.Collections.S_Object s_Operazione = new S_Object(); s_Operazione.ParameterName = "p_Operazione"; s_Operazione.DbType = ApplicationDataLayer.DBType.CustomDBType.VarChar; s_Operazione.Direction = ParameterDirection.Input; s_Operazione.Index = 3; s_Operazione.Value = "Delete"; S_Controls.Collections.S_Object s_IdOut = new S_Object(); s_IdOut.ParameterName = "p_IdOut"; s_IdOut.DbType = ApplicationDataLayer.DBType.CustomDBType.Integer; s_IdOut.Direction = ParameterDirection.Output; s_IdOut.Index = 4; _SColl.Add(s_email); _SColl.Add(s_Edificio_Id); _SColl.Add(s_Servizio_Id); _SColl.Add(s_Operazione); _SColl.Add(s_IdOut); _MailSend.UpdateEmailEdificiServizi(_SColl); }
private TreeNodeCollection AddNodesServizi(string id_bl, DataRow Dr, TreeNodeCollection nodes) { TreeNode n = new TreeNode(); n.Type = "servizio"; n.Text = Dr["DESCRIZIONE"].ToString(); n.Target = Dr["ID"].ToString(); // Uso la proprietà Target per memorizzare l'ID n.CheckBox = true; //controllo se il servizio in esame è già associato al ruolo per quel BL Classi.MailSend _MailSend = new TheSite.Classi.MailSend(); bool stato = _MailSend.ControllaEmailBlServizi(itemId, Int32.Parse(id_bl), Int32.Parse(n.Target)); n.Checked = stato; nodes.Add(n); return(nodes); }
private void btnCopiaEmail_Click(object sender, System.EventArgs e) { if (cmbCopiaEmail.SelectedValue != "0") { Classi.MailSend _MailSend = new TheSite.Classi.MailSend(); S_Controls.Collections.S_ControlsCollection _SColl = new S_Controls.Collections.S_ControlsCollection(); S_Controls.Collections.S_Object s_p_email_id = new S_Object(); s_p_email_id.ParameterName = "p_email_id"; s_p_email_id.DbType = CustomDBType.Integer; s_p_email_id.Direction = ParameterDirection.Input; s_p_email_id.Size = 8; s_p_email_id.Index = _SColl.Count; s_p_email_id.Value = Int32.Parse(lblEmailIns.Text); _SColl.Add(s_p_email_id); S_Controls.Collections.S_Object s_p_email_id_da_copiare = new S_Object(); s_p_email_id_da_copiare.ParameterName = "p_email_id_da_copiare"; s_p_email_id_da_copiare.DbType = CustomDBType.Integer; s_p_email_id_da_copiare.Direction = ParameterDirection.Input; s_p_email_id_da_copiare.Size = 8; s_p_email_id_da_copiare.Index = _SColl.Count; s_p_email_id_da_copiare.Value = Convert.ToInt32(cmbCopiaEmail.SelectedValue); _SColl.Add(s_p_email_id_da_copiare); int rows = _MailSend.CopiaEmailBLSV(_SColl); cmbCopiaEmail.Visible = false; btnCopiaEmail.Visible = false; lblMessage.Text = "Inserite per email " + txtsDescrizione.Text + " associazioni edifici-servizi"; } else { lblMessage.Text = "Email da copiare non selezionata "; cmbCopiaEmail.Visible = true; btnCopiaEmail.Visible = true; } }
private void CaricaListaLeft() { this.txtsCampus.DBDefaultValue = "%"; this.txtsCodice.DBDefaultValue = "%"; this.cmbsProvincia.DBDefaultValue = "0"; this.cmbsComune.DBDefaultValue = "0"; this.txtsCampus.Text = this.txtsCampus.Text.Trim(); this.txtsCodice.Text = this.txtsCodice.Text.Trim(); S_ControlsCollection _SCollection = new S_ControlsCollection(); _SCollection.AddItems(this.PanelEdit.Controls); Classi.MailSend _MailSend = new TheSite.Classi.MailSend(); DataSet _MyDs = _MailSend.GetEmailListaEdifici(_SCollection, itemId).Copy(); if (_MyDs.Tables[0].Rows.Count > 0) { if (_MyDs.Tables[0].Rows.Count > 0) { DataView o_DvEdifici = new DataView(_MyDs.Tables[0]); this.ListBoxLeftF.DataTextField = "descrizione"; this.ListBoxLeftF.DataValueField = "id"; this.ListBoxLeftF.DataSource = o_DvEdifici; this.ListBoxLeftF.DataBind(); } } ImpostaEventoCheckClient(); string totrecord = _MyDs.Tables[0].Rows.Count.ToString(); LblEdifici.Text = totrecord; ImpostaCheck(); }
private void btnsSalva_Click(object sender, System.EventArgs e) { int i_RowsAffected = 0; Classi.MailSend _MailSend = new TheSite.Classi.MailSend(); S_Controls.Collections.S_ControlsCollection _SCollection = new S_Controls.Collections.S_ControlsCollection(); S_Controls.Collections.S_Object s_p_Descrizione = new S_Object(); s_p_Descrizione.ParameterName = "p_Descrizione"; s_p_Descrizione.DbType = CustomDBType.VarChar; s_p_Descrizione.Direction = ParameterDirection.Input; s_p_Descrizione.Size = 255; s_p_Descrizione.Index = 0; s_p_Descrizione.Value = txtsDescrizione.Text; _SCollection.Add(s_p_Descrizione); S_Controls.Collections.S_Object s_p_Note = new S_Object(); s_p_Note.ParameterName = "p_Note"; s_p_Note.DbType = CustomDBType.VarChar; s_p_Note.Direction = ParameterDirection.Input; s_p_Note.Size = 255; s_p_Note.Index = _SCollection.Count;; s_p_Note.Value = txtsNote.Text; _SCollection.Add(s_p_Note); i_RowsAffected = _MailSend.InsEMail(_SCollection); S_Controls.Collections.S_ControlsCollection _SCollection_ = new S_Controls.Collections.S_ControlsCollection(); S_Controls.Collections.S_Object s_p_email_id_ = new S_Object(); s_p_email_id_.ParameterName = "p_email_id"; s_p_email_id_.DbType = CustomDBType.Integer; s_p_email_id_.Direction = ParameterDirection.Input; s_p_email_id_.Size = 8; s_p_email_id_.Index = 0; s_p_email_id_.Value = i_RowsAffected; _SCollection_.Add(s_p_email_id_); S_Controls.Collections.S_Object s_p_mrsga = new S_Object(); s_p_mrsga.ParameterName = "p_mrsga"; s_p_mrsga.DbType = CustomDBType.Integer; s_p_mrsga.Direction = ParameterDirection.Input; s_p_mrsga.Size = 8; s_p_mrsga.Index = _SCollection_.Count; s_p_mrsga.Value = (CHKMRSGA.Checked == true)?1:0; _SCollection_.Add(s_p_mrsga); S_Controls.Collections.S_Object s_p_mrdie = new S_Object(); s_p_mrdie.ParameterName = "p_mrdie"; s_p_mrdie.DbType = CustomDBType.Integer; s_p_mrdie.Direction = ParameterDirection.Input; s_p_mrdie.Size = 8; s_p_mrdie.Index = _SCollection_.Count; s_p_mrdie.Value = (CHKMRDIE.Checked == true)?1:0; _SCollection_.Add(s_p_mrdie); S_Controls.Collections.S_Object s_p_mssga = new S_Object(); s_p_mssga.ParameterName = "p_mssga"; s_p_mssga.DbType = CustomDBType.Integer; s_p_mssga.Direction = ParameterDirection.Input; s_p_mssga.Size = 8; s_p_mssga.Index = _SCollection_.Count; s_p_mssga.Value = (CHKMSSGA.Checked == true)?1:0; _SCollection_.Add(s_p_mssga); S_Controls.Collections.S_Object s_p_msdie = new S_Object(); s_p_msdie.ParameterName = "p_msdie"; s_p_msdie.DbType = CustomDBType.Integer; s_p_msdie.Direction = ParameterDirection.Input; s_p_msdie.Size = 8; s_p_msdie.Index = _SCollection_.Count; s_p_msdie.Value = (CHKMSDIE.Checked == true)?1:0; _SCollection_.Add(s_p_msdie); int i_RowsAffected_ = _MailSend.InsEMailInv(_SCollection_); BindEmailEsistenti(); cmbCopiaEmail.Visible = true; btnCopiaEmail.Visible = true; if (lbloperazione.Text == "Inserimento Email") { lblMessage.Text = "Inserita Email " + txtsDescrizione.Text; } else { lblMessage.Text = "Modifica Email " + txtsDescrizione.Text; } lblEmailIns.Text = i_RowsAffected.ToString(); }
public string GENERAPDFSGA(int wr_id, string sga, string username) { System.Web.UI.Page pg = new Page(); string pathRptSource; ReportDocument crReportDocument = new ReportDocument(); Classi.ManCorrettiva.MANCORRETTIVASFOGLIARDL _RichiestaIntervento = new Classi.ManCorrettiva.MANCORRETTIVASFOGLIARDL(); DataSet Ds = _RichiestaIntervento.ReportSGA(wr_id); dsRapportino dsP = new dsRapportino(); int i = 0; for (i = 0; i <= Ds.Tables[0].Rows.Count - 1; i++) { dsP.Tables["sga"].ImportRow(Ds.Tables[0].Rows[i]); } pathRptSource = pg.Server.MapPath("../Report/RptSGA1.rpt"); crReportDocument.Load(pathRptSource); crReportDocument.SetDataSource(dsP); //string Fname = pg.Server.MapPath("../Report/" + pg.Session.SessionID.ToString() + ".pdf");// ExportOptions optExp; DiskFileDestinationOptions optDsk = new DiskFileDestinationOptions(); PdfRtfWordFormatOptions optPdfRtf = new PdfRtfWordFormatOptions(); optExp = crReportDocument.ExportOptions; optExp.ExportFormatType = ExportFormatType.PortableDocFormat; optExp.FormatOptions = optPdfRtf; optExp.ExportDestinationType = ExportDestinationType.DiskFile; //-----inserire nome del file nuovo string STORENAME = "PACK_TRACCIA_DOC.SP_INS_SGA"; conn.Open(); System.Data.OracleClient.OracleCommand cmd = new OracleCommand(); cmd.Connection = conn; cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = STORENAME; OracleParameter par1 = new OracleParameter(); par1.ParameterName = "p_id_wr"; par1.OracleType = System.Data.OracleClient.OracleType.Number; par1.Direction = ParameterDirection.Input; par1.Value = wr_id; par1.Size = 100; cmd.Parameters.Add(par1); OracleParameter par2 = new OracleParameter(); par2.ParameterName = "p_user"; par2.OracleType = System.Data.OracleClient.OracleType.VarChar; par2.Direction = ParameterDirection.Input; par2.Size = 50; par2.Value = username; cmd.Parameters.Add(par2); OracleParameter par3 = new OracleParameter(); par3.ParameterName = "p_sga"; par3.OracleType = System.Data.OracleClient.OracleType.VarChar; par3.Direction = ParameterDirection.Input; par3.Size = 100; par3.Value = sga; cmd.Parameters.Add(par3); OracleParameter par4 = new OracleParameter(); par4.ParameterName = "p_codice"; par4.OracleType = System.Data.OracleClient.OracleType.VarChar; par4.Direction = ParameterDirection.Output; par4.Size = 50; par4.Value = ""; cmd.Parameters.Add(par4); cmd.ExecuteNonQuery(); string NOMESGA = cmd.Parameters["p_codice"].Value.ToString(); // OracleDataReader rdr = cmd.ExecuteReader(); // string pr=rdr.GetString(); //string pr=cmd.ExecuteScalar(); conn.Close(); cmd.Dispose(); //@"C:\Inetpub\wwwroot\RL\Doc_DB\" //optDsk.DiskFileName = pathRptSource+sga+".pdf"; optDsk.DiskFileName = @System.Configuration.ConfigurationSettings.AppSettings["DIRSGA"] + NOMESGA; //Fname; optExp.DestinationOptions = optDsk; crReportDocument.Export(); string FileZip = Path.GetDirectoryName(optDsk.DiskFileName) + @"\" + Path.GetFileNameWithoutExtension(optDsk.DiskFileName) + ".zip"; if (File.Exists(FileZip)) { File.Delete(FileZip); } ZipOutputStream s = new ZipOutputStream(File.Create(FileZip)); s.SetLevel(5); // 0 - store only to 9 - FileStream fs = File.OpenRead(optDsk.DiskFileName); byte[] buffer = new byte[fs.Length]; fs.Read(buffer, 0, buffer.Length); ZipEntry entry = new ZipEntry(Path.GetFileName(optDsk.DiskFileName)); s.PutNextEntry(entry); s.Write(buffer, 0, buffer.Length); s.Finish(); s.Close(); fs.Close(); TheSite.Classi.MailSend mail = new TheSite.Classi.MailSend(); //mail.SendMail(optDsk.DiskFileName,wr_id,DocType.SGA); mail.SendMail(FileZip, wr_id, DocType.SGA); return(optDsk.DiskFileName); }
private void InserisciAssociazioni() { DataTable o_Dt = (DataTable)Session["Edifici"]; try { foreach (DataRow riga in o_Dt.Rows) { bool esegui = false; string funzione = ""; int valore = 0; if (riga.RowState == DataRowState.Deleted) { funzione = "Delete"; esegui = true; valore = Convert.ToInt32(riga["id", DataRowVersion.Original].ToString()); } if (riga.RowState == DataRowState.Added) { funzione = "Insert"; esegui = true; valore = Convert.ToInt32(riga["id", DataRowVersion.Default].ToString()); } if (esegui) { Classi.MailSend _MailSend = new TheSite.Classi.MailSend(); S_Controls.Collections.S_ControlsCollection _SColl = new S_Controls.Collections.S_ControlsCollection(); S_Controls.Collections.S_Object s_Ruolo = new S_Controls.Collections.S_Object(); s_Ruolo.ParameterName = "p_email_Id"; s_Ruolo.DbType = ApplicationDataLayer.DBType.CustomDBType.Integer; s_Ruolo.Direction = ParameterDirection.Input; s_Ruolo.Index = 0; s_Ruolo.Value = itemId; S_Controls.Collections.S_Object s_Edificio_Id = new S_Controls.Collections.S_Object(); s_Edificio_Id.ParameterName = "p_Edificio_Id"; s_Edificio_Id.DbType = ApplicationDataLayer.DBType.CustomDBType.Integer; s_Edificio_Id.Direction = ParameterDirection.Input; s_Edificio_Id.Index = 1; s_Edificio_Id.Value = valore; S_Controls.Collections.S_Object s_Operazione = new S_Object(); s_Operazione.ParameterName = "p_Operazione"; s_Operazione.DbType = ApplicationDataLayer.DBType.CustomDBType.VarChar; s_Operazione.Direction = ParameterDirection.Input; s_Operazione.Index = 2; s_Operazione.Value = funzione; S_Controls.Collections.S_Object s_IdOut = new S_Object(); s_IdOut.ParameterName = "p_IdOut"; s_IdOut.DbType = ApplicationDataLayer.DBType.CustomDBType.Integer; s_IdOut.Direction = ParameterDirection.Output; s_IdOut.Index = 3; _SColl.Add(s_Ruolo); _SColl.Add(s_Edificio_Id); _SColl.Add(s_Operazione); _SColl.Add(s_IdOut); _MailSend.UpdateEmailEdifici(_SColl); } } } catch (Exception ex) { string s_Err = ex.Message.ToString().ToUpper(); PanelMess.ShowError(s_Err, true); } }
private void Page_Load(object sender, System.EventArgs e) { FunId = Int32.Parse(Request.Params["FunId"]); if (Request.Params["ItemID"] != null) { itemId = Int32.Parse(Request.Params["ItemID"]); } PageTitle1.Title = "Inserimento-modifica Email"; cmbCopiaEmail.Visible = false; btnCopiaEmail.Visible = false; if (!Page.IsPostBack) { ViewState["UrlReferrer"] = Request.UrlReferrer.ToString(); if (itemId != 0) { Classi.MailSend _MailSend = new TheSite.Classi.MailSend(); DataSet _MyDs = _MailSend.GetDestEmail_AGG(itemId).Copy(); if (_MyDs.Tables[0].Rows.Count == 1) { DataRow _Dr = _MyDs.Tables[0].Rows[0]; //ente descrizione this.txtsDescrizione.Text = _Dr["Descrizione"].ToString(); this.txtsNote.Text = _Dr["note"].ToString(); if (Int32.Parse(_Dr["sgamr"].ToString()) == 1) { this.CHKMRSGA.Checked = true; } else { this.CHKMRSGA.Checked = false; } if (Int32.Parse(_Dr["diemr"].ToString()) == 1) { this.CHKMRDIE.Checked = true; } else { this.CHKMRDIE.Checked = false; } if (Int32.Parse(_Dr["sgams"].ToString()) == 1) { this.CHKMSSGA.Checked = true; } else { this.CHKMSSGA.Checked = false; } if (Int32.Parse(_Dr["diems"].ToString()) == 1) { this.CHKMSDIE.Checked = true; } else { this.CHKMSDIE.Checked = false; } this.lbloperazione.Text = "Modifica Email: " + this.txtsDescrizione.Text; } } else { this.lbloperazione.Text = "Inserimento Email"; } } }
private void DataGridRicerca_ItemCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e) { if (e.CommandName == "Download") { string[] param; string [] bl; string file = ""; string[] filename; string filedownload = ""; if (e.Item.Cells[7].Text == "SGA" || e.Item.Cells[7].Text == "DIE") { param = e.CommandArgument.ToString().Split(','); bl = param[1].Split(' '); file = Server.MapPath("../Doc_DB") + "\\" + bl[1] + "\\" + param[0] + "\\" + param[1]; filename = Path.GetFileName(file).Split(' '); filedownload = Server.MapPath("../Doc_DB") + "\\" + filename[1] + "\\" + param[0] + "\\" + filename[0] + " " + filename[1] + " " + filename[2] + ".rtf"; Response.Clear(); Response.ContentType = "application/rtf"; if (File.Exists(filedownload)) { File.Delete(filedownload); } File.Copy(file, filedownload); } else { filedownload = Server.MapPath("../Doc_DB") + "\\" + e.Item.Cells[3].Text.Trim() + "\\" + e.Item.Cells[6].Text.Trim(); filedownload = filedownload.Replace(".xls", ".zip"); Response.Clear(); Response.ContentType = "application/zip"; } Response.AddHeader("content-disposition", "attachment; filename=" + Path.GetFileName(filedownload)); Response.WriteFile(filedownload); Response.End(); } if (e.CommandName == "Invio") { string[] param; string [] bl; string file = ""; string[] filename; string filedownload = ""; if (e.Item.Cells[7].Text == "SGA" || e.Item.Cells[7].Text == "DIE") { param = e.CommandArgument.ToString().Split(','); bl = param[1].Split(' '); file = Server.MapPath("../Doc_DB") + "\\" + bl[1] + "\\" + param[0] + "\\" + param[1]; filename = Path.GetFileName(file).Split(' '); filedownload = Server.MapPath("../Doc_DB") + "\\" + filename[1] + "\\" + param[0] + "\\" + filename[0] + " " + filename[1] + " " + filename[2] + ".rtf"; if (File.Exists(filedownload)) { File.Delete(filedownload); } File.Copy(file, filedownload); } else { param = e.CommandArgument.ToString().Split(','); filedownload = Server.MapPath("../Doc_DB") + "\\" + e.Item.Cells[3].Text.Trim() + "\\" + e.Item.Cells[6].Text.Trim(); } TheSite.Classi.MailSend mail = new TheSite.Classi.MailSend(); DocType TipoDc; if (e.Item.Cells[7].Text == "SGA") { TipoDc = DocType.SGA; } else if (e.Item.Cells[7].Text == "DIE") { TipoDc = DocType.DIE; } else { TipoDc = DocType.XLS; } string FileZip = ""; if (TipoDc == DocType.XLS) { FileZip = filedownload; } else { FileZip = Path.GetDirectoryName(filedownload) + @"\" + Path.GetFileNameWithoutExtension(filedownload) + ".zip"; if (File.Exists(FileZip)) { File.Delete(FileZip); } ZipOutputStream s = new ZipOutputStream(File.Create(FileZip)); s.SetLevel(5); // 0 - store only to 9 - means best compression FileStream fs = File.OpenRead(filedownload); byte[] buffer = new byte[fs.Length]; fs.Read(buffer, 0, buffer.Length); ZipEntry entry = new ZipEntry(Path.GetFileName(filedownload)); s.PutNextEntry(entry); s.Write(buffer, 0, buffer.Length); s.Finish(); s.Close(); fs.Close(); } if (e.Item.Cells[7].Text == "SGA" || e.Item.Cells[7].Text == "DIE") { mail.SendMail(FileZip, int.Parse(param[0]), TipoDc); } else { mail.SendMailXls(FileZip, TipoDc, Convert.ToInt32(e.Item.Cells[10].Text)); } } }
private void Salva(TreeNode nodopadre, TreeNodeCollection nodi) { int bl_id = Int32.Parse(nodopadre.Target); string bl_descrizione = nodopadre.Text; EliminaAssociazioni(bl_id); //nodopadre = BL | nodofiglio=servizio foreach (TreeNode nodofiglio in nodi) { if (nodofiglio.Checked == true) { int servizio_id = Int32.Parse(nodofiglio.Target); string servizio_descrizione = nodofiglio.Text; Classi.MailSend _MailSend = new TheSite.Classi.MailSend(); S_Controls.Collections.S_ControlsCollection _SColl = new S_Controls.Collections.S_ControlsCollection(); S_Controls.Collections.S_Object s_email = new S_Controls.Collections.S_Object(); s_email.ParameterName = "p_email_Id"; s_email.DbType = ApplicationDataLayer.DBType.CustomDBType.Integer; s_email.Direction = ParameterDirection.Input; s_email.Index = 0; s_email.Value = itemId; S_Controls.Collections.S_Object s_Edificio_Id = new S_Controls.Collections.S_Object(); s_Edificio_Id.ParameterName = "p_Edificio_Id"; s_Edificio_Id.DbType = ApplicationDataLayer.DBType.CustomDBType.Integer; s_Edificio_Id.Direction = ParameterDirection.Input; s_Edificio_Id.Index = 1; s_Edificio_Id.Value = bl_id; S_Controls.Collections.S_Object s_Servizio_Id = new S_Controls.Collections.S_Object(); s_Servizio_Id.ParameterName = "p_Servizio_Id"; s_Servizio_Id.DbType = ApplicationDataLayer.DBType.CustomDBType.Integer; s_Servizio_Id.Direction = ParameterDirection.Input; s_Servizio_Id.Index = 2; s_Servizio_Id.Value = servizio_id; S_Controls.Collections.S_Object s_Operazione = new S_Object(); s_Operazione.ParameterName = "p_Operazione"; s_Operazione.DbType = ApplicationDataLayer.DBType.CustomDBType.VarChar; s_Operazione.Direction = ParameterDirection.Input; s_Operazione.Index = 3; s_Operazione.Value = "Insert"; S_Controls.Collections.S_Object s_IdOut = new S_Object(); s_IdOut.ParameterName = "p_IdOut"; s_IdOut.DbType = ApplicationDataLayer.DBType.CustomDBType.Integer; s_IdOut.Direction = ParameterDirection.Output; s_IdOut.Index = 4; _SColl.Add(s_email); _SColl.Add(s_Edificio_Id); _SColl.Add(s_Servizio_Id); _SColl.Add(s_Operazione); _SColl.Add(s_IdOut); _MailSend.UpdateEmailEdificiServizi(_SColl); } } }