// Get Methods public static int GetTotalNumberOfNotifications(string username) { int userid = Profile.getUserID(username); using (TransactionScope ee = new TransactionScope()) using (boxEntities box = new boxEntities()) { var result = (from o in box.NotInfoes where o.UserID == userid && o.Ack == false select o).ToList(); int count = result.Count(); foreach (var t in result) { t.Ack = true; } box.SaveChanges(); ee.Complete(); return(count); } }
public static bool CheckAvl(int loc, DateTime date, DateTime stime, DateTime etime) { using (boxEntities box = new boxEntities()) { // TODO: check correct var result = box.MeetingLocations.Where(a => a.StartDate == date && a.LocationID == loc).ToList(); var tt = result.Where(a => stime == a.StartTime || (stime > a.StartTime && stime < a.EndTime) || (stime <a.StartTime && etime> a.StartTime) || (etime == a.EndTime)).ToList(); if (tt.Count != 0) { return(false); } else { return(true); } } }
public static List <AgendaTaskClass> GetAgendaTasks(string username, int agendaID) { using (boxEntities box = new boxEntities()) { // user id int userid = Profile.GetUserID(username); var result = new List <AgendaTaskClass>(); // check the user role if not creator then get the assigned to tasks only if (AgendaPrivacyClass.CheckRole(username, MeetingRoles.Creator, agendaID)) { result = (from o in box.TaskAssigns.Include("TaskUsers").Include("UserProfile") where o.AgendaID == agendaID select new AgendaTaskClass() { Title = o.TaskTitle, Desc = o.TaskDesc, TaskID = o.TaskID, DueDate = o.DueDate, CreatedDate = o.DateCreated, }).ToList(); foreach (var t in result) { t.Usernames = box.TaskUsers.Where(a => a.TaskID == t.TaskID).Select(a => a.UserProfile.UserName).ToArray(); } } else { result = (from o in box.TaskUsers where o.TaskAssign.AgendaID == agendaID && o.UserID == userid select new AgendaTaskClass() { Title = o.TaskAssign.TaskTitle, Desc = o.TaskAssign.TaskDesc, TaskID = o.TaskAssign.TaskID, DueDate = o.TaskAssign.DueDate, CreatedDate = o.TaskAssign.DateCreated, }).ToList(); } return(result); } }
public static List <ProjectTaskClass> GetProjectFileTasks(string username, string fileFullName, int projectID) { using (boxEntities box = new boxEntities()) { // user id int userid = Profile.GetUserID(username); var result = new List <ProjectTaskClass>(); // check the user role if not creator then get the assigned to tasks only if (Roles.UserIsAllowed_Project(username, ProjectPrivilages.Manage, projectID)) { result = (from o in box.TaskAssigns.Include("TaskUsers").Include("UserProfile") where o.ProjectFile.ProjectID == projectID && o.ProjectFile.FullName == fileFullName select new ProjectTaskClass() { Title = o.TaskTitle, Desc = o.TaskDesc, TaskID = o.TaskID, DueDate = o.DueDate, CreatedDate = o.DateCreated, }).ToList(); foreach (var t in result) { t.Usernames = box.TaskUsers.Where(a => a.TaskID == t.TaskID).Select(a => a.UserProfile.UserName).ToArray(); } } else { result = (from o in box.TaskUsers where o.TaskAssign.ProjectFile.FullName == fileFullName && o.TaskAssign.ProjectFile.ProjectID == projectID && o.UserID == userid select new ProjectTaskClass() { Title = o.TaskAssign.TaskTitle, Desc = o.TaskAssign.TaskDesc, TaskID = o.TaskAssign.TaskID, DueDate = o.TaskAssign.DueDate, CreatedDate = o.TaskAssign.DateCreated, }).ToList(); } return(result); } } // done
public static bool UpdateAppointment(Event ev) { using (boxEntities box = new boxEntities()) { var result = (from o in box.Meetings where o.MeetingID == ev.Id select o).FirstOrDefault(); if (result != null) { result.StartDate = ev.Start; result.EndDate = ev.End; result.MeetingTitle = ev.Title; result.AllDay = ev.Allday; result.MeetingDesc = ev.Desc; // get invited and var part = (from i in box.MeetingParticipants where i.MeetingID == ev.Id && i.Role == MeetingRoles.Attendee.ToString() select i).FirstOrDefault(); if (part != null) { if (part.UserProfile.UserName != ev.Invited) { box.MeetingParticipants.DeleteObject(part); int inv = Profile.getUserID(ev.Invited); MeetingParticipant invited = new MeetingParticipant(); invited.UserID = inv; invited.Role = MeetingRoles.Attendee.ToString(); invited.MeetingID = ev.Id; invited.Response = MeetingReponse.Pending.ToString(); result.MeetingParticipants.Add(invited); } } box.SaveChanges(); return(true); } else { return(false); } } }
internal static bool InsertCalender(DateTime sdate, DateTime edate, DateTime stime, DateTime etime, string title, string username, bool allday) { try { using (boxEntities box = new boxEntities()) { int userid = Profile.getUserID(username); Meeting meet = new Meeting(); meet.StartDate = new DateTime(sdate.Year, sdate.Month, sdate.Day, stime.Hour, stime.Minute, stime.Second); meet.EndDate = new DateTime(edate.Year, edate.Month, edate.Day, etime.Hour, etime.Minute, etime.Second); meet.MeetingTitle = title; meet.Cal = true; meet.Mee = false; meet.App = false; meet.AllDay = allday; // additional meet.MeetingDesc = ""; meet.Type = 0; // add participant as creator MeetingParticipant part = new MeetingParticipant(); part.UserID = userid; part.Role = MeetingRoles.Creator.ToString(); part.MeetingID = meet.MeetingID; part.Response = MeetingReponse.Pending.ToString(); part.Note = ""; meet.MeetingParticipants.Add(part); box.Meetings.AddObject(meet); box.SaveChanges(); return(true); } } catch { return(false); } }
public static void Not_NewMeetingDiscussion(int meetingid, int user, string dTitle) { using (boxEntities box = new boxEntities()) { NotificationHeader notH = new NotificationHeader(); notH.NotType = NotificationType.Meeting_New_Discussion.ToString(); notH.MeetingID = meetingid; notH.NotDate = DateTime.Now; notH.NotCreator = user; box.NotificationHeaders.AddObject(notH); box.SaveChanges(); // get meeting parties var parties = (from o in box.MeetingParticipants where o.MeetingID == meetingid select o.UserID).ToList(); // loop to add info and follower foreach (var i in parties) { NotInfo notI = new NotInfo(); notI.UserID = i; notI.NotHeaderID = notH.NotID; notI.Ack = false; notI.Seen = false; box.NotInfoes.AddObject(notI); //notH.NotInfoes.Add(notI); } box.SaveChanges(); // get meeting title var meetingTitle = (from o in box.Meetings where o.MeetingID == meetingid select o.MeetingTitle).FirstOrDefault(); var r = getEmails(parties); var msg = FormatDiscussiongMsg(dTitle, meetingTitle, NotificationType.Meeting_New_Discussion); SendEmail(r, msg, NotificationType.Meeting_New_Discussion); } }
// Task Response // updae and save public static bool SaveTaskResponse(string username, int taskID, string desc, string response) { using (boxEntities box = new boxEntities()) { var result = (from o in box.TaskUsers where o.UserProfile.UserName == username && o.TaskID == taskID select o).FirstOrDefault(); if (result != null) { result.TDesc = desc; result.Response = response; result.ResponseDate = DateTime.Now; box.SaveChanges(); return(true); } else { return(false); } } }
internal static bool EditUser(string fname, string lname, string position, string email, string uname) { using (boxEntities box = new boxEntities()) { var re = (from o in box.UserProfiles where o.UserName == uname select o).FirstOrDefault(); if (re != null) { re.FirstName = fname; re.LastName = lname; re.Email = email; re.Position = position; box.SaveChanges(); return(true); } else { return(false); } } }
internal static int InsertMeeting(DateTime sdate, DateTime edate, DateTime stime, DateTime etime, string title, string username, int type, string desc, bool allday) { try { using (boxEntities box = new boxEntities()) { int userid = Profile.getUserID(username); Meeting meet = new Meeting(); meet.StartDate = new DateTime(sdate.Year, sdate.Month, sdate.Day, stime.Hour, stime.Minute, stime.Second); meet.EndDate = new DateTime(edate.Year, edate.Month, edate.Day, etime.Hour, etime.Minute, etime.Second); meet.MeetingTitle = title; meet.Cal = false; meet.Mee = true; meet.App = false; meet.MeetingDesc = desc; meet.Type = type; meet.AllDay = allday; MeetingParticipant part1 = new MeetingParticipant(); part1.UserID = userid; part1.Role = MeetingRoles.Creator.ToString(); part1.MeetingID = meet.MeetingID; part1.Response = MeetingReponse.Attending.ToString(); part1.Note = ""; meet.MeetingParticipants.Add(part1); // send invitations here box.Meetings.AddObject(meet); box.SaveChanges(); return(meet.MeetingID); } } catch { return(0); } }
public static Event GetMeeting(int id) { using (boxEntities box = new boxEntities()) { var m = (from o in box.Meetings.Include("MeetingParticipants").Include("MeetingType") where o.MeetingID == id && o.Mee == true select o).FirstOrDefault(); if (m != null) { string type = MeetingFilter.Meeting.ToString(); // get type var t = m.MeetingType.CatID; Event e = new Event(m.MeetingID, m.MeetingTitle, m.StartDate, m.EndDate, t, type, m.MeetingDesc, m.AllDay); return(e); } else { throw new Exception("Error fetching Meeting information | MeetingClass.MeetinInfo.GetInfo"); } } }
public static List <CParticipant> getMeetingParticipant(int meetingid) { using (boxEntities box = new boxEntities()) { var result = (from o in box.MeetingParticipants.Include("UserProfiles") where o.Meeting.MeetingID == meetingid select new CParticipant() { UserName = o.UserProfile.UserName, Response = o.Response, Role = o.Role, Note = o.Note }).ToList(); if (result != null) { return(result); } else { throw new Exception("Error getting the user - MeetingClass_getMeetingParticipant"); } } }
public static bool UpdateCalendar(Event ev) { using (boxEntities box = new boxEntities()) { var result = (from o in box.Meetings where o.MeetingID == ev.Id select o).FirstOrDefault(); if (result != null) { result.StartDate = ev.Start; result.EndDate = ev.End; result.MeetingTitle = ev.Title; result.AllDay = ev.Allday; box.SaveChanges(); return(true); } else { return(false); } } }
public static Event GetInfo(int id) { using (boxEntities box = new boxEntities()) { var m = (from o in box.Meetings.Include("MeetingParticipants").Include("MeetingType") where o.MeetingID == id select o).FirstOrDefault(); if (m != null) { string type = MeetingFilter.Calendar.ToString(); Event e = new Event(m.MeetingID, m.MeetingTitle, m.StartDate, m.EndDate, m.AllDay, type); if (m.Mee) { type = MeetingFilter.Meeting.ToString(); // get type var t = m.MeetingType.CatID; e = new Event(m.MeetingID, m.MeetingTitle, m.StartDate, m.EndDate, t, type, m.MeetingDesc, m.AllDay); } if (m.App) { type = MeetingFilter.Appointment.ToString(); var inv = m.MeetingParticipants.Where(a => a.Role == "Attendee").FirstOrDefault(); if (inv != null) { e = new Event(m.MeetingID, m.MeetingTitle, m.StartDate, m.EndDate, m.AllDay, type, m.MeetingDesc, inv.UserProfile.UserName); } } return(e); } else { throw new Exception("Error fetching Meeting information | MeetingClass.MeetinInfo.GetInfo"); } } }
public static void Not_NewAgendaDiscussion(string dTitle, int AgendaID, int user) { using (boxEntities box = new boxEntities()) { NotificationHeader notH = new NotificationHeader(); notH.NotType = NotificationType.Agenda_New_Discussion.ToString(); notH.AgendaID = AgendaID; notH.NotDate = DateTime.Now; notH.NotCreator = user; box.NotificationHeaders.AddObject(notH); box.SaveChanges(); // get recipients email var re = (from o in box.AgendaPrivacies where o.AgendaID == AgendaID && o.Agendum.Published == true && o.CanSee == true select o.MeetingParticipant.UserID).ToList(); foreach (var i in re) { NotInfo notI = new NotInfo(); notI.UserID = i; notI.NotHeaderID = notH.NotID; notI.Ack = false; notI.Seen = false; box.NotInfoes.AddObject(notI); } box.SaveChanges(); // get agenda title var agendaT = (from o in box.Agenda where o.AgendaID == AgendaID select o.AgendaTitle).FirstOrDefault(); // get information for the email var parti = getEmails(re); var msg = FormatDiscussiongMsg(dTitle, agendaT, NotificationType.Agenda_New_Discussion); SendEmail(parti, msg, NotificationType.Agenda_New_Discussion); } }
internal static bool ChkAdmin(string username) { using (boxEntities box = new boxEntities()) { var result = (from o in box.UserProfiles where o.UserName == username select o.Position).FirstOrDefault(); if (result != null || result != "") { if (result == Positions.Admin.ToString()) { return(true); } else { return(false); } } else { return(false); } } }
public static void UpdateMeetingInfo(int meetingid, int user) { using (boxEntities box = new boxEntities()) { NotificationHeader notH = new NotificationHeader(); notH.NotType = NotificationType.Meeting_Info_Update.ToString(); notH.MeetingID = meetingid; notH.NotCreator = user; notH.NotDate = DateTime.Now; box.NotificationHeaders.AddObject(notH); box.SaveChanges(); // get the list of UserIDs of participants var parties = (from o in box.MeetingParticipants where o.MeetingID == meetingid select o.UserID).ToList(); // loop to add info and follower foreach (var i in parties) { NotInfo notI = new NotInfo(); notI.UserID = i; notI.NotHeaderID = notH.NotID; notI.Ack = false; notI.Seen = false; box.NotInfoes.AddObject(notI); //notH.NotInfoes.Add(notI); } box.SaveChanges(); // get meeting var m = (from o in box.Meetings where o.MeetingID == meetingid select o).FirstOrDefault(); SendEmail(getEmails(parties), m, NotificationType.Meeting_Info_Update); } }
public static void Not_UpdateAgenda(Agendum agenda, string user) { using (boxEntities box = new boxEntities()) { int uid = Profile.getUserID(user); NotificationHeader notH = new NotificationHeader(); notH.NotType = NotificationType.Agenda_Update.ToString(); notH.NotDate = DateTime.Now; notH.AgendaID = agenda.AgendaID; notH.NotCreator = uid; box.NotificationHeaders.AddObject(notH); box.SaveChanges(); // get parti // get recipients email var re = (from o in box.AgendaPrivacies where o.AgendaID == agenda.AgendaID && o.Agendum.Published == true && o.CanSee == true select o.MeetingParticipant.UserID).ToList(); re.Remove(uid); foreach (var i in re) { NotInfo notI = new NotInfo(); notI.UserID = i; notI.NotHeaderID = notH.NotID; notI.Ack = false; notI.Seen = false; box.NotInfoes.AddObject(notI); } box.SaveChanges(); // get data var mTitle = agenda.Meeting.MeetingTitle; var emails = getEmails(re); var msg = FormatAgendaMsg(agenda, NotificationType.Agenda_Update, mTitle); SendEmail(emails, msg, NotificationType.Agenda_Update); } }
internal bool Update() { using (boxEntities box = new boxEntities()) { int id = ID; var result = (from o in box.Meetings where o.MeetingID == id select o).FirstOrDefault(); if (result != null) { result.MeetingTitle = Title; result.MeetingDesc = Desc; result.StartDate = StartDate; result.EndDate = EndDate; box.SaveChanges(); return(true); } else { return(false); } } }
internal static bool DeleteUser(string username) { try { using (boxEntities box = new boxEntities()) { var user = (from o in box.UserProfiles where o.UserName == username select o).FirstOrDefault(); if (user != null) { box.UserProfiles.DeleteObject(user); box.SaveChanges(); } } // delete from membership Membership.DeleteUser(username, true); return(true); } catch { return(false); } }
public static void DeletProjectFile(int ProjectID, string FilePath) { using (boxEntities box = new boxEntities()) { var file = (from o in box.ProjectFiles where o.ProjectID == ProjectID && o.FullName == FilePath select o).FirstOrDefault(); if (file != null) { // get fileprivacies and delete them var privacy = (from o in box.ProjectPrivacies where o.ProjectFileID == file.ID select o).ToList(); foreach (var p in privacy) { box.ProjectPrivacies.DeleteObject(p); } box.ProjectFiles.DeleteObject(file); box.SaveChanges(); } } }
public static MeetingDiscussion SaveFileDiscussion(string title, string text, string path, string username) { try { using (boxEntities box = new boxEntities()) { // get file id var file = (from o in box.ProjectFiles where o.FullName == path select o.ID).FirstOrDefault(); int userid = Profile.getUserID(username); Discussion dis = new Discussion(); dis.UserID = userid; dis.Date = DateTime.Now; dis.Title = title; dis.Text = text; dis.FileID = file; box.Discussions.AddObject(dis); box.SaveChanges(); MeetingDiscussion m = new MeetingDiscussion() { Title = dis.Title, ID = dis.ID, Date = dis.Date, UserName = dis.UserProfile.UserName, Replies = dis.Replies.Count() }; return(m); } } catch { throw new Exception(); } }
public static int UpdateMeeting(Event ev) { using (boxEntities box = new boxEntities()) { var result = (from o in box.Meetings where o.MeetingID == ev.Id select o).FirstOrDefault(); if (result != null) { result.StartDate = ev.Start; result.EndDate = ev.End; result.MeetingTitle = ev.Title; result.AllDay = ev.Allday; result.MeetingDesc = ev.Desc; result.Type = ev.MType; box.SaveChanges(); return(ev.Id); } else { throw new Exception("Error Updating meeting information"); } } }
public static TaskClass GetTask(int TaskID) { using (boxEntities box = new boxEntities()) { var result = (from o in box.TaskAssigns.Include("TaskUsers") where o.TaskID == TaskID select new TaskClass() { Title = o.TaskTitle, Desc = o.TaskDesc, TaskID = o.TaskID, DueDate = o.DueDate }).FirstOrDefault(); if (result != null) { result.Usernames = box.TaskUsers.Where(a => a.TaskID == result.TaskID).Select(a => a.UserProfile.UserName).ToArray(); return(result); } else { throw new Exception(); } } }
public static void follow(string username) { using (boxEntities box = new boxEntities()) { } }
public static bool SetMeetingResources(object[] ids, int meetingid) { using (boxEntities box = new boxEntities()) { var oldList = (from o in box.MeetingResources where o.MeetingID == meetingid select o.ResourceID).ToList(); if (oldList.Count() == 0) { // insert new resources foreach (var t in ids) { MeetingResource re = new MeetingResource(); re.MeetingID = meetingid; re.ResourceID = (int)t; re.Quantity = 1; box.MeetingResources.AddObject(re); } box.SaveChanges(); return(true); } else { List <int> newList = new List <int>(); foreach (var t in ids) { newList.Add(Convert.ToInt32(t)); } var intersect = oldList.Intersect(newList); // insert new foreach (var t in newList) { if (!intersect.Contains(t)) { // insert MeetingResource re = new MeetingResource(); re.MeetingID = meetingid; re.ResourceID = t; re.Quantity = 1; box.MeetingResources.AddObject(re); } } // delete foreach (var t in oldList) { if (!intersect.Contains(t)) { var del = (from o in box.MeetingResources where o.ResourceID == t && o.MeetingID == meetingid select o).FirstOrDefault(); if (del != null) { box.MeetingResources.DeleteObject(del); } } } box.SaveChanges(); return(true); } } }
public static AgendaTaskClass UpdateAgendaTask(int taskID, string username, int agendaID, string title, string desc, DateTime dueDate, string[] usernames) { using (boxEntities box = new boxEntities()) { usernames = usernames.Distinct().ToArray(); // get meetin id var m = (from o in box.Agenda where o.AgendaID == agendaID select o.MeetingID).FirstOrDefault(); if (AgendaPrivacyClass.CheckRole(username, MeetingRoles.Creator, agendaID)) { // get the header var task = (from o in box.TaskAssigns.Include("TaskUsers") where o.TaskID == taskID select o).FirstOrDefault(); task.TaskTitle = title; task.TaskDesc = desc; task.DueDate = dueDate; task.Creator = Profile.getUserID(username); box.SaveChanges(); // get the users int[] NewUsers = { }; if (usernames.Contains("All")) { // get all users in meeting ids NewUsers = AgendaPrivacyClass.ListParticipantIDs(agendaID); } else { NewUsers = Profile.GetUserIDs(usernames); } // get old users int[] OldUsers = task.TaskUsers.Select(a => a.UserProfile.UserID).ToArray(); int[] same = NewUsers.Intersect(OldUsers).ToArray(); // insert new foreach (var t in NewUsers) { if (!same.Contains(t)) { TaskUser u = new TaskUser(); u.UserID = t; u.TaskID = task.TaskID; u.AssignedDate = DateTime.Now; task.TaskUsers.Add(u); } } // delete foreach (var o in OldUsers) { if (!same.Contains(o)) { var dtask = task.TaskUsers.Where(a => a.UserID == o).FirstOrDefault(); if (dtask != null) { task.TaskUsers.Remove(dtask); } } } box.SaveChanges(); // return object AgendaTaskClass tt = new AgendaTaskClass(); tt.Title = task.TaskTitle; tt.Desc = task.TaskDesc; tt.DueDate = task.DueDate; tt.TaskID = task.TaskID; tt.CreatedDate = task.DateCreated; tt.Usernames = task.TaskUsers.Select(a => a.UserProfile.UserName).ToArray(); return(tt); } else { throw new UnauthorizedAccessException(); } } }
public static AgendaTaskClass SaveAgendaTask(string username, int agendaID, string title, string desc, DateTime dueDate, string[] usernames) { AgendaTaskClass rObject = new AgendaTaskClass(); using (boxEntities box = new boxEntities()) { usernames = usernames.Distinct().ToArray(); if (AgendaClass.AgendaPrivacyClass.CheckRole(username, MeetingRoles.Creator, agendaID)) { // create the header TaskAssign task = new TaskAssign(); task.AgendaID = agendaID; task.TaskTitle = title; task.TaskDesc = desc; task.DueDate = dueDate; task.DateCreated = DateTime.Now; task.Creator = Profile.getUserID(username); box.TaskAssigns.AddObject(task); box.SaveChanges(); // check if all int[] users = { }; string[] na = { }; if (usernames.Contains("All")) { // get all users in meeting ids users = AgendaPrivacyClass.ListParticipantIDs(agendaID); na = AgendaPrivacyClass.ListParticipantUsername(agendaID); } else { users = Profile.GetUserIDs(usernames); na = usernames; } foreach (var t in users) { TaskUser u = new TaskUser(); u.UserID = t; u.TaskID = task.TaskID; u.AssignedDate = DateTime.Now; task.TaskUsers.Add(u); } box.SaveChanges(); rObject.TaskID = task.TaskID; rObject.CreatedDate = task.DateCreated; rObject.DueDate = task.DueDate; rObject.Desc = task.TaskDesc; rObject.Title = task.TaskTitle; rObject.AgendaID = agendaID; rObject.Usernames = na; rObject.Creator = username; return(rObject); } else { throw new UnauthorizedAccessException(); } } }
public static bool Delete(int id) { using (boxEntities box = new boxEntities()) { var evn = (from o in box.Meetings where o.MeetingID == id select o).FirstOrDefault(); if (evn != null) { if (evn.Mee) { // meeting // Files var file = (from o in box.MeetingFiles where o.MeetingID == evn.MeetingID select o).ToList(); foreach (var t in file) { box.MeetingFiles.DeleteObject(t); } // locations var loc = (from o in box.MeetingLocations where o.MeetingID == evn.MeetingID select o).ToList(); foreach (var t in loc) { box.MeetingLocations.DeleteObject(t); } // participants var part = (from o in box.MeetingParticipants where o.MeetingID == evn.MeetingID select o).ToList(); foreach (var t in part) { box.MeetingParticipants.DeleteObject(t); } //resources var res = (from o in box.MeetingResources where o.MeetingID == evn.MeetingID select o).ToList(); foreach (var t in res) { box.MeetingResources.DeleteObject(t); } // agenda var age = (from o in box.Agenda where o.MeetingID == evn.MeetingID select o).ToList(); foreach (var t in age) { box.Agenda.DeleteObject(t); } //tasks var task = (from o in box.TaskAssigns where o.MeetingID == evn.MeetingID select o).ToList(); foreach (var t in task) { box.TaskAssigns.DeleteObject(t); } } else if (evn.App) { // appointment var par = (from o in box.MeetingParticipants where o.MeetingID == evn.MeetingID select o).ToList(); foreach (var t in par) { box.MeetingParticipants.DeleteObject(t); } } else { // calendar var par = (from o in box.MeetingParticipants where o.MeetingID == evn.MeetingID select o).ToList(); foreach (var t in par) { box.MeetingParticipants.DeleteObject(t); } } box.Meetings.DeleteObject(evn); box.SaveChanges(); return(true); } else { return(false); } } }
//private static void getFile(string fileDir, boxEntities box, out int file) //{ // file = (from o in box.OFiles // where o.Directory == fileDir // select o.FileID).FirstOrDefault(); //} private static void getUser(string username, boxEntities box, out int user) { user = (from o in box.UserProfiles where o.UserName == username select o.UserID).FirstOrDefault(); }