public static CBE.SubDistrictCBE GetSubDistrictById(CBE.SubDistrictCBE SubDistrict) { try { CBE.SubDistrictCBECollection SubDistrictes = new CBE.SubDistrictCBECollection(); string spName = Constants.oraclePackagePrefix + "SUBDISTRICT_GETBYID"; DbCommand command = VaaaN.MLFF.Libraries.CommonLibrary.DBA.DBAccessor.GetStoredProcCommand(spName); command.Parameters.Add(VaaaN.MLFF.Libraries.CommonLibrary.DBA.DBAccessor.CreateDbParameter(ref command, "P_SUBDISTRICT_ID", DbType.Int32, SubDistrict.SubDistrictId, ParameterDirection.Input)); SubDistrictes = ConvertDataTableToCollection(VaaaN.MLFF.Libraries.CommonLibrary.DBA.DBAccessor.LoadDataSet(command, tableName).Tables[tableName]); return(SubDistrictes[0]); } catch (Exception ex) { throw ex; } }
public static VaaaN.MLFF.Libraries.CommonLibrary.CBE.SubDistrictCBECollection GetAll() { VaaaN.MLFF.Libraries.CommonLibrary.CBE.SubDistrictCBECollection subDistricts = new CBE.SubDistrictCBECollection(); try { //Stored procedure must have cur_out parameter. //There is no need to add ref cursor for oracle in code. string spName = VaaaN.MLFF.Libraries.CommonLibrary.Constants.oraclePackagePrefix + "SUBDISTRICT_GETALL"; DbCommand command = VaaaN.MLFF.Libraries.CommonLibrary.DBA.DBAccessor.GetStoredProcCommand(spName); DataSet ds = VaaaN.MLFF.Libraries.CommonLibrary.DBA.DBAccessor.LoadDataSet(command, tableName); DataTable dt = ds.Tables[tableName]; subDistricts = ConvertDataTableToCollection(dt); } catch (Exception ex) { throw ex; } return(subDistricts); }