public List <Persona> GetByActivo(bool blnActivo) { List <Persona> returnList = new List <Persona>(); Persona currentEntity; SqlParameter[] parameterArray = new SqlParameter[1]; SqlDataReader currentReader = null; parameterArray[0] = new SqlParameter("@blnActivo", blnActivo); try { currentReader = DatabaseHelper.ExecuteReader("Personas_GetByActivo", parameterArray); if (currentReader != null) { if (currentReader.HasRows) { while (currentReader.Read()) { currentEntity = DataReaderToObject(currentReader); returnList.Add(currentEntity); } } } } catch (Exception ex) { CustomLog.LogException(ex); } DatabaseHelper.CloseAndDisposeReader(ref currentReader); return(returnList); }
public Persona GetById(int intId) { Persona returnEntity = null; SqlParameter[] parameterArray = new SqlParameter[1]; SqlDataReader currentReader = null; parameterArray[0] = new SqlParameter("@intId", intId); try { currentReader = DatabaseHelper.ExecuteReader("Personas_GetById", parameterArray); if (currentReader != null) { if (currentReader.HasRows) { currentReader.Read(); returnEntity = DataReaderToObject(currentReader); } } } catch (Exception ex) { CustomLog.LogException(ex); } DatabaseHelper.CloseAndDisposeReader(ref currentReader); return(returnEntity); }
public Usuario GetByEmailClave(string strEmail, string strClave) { Usuario returnEntity = null; SqlParameter[] parameterArray = new SqlParameter[2]; SqlDataReader currentReader = null; parameterArray[0] = new SqlParameter("@strEmail", strEmail); parameterArray[1] = new SqlParameter("@strClave", strClave); try { currentReader = DatabaseHelper.ExecuteReader("Usuarios_GetByEmailClave", parameterArray); if (currentReader != null) { if (currentReader.HasRows) { currentReader.Read(); returnEntity = DataReaderToObject(currentReader); } } } catch (Exception ex) { CustomLog.LogException(ex); } DatabaseHelper.CloseAndDisposeReader(ref currentReader); return(returnEntity); }
public int Insert(Persona newEntity) { List <Persona> returnList = new List <Persona>(); SqlParameter[] parameterArray = new SqlParameter[3]; int intNewId = 0; parameterArray[0] = new SqlParameter("@strNombre", newEntity.Nombre); parameterArray[1] = new SqlParameter("@strEmail", newEntity.Email); parameterArray[2] = new SqlParameter("@blnActivo", newEntity.Activo); try { intNewId = DatabaseHelper.ExecuteNonQuery("Personas_Insert", parameterArray); } catch (Exception ex) { CustomLog.LogException(ex); } return(intNewId); }
public int Insert(Cliente newEntity) { List <Cliente> returnList = new List <Cliente>(); SqlParameter[] parameterArray = new SqlParameter[3]; int intNewId = 0; parameterArray[0] = new SqlParameter("@strRazonSocial", newEntity.RazonSocial); parameterArray[1] = new SqlParameter("@strCUIT", newEntity.CUIT); parameterArray[2] = new SqlParameter("@blnActivo", newEntity.Activo); try { intNewId = DatabaseHelper.ExecuteNonQuery("Clientes_Insert", parameterArray); } catch (Exception ex) { CustomLog.LogException(ex); } return(intNewId); }
public int InsertScalar(Persona newEntity) { List <Persona> returnList = new List <Persona>(); SqlParameter[] parameterArray = new SqlParameter[3]; int intNewId = 0; object currentObject; parameterArray[0] = new SqlParameter("@strNombre", newEntity.Nombre); parameterArray[1] = new SqlParameter("@strEmail", newEntity.Email); parameterArray[2] = new SqlParameter("@blnActivo", newEntity.Activo); try { currentObject = DatabaseHelper.ExecuteScalar("Personas_InsertScalar", parameterArray); intNewId = Convert.ToInt32(currentObject); } catch (Exception ex) { CustomLog.LogException(ex); } return(intNewId); }
public int InsertScalar(Cliente newEntity) { List <Cliente> returnList = new List <Cliente>(); SqlParameter[] parameterArray = new SqlParameter[3]; int intNewId = 0; object currentObject; parameterArray[0] = new SqlParameter("@strRazonSocial", newEntity.RazonSocial); parameterArray[1] = new SqlParameter("@strCUIT", newEntity.CUIT); parameterArray[2] = new SqlParameter("@blnActivo", newEntity.Activo); try { currentObject = DatabaseHelper.ExecuteScalar("Clientes_InsertScalar", parameterArray); intNewId = Convert.ToInt32(currentObject); } catch (Exception ex) { CustomLog.LogException(ex); } return(intNewId); }
public List <Persona> GetAll() { List <Persona> returnList = new List <Persona>(); Persona currentEntity; SqlDataReader currentReader = null; try { currentReader = DatabaseHelper.ExecuteReader("Personas_GetAll", null); if (currentReader.HasRows) { while (currentReader.Read()) { currentEntity = DataReaderToObject(currentReader); returnList.Add(currentEntity); } } } catch (Exception ex) { CustomLog.LogException(ex); } DatabaseHelper.CloseAndDisposeReader(ref currentReader); return(returnList); }