public void MarkGymAttendance(int nPackageID, string strMembershipID, DateTime dtDate, DateTime dtStartTime, DateTime dtEndTime ,bool needToVerify) { 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, dtDate, dtStartTime, dtEndTime, true); PrintClassAttendanceReminder(nPackageID, strMembershipID, nClassInstanceID); }
public void MarkAttendance(int nClassInstanceID, int nPackageID, string strMembershipID, int nClassType, bool isRefunded, bool needToVerifyMemberPackage) { MemberPackage memberPackage = new MemberPackage(); bool createNewClassAttendance = false; ACMSDAL.TblClassInstance sqlClassInstance = new TblClassInstance(); sqlClassInstance.NClassInstanceID = nClassInstanceID; sqlClassInstance.SelectOne(); if (sqlClassInstance.NActualInstructorID.IsNull) throw new Exception("No intructor has logined to this class. You cannot mark the attendance now."); //verify non peak package holder TblMemberPackage clsMemberPackage = new TblMemberPackage(); clsMemberPackage.NPackageID = nPackageID; clsMemberPackage.SelectOne(); TblPackage clsPackage = new TblPackage(); clsPackage.StrPackageCode = clsMemberPackage.StrPackageCode; clsPackage.SelectOne(); if (clsPackage.FPeak.IsNull == false && sqlClassInstance.FPeak.IsNull == false) { if (clsPackage.FPeak.Value == false && sqlClassInstance.FPeak == false) { } else { throw new Exception("Member holding Leisure Package and only allow to mark the attendance for non peak classes."); } } if (needToVerifyMemberPackage) { if (!VerifyMemberPackageAllowCertainClass(nPackageID, sqlClassInstance.StrClassCode.Value)) { //throw new Exception("The package you wish to use is not allow to attend the class. Please use other package."); 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; } } } createNewClassAttendance = memberPackage.NewClassAttendance(nPackageID, strMembershipID, nClassInstanceID, nClassType, User.BranchCode, sqlClassInstance.DtDate.Value, sqlClassInstance.DtStartTime.Value, sqlClassInstance.DtEndTime.Value, isRefunded); if (nPackageID >= 0) PrintClassAttendanceReminder(nPackageID, strMembershipID, nClassInstanceID); }
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); }
private void simpleButtonOK_Click(object sender, EventArgs e) { //this.DialogResult = DialogResult.OK; //DEREK if (this.NClassInstanceID != -1) { //myMemberPackage.NewClassAttendance(MemberPackagePackageID, currMembershipID, TblClassInstance clsInstance = new TblClassInstance(); clsInstance.NClassInstanceID = this.NClassInstanceID; clsInstance.SelectOne(); int nType = this.IsGym ? 1 : 0; if (!ClassAttendance.VerifyMemberPackageAllowCertainClass(myPackageID, clsInstance.StrClassCode.Value)) { MessageBox.Show(this, "The package you wish to use is not allow to attend the class. Please use other package."); //return; } else if (clsInstance.NActualInstructorID.IsNull) { MessageBox.Show(this, "The Instructor has Not punch in yet."); //return; } else { try { //Edited by Albert on 20-Dec-06 //Change the User.BranchCode to frm.strBranchID. //To get the branch id from the dialog form. MemberPackage myMemberPackage = new MemberPackage(); myMemberPackage.NewClassAttendance(myPackageID, myMemberShipID, this.NClassInstanceID, nType, this.strBranchID, clsInstance.DtDate.Value, clsInstance.DtStartTime.Value, clsInstance.DtEndTime.Value, this.Refunded); this.DialogResult = DialogResult.OK; } catch (Exception ex) { this.DialogResult = DialogResult.None; MessageBox.Show(this, ex.Message); } } } else { try { ClassAttendance myClassAttendance = new ClassAttendance(); myClassAttendance.MarkGymAttendance(myPackageID, myMemberShipID, this.AttendanceDate, this.StartTime, this.EndTime, true); this.DialogResult = DialogResult.OK; } catch (Exception ex) { this.DialogResult = DialogResult.None; MessageBox.Show(this, ex.Message); } } }