示例#1
0
        public static bool message_InsertMessage(int id_usr, string msg_body, int msg_type, int[] dest_users)
        {
            long id_message = 0;
            try
            {
                using (MessDataContext db = new MessDataContext())
                {
                    MESSAGE msg = new MESSAGE();
                    msg.MSG_TYPE = msg_type;
                    msg.MSG_BODY = msg_body;
                    msg.C_DATE = DateTime.Now;

                    db.MESSAGEs.InsertOnSubmit(msg);
                    db.SubmitChanges();

                    id_message = db.MESSAGEs.Max(i => i.ID_MESSAGE);

                    foreach (var du in dest_users)
                    {
                        MESSTOUSR m2u = new MESSTOUSR();
                        m2u.MSG_STATE = (int)MsgState.New;
                        m2u.ID_MESSAGE = id_message;
                        m2u.ID_SENDER = id_usr;
                        m2u.ID_USR = du;

                        db.MESSTOUSRs.InsertOnSubmit(m2u);
                    }

                    db.SubmitChanges();
                }
                return true;
            }
            catch (Exception)
            {
                return false;
            }
        }
示例#2
0
		private void attach_MESSTOUSRs(MESSTOUSR entity)
		{
			this.SendPropertyChanging();
			entity.MESSAGE = this;
		}
示例#3
0
		private void detach_MESSTOUSRs(MESSTOUSR entity)
		{
			this.SendPropertyChanging();
			entity.MESSAGE = null;
		}
示例#4
0
 partial void DeleteMESSTOUSR(MESSTOUSR instance);
示例#5
0
 partial void UpdateMESSTOUSR(MESSTOUSR instance);
示例#6
0
 partial void InsertMESSTOUSR(MESSTOUSR instance);
示例#7
0
		private void detach_MESSTOUSRs1(MESSTOUSR entity)
		{
			this.SendPropertyChanging();
			entity.USER1 = null;
		}
示例#8
0
		private void attach_MESSTOUSRs1(MESSTOUSR entity)
		{
			this.SendPropertyChanging();
			entity.USER1 = this;
		}