public static void insertevent(calendar_entity db, calendar_globalevent newe)
        {
            DateTime date=DateTime.Now;
            if (newe != null)
            {
                newe.eventid = Guid.NewGuid();
                newe.createtime=date;
                db.calendar_globalevent.AddObject(newe);

                db.SaveChanges();

                //cut extra events
                IEnumerable<calendar_globalevent> var = DAL.GlobalEvent_DAL.geteventByUser(db, newe.userid);

                if (var.Count() > MAX)
                {
                    for (int i = MAX; i < var.Count(); i++)
                    {
                        db.calendar_globalevent.DeleteObject(var.ElementAt(i));

                    }
                }
                 db.SaveChanges();

            }
        }
 public static void insert(calendar_entity db, calendar_notification newn)
 {
     newn.id = Guid.NewGuid();
     newn.createtime = DateTime.Now;
     db.calendar_notification.AddObject(newn);
     db.SaveChanges();
 }
        protected void indexchange(object sender, EventArgs e)
        {
            calendar_entity db = new calendar_entity();

            IEnumerable<onlyid_> searchRes = (IEnumerable<onlyid_>)Session["searchfriendonlyid"];
            Guid selected= searchRes.ElementAtOrDefault( gv.SelectedIndex).userid;

            Guid myid=(Guid)Membership.GetUser().ProviderUserKey;

            var res = from i in db.calendar_friend

                      where i.myUserId == myid && i.friendUserId == selected
                      select i;

            if(res.Count()==0)
            {
                calendar_friend newf=new calendar_friend();
                newf.friendUserId=selected;
                newf.myUserId=myid;
                newf.relationship="";
                db.calendar_friend.AddObject(newf);
                db.SaveChanges();
            }

            calendar_globalevent newg=new calendar_globalevent() {
                userid =(Guid) Membership.GetUser().ProviderUserKey,
                createtime = DateTime.Today,
                eventtype = "addfriend"
            };
            globaleventContext.insertevent(newg, selected);
        }
 public static calendar_profile insert(calendar_entity db,byte[] img, Guid uid)
 {
     calendar_profile newp = new calendar_profile { userid = uid, img = img };
     db.calendar_profile.AddObject(newp);
     db.SaveChanges();
     return newp;
 }
 public static void deleteevent(calendar_entity db, Guid eventid)
 {
     calendar_globalevent var = (from i in db.calendar_globalevent
                                             where i.eventid == eventid
                                             select i).First();
     db.calendar_globalevent.DeleteObject(var);
     db.SaveChanges();
 }
Beispiel #6
0
 public static void deleteMessage(Guid id)
 {
     calendar_entity db = new calendar_entity();
     IEnumerable<calendar_wallmessage> ret = Wall_DAL.getWallMessageByMessageId(id);
     foreach (calendar_wallmessage i in ret)
         db.calendar_wallmessage.DeleteObject(i);
     db.SaveChanges();
 }
 public static void insertJoin(Guid visiterid, Guid eventid)
 {
     calendar_entity db = new calendar_entity();
     calendar_joinevent newjoin = new calendar_joinevent();
     newjoin.eventid = eventid;
     newjoin.UserId = visiterid;
     db.calendar_joinevent.AddObject(newjoin);
     db.SaveChanges();
 }
        public static void deleteById(calendar_entity db, Guid id)
        {
            calendar_notification var = (from i in db.calendar_notification
                                        where i.id==id
                                        select i).First();

                db.calendar_notification.DeleteObject(var);
                db.SaveChanges();
        }
        public static void deleteEvent(Guid eventid_)
        {
            calendar_entity db = new calendar_entity();
            IEnumerable<calendar_event> var = from i in db.calendar_event
                                    where i.eventid == eventid_
                                    select i;
            foreach (calendar_event j in var)
                db.calendar_event.DeleteObject(j);

            db.SaveChanges();
        }
        public static void deleteComment(Guid messageId_)
        {
            calendar_entity db = new calendar_entity();
            IEnumerable<calendar_message> var = from i in db.calendar_message
                                              where i.messageId == messageId_
                                              select i;
            foreach (calendar_message j in var)
                db.calendar_message.DeleteObject(j);

            db.SaveChanges();
        }
Beispiel #11
0
        public static void deleteFriend(Guid target, Guid me)
        {
            calendar_entity db = new calendar_entity();
            IEnumerable<calendar_friend> var = from i in db.calendar_friend
                                    where i.myUserId==me && i.friendUserId ==target
                                    select i;
            foreach (calendar_friend j in var)
                db.calendar_friend.DeleteObject(j);

            db.SaveChanges();
        }
 public static void deleteByUserIdd(calendar_entity db, Guid userid)
 {
     IEnumerable<calendar_notification> var = from i in db.calendar_notification
                                        where i.userid == userid
                                        select i;
     foreach (calendar_notification i in var)
     {
         db.calendar_notification.DeleteObject(i);
         db.SaveChanges();
     }
 }
        public static void deleteComment(Guid visiterid, Guid eventid)
        {
            calendar_entity db = new calendar_entity();
            IEnumerable<calendar_joinevent> var = from i in db.calendar_joinevent
                                                where i.UserId == visiterid && i.eventid==eventid
                                                select i;
            foreach (calendar_joinevent j in var)
                db.calendar_joinevent.DeleteObject(j);

            db.SaveChanges();
        }
Beispiel #14
0
 public static void update(calendar_entity db, calendar_profile newp)
 {
     calendar_profile p = (from i in db.calendar_profile
                           where i.userid == newp.userid
                           select i).First();
     p.sex = newp.sex;
     p.name = newp.name;
     p.Favorate = newp.Favorate;
     p.Dislike = newp.Dislike;
     db.SaveChanges();
 }
Beispiel #15
0
        public static void addFriend(Guid target, Guid me)
        {
            calendar_entity db = new calendar_entity();
            calendar_friend f = new calendar_friend()
            {

             friendUserId=target,
             myUserId=me
            };

            db.calendar_friend.AddObject(f);
            db.SaveChanges();
        }
Beispiel #16
0
        public static void insertWallMessage(Guid target, Guid sender,string content)
        {
            calendar_entity db=new calendar_entity();
            calendar_wallmessage newm=new calendar_wallmessage()
                { messageId=Guid.NewGuid(),
                  senderid=sender,
                  UserId=target,
                  createtime=DateTime.Now,
                  content=content
                  };
            db.calendar_wallmessage.AddObject(newm);

            db.SaveChanges();
        }
        public static void insertComment(string UserName_, Guid eventid_, string content_ )
        {
            calendar_entity db = new calendar_entity();

            calendar_message newm = new calendar_message()
            {
                messageId = Guid.NewGuid(),
                UserName = UserName_,
                content = content_,
                createtime = DateTime.Now,
                eventid = eventid_

            };
            db.calendar_message.AddObject(newm);
            db.SaveChanges();
        }
        public static calendar_event insertEvent(Guid UserId_, Guid eventid_, string tittle, string content_, string place_, DateTime createtime_, DateTime start, DateTime end)
        {
            calendar_entity db = new calendar_entity();
            calendar_event newe = new calendar_event()
            {

                UserId = UserId_,
                eventid = eventid_,
                content = content_,
                place = place_,
                createtime = createtime_,
                tittle=tittle,
                 start=start,
                end=end
            };

            db.calendar_event.AddObject(newe);
            db.SaveChanges();
            return newe;
        }
Beispiel #19
0
 public static void changeImg(calendar_entity db, Guid uid, byte[] img)
 {
     calendar_profile p = DAL.Profile_DAL.get(db, uid);
     p.img = img;
     db.SaveChanges();
 }