public static TMSPartener Get(System.Int64 ptPartners) { DataSet ds; Database db; string sqlCommand; DbCommand dbCommand; TMSPartener instance; instance = new TMSPartener(); db = DatabaseFactory.CreateDatabase(); sqlCommand = "[dbo].gspTMSPartener_SELECT"; dbCommand = db.GetStoredProcCommand(sqlCommand, ptPartners); // Get results. ds = db.ExecuteDataSet(dbCommand); // Verification. if (ds == null || ds.Tables[0].Rows.Count == 0) { throw new ApplicationException("Could not get TMSPartener ID:" + ptPartners.ToString() + " from Database."); } // Return results. ds.Tables[0].TableName = TABLE_NAME; instance.MapFrom(ds.Tables[0].Rows[0]); return(instance); }
public static TMSPartener[] Search(System.Int64?ptPartners, System.String ptTitle, System.String ptFirstName, System.String ptLastName, System.String ptEmailID, System.String ptMobileNo, System.String ptCorporateUrl, System.String ptJobTitle, System.String ptCountryName, System.String ptDescription, System.String ptDescription1, System.DateTime?ptDate, System.Int32?ptStatus) { DataSet ds; Database db; string sqlCommand; DbCommand dbCommand; db = DatabaseFactory.CreateDatabase(); sqlCommand = "[dbo].gspTMSPartener_SEARCH"; dbCommand = db.GetStoredProcCommand(sqlCommand, ptPartners, ptTitle, ptFirstName, ptLastName, ptEmailID, ptMobileNo, ptCorporateUrl, ptJobTitle, ptCountryName, ptDescription, ptDescription1, ptDate, ptStatus); ds = db.ExecuteDataSet(dbCommand); ds.Tables[0].TableName = TABLE_NAME; return(TMSPartener.MapFrom(ds)); }
public static TMSPartener[] MapFrom(DataSet ds) { List <TMSPartener> objects; // Initialise Collection. objects = new List <TMSPartener>(); // 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_Partener] in DataSet."); } if (ds.Tables[TABLE_NAME].Rows.Count < 1) { throw new ApplicationException("Table [dbo].[TMS_Partener] is empty."); } // Map DataSet to Instance. foreach (DataRow dr in ds.Tables[TABLE_NAME].Rows) { TMSPartener instance = new TMSPartener(); instance.MapFrom(dr); objects.Add(instance); } // Return collection. return(objects.ToArray()); }
public static TMSPartener[] MapFrom(DataSet ds) { List<TMSPartener> objects; // Initialise Collection. objects = new List<TMSPartener>(); // 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_Partener] in DataSet."); if (ds.Tables[TABLE_NAME].Rows.Count < 1) throw new ApplicationException("Table [dbo].[TMS_Partener] is empty."); // Map DataSet to Instance. foreach (DataRow dr in ds.Tables[TABLE_NAME].Rows) { TMSPartener instance = new TMSPartener(); instance.MapFrom(dr); objects.Add(instance); } // Return collection. return objects.ToArray(); }
public static TMSPartener Get(System.Int64 ptPartners) { DataSet ds; Database db; string sqlCommand; DbCommand dbCommand; TMSPartener instance; instance = new TMSPartener(); db = DatabaseFactory.CreateDatabase(); sqlCommand = "[dbo].gspTMSPartener_SELECT"; dbCommand = db.GetStoredProcCommand(sqlCommand, ptPartners); // Get results. ds = db.ExecuteDataSet(dbCommand); // Verification. if (ds == null || ds.Tables[0].Rows.Count == 0) throw new ApplicationException("Could not get TMSPartener ID:" + ptPartners.ToString()+ " from Database."); // Return results. ds.Tables[0].TableName = TABLE_NAME; instance.MapFrom( ds.Tables[0].Rows[0] ); return instance; }