public static TMSTransportStaff Get(System.Int64 tpId) { DataSet ds; Database db; string sqlCommand; DbCommand dbCommand; TMSTransportStaff instance; instance = new TMSTransportStaff(); db = DatabaseFactory.CreateDatabase(); sqlCommand = "[dbo].gspTMSTransportStaff_SELECT"; dbCommand = db.GetStoredProcCommand(sqlCommand, tpId); // Get results. ds = db.ExecuteDataSet(dbCommand); // Verification. if (ds == null || ds.Tables[0].Rows.Count == 0) { throw new ApplicationException("Could not get TMSTransportStaff ID:" + tpId.ToString() + " from Database."); } // Return results. ds.Tables[0].TableName = TABLE_NAME; instance.MapFrom(ds.Tables[0].Rows[0]); return(instance); }
public static TMSTransportStaff[] Search(System.Int64?tpId, System.Int64?tpLoginID, System.Int64?tpUsertype, System.String tpFirstName, System.String tpMiddleName, System.String tpLastName, System.String tpPhoto, System.DateTime?tpDob, System.String tpCaste, System.String tpSubCaste, System.String tpBirthPlace, System.String tpGender, System.String tpBloodGroup, System.String tpMotherTongue, System.DateTime?tpDoj, System.String tpHighestDegree, System.String tpCompletedYear, System.String tpUniversity, System.Int64?tpAddressId, System.String tpAgeproof, System.String tpReleavingLetter, System.String tpResume, System.Int32?tpStatus) { DataSet ds; Database db; string sqlCommand; DbCommand dbCommand; db = DatabaseFactory.CreateDatabase(); sqlCommand = "[dbo].gspTMSTransportStaff_SEARCH"; dbCommand = db.GetStoredProcCommand(sqlCommand, tpId, tpLoginID, tpUsertype, tpFirstName, tpMiddleName, tpLastName, tpPhoto, tpDob, tpCaste, tpSubCaste, tpBirthPlace, tpGender, tpBloodGroup, tpMotherTongue, tpDoj, tpHighestDegree, tpCompletedYear, tpUniversity, tpAddressId, tpAgeproof, tpReleavingLetter, tpResume, tpStatus); ds = db.ExecuteDataSet(dbCommand); ds.Tables[0].TableName = TABLE_NAME; return(TMSTransportStaff.MapFrom(ds)); }
public static TMSTransportStaff[] MapFrom(DataSet ds) { List <TMSTransportStaff> objects; // Initialise Collection. objects = new List <TMSTransportStaff>(); // 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_TransportStaff] in DataSet."); } if (ds.Tables[TABLE_NAME].Rows.Count < 1) { throw new ApplicationException("Table [dbo].[TMS_TransportStaff] is empty."); } // Map DataSet to Instance. foreach (DataRow dr in ds.Tables[TABLE_NAME].Rows) { TMSTransportStaff instance = new TMSTransportStaff(); instance.MapFrom(dr); objects.Add(instance); } // Return collection. return(objects.ToArray()); }
public static TMSTransportStaff[] MapFrom(DataSet ds) { List<TMSTransportStaff> objects; // Initialise Collection. objects = new List<TMSTransportStaff>(); // 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_TransportStaff] in DataSet."); if (ds.Tables[TABLE_NAME].Rows.Count < 1) throw new ApplicationException("Table [dbo].[TMS_TransportStaff] is empty."); // Map DataSet to Instance. foreach (DataRow dr in ds.Tables[TABLE_NAME].Rows) { TMSTransportStaff instance = new TMSTransportStaff(); instance.MapFrom(dr); objects.Add(instance); } // Return collection. return objects.ToArray(); }
public static TMSTransportStaff Get(System.Int64 tpId) { DataSet ds; Database db; string sqlCommand; DbCommand dbCommand; TMSTransportStaff instance; instance = new TMSTransportStaff(); db = DatabaseFactory.CreateDatabase(); sqlCommand = "[dbo].gspTMSTransportStaff_SELECT"; dbCommand = db.GetStoredProcCommand(sqlCommand, tpId); // Get results. ds = db.ExecuteDataSet(dbCommand); // Verification. if (ds == null || ds.Tables[0].Rows.Count == 0) throw new ApplicationException("Could not get TMSTransportStaff ID:" + tpId.ToString()+ " from Database."); // Return results. ds.Tables[0].TableName = TABLE_NAME; instance.MapFrom( ds.Tables[0].Rows[0] ); return instance; }