Пример #1
0
 public ActionResult ContactTypeSearchBuilder(int id)
 {
     var qb = DbUtil.Db.QueryBuilderScratchPad();
     qb.CleanSlate(DbUtil.Db);
     var comp = CompareType.Equal;
     var clause = qb.AddNewClause(QueryType.RecentContactType, comp, "1,T");
     clause.Days = 10000;
     var cvc = new CodeValueModel();
     var q = from v in cvc.ContactTypeCodes()
             where v.Id == id
             select v.IdCode;
     clause.CodeIdValue = q.Single();
     DbUtil.Db.SubmitChanges();
     return Redirect("/QueryBuilder/Main/{0}".Fmt(qb.QueryId));
 }
Пример #2
0
 public ActionResult ContactTypeSearchBuilder(int id)
 {
     var cc = DbUtil.Db.ScratchPadCondition();
     cc.Reset(DbUtil.Db);
     var comp = CompareType.Equal;
     var clause = cc.AddNewClause(QueryType.RecentContactType, comp, "1,T");
     clause.Days = 10000;
     var cvc = new CodeValueModel();
     var q = from v in cvc.ContactTypeCodes()
             where v.Id == id
             select v.IdCode;
     clause.CodeIdValue = q.Single();
     cc.Save(DbUtil.Db);
     if (ViewExtensions2.UseNewLook())
         return Redirect("/Query/" + cc.Id);
     return Redirect("/QueryBuilder2/Main/{0}".Fmt(cc.Id));
 }
Пример #3
0
        private List GetContacts(int pid)
        {
            var ctl = new CodeValueModel();
            var cts = ctl.ContactTypeCodes();

            var cq = from ce in DbUtil.Db.Contactees
                     where ce.PeopleId == pid
                     where (ce.contact.LimitToRole ?? "") == ""
                     orderby ce.contact.ContactDate descending
                     select new
                     {
                         ce.contact,
                         madeby = ce.contact.contactsMakers.FirstOrDefault().person
                     };
            var list = new List(false, 10);
            list.ListSymbol = new Chunk("\u2022", font);
            var epip = (from p in DbUtil.Db.People
                        where p.PeopleId == pid
                        select new
                        {
                            ep = p.EntryPoint != null ? p.EntryPoint.Description : "",
                            ip = p.InterestPoint != null ? p.InterestPoint.Description : ""
                        }).Single();
            if (epip.ep.HasValue() || epip.ip.HasValue())
                list.Add(new ListItem(1.2f*font.Size, $"Entry, Interest: {epip.ep}, {epip.ip}", font));
            const int maxcontacts = 4;
            foreach (var pc in cq.Take(maxcontacts))
            {
                var cname = "unknown";
                if (pc.madeby != null)
                    cname = pc.madeby.Name;
                var ctyp = cts.SingleOrDefault(ct => ct.Id == pc.contact.ContactTypeId);
                string ctype = null;
                if (ctyp != null)
                    ctype = ctyp.Value;

                string comments = null;
                if (pc.contact.Comments.HasValue())
                    comments = pc.contact.Comments.Replace("\r\n\r\n", "\r\n");
                string s = $"{pc.contact.ContactDate:d}: {ctype} by {cname}\n{comments}";
                list.Add(new ListItem(1.2f*font.Size, s, font));
            }
            if (cq.Count() > maxcontacts)
                list.Add(new ListItem(1.2f*font.Size, $"(showing most recent 10 of {cq.Count()})", font));

            return list;
        }
Пример #4
0
        private List GetContacts(int pid)
        {
            var ctl = new CodeValueModel();
            var cts = ctl.ContactTypeCodes();

            var cq = from ce in DbUtil.Db.Contactees
                     where ce.PeopleId == pid
                     orderby ce.contact.ContactDate descending
                     select new
                     {
                         contact = ce.contact,
                         madeby = ce.contact.contactsMakers.FirstOrDefault().person,
                     };
            var list = new iTextSharp.text.List(false, 10);
            list.ListSymbol = new Chunk("\u2022", font);
            var epip = (from p in DbUtil.Db.People
                       where p.PeopleId == pid
                       select new
                       {
                           ep = p.EntryPoint != null ? p.EntryPoint.Description : "",
                           ip = p.InterestPoint != null ? p.InterestPoint.Description : ""
                       }).Single();
            if (epip.ep.HasValue() || epip.ip.HasValue())
                list.Add(new ListItem(1.2f * font.Size, "Entry, Interest: {0}, {1}".Fmt(epip.ep, epip.ip), font));
            const int maxcontacts = 4;
            foreach (var pc in cq.Take(maxcontacts))
            {
                var cname = "unknown";
                if (pc.madeby != null)
                    cname = pc.madeby.Name;
                string ctype = cts.Single(ct => ct.Id == pc.contact.ContactTypeId).Value;
                string comments = null;
                if (pc.contact.Comments.HasValue())
                    comments = pc.contact.Comments.Replace("\r\n\r\n", "\r\n");
                string s = "{0:d}: {1} by {2}\n{3}".Fmt(
                        pc.contact.ContactDate, ctype, cname, comments);
                list.Add(new iTextSharp.text.ListItem(1.2f * font.Size, s, font));
            }
            if (cq.Count() > maxcontacts)
                list.Add(new ListItem(1.2f * font.Size, "(showing most recent 10 of {0})".Fmt(cq.Count()), font));

            return list;
        }
Пример #5
0
        private List GetContacts(Person p)
        {
            var ctl = new CodeValueModel();
            var cts = ctl.ContactTypeCodes();

            var cq = from ce in DbUtil.Db.Contactees
                     where ce.PeopleId == p.PeopleId
                     where (ce.contact.LimitToRole ?? "") == ""
                     orderby ce.contact.ContactDate descending
                     select new
                     {
                         ce.contact,
                         madeby = ce.contact.contactsMakers.FirstOrDefault().person,
                     };
            var list = new iTextSharp.text.List(false, 10);
            list.ListSymbol = new Chunk("\u2022", font);
            var ep = p.EntryPoint != null ? p.EntryPoint.Description : "";
            var ip = p.InterestPoint != null ? p.InterestPoint.Description : "";
            if (ep.HasValue() || ip.HasValue())
                list.Add(new iTextSharp.text.ListItem(1.2f * font.Size, "Entry, Interest: {0}, {1}".Fmt(ep, ip), font));
            foreach (var pc in cq.Take(10))
            {
                var cname = "unknown";
                if (pc.madeby != null)
                    cname = pc.madeby.Name;
                string ctype = cts.ItemValue(pc.contact.ContactTypeId);
                string comments = null;
                if (pc.contact.Comments.HasValue())
                {
                    comments = pc.contact.Comments.Replace("\r\n\r\n", "\r\n");
                    var lines = Regex.Split(comments, "\r\n");
                    comments = string.Join("\r\n", lines.Take(6));
                    if (lines.Length > 6)
                        comments += "... (see rest of comment online)";
                }
                string s = "{0:d}: {1} by {2}\n{3}".Fmt(
                        pc.contact.ContactDate, ctype, cname, comments);
                list.Add(new iTextSharp.text.ListItem(1.2f * font.Size, s, font));
            }
            if (cq.Count() > 10)
                list.Add(new ListItem(1.2f * font.Size, "(showing most recent 10 of {0})".Fmt(cq.Count()), font));
            return list;
        }