コード例 #1
0
        public void btnPartialPayment_Click(object sender, EventArgs e)
        {
            if ( lvManageRecord.CheckedItems.Count > 0)
            {

                    Student st = new Student(lvManageRecord.CheckedItems[0].SubItems[1].Text);
                    frmPartialPayment f = new frmPartialPayment();
                    f.ControlBox = false;
                    f.studentData = st.studentData;

                    f.ShowDialog();
                    RefreshData(" ");

            }
            else if(!string.IsNullOrEmpty(mtlStudID.Text) && !Helper.strIsEmpty(mtlStudID.Text))
            {
                  Student st = new Student(mtlStudID.Text);
                frmPartialPayment f = new frmPartialPayment();
                f.ControlBox = false;
                f.studentData = st.studentData;

                f.ShowDialog();
                RefreshData(" ");
            }
            else
            {
                MessageBox.Show("Please Select/Search a student first ", "", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
コード例 #2
0
        // #  --------------------   DBACTIONS ---------------------------
        private void addPayment()
        {
            if (lvManageRecord.CheckedItems.Count < 1)
            {
                frmOrPayDataEntry.show_asAdd(new MsgHandler(RefreshData));
            }
            else
            {
                // instantiate an object of student
                Student st = new Student(lvManageRecord.CheckedItems[0].SubItems[1].Text);

                // pass values to form

                frmOrPayDataEntry.checkedItems = Payor.getCheckedItems(lvManageRecord);
                frmOrPayDataEntry.studentData = st.studentData;

                frmOrPayDataEntry.show_asAdd(new MsgHandler(RefreshData));
            }
        }
コード例 #3
0
        private void mtbStudent_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                Dictionary<string, string> data = new Dictionary<string, string>();
                string nameRest = "", studentNo = "", lastname = "";
                // position of comma for firstname and lastname

                try
                {
                     lastname = mtbStudent.Text.Substring(0, mtbStudent.Text.IndexOf(','));
                     nameRest = mtbStudent.Text.Substring(lastname.Length + 1, mtbStudent.Text.IndexOf('(') - lastname.Length - 1);

                     studentNo = mtbStudent.Text.Substring(mtbStudent.Text.IndexOf('(') + 1, mtbStudent.Text.IndexOf(')') - 2 - (lastname.Length + nameRest.Length));

                }
                catch (Exception ex)
                {
                    MessageBox.Show("Incomplete Data Input");
                }

                data["StudNo"] = studentNo;
                data["LName"] = lastname;
                data["nameRest"] = nameRest;

                Student st = new Student(data);

                if (st.isStudent)
                {
                    mtpStudInfo.Visible = true;
                    mtbOP.Visible = true;
                    mtlName.Text = st.studentData[4] + ", " + st.studentData[2] + " " + st.studentData[3];
                    mtlCourse.Text = st.course();
                    mtlStudID.Text = st.studentData[0];
                }
                else
                    MessageBox.Show("Invalid Student Data");

            }
            else
                mtbOP.Visible = false;
        }
コード例 #4
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            // instantiate student object
            try
            {
                if ( !Helper.strIsEmpty(tAmount.Text, true))
                {
                    Student st = new Student(listView1.Items[0].SubItems[1].Text);

                    string course = st.course();

                    // temporary conditioning to check if a student is masteral or undergrad
                    int OPType = (course.StartsWith("B")) ? 2 : 3;

                    Dictionary<string,float> amountPerParticular = SAccount.getAmountPerParticular(listView1,3,"tuition/msc");

                    if (amountPerParticular["Tuition Fee"] > 0 && amountPerParticular["Tuition Fee"] > float.Parse(tAmount.Text))
                    {
                        amountPerParticular["Tuition Fee"] = float.Parse(tAmount.Text) - float.Parse(lbMscFee.Text);

                    }

                    // validation
                    bool isValid = false;
                    string paymentType = (isFullPayment) ? "full" : "partial";

                    bool isCheck = false;
                    if (mtrbCheck.Checked)
                        isCheck = true;
                    else if (mtrbCash.Checked)
                        isCheck = false;

                    // check if NSTP is selected
                    string NSTP = (mtrbCWTS.Checked) ? mtrbCWTS.Text : (mtrbROTC.Checked) ? mtrbROTC.Text : null;

                    if (string.IsNullOrEmpty(NSTP)  && hasNSTP)
                    {
                        isValid = false;
                        MessageBox.Show("Please select NSTP Type");
                        return;
                    }

                    isValid = StudentAccount.validateAmout(paymentType, float.Parse(lbTotal.Text), float.Parse(tAmount.Text), float.Parse(lbTuitionFee.Text), float.Parse(lbMscFee.Text), isCheck);

                    if (isValid )
                    {
                        // ---------------- FINAL PROCEDURE -------------------
                        if (isValid)
                        {
                            OrderOfPayment OP = null;
                            if (Payor.validateCheckDetails(mtbBankName.Text, mtbCheckNo.Text, mtdCheckDate.Value.ToShortDateString(), mtbCheckAmount.Text) && mtrbCheck.Checked)
                            {
                                OP = new OrderOfPayment(float.Parse(tAmount.Text), int.Parse(tPaymentOrNo.Text), dtOrDate.Value.ToShortDateString(), "Tuition Fee/Misc", studentData[3] +' '+ studentData[4] +' '+studentData[2], int.Parse(studentData[0]), "", mtbBankName.Text, mtbCheckNo.Text, mtdCheckDate.Value.ToShortDateString(), float.Parse(mtbCheckAmount.Text));
                            }
                            else if (mtrbCash.Checked)
                                OP = new OrderOfPayment(float.Parse(tAmount.Text), int.Parse(tPaymentOrNo.Text), dtOrDate.Value.ToShortDateString(), "Tuition Fee/Misc", studentData[3] + ' ' + studentData[4] + ' ' + studentData[2], int.Parse(studentData[0]));
                            else
                                MessageBox.Show("There are some fields missing!");
                            // validated
                            if (OP != null)
                            {
                                if (OP.createOP())
                                {
                                    OP.addOPItem(int.Parse(tPaymentOrNo.Text), amountPerParticular, OPType, NSTP);
                                    MessageBox.Show("Successful! \n \t Please Proceed to Payment");

                                    Dictionary<string, string> OPData = OP.getOPDataWOOR(int.Parse(tPaymentOrNo.Text));
                                    ePrinting print = new ePrinting(OPData);
                                    print.ePrint("OP");

                                    Close();

                                }
                            }

                        }

                    }
                }
                else
                {
                    MessageBox.Show("Please select ");
                }

            }
            catch(Exception ex)
            {
                MessageBox.Show("There are some fields missing", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }