///<Summary> ///Select all rows by foreign key ///This method returns all data rows in the table EmployeeTerritories based on a foreign key ///</Summary> ///<returns> ///IList-IDAOEmployeeTerritories. ///</returns> ///<parameters> ///string territoryID ///</parameters> public static IList <IDAOEmployeeTerritories> SelectAllByTerritoryID(string territoryID) { Doing(null); SqlCommand command = new SqlCommand(); command.CommandText = InlineProcs.ctprEmployeeTerritories_SelectAllByTerritoryID; command.CommandType = CommandType.Text; SqlConnection staticConnection = StaticSqlConnection; command.Connection = staticConnection; DataTable dt = new DataTable("EmployeeTerritories"); SqlDataAdapter sqlAdapter = new SqlDataAdapter(command); try { command.Parameters.Add(CtSqlParameter.Get("@TerritoryID", SqlDbType.NVarChar, 20, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, (object)territoryID ?? (object)DBNull.Value)); staticConnection.Open(); sqlAdapter.Fill(dt); Done(null); List <IDAOEmployeeTerritories> objList = new List <IDAOEmployeeTerritories>(); if (dt.Rows.Count > 0) { foreach (DataRow row in dt.Rows) { DAOEmployeeTerritories retObj = new DAOEmployeeTerritories(); retObj._employeeID = Convert.IsDBNull(row["EmployeeID"]) ? (Int32?)null : (Int32?)row["EmployeeID"]; retObj._territoryID = Convert.IsDBNull(row["TerritoryID"]) ? null : (string)row["TerritoryID"]; 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 EmployeeTerritories ///</Summary> ///<returns> ///IList-IDAOEmployeeTerritories. ///</returns> ///<parameters> ///IList<IDataCriterion> listCriterion, IList<IDataOrderBy> listOrder, IDataSkip dataSkip, IDataTake dataTake ///</parameters> public static IList <IDAOEmployeeTerritories> SelectAllByCriteria(IList <IDataCriterion> listCriterion, IList <IDataOrderBy> listOrder, IDataSkip dataSkip, IDataTake dataTake) { Doing(null); SqlCommand command = new SqlCommand(); command.CommandText = GetSelectionCriteria(InlineProcs.ctprEmployeeTerritories_SelectAllByCriteria, null, listCriterion, listOrder, dataSkip, dataTake); command.CommandType = CommandType.Text; SqlConnection staticConnection = StaticSqlConnection; command.Connection = staticConnection; DataTable dt = new DataTable("EmployeeTerritories"); SqlDataAdapter sqlAdapter = new SqlDataAdapter(command); try { staticConnection.Open(); sqlAdapter.Fill(dt); Done(null); List <IDAOEmployeeTerritories> objList = new List <IDAOEmployeeTerritories>(); if (dt.Rows.Count > 0) { foreach (DataRow row in dt.Rows) { DAOEmployeeTerritories retObj = new DAOEmployeeTerritories(); retObj._employeeID = Convert.IsDBNull(row["EmployeeID"]) ? (Int32?)null : (Int32?)row["EmployeeID"]; retObj._territoryID = Convert.IsDBNull(row["TerritoryID"]) ? null : (string)row["TerritoryID"]; objList.Add(retObj); } } return(objList); } catch (Exception ex) { Failed(null, ex); Handle(null, ex); return(null); } finally { staticConnection.Close(); command.Dispose(); } }