14. ///<summary> /// Interface details required properties for abstractions with a mailing address. ///</summary> public interface I Address { ///<summary> /// Address Property ///</summary> ///<value>Automatic set used to set the address</value> string Address { get; set; } ///<summary> ///City Property ///</summary> ///<value>Automatic set used to set the City</value> string City { get; set; } ///<summary> /// Region Property ///</summary> ///<value>Automatic set used to set the Region</value> string Region { get; set; } ///<summary> ///Postal Code property ///</summary> ///<value>Automatic set used to set the Postal Code</value> string Postal Code { get; set; } } SetFocus Project #1 – Framework Project Address Interface
15. ///<remarks> /// Description Attribute created to allow the developer to specify information /// about himself for the newly created class. Developer name, date and title /// are field which can be specified. /// Description can be applied to Assembly, Class, Interface and Enum ///</remarks> [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Interface| AttributeTargets.Enum, AllowMultiple = true)] public class DeveloperInfoAttribute : Attribute { ///<summary> /// Non-Default Constructor ///</summary> ///<param name="name"></param> public DeveloperInfoAttribute(string name) { Name = name; } ///<summary> /// Name Property ///</summary> ///<value>Automatic set used to assign value</value> public string Name { get; set; } ///<summary> /// Date Property ///</summary> ///<value>Automatic set used to assign value</value> public string Date { get; set; } ///<summary> /// Title Property ///</summary> ///<value>Automatic set used to assign value</value> public string Title { get; set;} } SetFocus Project #1 – Framework Project Address Interface
16. ///<remarks> /// Description Attribute created to allow the developer to specify information /// about himself for the newly created class. Developer name, date and title /// are field which can be specified. /// Description can be applied to Assembly, Class, Interface and Enum ///</remarks> [AttributeUsage(AttributeTargets.Assembly| AttributeTargets.Class | AttributeTargets.Interface| AttributeTargets.Enum, AllowMultiple = true)] public class DeveloperInfoAttribute : Attribute { ///<summary> /// Non-Default Constructor ///</summary> ///<param name="name"></param> public DeveloperInfoAttribute(string name) { Name = name; } ///<summary> /// Name Property ///</summary> ///<value>Automatic set used to assign value</value> public string Name { get; set; } ///<summary> /// Date Property ///</summary> ///<value>Automatic set used to assign value</value> public string Date { get; set; } ///<summary> /// Title Property ///</summary> ///<value>Automatic set used to assign value</value> public string Title { get; set;} } SetFocus Project #1 – Framework Project Developer Attribute
38. SetFocus Project #3 – Library Phase 2 Transact- SQL : Stored Procedures -- ============================================= -- Author: Zaccheus Roserie -- Create date: 8/14/2009 -- Description: Adds a new Adult into the adult table -- Errors -- state 1 -- raiserror('firstname, lastname, street, city, state and zipcode can not be null',11,1) -- ============================================= CREATE PROCEDURE [dbo].[spAddAdultMember] -- Add the parameters for the stored procedure here @firstname varchar(15) = null, @lastname varchar(15) = null, @middleinitial char(1) = null, @photograph image = null, @street varchar(15) = null, @city varchar(15) = null, @state char(2) = null, @zipcode char(10) = null, @phone_no char(13) = null, @member_no smallint OUTPUT AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from -- interfering with SELECT statements. SET NOCOUNT ON; --validate params IF @firstname is null or @lastname is null or @street is null or @city is null or @state is null or @zipcode is null BEGIN raiserror(' firstname, lastname, street, city, state and zipcode cannot be null', 11,1) END
39. --set the expiration date to one year from today's date DECLARE @expr_date datetime SET @expr_date = DATEADD(YEAR,1,GETDATE()); END BEGIN TRY BEGIN TRAN -- Insert statements for procedure here INSERT INTO [library].[dbo].[member] ([lastname], [firstname], [middleinitial], [photograph]) VALUES (@lastname, @firstname, @middleinitial, @photograph) set @member_no = scope_identity() INSERT INTO [library].[dbo].[adult] ([member_no], [street], [city], [state], [zip], [phone_no], [expr_date]) VALUES (@member_no, @street, @city, @state, @zipcode, @phone_no, @expr_date) COMMIT TRAN END TRY BEGIN CATCH -- See if system error arose during Transaction if @@TRANCOUNT > 0 BEGIN ROLLBACK TRAN END PRINT 'Error(s) Caught' -- Declare local variables DECLARE @ErrorMessage NVARCHAR(4000); DECLARE @ErrorSeverity INT; DECLARE @ErrorState INT; -- Populate variables SELECT @ErrorMessage = ERROR_MESSAGE(), @ErrorSeverity = ERROR_SEVERITY(), @ErrorState = ERROR_STATE(); -- rethrow goes to front end c# RAISERROR (@ErrorMessage, @ErrorSeverity, @ErrorState); RETURN END CATCH
40.
41. Automatically updating Juvenile members of the library to adult members if they have encountered or passed their 18th birthday.