public static TMSClassAssignFacultyDetails Get(System.Int64 cafdAssignId) { DataSet ds; Database db; string sqlCommand; DbCommand dbCommand; TMSClassAssignFacultyDetails instance; instance = new TMSClassAssignFacultyDetails(); db = DatabaseFactory.CreateDatabase(); sqlCommand = "[dbo].gspTMSClassAssignFacultyDetails_SELECT"; dbCommand = db.GetStoredProcCommand(sqlCommand, cafdAssignId); // Get results. ds = db.ExecuteDataSet(dbCommand); // Verification. if (ds == null || ds.Tables[0].Rows.Count == 0) { throw new ApplicationException("Could not get TMSClassAssignFacultyDetails ID:" + cafdAssignId.ToString() + " from Database."); } // Return results. ds.Tables[0].TableName = TABLE_NAME; instance.MapFrom(ds.Tables[0].Rows[0]); return(instance); }
public static TMSClassAssignFacultyDetails[] Search(System.Int64?cafdAssignId, System.Int64?cafdFacultyId, System.Int64?cafdSchoolId, System.Int64?cafdSchoolSubCategoryId, System.Int64?cafdDepartmentId, System.Int64?cafdSubjectId, System.String cafdAssignType, System.DateTime?cafdDate, System.Int32?cafdStatus) { DataSet ds; Database db; string sqlCommand; DbCommand dbCommand; db = DatabaseFactory.CreateDatabase(); sqlCommand = "[dbo].gspTMSClassAssignFacultyDetails_SEARCH"; dbCommand = db.GetStoredProcCommand(sqlCommand, cafdAssignId, cafdFacultyId, cafdSchoolId, cafdSchoolSubCategoryId, cafdDepartmentId, cafdSubjectId, cafdAssignType, cafdDate, cafdStatus); ds = db.ExecuteDataSet(dbCommand); ds.Tables[0].TableName = TABLE_NAME; return(TMSClassAssignFacultyDetails.MapFrom(ds)); }
public static TMSClassAssignFacultyDetails[] MapFrom(DataSet ds) { List <TMSClassAssignFacultyDetails> objects; // Initialise Collection. objects = new List <TMSClassAssignFacultyDetails>(); // 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_ClassAssignFacultyDetails] in DataSet."); } if (ds.Tables[TABLE_NAME].Rows.Count < 1) { throw new ApplicationException("Table [dbo].[TMS_ClassAssignFacultyDetails] is empty."); } // Map DataSet to Instance. foreach (DataRow dr in ds.Tables[TABLE_NAME].Rows) { TMSClassAssignFacultyDetails instance = new TMSClassAssignFacultyDetails(); instance.MapFrom(dr); objects.Add(instance); } // Return collection. return(objects.ToArray()); }
public static TMSClassAssignFacultyDetails[] MapFrom(DataSet ds) { List<TMSClassAssignFacultyDetails> objects; // Initialise Collection. objects = new List<TMSClassAssignFacultyDetails>(); // 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_ClassAssignFacultyDetails] in DataSet."); if (ds.Tables[TABLE_NAME].Rows.Count < 1) throw new ApplicationException("Table [dbo].[TMS_ClassAssignFacultyDetails] is empty."); // Map DataSet to Instance. foreach (DataRow dr in ds.Tables[TABLE_NAME].Rows) { TMSClassAssignFacultyDetails instance = new TMSClassAssignFacultyDetails(); instance.MapFrom(dr); objects.Add(instance); } // Return collection. return objects.ToArray(); }
public static TMSClassAssignFacultyDetails Get(System.Int64 cafdAssignId) { DataSet ds; Database db; string sqlCommand; DbCommand dbCommand; TMSClassAssignFacultyDetails instance; instance = new TMSClassAssignFacultyDetails(); db = DatabaseFactory.CreateDatabase(); sqlCommand = "[dbo].gspTMSClassAssignFacultyDetails_SELECT"; dbCommand = db.GetStoredProcCommand(sqlCommand, cafdAssignId); // Get results. ds = db.ExecuteDataSet(dbCommand); // Verification. if (ds == null || ds.Tables[0].Rows.Count == 0) throw new ApplicationException("Could not get TMSClassAssignFacultyDetails ID:" + cafdAssignId.ToString()+ " from Database."); // Return results. ds.Tables[0].TableName = TABLE_NAME; instance.MapFrom( ds.Tables[0].Rows[0] ); return instance; }