Ejemplo n.º 1
0
        public ActionResult AddContactMade(int id)
        {
            var p = DbUtil.Db.LoadPersonById(id);
            DbUtil.LogPersonActivity($"Adding contact from: {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();

            var cp = new Contactor
            {
                PeopleId = p.PeopleId,
                ContactId = c.ContactId
            };

            DbUtil.Db.Contactors.InsertOnSubmit(cp);
            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);
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
 private void detach_contactsMakers(Contactor entity)
 {
     this.SendPropertyChanging();
     entity.contact = null;
 }
Ejemplo n.º 5
0
        private ReturnResult AddContactors(int id, int origin)
        {
            var c = DbUtil.Db.Contacts.SingleOrDefault(ct => ct.ContactId == id);
            if (c == null)
                return new ReturnResult {close = true, how = "CloseAddDialog", from = AddContext};

            foreach (var p in PendingList)
            {
                AddPerson(p, PendingList, origin, EntryPointId);
                var ctor = c.contactsMakers.SingleOrDefault(ct =>
                    ct.ContactId == id && ct.PeopleId == p.Person.PeopleId);
                if (ctor == null)
                {
                    ctor = new Contactor
                    {
                        ContactId = id,
                        PeopleId = p.Person.PeopleId
                    };
                    c.contactsMakers.Add(ctor);
                    DbUtil.LogActivity("AddContactor " + id, peopleid: p.PeopleId);
                }
            }
            DbUtil.Db.SubmitChanges();
            return new ReturnResult {close = true, cid = id, from = AddContext};
        }
Ejemplo n.º 6
0
 private JsonResult AddContactors(int id, SearchModel m, int origin)
 {
     if (id > 0)
     {
         var c = DbUtil.Db.Contacts.SingleOrDefault(ct => ct.ContactId == id);
         if (c == null)
             return Json(new { close = true, how = "CloseAddDialog" });
         foreach (var p in m.List)
         {
             AddPerson(p, m.List, origin, m.EntryPointId);
             var ctor = c.contactsMakers.SingleOrDefault(ct =>
                 ct.ContactId == id && ct.PeopleId == p.person.PeopleId);
             if (ctor == null)
             {
                 ctor = new Contactor
                 {
                     ContactId = id,
                     PeopleId = p.person.PeopleId,
                 };
                 c.contactsMakers.Add(ctor);
             }
         }
         DbUtil.Db.SubmitChanges();
     }
     return Json(new { close = true, how = "addselected" });
 }
Ejemplo n.º 7
0
		private void detach_contactsMade(Contactor entity)
		{
			this.SendPropertyChanging();
			entity.person = null;
		}
Ejemplo n.º 8
0
 private void detach_contactsMakers(Contactor entity)
 {
     this.SendPropertyChanging();
     entity.contact = null;
 }