public void Deserialize(string json) { var deserializedEventList = new SignInEventList(); using (var ms = new MemoryStream(Encoding.UTF8.GetBytes(json))) { var serializer = new DataContractJsonSerializer(deserializedEventList.GetType()); deserializedEventList = serializer.ReadObject(ms) as SignInEventList; ms.Close(); } EventList = deserializedEventList.EventList; }
public SignInEventList GetEventsByNumber(int number) { SignInEventList ret = new SignInEventList(); foreach (SignInEvent inEvent in EventList) { if (inEvent.Number == number) { ret.AddMember(inEvent); } } return(ret); }
public SignInEventList GetEventsByDate(DateTime date) { SignInEventList ret = new SignInEventList(); foreach (SignInEvent inEvent in EventList) { if (inEvent.SignInYear == date.Year && inEvent.SignInMonth == date.Month && inEvent.SignInDate == date.Day) { ret.AddMember(inEvent); } } return(ret); }
/** * Returns true if tracked data is unloaded, returns false otherwise */ public bool TrackAndUnloadNumber(int number, ref SignInEventList unloadList) { foreach (SignInEvent inEvent in EventList) { if (inEvent.Number == number) { inEvent.TrackTime(DateTime.Now); unloadList.AddMember(inEvent); EventList.Remove(inEvent); return(true); } } EventList.Add(new SignInEvent(number, DateTime.Now)); return(false); }
public InfoForm(Member member) { //initialize properties Member = member; SignEventList = MainProgram.AppState.SignedOut.GetEventsByNumber(Member.Number); //initialize components InitializeComponent(); //set components eventList.ListViewItemSorter = eventListSorter; updateEventList(); firstNameSpace.Text = Member.FirstName; lastNameSpace.Text = Member.LastName; numberSpace.Text = "" + Member.Number; hoursSpace.Text = "" + SignEventList.SumTime().TotalHours; }