/// <summary> /// Rimozione di un utente /// </summary> /// <param name="utente"></param> public static void Delete(Utente utente) { try { SecurityHelper.CheckAdminAuthenticatedPrincipal(); ValidateForDelete(utente); InternalDelete(utente); } catch (RubricaException rubricaEx) { Utils.Log.Write(rubricaEx); throw rubricaEx; } catch (Exception ex) { RubricaException exception = new RubricaException(Properties.Resources.DeleteUserException, ex); Utils.Log.Write(exception); throw exception; } }
/// <summary> /// /// </summary> /// <param name="utente"></param> /// <returns></returns> public static Utente Update(Utente utente) { try { SecurityHelper.CheckAdminAuthenticatedPrincipal(); // Validazione dati di input ValidateForUpdate(utente); return(InternalUpdate(utente)); } catch (RubricaException rubricaEx) { Utils.Log.Write(rubricaEx); throw rubricaEx; } catch (Exception ex) { RubricaException exception = new RubricaException(Properties.Resources.UpdateUserException, ex); Utils.Log.Write(exception); throw exception; } }
/// <summary> /// /// </summary> /// <param name="elemento"></param> /// <returns></returns> public static ElementoRubrica Insert(ElementoRubrica elemento) { try { // Controllo autenticazione SecurityHelper.CheckAuthenticatedPrincipal(); // Validazione dati di input ValidateForInsert(elemento); return(InternalInsert(elemento)); } catch (RubricaException rubricaEx) { Utils.Log.Write(rubricaEx); throw rubricaEx; } catch (Exception ex) { RubricaException exception = new RubricaException(Properties.Resources.InsertElementoRubricaException, ex); Utils.Log.Write(exception); throw exception; } }
/// <summary> /// Rimozione di un elemento in rubrica /// </summary> /// <param name="id"></param> public static void Delete(ElementoRubrica elemento) { try { SecurityHelper.CheckAuthenticatedPrincipal(); // Validazione dati di input ValidateForDelete(elemento); InternalDelete(elemento); } catch (RubricaException rubricaEx) { Utils.Log.Write(rubricaEx); throw rubricaEx; } catch (Exception ex) { RubricaException exception = new RubricaException(Properties.Resources.DeleteElementoRubricaException, ex); Utils.Log.Write(exception); throw exception; } }
/// <summary> /// /// </summary> /// <param name="data"></param> /// <returns></returns> public static ElementoRubrica Update(ElementoRubrica elemento, bool multicasella) { try { SecurityHelper.CheckAuthenticatedPrincipal(); // Validazione dati di input ValidateForUpdate(elemento); return(InternalUpdate(elemento, multicasella)); } catch (RubricaException rubricaEx) { Utils.Log.Write(rubricaEx); throw rubricaEx; } catch (Exception ex) { RubricaException exception = new RubricaException(Properties.Resources.UpdateElementoRubricaException, ex); Utils.Log.Write(exception); throw exception; } }
/// <summary> /// Reperimento di un utente /// </summary> /// <param name="id"></param> /// <returns></returns> public static Utente Get(int id) { try { SecurityHelper.CheckAdminAuthenticatedPrincipal(); return(InternalGet(id)); } catch (RubricaException rubricaEx) { Utils.Log.Write(rubricaEx); throw rubricaEx; } catch (Exception ex) { RubricaException exception = new RubricaException(Properties.Resources.GetUserException, ex); Utils.Log.Write(exception); throw exception; } }
/// <summary> /// Repreimento oggetto DataObject /// </summary> /// <param name="id"></param> /// <returns></returns> private static ElementoRubrica InternalGet(int id) { ElementoRubrica elemento = null; try { Dpa.DataAccess.Database db = RubricaDatabase.CreateDatabase(); using (Dpa.DataAccess.DBCommandWrapper cw = db.GetStoredProcCommandWrapper(RubricaDatabase.GetSpNameForPackage(SP_GET))) { cw.AddInParameter("pId", DbType.Int32, id); Utils.Log.Write(cw.Command); using (IDataReader reader = db.ExecuteReader(cw)) if (reader.Read()) { elemento = CreateElementoRubrica(reader, true); } } if (elemento == null) { throw new ApplicationException(Properties.Resources.DataNotFoundException); } } catch (Exception ex) { RubricaException exception = new RubricaException(string.Format(Properties.Resources.GetElementoRubricaException, id), ex); Utils.Log.Write(exception); throw exception; } return(elemento); }