public static IEnumerable<calendar_event> getEventByUserId(Guid userid) { calendar_entity db = new calendar_entity(); return from i in db.calendar_event where i.UserId == userid select i; }
public static IEnumerable<calendar_globalevent> geteventByUser(calendar_entity db, Guid userid) { List<Guid> a; IEnumerable<Guid> ids = from i in db.aspnet_Users where i.UserId == userid select i.UserId; IEnumerable<Guid> ids2=(from i in db.calendar_friend where i.myUserId==userid select i.friendUserId);//my friends //friends.Union( ); IEnumerable<Guid> ids3 = ids.ToArray<Guid>().Union<Guid>(ids2.ToArray<Guid>()); IEnumerable<Guid> ids4 = from i in db.calendar_friend join j in db.calendar_globalevent on i.myUserId equals j.userid where i.friendUserId == userid select j.userid; ids4 = ids4.ToArray<Guid>().Union<Guid>(ids3); //users that added me as friend IEnumerable<calendar_globalevent> ret = from j in ids4 join w in db.calendar_globalevent on j equals w.userid where 1==1 orderby w.createtime descending select w; return ret; }
public static IEnumerable<calendar_wallmessage> getWallMessageByUser(calendar_entity db, Guid owner) { IEnumerable<calendar_wallmessage> ret = from i in db.calendar_wallmessage where i.UserId == owner orderby i.createtime descending select i; return ret; }
protected void btnSubmit_Click(object sender, EventArgs e) { calendar_entity db = new calendar_entity(); string name=txtname.Text; string myname=Membership.GetUser().UserName; IEnumerable<SearchFriendProperty> result = friendcontext.searchUserForFriends(name, myname); IEnumerable<noid_> noid = from i in result select new noid_ {name=i.name, email=i.email, last_logged_in=i.last_logged_in, last_logged_out=i.last_logged_out, comment=i.comment}; IEnumerable<onlyid_> onlyd = from i in result select new onlyid_ { userid = i.userid }; Session["searchfriendonlyid"]=onlyd; Session["searchfriendnoid"] = noid; gv.DataSource = noid; gv.DataBind(); this.Controls.Add(gv); gv.Visible = true; }
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(); } }
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 insert(calendar_entity db, calendar_notification newn) { newn.id = Guid.NewGuid(); newn.createtime = DateTime.Now; db.calendar_notification.AddObject(newn); db.SaveChanges(); }
public static IEnumerable<calendar_event> getEvent(Guid userid, DateTime date) { calendar_entity db = new calendar_entity(); IEnumerable<calendar_event> var = from i in db.calendar_event where i.UserId == userid && i.createtime == date orderby i.start descending select i; return var; }
public static IEnumerable<calendar_friend> getFriend(Guid target, Guid me) { calendar_entity db = new calendar_entity(); IEnumerable<calendar_friend> var = from i in db.calendar_friend where i.friendUserId == target && i.myUserId == me select i; return var; }
public static IEnumerable<calendar_event> getEventById(Guid eventid) { calendar_entity db = new calendar_entity(); IEnumerable<calendar_event> var = from i in db.calendar_event where i.eventid==eventid select i; return var; }
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(); }
protected void indexchanged(object sender, EventArgs e) { calendar_entity db = new calendar_entity(); var var=(IEnumerable<calendar_notification>)Session["typelist"]; Notification_DAL.correspondingAction(var.ElementAt(GridView1.SelectedIndex), Session, Response); //globalevent_context.deleteNotification(var.ElementAt(GridView1.SelectedIndex).id); }
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(); }
public static IEnumerable<calendar_wallmessage> getWallMessageByMessageId(Guid id) { calendar_entity db = new calendar_entity(); IEnumerable<calendar_wallmessage> ret = from i in db.calendar_wallmessage where i.messageId == id select i; return ret; }
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(); }
protected void indexchange(object sender, EventArgs e) { calendar_entity db = new calendar_entity(); IEnumerable<withid> searchRes = (IEnumerable<withid>)Session["friendlist"]; Session["selectedfriend_id"] = searchRes.ElementAtOrDefault(gv.SelectedIndex).id; Session["selectedfriend_name"] = searchRes.ElementAtOrDefault(gv.SelectedIndex).Friend; Response.Redirect("FriendCalendar.aspx"); }
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 calendar_profile get(calendar_entity db, Guid uid) { IEnumerable< calendar_profile> p=from i in db.calendar_profile where i.userid == uid select i; if(p.Count()>0) return p.First(); else return null; }
public static IEnumerable<calendar_message> getComment(Guid eventid) { calendar_entity db = new calendar_entity(); IEnumerable<calendar_message> evt = (from i in db.calendar_message where i.eventid == eventid orderby i.createtime descending select i); return evt; }
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(); }
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 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(); }
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(); }
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 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 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(); }
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 IEnumerable<shaotianchatroom.Utilities.withid> getJoinList(Guid eventid) { calendar_entity db = new calendar_entity(); IEnumerable<calendar_joinevent> var = JoinList_DAL.getJoinList(eventid); IEnumerable<shaotianchatroom.Utilities.withid> joiners = (from i in var join j in db.aspnet_Users on i.UserId equals j.UserId select new shaotianchatroom.Utilities. withid { Friend = j.UserName, id = j.UserId }); return joiners; }
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(); }