コード例 #1
0
        public ActionResult Find(string id, string building, int? page, string querybit)
        {
            if (!Authenticate())
                return Content("not authorized");
            Response.NoCache();
            DbUtil.Db.SetNoLock();
            DbUtil.LogActivity("CheckinFind " + building + " " + id);

            var m = new CheckInModel();
            var matches = m.Find(id);

            if (!matches.Any())
                return new FindResult(0, building, querybit);
            if (matches.Count() == 1)
                return new FindResult(matches.Single().Familyid.Value, building, querybit);

            return new MultipleResult(matches, page);
        }
コード例 #2
0
 public ActionResult FetchBuildingActivities(string id)
 {
     if (!Authenticate())
         return Content("not authorized");
     var m = new CheckInModel();
     return Content(DbUtil.Db.Content($"BuildingCheckin-{id}.xml",
         "<BuildingActivity/>"), "text/xml");
 }
コード例 #3
0
 public ActionResult FetchPrintJobs(string id)
 {
     if (!Authenticate())
         return Content("not authorized");
     var m = new CheckInModel();
     var b = m.GetNextPrintJobs(id);
     return Content(b, "text/xml");
 }
コード例 #4
0
        public ContentResult UploadPrintJob(string id)
        {
            if (!Authenticate())
                return Content("not authorized");

            var reader = new StreamReader(Request.InputStream);
            var job = reader.ReadToEnd();

            var m = new CheckInModel();
            m.SavePrintJob(id, job);
            return Content("done");
        }
コード例 #5
0
        public ContentResult RecordAttend(int PeopleId, int OrgId, bool Present, int thisday, string kiosk)
        {
            if (!Authenticate())
                return Content("not authorized");

            DbUtil.LogActivity($"checkin {PeopleId}, {OrgId}, {(Present ? "attend0" : "unattend0")}");
            var m = new CheckInModel();
            m.RecordAttend(PeopleId, OrgId, Present, thisday);
            var r = new ContentResult();
            r.Content = "success";
            return r;
        }
コード例 #6
0
 public ContentResult Membership(int PeopleId, int OrgId, bool Member)
 {
     if (!Authenticate())
         return Content("not authorized");
     DbUtil.LogActivity($"checkin {PeopleId}, {OrgId}, {(Member ? "join" : "unjoin")}");
     var m = new CheckInModel();
     m.JoinUnJoinOrg(PeopleId, OrgId, Member);
     var r = new ContentResult();
     r.Content = "success";
     return r;
 }
コード例 #7
0
ファイル: FamilyResult.cs プロジェクト: panaitoh/bvcms
        public override void ExecuteResult(ControllerContext context)
        {
            context.HttpContext.Response.ContentType = "text/xml";
            var settings = new XmlWriterSettings()
            {
                Encoding = new System.Text.UTF8Encoding(false), Indent = true
            };

            using (var w = XmlWriter.Create(context.HttpContext.Response.OutputStream, settings))
            {
                var x = new APIWriter(w);
                x.NoDefaults = true;
                x.Start("Attendees");
                var m = new CheckInModel();
                List <CheckinFamilyMember> q;
                if (CheckInModel.UseOldCheckin())
                {
                    q = m.FamilyMembersOld(fid, campus, thisday);
                }
                else
                {
                    q = m.FamilyMembers(fid, campus, thisday);
                }

                x.Attr("familyid", fid);
                x.Attr("waslocked", waslocked);

                var count = q.Count();

                if (page > 0)
                {
                    const int INT_PageSize = 10;
                    var       startrow     = (page - 1) * INT_PageSize;
                    if (count > startrow + INT_PageSize)
                    {
                        x.Attr("next", (page + 1));
                    }
                    else
                    {
                        x.Attr("next", "");
                    }
                    if (page > 1)
                    {
                        x.Attr("prev", (page - 1));
                    }
                    else
                    {
                        x.Attr("prev", "");
                    }
                    q = q.Skip(startrow).Take(INT_PageSize).ToList();
                }
                x.Attr("maxlabels", DbUtil.Db.Setting("MaxLabels", "6"));

                // TODO: Consider the option to numbers only. Per Braden Kok @ Granite Springs
                var code = DbUtil.Db.NextSecurityCode().Select(c => c.Code).Single();
                x.Attr("securitycode", code);

                var accommodateCheckInBug = DbUtil.Db.Setting("AccommodateCheckinBug", "false").ToBool();

                foreach (var c in q)
                {
                    var parents = "";

                    if (c.Position == 30)
                    {
                        var child = (from e in DbUtil.Db.People
                                     where e.PeopleId == c.Id
                                     select e).SingleOrDefault();

                        if (child.Family.HeadOfHouseholdId != null)
                        {
                            parents = child.Family.HeadOfHousehold.FirstName;

                            if (child.Family.HeadOfHouseholdSpouseId != null)
                            {
                                parents += " & " + child.Family.HeadOfHouseholdSpouse.FirstName;
                            }
                        }
                        else if (child.Family.HeadOfHouseholdSpouseId != null)
                        {
                            parents = child.Family.HeadOfHouseholdSpouse.FirstName;
                        }
                    }

                    double hoursBeforeClassStarts = 0;
                    if (c.Hour.HasValue)
                    {
                        var midnight = c.Hour.Value.Date;
                        var now      = midnight.Add(Util.Now.TimeOfDay);
                        hoursBeforeClassStarts = c.Hour.Value.Subtract(now).TotalHours;
                        // TZOffset will be positive to the east, negative to the west
                        // but we are trying to get to central time so we subtract
                        // if tzoffset is +1 then we need to -1 to go to CentralTime.
                        hoursBeforeClassStarts -= DbUtil.Db.Setting("TZOffset", "0").ToInt();
                        // now we need to make sure we are within 24 hours (ignore the date change)
                        hoursBeforeClassStarts %= 24;
                    }
                    x.Start("attendee");
                    x.Attr("id", c.Id.ToString());
                    x.Attr("mv", c.MemberVisitor);
                    x.Attr("name", c.DisplayName);
                    x.Attr("preferredname", c.PreferredName);
                    x.Attr("first", accommodateCheckInBug ? c.PreferredName : c.First);
                    x.Attr("last", c.Last);
                    x.Attr("org", c.DisplayClass);
                    x.Attr("orgname", c.OrgName);
                    x.Attr("leader", c.Leader);
                    x.Attr("orgid", c.OrgId.ToString());
                    x.Attr("loc", c.Location);
                    x.Attr("gender", c.Genderid);
                    x.Attr("leadtime", hoursBeforeClassStarts.ToString());
                    x.Attr("age", Person.AgeDisplay(c.Age, c.Id).ToString());
                    x.Attr("numlabels", c.NumLabels.ToString());
                    x.Attr("checkedin", c.CheckedIn.ToString());
                    x.Attr("custody", c.Custody.ToString());
                    x.Attr("transport", c.Transport.ToString());
                    x.Attr("hour", c.Hour.FormatDateTm());
                    x.Attr("requiressecuritylabel", c.RequiresSecurityLabel.ToString());
                    x.Attr("church", c.Church);

                    x.Attr("email", c.Email);
                    x.Attr("dob", c.dob);
                    x.Attr("goesby", c.Goesby);
                    x.Attr("addr", c.Addr);
                    x.Attr("zip", c.Zip);
                    x.Attr("home", c.Home);
                    x.Attr("cell", c.Cell);
                    x.Attr("marital", c.Marital.ToString());
                    x.Attr("allergies", c.Allergies);
                    x.Attr("grade", c.Grade.ToString());
                    x.Attr("parent", c.Parent);
                    x.Attr("emfriend", c.Emfriend);
                    x.Attr("emphone", c.Emphone);
                    x.Attr("activeother", c.Activeother.ToString());
                    x.Attr("haspicture", c.HasPicture.ToString());

                    x.Attr("parents", parents);

                    x.End();
                }
                x.End();
            }
        }
コード例 #8
0
ファイル: FamilyResult.cs プロジェクト: davidbwire/bvcms
        public override void ExecuteResult(ControllerContext context)
        {
            context.HttpContext.Response.ContentType = "text/xml";
            var settings = new XmlWriterSettings()
            {
                Encoding = new System.Text.UTF8Encoding(false), Indent = true
            };

            using (var w = XmlWriter.Create(context.HttpContext.Response.OutputStream, settings))
            {
                w.WriteStartElement("Attendees");
                var             m = new CheckInModel();
                List <Attendee> q;
                if (kioskmode == true)
                {
                    q = m.FamilyMembersKiosk(fid, campus, thisday);
                }
                else
                {
                    q = m.FamilyMembers(fid, campus, thisday);
                }
                w.WriteAttributeString("familyid", fid.ToString());
                w.WriteAttributeString("waslocked", waslocked.ToString());

                var count = q.Count();

                if (page > 0)
                {
                    const int INT_PageSize = 10;
                    var       startrow     = (page - 1) * INT_PageSize;
                    if (count > startrow + INT_PageSize)
                    {
                        w.WriteAttributeString("next", (page + 1).ToString());
                    }
                    else
                    {
                        w.WriteAttributeString("next", "");
                    }
                    if (page > 1)
                    {
                        w.WriteAttributeString("prev", (page - 1).ToString());
                    }
                    else
                    {
                        w.WriteAttributeString("prev", "");
                    }
                    q = q.Skip(startrow).Take(INT_PageSize).ToList();
                }
                w.WriteAttributeString("maxlabels", DbUtil.Db.Setting("MaxLabels", "6"));
                var code = DbUtil.Db.NextSecurityCode(DateTime.Today).Select(c => c.Code).Single();
                w.WriteAttributeString("securitycode", code);

                var accommodateCheckInBug = DbUtil.Db.Setting("AccommodateCheckinBug", "false").ToBool();

                foreach (var c in q)
                {
                    double leadtime = 0;
                    if (c.Hour.HasValue)
                    {
                        var midnight = c.Hour.Value.Date;
                        var now      = midnight.Add(Util.Now.TimeOfDay);
                        leadtime  = c.Hour.Value.Subtract(now).TotalHours;
                        leadtime -= DbUtil.Db.Setting("TZOffset", "0").ToInt(); // positive to the east, negative to the west
                    }
                    w.WriteStartElement("attendee");
                    w.WriteAttributeString("id", c.Id.ToString());
                    w.WriteAttributeString("mv", c.MemberVisitor);
                    w.WriteAttributeString("name", c.DisplayName);
                    w.WriteAttributeString("preferredname", c.PreferredName);
                    if (accommodateCheckInBug)                     // bug in checkin requires this
                    {
                        w.WriteAttributeString("first", c.PreferredName);
                    }
                    else
                    {
                        w.WriteAttributeString("first", c.First);
                    }
                    w.WriteAttributeString("last", c.Last);
                    w.WriteAttributeString("org", c.DisplayClass);
                    w.WriteAttributeString("orgname", c.OrgName);
                    w.WriteAttributeString("leader", c.Leader);
                    w.WriteAttributeString("orgid", c.OrgId.ToString());
                    w.WriteAttributeString("loc", c.Location);
                    w.WriteAttributeString("gender", c.gender.ToString());
                    w.WriteAttributeString("leadtime", leadtime.ToString());
                    w.WriteAttributeString("age", c.Age.ToString());
                    w.WriteAttributeString("numlabels", c.NumLabels.ToString());
                    w.WriteAttributeString("checkedin", c.CheckedIn.ToString());
                    w.WriteAttributeString("custody", c.Custody.ToString());
                    w.WriteAttributeString("transport", c.Transport.ToString());
                    w.WriteAttributeString("hour", c.Hour.FormatDateTm());
                    w.WriteAttributeString("requiressecuritylabel", c.RequiresSecurityLabel.ToString());
                    w.WriteAttributeString("church", c.church);

                    w.WriteAttributeString("email", c.email);
                    w.WriteAttributeString("dob", c.dob);
                    w.WriteAttributeString("goesby", c.goesby);
                    w.WriteAttributeString("addr", c.addr);
                    w.WriteAttributeString("zip", c.zip);
                    w.WriteAttributeString("home", c.home);
                    w.WriteAttributeString("cell", c.cell);
                    w.WriteAttributeString("marital", c.marital.ToString());
                    w.WriteAttributeString("allergies", c.allergies);
                    w.WriteAttributeString("grade", c.grade.ToString());
                    w.WriteAttributeString("parent", c.parent);
                    w.WriteAttributeString("emfriend", c.emfriend);
                    w.WriteAttributeString("emphone", c.emphone);
                    w.WriteAttributeString("activeother", c.activeother.ToString());
                    w.WriteAttributeString("haspicture", c.HasPicture.ToString());

                    w.WriteEndElement();
                }
                w.WriteEndElement();
            }
        }
コード例 #9
0
ファイル: FamilyResult.cs プロジェクト: rossspoon/bvcms
        public override void ExecuteResult(ControllerContext context)
        {
            context.HttpContext.Response.ContentType = "text/xml";
            var settings = new XmlWriterSettings() { Encoding = new System.Text.UTF8Encoding(false), Indent = true };
            using (var w = XmlWriter.Create(context.HttpContext.Response.OutputStream, settings))
            {
                var x = new APIWriter(w);
                x.NoDefaults = true;
                x.Start("Attendees");
                var m = new CheckInModel();
                List<CheckinFamilyMember> q;
                if (CheckInModel.UseOldCheckin())
                    q = m.FamilyMembersOld(fid, campus, thisday);
                else
                    q = m.FamilyMembers(fid, campus, thisday);

                x.Attr("familyid", fid);
                x.Attr("waslocked", waslocked);

                var count = q.Count();

                if (page > 0)
                {
                    const int INT_PageSize = 10;
                    var startrow = (page - 1) * INT_PageSize;
                    if (count > startrow + INT_PageSize)
                        x.Attr("next", (page + 1));
                    else
                        x.Attr("next", "");
                    if (page > 1)
                        x.Attr("prev", (page - 1));
                    else
                        x.Attr("prev", "");
                    q = q.Skip(startrow).Take(INT_PageSize).ToList();
                }
                x.Attr("maxlabels", DbUtil.Db.Setting("MaxLabels", "6"));
                var code = DbUtil.Db.NextSecurityCode(DateTime.Today).Select(c => c.Code).Single();
                x.Attr("securitycode", code);

                var accommodateCheckInBug = DbUtil.Db.Setting("AccommodateCheckinBug", "false").ToBool();

                foreach (var c in q)
                {
                    double leadtime = 0;
                    if (c.Hour.HasValue)
                    {
                        var midnight = c.Hour.Value.Date;
                        var now = midnight.Add(Util.Now.TimeOfDay);
                        leadtime = c.Hour.Value.Subtract(now).TotalHours;
                        leadtime -= DbUtil.Db.Setting("TZOffset", "0").ToInt(); // positive to the east, negative to the west
                    }
                    x.Start("attendee");
                    x.Attr("id", c.Id.ToString());
                    x.Attr("mv", c.MemberVisitor);
                    x.Attr("name", c.DisplayName);
                    x.Attr("preferredname", c.PreferredName);
                    x.Attr("first", accommodateCheckInBug ? c.PreferredName : c.First);
                    x.Attr("last", c.Last);
                    x.Attr("org", c.DisplayClass);
                    x.Attr("orgname", c.OrgName);
                    x.Attr("leader", c.Leader);
                    x.Attr("orgid", c.OrgId.ToString());
                    x.Attr("loc", c.Location);
                    x.Attr("gender", c.Genderid);
                    x.Attr("leadtime", leadtime.ToString());
                    x.Attr("age", c.Age.ToString());
                    x.Attr("numlabels", c.NumLabels.ToString());
                    x.Attr("checkedin", c.CheckedIn.ToString());
                    x.Attr("custody", c.Custody.ToString());
                    x.Attr("transport", c.Transport.ToString());
                    x.Attr("hour", c.Hour.FormatDateTm());
                    x.Attr("requiressecuritylabel", c.RequiresSecurityLabel.ToString());
                    x.Attr("church", c.Church);

                    x.Attr("email", c.Email);
                    x.Attr("dob", c.dob);
                    x.Attr("goesby", c.Goesby);
                    x.Attr("addr", c.Addr);
                    x.Attr("zip", c.Zip);
                    x.Attr("home", c.Home);
                    x.Attr("cell", c.Cell);
                    x.Attr("marital", c.Marital.ToString());
                    x.Attr("allergies", c.Allergies);
                    x.Attr("grade", c.Grade.ToString());
                    x.Attr("parent", c.Parent);
                    x.Attr("emfriend", c.Emfriend);
                    x.Attr("emphone", c.Emphone);
                    x.Attr("activeother", c.Activeother.ToString());
                    x.Attr("haspicture", c.HasPicture.ToString());

                    x.End();
                }
                x.End();
            }
        }
コード例 #10
0
        public ActionResult Match(string id, int campus, int thisday, int? page, string kiosk, bool? kioskmode)
        {
            if (!Authenticate())
                return Content("not authorized");
            Response.NoCache();
            DbUtil.Db.SetNoLock();
            DbUtil.LogActivity("checkin " + id);

            List<CheckinMatch> matches;

            if (CheckInModel.UseOldCheckin())
            {
                var m = new CheckInModel();
                matches = m.MatchOld(id);
            }
            else
                matches = DbUtil.Db.CheckinMatch(id).ToList();

            if (!matches.Any())
                return new FamilyResult(0, campus, thisday, 0, false); // not found
            if (matches.Count() == 1)
                return new FamilyResult(matches.Single().Familyid.Value, campus, thisday, 0, matches[0].Locked ?? false);
            return new MultipleResult(matches, page);
        }
コード例 #11
0
ファイル: FamilyResult.cs プロジェクト: stevesloka/bvcms
		public override void ExecuteResult(ControllerContext context)
		{
			context.HttpContext.Response.ContentType = "text/xml";
			var settings = new XmlWriterSettings() { Encoding = new System.Text.UTF8Encoding(false), Indent = true };
			using (var w = XmlWriter.Create(context.HttpContext.Response.OutputStream, settings))
			{
				var x = new APIWriter(w);
				x.NoDefaults = true;
				x.Start("Attendees");
				var m = new CheckInModel();
				List<CheckinFamilyMember> q;
				if (CheckInModel.UseOldCheckin())
					q = m.FamilyMembersOld(fid, campus, thisday);
				else
					q = m.FamilyMembers(fid, campus, thisday);

				x.Attr("familyid", fid);
				x.Attr("waslocked", waslocked);

				var count = q.Count();

				if (page > 0)
				{
					const int INT_PageSize = 10;
					var startrow = (page - 1) * INT_PageSize;
					if (count > startrow + INT_PageSize)
						x.Attr("next", (page + 1));
					else
						x.Attr("next", "");
					if (page > 1)
						x.Attr("prev", (page - 1));
					else
						x.Attr("prev", "");
					q = q.Skip(startrow).Take(INT_PageSize).ToList();
				}
				x.Attr("maxlabels", DbUtil.Db.Setting("MaxLabels", "6"));

				// TODO: Consider the option to numbers only. Per Braden Kok @ Granite Springs
				var code = DbUtil.Db.NextSecurityCode(DateTime.Today).Select(c => c.Code).Single();
				x.Attr("securitycode", code);

				var accommodateCheckInBug = DbUtil.Db.Setting("AccommodateCheckinBug", "false").ToBool();

				foreach (var c in q)
				{
					var parents = "";

					if (c.Position == 30)
					{
						var child = (from e in DbUtil.Db.People
										 where e.PeopleId == c.Id
										 select e).SingleOrDefault();

						if (child.Family.HeadOfHouseholdId != null)
						{
							parents = child.Family.HeadOfHousehold.FirstName;

							if (child.Family.HeadOfHouseholdSpouseId != null)
							{
								parents += " & " + child.Family.HeadOfHouseholdSpouse.FirstName;
							}
						}
						else if (child.Family.HeadOfHouseholdSpouseId != null)
						{
							parents = child.Family.HeadOfHouseholdSpouse.FirstName;
						}
					}

					double hoursBeforeClassStarts = 0;
					if (c.Hour.HasValue)
					{
						var midnight = c.Hour.Value.Date;
						var now = midnight.Add(Util.Now.TimeOfDay);
						hoursBeforeClassStarts = c.Hour.Value.Subtract(now).TotalHours;
						// TZOffset will be positive to the east, negative to the west
						// but we are trying to get to central time so we subtract
						// if tzoffset is +1 then we need to -1 to go to CentralTime.
						hoursBeforeClassStarts -= DbUtil.Db.Setting("TZOffset", "0").ToInt();
						// now we need to make sure we are within 24 hours (ignore the date change)
						hoursBeforeClassStarts %= 24;
					}
					x.Start("attendee");
					x.Attr("id", c.Id.ToString());
					x.Attr("mv", c.MemberVisitor);
					x.Attr("name", c.DisplayName);
					x.Attr("preferredname", c.PreferredName);
					x.Attr("first", accommodateCheckInBug ? c.PreferredName : c.First);
					x.Attr("last", c.Last);
					x.Attr("org", c.DisplayClass);
					x.Attr("orgname", c.OrgName);
					x.Attr("leader", c.Leader);
					x.Attr("orgid", c.OrgId.ToString());
					x.Attr("loc", c.Location);
					x.Attr("gender", c.Genderid);
					x.Attr("leadtime", hoursBeforeClassStarts.ToString());
					x.Attr("age", c.Age.ToString());
					x.Attr("numlabels", c.NumLabels.ToString());
					x.Attr("checkedin", c.CheckedIn.ToString());
					x.Attr("custody", c.Custody.ToString());
					x.Attr("transport", c.Transport.ToString());
					x.Attr("hour", c.Hour.FormatDateTm());
					x.Attr("requiressecuritylabel", c.RequiresSecurityLabel.ToString());
					x.Attr("church", c.Church);

					x.Attr("email", c.Email);
					x.Attr("dob", c.dob);
					x.Attr("goesby", c.Goesby);
					x.Attr("addr", c.Addr);
					x.Attr("zip", c.Zip);
					x.Attr("home", c.Home);
					x.Attr("cell", c.Cell);
					x.Attr("marital", c.Marital.ToString());
					x.Attr("allergies", c.Allergies);
					x.Attr("grade", c.Grade.ToString());
					x.Attr("parent", c.Parent);
					x.Attr("emfriend", c.Emfriend);
					x.Attr("emphone", c.Emphone);
					x.Attr("activeother", c.Activeother.ToString());
					x.Attr("haspicture", c.HasPicture.ToString());

					x.Attr("parents", parents);

					x.End();
				}
				x.End();
			}
		}