public void AddTeeTime() { bool AllMemberQualified = true; DailyTeeTimeSheet DedesireTeeTime = new DailyTeeTimeSheet(); DedesireTeeTime.Date = Date; DedesireTeeTime.Teetime = AList; DedesireTeeTime.Member1Number = Member1Number; DedesireTeeTime.Member2Number = Member2Number; DedesireTeeTime.Member3Number = Member3Number; DedesireTeeTime.Member4Number = Member4Number; DedesireTeeTime.Phone = Phone; DedesireTeeTime.NumberOfCarts = NumOfCarts; DedesireTeeTime.Time = Time; List <TeeTimeMember> MemberList = new List <TeeTimeMember>(); TeeTimeMember member = new TeeTimeMember(); member.Date = DedesireTeeTime.Date; member.Teetime = DedesireTeeTime.Teetime; member.MemberNumber = DedesireTeeTime.Member1Number; MemberList.Add(member); if (Member2Number != null) { member = new TeeTimeMember(); member.Date = DedesireTeeTime.Date; member.Teetime = DedesireTeeTime.Teetime; member.MemberNumber = DedesireTeeTime.Member2Number; MemberList.Add(member); } if (Member3Number != null) { member = new TeeTimeMember(); member.Date = DedesireTeeTime.Date; member.Teetime = DedesireTeeTime.Teetime; member.MemberNumber = DedesireTeeTime.Member3Number; MemberList.Add(member); } if (Member4Number != null) { member = new TeeTimeMember(); member.Date = DedesireTeeTime.Date; member.Teetime = DedesireTeeTime.Teetime; member.MemberNumber = DedesireTeeTime.Member4Number; MemberList.Add(member); } foreach (TeeTimeMember member1 in MemberList) { if (ISMemberNumberQualified(member1.MemberNumber) == false) { Message = "Number Number: " + member1.MemberNumber + " Not exist or not qualified; " + Message; AllMemberQualified = false; } } if (AllMemberQualified == true) { bool Confirmation = RequestDirector.AddTeeTime(DedesireTeeTime, MemberList); if (Confirmation == true) { Message = "Successfully Booked TeeTime on " + Date + " at " + AList; } else { Message = "Booked TeeTime: Failed"; } } }
public void UpdateTeeTime() { bool AllMemberQualified = true; DailyTeeTimeSheet DedesireTeeTime = new DailyTeeTimeSheet(); DedesireTeeTime.Date = DateTime.ParseExact(OriginalDate, "yyyy-MM-dd", CultureInfo.InvariantCulture).ToString("MM/dd/yyyy", CultureInfo.InvariantCulture);; DedesireTeeTime.Teetime = AList; DedesireTeeTime.Member1Number = Member1Number; DedesireTeeTime.Member2Number = Member2Number; DedesireTeeTime.Member3Number = Member3Number; DedesireTeeTime.Member4Number = Member4Number; DedesireTeeTime.Phone = Phone; DedesireTeeTime.NumberOfCarts = NumOfCarts; DedesireTeeTime.Time = Time; List <TeeTimeMember> MemberList = new List <TeeTimeMember>(); TeeTimeMember member = new TeeTimeMember(); member.Date = DedesireTeeTime.Date; member.Teetime = DedesireTeeTime.Teetime; member.MemberNumber = DedesireTeeTime.Member1Number; MemberList.Add(member); if (Member2Number != null) { member = new TeeTimeMember(); member.Date = DedesireTeeTime.Date; member.Teetime = DedesireTeeTime.Teetime; member.MemberNumber = DedesireTeeTime.Member2Number; MemberList.Add(member); } if (Member3Number != null) { member = new TeeTimeMember(); member.Date = DedesireTeeTime.Date; member.Teetime = DedesireTeeTime.Teetime; member.MemberNumber = DedesireTeeTime.Member3Number; MemberList.Add(member); } if (Member4Number != null) { member = new TeeTimeMember(); member.Date = DedesireTeeTime.Date; member.Teetime = DedesireTeeTime.Teetime; member.MemberNumber = DedesireTeeTime.Member4Number; MemberList.Add(member); } foreach (TeeTimeMember member1 in MemberList) { if (ISMemberNumberQualified(member1.MemberNumber) == false) { Message = "Number Number: " + member1.MemberNumber + " Not exist or not qualified; " + Message; AllMemberQualified = false; } } if (AllMemberQualified == true) { bool Confirmation = RequestDirector.UpdateTeeTime(DedesireTeeTime, MemberList); if (Confirmation == true) { Message = "Successfully Modified TeeTime on " + DedesireTeeTime.Date + " at " + AList; AList = null; Member1Number = null; Member2Number = null; Member3Number = null; Member4Number = null; Phone = null; NumOfCarts = 0; } else { Message = "Booked TeeTime: Failed"; } } }