Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Oppdatert databse

  • Loading branch information...
commit 0fc63be0133bc4756056886a5210f9e14c98b806 1 parent 3d1e0e2
Unknown authored
View
38 JoMAR/DataClasses1.dbml
@@ -1,19 +1,45 @@
<?xml version="1.0" encoding="utf-8"?><Database Name="gruppe2_h11" Class="DataClasses1DataContext" xmlns="http://schemas.microsoft.com/linqtosql/dbml/2007">
- <Connection Mode="WebSettings" ConnectionString="Data Source=malmen.hin.no;Initial Catalog=gruppe2_h11;User ID=gruppe2" SettingsObjectName="System.Configuration.ConfigurationManager.ConnectionStrings" SettingsPropertyName="gruppe2_h11ConnectionString" Provider="System.Data.SqlClient" />
+ <Connection Mode="WebSettings" ConnectionString="Data Source=malmen.hin.no;Initial Catalog=gruppe2_h11;User ID=gruppe2" SettingsObjectName="System.Configuration.ConfigurationManager.ConnectionStrings" SettingsPropertyName="gruppe2_h11ConnectionString1" Provider="System.Data.SqlClient" />
+ <Table Name="dbo.UserRooms" Member="UserRooms">
+ <Type Name="UserRoom">
+ <Column Name="userID" Type="System.Int32" DbType="Int NOT NULL" IsPrimaryKey="true" CanBeNull="false" />
+ <Column Name="roomID" Type="System.Int32" DbType="Int NOT NULL" CanBeNull="false" />
+ <Association Name="User_UserRoom" Member="User" ThisKey="userID" OtherKey="UserID" Type="User" IsForeignKey="true" />
+ <Association Name="ChatRoom_UserRoom" Member="ChatRoom" ThisKey="roomID" OtherKey="RoomID" Type="ChatRoom" IsForeignKey="true" />
+ </Type>
+ </Table>
+ <Table Name="dbo.ChatMessages" Member="ChatMessages">
+ <Type Name="ChatMessage">
+ <Column Name="messageID" Type="System.Int32" DbType="Int NOT NULL" IsPrimaryKey="true" CanBeNull="false" />
+ <Column Name="Date" Type="System.DateTime" DbType="DateTime NOT NULL" CanBeNull="false" />
+ <Column Name="Text" Type="System.String" DbType="NVarChar(50) NOT NULL" CanBeNull="false" />
+ <Column Name="userID" Type="System.Int32" DbType="Int NOT NULL" CanBeNull="false" />
+ <Column Name="chatRoomID" Type="System.Int32" DbType="Int NOT NULL" CanBeNull="false" />
+ <Association Name="User_ChatMessage" Member="User" ThisKey="userID" OtherKey="UserID" Type="User" IsForeignKey="true" />
+ <Association Name="ChatRoom_ChatMessage" Member="ChatRoom" ThisKey="chatRoomID" OtherKey="RoomID" Type="ChatRoom" IsForeignKey="true" />
+ </Type>
+ </Table>
<Table Name="dbo.Users" Member="Users">
<Type Name="User">
- <Column Name="Id" Type="System.Int32" DbType="Int NOT NULL IDENTITY" IsPrimaryKey="true" IsDbGenerated="true" CanBeNull="false" />
+ <Column Name="UserID" Type="System.Int32" DbType="Int NOT NULL IDENTITY" IsPrimaryKey="true" IsDbGenerated="true" CanBeNull="false" />
<Column Name="Nick" Type="System.String" DbType="VarChar(15) NOT NULL" CanBeNull="false" />
<Column Name="Email" Type="System.String" DbType="VarChar(255)" CanBeNull="true" />
<Column Name="Password" Type="System.String" DbType="VarChar(255) NOT NULL" CanBeNull="false" />
- <Association Name="User_ChatRoom" Member="ChatRooms" ThisKey="Id" OtherKey="UserId" Type="ChatRoom" />
+ <Association Name="User_UserRoom" Member="UserRooms" ThisKey="UserID" OtherKey="userID" Type="UserRoom" Cardinality="One" />
+ <Association Name="User_ChatMessage" Member="ChatMessages" ThisKey="UserID" OtherKey="userID" Type="ChatMessage" />
+ <Association Name="User_ChatRoom" Member="ChatRooms" ThisKey="UserID" OtherKey="UserID" Type="ChatRoom" />
</Type>
</Table>
<Table Name="dbo.ChatRooms" Member="ChatRooms">
<Type Name="ChatRoom">
- <Column Name="Id" Type="System.Int32" DbType="Int NOT NULL" IsPrimaryKey="true" CanBeNull="false" />
- <Column Name="UserId" Type="System.Int32" DbType="Int" CanBeNull="true" />
- <Association Name="User_ChatRoom" Member="User" ThisKey="UserId" OtherKey="Id" Type="User" IsForeignKey="true" />
+ <Column Name="RoomID" Type="System.Int32" DbType="Int NOT NULL" IsPrimaryKey="true" CanBeNull="false" />
+ <Column Name="UserID" Type="System.Int32" DbType="Int" CanBeNull="true" />
+ <Column Name="Name" Type="System.String" DbType="NVarChar(50) NOT NULL" CanBeNull="false" />
+ <Column Name="isPublic" Type="System.Boolean" DbType="Bit NOT NULL" CanBeNull="false" />
+ <Column Name="isPrivate" Type="System.Boolean" DbType="Bit NOT NULL" CanBeNull="false" />
+ <Association Name="ChatRoom_ChatMessage" Member="ChatMessages" ThisKey="RoomID" OtherKey="chatRoomID" Type="ChatMessage" />
+ <Association Name="ChatRoom_UserRoom" Member="UserRooms" ThisKey="RoomID" OtherKey="roomID" Type="UserRoom" />
+ <Association Name="User_ChatRoom" Member="User" ThisKey="UserID" OtherKey="UserID" Type="User" IsForeignKey="true" />
</Type>
</Table>
</Database>
View
54 JoMAR/DataClasses1.dbml.layout
@@ -2,23 +2,63 @@
<ordesignerObjectsDiagram dslVersion="1.0.0.0" absoluteBounds="0, 0, 11, 8.5" name="DataClasses1">
<DataContextMoniker Name="/DataClasses1DataContext" />
<nestedChildShapes>
- <classShape Id="58185681-34ac-4c87-838f-f50b12140013" absoluteBounds="0.5, 0.5, 2, 1.5785953776041666">
+ <classShape Id="eb2ab765-b058-4f92-b610-422cbe640ede" absoluteBounds="0.5, 3.125, 2, 1.1939925130208333">
+ <DataClassMoniker Name="/DataClasses1DataContext/UserRoom" />
+ <nestedChildShapes>
+ <elementListCompartment Id="127073c9-b915-4cca-9974-b611e6c2d05a" absoluteBounds="0.51500000000000057, 3.585, 1.9700000000000002, 0.63399251302083326" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
+ </nestedChildShapes>
+ </classShape>
+ <classShape Id="48f3bcbd-c610-42d1-8223-d5d3fb16c126" absoluteBounds="4.125, 0.5, 2, 1.7708968098958331">
+ <DataClassMoniker Name="/DataClasses1DataContext/ChatMessage" />
+ <nestedChildShapes>
+ <elementListCompartment Id="3cd167df-137d-49d8-9850-23601c483baf" absoluteBounds="4.1400000000000006, 0.96, 1.9700000000000002, 1.2108968098958333" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
+ </nestedChildShapes>
+ </classShape>
+ <classShape Id="faf72b08-7f14-492c-a818-f3a1b6156580" absoluteBounds="1, 0.5, 2, 1.5785953776041666">
<DataClassMoniker Name="/DataClasses1DataContext/User" />
<nestedChildShapes>
- <elementListCompartment Id="ba963580-128c-482d-97ac-2899d3eb6f4b" absoluteBounds="0.515, 0.96, 1.9700000000000002, 1.0185953776041665" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
+ <elementListCompartment Id="3fd5e02e-8b04-47be-b805-97fec7ff4673" absoluteBounds="1.0150000000000006, 0.96, 1.9700000000000002, 1.0185953776041665" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
</nestedChildShapes>
</classShape>
- <classShape Id="77e658d4-73e3-4b6f-a08b-7007e95912d6" absoluteBounds="3, 0.5, 2, 1.1939925130208333">
+ <classShape Id="a2f065bc-f4b7-4ef5-b8fd-f951cf576e4d" absoluteBounds="4.5, 3.875, 2, 1.7708968098958331">
<DataClassMoniker Name="/DataClasses1DataContext/ChatRoom" />
<nestedChildShapes>
- <elementListCompartment Id="645f239c-00d9-4f75-a55f-0226e78bc065" absoluteBounds="3.015, 0.96, 1.9700000000000002, 0.63399251302083326" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
+ <elementListCompartment Id="c21336b2-fd2e-4ed3-b761-b785aa4e8f2b" absoluteBounds="4.515, 4.335, 1.9700000000000002, 1.2108968098958333" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
</nestedChildShapes>
</classShape>
- <associationConnector edgePoints="[(2.5 : 1.09699625651042); (3 : 1.09699625651042)]" fixedFrom="Algorithm" fixedTo="Algorithm">
+ <associationConnector edgePoints="[(1.75 : 2.07859537760417); (1.75 : 3.125)]" fixedFrom="Algorithm" fixedTo="Algorithm">
+ <AssociationMoniker Name="/DataClasses1DataContext/User/User_UserRoom" />
+ <nodes>
+ <classShapeMoniker Id="faf72b08-7f14-492c-a818-f3a1b6156580" />
+ <classShapeMoniker Id="eb2ab765-b058-4f92-b610-422cbe640ede" />
+ </nodes>
+ </associationConnector>
+ <associationConnector edgePoints="[(3 : 1.28929768880208); (4.125 : 1.28929768880208)]" fixedFrom="Algorithm" fixedTo="Algorithm">
+ <AssociationMoniker Name="/DataClasses1DataContext/User/User_ChatMessage" />
+ <nodes>
+ <classShapeMoniker Id="faf72b08-7f14-492c-a818-f3a1b6156580" />
+ <classShapeMoniker Id="48f3bcbd-c610-42d1-8223-d5d3fb16c126" />
+ </nodes>
+ </associationConnector>
+ <associationConnector edgePoints="[(5.3125 : 3.875); (5.3125 : 2.27089680989583)]" fixedFrom="Algorithm" fixedTo="Algorithm">
+ <AssociationMoniker Name="/DataClasses1DataContext/ChatRoom/ChatRoom_ChatMessage" />
+ <nodes>
+ <classShapeMoniker Id="a2f065bc-f4b7-4ef5-b8fd-f951cf576e4d" />
+ <classShapeMoniker Id="48f3bcbd-c610-42d1-8223-d5d3fb16c126" />
+ </nodes>
+ </associationConnector>
+ <associationConnector edgePoints="[(3 : 2.07859537760417); (3 : 4.22708605375744); (4.5 : 4.22708605375744)]" manuallyRouted="true" fixedFrom="Algorithm" fixedTo="Caller">
<AssociationMoniker Name="/DataClasses1DataContext/User/User_ChatRoom" />
<nodes>
- <classShapeMoniker Id="58185681-34ac-4c87-838f-f50b12140013" />
- <classShapeMoniker Id="77e658d4-73e3-4b6f-a08b-7007e95912d6" />
+ <classShapeMoniker Id="faf72b08-7f14-492c-a818-f3a1b6156580" />
+ <classShapeMoniker Id="a2f065bc-f4b7-4ef5-b8fd-f951cf576e4d" />
+ </nodes>
+ </associationConnector>
+ <associationConnector edgePoints="[(4.5 : 4.98244516145833); (1.53572465152846 : 4.98244516145833); (1.53572465152846 : 4.31899251302083)]" fixedFrom="Algorithm" fixedTo="Caller">
+ <AssociationMoniker Name="/DataClasses1DataContext/ChatRoom/ChatRoom_UserRoom" />
+ <nodes>
+ <classShapeMoniker Id="a2f065bc-f4b7-4ef5-b8fd-f951cf576e4d" />
+ <classShapeMoniker Id="eb2ab765-b058-4f92-b610-422cbe640ede" />
</nodes>
</associationConnector>
</nestedChildShapes>
View
694 JoMAR/DataClasses1.designer.cs
@@ -30,6 +30,12 @@ public partial class DataClasses1DataContext : System.Data.Linq.DataContext
#region Extensibility Method Definitions
partial void OnCreated();
+ partial void InsertUserRoom(UserRoom instance);
+ partial void UpdateUserRoom(UserRoom instance);
+ partial void DeleteUserRoom(UserRoom instance);
+ partial void InsertChatMessage(ChatMessage instance);
+ partial void UpdateChatMessage(ChatMessage instance);
+ partial void DeleteChatMessage(ChatMessage instance);
partial void InsertUser(User instance);
partial void UpdateUser(User instance);
partial void DeleteUser(User instance);
@@ -39,7 +45,7 @@ public partial class DataClasses1DataContext : System.Data.Linq.DataContext
#endregion
public DataClasses1DataContext() :
- base(global::System.Configuration.ConfigurationManager.ConnectionStrings["gruppe2_h11ConnectionString"].ConnectionString, mappingSource)
+ base(global::System.Configuration.ConfigurationManager.ConnectionStrings["gruppe2_h11ConnectionString1"].ConnectionString, mappingSource)
{
OnCreated();
}
@@ -68,6 +74,22 @@ public partial class DataClasses1DataContext : System.Data.Linq.DataContext
OnCreated();
}
+ public System.Data.Linq.Table<UserRoom> UserRooms
+ {
+ get
+ {
+ return this.GetTable<UserRoom>();
+ }
+ }
+
+ public System.Data.Linq.Table<ChatMessage> ChatMessages
+ {
+ get
+ {
+ return this.GetTable<ChatMessage>();
+ }
+ }
+
public System.Data.Linq.Table<User> Users
{
get
@@ -85,13 +107,421 @@ public System.Data.Linq.Table<ChatRoom> ChatRooms
}
}
+ [global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.UserRooms")]
+ public partial class UserRoom : INotifyPropertyChanging, INotifyPropertyChanged
+ {
+
+ private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
+
+ private int _userID;
+
+ private int _roomID;
+
+ private EntityRef<User> _User;
+
+ private EntityRef<ChatRoom> _ChatRoom;
+
+ #region Extensibility Method Definitions
+ partial void OnLoaded();
+ partial void OnValidate(System.Data.Linq.ChangeAction action);
+ partial void OnCreated();
+ partial void OnuserIDChanging(int value);
+ partial void OnuserIDChanged();
+ partial void OnroomIDChanging(int value);
+ partial void OnroomIDChanged();
+ #endregion
+
+ public UserRoom()
+ {
+ this._User = default(EntityRef<User>);
+ this._ChatRoom = default(EntityRef<ChatRoom>);
+ OnCreated();
+ }
+
+ [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_userID", DbType="Int NOT NULL", IsPrimaryKey=true)]
+ public int userID
+ {
+ get
+ {
+ return this._userID;
+ }
+ set
+ {
+ if ((this._userID != value))
+ {
+ if (this._User.HasLoadedOrAssignedValue)
+ {
+ throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException();
+ }
+ this.OnuserIDChanging(value);
+ this.SendPropertyChanging();
+ this._userID = value;
+ this.SendPropertyChanged("userID");
+ this.OnuserIDChanged();
+ }
+ }
+ }
+
+ [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_roomID", DbType="Int NOT NULL")]
+ public int roomID
+ {
+ get
+ {
+ return this._roomID;
+ }
+ set
+ {
+ if ((this._roomID != value))
+ {
+ if (this._ChatRoom.HasLoadedOrAssignedValue)
+ {
+ throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException();
+ }
+ this.OnroomIDChanging(value);
+ this.SendPropertyChanging();
+ this._roomID = value;
+ this.SendPropertyChanged("roomID");
+ this.OnroomIDChanged();
+ }
+ }
+ }
+
+ [global::System.Data.Linq.Mapping.AssociationAttribute(Name="User_UserRoom", Storage="_User", ThisKey="userID", OtherKey="UserID", IsForeignKey=true)]
+ public User User
+ {
+ get
+ {
+ return this._User.Entity;
+ }
+ set
+ {
+ User previousValue = this._User.Entity;
+ if (((previousValue != value)
+ || (this._User.HasLoadedOrAssignedValue == false)))
+ {
+ this.SendPropertyChanging();
+ if ((previousValue != null))
+ {
+ this._User.Entity = null;
+ previousValue.UserRooms = null;
+ }
+ this._User.Entity = value;
+ if ((value != null))
+ {
+ value.UserRooms = this;
+ this._userID = value.UserID;
+ }
+ else
+ {
+ this._userID = default(int);
+ }
+ this.SendPropertyChanged("User");
+ }
+ }
+ }
+
+ [global::System.Data.Linq.Mapping.AssociationAttribute(Name="ChatRoom_UserRoom", Storage="_ChatRoom", ThisKey="roomID", OtherKey="RoomID", IsForeignKey=true)]
+ public ChatRoom ChatRoom
+ {
+ get
+ {
+ return this._ChatRoom.Entity;
+ }
+ set
+ {
+ ChatRoom previousValue = this._ChatRoom.Entity;
+ if (((previousValue != value)
+ || (this._ChatRoom.HasLoadedOrAssignedValue == false)))
+ {
+ this.SendPropertyChanging();
+ if ((previousValue != null))
+ {
+ this._ChatRoom.Entity = null;
+ previousValue.UserRooms.Remove(this);
+ }
+ this._ChatRoom.Entity = value;
+ if ((value != null))
+ {
+ value.UserRooms.Add(this);
+ this._roomID = value.RoomID;
+ }
+ else
+ {
+ this._roomID = default(int);
+ }
+ this.SendPropertyChanged("ChatRoom");
+ }
+ }
+ }
+
+ public event PropertyChangingEventHandler PropertyChanging;
+
+ public event PropertyChangedEventHandler PropertyChanged;
+
+ protected virtual void SendPropertyChanging()
+ {
+ if ((this.PropertyChanging != null))
+ {
+ this.PropertyChanging(this, emptyChangingEventArgs);
+ }
+ }
+
+ protected virtual void SendPropertyChanged(String propertyName)
+ {
+ if ((this.PropertyChanged != null))
+ {
+ this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
+ }
+ }
+ }
+
+ [global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.ChatMessages")]
+ public partial class ChatMessage : INotifyPropertyChanging, INotifyPropertyChanged
+ {
+
+ private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
+
+ private int _messageID;
+
+ private System.DateTime _Date;
+
+ private string _Text;
+
+ private int _userID;
+
+ private int _chatRoomID;
+
+ private EntityRef<User> _User;
+
+ private EntityRef<ChatRoom> _ChatRoom;
+
+ #region Extensibility Method Definitions
+ partial void OnLoaded();
+ partial void OnValidate(System.Data.Linq.ChangeAction action);
+ partial void OnCreated();
+ partial void OnmessageIDChanging(int value);
+ partial void OnmessageIDChanged();
+ partial void OnDateChanging(System.DateTime value);
+ partial void OnDateChanged();
+ partial void OnTextChanging(string value);
+ partial void OnTextChanged();
+ partial void OnuserIDChanging(int value);
+ partial void OnuserIDChanged();
+ partial void OnchatRoomIDChanging(int value);
+ partial void OnchatRoomIDChanged();
+ #endregion
+
+ public ChatMessage()
+ {
+ this._User = default(EntityRef<User>);
+ this._ChatRoom = default(EntityRef<ChatRoom>);
+ OnCreated();
+ }
+
+ [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_messageID", DbType="Int NOT NULL", IsPrimaryKey=true)]
+ public int messageID
+ {
+ get
+ {
+ return this._messageID;
+ }
+ set
+ {
+ if ((this._messageID != value))
+ {
+ this.OnmessageIDChanging(value);
+ this.SendPropertyChanging();
+ this._messageID = value;
+ this.SendPropertyChanged("messageID");
+ this.OnmessageIDChanged();
+ }
+ }
+ }
+
+ [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Date", DbType="DateTime NOT NULL")]
+ public System.DateTime Date
+ {
+ get
+ {
+ return this._Date;
+ }
+ set
+ {
+ if ((this._Date != value))
+ {
+ this.OnDateChanging(value);
+ this.SendPropertyChanging();
+ this._Date = value;
+ this.SendPropertyChanged("Date");
+ this.OnDateChanged();
+ }
+ }
+ }
+
+ [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Text", DbType="NVarChar(50) NOT NULL", CanBeNull=false)]
+ public string Text
+ {
+ get
+ {
+ return this._Text;
+ }
+ set
+ {
+ if ((this._Text != value))
+ {
+ this.OnTextChanging(value);
+ this.SendPropertyChanging();
+ this._Text = value;
+ this.SendPropertyChanged("Text");
+ this.OnTextChanged();
+ }
+ }
+ }
+
+ [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_userID", DbType="Int NOT NULL")]
+ public int userID
+ {
+ get
+ {
+ return this._userID;
+ }
+ set
+ {
+ if ((this._userID != value))
+ {
+ if (this._User.HasLoadedOrAssignedValue)
+ {
+ throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException();
+ }
+ this.OnuserIDChanging(value);
+ this.SendPropertyChanging();
+ this._userID = value;
+ this.SendPropertyChanged("userID");
+ this.OnuserIDChanged();
+ }
+ }
+ }
+
+ [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_chatRoomID", DbType="Int NOT NULL")]
+ public int chatRoomID
+ {
+ get
+ {
+ return this._chatRoomID;
+ }
+ set
+ {
+ if ((this._chatRoomID != value))
+ {
+ if (this._ChatRoom.HasLoadedOrAssignedValue)
+ {
+ throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException();
+ }
+ this.OnchatRoomIDChanging(value);
+ this.SendPropertyChanging();
+ this._chatRoomID = value;
+ this.SendPropertyChanged("chatRoomID");
+ this.OnchatRoomIDChanged();
+ }
+ }
+ }
+
+ [global::System.Data.Linq.Mapping.AssociationAttribute(Name="User_ChatMessage", Storage="_User", ThisKey="userID", OtherKey="UserID", IsForeignKey=true)]
+ public User User
+ {
+ get
+ {
+ return this._User.Entity;
+ }
+ set
+ {
+ User previousValue = this._User.Entity;
+ if (((previousValue != value)
+ || (this._User.HasLoadedOrAssignedValue == false)))
+ {
+ this.SendPropertyChanging();
+ if ((previousValue != null))
+ {
+ this._User.Entity = null;
+ previousValue.ChatMessages.Remove(this);
+ }
+ this._User.Entity = value;
+ if ((value != null))
+ {
+ value.ChatMessages.Add(this);
+ this._userID = value.UserID;
+ }
+ else
+ {
+ this._userID = default(int);
+ }
+ this.SendPropertyChanged("User");
+ }
+ }
+ }
+
+ [global::System.Data.Linq.Mapping.AssociationAttribute(Name="ChatRoom_ChatMessage", Storage="_ChatRoom", ThisKey="chatRoomID", OtherKey="RoomID", IsForeignKey=true)]
+ public ChatRoom ChatRoom
+ {
+ get
+ {
+ return this._ChatRoom.Entity;
+ }
+ set
+ {
+ ChatRoom previousValue = this._ChatRoom.Entity;
+ if (((previousValue != value)
+ || (this._ChatRoom.HasLoadedOrAssignedValue == false)))
+ {
+ this.SendPropertyChanging();
+ if ((previousValue != null))
+ {
+ this._ChatRoom.Entity = null;
+ previousValue.ChatMessages.Remove(this);
+ }
+ this._ChatRoom.Entity = value;
+ if ((value != null))
+ {
+ value.ChatMessages.Add(this);
+ this._chatRoomID = value.RoomID;
+ }
+ else
+ {
+ this._chatRoomID = default(int);
+ }
+ this.SendPropertyChanged("ChatRoom");
+ }
+ }
+ }
+
+ public event PropertyChangingEventHandler PropertyChanging;
+
+ public event PropertyChangedEventHandler PropertyChanged;
+
+ protected virtual void SendPropertyChanging()
+ {
+ if ((this.PropertyChanging != null))
+ {
+ this.PropertyChanging(this, emptyChangingEventArgs);
+ }
+ }
+
+ protected virtual void SendPropertyChanged(String propertyName)
+ {
+ if ((this.PropertyChanged != null))
+ {
+ this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
+ }
+ }
+ }
+
[global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.Users")]
public partial class User : INotifyPropertyChanging, INotifyPropertyChanged
{
private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
- private int _Id;
+ private int _UserID;
private string _Nick;
@@ -99,14 +529,18 @@ public partial class User : INotifyPropertyChanging, INotifyPropertyChanged
private string _Password;
+ private EntityRef<UserRoom> _UserRooms;
+
+ private EntitySet<ChatMessage> _ChatMessages;
+
private EntitySet<ChatRoom> _ChatRooms;
#region Extensibility Method Definitions
partial void OnLoaded();
partial void OnValidate(System.Data.Linq.ChangeAction action);
partial void OnCreated();
- partial void OnIdChanging(int value);
- partial void OnIdChanged();
+ partial void OnUserIDChanging(int value);
+ partial void OnUserIDChanged();
partial void OnNickChanging(string value);
partial void OnNickChanged();
partial void OnEmailChanging(string value);
@@ -117,26 +551,28 @@ public partial class User : INotifyPropertyChanging, INotifyPropertyChanged
public User()
{
+ this._UserRooms = default(EntityRef<UserRoom>);
+ this._ChatMessages = new EntitySet<ChatMessage>(new Action<ChatMessage>(this.attach_ChatMessages), new Action<ChatMessage>(this.detach_ChatMessages));
this._ChatRooms = new EntitySet<ChatRoom>(new Action<ChatRoom>(this.attach_ChatRooms), new Action<ChatRoom>(this.detach_ChatRooms));
OnCreated();
}
- [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Id", AutoSync=AutoSync.OnInsert, DbType="Int NOT NULL IDENTITY", IsPrimaryKey=true, IsDbGenerated=true)]
- public int Id
+ [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_UserID", AutoSync=AutoSync.OnInsert, DbType="Int NOT NULL IDENTITY", IsPrimaryKey=true, IsDbGenerated=true)]
+ public int UserID
{
get
{
- return this._Id;
+ return this._UserID;
}
set
{
- if ((this._Id != value))
+ if ((this._UserID != value))
{
- this.OnIdChanging(value);
+ this.OnUserIDChanging(value);
this.SendPropertyChanging();
- this._Id = value;
- this.SendPropertyChanged("Id");
- this.OnIdChanged();
+ this._UserID = value;
+ this.SendPropertyChanged("UserID");
+ this.OnUserIDChanged();
}
}
}
@@ -201,7 +637,49 @@ public string Password
}
}
- [global::System.Data.Linq.Mapping.AssociationAttribute(Name="User_ChatRoom", Storage="_ChatRooms", ThisKey="Id", OtherKey="UserId")]
+ [global::System.Data.Linq.Mapping.AssociationAttribute(Name="User_UserRoom", Storage="_UserRooms", ThisKey="UserID", OtherKey="userID", IsUnique=true, IsForeignKey=false)]
+ public UserRoom UserRooms
+ {
+ get
+ {
+ return this._UserRooms.Entity;
+ }
+ set
+ {
+ UserRoom previousValue = this._UserRooms.Entity;
+ if (((previousValue != value)
+ || (this._UserRooms.HasLoadedOrAssignedValue == false)))
+ {
+ this.SendPropertyChanging();
+ if ((previousValue != null))
+ {
+ this._UserRooms.Entity = null;
+ previousValue.User = null;
+ }
+ this._UserRooms.Entity = value;
+ if ((value != null))
+ {
+ value.User = this;
+ }
+ this.SendPropertyChanged("UserRooms");
+ }
+ }
+ }
+
+ [global::System.Data.Linq.Mapping.AssociationAttribute(Name="User_ChatMessage", Storage="_ChatMessages", ThisKey="UserID", OtherKey="userID")]
+ public EntitySet<ChatMessage> ChatMessages
+ {
+ get
+ {
+ return this._ChatMessages;
+ }
+ set
+ {
+ this._ChatMessages.Assign(value);
+ }
+ }
+
+ [global::System.Data.Linq.Mapping.AssociationAttribute(Name="User_ChatRoom", Storage="_ChatRooms", ThisKey="UserID", OtherKey="UserID")]
public EntitySet<ChatRoom> ChatRooms
{
get
@@ -234,6 +712,18 @@ protected virtual void SendPropertyChanged(String propertyName)
}
}
+ private void attach_ChatMessages(ChatMessage entity)
+ {
+ this.SendPropertyChanging();
+ entity.User = this;
+ }
+
+ private void detach_ChatMessages(ChatMessage entity)
+ {
+ this.SendPropertyChanging();
+ entity.User = null;
+ }
+
private void attach_ChatRooms(ChatRoom entity)
{
this.SendPropertyChanging();
@@ -253,9 +743,19 @@ public partial class ChatRoom : INotifyPropertyChanging, INotifyPropertyChanged
private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
- private int _Id;
+ private int _RoomID;
+
+ private System.Nullable<int> _UserID;
+
+ private string _Name;
+
+ private bool _isPublic;
+
+ private bool _isPrivate;
+
+ private EntitySet<ChatMessage> _ChatMessages;
- private System.Nullable<int> _UserId;
+ private EntitySet<UserRoom> _UserRooms;
private EntityRef<User> _User;
@@ -263,63 +763,157 @@ public partial class ChatRoom : INotifyPropertyChanging, INotifyPropertyChanged
partial void OnLoaded();
partial void OnValidate(System.Data.Linq.ChangeAction action);
partial void OnCreated();
- partial void OnIdChanging(int value);
- partial void OnIdChanged();
- partial void OnUserIdChanging(System.Nullable<int> value);
- partial void OnUserIdChanged();
+ partial void OnRoomIDChanging(int value);
+ partial void OnRoomIDChanged();
+ partial void OnUserIDChanging(System.Nullable<int> value);
+ partial void OnUserIDChanged();
+ partial void OnNameChanging(string value);
+ partial void OnNameChanged();
+ partial void OnisPublicChanging(bool value);
+ partial void OnisPublicChanged();
+ partial void OnisPrivateChanging(bool value);
+ partial void OnisPrivateChanged();
#endregion
public ChatRoom()
{
+ this._ChatMessages = new EntitySet<ChatMessage>(new Action<ChatMessage>(this.attach_ChatMessages), new Action<ChatMessage>(this.detach_ChatMessages));
+ this._UserRooms = new EntitySet<UserRoom>(new Action<UserRoom>(this.attach_UserRooms), new Action<UserRoom>(this.detach_UserRooms));
this._User = default(EntityRef<User>);
OnCreated();
}
- [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Id", DbType="Int NOT NULL", IsPrimaryKey=true)]
- public int Id
+ [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_RoomID", DbType="Int NOT NULL", IsPrimaryKey=true)]
+ public int RoomID
{
get
{
- return this._Id;
+ return this._RoomID;
}
set
{
- if ((this._Id != value))
+ if ((this._RoomID != value))
{
- this.OnIdChanging(value);
+ this.OnRoomIDChanging(value);
this.SendPropertyChanging();
- this._Id = value;
- this.SendPropertyChanged("Id");
- this.OnIdChanged();
+ this._RoomID = value;
+ this.SendPropertyChanged("RoomID");
+ this.OnRoomIDChanged();
}
}
}
- [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_UserId", DbType="Int")]
- public System.Nullable<int> UserId
+ [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_UserID", DbType="Int")]
+ public System.Nullable<int> UserID
{
get
{
- return this._UserId;
+ return this._UserID;
}
set
{
- if ((this._UserId != value))
+ if ((this._UserID != value))
{
if (this._User.HasLoadedOrAssignedValue)
{
throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException();
}
- this.OnUserIdChanging(value);
+ this.OnUserIDChanging(value);
+ this.SendPropertyChanging();
+ this._UserID = value;
+ this.SendPropertyChanged("UserID");
+ this.OnUserIDChanged();
+ }
+ }
+ }
+
+ [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Name", DbType="NVarChar(50) NOT NULL", CanBeNull=false)]
+ public string Name
+ {
+ get
+ {
+ return this._Name;
+ }
+ set
+ {
+ if ((this._Name != value))
+ {
+ this.OnNameChanging(value);
this.SendPropertyChanging();
- this._UserId = value;
- this.SendPropertyChanged("UserId");
- this.OnUserIdChanged();
+ this._Name = value;
+ this.SendPropertyChanged("Name");
+ this.OnNameChanged();
}
}
}
- [global::System.Data.Linq.Mapping.AssociationAttribute(Name="User_ChatRoom", Storage="_User", ThisKey="UserId", OtherKey="Id", IsForeignKey=true)]
+ [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_isPublic", DbType="Bit NOT NULL")]
+ public bool isPublic
+ {
+ get
+ {
+ return this._isPublic;
+ }
+ set
+ {
+ if ((this._isPublic != value))
+ {
+ this.OnisPublicChanging(value);
+ this.SendPropertyChanging();
+ this._isPublic = value;
+ this.SendPropertyChanged("isPublic");
+ this.OnisPublicChanged();
+ }
+ }
+ }
+
+ [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_isPrivate", DbType="Bit NOT NULL")]
+ public bool isPrivate
+ {
+ get
+ {
+ return this._isPrivate;
+ }
+ set
+ {
+ if ((this._isPrivate != value))
+ {
+ this.OnisPrivateChanging(value);
+ this.SendPropertyChanging();
+ this._isPrivate = value;
+ this.SendPropertyChanged("isPrivate");
+ this.OnisPrivateChanged();
+ }
+ }
+ }
+
+ [global::System.Data.Linq.Mapping.AssociationAttribute(Name="ChatRoom_ChatMessage", Storage="_ChatMessages", ThisKey="RoomID", OtherKey="chatRoomID")]
+ public EntitySet<ChatMessage> ChatMessages
+ {
+ get
+ {
+ return this._ChatMessages;
+ }
+ set
+ {
+ this._ChatMessages.Assign(value);
+ }
+ }
+
+ [global::System.Data.Linq.Mapping.AssociationAttribute(Name="ChatRoom_UserRoom", Storage="_UserRooms", ThisKey="RoomID", OtherKey="roomID")]
+ public EntitySet<UserRoom> UserRooms
+ {
+ get
+ {
+ return this._UserRooms;
+ }
+ set
+ {
+ this._UserRooms.Assign(value);
+ }
+ }
+
+ [global::System.Data.Linq.Mapping.AssociationAttribute(Name="User_ChatRoom", Storage="_User", ThisKey="UserID", OtherKey="UserID", IsForeignKey=true)]
public User User
{
get
@@ -342,11 +936,11 @@ public User User
if ((value != null))
{
value.ChatRooms.Add(this);
- this._UserId = value.Id;
+ this._UserID = value.UserID;
}
else
{
- this._UserId = default(Nullable<int>);
+ this._UserID = default(Nullable<int>);
}
this.SendPropertyChanged("User");
}
@@ -372,6 +966,30 @@ protected virtual void SendPropertyChanged(String propertyName)
this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
+
+ private void attach_ChatMessages(ChatMessage entity)
+ {
+ this.SendPropertyChanging();
+ entity.ChatRoom = this;
+ }
+
+ private void detach_ChatMessages(ChatMessage entity)
+ {
+ this.SendPropertyChanging();
+ entity.ChatRoom = null;
+ }
+
+ private void attach_UserRooms(UserRoom entity)
+ {
+ this.SendPropertyChanging();
+ entity.ChatRoom = this;
+ }
+
+ private void detach_UserRooms(UserRoom entity)
+ {
+ this.SendPropertyChanging();
+ entity.ChatRoom = null;
+ }
}
}
#pragma warning restore 1591
View
6 JoMAR/Web.config
@@ -1,4 +1,4 @@
-<?xml version="1.0"?>
+<?xml version="1.0"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=152368
@@ -10,6 +10,10 @@
<connectionStrings>
<add name="JoMAR.Properties.Settings.ConnString" connectionString="Data Source=malmen.hin.no;Initial Catalog=gruppe2_h11;User ID=gruppe2"
providerName="System.Data.SqlClient" />
+ <add name="gruppe2_h11ConnectionString" connectionString="Data Source=malmen.hin.no;Initial Catalog=gruppe2_h11;User ID=gruppe2"
+ providerName="System.Data.SqlClient" />
+ <add name="gruppe2_h11ConnectionString1" connectionString="Data Source=malmen.hin.no;Initial Catalog=gruppe2_h11;User ID=gruppe2;Password=grp2.hin"
+ providerName="System.Data.SqlClient" />
</connectionStrings>
<appSettings>
Please sign in to comment.
Something went wrong with that request. Please try again.