Wednesday, May 25, 2011

Sunday, April 22, 2011
Today me Phil and Jun meet to implement the database part of the program. Now the program can save file to XML format and load from a file.

Thursday, April 19, 2011
Have been working on the database to get it update.  A few errors have occurred like the wrong .dll file.

Tuesday, April 5, 2011

Model unit test finished

All Model unit test finished...

Public database setup

Database was setup, the connection string is:
Data Source=knotpedia.db.6221122.hostedresource.com; Initial Catalog=knotpedia; User ID=knotpedia; Password=Hexsoft2003;
If you want to setup the database in your own computer, you could download and setup Microsoft SQL Server 2005+ and management studio and execute following statement:
USE [master]
GO
/****** Object:  Database [Knot]    Script Date: 04/05/2011 20:21:11 ******/
CREATE DATABASE [Knot] ON  PRIMARY
( NAME = N'Knot', FILENAME = N'D:\Project\Knot\Database\Knot.mdf' , SIZE = 3072KB , MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB )
 LOG ON
( NAME = N'Knot_log', FILENAME = N'D:\Project\Knot\Database\Knot_log.ldf' , SIZE = 1024KB , MAXSIZE = 2048GB , FILEGROWTH = 1024KB )
GO
ALTER DATABASE [Knot] SET COMPATIBILITY_LEVEL = 90
GO
IF (1 = FULLTEXTSERVICEPROPERTY('IsFullTextInstalled'))
begin
EXEC [Knot].[dbo].[sp_fulltext_database] @action = 'enable'
end
GO
ALTER DATABASE [Knot] SET ANSI_NULL_DEFAULT OFF
GO
ALTER DATABASE [Knot] SET ANSI_NULLS OFF
GO
ALTER DATABASE [Knot] SET ANSI_PADDING OFF
GO
ALTER DATABASE [Knot] SET ANSI_WARNINGS OFF
GO
ALTER DATABASE [Knot] SET ARITHABORT OFF
GO
ALTER DATABASE [Knot] SET AUTO_CLOSE ON
GO
ALTER DATABASE [Knot] SET AUTO_CREATE_STATISTICS ON
GO
ALTER DATABASE [Knot] SET AUTO_SHRINK OFF
GO
ALTER DATABASE [Knot] SET AUTO_UPDATE_STATISTICS ON
GO
ALTER DATABASE [Knot] SET CURSOR_CLOSE_ON_COMMIT OFF
GO
ALTER DATABASE [Knot] SET CURSOR_DEFAULT  GLOBAL
GO
ALTER DATABASE [Knot] SET CONCAT_NULL_YIELDS_NULL OFF
GO
ALTER DATABASE [Knot] SET NUMERIC_ROUNDABORT OFF
GO
ALTER DATABASE [Knot] SET QUOTED_IDENTIFIER OFF
GO
ALTER DATABASE [Knot] SET RECURSIVE_TRIGGERS OFF
GO
ALTER DATABASE [Knot] SET  DISABLE_BROKER
GO
ALTER DATABASE [Knot] SET AUTO_UPDATE_STATISTICS_ASYNC OFF
GO
ALTER DATABASE [Knot] SET DATE_CORRELATION_OPTIMIZATION OFF
GO
ALTER DATABASE [Knot] SET TRUSTWORTHY OFF
GO
ALTER DATABASE [Knot] SET ALLOW_SNAPSHOT_ISOLATION OFF
GO
ALTER DATABASE [Knot] SET PARAMETERIZATION SIMPLE
GO
ALTER DATABASE [Knot] SET READ_COMMITTED_SNAPSHOT OFF
GO
ALTER DATABASE [Knot] SET HONOR_BROKER_PRIORITY OFF
GO
ALTER DATABASE [Knot] SET  READ_WRITE
GO
ALTER DATABASE [Knot] SET RECOVERY SIMPLE
GO
ALTER DATABASE [Knot] SET  MULTI_USER
GO
ALTER DATABASE [Knot] SET PAGE_VERIFY CHECKSUM
GO
ALTER DATABASE [Knot] SET DB_CHAINING OFF
GO
USE [Knot]
GO
/****** Object:  Table [dbo].[Knot]    Script Date: 04/05/2011 20:21:12 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Knot](
    [Id] [uniqueidentifier] NOT NULL,
    [Name] [nvarchar](50) NOT NULL,
    [Description] [nvarchar](4000) NOT NULL,
 CONSTRAINT [PK_Knot] PRIMARY KEY CLUSTERED
(
    [Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Fixture]    Script Date: 04/05/2011 20:21:12 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Fixture](
    [Id] [uniqueidentifier] NOT NULL,
    [Material] [int] NOT NULL,
    [Knot] [uniqueidentifier] NOT NULL,
 CONSTRAINT [PK_Fixture] PRIMARY KEY CLUSTERED
(
    [Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Line]    Script Date: 04/05/2011 20:21:12 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Line](
    [Id] [uniqueidentifier] NOT NULL,
    [Material] [int] NOT NULL,
    [Knot] [uniqueidentifier] NOT NULL,
 CONSTRAINT [PK_Line] PRIMARY KEY CLUSTERED
(
    [Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  StoredProcedure [dbo].[KnotUpdate]    Script Date: 04/05/2011 20:21:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[KnotUpdate]
    @Id uniqueidentifier,
    @Name nvarchar(50),
    @Description nvarchar(4000)
AS
UPDATE
    [Knot]
SET
    [Knot].[Name] = @Name,
    [Knot].[Description] = @Description
WHERE
    [Knot].[Id] = @Id
GO
/****** Object:  StoredProcedure [dbo].[KnotRemove]    Script Date: 04/05/2011 20:21:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[KnotRemove]
    @Id uniqueidentifier
AS
DELETE
    [Knot]
WHERE
    [Knot].[Id] = @Id
GO
/****** Object:  StoredProcedure [dbo].[KnotGetAll]    Script Date: 04/05/2011 20:21:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[KnotGetAll]
AS
SELECT
    [Knot].[Id],
    [Knot].[Name],
    [Knot].[Description]
FROM
    [Knot]
GO
/****** Object:  StoredProcedure [dbo].[KnotGet]    Script Date: 04/05/2011 20:21:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[KnotGet]
    @Id uniqueidentifier
AS
SELECT
    [Knot].[Id],
    [Knot].[Name],
    [Knot].[Description]
FROM
    [Knot]
WHERE
    [Knot].[Id] = @Id
GO
/****** Object:  StoredProcedure [dbo].[KnotAdd]    Script Date: 04/05/2011 20:21:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[KnotAdd]
    @Id uniqueidentifier,
    @Name nvarchar(50),
    @Description nvarchar(4000)
AS
INSERT
    [Knot]
VALUES (
    @Id,
    @Name,
    @Description
)
GO
/****** Object:  StoredProcedure [dbo].[FixtureUpdate]    Script Date: 04/05/2011 20:21:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[FixtureUpdate]
    @Id uniqueidentifier,
    @Material int,
    @Knot uniqueidentifier
AS
UPDATE
    [Fixture]
SET
    [Fixture].[Material] = @Material,
    [Fixture].[Knot] = @Knot
WHERE
    [Fixture].[Id] = @Id
GO
/****** Object:  StoredProcedure [dbo].[FixtureRemoveByKnot]    Script Date: 04/05/2011 20:21:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[FixtureRemoveByKnot]
    @Knot uniqueidentifier
AS
DELETE
    [Fixture]
WHERE
    [Fixture].[Knot] = @Knot
GO
/****** Object:  StoredProcedure [dbo].[FixtureRemove]    Script Date: 04/05/2011 20:21:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[FixtureRemove]
    @Id uniqueidentifier
AS
DELETE
    [Fixture]
WHERE
    [Fixture].[Id] = @Id
GO
/****** Object:  StoredProcedure [dbo].[FixtureGetByKnot]    Script Date: 04/05/2011 20:21:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[FixtureGetByKnot]
    @Knot uniqueidentifier
AS
SELECT
    [Fixture].[Id],
    [Fixture].[Material]
FROM
    [Fixture]
WHERE
    [Fixture].[Knot] = @Knot
GO
/****** Object:  StoredProcedure [dbo].[FixtureGetAll]    Script Date: 04/05/2011 20:21:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[FixtureGetAll]
AS
SELECT
    [Fixture].[Id],
    [Fixture].[Material],
    [FixtureKnot].[Id],
    [FixtureKnot].[Name],
    [FixtureKnot].[Description]
FROM
    [Fixture]
    JOIN [Knot] AS [FixtureKnot] ON [Fixture].[Knot] = [FixtureKnot].[Id]
GO
/****** Object:  StoredProcedure [dbo].[FixtureGet]    Script Date: 04/05/2011 20:21:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[FixtureGet]
    @Id uniqueidentifier
AS
SELECT
    [Fixture].[Id],
    [Fixture].[Material],
    [FixtureKnot].[Id],
    [FixtureKnot].[Name],
    [FixtureKnot].[Description]
FROM
    [Fixture]
    JOIN [Knot] AS [FixtureKnot] ON [Fixture].[Knot] = [FixtureKnot].[Id]
WHERE
    [Fixture].[Id] = @Id
GO
/****** Object:  StoredProcedure [dbo].[FixtureAdd]    Script Date: 04/05/2011 20:21:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[FixtureAdd]
    @Id uniqueidentifier,
    @Material int,
    @Knot uniqueidentifier
AS
INSERT
    [Fixture]
VALUES (
    @Id,
    @Material,
    @Knot
)
GO
/****** Object:  Table [dbo].[Step]    Script Date: 04/05/2011 20:21:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Step](
    [Id] [uniqueidentifier] NOT NULL,
    [Description] [nvarchar](4000) NOT NULL,
    [Line] [uniqueidentifier] NOT NULL,
 CONSTRAINT [PK_Step] PRIMARY KEY CLUSTERED
(
    [Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  StoredProcedure [dbo].[LineUpdate]    Script Date: 04/05/2011 20:21:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[LineUpdate]
    @Id uniqueidentifier,
    @Material int,
    @Knot uniqueidentifier
AS
UPDATE
    [Line]
SET
    [Line].[Material] = @Material,
    [Line].[Knot] = @Knot
WHERE
    [Line].[Id] = @Id
GO
/****** Object:  StoredProcedure [dbo].[LineRemoveByKnot]    Script Date: 04/05/2011 20:21:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[LineRemoveByKnot]
    @Knot uniqueidentifier
AS
DELETE
    [Line]
WHERE
    [Line].[Knot] = @Knot
GO
/****** Object:  StoredProcedure [dbo].[LineRemove]    Script Date: 04/05/2011 20:21:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[LineRemove]
    @Id uniqueidentifier
AS
DELETE
    [Line]
WHERE
    [Line].[Id] = @Id
GO
/****** Object:  StoredProcedure [dbo].[LineGetByKnot]    Script Date: 04/05/2011 20:21:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[LineGetByKnot]
    @Knot uniqueidentifier
AS
SELECT
    [Line].[Id],
    [Line].[Material]
FROM
    [Line]
WHERE
    [Line].[Knot] = @Knot
GO
/****** Object:  StoredProcedure [dbo].[LineGetAll]    Script Date: 04/05/2011 20:21:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[LineGetAll]
AS
SELECT
    [Line].[Id],
    [Line].[Material],
    [LineKnot].[Id],
    [LineKnot].[Name],
    [LineKnot].[Description]
FROM
    [Line]
    JOIN [Knot] AS [LineKnot] ON [Line].[Knot] = [LineKnot].[Id]
GO
/****** Object:  StoredProcedure [dbo].[LineGet]    Script Date: 04/05/2011 20:21:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[LineGet]
    @Id uniqueidentifier
AS
SELECT
    [Line].[Id],
    [Line].[Material],
    [LineKnot].[Id],
    [LineKnot].[Name],
    [LineKnot].[Description]
FROM
    [Line]
    JOIN [Knot] AS [LineKnot] ON [Line].[Knot] = [LineKnot].[Id]
WHERE
    [Line].[Id] = @Id
GO
/****** Object:  StoredProcedure [dbo].[LineAdd]    Script Date: 04/05/2011 20:21:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[LineAdd]
    @Id uniqueidentifier,
    @Material int,
    @Knot uniqueidentifier
AS
INSERT
    [Line]
VALUES (
    @Id,
    @Material,
    @Knot
)
GO
/****** Object:  StoredProcedure [dbo].[StepUpdate]    Script Date: 04/05/2011 20:21:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[StepUpdate]
    @Id uniqueidentifier,
    @Description nvarchar(4000),
    @Line uniqueidentifier
AS
UPDATE
    [Step]
SET
    [Step].[Description] = @Description,
    [Step].[Line] = @Line
WHERE
    [Step].[Id] = @Id
GO
/****** Object:  StoredProcedure [dbo].[StepRemoveByLine]    Script Date: 04/05/2011 20:21:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[StepRemoveByLine]
    @Line uniqueidentifier
AS
DELETE
    [Step]
WHERE
    [Step].[Line] = @Line
GO
/****** Object:  StoredProcedure [dbo].[StepRemove]    Script Date: 04/05/2011 20:21:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[StepRemove]
    @Id uniqueidentifier
AS
DELETE
    [Step]
WHERE
    [Step].[Id] = @Id
GO
/****** Object:  StoredProcedure [dbo].[StepGetByLine]    Script Date: 04/05/2011 20:21:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[StepGetByLine]
    @Line uniqueidentifier
AS
SELECT
    [Step].[Id],
    [Step].[Description]
FROM
    [Step]
WHERE
    [Step].[Line] = @Line
GO
/****** Object:  StoredProcedure [dbo].[StepGetAll]    Script Date: 04/05/2011 20:21:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[StepGetAll]
AS
SELECT
    [Step].[Id],
    [Step].[Description],
    [StepLine].[Id],
    [StepLine].[Material],
    [StepLineKnot].[Id],
    [StepLineKnot].[Name],
    [StepLineKnot].[Description]
FROM
    [Step]
    JOIN [Line] AS [StepLine] ON [Step].[Line] = [StepLine].[Id]
    JOIN [Knot] AS [StepLineKnot] ON [StepLine].[Knot] = [StepLineKnot].[Id]
GO
/****** Object:  StoredProcedure [dbo].[StepGet]    Script Date: 04/05/2011 20:21:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[StepGet]
    @Id uniqueidentifier
AS
SELECT
    [Step].[Id],
    [Step].[Description],
    [StepLine].[Id],
    [StepLine].[Material],
    [StepLineKnot].[Id],
    [StepLineKnot].[Name],
    [StepLineKnot].[Description]
FROM
    [Step]
    JOIN [Line] AS [StepLine] ON [Step].[Line] = [StepLine].[Id]
    JOIN [Knot] AS [StepLineKnot] ON [StepLine].[Knot] = [StepLineKnot].[Id]
WHERE
    [Step].[Id] = @Id
GO
/****** Object:  StoredProcedure [dbo].[StepAdd]    Script Date: 04/05/2011 20:21:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[StepAdd]
    @Id uniqueidentifier,
    @Description nvarchar(4000),
    @Line uniqueidentifier
AS
INSERT
    [Step]
VALUES (
    @Id,
    @Description,
    @Line
)
GO
/****** Object:  Table [dbo].[Point]    Script Date: 04/05/2011 20:21:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Point](
    [Id] [uniqueidentifier] NOT NULL,
    [X] [real] NOT NULL,
    [Y] [real] NOT NULL,
    [Z] [real] NOT NULL,
    [Step] [uniqueidentifier] NOT NULL,
 CONSTRAINT [PK_Point] PRIMARY KEY CLUSTERED
(
    [Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  StoredProcedure [dbo].[PointUpdate]    Script Date: 04/05/2011 20:21:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[PointUpdate]
    @Id uniqueidentifier,
    @X real,
    @Y real,
    @Z real,
    @Step uniqueidentifier
AS
UPDATE
    [Point]
SET
    [Point].[X] = @X,
    [Point].[Y] = @Y,
    [Point].[Z] = @Z,
    [Point].[Step] = @Step
WHERE
    [Point].[Id] = @Id
GO
/****** Object:  StoredProcedure [dbo].[PointRemoveByStep]    Script Date: 04/05/2011 20:21:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[PointRemoveByStep]
    @Step uniqueidentifier
AS
DELETE
    [Point]
WHERE
    [Point].[Step] = @Step
GO
/****** Object:  StoredProcedure [dbo].[PointRemove]    Script Date: 04/05/2011 20:21:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[PointRemove]
    @Id uniqueidentifier
AS
DELETE
    [Point]
WHERE
    [Point].[Id] = @Id
GO
/****** Object:  StoredProcedure [dbo].[PointGetByStep]    Script Date: 04/05/2011 20:21:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[PointGetByStep]
    @Step uniqueidentifier
AS
SELECT
    [Point].[Id],
    [Point].[X],
    [Point].[Y],
    [Point].[Z]
FROM
    [Point]
WHERE
    [Point].[Step] = @Step
GO
/****** Object:  StoredProcedure [dbo].[PointGetAll]    Script Date: 04/05/2011 20:21:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[PointGetAll]
AS
SELECT
    [Point].[Id],
    [Point].[X],
    [Point].[Y],
    [Point].[Z],
    [PointStep].[Id],
    [PointStep].[Description],
    [PointStepLine].[Id],
    [PointStepLine].[Material],
    [PointStepLineKnot].[Id],
    [PointStepLineKnot].[Name],
    [PointStepLineKnot].[Description]
FROM
    [Point]
    JOIN [Step] AS [PointStep] ON [Point].[Step] = [PointStep].[Id]
    JOIN [Line] AS [PointStepLine] ON [PointStep].[Line] = [PointStepLine].[Id]
    JOIN [Knot] AS [PointStepLineKnot] ON [PointStepLine].[Knot] = [PointStepLineKnot].[Id]
GO
/****** Object:  StoredProcedure [dbo].[PointGet]    Script Date: 04/05/2011 20:21:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[PointGet]
    @Id uniqueidentifier
AS
SELECT
    [Point].[Id],
    [Point].[X],
    [Point].[Y],
    [Point].[Z],
    [PointStep].[Id],
    [PointStep].[Description],
    [PointStepLine].[Id],
    [PointStepLine].[Material],
    [PointStepLineKnot].[Id],
    [PointStepLineKnot].[Name],
    [PointStepLineKnot].[Description]
FROM
    [Point]
    JOIN [Step] AS [PointStep] ON [Point].[Step] = [PointStep].[Id]
    JOIN [Line] AS [PointStepLine] ON [PointStep].[Line] = [PointStepLine].[Id]
    JOIN [Knot] AS [PointStepLineKnot] ON [PointStepLine].[Knot] = [PointStepLineKnot].[Id]
WHERE
    [Point].[Id] = @Id
GO
/****** Object:  StoredProcedure [dbo].[PointAdd]    Script Date: 04/05/2011 20:21:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[PointAdd]
    @Id uniqueidentifier,
    @X real,
    @Y real,
    @Z real,
    @Step uniqueidentifier
AS
INSERT
    [Point]
VALUES (
    @Id,
    @X,
    @Y,
    @Z,
    @Step
)
GO
/****** Object:  ForeignKey [FK_Fixture_Knot]    Script Date: 04/05/2011 20:21:12 ******/
ALTER TABLE [dbo].[Fixture]  WITH CHECK ADD  CONSTRAINT [FK_Fixture_Knot] FOREIGN KEY([Knot])
REFERENCES [dbo].[Knot] ([Id])
GO
ALTER TABLE [dbo].[Fixture] CHECK CONSTRAINT [FK_Fixture_Knot]
GO
/****** Object:  ForeignKey [FK_Line_Knot]    Script Date: 04/05/2011 20:21:12 ******/
ALTER TABLE [dbo].[Line]  WITH CHECK ADD  CONSTRAINT [FK_Line_Knot] FOREIGN KEY([Knot])
REFERENCES [dbo].[Knot] ([Id])
GO
ALTER TABLE [dbo].[Line] CHECK CONSTRAINT [FK_Line_Knot]
GO
/****** Object:  ForeignKey [FK_Step_Line]    Script Date: 04/05/2011 20:21:13 ******/
ALTER TABLE [dbo].[Step]  WITH CHECK ADD  CONSTRAINT [FK_Step_Line] FOREIGN KEY([Line])
REFERENCES [dbo].[Line] ([Id])
GO
ALTER TABLE [dbo].[Step] CHECK CONSTRAINT [FK_Step_Line]
GO
/****** Object:  ForeignKey [FK_Point_Step]    Script Date: 04/05/2011 20:21:13 ******/
ALTER TABLE [dbo].[Point]  WITH CHECK ADD  CONSTRAINT [FK_Point_Step] FOREIGN KEY([Step])
REFERENCES [dbo].[Step] ([Id])
GO
ALTER TABLE [dbo].[Point] CHECK CONSTRAINT [FK_Point_Step]
GO

Interface Manual

The Model has 7 important signatures: 4 member functions and 3 static functions of KnotModel class.
public KnotModel(): Initializes the knot model.
public void Add(): Add the knot instance into database.
public void Update(): Update the knot instance into database.
public void Save(string filename): Saves the knot into XML file.
public static List<KnotModel> GetAll(): Gets the all knot list from database.
public static KnotModel GetById(Guid id): Gets the knot by specified ID from database.
public static KnotModel Load(string filename): Loads knot form XML file.
Most people confuse different between Entity and Model, anybody knows different between memory and storage? that it! they design in different purpose. Entity use to persistent with database, however, Model use to represent business unit. One is storage oriented, another is business oriented.
One knot contains a lot of objects and lines(?), one line contains a lot of step and one step contain a lot of point. That logic is make sense, but Entity is not, isn't it.

Entity package

This is the final design of Entity, I and Jun decided to remove some useless function such as user as well as comment. Consequently, there are only 5 classes left, which are persistent 5 table in database.
Knot represent the knot entries in database, Fixture represent the objects such as tree, hook or loop for specified knot. Line represent the strings for specified knot, one knot has one, may be two(or more?) strings. Step represent the status or snapshot for particular string, the core functionality is show the steps of knot. Point store the sequence of point for particular step of line.

Architecture

Our system use EMVC architecture. Different between form MVC, I add a entity package which use to president with database table and data access. It is the common way to expend database stuff into MVC architecture.
Unfortunately, the code in final version do not really separate the Controller with View, which lose the testability of user interface(in MVC's purpose, Controller is testable), but anyway, Model is separated, so Model is testable and the unit test is finish.

Thursday, October 21, 2010

Data Access Prototype Description

Hexsoft.Knots.DataAccess.PointData
Represent the point data access.
Methods:
  • Add(System.Guid,System.Int32,System.Int32,System.Int32,System.Int32)
    Add the point.
    Parameters:
    • id: The id of the point.
    • line: The line of the point.
    • x: The x of the point.
    • y: The y of the point.
    • z: The z of the point.
  • Set(System.Guid,System.Int32,System.Int32,System.Int32,System.Int32)
    Set the point.
    Parameters:
    • id: The id of the point.
    • line: The line of the point.
    • x: The x of the point.
    • y: The y of the point.
    • z: The z of the point.
  • Remove(System.Guid)
    Remove the point.
    Parameters:
    • id: The id of the point.
  • GetById(System.Guid)
    Get the point by id.
    Parameters:
    • id: The id of the point.
    Returns:
    • The point entity.
  • GetAll()
    Get all the points.
    Returns:
    • The Point entities.
Hexsoft.Knots.DataAccess.UserData
Represent the user data access.
Methods:
  • Add(System.Guid,System.String,System.String,System.String)
    Add the user.
    Parameters:
    • id: The id of the user.
    • name: The name of the user.
    • email: The email of the user.
    • password: The password of the user.
  • Set(System.Guid,System.String,System.String,System.String)
    Set the user.
    Parameters:
    • id: The id of the user.
    • name: The name of the user.
    • email: The email of the user.
    • password: The password of the user.
  • Remove(System.Guid)
    Remove the user.
    Parameters:
    • id: The id of the user.
  • GetById(System.Guid)
    Get the user by id.
    Parameters:
    • id: The id of the user.
    Returns:
    • The user entity.
  • GetAll()
    Get all the users.
    Returns:
    • The User entities.
Hexsoft.Knots.DataAccess.StepData
Represent the step data access.
Methods:
  • Add(System.Guid,System.String,System.String,System.Guid)
    Add the step.
    Parameters:
    • id: The id of the step.
    • type: The type of the step.
    • description: The description of the step.
    • knot: The knot of the step.
  • Set(System.Guid,System.String,System.String,System.Guid)
    Set the step.
    Parameters:
    • id: The id of the step.
    • type: The type of the step.
    • description: The description of the step.
    • knot: The knot of the step.
  • Remove(System.Guid)
    Remove the step.
    Parameters:
    • id: The id of the step.
  • RemoveByKnot(System.Guid)
    Remove the step by knot.
    Parameters:
    • knot: The knot of the step.
  • GetById(System.Guid)
    Get the step by id.
    Parameters:
    • id: The id of the step.
    Returns:
    • The step entity.
  • GetAll()
    Get all the steps.
    Returns:
    • The Step entities.
  • GetByKnot(System.Guid)
    Get the steps by knot.
    Parameters:
    • knot: The knot of the step.
    Returns:
    • The step entities.
Hexsoft.Knots.DataAccess.KnotData
Represent the knot data access.
Methods:
  • Add(System.Guid,System.String,System.String,System.Guid)
    Add the knot.
    Parameters:
    • id: The id of the knot.
    • name: The name of the knot.
    • description: The description of the knot.
    • user: The user of the knot.
  • Set(System.Guid,System.String,System.String,System.Guid)
    Set the knot.
    Parameters:
    • id: The id of the knot.
    • name: The name of the knot.
    • description: The description of the knot.
    • user: The user of the knot.
  • Remove(System.Guid)
    Remove the knot.
    Parameters:
    • id: The id of the knot.
  • RemoveByUser(System.Guid)
    Remove the knot by user.
    Parameters:
    • user: The user of the knot.
  • GetById(System.Guid)
    Get the knot by id.
    Parameters:
    • id: The id of the knot.
    Returns:
    • The knot entity.
  • GetAll()
    Get all the knots.
    Returns:
    • The Knot entities.
  • GetByUser(System.Guid)
    Get the knots by user.
    Parameters:
    • user: The user of the knot.
    Returns:
    • The knot entities.
Hexsoft.Knots.DataAccess.ClassificationData
Represent the classification data access.
Methods:
  • Add(System.Guid,System.Guid)
    Add the classification.
    Parameters:
    • knot: The knot of the classification.
    • category: The category of the classification.
  • Remove(System.Guid,System.Guid)
    Remove the classification.
    Parameters:
    • knot: The knot of the classification.
    • category: The category of the classification.
  • RemoveByKnot(System.Guid)
    Remove the classification by knot.
    Parameters:
    • knot: The knot of the classification.
  • RemoveByCategory(System.Guid)
    Remove the classification by category.
    Parameters:
    • category: The category of the classification.
  • GetAll()
    Get all the classifications.
    Returns:
    • The Classification entities.
  • GetByKnot(System.Guid)
    Get the classifications by knot.
    Parameters:
    • knot: The knot of the classification.
    Returns:
    • The classification entities.
  • GetByCategory(System.Guid)
    Get the classifications by category.
    Parameters:
    • category: The category of the classification.
    Returns:
    • The classification entities.
Hexsoft.Knots.DataAccess.LineData
Represent the line data access.
Methods:
  • Add(System.Guid,System.Guid,System.Int32)
    Add the line.
    Parameters:
    • id: The id of the object.
    • knot: The knot of the object.
    • material: The material of the line.
  • Set(System.Guid,System.Guid,System.Int32)
    Set the line.
    Parameters:
    • id: The id of the object.
    • knot: The knot of the object.
    • material: The material of the line.
  • Remove(System.Guid)
    Remove the line.
    Parameters:
    • id: The id of the line.
  • RemoveByKnot(System.Guid)
    Remove the line by knot.
    Parameters:
    • knot: The knot of the line.
  • GetById(System.Guid)
    Get the line by id.
    Parameters:
    • id: The id of the line.
    Returns:
    • The line entity.
  • GetAll()
    Get all the lines.
    Returns:
    • The Line entities.
  • GetByKnot(System.Guid)
    Get the lines by knot.
    Parameters:
    • knot: The knot of the line.
    Returns:
    • The line entities.
Hexsoft.Knots.DataAccess.CategoryData
Represent the category data access.
Methods:
  • Add(System.Guid,System.String)
    Add the category.
    Parameters:
    • id: The id of the category.
    • name: The name of the category.
  • Set(System.Guid,System.String)
    Set the category.
    Parameters:
    • id: The id of the category.
    • name: The name of the category.
  • Remove(System.Guid)
    Remove the category.
    Parameters:
    • id: The id of the category.
  • GetById(System.Guid)
    Get the category by id.
    Parameters:
    • id: The id of the category.
    Returns:
    • The category entity.
  • GetAll()
    Get all the categorys.
    Returns:
    • The Category entities.
Hexsoft.Knots.DataAccess.FixtureData
Represent the fixture data access.
Methods:
  • Add(System.Guid,System.Guid,System.Int32)
    Add the fixture.
    Parameters:
    • id: The id of the object.
    • knot: The knot of the object.
    • number: The number of the fixture.
  • Set(System.Guid,System.Guid,System.Int32)
    Set the fixture.
    Parameters:
    • id: The id of the object.
    • knot: The knot of the object.
    • number: The number of the fixture.
  • Remove(System.Guid)
    Remove the fixture.
    Parameters:
    • id: The id of the fixture.
  • RemoveByKnot(System.Guid)
    Remove the fixture by knot.
    Parameters:
    • knot: The knot of the fixture.
  • GetById(System.Guid)
    Get the fixture by id.
    Parameters:
    • id: The id of the fixture.
    Returns:
    • The fixture entity.
  • GetAll()
    Get all the fixtures.
    Returns:
    • The Fixture entities.
  • GetByKnot(System.Guid)
    Get the fixtures by knot.
    Parameters:
    • knot: The knot of the fixture.
    Returns:
    • The fixture entities.
Hexsoft.Knots.DataAccess.ObjectData
Represent the object data access.
Methods:
  • Add(System.Guid,System.Guid)
    Add the object.
    Parameters:
    • id: The id of the object.
    • knot: The knot of the object.
  • Set(System.Guid,System.Guid)
    Set the object.
    Parameters:
    • id: The id of the object.
    • knot: The knot of the object.
  • Remove(System.Guid)
    Remove the object.
    Parameters:
    • id: The id of the object.
  • RemoveByKnot(System.Guid)
    Remove the object by knot.
    Parameters:
    • knot: The knot of the object.
  • GetById(System.Guid)
    Get the object by id.
    Parameters:
    • id: The id of the object.
    Returns:
    • The object entity.
  • GetAll()
    Get all the objects.
    Returns:
    • The Object entities.
  • GetByKnot(System.Guid)
    Get the objects by knot.
    Parameters:
    • knot: The knot of the object.
    Returns:
    • The object entities.

Entity Prototype Description

Hexsoft.Knots.Entity.Object
Represent the object entity.
Properties:
  • Id
    Get or set the id of the object.
  • Knot
    Get or set the knot of the object.
Methods:
  • #ctor(System.Guid,Hexsoft.Knots.Entity.Knot)
    Initialize the object entity.
    Parameters:
    • id: The id of the object.
    • knot: The knot of the object.
Hexsoft.Knots.Entity.User
Represent the user entity.
Properties:
  • Id
    Get or set the id of the user.
  • Name
    Get or set the name of the user.
  • Email
    Get or set the email of the user.
  • Password
    Get or set the password of the user.
Methods:
  • #ctor(System.Guid,System.String,System.String,System.String)
    Initialize the user entity.
    Parameters:
    • id: The id of the user.
    • name: The name of the user.
    • email: The email of the user.
    • password: The password of the user.
Hexsoft.Knots.Entity.Step
Represent the step entity.
Properties:
  • Id
    Get or set the id of the step.
  • Type
    Get or set the type of the step.
  • Description
    Get or set the description of the step.
  • Knot
    Get or set the knot of the step.
Methods:
  • #ctor(System.Guid,System.String,System.String,Hexsoft.Knots.Entity.Knot)
    Initialize the step entity.
    Parameters:
    • id: The id of the step.
    • type: The type of the step.
    • description: The description of the step.
    • knot: The knot of the step.
Hexsoft.Knots.Entity.Category
Represent the category entity.
Properties:
  • Id
    Get or set the id of the category.
  • Name
    Get or set the name of the category.
Methods:
  • #ctor(System.Guid,System.String)
    Initialize the category entity.
    Parameters:
    • id: The id of the category.
    • name: The name of the category.
Hexsoft.Knots.Entity.Knot
Represent the knot entity.
Properties:
  • Id
    Get or set the id of the knot.
  • Name
    Get or set the name of the knot.
  • Description
    Get or set the description of the knot.
  • User
    Get or set the user of the knot.
Methods:
  • #ctor(System.Guid,System.String,System.String,Hexsoft.Knots.Entity.User)
    Initialize the knot entity.
    Parameters:
    • id: The id of the knot.
    • name: The name of the knot.
    • description: The description of the knot.
    • user: The user of the knot.
Hexsoft.Knots.Entity.Fixture
Represent the fixture entity.
Properties:
  • Number
    Get or set the number of the fixture.
Methods:
  • #ctor(System.Guid,Hexsoft.Knots.Entity.Knot,System.Int32)
    Initialize the fixture entity.
    Parameters:
    • id: The id of the object.
    • knot: The knot of the object.
    • number: The number of the fixture.
Hexsoft.Knots.Entity.Line
Represent the line entity.
Properties:
  • Material
    Get or set the material of the line.
Methods:
  • #ctor(System.Guid,Hexsoft.Knots.Entity.Knot,System.Int32)
    Initialize the line entity.
    Parameters:
    • id: The id of the object.
    • knot: The knot of the object.
    • material: The material of the line.
Hexsoft.Knots.Entity.Point
Represent the point entity.
Properties:
  • Id
    Get or set the id of the point.
  • Line
    Get or set the line of the point.
  • X
    Get or set the x of the point.
  • Y
    Get or set the y of the point.
  • Z
    Get or set the z of the point.
Methods:
  • #ctor(System.Guid,System.Int32,System.Int32,System.Int32,System.Int32)
    Initialize the point entity.
    Parameters:
    • id: The id of the point.
    • line: The line of the point.
    • x: The x of the point.
    • y: The y of the point.
    • z: The z of the point.
Hexsoft.Knots.Entity.Classification
Represent the classification entity.
Properties:
  • Knot
    Get or set the knot of the classification.
  • Category
    Get or set the category of the classification.
Methods:
  • #ctor(Hexsoft.Knots.Entity.Knot,Hexsoft.Knots.Entity.Category)
    Initialize the classification entity.
    Parameters:
    • knot: The knot of the classification.
    • category: The category of the classification.

General User Case

Editor User Case

Entity Definition Persisent with ER Diagram

Business Logic Prototypes

ER Diagram

Deploy Layout - 3 Phyiscal Tier

Atchitecture Released

3-Tier Architecture

Three-Tier is a client–server architecture in which the user interface, functional process logic, computer data storage and data access are developed and maintained as independent modules, most often on separate platforms. It was developed by John J. Donovan in Open Environment Corporation, a tools company he founded in Cambridge, MA.
The three-tier model is software architecture and a software design pattern.
Apart from the usual advantages of modular software with well-defined interfaces, the three-tier architecture is intended to allow any of the three tiers to be upgraded or replaced independently as requirements or technology change. For example, a change of operating system in the presentation tier would only affect the user interface code.
Typically, the user interface runs on a desktop PC or workstation and uses a standard graphical user interface, functional process logic may consist of one or more separate modules running on a workstation or application server, and an RDBMS on a database server or mainframe contains the computer data storage logic. The middle tier may be multi-tiered itself.

Data Access Tier

This tier consists of database servers. Here information is stored and retrieved. This tier keeps data neutral and independent from application servers or business logic. Giving data its own tier also improves scalability and performance.

Business Logic Tier

The business logic tier is pulled out from the presentation tier and, as its own tier, it controls an application’s functionality by performing detailed processing.

User Interface Tier

This is the topmost level of the application. The user interface tier displays information related to such services as browsing merchandise, purchasing, and shopping cart contents. It communicates with other tiers by outputting results to the browser/client tier and all other tiers in the network.

MVC Architecture

Model–View–Controller is a software architecture, currently considered an architectural pattern used in software engineering. The pattern isolates "domain logic" from input and presentation, permitting independent development, testing and maintenance of each.

Model

The model is used to manage information and notify observers when that information changes. The model is the domain-specific representation of the data upon which the application operates. Domain logic adds meaning to raw data. When a model changes its state, it notifies its associated views so they can be refreshed.

View

The view renders the model into a form suitable for interaction, typically a user interface element. Multiple views can exist for a single model for different purposes. A viewport typically has a one to one correspondence with a display surface and knows how to render to it.

Controller

The controller receives input and initiates a response by making calls on model objects. A controller accepts input from the user and instructs the model and viewport to perform actions based on that input.

Client Server Architecture

The client–server model of computing is a distributed application structure that partitions tasks or workloads between the providers of a resource or service, called servers, and service requesters, called clients. Often clients and servers communicate over a computer network on separate hardware, but both client and server may reside in the same system. A server machine is a host that is running one or more server programs which share their resources with clients. A client does not share any of its resources, but requests a server's content or service function. Clients therefore initiate communication sessions with servers which await incoming requests.

Database Server

A database server is a computer program that provides database services to other computer programs or computers, as defined by the client–server model. The term may also refer to a computer dedicated to running such a program. Database management systems frequently provide database server functionality, and some DBMSs rely exclusively on the client–server model for database access.

Application Server

An application server is a software framework dedicated to the efficient execution of procedures for supporting the construction of applications. The term was originally used when discussing early client–server systems and servers that run SQL services and middleware servers to differentiate them from file servers.

Client

A client is an application or system that accesses a remote service on another computer system, known as a server, by way of a network. The term was first applied to devices that were not capable of running their own stand-alone programs, but could interact with remote computers via a network. These dumb terminals were clients of the time-sharing mainframe computer.

Monday, August 30, 2010

Base on the discuses of the meeting in Friday, I update the entity modeling which Tim already post once before. Thanks.
This is Draft version of use case, I hope everyone could helps to add basic functionality to it, it will helps us to finish the user manual, Thanks.