public static TMSFeesSetup Get(System.Int64 feesSetupID) { DataSet ds; Database db; string sqlCommand; DbCommand dbCommand; TMSFeesSetup instance; instance = new TMSFeesSetup(); db = DatabaseFactory.CreateDatabase(); sqlCommand = "[dbo].gspTMSFeesSetup_SELECT"; dbCommand = db.GetStoredProcCommand(sqlCommand, feesSetupID); // Get results. ds = db.ExecuteDataSet(dbCommand); // Verification. if (ds == null || ds.Tables[0].Rows.Count == 0) { throw new ApplicationException("Could not get TMSFeesSetup ID:" + feesSetupID.ToString() + " from Database."); } // Return results. ds.Tables[0].TableName = TABLE_NAME; instance.MapFrom(ds.Tables[0].Rows[0]); return(instance); }
public static TMSFeesSetup[] Search(System.Int64?feesSetupID, System.Int32?schoolCategoryID, System.Int32?schoolSubcategoryID, System.Int32?feesCategoryID, System.Int64?feesTermID, System.Int32?feesHeadID, System.Int32?studentTypeID, System.Decimal?feesAmount, System.DateTime?createdDate, System.Boolean?isDelete) { DataSet ds; Database db; string sqlCommand; DbCommand dbCommand; db = DatabaseFactory.CreateDatabase(); sqlCommand = "[dbo].gspTMSFeesSetup_SEARCH"; dbCommand = db.GetStoredProcCommand(sqlCommand, feesSetupID, schoolCategoryID, schoolSubcategoryID, feesCategoryID, feesTermID, feesHeadID, studentTypeID, feesAmount, createdDate, isDelete); ds = db.ExecuteDataSet(dbCommand); ds.Tables[0].TableName = TABLE_NAME; return(TMSFeesSetup.MapFrom(ds)); }
public static TMSFeesSetup[] MapFrom(DataSet ds) { List <TMSFeesSetup> objects; // Initialise Collection. objects = new List <TMSFeesSetup>(); // 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_FeesSetup] in DataSet."); } if (ds.Tables[TABLE_NAME].Rows.Count < 1) { throw new ApplicationException("Table [dbo].[TMS_FeesSetup] is empty."); } // Map DataSet to Instance. foreach (DataRow dr in ds.Tables[TABLE_NAME].Rows) { TMSFeesSetup instance = new TMSFeesSetup(); instance.MapFrom(dr); objects.Add(instance); } // Return collection. return(objects.ToArray()); }
public static TMSFeesSetup[] MapFrom(DataSet ds) { List<TMSFeesSetup> objects; // Initialise Collection. objects = new List<TMSFeesSetup>(); // 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_FeesSetup] in DataSet."); if (ds.Tables[TABLE_NAME].Rows.Count < 1) throw new ApplicationException("Table [dbo].[TMS_FeesSetup] is empty."); // Map DataSet to Instance. foreach (DataRow dr in ds.Tables[TABLE_NAME].Rows) { TMSFeesSetup instance = new TMSFeesSetup(); instance.MapFrom(dr); objects.Add(instance); } // Return collection. return objects.ToArray(); }
public static TMSFeesSetup Get(System.Int64 feesSetupID) { DataSet ds; Database db; string sqlCommand; DbCommand dbCommand; TMSFeesSetup instance; instance = new TMSFeesSetup(); db = DatabaseFactory.CreateDatabase(); sqlCommand = "[dbo].gspTMSFeesSetup_SELECT"; dbCommand = db.GetStoredProcCommand(sqlCommand, feesSetupID); // Get results. ds = db.ExecuteDataSet(dbCommand); // Verification. if (ds == null || ds.Tables[0].Rows.Count == 0) throw new ApplicationException("Could not get TMSFeesSetup ID:" + feesSetupID.ToString()+ " from Database."); // Return results. ds.Tables[0].TableName = TABLE_NAME; instance.MapFrom( ds.Tables[0].Rows[0] ); return instance; }