CREATE PROCEDURE [dbo].[procInsertWebSite]
	@Type int,
	@Time varchar(30),
	@ComputerId varchar(128),
	@SiteAddr varchar(255),
	@IeId int,
	@AllTime float,
	@ActiveSeconds int
AS
	INSERT INTO tblSite (Operator, OppTime, ComputerId, Address, ieid)
		VALUES(@Type, CONVERT(datetime, @Time), @ComputerId, @SiteAddr, @IeId)

	If @Type = 3
		INSERT INTO tblEvent (OppTime, ComputerId, Type, Operator, Description)
			VALUES(CONVERT(datetime, @Time, 120), @ComputerId, 3, 1, @SiteAddr)
	Else
		Begin
			INSERT INTO tblNetStat (ComputerId, IeId, AssocId, StartTime, EndTime, ActiveSecond, Status, SiteAddr)
				VALUES(@ComputerId, @IeId, 0, CONVERT(DATETIME, @Time, 120) - @AllTime, CONVERT(DATETIME, @Time, 120), @ActiveSeconds, 1, @SiteAddr)
	
			INSERT INTO tblEvent (OppTime, ComputerId, Type, Operator, Description)
				VALUES(CONVERT(datetime, @Time, 120), @ComputerId, 3, 2, @SiteAddr)
		End
GO
