示例#1
0
        public void AddMessage(int idUserFor, string text)
        {
            IsAllowAction(AccessType.Authorized);

            Message message = new Message() { IdUserFrom = idUser, IdUserFor = idUserFor, Text = text };

            try
            {
                context.Messages.InsertOnSubmit(message);
                context.SubmitChanges();
            }
            catch
            {
                // Запись в протокол о попытке хакерской атаки

                return;
            }

            if (connected.ContainsKey(idUserFor))
            {
                try
                {
                    connected[idUserFor].NewMessageReceive(idUser, text);
                }
                catch
                {
                    // Обработка исключения
                }
            }
        }
		private void detach_Messages1(Message entity)
		{
			this.SendPropertyChanging();
			entity.User1 = null;
		}
		private void attach_Messages1(Message entity)
		{
			this.SendPropertyChanging();
			entity.User1 = this;
		}
 partial void DeleteMessage(Message instance);
 partial void UpdateMessage(Message instance);
 partial void InsertMessage(Message instance);
		private void detach_Messages(Message entity)
		{
			this.SendPropertyChanging();
			entity.Group = null;
		}
		private void attach_Messages(Message entity)
		{
			this.SendPropertyChanging();
			entity.Group = this;
		}