public bool DeleteIntellectualProperty(IntellectualPropertyObject intellectualProperty) { try { Config.Conn.Execute("DELETE FROM dat_IntellectualProperty WHERE IntellectualPropertyId = @IntellectualPropertyId", intellectualProperty); } catch { return(false); } return(true); }
public IntellectualPropertyObject SaveIntellectualProperty(IntellectualPropertyObject intellectualProperty) { if (intellectualProperty.IntellectualPropertyId > 0) // Update { string sql = @" UPDATE dat_IntellectualProperty SET MainId = @MainId, IdrNumber = @IdrNumber, DocketNumber = @DocketNumber, Aty = @Aty, Ae = @Ae, Title = @Title WHERE IntellectualPropertyId = @IntellectualPropertyId"; Config.Conn.Execute(sql, intellectualProperty); } else { string sql = @" INSERT INTO dat_IntellectualProperty ( MainId, IdrNumber, DocketNumber, Aty, Ae, Title ) VALUES ( @MainId, @IdrNumber, @DocketNumber, @Aty, @Ae, @Title ) SELECT CAST(SCOPE_IDENTITY() AS INT)"; intellectualProperty.IntellectualPropertyId = Config.Conn.Query <int>(sql, intellectualProperty).Single(); } return(intellectualProperty); }