protected void Page_Load(object sender, EventArgs e) { int?id = this.QueryString <int?>("id"); contact = DbUtil.Db.Contacts.SingleOrDefault(c => c.ContactId == id); if (contact == null) { Response.EndShowMessage("no contact", "/", "home"); } if (!Page.IsPostBack) { GridPager.SetPageSize(ContacteeGrid); GridPager.SetPageSize(ContactorGrid); } if (!Page.IsPostBack && this.QueryString <int?>("edit").HasValue) { EditUpdateButton1.Editing = true; } EditUpdateButton1.Enabled = CanEdit(); DeleteButton.Enabled = CanEdit(); EditUpdateButton1.DataBind(); task = contact.TasksCompleted.FirstOrDefault(); TaskRow.Visible = task != null; if (TaskRow.Visible) { TaskLink.Text = task.Description; TaskLink.NavigateUrl = "~/Task/List/{0}".Fmt(task.Id); } CommentsSection.Visible = ctrl.CanViewComments((int)id); }
public ActionResult AddContactMade(int id) { var p = DbUtil.Db.LoadPersonById(id); DbUtil.LogActivity("Adding contact from: {0}".Fmt(p.Name)); var c = new CmsData.Contact { CreatedDate = Util.Now, CreatedBy = Util.UserId1, ContactDate = Util.Now.Date, ContactTypeId = 99, ContactReasonId = 99, }; DbUtil.Db.Contacts.InsertOnSubmit(c); DbUtil.Db.SubmitChanges(); var cp = new Contactor { PeopleId = p.PeopleId, ContactId = c.ContactId }; DbUtil.Db.Contactors.InsertOnSubmit(cp); DbUtil.Db.SubmitChanges(); return Content("/Contact.aspx?id=" + c.ContactId); }
public ActionResult AddContactReceived(int id) { var p = DbUtil.Db.LoadPersonById(id); DbUtil.LogPersonActivity($"Adding contact to: {p.Name}", id, p.Name); var c = new Contact { CreatedDate = Util.Now, CreatedBy = Util.UserId1, ContactDate = Util.Now.Date }; DbUtil.Db.Contacts.InsertOnSubmit(c); DbUtil.Db.SubmitChanges(); c.contactees.Add(new Contactee {PeopleId = p.PeopleId}); c.contactsMakers.Add(new Contactor {PeopleId = Util.UserPeopleId.Value}); DbUtil.Db.SubmitChanges(); var defaultRole = DbUtil.Db.Setting("Contacts-DefaultRole", null); if (!string.IsNullOrEmpty(defaultRole) && DbUtil.Db.Roles.Any(x => x.RoleName == defaultRole)) TempData["SetRole"] = defaultRole; TempData["ContactEdit"] = true; return Content($"/Contact2/{c.ContactId}"); }
public ActionResult AddContactReceived(int id) { var p = DbUtil.Db.LoadPersonById(id); DbUtil.LogActivity("Adding contact to: {0}".Fmt(p.Name)); var c = new CmsData.Contact { CreatedDate = Util.Now, CreatedBy = Util.UserId1, ContactDate = Util.Now.Date, ContactTypeId = 99, ContactReasonId = 99, }; DbUtil.Db.Contacts.InsertOnSubmit(c); DbUtil.Db.SubmitChanges(); var pc = new Contactee { PeopleId = p.PeopleId, ContactId = c.ContactId }; DbUtil.Db.Contactees.InsertOnSubmit(pc); DbUtil.Db.SubmitChanges(); return(Content("/Contact.aspx?id=" + c.ContactId)); }
public ActionResult AddContactMade(int id) { var p = DbUtil.Db.LoadPersonById(id); DbUtil.LogActivity("Adding contact from: {0}".Fmt(p.Name)); var c = new Contact { CreatedDate = Util.Now, CreatedBy = Util.UserId1, ContactDate = Util.Now.Date, }; DbUtil.Db.Contacts.InsertOnSubmit(c); DbUtil.Db.SubmitChanges(); var cp = new Contactor { PeopleId = p.PeopleId, ContactId = c.ContactId }; DbUtil.Db.Contactors.InsertOnSubmit(cp); DbUtil.Db.SubmitChanges(); TempData["ContactEdit"] = true; return Content("/Contact2/" + c.ContactId); }
public static Contact AddContact(CMSDataContext Db, int pid, DateTime? date, string comments) { var c = new Contact { ContactDate = date ?? DateTime.Parse("1/1/1900"), CreatedBy = Util.UserPeopleId ?? Util.UserId1, CreatedDate = DateTime.Now, Comments = comments }; c.contactees.Add(new Contactee { PeopleId = pid }); Db.Contacts.InsertOnSubmit(c); Db.SubmitChanges(); return c; }
public static Contact AddOrgContact(CMSDataContext db, int orgId, DateTime? date, string comments, int contactmakerid) { var c = new Contact { OrganizationId = orgId, ContactDate = date ?? DateTime.Parse("1/1/1900"), CreatedDate = DateTime.Now, Comments = comments }; c.contactsMakers.Add(new Contactor { PeopleId = contactmakerid }); db.Contacts.InsertOnSubmit(c); db.SubmitChanges(); return c; }
public static Contact AddContact(CMSDataContext Db, int contacteeid, DateTime? date, string comments, int? contactmakerid = null) { var c = new Contact { ContactDate = date ?? DateTime.Parse("1/1/1900"), CreatedBy = Util.UserPeopleId ?? Util.UserId1, CreatedDate = DateTime.Now, Comments = comments }; c.contactees.Add(new Contactee { PeopleId = contacteeid }); if(contactmakerid.HasValue) c.contactsMakers.Add(new Contactor { PeopleId = contactmakerid.Value }); Db.Contacts.InsertOnSubmit(c); Db.SubmitChanges(); return c; }
protected void AddTeamContact_Click(object sender, EventArgs e) { var c = new CmsData.Contact { ContactDate = contact.ContactDate, ContactTypeId = contact.ContactTypeId, ContactReasonId = contact.ContactReasonId, MinistryId = contact.MinistryId, CreatedDate = Util.Now, CreatedBy = Util.UserId1, }; DbUtil.Db.Contacts.InsertOnSubmit(c); foreach (var cp in contact.contactsMakers) c.contactsMakers.Add(new Contactor { PeopleId = cp.PeopleId }); DbUtil.Db.SubmitChanges(); Response.Redirect("~/contact.aspx?id=" + c.ContactId); }
public static int AddContact(Guid qid, int? MakerId = null) { var q = DbUtil.Db.PeopleQuery(qid); if (!q.Any()) return 0; var c = new Contact { ContactDate = DateTime.Now.Date, CreatedBy = Util.UserId1, CreatedDate = DateTime.Now, }; foreach (var p in q) c.contactees.Add(new Contactee { PeopleId = p.PeopleId }); if (MakerId.HasValue) c.contactsMakers.Add(new Contactor {PeopleId = MakerId.Value}); DbUtil.Db.Contacts.InsertOnSubmit(c); DbUtil.Db.SubmitChanges(); return c.ContactId; }
private void LoadContact(int id) { var u = DbUtil.Db.CurrentUser; var roles = u.UserRoles.Select(uu => uu.Role.RoleName.ToLower()).ToArray(); var ManagePrivateContacts = HttpContext.Current.User.IsInRole("ManagePrivateContacts"); var q = from c in DbUtil.Db.Contacts where (c.LimitToRole ?? "") == "" || roles.Contains(c.LimitToRole) || ManagePrivateContacts where c.ContactId == id select c; contact = q.SingleOrDefault(); if (contact == null) return; ContactId = id; MinisteredTo = new ContacteesModel(id); Ministers = new ContactorsModel(id); MinisteredTo.CanViewComments = CanViewComments; Ministers.CanViewComments = CanViewComments; }
public int AddCompletedContact(int id) { var task = DbUtil.Db.Tasks.SingleOrDefault(t => t.Id == id); var c = new CmsData.Contact { ContactDate = Util.Now.Date }; c.CreatedDate = c.ContactDate; c.ContactTypeId = 7; c.ContactReasonId = 160; var min = DbUtil.Db.Ministries.SingleOrDefault(m => m.MinistryName == task.Project); if (min != null) { c.MinistryId = min.MinistryId; } c.contactees.Add(new Contactee { PeopleId = task.WhoId.Value }); c.contactsMakers.Add(new Contactor { PeopleId = PeopleId }); c.Comments = task.Notes; task.CompletedContact = c; task.StatusId = TaskStatusCode.Complete; if (task.CoOwnerId == PeopleId) { DbUtil.Db.Email(task.CoOwner.EmailAddress, task.Owner, "Task Completed with a Contact by " + task.CoOwner.Name, TaskLink(task.Description, task.Id) + "<br />" + task.AboutName); } else if (task.CoOwnerId != null) { DbUtil.Db.Email(task.Owner.EmailAddress, task.CoOwner, "Task Completed with a Contact by " + task.Owner.Name, TaskLink(task.Description, task.Id) + "<br />" + task.AboutName); } task.CompletedOn = c.ContactDate; DbUtil.Db.SubmitChanges(); return(c.ContactId); }
public static int AddContact(int qid) { var q = DbUtil.Db.PeopleQuery(qid); if (q.Count() > 100) return -1; if (q.Count() == 0) return 0; var c = new Contact { ContactDate = DateTime.Now.Date, CreatedBy = Util.UserId1, CreatedDate = DateTime.Now, ContactTypeId = ContactTypeCode.Other, ContactReasonId = ContactReasonCode.Other, }; foreach (var p in q) c.contactees.Add(new Contactee { PeopleId = p.PeopleId }); DbUtil.Db.Contacts.InsertOnSubmit(c); DbUtil.Db.SubmitChanges(); return c.ContactId; }
public ActionResult AddContactReceived(int id) { var p = DbUtil.Db.LoadPersonById(id); DbUtil.LogActivity("Adding contact to: {0}".Fmt(p.Name)); var c = new Contact { CreatedDate = Util.Now, CreatedBy = Util.UserId1, ContactDate = Util.Now.Date, }; DbUtil.Db.Contacts.InsertOnSubmit(c); DbUtil.Db.SubmitChanges(); c.contactees.Add(new Contactee { PeopleId = p.PeopleId }); c.contactsMakers.Add(new Contactor { PeopleId = Util.UserPeopleId.Value }); DbUtil.Db.SubmitChanges(); TempData["ContactEdit"] = true; return Content("/Contact2/{0}".Fmt(c.ContactId)); }
protected void AddTeamContact_Click(object sender, EventArgs e) { var c = new CmsData.Contact { ContactDate = contact.ContactDate, ContactTypeId = contact.ContactTypeId, ContactReasonId = contact.ContactReasonId, MinistryId = contact.MinistryId, CreatedDate = Util.Now, CreatedBy = Util.UserId1, }; DbUtil.Db.Contacts.InsertOnSubmit(c); foreach (var cp in contact.contactsMakers) { c.contactsMakers.Add(new Contactor { PeopleId = cp.PeopleId }); } DbUtil.Db.SubmitChanges(); Response.Redirect("~/contact.aspx?id=" + c.ContactId); }
public static int AddCompletedContact(int id) { var task = DbUtil.Db.Tasks.Single(t => t.Id == id); var c = new Contact {ContactDate = Util.Now.Date}; c.CreatedDate = c.ContactDate; var min = DbUtil.Db.Ministries.SingleOrDefault(m => m.MinistryName == task.Project); if (min != null) c.MinistryId = min.MinistryId; if (task.WhoId.HasValue) c.contactees.Add(new Contactee {PeopleId = task.WhoId.Value}); if (Util.UserPeopleId.HasValue) c.contactsMakers.Add(new Contactor {PeopleId = Util.UserPeopleId.Value}); c.Comments = task.Notes; task.CompletedContact = c; task.StatusId = TaskStatusCode.Complete; if (task.CoOwnerId == Util.UserPeopleId) DbUtil.Db.Email(task.CoOwner.EmailAddress, task.Owner, $"Task completed with a Contact by {Util.UserFullName}", CreateEmailBody(task)); else if (task.CoOwnerId != null) DbUtil.Db.Email(task.Owner.EmailAddress, task.CoOwner, $"Task completed with a Contact by {Util.UserFullName}", CreateEmailBody(task)); task.CompletedOn = c.ContactDate; DbUtil.Db.SubmitChanges(); if (task.Owner.PeopleId == Util.UserPeopleId) { if (task.CoOwner != null) GCMHelper.sendNotification(task.CoOwner.PeopleId, GCMHelper.TYPE_TASK, task.Id, "Task Complete", $"{Util.UserFullName} completed a task they delegated to you"); } else { GCMHelper.sendNotification(task.Owner.PeopleId, GCMHelper.TYPE_TASK, task.Id, "Task Complete", $"{Util.UserFullName} completed a task you delegated them"); } if (Util.UserPeopleId.HasValue) GCMHelper.sendRefresh(Util.UserPeopleId.Value, GCMHelper.TYPE_TASK); return c.ContactId; }
private void detach_Contacts(Contact entity) { this.SendPropertyChanging(); entity.Ministry = null; }
public int AddNewTeamContact() { var c = new Contact { ContactDate = contact.ContactDate.Date, MinistryId = contact.MinistryId, CreatedBy = Util.UserId1, CreatedDate = DateTime.Now, ContactTypeId = contact.ContactTypeId, ContactReasonId = contact.ContactReasonId, }; var q = from cor in DbUtil.Db.Contactors where cor.ContactId == contact.ContactId select cor; foreach (var p in q) c.contactsMakers.Add(new Contactor { PeopleId = p.PeopleId }); DbUtil.Db.Contacts.InsertOnSubmit(c); DbUtil.Db.SubmitChanges(); return c.ContactId; }
private void detach_contactsHad(Contact entity) { this.SendPropertyChanging(); entity.organization = null; }
private void attach_Contacts(Contact entity) { this.SendPropertyChanging(); entity.Ministry = this; }
private void detach_Contacts(Contact entity) { this.SendPropertyChanging(); entity.ContactType = null; }
private void attach_Contacts(Contact entity) { this.SendPropertyChanging(); entity.ContactType = this; }
protected void Page_Load(object sender, EventArgs e) { int? id = this.QueryString<int?>("id"); contact = DbUtil.Db.Contacts.SingleOrDefault(c => c.ContactId == id); if (contact == null) Response.EndShowMessage("no contact", "/", "home"); if (!Page.IsPostBack) { GridPager.SetPageSize(ContacteeGrid); GridPager.SetPageSize(ContactorGrid); } if (!Page.IsPostBack && this.QueryString<int?>("edit").HasValue) EditUpdateButton1.Editing = true; EditUpdateButton1.Enabled = CanEdit(); DeleteButton.Enabled = CanEdit(); EditUpdateButton1.DataBind(); task = contact.TasksCompleted.FirstOrDefault(); TaskRow.Visible = task != null; if (TaskRow.Visible) { TaskLink.Text = task.Description; TaskLink.NavigateUrl = "~/Task/List/{0}".Fmt(task.Id); } CommentsSection.Visible = ctrl.CanViewComments((int)id); }
public int AddCompletedContact(int id) { var task = DbUtil.Db.Tasks.SingleOrDefault(t => t.Id == id); var c = new Contact {ContactDate = Util.Now.Date}; c.CreatedDate = c.ContactDate; var min = DbUtil.Db.Ministries.SingleOrDefault(m => m.MinistryName == task.Project); if (min != null) c.MinistryId = min.MinistryId; c.contactees.Add(new Contactee {PeopleId = task.WhoId.Value}); c.contactsMakers.Add(new Contactor {PeopleId = PeopleId}); c.Comments = task.Notes; task.CompletedContact = c; task.StatusId = TaskStatusCode.Complete; if (task.CoOwnerId == PeopleId) DbUtil.Db.Email(task.CoOwner.EmailAddress, task.Owner, "Task Completed with a Contact by " + task.CoOwner.Name, TaskLink(task.Description, task.Id) + "<br />" + task.AboutName); else if (task.CoOwnerId != null) DbUtil.Db.Email(task.Owner.EmailAddress, task.CoOwner, "Task Completed with a Contact by " + task.Owner.Name, TaskLink(task.Description, task.Id) + "<br />" + task.AboutName); task.CompletedOn = c.ContactDate; DbUtil.Db.SubmitChanges(); return c.ContactId; }
//public PagerModel2 Pager { get; set; } public ContacteesModel(int id) { Contact = DbUtil.Db.Contacts.Single(cc => cc.ContactId == id); //Pager = new PagerModel2(Count); }
public ContactorsModel(int id) { Contact = DbUtil.Db.Contacts.SingleOrDefault(cc => cc.ContactId == id); }
public Contact AddContactReceived(CMSDataContext Db, DateTime dt, int type, int reason, string notes) { var c = new Contact { CreatedDate = Util.Now, CreatedBy = Util.UserId1, ContactDate = dt, ContactTypeId = type, ContactReasonId = reason, Comments = notes }; Db.Contacts.InsertOnSubmit(c); c.contactees.Add(new Contactee { PeopleId = PeopleId }); Db.SubmitChanges(); return c; }
public ContacteesModel(int id) { Contact = DbUtil.Db.Contacts.Single(cc => cc.ContactId == id); }