private void LoadTitoli() { TitolarioService <SendMail.Model.Titolo> ts = null; if (SessionManager <ITitolarioService <SendMail.Model.Titolo> > .exist(SessionKeys.TITOLARIO)) { ts = SessionManager <TitolarioService <Titolo> > .get(SessionKeys.TITOLARIO); } else { ts = new TitolarioService <SendMail.Model.Titolo>(); } IList <SendMail.Model.Titolo> titoli = null; if (SessionManager <List <BackendUser> > .exist(SessionKeys.TITOLI)) { titoli = SessionManager <List <Titolo> > .get(SessionKeys.TITOLI); } else { titoli = ts.GetAll(null); } ddlTitolo.DataTextField = "Nome"; ddlTitolo.DataValueField = "Id"; titoli.RemoveAt(0); ddlTitolo.DataSource = titoli; ddlTitolo.DataBind(); ListItem item = new ListItem(); item.Value = ""; item.Text = "-- Selezionare un titolo --"; item.Selected = true; this.ddlTitolo.Items.Insert(0, item); UpdTitolo.Update(); }
protected void Page_Load(object sender, EventArgs e) { if (Page.IsPostBack == false) { TitolarioService <SendMail.Model.Titolo> ts = new TitolarioService <SendMail.Model.Titolo>(); IList <SendMail.Model.Titolo> titoli = ts.GetAll(null); ddlTitolo.DataTextField = "Nome"; ddlTitolo.DataValueField = "Id"; titoli.RemoveAt(0); ddlTitolo.DataSource = titoli; ddlTitolo.DataBind(); this.ddlTitolo.Items.Insert(0, "-- Selezionare un titolo --"); //Controllo per disabilitare l'invio nascosto in caso di PEC if (HttpContext.Current.Session["MAIL_ACCOUNT"] != null) { if ((HttpContext.Current.Session["MAIL_ACCOUNT"] as ActiveUp.Net.Mail.DeltaExt.MailUser).Dominus.Equals("PEC")) { trBCC.Visible = false; BCCMail.Text = string.Empty; BCCMail.ReadOnly = true; } } } }
protected void buttonSalvaSottoTitolo_Click(object sender, EventArgs e) { if (SottoTitoloCodiceComunicazione.Text.Trim() != string.Empty && NomeSottotitolo.Text.Trim() != string.Empty && ddlTitolo.SelectedValue != "0") { TitolarioService <SendMail.Model.SottoTitolo> st = new TitolarioService <SendMail.Model.SottoTitolo>(); TitolarioService <SendMail.Model.Titolo> ts = new TitolarioService <SendMail.Model.Titolo>(); Titolo titolo = ts.LoadTitoloById(int.Parse(ddlTitolo.SelectedValue)); SottoTitolo sottotitolo = new SottoTitolo(titolo); SottoTitolo s = null; sottotitolo.ComCode = SottoTitoloCodiceComunicazione.Text; sottotitolo.ProtocolloCode = SottoTitoloCodiceProtocollo.Text; sottotitolo.Nome = NomeSottotitolo.Text; sottotitolo.RefIdTitolo = titolo.Id; sottotitolo.UsaProtocollo = CheckProtocolloAttivo.Checked; sottotitolo.Deleted = CheckProtocolloAttivo.Checked; try { s = st.insertTitolo(sottotitolo); } catch (Exception ex) { info.AddError("Creazione sottotitolo errata dettagli: " + ex.Message); } if (titolo.Id > 0) { info.AddInfo("Titolo creato"); } } }
protected void btnSalva_Click(object sender, EventArgs e) { TitolarioService <SendMail.Model.Titolo> ts = new TitolarioService <SendMail.Model.Titolo>(); Titolo titolo = new Titolo(); if (CodiceApplicazione.Text.Trim() != string.Empty && TitoloNome.Text.Trim() != string.Empty) { titolo.AppCode = CodiceApplicazione.Text; titolo.CodiceProtocollo = CodiceProtocollo.Text; titolo.Nome = TitoloNome.Text; titolo.Deleted = !(TitoloIsActive.Checked); try { ts.insertTitolo(titolo); } catch (Exception ex) { info.AddError("Creazione titolo errata dettagli: " + ex.Message); return; } info.AddInfo("Titolo creato"); IList <SendMail.Model.Titolo> titoli = ts.GetAll(null); ddlTitolo.DataTextField = "Nome"; ddlTitolo.DataValueField = "Id"; titoli.RemoveAt(0); ddlTitolo.DataSource = titoli; ddlTitolo.DataBind(); this.ddlTitolo.Items.Insert(0, "-- Selezionare un titolo --"); } else { info.AddError("Inserire i campi obbligatori"); } }
protected void OnChangeIndex_ddlTitolo(object sender, EventArgs e) { TitolarioService <SendMail.Model.SottoTitolo> ts = new TitolarioService <SendMail.Model.SottoTitolo>(); if (ddlTitolo.SelectedItem.Value != "-- Selezionare un titolo --") { IList <SendMail.Model.SottoTitolo> sottotitoli = ts.FindByTitolo(int.Parse(ddlTitolo.SelectedItem.Value)); ddlSottotitolo.DataTextField = "Nome"; ddlSottotitolo.DataValueField = "Id"; ddlSottotitolo.DataSource = sottotitoli; ddlSottotitolo.DataBind(); } }
public HttpResponseMessage GetAllTitoli() { List <Titolo> risp = new List <Titolo>(); TitolarioService <SendMail.Model.Titolo> titoloservice = new TitolarioService <SendMail.Model.Titolo>(); IList <SendMail.Model.Titolo> titoli = titoloservice.GetAll(null); risp = null; if (titoli != null) { risp = (from t in titoli select(Titolo) t).ToList(); } return(this.Request.CreateResponse <List <Titolo> >(HttpStatusCode.OK, risp)); }
protected void Page_Load(object sender, EventArgs e) { if (Page.IsPostBack == false) { TitolarioService <SendMail.Model.Titolo> ts = new TitolarioService <SendMail.Model.Titolo>(); IList <SendMail.Model.Titolo> titoli = ts.GetAll(null); ddlTitolo.DataTextField = "Nome"; ddlTitolo.DataValueField = "Id"; titoli.RemoveAt(0); ddlTitolo.DataSource = titoli; ddlTitolo.DataBind(); this.ddlTitolo.Items.Insert(0, "-- Selezionare un titolo --"); } }
public HttpResponseMessage GetSottoTitoli(string idtitolo, int?page, int?start, int?limit) { TitolarioService <SendMail.Model.SottoTitolo> ts = new TitolarioService <SendMail.Model.SottoTitolo>(); TitoliModel model = new TitoliModel(); IList <SendMail.Model.SottoTitolo> sottotitoli = new List <SendMail.Model.SottoTitolo>(); try { if (CacheManager <List <SendMail.Model.Titolo> > .exist(CacheKeys.ALL_SUBTITLES)) { sottotitoli = CacheManager <List <SendMail.Model.SottoTitolo> > .get(CacheKeys.ALL_SUBTITLES, VincoloType.BACKEND); } else { sottotitoli = (List <SendMail.Model.SottoTitolo>)ts.FindByTitolo(int.Parse(idtitolo)); } model.success = "true"; model.SottoTitoliList = sottotitoli.ToList(); model.Totale = sottotitoli.Count.ToString(); } catch (Exception ex) { if (!ex.GetType().Equals(typeof(ManagedException))) { ErrorLogInfo error = new ErrorLogInfo(); error.freeTextDetails = ex.Message; error.logCode = "ERR_T002"; error.loggingAppCode = "PEC"; error.loggingTime = System.DateTime.Now; error.uniqueLogID = System.DateTime.Now.Ticks.ToString(); log.Error(error); model.message = ex.Message; model.success = "false"; } else { model.message = ex.Message; model.success = "false"; } return(this.Request.CreateResponse <TitoliModel>(HttpStatusCode.OK, model)); } return(this.Request.CreateResponse <TitoliModel>(HttpStatusCode.OK, model)); }
protected void OnChangeIndex_ddlTitolo(object sender, EventArgs e) { TitolarioService <SendMail.Model.SottoTitolo> ts = new TitolarioService <SendMail.Model.SottoTitolo>(); if (ddlTitolo.SelectedItem.Value != "-- Selezionare un titolo --" && ddlTitolo.SelectedItem.Value != string.Empty) { IList <SendMail.Model.SottoTitolo> sottotitoli = ts.FindByTitolo(int.Parse(ddlTitolo.SelectedItem.Value)); ddlSottotitolo.DataTextField = "Nome"; ddlSottotitolo.DataValueField = "Id"; ddlSottotitolo.DataSource = sottotitoli; ddlSottotitolo.DataBind(); ListItem item = new ListItem(); item.Value = ""; item.Text = "-- Selezionare un sottotitolo --"; item.Selected = true; ddlSottotitolo.Items.Insert(0, item); UpdSottotitolo.Update(); } }