///<Summary> ///Select all rows by foreign key ///This method returns all data rows in the table IdentityUserProfile based on a foreign key ///</Summary> ///<returns> ///IList-IDAOIdentityUserProfile. ///</returns> ///<parameters> ///Int32? userId ///</parameters> public static IList <IDAOIdentityUserProfile> SelectAllByUserId(Int32?userId) { Doing(null); SqlCommand command = new SqlCommand(); command.CommandText = InlineProcs.ctprIdentityUserProfile_SelectAllByUserId; command.CommandType = CommandType.Text; SqlConnection staticConnection = StaticSqlConnection; command.Connection = staticConnection; DataTable dt = new DataTable("IdentityUserProfile"); SqlDataAdapter sqlAdapter = new SqlDataAdapter(command); try { command.Parameters.Add(CtSqlParameter.Get("@UserId", SqlDbType.Int, 4, ParameterDirection.Input, false, 10, 0, "", DataRowVersion.Proposed, (object)userId ?? (object)DBNull.Value)); staticConnection.Open(); sqlAdapter.Fill(dt); Done(null); List <IDAOIdentityUserProfile> objList = new List <IDAOIdentityUserProfile>(); if (dt.Rows.Count > 0) { foreach (DataRow row in dt.Rows) { DAOIdentityUserProfile retObj = new DAOIdentityUserProfile(); retObj._userId = Convert.IsDBNull(row["UserId"]) ? (Int32?)null : (Int32?)row["UserId"]; retObj._firstName = Convert.IsDBNull(row["FirstName"]) ? null : (string)row["FirstName"]; retObj._lastName = Convert.IsDBNull(row["LastName"]) ? null : (string)row["LastName"]; retObj._fullName = Convert.IsDBNull(row["FullName"]) ? null : (string)row["FullName"]; retObj._ctrVersion = Convert.IsDBNull(row["ctr_version"]) ? (Int32?)null : (Int32?)row["ctr_version"]; objList.Add(retObj); } } return(objList); } catch (Exception ex) { Failed(null, ex); Handle(null, ex); return(null); } finally { staticConnection.Close(); command.Dispose(); } }
///<Summary> ///Select all rows by filter criteria ///This method returns all data rows in the table using criteriaquery api IdentityUserProfile ///</Summary> ///<returns> ///IList-IDAOIdentityUserProfile. ///</returns> ///<parameters> ///IList<IDataCriterion> listCriterion, IList<IDataOrderBy> listOrder, IDataSkip dataSkip, IDataTake dataTake ///</parameters> public static IList <IDAOIdentityUserProfile> SelectAllByCriteria(IList <IDataCriterion> listCriterion, IList <IDataOrderBy> listOrder, IDataSkip dataSkip, IDataTake dataTake) { Doing(null); SqlCommand command = new SqlCommand(); command.CommandText = GetSelectionCriteria(InlineProcs.ctprIdentityUserProfile_SelectAllByCriteria, null, listCriterion, listOrder, dataSkip, dataTake); command.CommandType = CommandType.Text; SqlConnection staticConnection = StaticSqlConnection; command.Connection = staticConnection; DataTable dt = new DataTable("IdentityUserProfile"); SqlDataAdapter sqlAdapter = new SqlDataAdapter(command); try { staticConnection.Open(); sqlAdapter.Fill(dt); Done(null); List <IDAOIdentityUserProfile> objList = new List <IDAOIdentityUserProfile>(); if (dt.Rows.Count > 0) { foreach (DataRow row in dt.Rows) { DAOIdentityUserProfile retObj = new DAOIdentityUserProfile(); retObj._userId = Convert.IsDBNull(row["UserId"]) ? (Int32?)null : (Int32?)row["UserId"]; retObj._firstName = Convert.IsDBNull(row["FirstName"]) ? null : (string)row["FirstName"]; retObj._lastName = Convert.IsDBNull(row["LastName"]) ? null : (string)row["LastName"]; retObj._fullName = Convert.IsDBNull(row["FullName"]) ? null : (string)row["FullName"]; retObj._ctrVersion = Convert.IsDBNull(row["ctr_version"]) ? (Int32?)null : (Int32?)row["ctr_version"]; objList.Add(retObj); } } return(objList); } catch (Exception ex) { Failed(null, ex); Handle(null, ex); return(null); } finally { staticConnection.Close(); command.Dispose(); } }