public ICollection <SendMail.Model.BackEndRefCode> GetAll() { List <BackEndRefCode> entityList = null; try { using (var dbcontext = new FAXPECContext()) { var allEntity = dbcontext.RUBR_BACKEND.ToList(); entityList = AutoMapperConfiguration.FromRubrBackendToModel(allEntity); } } //TODO:Exception Handling catch (Exception e0) { //Allineamento log - Ciro if (e0.GetType() != typeof(ManagedException)) { ManagedException me = new ManagedException(e0.Message, "ORA_ERR001", string.Empty, string.Empty, e0); ErrorLogInfo err = new ErrorLogInfo(me); log.Error(err); } return(null); } return(entityList); }
protected void odsServerConfig_ObjectCreating(object sender, ObjectDataSourceEventArgs e) { if (this.IdServer_ViewState != decimal.MinusOne) { try { MailServerConfigFacade facade = MailServerConfigFacade.GetInstance(); e.ObjectInstance = facade.LoadServerConfigById(this.IdServer_ViewState); } catch (Exception ex) { if (ex.GetType() != typeof(ManagedException)) { ManagedException mEx = new ManagedException("Errore nel caricamento della configurazione del server", "CM020", string.Empty, string.Empty, ex.InnerException); ErrorLogInfo err = new ErrorLogInfo(mEx); err.loggingAppCode = "WEB_MAIL"; err.objectID = this.Context.Session.SessionID; log.Error(err); info.AddMessage(mEx.Message, Com.Delta.Messaging.MapperMessages.LivelloMessaggio.ERROR); } else { info.AddMessage(ex.Message, Com.Delta.Messaging.MapperMessages.LivelloMessaggio.ERROR); } } } else { e.ObjectInstance = new MailServer(); } }
public void setDefaultContact(long idTitolo, long refOrg, long idContatto) { using (OracleCommand oCmd = base.CurrentConnection.CreateCommand()) { oCmd.CommandText = cmdSetDefaultContact; oCmd.Parameters.Add(new OracleParameter("pCONTATTO", OracleDbType.Int64, idContatto, ParameterDirection.Input)); oCmd.Parameters.Add(new OracleParameter("pIDTITOLO", OracleDbType.Int64, idTitolo, ParameterDirection.Input)); oCmd.Parameters.Add(new OracleParameter("pIDENTITA", OracleDbType.Int64, refOrg, ParameterDirection.Input)); oCmd.BindByName = true; try { int ret = oCmd.ExecuteNonQuery(); } catch (Exception ex) { //TASK: Allineamento log - Ciro if (!ex.GetType().Equals(typeof(ManagedException))) { ManagedException mEx = new ManagedException(ex.Message, "ORA_ERR007", string.Empty, string.Empty, ex); ErrorLogInfo err = new ErrorLogInfo(mEx); _log.Error(err); throw mEx; } else { throw ex; } } } }
public ICollection <Model.WebserviceMappings.StatoComunicazioneItem> GetComunicazioniByProtocollo(Model.ComunicazioniMapping.ComunicazioniProtocollo prot) { ICollection <StatoComunicazioneItem> list = null; using (FAXPECContext dbcontext = new FAXPECContext()) { string s = "select c.id_com as ID, c.ref_id_sottotitolo as ID_SOTTOTITOLO, cs.sottotitolo " + " as SOTTOTITOLO,cf.data_operazione as DATA_INS, cf3.stato_comunicazione_new as STATO " + " from [FAXPEC].[FAXPEC].[comunicazioni] c inner join [FAXPEC].[FAXPEC].[comunicazioni_sottotitoli] cs on c.ref_id_sottotitolo = cs.id_sottotitolo inner join comunicazioni_flusso cf on c.id_com=cf.ref_id_com " + " inner join (select ref_id_com, data_operazione ,stato_comunicazione_new from " + " [FAXPEC].[FAXPEC].[comunicazioni]_flusso where (ref_id_com, data_operazione) in ( select ref_id_com, max(data_operazione) " + " from [FAXPEC].[FAXPEC].[comunicazioni_flusso] where ref_id_com in (select ref_id_com from [FAXPEC].[FAXPEC].[comunicazioni_protocollo] " + " where RESP_PROT_TIPO='" + prot.ResponseProtocolloTipo + "' AND RESP_PROT_ANNO=" + prot.ResponseProtocolloAnno + " AND RESP_PROT_NUMERO='" + prot.ResponseProtocolloNumero + "' AND PROT_IN_OUT='" + prot.ProtocolloInOut + "') " + " group by (ref_id_com)))cf3 on cf3.ref_id_com=c.id_com where cf.stato_comunicazione_old is null and c.id_com " + " in (select ref_id_com FROM [FAXPEC].[FAXPEC].[comunicazioni_protocollo] t2 WHERE t2.RESP_PROT_TIPO='" + prot.ResponseProtocolloTipo + "' AND T2.RESP_PROT_ANNO=" + prot.ResponseProtocolloAnno + " AND T2.RESP_PROT_NUMERO='" + prot.ResponseProtocolloNumero + "' AND PROT_IN_OUT='" + prot.ProtocolloInOut + "')"; var oCmd = dbcontext.Database.Connection.CreateCommand(); oCmd.CommandText = s; try { using (DbDataReader r = oCmd.ExecuteReader()) { list = new List <StatoComunicazioneItem>(); while (r.Read()) { StatoComunicazioneItem itm = new StatoComunicazioneItem(); itm.Id = r["ID"].ToString(); itm.SottoTitolo = r["ID_SOTTOTITOLO"].ToString(); itm.SottoTitoloDescr = r["SOTTOTITOLO"].ToString(); itm.DataInserimento = r["DATA_INS"].ToString(); itm.StatoInvio = r["STATO"].ToString(); list.Add(itm); } } } catch (Exception e) { dbcontext.Dispose(); if (!e.GetType().Equals(typeof(ManagedException))) { ManagedException mEx = new ManagedException(String.Format("Errore nell'estrazione delle emails per protocollo {0} {1}. Dettaglio: ", prot.ResponseProtocolloAnno, prot.ResponseProtocolloNumero) + e.Message, "ORA_ERR005", string.Empty, string.Empty, e.InnerException); ErrorLogInfo err = new ErrorLogInfo(mEx); err.objectID = prot.RefIdCom.ToString(); //foreign key ID_COMUNICAZIONE _log.Error(err); throw mEx; } else { throw e; } } } return(list); }
protected void gvElencoEmailsShared_PageIndexChanging(object sender, GridViewPageEventArgs e) { List <BackEndUserMailUserMapping> listMailSender = bUser.MappedMails; if (listMailSender != null) { listMailSender = listMailSender.OrderBy(ms => ms.EmailAddress).ToList(); } try { gvElencoEmailsShared.DataSource = listMailSender; gvElencoEmailsShared.PageIndex = e.NewPageIndex; gvElencoEmailsShared.DataBind(); } catch (Com.Delta.Logging.ManagedException me) { info.AddMessage(me.Message, Com.Delta.Messaging.MapperMessages.LivelloMessaggio.ERROR); } catch (Exception ex) { ManagedException mEx = new ManagedException("Errore nella paginazione della griglia", "CM006", string.Empty, string.Empty, ex.InnerException); ErrorLogInfo err = new ErrorLogInfo(mEx); err.loggingAppCode = "WEB_MAIL"; err.objectID = this.Context.Session.SessionID; if (MySecurityProvider.CurrentPrincipal != null && MySecurityProvider.CurrentPrincipal.MyIdentity != null) { err.userID = MySecurityProvider.CurrentPrincipal.MyIdentity.UserName; } log.Error(err); info.AddMessage(mEx); } }
public void RemoveAbilitazioneEmail(Decimal UserId, Decimal idSender) { try { using (var dbcontext = new FAXPECContext()) { var m = dbcontext.MAIL_USERS_SENDER_BACKEND.Where(x => x.REF_ID_USER == UserId && x.REF_ID_SENDER == idSender).First(); if (m != null) { dbcontext.MAIL_USERS_SENDER_BACKEND.Remove(m); dbcontext.SaveChanges(); } } } catch (Exception ex) { if (!ex.GetType().Equals(typeof(ManagedException))) { ManagedException mEx = new ManagedException("Errore nella rimozione delle abilitazioni per utente " + UserId.ToString() + " E070 Dettagli Errore: " + ex.Message, "ERR_070", string.Empty, string.Empty, ex.InnerException); ErrorLogInfo err = new ErrorLogInfo(mEx); log.Error(err); throw mEx; } else { throw; } } }
public string GetTotalePeriodoAccount(string account, string datainizio, string datafine) { string tot = "0"; try { using (var dbcontext = new FAXPECContext()) { DateTime di; DateTime.TryParse(datainizio, out di); DateTime df; DateTime.TryParse(datafine, out df); tot = dbcontext.MAIL_INBOX.Where(x => x.FOLDERID != 3 && x.MAIL_ACCOUNT.ToUpper() == account.ToUpper() && x.DATA_RICEZIONE >= di && x.DATA_RICEZIONE <= df).Count().ToString(); } } catch (Exception e) { if (!e.GetType().Equals(typeof(ManagedException))) { ManagedException mEx = new ManagedException("Errore nella creazione lista utenti statistica per casella email e periodo: " + account.ToString() + " " + datainizio + "-" + datafine + " ERR_080 Dettagli Errore: " + e.Message, "ERR_080", string.Empty, string.Empty, e.InnerException); ErrorLogInfo err = new ErrorLogInfo(mEx); log.Error(err); } } return(tot); }
protected void CreateUserRole_Click(object sender, EventArgs e) { var userStore = new UserStore(); var user = new IdentityUser() { Id = Users.SelectedValue, UserName = Users.SelectedItem.Text }; try { var result = userStore.AddToRoleAsync(user, int.Parse(Role.SelectedValue)).Result; if (result != 0) { info.AddMessage(string.Format("Utente {0} aggiunto a ruolo {1} !", user.UserName, Role.SelectedItem.Text), LivelloMessaggio.INFO); } } catch (Exception ex) { if (ex.GetType() != typeof(ManagedException)) { ManagedException mEx = new ManagedException("Errore creazione utente. Dettaglio: " + ex.Message + "StackTrace: " + ((ex.StackTrace != null) ? ex.StackTrace.ToString() : " vuoto "), "ERR317", string.Empty, string.Empty, ex.InnerException); ErrorLogInfo err = new ErrorLogInfo(mEx); log.Error(err); info.AddMessage("Errore nell'associazione utente a ruolo: " + ex.Message, LivelloMessaggio.ERROR); } } }
public void Update(SottoTitolo sottoTitolo) { using (var dbcontext = new FAXPECContext()) { try { COMUNICAZIONI_SOTTOTITOLI s = DaoSQLServerDBHelper.MapToComunicazioniSottotitolo(sottoTitolo, false); var olds = dbcontext.COMUNICAZIONI_SOTTOTITOLI.Where(x => x.ID_SOTTOTITOLO == sottoTitolo.Id).First(); dbcontext.COMUNICAZIONI_SOTTOTITOLI.Remove(olds); dbcontext.COMUNICAZIONI_SOTTOTITOLI.Add(s); int rowAff = dbcontext.SaveChanges(); if (rowAff == 0) { ManagedException mEx = new ManagedException(DalExMessages.NESSUNA_RIGA_MODIFICATA, "DAL_TIT_009", string.Empty, string.Empty, null); ErrorLogInfo err = new ErrorLogInfo(mEx); log.Error(mEx); throw mEx; } } catch (InvalidOperationException ex) { ManagedException mEx = new ManagedException(DalExMessages.RUBRICA_NON_AGGIORNATA, "DAL_UNIQUE_CODE", string.Empty, string.Empty, ex); ErrorLogInfo err = new ErrorLogInfo(mEx); log.Error(mEx); throw mEx; } } }
public void setDefaultContact(long idTitolo, long refOrg, long idContatto) { using (var dbcontext = new FAXPECContext()) { try { var v_rubr = dbcontext.RUBR_CONTATTI_BACKEND.Where(x => x.REF_ID_TITOLO == idTitolo && x.REF_ID_ENTITA == refOrg).First(); if (v_rubr != null) { v_rubr.REF_ID_CONTATTO = (int)idContatto; int ret = dbcontext.SaveChanges(); } } catch (Exception ex) { if (!ex.GetType().Equals(typeof(ManagedException))) { ManagedException mEx = new ManagedException(ex.Message, "ORA_ERR007", string.Empty, string.Empty, ex); ErrorLogInfo err = new ErrorLogInfo(mEx); _log.Error(err); throw mEx; } else { throw ex; } } } }
public ContactsApplicationMapping GetById(long id) { ContactsApplicationMapping app = null; try { using (var dbcontext = new FAXPECContext()) { var v = dbcontext.V_MAP_APPL_CONTATTI_NEW.Where(x => x.ID_MAP == id).First(); if (v != null) { app = AutoMapperConfiguration.MapToContactsApplicationModel(v); } } } catch (Exception ex) { if (!ex.GetType().Equals(typeof(ManagedException))) { ManagedException mEx = new ManagedException(ex.Message, "ORA_ERR008", string.Empty, string.Empty, ex); ErrorLogInfo err = new ErrorLogInfo(mEx); err.objectID = Convert.ToString(id); _log.Error(err); throw mEx; } else { throw ex; } } return(app); }
public void Update(ActiveUp.Net.Mail.DeltaExt.MailUser entity) { try { using (OracleCommand oCmd = base.CurrentConnection.CreateCommand()) { oCmd.CommandText = "UPDATE MAIL_SENDERS " + "SET MAIL_SENDERS.MAIL = :MAIL, " + "MAIL_SENDERS.ID_MAILSERVER = :ID_MAILSERVER, " + "MAIL_SENDERS.USERNAME = :USERNAME, " + "MAIL_SENDERS.PASSWORD = :PASSWORD " + "WHERE MAIL_SENDERS.ID_SENDER = :ID_SENDER"; oCmd.Parameters.Add("MAIL", entity.EmailAddress); oCmd.Parameters.Add("ID_MAILSERVER", entity.Id); oCmd.Parameters.Add("USERNAME", entity.LoginId); oCmd.Parameters.Add("PASSWORD", entity.Password); oCmd.Parameters.Add("ID_SENDER", entity.UserId); oCmd.BindByName = true; oCmd.ExecuteNonQuery(); } } catch (Exception ex) { //TASK: Allineamento log - Ciro if (!ex.GetType().Equals(typeof(ManagedException))) { ManagedException mEx = new ManagedException(ex.Message, "ERR_ACC_005", string.Empty, string.Empty, ex.InnerException); ErrorLogInfo err = new ErrorLogInfo(mEx); err.objectID = entity.Id.ToString(); log.Error(err); } } }
public void Insert(SendMail.Model.BackEndRefCode entity) { try { using (var dbcontext = new FAXPECContext()) { RUBR_BACKEND r = AutoMapperConfiguration.FromRubrBackendToDto(entity); dbcontext.RUBR_BACKEND.Add(r); int risp = dbcontext.SaveChanges(); if (risp != 1) { throw new InvalidOperationException("Dato non inserito"); } } } catch (Exception ex) { if (ex.GetType() != typeof(ManagedException)) { ManagedException mEx = new ManagedException(ex.Message, "ERR_ORADB111", string.Empty, string.Empty, ex); ErrorLogInfo er = new ErrorLogInfo(mEx); log.Error(er); throw mEx; } else { throw; } } }
public SendMail.Model.BackEndRefCode GetById(decimal id) { BackEndRefCode entity = null; try { using (var dbcontext = new FAXPECContext()) { RUBR_BACKEND b = dbcontext.RUBR_BACKEND.Where(x => x.ID_BACKEND == id).First(); if (b != null && b.ID_BACKEND != 0) { entity = AutoMapperConfiguration.FromRubrBackendToSingleModel(b); } else { return(null); } } } catch (Exception e0) { if (e0.GetType() != typeof(ManagedException)) { ManagedException me = new ManagedException(e0.Message, "ORA_ERR002", string.Empty, string.Empty, e0); ErrorLogInfo err = new ErrorLogInfo(me); log.Error(err); } return(null); } return(entity); }
public List <BackendUser> GetAllDipartimenti() { List <BackendUser> listaDipartimenti = null; try { using (var dbcontext = new FAXPECContext()) { var v = dbcontext.MAIL_USERS_BACKEND.ToList(); foreach (MAIL_USERS_BACKEND a in v) { listaDipartimenti.Add(AutoMapperConfiguration.MapToDepartmentModel(a)); } } } catch (Exception e) { if (!e.GetType().Equals(typeof(ManagedException))) { ManagedException mEx = new ManagedException("Errore nella creazione lista dei dipartimenti : " + " E075 Dettagli Errore: " + e.Message, "ERR_075", string.Empty, string.Empty, e.InnerException); ErrorLogInfo err = new ErrorLogInfo(mEx); log.Error(err); } listaDipartimenti = null; } return(listaDipartimenti); }
/// <summary> /// Restituisce l'intera collezione degli oggetti SottoTitolo. /// </summary> /// <returns></returns> public ICollection <SottoTitolo> GetAll() { List <SottoTitolo> sottotitoli = null; using (var dbcontext = new FAXPECContext()) { try { var l = dbcontext.COMUNICAZIONI_SOTTOTITOLI.ToList(); foreach (COMUNICAZIONI_SOTTOTITOLI s in l) { sottotitoli.Add(DaoSQLServerDBHelper.MapToSottotitolo(s)); } } catch (SqlException oex) { ManagedException mEx = new ManagedException(DalExMessages.SOTTOTITOLO_NON_RECUPERATO, "DAL_SOT_001", string.Empty, string.Empty, oex); ErrorLogInfo err = new ErrorLogInfo(mEx); log.Error(mEx); throw mEx; } } return(sottotitoli); }
public void InsertAbilitazioneEmail(Decimal UserId, Decimal idSender, int role) { try { using (var dbcontext = new FAXPECContext()) { MAIL_USERS_SENDER_BACKEND m = new MAIL_USERS_SENDER_BACKEND() { REF_ID_USER = int.Parse(UserId.ToString()), REF_ID_SENDER = int.Parse(idSender.ToString()), ROLE = role.ToString(), DATA_INSERIMENTO = System.DateTime.Now }; dbcontext.MAIL_USERS_SENDER_BACKEND.Add(m); dbcontext.SaveChanges(); } } catch (Exception ex) { if (!ex.GetType().Equals(typeof(ManagedException))) { ManagedException mEx = new ManagedException("Errore nell'inserimento dell'utente all'abilitazione di una email: " + idSender.ToString() + " " + UserId.ToString() + " E073 Dettagli Errore: " + ex.Message, "ERR_073", string.Empty, string.Empty, ex.InnerException); ErrorLogInfo err = new ErrorLogInfo(mEx); log.Error(err); throw mEx; } else { throw; } } }
public void DeleteLogic(decimal id) { using (var dbcontext = new FAXPECContext()) { try { var s = dbcontext.COMUNICAZIONI_SOTTOTITOLI.Where(x => x.ID_SOTTOTITOLO == id).First(); s.ACTIVE = 0; int rowAff = dbcontext.SaveChanges(); if (rowAff != 1) { ManagedException mEx = new ManagedException(DalExMessages.NESSUNA_RIGA_MODIFICATA, "DAL_SOT_009", string.Empty, string.Empty, null); ErrorLogInfo err = new ErrorLogInfo(mEx); log.Error(mEx); throw mEx; } } catch (InvalidOperationException ex) { ManagedException mEx = new ManagedException(DalExMessages.RUBRICA_NON_AGGIORNATA, "DAL_SOT_034", string.Empty, string.Empty, ex); ErrorLogInfo err = new ErrorLogInfo(mEx); log.Error(mEx); throw mEx; } } }
public void UpdateAbilitazioneEmail(decimal userId, decimal idsender, int level) { try { using (var dbcontext = new FAXPECContext()) { var m = dbcontext.MAIL_USERS_SENDER_BACKEND.Where(x => x.REF_ID_SENDER == idsender && x.REF_ID_USER == userId).First(); if (m != null) { m.ROLE = level.ToString(); dbcontext.SaveChanges(); } } } catch (Exception ex) { if (!ex.GetType().Equals(typeof(ManagedException))) { ManagedException mEx = new ManagedException("Errore nell'aggiornamento delle abilitazioni per utente " + userId.ToString() + " E071 Dettagli Errore: " + ex.Message, "ERR_071", string.Empty, string.Empty, ex.InnerException); ErrorLogInfo err = new ErrorLogInfo(mEx); log.Error(err); throw mEx; } else { throw; } } }
/// <summary> /// Restituisce la collezione di oggetti SottoTitolo /// collegati al Titolo passato. /// </summary> /// <param name="titoloKey">identificativo del Titolo</param> /// <returns>una collection di oggetti SottoTitolo</returns> public ICollection <SottoTitolo> FindByTitolo(decimal titoloKey) { List <SottoTitolo> sottotitoli = null; using (var dbcontext = new FAXPECContext()) { try { var l = dbcontext.COMUNICAZIONI_SOTTOTITOLI.Where(x => x.REF_ID_TITOLO == titoloKey).ToList(); if (l.Count > 0) { sottotitoli = new List <SottoTitolo>(); foreach (COMUNICAZIONI_SOTTOTITOLI t in l) { sottotitoli.Add(DaoSQLServerDBHelper.MapToSottotitolo(t)); } } } catch (SqlException oex) { ManagedException mEx = new ManagedException(DalExMessages.SOTTOTITOLO_NON_RECUPERATO, "DAL_SOT_002", string.Empty, string.Empty, oex); ErrorLogInfo err = new ErrorLogInfo(mEx); log.Error(mEx); throw mEx; } } return(sottotitoli); }
public void UpdateMailBody(long idMail, string mailBody) { using (var dbcontext = new FAXPECContext()) { try { MAIL_CONTENT content = dbcontext.MAIL_CONTENT.Where(x => x.ID_MAIL == idMail).FirstOrDefault(); content.MAIL_TEXT = mailBody; dbcontext.SaveChanges(); } catch (Exception e) { //TASK: Allineamento log - Ciro if (!e.GetType().Equals(typeof(ManagedException))) { ManagedException mEx = new ManagedException(String.Format("Errore aggiornamento body mail. >> {0}", e.Message), "ERR_COM_022", string.Empty, string.Empty, e.InnerException); ErrorLogInfo err = new ErrorLogInfo(mEx); err.objectID = idMail.ToString(); _log.Error(err); throw mEx; } else { throw e; } } } }
/// <summary> /// /// </summary> /// <param name="entity"></param> public void Insert(Model.MailRefs entity) { try { using (FAXPECContext dbcontext = new FAXPECContext()) { MAIL_REFS_NEW refs = AutoMapperConfiguration.FromMailRefsNewToDto(entity); dbcontext.MAIL_REFS_NEW.Add(refs); dbcontext.SaveChanges(); } } catch (Exception ex) { //Allineamento log - Ciro if (ex.GetType() != typeof(ManagedException)) { ManagedException mEx = new ManagedException(ex.Message, "ERR_INS001", string.Empty, string.Empty, ex); ErrorLogInfo er = new ErrorLogInfo(mEx); er.objectID = entity.IdRef.ToString(); log.Error(er); throw mEx; } else { throw ex; } } }
public List <BackEndUserMailUserMapping> GetMailUserByUserId(long userId, int userRole) { List <BackEndUserMailUserMapping> listStart = null; try { using (OracleCommand oCmd = base.CurrentConnection.CreateCommand()) { if (userRole < 2) { oCmd.CommandText = "SELECT MAIL_USERS_SENDER_BACKEND.REF_ID_USER, " + "MAIL_USERS_SENDER_BACKEND.REF_ID_SENDER ID_SENDER, " + "MAIL_USERS_SENDER_BACKEND.ROLE AS ROLE_MAIL " + "FROM MAIL_USERS_SENDER_BACKEND " + "WHERE REF_ID_USER = :REF_ID_USER"; oCmd.Parameters.Add("REF_ID_USER", userId); } else { oCmd.CommandText = "SELECT DISTINCT ID_SENDER, 1 AS \"ROLE_MAIL\"" + " FROM MAIL_SENDERS" + " ORDER BY 1"; } using (OracleDataReader r = oCmd.ExecuteReader()) { listStart = new List <BackEndUserMailUserMapping>(); while (r.Read()) { BackEndUserMailUserMapping b = DaoOracleDbHelper.MapToBackEndUserMailUserMapping(r); MailUser mu = this.Context.DaoImpl.MailAccountDao.GetById(b.MailSenderId); listStart.Add(new BackEndUserMailUserMapping(mu, b.MailAccessLevel)); } } } } catch (Exception e) { //TASK: Allineamento log - Ciro if (!e.GetType().Equals(typeof(ManagedException))) { ManagedException mEx = new ManagedException("Errore nella creazione lista emails abilitate per utente: " + userId.ToString() + " E077 Dettagli Errore: " + e.Message, "ERR_077", string.Empty, string.Empty, e.InnerException); ErrorLogInfo err = new ErrorLogInfo(mEx); log.Error(err); } //Com.Delta.Logging.Errors.ErrorLogInfo error = new Com.Delta.Logging.Errors.ErrorLogInfo(); //error.freeTextDetails = "Errore nella creazione lista emails abilitate per utente: " + userId.ToString() + " E077 Dettagli Errore: " + e.Message; //error.logCode = "ERR_077"; //error.passiveparentcodeobjectID = string.Empty; //error.passiveobjectGroupID = userId.ToString(); //error.passiveobjectID = string.Empty; //error.passiveapplicationID = string.Empty; //log.Error(error); listStart = null; } return(listStart); }
public int Save(MailRefs entity) { int ins = 0; try { using (FAXPECContext dbcontext = new FAXPECContext()) { MAIL_REFS_NEW refs = AutoMapperConfiguration.FromMailRefsNewToDto(entity); dbcontext.MAIL_REFS_NEW.Add(refs); ins = dbcontext.SaveChanges(); } } catch (Exception ex) { if (ex.GetType() != typeof(ManagedException)) { ManagedException mEx = new ManagedException(ex.Message, "ERR_INS002", string.Empty, string.Empty, ex); ErrorLogInfo er = new ErrorLogInfo(mEx); er.objectID = entity.IdRef.ToString(); log.Error(er); throw mEx; } else { throw ex; } } return(ins); }
protected void odsMailConfig_Updating(object sender, ObjectDataSourceMethodEventArgs e) { try { MailAccountService mailAccountService = new MailAccountService(); MailUser mu = e.InputParameters[0] as MailUser; if (!IsValidEmailDesc(mu.EmailAddress)) { e.Cancel = true; info.AddMessage("Errore nel formato della mail", Com.Delta.Messaging.MapperMessages.LivelloMessaggio.ERROR); return; } mailAccountService.Update(mu); info.AddMessage("Operazione effettauata", Com.Delta.Messaging.MapperMessages.LivelloMessaggio.OK); } catch (Exception ex) { if (ex.GetType() != typeof(ManagedException)) { ManagedException mEx = new ManagedException("Errore nel caricamento della configurazione della mail", "CM008", string.Empty, string.Empty, ex.InnerException); ErrorLogInfo err = new ErrorLogInfo(mEx); err.loggingAppCode = "WEB_MAIL"; err.objectID = this.Context.Session.SessionID; log.Error(err); info.AddMessage(mEx.Message, Com.Delta.Messaging.MapperMessages.LivelloMessaggio.ERROR); } else { info.AddMessage(ex.Message, Com.Delta.Messaging.MapperMessages.LivelloMessaggio.ERROR); } } e.Cancel = true; }
public BackendUser GetByUserName(String UserName) { BackendUser backendUser = null; try { using (var dbcontext = new FAXPECContext()) { MAIL_USERS_BACKEND d = dbcontext.MAIL_USERS_BACKEND.Where(x => x.USER_NAME.ToUpper() == UserName.ToUpper()).First(); backendUser = AutoMapperConfiguration.FromMailUsersBackendToModel(d); if (backendUser != null && backendUser.UserId >= 0) { var musb = dbcontext.MAIL_USERS_SENDER_BACKEND.Where(x => x.REF_ID_USER == d.ID_USER).ToList(); backendUser.MappedMails = (List <BackEndUserMailUserMapping>) this.GetMailUserByUserId(backendUser.UserId, backendUser.UserRole); } } } catch (Exception e) { if (!e.GetType().Equals(typeof(ManagedException))) { ManagedException mEx = new ManagedException("Errore nella creazione del profilo utente abilitati per username : "******" E078 Dettagli Errore: " + e.Message, "ERR_078", string.Empty, string.Empty, e.InnerException); ErrorLogInfo err = new ErrorLogInfo(mEx); log.Error(err); } backendUser = null; } return(backendUser); }
protected void odsServerConfig_Inserting(object sender, ObjectDataSourceMethodEventArgs e) { MailServer ms = e.InputParameters[0] as MailServer; try { MailServerConfigFacade facade = MailServerConfigFacade.GetInstance(); facade.insertServerConfig(ms); this.IdServer_ViewState = ms.Id; info.AddMessage("Operazione effettuata", Com.Delta.Messaging.MapperMessages.LivelloMessaggio.OK); } catch (ManagedException mEx) { info.AddMessage(mEx.Message, Com.Delta.Messaging.MapperMessages.LivelloMessaggio.ERROR); } catch (Exception ex) { ManagedException mEx = new ManagedException("Errore nell'inserimento del nuovo server", "CM010", string.Empty, string.Empty, ex.InnerException); ErrorLogInfo err = new ErrorLogInfo(mEx); err.loggingAppCode = "WEB_MAIL"; err.objectID = this.Context.Session.SessionID; if (MySecurityProvider.CurrentPrincipal != null && MySecurityProvider.CurrentPrincipal.MyIdentity != null) { err.userID = MySecurityProvider.CurrentPrincipal.MyIdentity.UserName; } log.Error(err); info.AddMessage(mEx.Message, Com.Delta.Messaging.MapperMessages.LivelloMessaggio.ERROR); } }
public List <BackendUser> GetAllDipartimentiByMailAdmin(string UserName) { List <BackendUser> listaDipartimenti = null; try { using (var dbcontext = new FAXPECContext()) { var list = dbcontext.MAIL_USERS_BACKEND.Where(x => x.USER_NAME.ToUpper() == UserName.Trim().ToUpper()).OrderBy(x => x.DEPARTMENT).ToList(); if (list.Count > 0) { listaDipartimenti = new List <BackendUser>(); foreach (MAIL_USERS_BACKEND m in list) { listaDipartimenti.Add(AutoMapperConfiguration.MapToDepartmentModel(m)); } } } } catch (Exception e) { if (!e.GetType().Equals(typeof(ManagedException))) { ManagedException mEx = new ManagedException("Errore nella creazione lista dipartimenti per utente : " + UserName.ToString() + " E076 Dettagli Errore: " + e.Message, "ERR_076", string.Empty, string.Empty, e.InnerException); ErrorLogInfo err = new ErrorLogInfo(mEx); log.Error(err); } listaDipartimenti = null; } return(listaDipartimenti); }
public ICollection <Titolo> GetAll() { using (OracleCommand ocmd = new OracleCommand()) { // preparo il command ocmd.Connection = base.CurrentConnection; ocmd.CommandText = "SELECT * FROM COMUNICAZIONI_TITOLI ORDER BY ID_TITOLO"; // eseguo il command try { return(DaoOracleDbHelper <Titolo> .ExecSelectCommand(ocmd, DaoOracleDbHelper.MapToTitolo)); } catch (OracleException oex) { //TASK: Allineamento log - Ciro ManagedException mEx = new ManagedException(DalExMessages.TITOLO_NON_RECUPERATO, "DAL_TIT_001", string.Empty, string.Empty, oex); ErrorLogInfo err = new ErrorLogInfo(mEx); log.Error(mEx); throw mEx; //throw new ManagedException(DalExMessages.TITOLO_NON_RECUPERATO, "DAL_TIT_001", "", "", "", "", "", oex); } } }
public void Delete(decimal id) { try { using (var dbcontext = new FAXPECContext()) { RUBR_BACKEND r = dbcontext.RUBR_BACKEND.Where(x => x.ID_BACKEND == id).First(); dbcontext.RUBR_BACKEND.Remove(r); int resp = dbcontext.SaveChanges(); if (resp != 1) { throw new InvalidOperationException("Oggetto non cancellato"); } } } catch (Exception ex) { if (!ex.GetType().Equals(typeof(ManagedException))) { ManagedException mEx = new ManagedException(ex.Message, "ORA_ERR006", string.Empty, string.Empty, ex); ErrorLogInfo err = new ErrorLogInfo(mEx); log.Error(err); throw mEx; } else { throw ex; } } }