예제 #1
0
        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";
                }
            }
        }
예제 #2
0
        public Congregation GetCongregationById(int id)
        {
            var congregation = _congregationService.GetCongregationById(id);

            if (congregation == null)
            {
                return(null);
            }
            var c = new Congregation();

            c.CongregationId = congregation.CongregationId;
            c.LocationId     = congregation.LocationId;
            c.Name           = congregation.Name;

            return(c);
        }
예제 #3
0
        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;
            }
        }
예제 #4
0
 private void CreatorUpdateButton_Click(object sender, EventArgs e)
 {
     if (NewCongregationRadioButton.Checked == true)
     {
         Congregation newCongo = manager.CreateCongregation(CongregationNameTextBox.Text, AddressTextBox.Text, CityTextBox.Text, StateTextBox.Text, ZipTextBox.Text,
                                                            WeekMeetingDayComboBox.SelectedItem.ToString(), WeekMeetingHourPicker.Value.ToString() + ":" + WeekMeetingMinutePicker.Value.ToString(),
                                                            PublicMeetingDayComboBox.SelectedItem.ToString(), PublicMeetingHourPicker.Value.ToString() + ":" + PublicMeetingMinutePicker.Value.ToString());
         MemberForm newMember = new MemberForm(newCongo.Id, true, false, false, null);
         newMember.WindowState = FormWindowState.Normal;
         this.Close();
         newMember.Show();
     }
     else
     {
         manager.UpdateCongregation(Convert.ToInt32(CongregationIdLabel.Text), CongregationNameTextBox.Text, AddressTextBox.Text, CityTextBox.Text, StateTextBox.Text, ZipTextBox.Text,
                                    WeekMeetingDayComboBox.SelectedItem.ToString(), WeekMeetingHourPicker.Value.ToString() + ":" + WeekMeetingMinutePicker.Value.ToString(),
                                    PublicMeetingDayComboBox.SelectedItem.ToString(), PublicMeetingHourPicker.Value.ToString() + ":" + PublicMeetingMinutePicker.Value.ToString());
         MessageBox.Show("Congregation Updated");
         this.Close();
     }
 }
        public ActionResult Save(Congregation congregation)
        {
            if (!ModelState.IsValid)
            {
                return(View("CongregationsForm", congregation));
            }

            if (congregation.Id == 0)
            {
                _context.Congregations.Add(congregation);
            }
            else
            {
                var congregationdb = _context.Congregations.Single(c => c.Id == congregation.Id);

                congregationdb.Name = congregation.Name;
            }

            _context.SaveChanges();

            return(RedirectToAction("Index", "Congregations"));
        }
예제 #6
0
 public EditMembersForm(int congregationId)
 {
     InitializeComponent();
     congo = manager.CongregationByCongregationId(congregationId);
     CurrentMembersGridBox = cc.CurrentMembersBox(CurrentMembersGridBox, congo.Id);
 }
        public ActionResult New()
        {
            Congregation congregation = new Congregation();

            return(View("CongregationsForm", congregation));
        }