public static TMSParentDetails Get(System.Int64 pdParentId) { DataSet ds; Database db; string sqlCommand; DbCommand dbCommand; TMSParentDetails instance; instance = new TMSParentDetails(); db = DatabaseFactory.CreateDatabase(); sqlCommand = "[dbo].gspTMSParentDetails_SELECT"; dbCommand = db.GetStoredProcCommand(sqlCommand, pdParentId); // Get results. ds = db.ExecuteDataSet(dbCommand); // Verification. if (ds == null || ds.Tables[0].Rows.Count == 0) { throw new ApplicationException("Could not get TMSParentDetails ID:" + pdParentId.ToString() + " from Database."); } // Return results. ds.Tables[0].TableName = TABLE_NAME; instance.MapFrom(ds.Tables[0].Rows[0]); return(instance); }
public static TMSParentDetails[] Search(System.Int64?pdParentId, System.Int64?pdStudentDetailsId, System.String pdParentRefId, System.Int64?pdFatherLoginId, System.Int64?pdMotherLoginId, System.String pdFatherFullName, System.String pdFatherPhoto, System.String pdFatherEduQualification, System.String pdFatherOccupation, System.Int64?pdFatherAddressId, System.String pdFatherOrgName, System.String pdFatherDsgtName, System.String pdMotherFullName, System.String pdMotherPhoto, System.String pdMotherEduQualification, System.String pdMotherOccupation, System.Int64?pdMotherAddressId, System.String pdMotherOrgName, System.String pdMotherDsgtName, System.DateTime?pdDate, System.Int32?pdStatus) { DataSet ds; Database db; string sqlCommand; DbCommand dbCommand; db = DatabaseFactory.CreateDatabase(); sqlCommand = "[dbo].gspTMSParentDetails_SEARCH"; dbCommand = db.GetStoredProcCommand(sqlCommand, pdParentId, pdStudentDetailsId, pdParentRefId, pdFatherLoginId, pdMotherLoginId, pdFatherFullName, pdFatherPhoto, pdFatherEduQualification, pdFatherOccupation, pdFatherAddressId, pdFatherOrgName, pdFatherDsgtName, pdMotherFullName, pdMotherPhoto, pdMotherEduQualification, pdMotherOccupation, pdMotherAddressId, pdMotherOrgName, pdMotherDsgtName, pdDate, pdStatus); ds = db.ExecuteDataSet(dbCommand); ds.Tables[0].TableName = TABLE_NAME; return(TMSParentDetails.MapFrom(ds)); }
public static TMSParentDetails[] MapFrom(DataSet ds) { List <TMSParentDetails> objects; // Initialise Collection. objects = new List <TMSParentDetails>(); // 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_ParentDetails] in DataSet."); } if (ds.Tables[TABLE_NAME].Rows.Count < 1) { throw new ApplicationException("Table [dbo].[TMS_ParentDetails] is empty."); } // Map DataSet to Instance. foreach (DataRow dr in ds.Tables[TABLE_NAME].Rows) { TMSParentDetails instance = new TMSParentDetails(); instance.MapFrom(dr); objects.Add(instance); } // Return collection. return(objects.ToArray()); }
public static TMSParentDetails[] MapFrom(DataSet ds) { List<TMSParentDetails> objects; // Initialise Collection. objects = new List<TMSParentDetails>(); // 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_ParentDetails] in DataSet."); if (ds.Tables[TABLE_NAME].Rows.Count < 1) throw new ApplicationException("Table [dbo].[TMS_ParentDetails] is empty."); // Map DataSet to Instance. foreach (DataRow dr in ds.Tables[TABLE_NAME].Rows) { TMSParentDetails instance = new TMSParentDetails(); instance.MapFrom(dr); objects.Add(instance); } // Return collection. return objects.ToArray(); }
public static TMSParentDetails Get(System.Int64 pdParentId) { DataSet ds; Database db; string sqlCommand; DbCommand dbCommand; TMSParentDetails instance; instance = new TMSParentDetails(); db = DatabaseFactory.CreateDatabase(); sqlCommand = "[dbo].gspTMSParentDetails_SELECT"; dbCommand = db.GetStoredProcCommand(sqlCommand, pdParentId); // Get results. ds = db.ExecuteDataSet(dbCommand); // Verification. if (ds == null || ds.Tables[0].Rows.Count == 0) throw new ApplicationException("Could not get TMSParentDetails ID:" + pdParentId.ToString()+ " from Database."); // Return results. ds.Tables[0].TableName = TABLE_NAME; instance.MapFrom( ds.Tables[0].Rows[0] ); return instance; }