/// <summary> /// Creates a new ProposedSoilSalvageDepths record using async /// </summary> public static async Task CreateAsync(ProposedSoilSalvageDepthsDO DO) { SqlParameter _PermitKey = new SqlParameter("PermitKey", SqlDbType.Int); SqlParameter _SoilType = new SqlParameter("SoilType", SqlDbType.VarChar); SqlParameter _SalvageDepth = new SqlParameter("SalvageDepth", SqlDbType.VarChar); SqlParameter _Acres = new SqlParameter("Acres", SqlDbType.Int); _PermitKey.Value = DO.PermitKey; _SoilType.Value = DO.SoilType; _SalvageDepth.Value = DO.SalvageDepth; _Acres.Value = DO.Acres; SqlParameter[] _params = new SqlParameter[] { _PermitKey, _SoilType, _SalvageDepth, _Acres }; string pid = ConfigurationManager.AppSettings["ePermitDAL"]; await DataCommon.ExecuteNonQueryAsync("[dbo].[ProposedSoilSalvageDepths_Insert]", _params, pid); }
/// <summary> /// Updates a ProposedSoilSalvageDepths record and returns the number of records affected /// </summary> public static int Update(ProposedSoilSalvageDepthsDO DO) { SqlParameter _PermitKey = new SqlParameter("PermitKey", SqlDbType.Int); SqlParameter _SoilType = new SqlParameter("SoilType", SqlDbType.VarChar); SqlParameter _SalvageDepth = new SqlParameter("SalvageDepth", SqlDbType.VarChar); SqlParameter _Acres = new SqlParameter("Acres", SqlDbType.Int); _PermitKey.Value = DO.PermitKey; _SoilType.Value = DO.SoilType; _SalvageDepth.Value = DO.SalvageDepth; _Acres.Value = DO.Acres; SqlParameter[] _params = new SqlParameter[] { _PermitKey, _SoilType, _SalvageDepth, _Acres }; string pid = ConfigurationManager.AppSettings["ePermitDAL"]; return DataCommon.ExecuteScalar("[dbo].[ProposedSoilSalvageDepths_Update]", _params, pid); }
/// <summary> /// Gets all ProposedSoilSalvageDepths records /// </summary> public static async Task<ProposedSoilSalvageDepthsDO[]> GetAllAsync() { string pid = ConfigurationManager.AppSettings["ePermitDAL"]; SafeReader sr = await DataCommon.ExecuteSafeReaderAsync("[dbo].[ProposedSoilSalvageDepths_GetAll]", new SqlParameter[] { }, pid); List<ProposedSoilSalvageDepthsDO> objs = new List<ProposedSoilSalvageDepthsDO>(); while(sr.Read()){ ProposedSoilSalvageDepthsDO obj = new ProposedSoilSalvageDepthsDO(); obj.PermitKey = sr.GetInt32(sr.GetOrdinal("PermitKey")); obj.SoilType = sr.GetString(sr.GetOrdinal("SoilType")); obj.SalvageDepth = sr.GetString(sr.GetOrdinal("SalvageDepth")); obj.Acres = sr.GetInt32(sr.GetOrdinal("Acres")); objs.Add(obj); } return objs.ToArray(); }
/// <summary> /// Selects ProposedSoilSalvageDepths records by PK /// </summary> public static async Task<ProposedSoilSalvageDepthsDO[]> GetByPKAsync(Int32 PermitKey, String SoilType) { SqlParameter _PermitKey = new SqlParameter("PermitKey", SqlDbType.Int); SqlParameter _SoilType = new SqlParameter("SoilType", SqlDbType.VarChar); _PermitKey.Value = PermitKey; _SoilType.Value = SoilType; SqlParameter[] _params = new SqlParameter[] { _PermitKey, _SoilType }; string pid = ConfigurationManager.AppSettings["ePermitDAL"]; SafeReader sr = await DataCommon.ExecuteSafeReaderAsync("[dbo].[ProposedSoilSalvageDepths_GetByPK]", _params, pid); List<ProposedSoilSalvageDepthsDO> objs = new List<ProposedSoilSalvageDepthsDO>(); while(sr.Read()) { ProposedSoilSalvageDepthsDO obj = new ProposedSoilSalvageDepthsDO(); obj.PermitKey = sr.GetInt32(sr.GetOrdinal("PermitKey")); obj.SoilType = sr.GetString(sr.GetOrdinal("SoilType")); obj.SalvageDepth = sr.GetString(sr.GetOrdinal("SalvageDepth")); obj.Acres = sr.GetInt32(sr.GetOrdinal("Acres")); objs.Add(obj); } return objs.ToArray(); }
/// <summary> /// Deletes a ProposedSoilSalvageDepths record /// </summary> public static async Task<int> DeleteAsync(ProposedSoilSalvageDepthsDO DO) { SqlParameter _PermitKey = new SqlParameter("PermitKey", SqlDbType.Int); SqlParameter _SoilType = new SqlParameter("SoilType", SqlDbType.VarChar); _PermitKey.Value = DO.PermitKey; _SoilType.Value = DO.SoilType; SqlParameter[] _params = new SqlParameter[] { _PermitKey, _SoilType }; string pid = ConfigurationManager.AppSettings["ePermitDAL"]; return await DataCommon.ExecuteScalarAsync("[dbo].[ProposedSoilSalvageDepths_Delete]", _params, pid); }