Пример #1
0
 public AddMemberForm(MainForm form)
 {
     InitializeComponent();
     mainForm = form;
     comboBoxMembershipType.DataSource = MembershipTypeDAO.getAll();
     picturePath       = "";
     btnAddMember.Text = "Dodaj";
     this.Name         = "Dodavanje novog člana";
 }
Пример #2
0
        public AddMemberForm(MainForm form, member member)
        {
            Console.WriteLine(path);

            InitializeComponent();
            mainForm = form;
            memberId = member.member_id;
            comboBoxMembershipType.DataSource = MembershipTypeDAO.getAll();
            picturePath = member.profile_picture;
            populateAddMemberForm(member);
            btnAddMember.Text = "Izmjeni";
            this.Name         = "Izmjena informacija o članu";
        }
Пример #3
0
        public void populateMembershipFeeStatistic()
        {
            var member = members[selectedMemberRowIndex];

            lblFeePrice.Text = MembershipTypeDAO.getById(member.membership_type_id).fee_price.ToString();
            var month = MembershipFeePaymentDAO.getLastPaidMonth(member.member_id);

            if (month == 0)
            {
                lblLastPayedMonth.Text = "/";
            }
            else
            {
                lblLastPayedMonth.Text = ((months)month).ToString();
            }
            lblFeeSummary.Text = MembershipFeePaymentDAO.getNumberOfPaidMembershipFees(member.member_id).ToString();
        }
Пример #4
0
        private void btnSubmitPayment_Click(object sender, EventArgs e)
        {
            membeship_fee_payment membershipFeePayment = new membeship_fee_payment();
            member member = members[selectedMemberRowIndex];

            membershipFeePayment.member_id = member.member_id;

            //hardcoded
            membershipFeePayment.issuer_user_account_id = 1;

            Enum.TryParse(comboBoxMonthMembershipFee.Text, out months month);
            membershipFeePayment.month             = (sbyte)month;
            membershipFeePayment.year              = short.Parse(comboBoxYearMembershipFee.Text);
            membershipFeePayment.is_free_of_charge = checkBoxFreeOfCharge.Checked;
            if (checkBoxFreeOfCharge.Checked)
            {
                membershipFeePayment.price = 0;
            }
            else
            {
                membershipFeePayment.price = MembershipTypeDAO.getById(member.membership_type_id).fee_price;
            }
            membershipFeePayment.is_paid      = true;
            membershipFeePayment.payment_date = DateTime.Now;

            int result = MembershipFeePaymentDAO.insert(membershipFeePayment);

            if (result == 1)
            {
                MessageBox.Show("Uspješno uplaćena članarina za mjesec " + month);
                displayMemberInfo(members[selectedMemberRowIndex]);
            }
            else
            {
                MessageBox.Show("Došlo je do greške prilikom uplate za mjesec " + month);
            }
        }
Пример #5
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;
            }
        }