コード例 #1
0
		/// <summary>
		/// Cooking up a method that will simulate checking in a person to a Occurrence
		/// to print out their check-in labels but without actually checking them in.
		/// </summary>
		protected void btnTest_Click( object sender, EventArgs e )
		{
			if ( tvLocations.CheckedNodes.Length > 0 && txtPersonID.Text.Trim() != string.Empty )
			{
				System.Collections.Generic.List<string> success = new System.Collections.Generic.List<string>();
				System.Collections.Generic.List<string> fails = new System.Collections.Generic.List<string>();
				foreach ( TreeViewNode node in tvLocations.CheckedNodes )
				{
					// skip all but level 1
					if ( node.Depth != 1 )
						continue;

					Location location = new Location( int.Parse( node.ID ) );
					try
					{
						IPrintLabel pl = PrintLabelHelper.GetPrintLabelClass( int.Parse( providerLookup.SelectedLookup.Value ) );

						// The IPrintLabel provider prints labels based on a given:
						// attendee, a collection of occurrences, and an attendance record.
						// Our particular provider will print to the location
						// that is set in the first occurrence.
						//
						// We will create multiple occurrences for the collection based
						// on the user's comma delimited start times from the form.
						OccurrenceCollection occurrences = new OccurrenceCollection();
						foreach ( string time in txtServices.Text.Split( ',' ) )
						{
							Occurrence occurrence = new Occurrence();
							occurrence.LocationID = location.LocationId;
							occurrence.StartTime = DateTime.Parse( DateTime.Now.ToShortDateString() + " " + time );
							occurrences.Add( occurrence );
						}

						OccurrenceAttendance attendance = new OccurrenceAttendance();
						attendance.SecurityCode = txtSecurityCode.Text;
						attendance.CheckInTime = DateTime.Now;

						FamilyMember attendee = new FamilyMember( int.Parse( txtPersonID.Text ) );

						pl.Print( attendee, occurrences, attendance, new Arena.Computer.ComputerSystem() );
						success.Add( string.Format( "{0} ({1})", location.LocationName, location.Printer.PrinterName ));
					}
					catch ( System.Exception ex )
					{
						fails.Add( string.Format( "{0} ({1})<BR>{2}", location.LocationName, location.Printer.PrinterName, ex.Message ) + "<BR>StackTrace: " + ex.StackTrace );
					}
				}

				if ( success.Count > 0 )
				{
					lblSuccessMessage.Text = "IPrintLabels Provider successfully printed to room (printer): " + string.Join( ", ", success.ToArray() ) + "<hr>";
					lblSuccessMessage.Visible = true;
				}
				if ( fails.Count > 0 )
				{
					lblErrorMessage.Text = string.Join( "<hr>Failure to print in room (printer):<br>", fails.ToArray() );
					lblErrorMessage.Visible = true;
				}
			}
		}
コード例 #2
0
        public static List <Occurrence> SetupOccurrenceSearchRoomBalancing(ComputerSystem kiosk)
        {
            List <Occurrence> occurrences = SetupOccurrenceSearchMultipleOccurrences(kiosk);
            var attribute = new OccurrenceTypeAttribute
            {
                OccurrenceTypeId = occurrences.First().OccurrenceTypeID,
                IsRoomBalancing  = true
            };

            attribute.Save(CheckInTestConstants.USER_ID);

            var person = CheckInTestFactories.CreateFamilyMember();

            person.Save(CheckInTestConstants.ORG_ID, CheckInTestConstants.USER_ID, false);
            var attendance = new OccurrenceAttendance
            {
                OccurrenceID = occurrences.First().OccurrenceID,
                PersonID     = person.PersonID,
                Attended     = true,
                CheckInTime  = DateTime.Now.AddMinutes(-2)
            };

            attendance.Save(CheckInTestConstants.USER_ID);
            return(occurrences);
        }
コード例 #3
0
        public void Print(FamilyMember person, IEnumerable <Occurrence> occurrences, OccurrenceAttendance attendance, ComputerSystem kiosk)
        {
            // Send the item to the real server...
            Organization.Organization organization = ArenaContext.Current.Organization;
            var proxyURI = organization.Settings["Cccev.PrintLabelURI"];

            if (string.IsNullOrEmpty(proxyURI))
            {
                throw new ApplicationException("Unable to request print label services.  Required Org Setting (Cccev.PrintLabelURI) must contain the URL to the print service.");
            }

            string data = string.Format("personID={0}&occurrenceIDs={1}&attendanceID={2}&kioskID={3}",
                                        person.PersonID, OccurrenceIDsToCSV(occurrences), attendance.OccurrenceAttendanceID, kiosk.SystemId);

            proxyURI = string.Format("{0}?{1}", proxyURI, data);

            HttpWebRequest webRequest = WebRequest.Create(proxyURI) as HttpWebRequest;

            using (HttpWebResponse response = webRequest.GetResponse() as HttpWebResponse)
            {
                if (response == null || response.StatusCode != HttpStatusCode.OK)
                {
                    throw new ApplicationException("There was a problem with the Print Label service.");
                }

                var  stream    = response.GetResponseStream();
                var  xr        = XmlReader.Create(stream);
                var  xdoc      = XDocument.Load(xr);
                bool isSuccess = bool.Parse(xdoc.Root.Value);
                if (!isSuccess)
                {
                    throw new ApplicationException("There was a problem with the Print Label service.");
                }
            }
        }
コード例 #4
0
        public void Print(FamilyMember person, IEnumerable <Occurrence> occurrences, OccurrenceAttendance attendance, ComputerSystem kiosk)
        {
            if (occurrences.Any(o => o is EmptyOccurrence))
            {
                throw new ApplicationException("Invalid Occurrence!");
            }

            return;
        }
コード例 #5
0
        public static OccurrenceAttendance CreateAttendance(Occurrence occurrence, Person attendee)
        {
            OccurrenceAttendance attendance = new OccurrenceAttendance
            {
                Attended     = true,
                CheckInTime  = DateTime.Now,
                OccurrenceID = occurrence.OccurrenceID,
                PersonID     = attendee.PersonID
            };

            return(attendance);
        }
コード例 #6
0
        public void btnNumberBoard_Click(object sender, CommandEventArgs e)
        {
            OccurrenceAttendance oa = new OccurrenceAttendance(Convert.ToInt32(e.CommandArgument));

            Arena.DataLayer.Organization.OrganizationData org = new Arena.DataLayer.Organization.OrganizationData();
            String securityNumber = oa.SecurityCode.Substring(2);
            int    promotionRequestID;


            //
            // Check if the security code is already posted.
            //
            promotionRequestID = FindPromotionRequest(oa.OccurrenceAttendanceID);
            if (promotionRequestID != -1)
            {
                PromotionRequest promotion = new PromotionRequest(promotionRequestID);

                promotion.Delete();
            }
            else
            {
                PromotionRequest promotion = new PromotionRequest();
                String           html;

                //
                // Generate the HTML for this note.
                //
                html = String.Format("<p id=\"SecurityCode\">{0}</p>", securityNumber);

                //
                // Create the new promotion.
                //
                if (CampusID != -1)
                {
                    promotion.Campus = new Campus(CampusID);
                }
                promotion.ContactName     = ArenaContext.Current.Person.FullName;
                promotion.ContactEmail    = "";
                promotion.ContactPhone    = "";
                promotion.Title           = oa.OccurrenceAttendanceID.ToString();
                promotion.TopicArea       = new Lookup(TopicAreaID);
                promotion.WebSummary      = html;
                promotion.WebPromote      = true;
                promotion.WebStartDate    = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
                promotion.WebEndDate      = promotion.WebStartDate.AddYears(1);
                promotion.WebApprovedBy   = ArenaContext.Current.User.Identity.Name;
                promotion.WebApprovedDate = DateTime.Now;
                promotion.Save(ArenaContext.Current.User.Identity.Name);
            }

            dgAttendance_ReBind(null, null);
        }
コード例 #7
0
        public void Print(FamilyMember person, IEnumerable <Occurrence> occurrences, OccurrenceAttendance attendance, ComputerSystem system)
        {
            // Don't new up Kiosk w/o empty constructor, might be too costly
            Kiosk kiosk = new Kiosk()
            {
                System = system
            };
            var           jobs    = kiosk.GetPrintJobs(attendance);
            ReportPrinter printer = new ReportPrinter();

            foreach (ReportPrintJob job in jobs)
            {
                printer.PrintReport(job.PrinterName, job.ReportPath, job.Copies, job.Landscape, job.Parameters, job.PrinterName);
            }
        }
コード例 #8
0
        private static OccurrenceAttendance LoadOccurrenceAttendance(SqlDataReader reader)
        {
            OccurrenceAttendance oa = new OccurrenceAttendance();

            if (!reader.IsDBNull(reader.GetOrdinal("occurrence_attendance_id")))
            {
                oa.OccurrenceAttendanceID = (int)reader["occurrence_attendance_id"];
            }

            if (!reader.IsDBNull(reader.GetOrdinal("occurrence_id")))
            {
                oa.OccurrenceID = (int)reader["occurrence_id"];
            }

            if (!reader.IsDBNull(reader.GetOrdinal("person_id")))
            {
                oa.PersonID = (int)reader["person_id"];
            }

            oa.SecurityCode = reader["security_code"].ToString();

            if (!reader.IsDBNull(reader.GetOrdinal("attended")))
            {
                oa.Attended = (bool)reader["attended"];
            }

            if (!reader.IsDBNull(reader.GetOrdinal("check_in_time")))
            {
                oa.CheckInTime = (DateTime)reader["check_in_time"];
            }

            if (!reader.IsDBNull(reader.GetOrdinal("check_out_time")))
            {
                oa.CheckOutTime = (DateTime)reader["check_out_time"];
            }

            oa.Notes = reader["notes"].ToString();
            oa.Pager = reader["pager"].ToString();

            if (!reader.IsDBNull(reader.GetOrdinal("type")))
            {
                string type = reader["type"].ToString();
                oa.Type = (OccurrenceAttendanceType)Enum.Parse(typeof(OccurrenceAttendanceType), type);
            }

            return(oa);
        }
コード例 #9
0
        public void Print(FamilyMember person, IEnumerable <Occurrence> occurrences, OccurrenceAttendance attendance, ComputerSystem system)
        {
            // Don't new up Kiosk w/o empty constructor, might be too costly
            Kiosk kiosk = new Kiosk()
            {
                System = system
            };
            var           jobs    = kiosk.GetPrintJobs(attendance);
            ReportPrinter printer = new ReportPrinter();

            // Work around a bug in the way the ReportPrinter.PrintReports(jobs) method works...
            // ...it uses impersonation which seems to cause some problems with printing on Win 2008 R2 SP1.
            foreach (ReportPrintJob job in jobs)
            {
                printer.PrintReport(job.PrinterName, job.ReportPath, job.Copies, job.Landscape, job.Parameters, job.PrinterName);
            }
        }
コード例 #10
0
        /// <summary>
        /// Intialize a person's label set with the information from the given person, occurrence(s),
        /// and attendance record.
        /// </summary>
        /// <param name="attendee"><see cref="Arena.Core.Person">Person</see> attending occurrence</param>
        /// <param name="occurrences">Collection of <see cref="Arena.Core.Occurrence">Occurrences</see> the attendee can check into</param>
        /// <param name="attendance"><see cref="Arena.Core.OccurrenceAttendance">OccurrenceAttendance</see> to be updated with failure status if print job fails</param>
        /// <param name="loc"></param>
        private void InitLabel(Person attendee, IEnumerable <Occurrence> occurrences, OccurrenceAttendance attendance, Location loc)
        {
            label = new CheckinLabel
            {
                FirstName     = attendee.NickName.Trim() != string.Empty ? attendee.NickName : attendee.FirstName,
                LastName      = attendee.LastName,
                FullName      = string.Format("{0} {1}", attendee.NickName, attendee.LastName),
                SecurityToken = attendance.SecurityCode,
                CheckInDate   = attendance.CheckInTime,
                RoomName      = loc.LocationName
            };

            StringBuilder services = new StringBuilder();

            foreach (Occurrence o in occurrences)
            {
                if (services.Length > 0)
                {
                    services.Append(", ");
                }

                services.Append(o.StartTime.ToShortTimeString());
            }

            label.Services     = services.ToString();
            label.BirthdayDate = attendee.BirthDate;
            SetAgeGroup(attendee);
            SetLabelFlags(attendee);
            LoadOrgSettings();
        }
コード例 #11
0
        public void btnRePrint_Click(object sender, CommandEventArgs e)
        {
            OccurrenceAttendance oa;
            FamilyMember         member;
            Occurrence           occurrence;
            List <Occurrence>    list;
            Boolean  status = false;
            Assembly asm;
            String   arenaBin;
            Type     t_controller;

            Type[]         paramTypes;
            ComputerSystem cs;


            //
            // Set the basic information we need to print the labels.
            //
            oa         = new OccurrenceAttendance(Int32.Parse(e.CommandArgument.ToString()));
            member     = new FamilyMember(oa.PersonID);
            occurrence = oa.Occurrence;
            list       = new List <Occurrence>(1);
            list.Add(occurrence);

            try
            {
                //
                // Find the location of the Arena bin directory and then try to load
                // the Cccev assembly file.
                //
                arenaBin = new Organization().GetType().Assembly.CodeBase.Split(new string[] { "/Arena." }, StringSplitOptions.None)[0];
                asm      = System.Reflection.Assembly.LoadFrom(arenaBin + "/Arena.Custom.Cccev.CheckIn.dll");

                //
                // Get the controller object from the assembly.
                //
                t_controller = asm.GetType("Arena.Custom.Cccev.CheckIn.CheckInController");

                //
                // Load the 2 methods we need from the Cccev assembly.
                //
                paramTypes = new Type[] { typeof(int), typeof(FamilyMember), typeof(IEnumerable <Occurrence>),
                                          typeof(OccurrenceAttendance), typeof(ComputerSystem) };
                System.Reflection.MethodInfo mi_Print = t_controller.GetMethod("Print", paramTypes);
                paramTypes = new Type[] { typeof(string) };
                System.Reflection.MethodInfo mi_GetCurrentKiosk = t_controller.GetMethod("GetCurrentKiosk", paramTypes);

                //
                // Call the GetCurrentKiosk method to find the
                // ComputerSystem object we need to print with.
                //
                cs = (ComputerSystem)mi_GetCurrentKiosk.Invoke(null, new String[] { Request.ServerVariables["REMOTE_ADDR"] });
                if (cs != null)
                {
                    //
                    // Try to print the person's name tags again.
                    //
                    object[] parameters = new object[] { LabelPrintProviderID, member, list, oa, cs };
                    status = (Boolean)mi_Print.Invoke(null, parameters);
                }
            }
            catch
            {
                status = false;
            }

            dgAttendance_ReBind(null, null);
        }
コード例 #12
0
        /// <summary>
        /// Attempts to load an OccurrenceAttendance by start time and person ID.
        /// </summary>
        /// <param name="oa">OccurrenceAttendance object this extension method will be used on (and return value).</param>
        /// <param name="startDate">occurrence start time</param>
        /// <param name="personID">person id</param>
        /// <returns>Returns null if nothing comes back from the database, otherwise returns a populated
        /// <see cref"Arena.Core.OccurrenceAttendance">OccurrenceAttendance</see>.</returns>
        public static OccurrenceAttendance LoadOccurrenceAttendanceByStartDateAndPersonID(this OccurrenceAttendance oa, DateTime startDate, int personID)
        {
            SqlDataReader reader = new XOccurrenceAttendanceData().GetOccurrenceAttendanceByStartDateAndPersonID(startDate, personID);

            if (reader.Read())
            {
                oa = LoadOccurrenceAttendance(reader);

                if (oa.OccurrenceAttendanceID.Equals(-1))
                {
                    oa = null;
                }
            }
            else
            {
                oa = null;
            }

            reader.Close();
            return(oa);
        }
コード例 #13
0
        /// <summary>
        /// IPrintLabel implementation to print out name tags.
        /// </summary>
        /// <param name="attendee"><see cref="Arena.Core.FamilyMember">FamilyMember</see> person attending</param>
        /// <param name="occurrences">IEnumerable<<see cref="Arena.Core.Occurrence">Occurrence</see> of services</param>
        /// <param name="attendance"><see cref="Arena.Core.OccurrenceAttendance">OccurrenceAttendance</see> attendance record</param>
        /// <param name="kiosk"><see cref="Arena.Computer.ComputerSystem">ComputerSystem</see> the family is standing at</param>
        void IPrintLabel.Print(FamilyMember attendee, IEnumerable <Occurrence> occurrences, OccurrenceAttendance attendance, ComputerSystem kiosk)
        {
            location = new Location(occurrences.First().LocationID);
            InitLabel(attendee, occurrences, attendance, location);

            OccurrenceTypeReportCollection reports = new OccurrenceTypeReportCollection(occurrences.First().OccurrenceTypeID);
            var report = reports.OfType <OccurrenceTypeReport>().FirstOrDefault();

            if ((report != null && report.UseDefaultPrinter) ||
                location.Printer.PrinterName.Equals("[Kiosk]", StringComparison.CurrentCultureIgnoreCase))
            {
                label.PrintAllLabels(kiosk.Printer.PrinterName);
            }
            else
            {
                label.PrintAllLabels(location.Printer.PrinterName);
            }
        }
コード例 #14
0
        /// <summary>
        /// Updates an existing Small Group Occurrence
        /// </summary>
        /// <param name="id">The GroupId</param>
        /// <param name="occurrence">The occurrence.</param>
        /// <returns>A ModifyResult object that indicates success or failure of the call.</returns>
        internal Services.Contracts.ModifyResult Update( int id, SmallGroupOccurrence occurrence )
        {
            GroupOccurrence arenaOccurrence = new GroupOccurrence( occurrence.OccurrenceID );
            Services.Contracts.ModifyResult result = new Services.Contracts.ModifyResult();

            if ( arenaOccurrence.GroupID <= 0 )
            {
                result.Successful = "False";
                result.ErrorMessage = "Occurrence was not found.";
            }
            if ( arenaOccurrence.GroupID != id )
            {
                result.Successful = "False";
                result.ErrorMessage = "Occurrence does not belong to the current group.";
                return result;
            }

            arenaOccurrence.Name = occurrence.Name;
            arenaOccurrence.Description = occurrence.Description;
            arenaOccurrence.StartTime = occurrence.Start;
            arenaOccurrence.EndTime = occurrence.End;

            arenaOccurrence.Save( ArenaContext.Current.User.Identity.Name );

            var didNotAttend = arenaOccurrence.OccurrenceAttendances.Attendees
                        .Where( a => a.Attended )
                        .Where( a => !occurrence.Attendees.Select( oa => oa.ID ).Contains( a.PersonID ) )
                        .Select( a => a.PersonID ).ToList();

            var attendeesToAdd = occurrence.Attendees.Where( a => !arenaOccurrence.OccurrenceAttendances.Attendees.Where( aa => aa.Attended )
                                                            .Select( aa => aa.PersonID ).Contains( a.ID ) )
                                                .Select( a => a.ID );

            foreach ( var nonAttendeePersonId in didNotAttend )
            {
                var notTheAttendee = arenaOccurrence.OccurrenceAttendances.Where( a => a.PersonID == nonAttendeePersonId ).FirstOrDefault();

                notTheAttendee.Attended = false;
                notTheAttendee.Save( ArenaContext.Current.User.Identity.Name );
            }

            foreach ( var attendeePersonId in attendeesToAdd )
            {
                var attendee = arenaOccurrence.OccurrenceAttendances.Where( a => a.PersonID == attendeePersonId ).FirstOrDefault();

                if ( attendee != null )
                {
                    attendee.Attended = true;
                }
                else
                {
                    attendee = new OccurrenceAttendance();
                    attendee.OccurrenceID = arenaOccurrence.OccurrenceID;
                    attendee.PersonID = attendeePersonId;
                    attendee.Attended = true;
                }

                attendee.Save( ArenaContext.Current.User.Identity.Name );

            }

            result.Successful = "True";
            return result;
        }
コード例 #15
0
        public void dgNote_ReBind(object sender, EventArgs e)
        {
            PromotionRequestCollection prc = new PromotionRequestCollection();
            DataTable dt   = new DataTable();
            ArrayList data = new ArrayList();


            dt.Columns.Add("promotion_id");
            dt.Columns.Add("number_string");
            dt.Columns.Add("created_date");
            dt.Columns.Add("created_string");
            dt.Columns.Add("created_by");
            dt.Columns.Add("first_name");
            dt.Columns.Add("full_name");
            dt.Columns.Add("sort_name");
            dt.Columns.Add("location_name");
            dt.Columns.Add("show_name");

            prc.LoadCurrentWebRequests(TopicAreaID.ToString(), "primary", CampusID, 1000, false, -1);
            foreach (PromotionRequest promotion in prc)
            {
                OccurrenceAttendance oa;
                DataRow row = dt.NewRow();

                try
                {
                    oa = new OccurrenceAttendance(Convert.ToInt32(promotion.Title));
                    row["first_name"]    = oa.Person.FirstName;
                    row["full_name"]     = oa.Person.FullName;
                    row["sort_name"]     = oa.Person.LastName + ", " + oa.Person.FirstName;
                    row["location_name"] = oa.Occurrence.Location;
                }
                catch
                {
                    row["first_name"]    = "";
                    row["full_name"]     = "";
                    row["sort_name"]     = "";
                    row["location_name"] = "";
                }
                row["promotion_id"]   = promotion.PromotionRequestID;
                row["created_date"]   = promotion.DateCreated;
                row["created_string"] = promotion.DateCreated.ToShortDateTimeString();
                row["created_by"]     = promotion.CreatedBy;
                row["show_name"]      = false;

                //
                // Pull out the number and status of the first name.
                //
                try
                {
                    XmlDocument xdoc = new XmlDocument();
                    xdoc.LoadXml("<body>" + promotion.WebSummary + "</body>");
                    row["number_string"] = xdoc.ChildNodes[0].ChildNodes[0].ChildNodes[0].Value.ToString();
                    if (xdoc.ChildNodes[0].ChildNodes.Count == 2)
                    {
                        row["show_name"] = true;
                    }
                }
                catch
                {
                }

                dt.Rows.Add(row);
            }

            dgNote.DataSource = dt;
            dgNote.DataBind();
        }
コード例 #16
0
        private string BuildDescription(Family family, OccurrenceAttendanceCollection attendances)
        {
            StringBuilder sb = new StringBuilder();

            FamilyMemberCollection adults   = family.Adults();
            FamilyMemberCollection children = family.Children();
            Address primaryAddress          = null;

            if (adults.Count > 0)
            {
                sb.Append("\nAdults:\n");
                foreach (FamilyMember adult in adults)
                {
                    sb.AppendFormat("+ {0}", adult.FullName, adult.Age.ToString());
                    if (primaryAddress == null)
                    {
                        primaryAddress = adult.PrimaryAddress;
                    }

                    if (adult.Age != -1)
                    {
                        sb.AppendFormat(" (Age {0})", adult.Age.ToString());
                    }

                    sb.Append("\n");
                }
            }

            if (children.Count > 0)
            {
                sb.Append("\nChildren:\n");
                foreach (FamilyMember child in children)
                {
                    sb.AppendFormat("+ {0}", child.FullName);

                    OccurrenceAttendance attendance = attendances.FindByID(child.PersonID);
                    if (attendance != null)
                    {
                        sb.AppendFormat(" (Checked into {0} {1} {2})",
                                        attendance.Occurrence.StartTime.DayOfWeek.ToString(),
                                        attendance.Occurrence.Name,
                                        attendance.Occurrence.OccurrenceType.TypeName);
                    }
                    else
                    if (child.Age != -1)
                    {
                        sb.AppendFormat(" (Age {0})", child.Age.ToString());
                    }

                    sb.Append("\n");

                    if (primaryAddress == null)
                    {
                        primaryAddress = child.PrimaryAddress;
                    }
                }
            }

            if (primaryAddress != null && primaryAddress.Area != null && primaryAddress.Area.AreaID != -1)
            {
                sb.AppendFormat("\nNeighborhood: {0}\n", primaryAddress.Area.Name);
                sb.Append(AreaCoordinators(primaryAddress.Area, RegionalPastorRoleID));
                sb.Append(AreaCoordinators(primaryAddress.Area, NeighborhoodLeaderRoleID));
            }
            sb.Append("\n");

            return(sb.ToString());
        }
コード例 #17
0
        /// <summary>
        /// Creates a new Small Group Occurrence
        /// </summary>
        /// <param name="id">The GroupId.</param>
        /// <param name="occurrence">The occurrence.</param>
        /// <returns></returns>
        internal Services.Contracts.ModifyResult Create( int id, SmallGroupOccurrence occurrence )
        {
            Services.Contracts.ModifyResult result = new Services.Contracts.ModifyResult();
            Group group = new Group( id );

            if ( group.GroupID <= 0 )
            {
                result.Successful = "False";
                result.ErrorMessage = "Group not found.";
            }

            DayOfWeek todayDOW = DateTime.Now.DayOfWeek;
            DayOfWeek meetingDOW = DayOfWeek.Sunday;

            if ( occurrence.Start == new DateTime( 1900, 1, 1 ) || occurrence.Start == DateTime.MinValue )
            {
                switch ( group.MeetingDay.Value.ToLower() )
                {
                    case "sunday":
                        meetingDOW = DayOfWeek.Sunday;
                        break;
                    case "monday":
                        meetingDOW = DayOfWeek.Monday;
                        break;
                    case "tuesday":
                        meetingDOW = DayOfWeek.Tuesday;
                        break;
                    case "wednesday":
                        meetingDOW = DayOfWeek.Wednesday;
                        break;
                    case "thursday":
                        meetingDOW = DayOfWeek.Thursday;
                        break;
                    case "friday":
                        meetingDOW = DayOfWeek.Friday;
                        break;
                    case "saturday":
                        meetingDOW = DayOfWeek.Saturday;
                        break;
                    default:
                        result.Successful = "False";
                        result.ErrorMessage = "Meeting Date was not provided and could not be determined from the group";
                        return result;
                }

                if ( meetingDOW <= todayDOW )
                {
                    //if meeting day for this week is the current day or a day in the past assume this week's meeting
                    occurrence.Start = new DateTime( DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, group.MeetingStartTime.Hour, group.MeetingStartTime.Minute, group.MeetingStartTime.Second )
                        .AddDays( -( todayDOW - meetingDOW ) );
                }
                else
                {
                    //if meeting day has not occurred yet assume last week's meeting.
                    int daysToSubtract = 7 - meetingDOW - todayDOW;
                    occurrence.Start = new DateTime( DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, group.MeetingStartTime.Hour, group.MeetingStartTime.Minute, group.MeetingStartTime.Second )
                        .AddDays( -daysToSubtract );
                }

                occurrence.End = new DateTime( occurrence.Start.Year, occurrence.Start.Month, occurrence.Start.Day, group.MeetingEndTime.Hour, group.MeetingEndTime.Minute, group.MeetingEndTime.Second );

            }

            if ( group.Occurrences.Where( o => o.StartTime.Date == occurrence.Start.Date ).Count() > 0 )
            {
                result.Successful = "False";
                result.ErrorMessage = string.Format( "Could not create an occurrence.  An occurrence already exists for {0}", occurrence.Start.Date );
                return result;
            }

            GroupOccurrence arenaOccurrence = new GroupOccurrence();
            if ( String.IsNullOrWhiteSpace( occurrence.Name ) )
            {
                arenaOccurrence.Name = string.Format( "{0} Occurrence", group.Name );
            }
            else
            {
                arenaOccurrence.Name = occurrence.Name;
            }

            arenaOccurrence.GroupID = group.GroupID;
            arenaOccurrence.OccurrenceTypeID = 230;
            arenaOccurrence.CheckInStart = new DateTime( 1900, 1, 1 );
            arenaOccurrence.CheckInEnd = new DateTime( 1900, 1, 1 );
            arenaOccurrence.StartTime = occurrence.Start;
            arenaOccurrence.EndTime = occurrence.End;
            //arenaOccurrence.Description = "Occurrence";
            arenaOccurrence.MembershipRequired = false;

            arenaOccurrence.Save( ArenaContext.Current.User.Identity.Name );

            foreach ( var a in occurrence.Attendees )
            {
                OccurrenceAttendance attendance = new OccurrenceAttendance();
                attendance.OccurrenceID = arenaOccurrence.OccurrenceID;
                attendance.PersonID = a.ID;
                attendance.Attended = true;
                attendance.Save( ArenaContext.Current.User.Identity.Name );
            }

            result.Successful = "True";
            return result;
        }
コード例 #18
0
        public WorkerResultStatus ProcessVisitors(out string message, out int state)
        {
            Trace.Write("Starting FirstTimeVisitAssignments Agent...\n");

            WorkerResultStatus workerResultStatus = WorkerResultStatus.Ok;

            message = string.Empty;
            state   = STATE_OK;

            try
            {
                //groupAssignmentType = new AssignmentType(GroupVisitAssignmentType);
                //if (groupAssignmentType.AssignmentTypeId == -1)
                //    throw new Exception("Invalid 'Neighborhood Group Assignment Type' setting");

                childAssignmentType = new AssignmentType(ChildVisitAssignmentType);
                if (childAssignmentType.AssignmentTypeId == -1)
                {
                    throw new Exception("Invalid 'Child Assignment Type' setting");
                }

                juniorHighAssignmentType = new AssignmentType(JuniorHighVisitAssignmentType);
                if (juniorHighAssignmentType.AssignmentTypeId == -1)
                {
                    throw new Exception("Invalid 'Junior High Assignment Type' setting");
                }

                highSchoolAssignmentType = new AssignmentType(HighSchoolVisitAssignmentType);
                if (highSchoolAssignmentType.AssignmentTypeId == -1)
                {
                    throw new Exception("Invalid 'High School Assignment Type' setting");
                }

                adultAssignmentType = new AssignmentType(AdultVisitAssignmentType);
                if (adultAssignmentType.AssignmentTypeId == -1)
                {
                    throw new Exception("Invalid 'Adult Assignment Type' setting");
                }

                //groupFamilyIDField = GetAssignmentTypeField(groupAssignmentType, "Family ID");
                //groupFirstVisitDateField = GetAssignmentTypeField(groupAssignmentType, "First Visit Date");

                childFamilyIDField       = GetAssignmentTypeField(childAssignmentType, "Family ID");
                childFirstVisitDateField = GetAssignmentTypeField(childAssignmentType, "First Visit Date");

                juniorHighFamilyIDField       = GetAssignmentTypeField(juniorHighAssignmentType, "Family ID");
                juniorHighFirstVisitDateField = GetAssignmentTypeField(juniorHighAssignmentType, "First Visit Date");

                highSchoolFamilyIDField       = GetAssignmentTypeField(highSchoolAssignmentType, "Family ID");
                highSchoolFirstVisitDateField = GetAssignmentTypeField(highSchoolAssignmentType, "First Visit Date");

                adultFamilyIDField       = GetAssignmentTypeField(adultAssignmentType, "Family ID");
                adultFirstVisitDateField = GetAssignmentTypeField(adultAssignmentType, "First Visit Date");

                Lookup child = new Lookup(SystemLookup.FamilyRole_Child);

                DateTime beginDate = DateTime.Today.Date.AddDays(-DaysBack);

                ArrayList lst = new ArrayList();
                lst.Add(new SqlParameter("@AttributeID", FirstTimeVisitAttributeID));
                lst.Add(new SqlParameter("@BeginDate", beginDate));
                //lst.Add(new SqlParameter("@GroupFamilyIDField", groupFamilyIDField.CustomFieldId));
                lst.Add(new SqlParameter("@ChildFamilyIDField", childFamilyIDField.CustomFieldId));
                lst.Add(new SqlParameter("@JuniorHighFamilyIDField", juniorHighFamilyIDField.CustomFieldId));
                lst.Add(new SqlParameter("@HighSchoolFamilyIDField", highSchoolFamilyIDField.CustomFieldId));
                lst.Add(new SqlParameter("@AdultFamilyIDField", adultFamilyIDField.CustomFieldId));

                Arena.DataLayer.Organization.OrganizationData oData = new Arena.DataLayer.Organization.OrganizationData();

                SqlDataReader rdr = oData.ExecuteReader("cust_ccv_recent_visitor_families", lst);

                while (rdr.Read())
                {
                    OccurrenceAttendanceCollection attendances = new OccurrenceAttendanceCollection();
                    //bool interestedInGroup = false;

                    Family family = new Family((int)rdr["family_id"]);

                    bool newFamily  = true;
                    int  childCount = 0;
                    int  adultCount = 0;
                    bool attendedHS = false;
                    bool attendedJH = false;

                    foreach (FamilyMember fm in family.FamilyMembers)
                    {
                        PersonAttribute pa = (PersonAttribute)fm.Attributes.FindByID(FirstTimeVisitAttributeID);
                        if (pa != null && !pa.DateValue.IsEmptyDate() && pa.DateValue < beginDate)
                        {
                            newFamily = false;
                        }

                        if (newFamily)
                        {
                            if (fm.FamilyRole.LookupID == child.LookupID)
                            {
                                childCount++;
                            }
                            else
                            {
                                adultCount++;
                            }

                            //pa = (PersonAttribute)fm.Attributes.FindByID(InterestedInGroupAttributeID);
                            //if (pa != null && pa.IntValue == 1)
                            //    interestedInGroup = true;

                            ArrayList lstOccurrence = new ArrayList();
                            lstOccurrence.Add(new SqlParameter("@PersonID", fm.PersonID));
                            SqlDataReader rdrOccurrence = oData.ExecuteReader("cust_ccv_recent_visitor_first_checkin", lstOccurrence);
                            if (rdrOccurrence.Read())
                            {
                                if (((DateTime)rdrOccurrence["first_attended"]).Date >= beginDate)
                                {
                                    OccurrenceAttendance oa = new OccurrenceAttendance((int)rdrOccurrence["occurrence_attendance_id"]);
                                    if (oa.Occurrence.OccurrenceType.OccurrenceTypeId == HighSchoolAttendanceTypeID)
                                    {
                                        attendedHS = true;
                                    }
                                    else if (oa.Occurrence.OccurrenceType.OccurrenceTypeId == JuniorHighAttendanceTypeID)
                                    {
                                        attendedJH = true;
                                    }

                                    attendances.Add(oa);
                                }
                            }
                            rdrOccurrence.Close();
                        }
                    }

                    if (newFamily)
                    {
                        _regionalPastorID = -1;

                        Assignment assignment = new Assignment();
                        assignment.Title             = family.FamilyName;
                        assignment.Description       = BuildDescription(family, attendances);
                        assignment.RequesterPersonId = family.FamilyHead.PersonID;

                        //if (interestedInGroup)
                        //{
                        //    assignment.AssignmentTypeId = groupAssignmentType.AssignmentTypeId;
                        //    assignment.PriorityId = groupAssignmentType.DefaultPriorityId;
                        //    assignment.StatusId = groupAssignmentType.DefaultStatusId;

                        //    AssignmentFieldValue familyIDField = new AssignmentFieldValue(groupFamilyIDField.CustomFieldId);
                        //    familyIDField.SelectedValue = family.FamilyID.ToString();
                        //    assignment.FieldValues.Add(familyIDField);

                        //    AssignmentFieldValue firstVisitDateField = new AssignmentFieldValue(groupFirstVisitDateField.CustomFieldId);
                        //    firstVisitDateField.SelectedValue = ((DateTime)rdr["first_visit"]).ToShortDateString();
                        //    assignment.FieldValues.Add(firstVisitDateField);

                        //    if (_regionalPastorID != -1)
                        //        assignment.SubmitAssignmentEntry(childAssignmentType.Owner != null ? adultAssignmentType.Owner : family.FamilyHead, "FirstTimeVisitAssignment Agent", _regionalPastorID);
                        //    else
                        //        assignment.SubmitAssignmentEntry(childAssignmentType.Owner != null ? adultAssignmentType.Owner : family.FamilyHead, "FirstTimeVisitAssignment Agent");
                        //}
                        //else
                        //{

                        if (attendedHS)
                        {
                            assignment.AssignmentTypeId = highSchoolAssignmentType.AssignmentTypeId;
                            assignment.PriorityId       = highSchoolAssignmentType.DefaultPriorityId;

                            AssignmentFieldValue familyIDField = new AssignmentFieldValue(highSchoolFamilyIDField.CustomFieldId);
                            familyIDField.SelectedValue = family.FamilyID.ToString();
                            assignment.FieldValues.Add(familyIDField);

                            AssignmentFieldValue firstVisitDateField = new AssignmentFieldValue(highSchoolFirstVisitDateField.CustomFieldId);
                            firstVisitDateField.SelectedValue = ((DateTime)rdr["first_visit"]).ToShortDateString();
                            assignment.FieldValues.Add(firstVisitDateField);

                            assignment.SubmitAssignmentEntry(highSchoolAssignmentType.Owner != null ? highSchoolAssignmentType.Owner : family.FamilyHead, "FirstTimeVisitAssignment Agent");
                        }
                        else if (attendedJH)
                        {
                            assignment.AssignmentTypeId = juniorHighAssignmentType.AssignmentTypeId;
                            assignment.PriorityId       = juniorHighAssignmentType.DefaultPriorityId;

                            AssignmentFieldValue familyIDField = new AssignmentFieldValue(juniorHighFamilyIDField.CustomFieldId);
                            familyIDField.SelectedValue = family.FamilyID.ToString();
                            assignment.FieldValues.Add(familyIDField);

                            AssignmentFieldValue firstVisitDateField = new AssignmentFieldValue(juniorHighFirstVisitDateField.CustomFieldId);
                            firstVisitDateField.SelectedValue = ((DateTime)rdr["first_visit"]).ToShortDateString();
                            assignment.FieldValues.Add(firstVisitDateField);

                            assignment.SubmitAssignmentEntry(highSchoolAssignmentType.Owner != null ? juniorHighAssignmentType.Owner : family.FamilyHead, "FirstTimeVisitAssignment Agent");
                        }
                        else if (childCount == 0)
                        {
                            assignment.AssignmentTypeId = adultAssignmentType.AssignmentTypeId;
                            assignment.PriorityId       = adultAssignmentType.DefaultPriorityId;

                            AssignmentFieldValue familyIDField = new AssignmentFieldValue(adultFamilyIDField.CustomFieldId);
                            familyIDField.SelectedValue = family.FamilyID.ToString();
                            assignment.FieldValues.Add(familyIDField);

                            AssignmentFieldValue firstVisitDateField = new AssignmentFieldValue(adultFirstVisitDateField.CustomFieldId);
                            firstVisitDateField.SelectedValue = ((DateTime)rdr["first_visit"]).ToShortDateString();
                            assignment.FieldValues.Add(firstVisitDateField);

                            assignment.SubmitAssignmentEntry(adultAssignmentType.Owner != null ? adultAssignmentType.Owner : family.FamilyHead, "FirstTimeVisitAssignment Agent");
                        }
                        else if (adultCount > 0)
                        {
                            assignment.AssignmentTypeId = childAssignmentType.AssignmentTypeId;
                            assignment.PriorityId       = childAssignmentType.DefaultPriorityId;

                            AssignmentFieldValue familyIDField = new AssignmentFieldValue(childFamilyIDField.CustomFieldId);
                            familyIDField.SelectedValue = family.FamilyID.ToString();
                            assignment.FieldValues.Add(familyIDField);

                            AssignmentFieldValue firstVisitDateField = new AssignmentFieldValue(childFirstVisitDateField.CustomFieldId);
                            firstVisitDateField.SelectedValue = ((DateTime)rdr["first_visit"]).ToShortDateString();
                            assignment.FieldValues.Add(firstVisitDateField);

                            assignment.SubmitAssignmentEntry(childAssignmentType.Owner != null ? childAssignmentType.Owner : family.FamilyHead, "FirstTimeVisitAssignment Agent");
                        }
                    }
                }
                rdr.Close();
            }
            catch (Exception ex)
            {
                workerResultStatus = WorkerResultStatus.Exception;
                message            = "An error occured while processing First Time Visitor Assignments.\n\nMessage\n------------------------\n" + ex.Message + "\n\nStack Trace\n------------------------\n" + ex.StackTrace;
            }
            finally
            {
            }

            return(workerResultStatus);
        }
コード例 #19
0
        /// <summary>
        /// Intialize a person's label set with the information from the given person, occurrence(s),
        /// and attendance record.
        /// </summary>
        /// <param name="attendee"><see cref="Arena.Core.Person">Person</see> attending occurrence</param>
        /// <param name="occurrences">Collection of <see cref="Arena.Core.Occurrence">Occurrences</see> the attendee can check into</param>
        /// <param name="attendance"><see cref="Arena.Core.OccurrenceAttendance">OccurrenceAttendance</see> to be updated with failure status if print job fails</param>
        /// <param name="loc"></param>
        private void InitLabel(Person attendee, IEnumerable <Occurrence> occurrences, OccurrenceAttendance attendance, Location loc)
        {
            // Change required for Extreme Week (formerly VBS) Request #7093
            // http://arena/arena/default.aspx?page=3989&parCurrentGroup=Assignments&assignmentID=7093
            string displayValue = loc.LocationName;
            var    x            = occurrences.First();
            int    tagId        = occurrences.First().OccurrenceType.SyncWithProfile;

            if (tagId != Constants.NULL_INT)
            {
                bool useTagName = false;
                if (bool.TryParse(organization.Settings["Cccev.UseTagNameInsteadOfRoomName"], out useTagName) && useTagName)
                {
                    displayValue = ProfileCache(tagId);
                }
            }

            label = new CheckinLabel
            {
                FirstName     = attendee.NickName.Trim() != string.Empty ? attendee.NickName : attendee.FirstName,
                LastName      = attendee.LastName,
                FullName      = string.Format("{0} {1}", attendee.NickName, attendee.LastName),
                SecurityToken = attendance.SecurityCode,
                CheckInDate   = attendance.CheckInTime,
                RoomName      = displayValue
            };

            StringBuilder services = new StringBuilder();

            foreach (Occurrence o in occurrences)
            {
                if (services.Length > 0)
                {
                    services.Append(", ");
                }

                services.Append(o.StartTime.ToShortTimeString());
            }

            label.Services     = services.ToString();
            label.BirthdayDate = attendee.BirthDate;
            SetAgeGroup(attendee);
            SetLabelFlags(attendee);
            LoadOrgSettings();
        }
コード例 #20
0
        /// <summary>
        /// Creates a new Small Group Occurrence
        /// </summary>
        /// <param name="id">The GroupId.</param>
        /// <param name="occurrence">The occurrence.</param>
        /// <returns></returns>
        internal Services.Contracts.ModifyResult Create(int id, SmallGroupOccurrence occurrence)
        {
            Services.Contracts.ModifyResult result = new Services.Contracts.ModifyResult();
            Group group = new Group(id);

            if (group.GroupID <= 0)
            {
                result.Successful   = "False";
                result.ErrorMessage = "Group not found.";
            }

            DayOfWeek todayDOW   = DateTime.Now.DayOfWeek;
            DayOfWeek meetingDOW = DayOfWeek.Sunday;

            if (occurrence.Start == new DateTime(1900, 1, 1) || occurrence.Start == DateTime.MinValue)
            {
                switch (group.MeetingDay.Value.ToLower())
                {
                case "sunday":
                    meetingDOW = DayOfWeek.Sunday;
                    break;

                case "monday":
                    meetingDOW = DayOfWeek.Monday;
                    break;

                case "tuesday":
                    meetingDOW = DayOfWeek.Tuesday;
                    break;

                case "wednesday":
                    meetingDOW = DayOfWeek.Wednesday;
                    break;

                case "thursday":
                    meetingDOW = DayOfWeek.Thursday;
                    break;

                case "friday":
                    meetingDOW = DayOfWeek.Friday;
                    break;

                case "saturday":
                    meetingDOW = DayOfWeek.Saturday;
                    break;

                default:
                    result.Successful   = "False";
                    result.ErrorMessage = "Meeting Date was not provided and could not be determined from the group";
                    return(result);
                }

                if (meetingDOW <= todayDOW)
                {
                    //if meeting day for this week is the current day or a day in the past assume this week's meeting
                    occurrence.Start = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, group.MeetingStartTime.Hour, group.MeetingStartTime.Minute, group.MeetingStartTime.Second)
                                       .AddDays(-(todayDOW - meetingDOW));
                }
                else
                {
                    //if meeting day has not occurred yet assume last week's meeting.
                    int daysToSubtract = 7 - meetingDOW - todayDOW;
                    occurrence.Start = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, group.MeetingStartTime.Hour, group.MeetingStartTime.Minute, group.MeetingStartTime.Second)
                                       .AddDays(-daysToSubtract);
                }

                occurrence.End = new DateTime(occurrence.Start.Year, occurrence.Start.Month, occurrence.Start.Day, group.MeetingEndTime.Hour, group.MeetingEndTime.Minute, group.MeetingEndTime.Second);
            }

            if (group.Occurrences.Where(o => o.StartTime.Date == occurrence.Start.Date).Count() > 0)
            {
                result.Successful   = "False";
                result.ErrorMessage = string.Format("Could not create an occurrence.  An occurrence already exists for {0}", occurrence.Start.Date);
                return(result);
            }

            GroupOccurrence arenaOccurrence = new GroupOccurrence();

            if (String.IsNullOrWhiteSpace(occurrence.Name))
            {
                arenaOccurrence.Name = string.Format("{0} Occurrence", group.Name);
            }
            else
            {
                arenaOccurrence.Name = occurrence.Name;
            }

            arenaOccurrence.GroupID          = group.GroupID;
            arenaOccurrence.OccurrenceTypeID = 230;
            arenaOccurrence.CheckInStart     = new DateTime(1900, 1, 1);
            arenaOccurrence.CheckInEnd       = new DateTime(1900, 1, 1);
            arenaOccurrence.StartTime        = occurrence.Start;
            arenaOccurrence.EndTime          = occurrence.End;
            //arenaOccurrence.Description = "Occurrence";
            arenaOccurrence.MembershipRequired = false;

            arenaOccurrence.Save(ArenaContext.Current.User.Identity.Name);

            foreach (var a in occurrence.Attendees)
            {
                OccurrenceAttendance attendance = new OccurrenceAttendance();
                attendance.OccurrenceID = arenaOccurrence.OccurrenceID;
                attendance.PersonID     = a.ID;
                attendance.Attended     = true;
                attendance.Save(ArenaContext.Current.User.Identity.Name);
            }

            result.Successful = "True";
            return(result);
        }
コード例 #21
0
        /// <summary>
        /// Updates an existing Small Group Occurrence
        /// </summary>
        /// <param name="id">The GroupId</param>
        /// <param name="occurrence">The occurrence.</param>
        /// <returns>A ModifyResult object that indicates success or failure of the call.</returns>
        internal Services.Contracts.ModifyResult Update(int id, SmallGroupOccurrence occurrence)
        {
            GroupOccurrence arenaOccurrence = new GroupOccurrence(occurrence.OccurrenceID);

            Services.Contracts.ModifyResult result = new Services.Contracts.ModifyResult();

            if (arenaOccurrence.GroupID <= 0)
            {
                result.Successful   = "False";
                result.ErrorMessage = "Occurrence was not found.";
            }
            if (arenaOccurrence.GroupID != id)
            {
                result.Successful   = "False";
                result.ErrorMessage = "Occurrence does not belong to the current group.";
                return(result);
            }

            arenaOccurrence.Name        = occurrence.Name;
            arenaOccurrence.Description = occurrence.Description;
            arenaOccurrence.StartTime   = occurrence.Start;
            arenaOccurrence.EndTime     = occurrence.End;

            arenaOccurrence.Save(ArenaContext.Current.User.Identity.Name);

            var didNotAttend = arenaOccurrence.OccurrenceAttendances.Attendees
                               .Where(a => a.Attended)
                               .Where(a => !occurrence.Attendees.Select(oa => oa.ID).Contains(a.PersonID))
                               .Select(a => a.PersonID).ToList();

            var attendeesToAdd = occurrence.Attendees.Where(a => !arenaOccurrence.OccurrenceAttendances.Attendees.Where(aa => aa.Attended)
                                                            .Select(aa => aa.PersonID).Contains(a.ID))
                                 .Select(a => a.ID);


            foreach (var nonAttendeePersonId in didNotAttend)
            {
                var notTheAttendee = arenaOccurrence.OccurrenceAttendances.Where(a => a.PersonID == nonAttendeePersonId).FirstOrDefault();

                notTheAttendee.Attended = false;
                notTheAttendee.Save(ArenaContext.Current.User.Identity.Name);
            }

            foreach (var attendeePersonId in attendeesToAdd)
            {
                var attendee = arenaOccurrence.OccurrenceAttendances.Where(a => a.PersonID == attendeePersonId).FirstOrDefault();

                if (attendee != null)
                {
                    attendee.Attended = true;
                }
                else
                {
                    attendee = new OccurrenceAttendance();
                    attendee.OccurrenceID = arenaOccurrence.OccurrenceID;
                    attendee.PersonID     = attendeePersonId;
                    attendee.Attended     = true;
                }

                attendee.Save(ArenaContext.Current.User.Identity.Name);
            }

            result.Successful = "True";
            return(result);
        }
コード例 #22
0
ファイル: NullPrintLabel.cs プロジェクト: CentralAZ/ArenaChMS
 /// <summary>
 /// Empty Print method to consume IPrintLabel contract, but do nothing with it.
 /// </summary>
 /// <param name="person"></param>
 /// <param name="occurrences"></param>
 /// <param name="attendance"></param>
 /// <param name="kiosk"></param>
 public void Print(FamilyMember person, IEnumerable <Occurrence> occurrences, OccurrenceAttendance attendance, ComputerSystem kiosk)
 {
 }
コード例 #23
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            GroupOccurrence occurrence = FindOccurrenceByDate(group.Occurrences, groupDate);

            if (occurrence == null)
            {
                occurrence                  = new GroupOccurrence();
                occurrence.GroupID          = group.GroupID;
                occurrence.OccurrenceID     = -1;
                occurrence.OccurrenceTypeID = Convert.ToInt32(OccurrenceTypeSetting);
                occurrence.Name             = group.Title;
                occurrence.StartTime        = groupDate;
                occurrence.EndTime          = groupDate;
                group.Occurrences.Add(occurrence);
            }

            occurrence.OccurrenceClosed = cbNoMeet.Checked;
            occurrence.Save(CurrentUser.Identity.Name);

            if (occurrence.OccurrenceClosed)
            {
                foreach (OccurrenceAttendance attendance in occurrence.OccurrenceAttendances)
                {
                    attendance.Delete();
                }
            }
            else
            {
                foreach (ListViewDataItem item in lvMembers.Items)
                {
                    CheckBox cb = (CheckBox)item.FindControl("cbMember");
                    if (cb != null)
                    {
                        int personId = Int32.Parse(cb.Attributes["memberid"]);
                        OccurrenceAttendance attendance = new OccurrenceAttendance(occurrence.OccurrenceID, personId);
                        attendance.OccurrenceID = occurrence.OccurrenceID;
                        attendance.PersonID     = personId;
                        attendance.Attended     = cb.Checked;

                        if (attendance.Attended)
                        {
                            attendance.Save(CurrentUser.Identity.Name);
                        }
                        else
                        {
                            if (attendance.OccurrenceAttendanceID != -1)
                            {
                                if (attendance.PersonID == -1 || attendance.Notes == string.Empty)
                                {
                                    attendance.Delete();
                                }
                                else
                                {
                                    attendance.Save(CurrentUser.Identity.Name);
                                }
                            }
                        }
                    }
                }
            }

            ShowMessage(string.Format("Attendance has been saved for {0}", groupDate.ToLongDateString()), false);

            ShowAttendance();
        }
コード例 #24
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            GroupOccurrence occurrence = null;
            int             headCount  = Convert.ToInt32(tbHeadCount.Text);
            string          note       = tbNote.Text;

            if (ViewState["OccurrenceID"] != null)
            {
                occurrence = new GroupOccurrence((int)ViewState["OccurrenceID"]);
                if (occurrence.StartTime.Date != dtDate.SelectedDate)
                {
                    occurrence = null;
                }
            }

            if (occurrence == null)
            {
                occurrence                  = new GroupOccurrence();
                occurrence.GroupID          = group.GroupID;
                occurrence.OccurrenceID     = -1;
                occurrence.OccurrenceTypeID = Convert.ToInt32(OccurrenceTypeSetting);
                occurrence.Name             = OccurrenceNameSetting;
                occurrence.StartTime        = dtDate.SelectedDate;
                occurrence.EndTime          = dtDate.SelectedDate;
                occurrence.HeadCount        = headCount;
                occurrence.Description      = note;
                occurrence.Save(CurrentUser.Identity.Name);
            }

            foreach (ListItem li in cblAttendees.Items)
            {
                OccurrenceAttendance attendance = new OccurrenceAttendance(occurrence.OccurrenceID, Convert.ToInt32(li.Value));
                attendance.OccurrenceID = occurrence.OccurrenceID;
                attendance.PersonID     = Convert.ToInt32(li.Value);
                attendance.Attended     = li.Selected;

                if (attendance.Attended)
                {
                    attendance.Save(CurrentUser.Identity.Name);
                }
                else
                {
                    if (attendance.OccurrenceAttendanceID != -1)
                    {
                        if (attendance.PersonID == -1 || attendance.Notes == string.Empty)
                        {
                            attendance.Delete();
                        }
                        else
                        {
                            attendance.Save(CurrentUser.Identity.Name);
                        }
                    }
                }
            }

            occurrence.HeadCount   = headCount;
            occurrence.Description = note;
            occurrence.Save(CurrentUser.Identity.Name);

            occurrence = null;
            ShowAttendance(occurrence);

            ShowOccurrences();

            if (RedirectPageIDSetting != "")
            {
                string URLGroupID = Request.Params["group"];
                Response.Redirect(string.Format("default.aspx?page={0}&group={1}", RedirectPageIDSetting, URLGroupID));
            }
        }