///<Summary> ///Select all rows by foreign key ///This method returns all data rows in the table CustomerCustomerDemo based on a foreign key ///</Summary> ///<returns> ///IList-IDAOCustomerCustomerDemo. ///</returns> ///<parameters> ///string customerTypeID ///</parameters> public static IList <IDAOCustomerCustomerDemo> SelectAllByCustomerTypeID(string customerTypeID) { Doing(null); SqlCommand command = new SqlCommand(); command.CommandText = InlineProcs.ctprCustomerCustomerDemo_SelectAllByCustomerTypeID; command.CommandType = CommandType.Text; SqlConnection staticConnection = StaticSqlConnection; command.Connection = staticConnection; DataTable dt = new DataTable("CustomerCustomerDemo"); 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); List <IDAOCustomerCustomerDemo> objList = new List <IDAOCustomerCustomerDemo>(); if (dt.Rows.Count > 0) { foreach (DataRow row in dt.Rows) { DAOCustomerCustomerDemo retObj = new DAOCustomerCustomerDemo(); retObj._customerID = Convert.IsDBNull(row["CustomerID"]) ? null : (string)row["CustomerID"]; retObj._customerTypeID = Convert.IsDBNull(row["CustomerTypeID"]) ? null : (string)row["CustomerTypeID"]; 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 CustomerCustomerDemo ///</Summary> ///<returns> ///IList-IDAOCustomerCustomerDemo. ///</returns> ///<parameters> ///IList<IDataCriterion> listCriterion, IList<IDataOrderBy> listOrder, IDataSkip dataSkip, IDataTake dataTake ///</parameters> public static IList <IDAOCustomerCustomerDemo> SelectAllByCriteria(IList <IDataCriterion> listCriterion, IList <IDataOrderBy> listOrder, IDataSkip dataSkip, IDataTake dataTake) { Doing(null); SqlCommand command = new SqlCommand(); command.CommandText = GetSelectionCriteria(InlineProcs.ctprCustomerCustomerDemo_SelectAllByCriteria, null, listCriterion, listOrder, dataSkip, dataTake); command.CommandType = CommandType.Text; SqlConnection staticConnection = StaticSqlConnection; command.Connection = staticConnection; DataTable dt = new DataTable("CustomerCustomerDemo"); SqlDataAdapter sqlAdapter = new SqlDataAdapter(command); try { staticConnection.Open(); sqlAdapter.Fill(dt); Done(null); List <IDAOCustomerCustomerDemo> objList = new List <IDAOCustomerCustomerDemo>(); if (dt.Rows.Count > 0) { foreach (DataRow row in dt.Rows) { DAOCustomerCustomerDemo retObj = new DAOCustomerCustomerDemo(); retObj._customerID = Convert.IsDBNull(row["CustomerID"]) ? null : (string)row["CustomerID"]; retObj._customerTypeID = Convert.IsDBNull(row["CustomerTypeID"]) ? null : (string)row["CustomerTypeID"]; objList.Add(retObj); } } return(objList); } catch (Exception ex) { Failed(null, ex); Handle(null, ex); return(null); } finally { staticConnection.Close(); command.Dispose(); } }