Exemplo n.º 1
0
        private void btnAddEducationLevel_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(textBoxCommissionMember3.Text) ||
                String.IsNullOrEmpty(textBoxCommissionMember2.Text) ||
                String.IsNullOrEmpty(textBoxCommissionMember1.Text))
            {
                lblAddEducationLevelError.ForeColor = System.Drawing.Color.Red;
                lblAddEducationLevelError.Text      = "*Niste unijeli sve podatke";
            }
            else
            {
                member_education memberEducation = new member_education();
                memberEducation.commission_member_1 = textBoxCommissionMember1.Text;
                memberEducation.commission_member_2 = textBoxCommissionMember2.Text;
                memberEducation.commission_member_3 = textBoxCommissionMember3.Text;
                memberEducation.exam_date           = dateTimePickerEducationLevelExamDate.Value;

                // vraca sve dosadasnje stepene, pa dodaje novi (tj. sledeci stepen)
                var memberEducations = MemberEducationDAO.getById(members[selectedMemberRowIndex].member_id);
                memberEducation.education_level_id = memberEducations.Count() + 1;
                memberEducation.member_id          = members[selectedMemberRowIndex].member_id;
                MemberEducationDAO.insert(memberEducation);
                textBoxCommissionMember1.Clear();
                textBoxCommissionMember2.Clear();
                textBoxCommissionMember3.Clear();
                lblAddEducationLevelError.Text = "";
                displayMemberInfo(members[selectedMemberRowIndex]);
            }
        }
Exemplo n.º 2
0
        public void displayMemberInfo(member member)
        {
            panelNoMemberSelected.Hide();
            lblAddEducationLevelError.Text        = "";
            lblFirstNameProfileView.Text          = member.first_name;
            lblLastNameProfileView.Text           = member.last_name;
            lblBirthDateProfileView.Text          = String.Format("{0:dd.MM.yyyy}", member.birth_date);
            lblAddressProfileView.Text            = member.address;
            lblSexProfileView.Text                = member.sex;
            lblPhoneNumberProfileView.Text        = member.phone_number;
            lblEmailProfileView.Text              = member.email;
            lblRegistrationDateProfileView.Text   = String.Format("{0:dd.MM.yyyy}", member.registration_date);
            lblMembershipTypeProfileView.Text     = MembershipTypeDAO.getById(member.membership_type_id).name;
            lblFirstAndLastNameAttendance.Text    = member.first_name + " " + member.last_name;
            lblFirstAndLastNameMembershipFee.Text = member.first_name + " " + member.last_name;
            lblFirstAndLastNameEducation.Text     = member.first_name + " " + member.last_name;
            lblMeberIdProfileView.Text            = member.member_id.ToString();

            if (String.IsNullOrEmpty(member.profile_picture))
            {
                pictureBoxProfilePicture.Image = Properties.Resources.user;
            }
            else
            {
                pictureBoxProfilePicture.Image = Image.FromFile(member.profile_picture);
            }
            var lastAttendance = AttendanceDAO.getLastById(member.member_id);

            lblLastAttendance.Text = lastAttendance;

            populateCalendar(member.member_id);

            //You can pay for the month three days before
            var payingMonth = DateTime.Now.AddDays(3).Month;
            var payingYear  = DateTime.Now.AddDays(3).Year;

            comboBoxMonthMembershipFee.SelectedIndex = 0;
            comboBoxYearMembershipFee.SelectedIndex  = 0;

            populateMembershipFeeStatistic();
            var memberEducations = MemberEducationDAO.getById(member.member_id);

            comboBoxEducationLevel4.Items.Clear();
            comboBoxEducationLevel3.Items.Clear();
            comboBoxEducationLevel2.Items.Clear();
            comboBoxEducationLevel1.Items.Clear();

            lblEducationLevelExamDate4.Text = "/";
            lblEducationLevelExamDate3.Text = "/";
            lblEducationLevelExamDate2.Text = "/";
            lblEducationLevelExamDate1.Text = "/";

            comboBoxEducationLevel4.Enabled = false;
            comboBoxEducationLevel3.Enabled = false;
            comboBoxEducationLevel2.Enabled = false;
            comboBoxEducationLevel1.Enabled = false;


            switch (memberEducations.Count)
            {
            case 4:
                lblEducationLevelExamDate4.Text = memberEducations[3].exam_date.ToString("dd.MM.yyyy.");
                comboBoxEducationLevel4.Items.Add(memberEducations[3].commission_member_1);
                comboBoxEducationLevel4.Items.Add(memberEducations[3].commission_member_2);
                comboBoxEducationLevel4.Items.Add(memberEducations[3].commission_member_3);
                comboBoxEducationLevel4.SelectedIndex = 0;
                comboBoxEducationLevel4.Enabled       = true;
                goto case 3;

            case 3:
                lblEducationLevelExamDate3.Text = memberEducations[2].exam_date.ToString("dd.MM.yyyy.");
                comboBoxEducationLevel3.Items.Add(memberEducations[2].commission_member_1);
                comboBoxEducationLevel3.Items.Add(memberEducations[2].commission_member_2);
                comboBoxEducationLevel3.Items.Add(memberEducations[2].commission_member_3);
                comboBoxEducationLevel3.SelectedIndex = 0;
                comboBoxEducationLevel3.Enabled       = true;
                goto case 2;

            case 2:
                lblEducationLevelExamDate2.Text = memberEducations[1].exam_date.ToString("dd.MM.yyyy.");
                comboBoxEducationLevel2.Items.Add(memberEducations[1].commission_member_1);
                comboBoxEducationLevel2.Items.Add(memberEducations[1].commission_member_2);
                comboBoxEducationLevel2.Items.Add(memberEducations[1].commission_member_3);
                comboBoxEducationLevel2.SelectedIndex = 0;
                comboBoxEducationLevel2.Enabled       = true;
                goto case 1;

            case 1:
                lblEducationLevelExamDate1.Text = memberEducations[0].exam_date.ToString("dd.MM.yyyy.");
                comboBoxEducationLevel1.Items.Add(memberEducations[0].commission_member_1);
                comboBoxEducationLevel1.Items.Add(memberEducations[0].commission_member_2);
                comboBoxEducationLevel1.Items.Add(memberEducations[0].commission_member_3);
                comboBoxEducationLevel1.SelectedIndex = 0;
                comboBoxEducationLevel1.Enabled       = true;
                break;
            }
            int lastPayedMonth = MembershipFeePaymentDAO.getLastPaidMonth(member.member_id);

            if (lastPayedMonth == payingMonth)
            {
                comboBoxMonthMembershipFee.Enabled = false;
                comboBoxYearMembershipFee.Enabled  = false;
                btnSubmitPayment.Enabled           = false;
            }
            else
            {
                comboBoxMonthMembershipFee.Enabled = true;
                comboBoxYearMembershipFee.Enabled  = true;
                btnSubmitPayment.Enabled           = true;
            }
        }