示例#1
0
        public void MarkGymAttendance(int nPackageID, string strMembershipID, bool needToVerify)
        {
            string cmdText = "select npackageid from tblMemberPackage mp left join tblReceipt r on mp.strReceiptNo=r.strReceiptNo left join tblPackage p on mp.strPackageCode=p.strPackageCode " +
                            "where mp.strReceiptNo is not null and r.strReceiptNo is null and nStatusID=0 and mp.strRemarks not like '%PKG MISSING FROM SYSTEM%' " +
                            "and mp.strReceiptNo not like '%FOC%' and fFree=0 and p.nCategoryID not in (23,14) and nPackageID=@nPackageID ";

            TblInstructorCommission commission = new TblInstructorCommission();
            DataTable dt = commission.LoadData(cmdText, new string[] { "@nPackageID" }, new object[] { nPackageID });
            if (dt != null && dt.Rows.Count > 0)
            {
                MessageBox.Show("Not allow to use this package as not receipt found.", "Warning", MessageBoxButtons.OK);
                return;
            }

            MemberPackage memberPackage = new MemberPackage();
            myClassInstance.StrClassCode = "GYM";
            DataTable table = myClassInstance.SelectAllWstrClassCodeLogic();

            if (table == null || table.Rows.Count == 0)
                throw new Exception("Failed to mark GYM Attendance.");

            int nClassInstanceID = ACMS.Convert.ToInt32(table.Rows[0]["nClassInstanceID"]);

            bool createNewClassAttendance = false;

            if (needToVerify)
            {

                if (!VerifyMemberPackageAllowCertainClass(nPackageID,"GYM"))
                {
                    DialogResult result = MessageBox.Show("The package you wish to use is not allow to attend the class. Do you still want to mark it. \n " +
                        "(An unlinked record will be create if you click yes) ", "Warning",MessageBoxButtons.YesNo);

                    if (result == DialogResult.Yes)
                    {
                        MemberPackage.CreateUnlinkedMemberPackage(strMembershipID, ref nPackageID);
                    }
                    else
                    {
                        return;
                    }
                    //throw new Exception("The package you wish to use is not allow to attend the class. Please use other package.");
                }
            }

            createNewClassAttendance = memberPackage.NewClassAttendance(nPackageID, strMembershipID, nClassInstanceID, 1,
                User.BranchCode, DateTime.Today.Date, DateTime.Now, DateTime.Now, true);

            PrintClassAttendanceReminder(nPackageID, strMembershipID, nClassInstanceID);
        }
示例#2
0
 private decimal GetCommission(int nCommissionTypeID, int nInstructorTypeID)
 {
     string cmdText = "Select * From tblInstructorTypeCommission where nCommissionTypeID = @nCommissionTypeID And nInstructorTypeID = @nInstructorTypeID";
     //myClassInstance.LoadData(cmdText, new string
     TblInstructorCommission commission = new TblInstructorCommission();
     DataTable table = commission.LoadData(cmdText, new string[] {"@nCommissionTypeID", "@nInstructorTypeID"}, new object[]{nCommissionTypeID, nInstructorTypeID});
     if (table != null && table.Rows.Count > 0)
     {
         return ACMS.Convert.ToDecimal(table.Rows[0]["mCommissionAmount"]);
     }
     return 0;
 }