///<Summary> ///Select all rows by filter criteria ///This method returns all data rows in the table using criteriaquery api CustomerDemographics ///</Summary> ///<returns> ///IList-IDAOCustomerDemographics. ///</returns> ///<parameters> ///IList<IDataCriterion> listCriterion, IList<IDataOrderBy> listOrder, IDataSkip dataSkip, IDataTake dataTake ///</parameters> public static IList <IDAOCustomerDemographics> SelectAllByCriteria(IList <IDataCriterion> listCriterion, IList <IDataOrderBy> listOrder, IDataSkip dataSkip, IDataTake dataTake) { Doing(null); SqlCommand command = new SqlCommand(); command.CommandText = GetSelectionCriteria(InlineProcs.ctprCustomerDemographics_SelectAllByCriteria, null, listCriterion, listOrder, dataSkip, dataTake); command.CommandType = CommandType.Text; SqlConnection staticConnection = StaticSqlConnection; command.Connection = staticConnection; DataTable dt = new DataTable("CustomerDemographics"); SqlDataAdapter sqlAdapter = new SqlDataAdapter(command); try { staticConnection.Open(); sqlAdapter.Fill(dt); Done(null); List <IDAOCustomerDemographics> objList = new List <IDAOCustomerDemographics>(); if (dt.Rows.Count > 0) { foreach (DataRow row in dt.Rows) { DAOCustomerDemographics retObj = new DAOCustomerDemographics(); retObj._customerTypeID = Convert.IsDBNull(row["CustomerTypeID"]) ? null : (string)row["CustomerTypeID"]; retObj._customerDesc = Convert.IsDBNull(row["CustomerDesc"]) ? null : (string)row["CustomerDesc"]; 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 CustomerDemographics based on the primary key(s) ///</Summary> ///<returns> ///IDAOCustomerDemographics ///</returns> ///<parameters> ///string customerTypeID ///</parameters> public static IDAOCustomerDemographics SelectOne(string customerTypeID) { Doing(null); SqlCommand command = new SqlCommand(); command.CommandText = InlineProcs.ctprCustomerDemographics_SelectOne; command.CommandType = CommandType.Text; SqlConnection staticConnection = StaticSqlConnection; command.Connection = staticConnection; DataTable dt = new DataTable("CustomerDemographics"); SqlDataAdapter sqlAdapter = new SqlDataAdapter(command); try { command.Parameters.Add(CtSqlParameter.Get("@CustomerTypeID", SqlDbType.NChar, 10, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, (object)customerTypeID ?? (object)DBNull.Value)); staticConnection.Open(); sqlAdapter.Fill(dt); Done(null); DAOCustomerDemographics retObj = null; if (dt.Rows.Count > 0) { retObj = new DAOCustomerDemographics(); retObj._customerTypeID = Convert.IsDBNull(dt.Rows[0]["CustomerTypeID"]) ? null : (string)dt.Rows[0]["CustomerTypeID"]; retObj._customerDesc = Convert.IsDBNull(dt.Rows[0]["CustomerDesc"]) ? null : (string)dt.Rows[0]["CustomerDesc"]; 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(); } }