public static int insert(membeship_fee_payment membershipFeePayment) { int result = 0; using (var db = new ExtremeAppContext()) { db.membeship_fee_payment.Add(membershipFeePayment); result = db.SaveChanges(); } return(result); }
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); } }