///<Summary> ///Select all rows by filter criteria ///This method returns all data rows in the table using criteriaquery api IdentityUser ///</Summary> ///<returns> ///IList-IDAOIdentityUser. ///</returns> ///<parameters> ///IList<IDataCriterion> listCriterion, IList<IDataOrderBy> listOrder, IDataSkip dataSkip, IDataTake dataTake ///</parameters> public static IList <IDAOIdentityUser> SelectAllByCriteria(IList <IDataCriterion> listCriterion, IList <IDataOrderBy> listOrder, IDataSkip dataSkip, IDataTake dataTake) { Doing(null); SqlCommand command = new SqlCommand(); command.CommandText = GetSelectionCriteria(InlineProcs.ctprIdentityUser_SelectAllByCriteria, null, listCriterion, listOrder, dataSkip, dataTake); command.CommandType = CommandType.Text; SqlConnection staticConnection = StaticSqlConnection; command.Connection = staticConnection; DataTable dt = new DataTable("IdentityUser"); SqlDataAdapter sqlAdapter = new SqlDataAdapter(command); try { staticConnection.Open(); sqlAdapter.Fill(dt); Done(null); List <IDAOIdentityUser> objList = new List <IDAOIdentityUser>(); if (dt.Rows.Count > 0) { foreach (DataRow row in dt.Rows) { DAOIdentityUser retObj = new DAOIdentityUser(); retObj._userId = Convert.IsDBNull(row["UserId"]) ? (Int32?)null : (Int32?)row["UserId"]; retObj._email = Convert.IsDBNull(row["Email"]) ? null : (string)row["Email"]; retObj._emailConfirmed = Convert.IsDBNull(row["EmailConfirmed"]) ? (bool?)null : (bool?)row["EmailConfirmed"]; retObj._passwordHash = Convert.IsDBNull(row["PasswordHash"]) ? null : (string)row["PasswordHash"]; retObj._securityStamp = Convert.IsDBNull(row["SecurityStamp"]) ? null : (string)row["SecurityStamp"]; retObj._phoneNumber = Convert.IsDBNull(row["PhoneNumber"]) ? null : (string)row["PhoneNumber"]; retObj._phoneNumberConfirmed = Convert.IsDBNull(row["PhoneNumberConfirmed"]) ? (bool?)null : (bool?)row["PhoneNumberConfirmed"]; retObj._twoFactorEnabled = Convert.IsDBNull(row["TwoFactorEnabled"]) ? (bool?)null : (bool?)row["TwoFactorEnabled"]; retObj._lockoutEndDateUtc = Convert.IsDBNull(row["LockoutEndDateUtc"]) ? (DateTime?)null : (DateTime?)row["LockoutEndDateUtc"]; retObj._lockoutEnabled = Convert.IsDBNull(row["LockoutEnabled"]) ? (bool?)null : (bool?)row["LockoutEnabled"]; retObj._accessFailedCount = Convert.IsDBNull(row["AccessFailedCount"]) ? (Int32?)null : (Int32?)row["AccessFailedCount"]; retObj._username = Convert.IsDBNull(row["Username"]) ? null : (string)row["Username"]; 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 one row by primary key(s) ///This method returns one row from the table IdentityUser based on the primary key(s) ///</Summary> ///<returns> ///IDAOIdentityUser ///</returns> ///<parameters> ///Int32? userId ///</parameters> public static IDAOIdentityUser SelectOne(Int32?userId) { Doing(null); SqlCommand command = new SqlCommand(); command.CommandText = InlineProcs.ctprIdentityUser_SelectOne; command.CommandType = CommandType.Text; SqlConnection staticConnection = StaticSqlConnection; command.Connection = staticConnection; DataTable dt = new DataTable("IdentityUser"); 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); DAOIdentityUser retObj = null; if (dt.Rows.Count > 0) { retObj = new DAOIdentityUser(); retObj._userId = Convert.IsDBNull(dt.Rows[0]["UserId"]) ? (Int32?)null : (Int32?)dt.Rows[0]["UserId"]; retObj._email = Convert.IsDBNull(dt.Rows[0]["Email"]) ? null : (string)dt.Rows[0]["Email"]; retObj._emailConfirmed = Convert.IsDBNull(dt.Rows[0]["EmailConfirmed"]) ? (bool?)null : (bool?)dt.Rows[0]["EmailConfirmed"]; retObj._passwordHash = Convert.IsDBNull(dt.Rows[0]["PasswordHash"]) ? null : (string)dt.Rows[0]["PasswordHash"]; retObj._securityStamp = Convert.IsDBNull(dt.Rows[0]["SecurityStamp"]) ? null : (string)dt.Rows[0]["SecurityStamp"]; retObj._phoneNumber = Convert.IsDBNull(dt.Rows[0]["PhoneNumber"]) ? null : (string)dt.Rows[0]["PhoneNumber"]; retObj._phoneNumberConfirmed = Convert.IsDBNull(dt.Rows[0]["PhoneNumberConfirmed"]) ? (bool?)null : (bool?)dt.Rows[0]["PhoneNumberConfirmed"]; retObj._twoFactorEnabled = Convert.IsDBNull(dt.Rows[0]["TwoFactorEnabled"]) ? (bool?)null : (bool?)dt.Rows[0]["TwoFactorEnabled"]; retObj._lockoutEndDateUtc = Convert.IsDBNull(dt.Rows[0]["LockoutEndDateUtc"]) ? (DateTime?)null : (DateTime?)dt.Rows[0]["LockoutEndDateUtc"]; retObj._lockoutEnabled = Convert.IsDBNull(dt.Rows[0]["LockoutEnabled"]) ? (bool?)null : (bool?)dt.Rows[0]["LockoutEnabled"]; retObj._accessFailedCount = Convert.IsDBNull(dt.Rows[0]["AccessFailedCount"]) ? (Int32?)null : (Int32?)dt.Rows[0]["AccessFailedCount"]; retObj._username = Convert.IsDBNull(dt.Rows[0]["Username"]) ? null : (string)dt.Rows[0]["Username"]; retObj._ctrVersion = Convert.IsDBNull(dt.Rows[0]["ctr_version"]) ? (Int32?)null : (Int32?)dt.Rows[0]["ctr_version"]; } return(retObj); } catch (Exception ex) { Failed(null, ex); Handle(null, ex); return(null); } finally { staticConnection.Close(); command.Dispose(); } }