public MemberForm(int congregationId,bool isFirstMember,bool essentialFieldsOnly, bool isUpdate, EditMembersForm editForm) { InitializeComponent(); congo = manager.CongregationByCongregationId(congregationId); firstMember = isFirstMember; neccessaryFieldsOnly = essentialFieldsOnly; update = isUpdate; emf = editForm; if (neccessaryFieldsOnly == true) { UserNameLabel.Visible = false; UserNameTextBox.Visible = false; PasswordLabel.Visible = false; PasswordTextBox.Visible = false; MiddleName.Visible = false; MiddleNameLabel.Visible = false; DateOfBirthPicker.Visible = false; DateOfBirthLabel.Visible = false; BaptismDateLabel.Visible = false; BaptismDatePicker.Visible = false; if(update==true) { FirstName.Text = emf.SelectedMember.FirstName; LastName.Text = emf.SelectedMember.LastName; PreferredName.Text = emf.SelectedMember.PreferredName; DeleteMemberButton.Visible = true; AddUpdateButton.Text = "Update Member"; } } }
public Congregation CongregationByCongregationId(int congregationId) { Congregation congregation = (from c in repository.Congregations where c.Id == congregationId select c).Single(); return(congregation); }
public List <MeetingAssignment> MeetingAssignmentsForSchedule(ScheduleDate scheduleDates, int congregationId) { Congregation congo = CongregationByCongregationId(congregationId); List <Assignment> congoAssignments = AssignmentsByCongregationId(congo.Id); List <Meeting> meetings = new List <Meeting>(); List <MeetingAssignment> meetingAssignments = new List <MeetingAssignment>(); Meeting meeting; string dayOfWeekMeeting = congo.WeekMeetingDay; string publicMeeting = congo.PublicMeetingDay; foreach (DateTime day in EachDayLoop(scheduleDates.StartDate, scheduleDates.EndDate)) { if (Convert.ToString(day.DayOfWeek) == dayOfWeekMeeting || Convert.ToString(day.DayOfWeek) == publicMeeting) { if (Convert.ToString(day.DayOfWeek) == publicMeeting) { meeting = CreateMeeting(2, day.Date, congo.Id); } else { meeting = CreateMeeting(1, day.Date, congo.Id); } meetings.Add(meeting); } } List <UnavailableDate> cancelled = UnavailableDateByCongregationId(congregationId); foreach (Meeting m in meetings) { if (cancelled.Any(p => p.DateUnavailable == m.MeetingDate)) { continue; } congoAssignments = congoAssignments.OrderBy(o => o.PositionOnSchedule).ToList(); foreach (Assignment a in congoAssignments) { if (a.AmountPerMeeting == 0) { continue; } List <Member> membersAvailable = MembersAvailable(a.Id, m.MeetingDate); int counter = 1; while (counter <= a.AmountPerMeeting) { Member nextMember = NextMemberToAssign(membersAvailable, m, a); MeetingAssignment ma = CreateMeetingAssignment(m.Id, nextMember.Id, a.Id, nextMember.CongregationId, scheduleDates.Id); meetingAssignments.Add(ma); counter++; } } } return(meetingAssignments); }
public Congregation UpdateCongregation(int congregationId, string congregationName, string address, string city, string state, string zipcode, string weekMeetingDay, string weekMeetingTime, string publicMeetingDay, string publicMeetingTime) { Congregation congregation = CongregationByCongregationId(congregationId); congregation.CongregationName = congregationName; congregation.Address = address; congregation.City = city; congregation.State = state; congregation.Zipcode = zipcode; congregation.WeekMeetingDay = weekMeetingDay; congregation.WeekMeetingTime = weekMeetingTime; congregation.PublicMeetingDay = publicMeetingDay; congregation.PublicMeetingTime = publicMeetingTime; congregation.UpdateDate = DateTime.Now; repository.SaveChanges(); return(congregation); }
public Congregation CreateCongregation(string congregationName, string address, string city, string state, string zipcode, string weekMeetingDay, string weekMeetingTime, string publicMeetingDay, string publicMeetingTime) { Congregation congregation = new Congregation(); congregation.CongregationName = congregationName; congregation.Address = address; congregation.City = city; congregation.State = state; congregation.Zipcode = zipcode; congregation.WeekMeetingDay = weekMeetingDay; congregation.WeekMeetingTime = weekMeetingTime; congregation.PublicMeetingDay = publicMeetingDay; congregation.PublicMeetingTime = publicMeetingTime; congregation.CreateDate = DateTime.Now; repository.Congregations.Add(congregation); repository.SaveChanges(); return congregation; }
public CongregationForm(bool newCongregation, Congregation congo) { InitializeComponent(); WeekMeetingHourPicker.Maximum = 12; WeekMeetingHourPicker.Minimum = 1; WeekMeetingMinutePicker.Maximum = 59; PublicMeetingHourPicker.Maximum = 12; PublicMeetingHourPicker.Minimum = 1; PublicMeetingMinutePicker.Maximum = 59; WeekMeetingDayComboBox.Items.Add("Sunday"); WeekMeetingDayComboBox.Items.Add("Monday"); WeekMeetingDayComboBox.Items.Add("Tuesday"); WeekMeetingDayComboBox.Items.Add("Wednesday"); WeekMeetingDayComboBox.Items.Add("Thursday"); WeekMeetingDayComboBox.Items.Add("Friday"); WeekMeetingDayComboBox.Items.Add("Saturday"); PublicMeetingDayComboBox.Items.Add("Sunday"); PublicMeetingDayComboBox.Items.Add("Monday"); PublicMeetingDayComboBox.Items.Add("Tuesday"); PublicMeetingDayComboBox.Items.Add("Wednesday"); PublicMeetingDayComboBox.Items.Add("Thursday"); PublicMeetingDayComboBox.Items.Add("Friday"); PublicMeetingDayComboBox.Items.Add("Saturday"); if(newCongregation==false) { CreatorUpdateButton.Text = "Update Congregation"; CongregationIdLabel.Text = Convert.ToString(congo.Id); AddressTextBox.Text = congo.Address; CityTextBox.Text = congo.City; StateTextBox.Text = congo.State; ZipTextBox.Text = congo.Zipcode; WeekMeetingDayComboBox.Text=congo.WeekMeetingDay; PublicMeetingDayComboBox.Text = congo.PublicMeetingDay; WeekMeetingHourPicker.Value = Convert.ToInt32(congo.WeekMeetingTime.Split(':')[0]); WeekMeetingMinutePicker.Value = Convert.ToInt32(congo.WeekMeetingTime.Split(':')[1]); NewCongregationRadioButton.Checked = false; } }
public EditMembersForm(int congregationId) { InitializeComponent(); congo=manager.CongregationByCongregationId(congregationId); CurrentMembersGridBox = cc.CurrentMembersBox(CurrentMembersGridBox,congo.Id); }