/// <summary> /// Updates a MapAttachmentContent record and returns the number of records affected /// </summary> public static int Update(MapAttachmentContentDO DO) { SqlParameter _MapAttachmentID = new SqlParameter("MapAttachmentID", SqlDbType.Int); SqlParameter _Content = new SqlParameter("Content", SqlDbType.VarBinary); _MapAttachmentID.Value = DO.MapAttachmentID; _Content.Value = DO.Content; SqlParameter[] _params = new SqlParameter[] { _MapAttachmentID, _Content }; string pid = ConfigurationManager.AppSettings["ePermitDAL"]; return DataCommon.ExecuteScalar("[dbo].[MapAttachmentContent_Update]", _params, pid); }
/// <summary> /// Creates a new MapAttachmentContent record using async /// </summary> public static async Task CreateAsync(MapAttachmentContentDO DO) { SqlParameter _MapAttachmentID = new SqlParameter("MapAttachmentID", SqlDbType.Int); SqlParameter _Content = new SqlParameter("Content", SqlDbType.VarBinary); _MapAttachmentID.Value = DO.MapAttachmentID; _Content.Value = DO.Content; SqlParameter[] _params = new SqlParameter[] { _MapAttachmentID, _Content }; string pid = ConfigurationManager.AppSettings["ePermitDAL"]; await DataCommon.ExecuteNonQueryAsync("[dbo].[MapAttachmentContent_Insert]", _params, pid); }
/// <summary> /// Gets all MapAttachmentContent records /// </summary> public static async Task<MapAttachmentContentDO[]> GetAllAsync() { string pid = ConfigurationManager.AppSettings["ePermitDAL"]; SafeReader sr = await DataCommon.ExecuteSafeReaderAsync("[dbo].[MapAttachmentContent_GetAll]", new SqlParameter[] { }, pid); List<MapAttachmentContentDO> objs = new List<MapAttachmentContentDO>(); while(sr.Read()){ MapAttachmentContentDO obj = new MapAttachmentContentDO(); obj.MapAttachmentID = sr.GetInt32(sr.GetOrdinal("MapAttachmentID")); obj.Content = sr.GetBytes(sr.GetOrdinal("Content")); objs.Add(obj); } return objs.ToArray(); }
/// <summary> /// Selects MapAttachmentContent records by PK /// </summary> public static async Task<MapAttachmentContentDO[]> GetByPKAsync(Int32 MapAttachmentID) { SqlParameter _MapAttachmentID = new SqlParameter("MapAttachmentID", SqlDbType.Int); _MapAttachmentID.Value = MapAttachmentID; SqlParameter[] _params = new SqlParameter[] { _MapAttachmentID }; string pid = ConfigurationManager.AppSettings["ePermitDAL"]; SafeReader sr = await DataCommon.ExecuteSafeReaderAsync("[dbo].[MapAttachmentContent_GetByPK]", _params, pid); List<MapAttachmentContentDO> objs = new List<MapAttachmentContentDO>(); while(sr.Read()) { MapAttachmentContentDO obj = new MapAttachmentContentDO(); obj.MapAttachmentID = sr.GetInt32(sr.GetOrdinal("MapAttachmentID")); obj.Content = sr.GetBytes(sr.GetOrdinal("Content")); objs.Add(obj); } return objs.ToArray(); }
/// <summary> /// Deletes a MapAttachmentContent record /// </summary> public static async Task<int> DeleteAsync(MapAttachmentContentDO DO) { SqlParameter _MapAttachmentID = new SqlParameter("MapAttachmentID", SqlDbType.Int); _MapAttachmentID.Value = DO.MapAttachmentID; SqlParameter[] _params = new SqlParameter[] { _MapAttachmentID }; string pid = ConfigurationManager.AppSettings["ePermitDAL"]; return await DataCommon.ExecuteScalarAsync("[dbo].[MapAttachmentContent_Delete]", _params, pid); }