Пример #1
0
        public override void ExecuteResult(ControllerContext context)
        {
            context.HttpContext.Response.ContentType = "text/xml";
            var settings = new XmlWriterSettings();

            settings.Encoding = new System.Text.UTF8Encoding(false);
            settings.Indent   = true;

            using (var w = XmlWriter.Create(context.HttpContext.Response.OutputStream, settings))
            {
                w.WriteStartElement("RollList");
                w.WriteAttributeString("MeetingId", MeetingId.ToString());
                if (NewPeopleId.HasValue)
                {
                    w.WriteAttributeString("NewPeopleId", NewPeopleId.ToString());
                }

                foreach (var p in RollsheetModel.RollList(MeetingId, OrgId, MeetingDate))
                {
                    w.WriteStartElement("Person");
                    w.WriteAttributeString("Id", p.PeopleId.ToString());
                    w.WriteAttributeString("Name", p.Name);
                    w.WriteAttributeString("Attended", p.Attended.ToString());
                    w.WriteAttributeString("Member", p.Member.ToString());
                    w.WriteEndElement();
                }
                w.WriteEndElement();
            }
        }
Пример #2
0
        public IEnumerable <RollsheetModel.AttendInfo> Attends(bool sorted = false, string highlight = null)
        {
            var rm = highlight == null
                ? RollsheetModel.RollList(meeting.MeetingId, meeting.OrganizationId, meeting.MeetingDate.Value, sorted, currmembers)
                : RollsheetModel.RollListHighlight(meeting.MeetingId, meeting.OrganizationId, meeting.MeetingDate.Value, sorted, currmembers, highlight);

            return(rm);
        }
Пример #3
0
 public RollListResult(Meeting meeting, int?PeopleId = null)
 {
     MeetingId   = meeting.MeetingId;
     NewPeopleId = PeopleId;
     if (meeting.MeetingDate != null)
     {
         people = RollsheetModel.RollList(MeetingId, meeting.OrganizationId, meeting.MeetingDate.Value);
     }
 }
Пример #4
0
        public List <RollsheetModel.AttendInfo> Attends(bool sorted = false, string highlight = null)
        {
            if (!meeting.MeetingDate.HasValue)
            {
                throw new Exception("Meeting should have a date");
            }
            var rm = highlight == null
                ? RollsheetModel.RollList(meeting.MeetingId, meeting.OrganizationId, meeting.MeetingDate.Value, sorted, currmembers, CommitsOnly)
                : RollsheetModel.RollListHighlight(meeting.MeetingId, meeting.OrganizationId, meeting.MeetingDate.Value, sorted, currmembers, highlight, CommitsOnly);

            return(rm);
        }
        public ActionResult FetchOrgRollList(string data)
        {
            // Authenticate first
            var result = AuthenticateUser();

            if (!result.IsValid)
            {
                return(AuthorizationError(result));
            }

            // Check Role
            if (!CMSRoleProvider.provider.IsUserInRole(AccountModel.UserName2, "Attendance"))
            {
                return(BaseMessage.createErrorReturn("Attendance roles is required to take attendance for organizations"));
            }

            // Check to see if type matches
            BaseMessage        dataIn = BaseMessage.createFromString(data);
            MobilePostRollList mprl   = JsonConvert.DeserializeObject <MobilePostRollList>(dataIn.data);

            var meetingId = DbUtil.Db.CreateMeeting(mprl.id, mprl.datetime);
            var people    = RollsheetModel.RollList(meetingId, mprl.id, mprl.datetime);

            var meeting = DbUtil.Db.Meetings.SingleOrDefault(m => m.MeetingId == meetingId);

            MobileRollList mrl = new MobileRollList();

            mrl.attendees        = new List <MobileAttendee>();
            mrl.meetingID        = meetingId;
            mrl.headcountEnabled = DbUtil.Db.Setting("RegularMeetingHeadCount", "true");
            mrl.headcount        = meeting.HeadCount ?? 0;

            BaseMessage br = new BaseMessage();

            br.id    = meetingId;
            br.error = 0;
            br.count = people.Count();

            foreach (var person in people)
            {
                mrl.attendees.Add(new MobileAttendee().populate(person));
            }

            br.data = JsonConvert.SerializeObject(mrl);
            return(br);
        }
Пример #6
0
        public ActionResult FetchOrgRollList(string data)
        {
            // Authenticate first
            var authError = Authenticate();

            if (authError != null)
            {
                return(authError);
            }

            // Check Role
            if (!CMSRoleProvider.provider.IsUserInRole(AccountModel.UserName2, "Attendance"))
            {
                return(BaseMessage.createErrorReturn("Attendance roles is required to take attendance for organizations"));
            }

            // Check to see if type matches
            BaseMessage dataIn = BaseMessage.createFromString(data);

            if (dataIn.type != BaseMessage.API_TYPE_ORG_ROLL_REFRESH)
            {
                return(BaseMessage.createTypeErrorReturn());
            }

            // Everything is in order, start the return
            MobilePostRollList mprl = JsonConvert.DeserializeObject <MobilePostRollList>(dataIn.data);

            var meeting = Meeting.FetchOrCreateMeeting(DbUtil.Db, mprl.id, mprl.datetime);
            var people  = RollsheetModel.RollList(meeting.MeetingId, meeting.OrganizationId, meeting.MeetingDate.Value);

            BaseMessage           br = new BaseMessage();
            List <MobileAttendee> ma = new List <MobileAttendee>();

            br.id    = meeting.MeetingId;
            br.error = 0;
            br.type  = BaseMessage.API_TYPE_ORG_ROLL_REFRESH;
            br.count = people.Count();

            foreach (var person in people)
            {
                ma.Add(new MobileAttendee().populate(person));
            }

            br.data = JsonConvert.SerializeObject(ma);
            return(br);
        }
Пример #7
0
        public IEnumerable <RollsheetModel.AttendInfo> VisitAttends(bool sorted = false)
        {
            var q = RollsheetModel.RollList(meeting.MeetingId, meeting.OrganizationId, meeting.MeetingDate.Value, sorted);

            return(q.Where(vv => !vv.Member && vv.Attended));
        }
Пример #8
0
 public IEnumerable <RollsheetModel.AttendInfo> Attends(bool sorted = false)
 {
     return(RollsheetModel.RollList(meeting.MeetingId, meeting.OrganizationId, meeting.MeetingDate.Value, sorted, currmembers));
 }
Пример #9
0
 public RollListResult(int orgid, DateTime dt)
 {
     MeetingId = DbUtil.Db.CreateMeeting(orgid, dt);
     people    = RollsheetModel.RollList(MeetingId, orgid, dt);
 }