public static TMSParentRepresentativeDetails Get(System.Int64 prpDetailsID) { DataSet ds; Database db; string sqlCommand; DbCommand dbCommand; TMSParentRepresentativeDetails instance; instance = new TMSParentRepresentativeDetails(); db = DatabaseFactory.CreateDatabase(); sqlCommand = "[dbo].gspTMSParentRepresentativeDetails_SELECT"; dbCommand = db.GetStoredProcCommand(sqlCommand, prpDetailsID); // Get results. ds = db.ExecuteDataSet(dbCommand); // Verification. if (ds == null || ds.Tables[0].Rows.Count == 0) { throw new ApplicationException("Could not get TMSParentRepresentativeDetails ID:" + prpDetailsID.ToString() + " from Database."); } // Return results. ds.Tables[0].TableName = TABLE_NAME; instance.MapFrom(ds.Tables[0].Rows[0]); return(instance); }
public static TMSParentRepresentativeDetails[] Search(System.Int64?prpDetailsID, System.Int64?prpParentRepresentativeID, System.Int64?prpParentLoginID, System.Int64?prpStudentLoginID, System.Int64?prpStandardID, System.Int64?prpDivisionID, System.String prpSubject, System.String prpDescription, System.String prpDescription1, System.DateTime?prpDate, System.Int32?prpStatus) { DataSet ds; Database db; string sqlCommand; DbCommand dbCommand; db = DatabaseFactory.CreateDatabase(); sqlCommand = "[dbo].gspTMSParentRepresentativeDetails_SEARCH"; dbCommand = db.GetStoredProcCommand(sqlCommand, prpDetailsID, prpParentRepresentativeID, prpParentLoginID, prpStudentLoginID, prpStandardID, prpDivisionID, prpSubject, prpDescription, prpDescription1, prpDate, prpStatus); ds = db.ExecuteDataSet(dbCommand); ds.Tables[0].TableName = TABLE_NAME; return(TMSParentRepresentativeDetails.MapFrom(ds)); }
public static TMSParentRepresentativeDetails[] MapFrom(DataSet ds) { List <TMSParentRepresentativeDetails> objects; // Initialise Collection. objects = new List <TMSParentRepresentativeDetails>(); // Validation. if (ds == null) { throw new ApplicationException("Cannot map to dataset null."); } else if (ds.Tables[TABLE_NAME].Rows.Count == 0) { return(objects.ToArray()); } if (ds.Tables[TABLE_NAME] == null) { throw new ApplicationException("Cannot find table [dbo].[TMS_ParentRepresentativeDetails] in DataSet."); } if (ds.Tables[TABLE_NAME].Rows.Count < 1) { throw new ApplicationException("Table [dbo].[TMS_ParentRepresentativeDetails] is empty."); } // Map DataSet to Instance. foreach (DataRow dr in ds.Tables[TABLE_NAME].Rows) { TMSParentRepresentativeDetails instance = new TMSParentRepresentativeDetails(); instance.MapFrom(dr); objects.Add(instance); } // Return collection. return(objects.ToArray()); }
public static TMSParentRepresentativeDetails[] MapFrom(DataSet ds) { List<TMSParentRepresentativeDetails> objects; // Initialise Collection. objects = new List<TMSParentRepresentativeDetails>(); // Validation. if (ds == null) throw new ApplicationException("Cannot map to dataset null."); else if (ds.Tables[TABLE_NAME].Rows.Count == 0) return objects.ToArray(); if (ds.Tables[TABLE_NAME] == null) throw new ApplicationException("Cannot find table [dbo].[TMS_ParentRepresentativeDetails] in DataSet."); if (ds.Tables[TABLE_NAME].Rows.Count < 1) throw new ApplicationException("Table [dbo].[TMS_ParentRepresentativeDetails] is empty."); // Map DataSet to Instance. foreach (DataRow dr in ds.Tables[TABLE_NAME].Rows) { TMSParentRepresentativeDetails instance = new TMSParentRepresentativeDetails(); instance.MapFrom(dr); objects.Add(instance); } // Return collection. return objects.ToArray(); }
public static TMSParentRepresentativeDetails Get(System.Int64 prpDetailsID) { DataSet ds; Database db; string sqlCommand; DbCommand dbCommand; TMSParentRepresentativeDetails instance; instance = new TMSParentRepresentativeDetails(); db = DatabaseFactory.CreateDatabase(); sqlCommand = "[dbo].gspTMSParentRepresentativeDetails_SELECT"; dbCommand = db.GetStoredProcCommand(sqlCommand, prpDetailsID); // Get results. ds = db.ExecuteDataSet(dbCommand); // Verification. if (ds == null || ds.Tables[0].Rows.Count == 0) throw new ApplicationException("Could not get TMSParentRepresentativeDetails ID:" + prpDetailsID.ToString()+ " from Database."); // Return results. ds.Tables[0].TableName = TABLE_NAME; instance.MapFrom( ds.Tables[0].Rows[0] ); return instance; }