public static bool IsMemberExceedUOBBookingThisMonth(string strMembershipID, DateTime uobBookingDate) { TblCompany comp = new TblCompany(); DataTable table = comp.SelectAll(); DataRow compMasterRow = table.Rows[0]; int nUOBMonthlyBooking = ACMS.Convert.ToInt32(compMasterRow["nUOBMonthlyBooking"]); TblServiceSession serviceSession = new TblServiceSession(); DataTable uobBookingTable = serviceSession.GetUOBBookingServiceSessionBaseMembershipID(strMembershipID); int uobBookingMade = 0; if (uobBookingTable != null && uobBookingTable.Rows.Count > 0) { foreach (DataRow r in uobBookingTable.Rows) { DateTime serviceSessionDate = ACMS.Convert.ToDateTime(r["dtDate"]); if (serviceSessionDate != DateTime.MinValue) { if (serviceSessionDate.Month == uobBookingDate.Month && serviceSessionDate.Year == uobBookingDate.Year) uobBookingMade++; } } } return uobBookingMade >= nUOBMonthlyBooking; }
//2604 public void UpdateGiftToFriends(int nServiceSessionID, int nNewServiceEmployeeID, DateTime dtDate, DateTime dtService) { TblServiceSession ss = new TblServiceSession(); ss.NSessionID = nServiceSessionID; ss.SelectOne(); ss.DtDate = dtDate; ss.DtTreatment = dtService; ss.NServiceEmployeeID = nNewServiceEmployeeID; ss.Update(); }
public void TransferMemberPackage(int packageID, string currMemberID, string newMemberID, string remark) { TblClassAttendance classAttendance = new TblClassAttendance(); TblServiceSession serviceSession = new TblServiceSession(); classAttendance.NPackageID = packageID; DataTable tableClassAttendance = classAttendance.SelectAllWnPackageIDLogic(); serviceSession.NPackageID = packageID; DataTable tableServiceSession = serviceSession.SelectAllWnPackageIDLogic(); //classAttendance.nP ACMSDAL.ConnectionProvider connProvider = new ConnectionProvider(); try { classAttendance.MainConnectionProvider = connProvider; serviceSession.MainConnectionProvider = connProvider; myMemberPackage.MainConnectionProvider = connProvider; myAudit.MainConnectionProvider = connProvider; connProvider.OpenConnection(); connProvider.BeginTransaction("TransferMemberPackage"); if (tableClassAttendance != null && tableClassAttendance.Rows.Count > 0) { foreach (DataRow r in tableClassAttendance.Rows) { r["strMembershipID"] = newMemberID; } //classAttendance.StrMembershipID = newMemberID; //classAttendance.UpdateAllWnEmployeeIDLogic(); } if (tableServiceSession != null && tableServiceSession.Rows.Count > 0) { // serviceSession.StrMembershipID = newMemberID; // serviceSession.UpdateAllWnPackageIDLogic(); foreach (DataRow r in tableServiceSession.Rows) { r["strMembershipID"] = newMemberID; } } myMemberPackage.NPackageID = packageID; myMemberPackage.SelectOne(); myMemberPackage.StrMembershipID = newMemberID; myMemberPackage.StrRemarks = remark; myAudit.DtDate = DateTime.Today; myAudit.NAuditTypeID = 1; myAudit.NEmployeeID = ACMSLogic.User.EmployeeID; myAudit.StrAuditEntry = "Transfer Member Package " + packageID.ToString() + "from " + currMemberID + "to " + newMemberID; myAudit.StrReference = packageID.ToString(); classAttendance.SaveData(tableClassAttendance); serviceSession.SaveData(tableServiceSession); myMemberPackage.Update(); myAudit.Insert(); connProvider.CommitTransaction(); } catch (Exception) { connProvider.RollbackTransaction("CancelMemberPackage"); throw new Exception("Failed to transfer Member Package"); } finally { if (connProvider.CurrentTransaction != null) connProvider.CurrentTransaction.Dispose(); if (connProvider.DBConnection != null) { if (connProvider.DBConnection.State == ConnectionState.Open) connProvider.DBConnection.Close(); //connProvider.DBConnection.Dispose(); } myMemberPackage.MainConnactionIsCreatedLocal = true; myAudit.MainConnactionIsCreatedLocal = true; classAttendance.MainConnactionIsCreatedLocal = true; serviceSession.MainConnactionIsCreatedLocal = true; } }
public bool NewServiceSession(int nPackageID, string strServiceCode, string strMemberShipID, int nEmployeeID, string strBranchCode, DateTime dtDate, DateTime startTime, DateTime dtTreatment, string strSignID, int nQuatity, Boolean forfeited, int MemberPackageCategoryID, string strSigKey, string strPdfExportPath, ref DataTable dtSessionID, string SsRemark) { // i will know whether the service session is for PT or not by using strServiceCode and query out the record from tblService. // i also can calculate the endTime using the data(nduration) from tblService TblService service = new TblService(); service.StrServiceCode = strServiceCode; DataTable table = service.SelectOne(); if (table == null || table.Rows.Count == 0) throw new Exception("The service is not available."); int duration = ACMS.Convert.ToInt32(service.NDuration); bool isPT = ACMS.Convert.ToInt32(service.NServiceTypeID) == 0; DateTime endTime = startTime.AddMinutes((Double)duration); TblEmployee Employee = new TblEmployee(); Employee.NEmployeeID = nEmployeeID; DataTable Emptable = Employee.SelectOne(); if (Emptable.Rows[0]["fPartTime"].ToString() == "True" || ACMSLogic.SpaBooking.TherapistIsAvailableToBook(nEmployeeID, dtDate, startTime, endTime, strBranchCode)) { TblServiceSession serviceSession = new TblServiceSession(); serviceSession.NPackageID = nPackageID; serviceSession.StrMembershipID = strMemberShipID; serviceSession.StrServiceCode = strServiceCode; serviceSession.NStatusID = 5; serviceSession.DtDate = dtDate; serviceSession.DtStartTime = startTime; serviceSession.DtEndTime = endTime; serviceSession.DtLastEditDate = DateTime.Now; serviceSession.NEmployeeID = User.EmployeeID; serviceSession.NMarkedByID = User.EmployeeID; serviceSession.NServiceEmployeeID = nEmployeeID; serviceSession.DtTreatment = dtTreatment; serviceSession.StrSignID = strSignID; serviceSession.StrSigKey = strSigKey; serviceSession.StrSigPdfPath = strPdfExportPath; serviceSession.StrUtilData = strSigKey; serviceSession.StrRemarks = SsRemark; if (forfeited == true) { serviceSession.StrRemarks = "FORFEITED"; } if (isPT) { serviceSession.StrBranchCode = strBranchCode; } else serviceSession.StrBranchCode = User.BranchCode; TblMemberPackage memberPackage = new TblMemberPackage(); //1309 memberPackage.NPackageID = nPackageID; DataTable memberPackageTable = memberPackage.GetMemberPackage(nPackageID); if (memberPackageTable == null || memberPackageTable.Rows.Count == 0) throw new Exception("Failed to create new service session. Member Package with npackageID = " + nPackageID.ToString() + "has been deleted"); CalculateMemberPackageBalance(strServiceCode, strMemberShipID, memberPackageTable); if (ACMS.Convert.ToInt32(memberPackageTable.Rows[0]["Balance"]) == 0 || ACMS.Convert.ToInt32(memberPackageTable.Rows[0]["Balance"]) - nQuatity < 0) throw new Exception("The balance of this member's package is zero."); // Kean Yiap DataRow masterRow = memberPackageTable.Rows[0]; if (masterRow["dtStartDate"] == DBNull.Value && masterRow["dtExpiryDate"] == DBNull.Value) { // Means new service session gonna insert TblPackage package = new TblPackage(); package.StrPackageCode = masterRow["strPackageCode"].ToString(); package.SelectOne(); masterRow["dtStartDate"] = dtDate; masterRow["dtExpiryDate"] = dtDate.AddMonths(package.NPackageDuration.Value).AddDays(-1); } else { DateTime memberPackageStartDate = ACMS.Convert.ToDateTime(masterRow["DtStartDate"]); DateTime memberPackageExpiryDate = ACMS.Convert.ToDateTime(masterRow["dtExpiryDate"]); if (memberPackageStartDate > dtDate) { masterRow["dtExpiryDate"] = memberPackageExpiryDate.Subtract(memberPackageStartDate.Subtract(dtDate)); } } ACMSDAL.ConnectionProvider connProvider = new ConnectionProvider(); try { memberPackage.MainConnectionProvider = connProvider; serviceSession.MainConnectionProvider = connProvider; connProvider.OpenConnection(); connProvider.BeginTransaction("SaveServiceSession"); memberPackage.SaveData(memberPackageTable); for (int i = 0; i < nQuatity; i++) { serviceSession.Insert(); //Capture Session ID Here DataRow ssRow; ssRow = dtSessionID.NewRow(); ssRow["nSessionID"] = Convert.ToInt32(serviceSession.NSessionID.Value); ssRow["strMembershipID"] = strMemberShipID; dtSessionID.Rows.Add(ssRow); } connProvider.CommitTransaction(); //DEREK Wrong Here Need to Fix //Use DataTable //Same goes with Live Version //mySessionID = Convert.ToInt32(serviceSession.NSessionID.Value); return true; } catch (Exception ex) { connProvider.RollbackTransaction("SaveClassAttendance"); throw new Exception("Failed to save Class Attendance"); } finally { if (connProvider.CurrentTransaction != null) connProvider.CurrentTransaction.Dispose(); if (connProvider.DBConnection != null) { if (connProvider.DBConnection.State == ConnectionState.Open) connProvider.DBConnection.Close(); } memberPackage.MainConnactionIsCreatedLocal = true; serviceSession.MainConnactionIsCreatedLocal = true; } } else { return false; } }
public DataTable GetMemberPackage(string strMemberShipID) { TblMemberPackage memberPackege = new TblMemberPackage(); DataTable table = memberPackege.GetActiveMemberPackageForServiceSession(); if (!table.Columns.Contains("Balance")) { DataColumn colBalance = new DataColumn("Balance", System.Type.GetType("System.Int32")); table.Columns.Add(colBalance); } TblClassAttendance classAttendance = new TblClassAttendance(); TblServiceSession serviceSession = new TblServiceSession(); foreach (DataRow r in table.Rows) { int nCategoryID = ACMS.Convert.ToInt32(r["nCategoryID"]); int nPackageID = ACMS.Convert.ToInt32(r["nPackageID"]); // class Attendance if (nCategoryID == 1 || nCategoryID == 2) { classAttendance.NPackageID = nPackageID; DataView classAttendanceTable = classAttendance.SelectAllWnPackageIDLogic().DefaultView; classAttendanceTable.RowFilter = "nStatusID = 1 or nStatusID = 2"; r["Balance"] = ACMS.Convert.ToInt32(r["nMaxSession"]) - classAttendanceTable.Count; } else if (nCategoryID == 4 || nCategoryID == 5 || nCategoryID == 6) // Service Session { serviceSession.NPackageID = nPackageID; DataView serviceSessionTable = serviceSession.SelectAllWnPackageIDLogic().DefaultView; serviceSessionTable.RowFilter = "nStatusID = 5 or nStatusID = 6"; r["Balance"] = ACMS.Convert.ToInt32(r["nMaxSession"]) - serviceSessionTable.Count; } } return table; }
private void TopUpSingleTreatmentTransaction(ACMSDAL.ConnectionProvider connProvider, ACMSLogic.POS pos) { if (pos.NCategoryID == 19) { TblServiceSession sqlserviceSession = new TblServiceSession(); sqlserviceSession.MainConnectionProvider = connProvider; string strServiceCode = ""; int nPackageID = -1; foreach (DataRow r in pos.ReceiptItemsTable.Rows) { strServiceCode = r["strCode"].ToString(); nPackageID = ACMS.Convert.ToInt32(r["strReferenceNo"]); sqlserviceSession.DtDate = DateTime.Today.Date; sqlserviceSession.DtStartTime = DateTime.Now; sqlserviceSession.DtEndTime = DateTime.Now.AddMinutes(15); sqlserviceSession.DtLastEditDate = DateTime.Now; sqlserviceSession.NEmployeeID = User.EmployeeID; sqlserviceSession.NPackageID = nPackageID; sqlserviceSession.NStatusID = 5; sqlserviceSession.StrBranchCode = User.BranchCode; sqlserviceSession.StrMembershipID = pos.StrMembershipID; sqlserviceSession.StrServiceCode = strServiceCode; sqlserviceSession.Insert(); r["strReferenceNo"] = sqlserviceSession.NSessionID; } } }
/// <summary> /// Balance for new member package is not allow to set nMaxSession is bcoz need the value zero /// to do calculation In POS /// </summary> /// <param name="strMembershipID"></param> /// <returns></returns> /// start jackie 4/3/2012 public DataView GetActive_n_NonFreeMemberPackage_Convert_Calculation(string strMembershipID) { DataTable table = myMemberPackage.GetActivenNonFreeMemberPackage(strMembershipID); if (table != null) { if (!table.Columns.Contains("Balance")) { DataColumn colBalance = new DataColumn("Balance", System.Type.GetType("System.Int32")); table.Columns.Add(colBalance); } if (!table.Columns.Contains("FNew")) { DataColumn colNew = new DataColumn("FNew", System.Type.GetType("System.Int32")); table.Columns.Add(colNew); } TblClassAttendance classAttendance = new TblClassAttendance(); TblServiceSession serviceSession = new TblServiceSession(); foreach (DataRow r in table.Rows) { int nCategoryID = ACMS.Convert.ToInt32(r["nCategoryID"]); int nPackageID = ACMS.Convert.ToInt32(r["nPackageID"]); // class Attendance if (nCategoryID == 1 || nCategoryID == 2) { classAttendance.NPackageID = nPackageID; DataView classAttendanceTable = classAttendance.SelectAllWnPackageIDLogic().DefaultView; classAttendanceTable.RowFilter = "nStatusID = 1 or nStatusID = 2"; if (classAttendanceTable.Count > 0) { // r["Balance"] = ACMS.Convert.ToInt32(r["nMaxSession"]) - classAttendanceTable.Count; r["Balance"] = (ACMS.Convert.ToInt32(r["mbaseunitprice"]) * classAttendanceTable.Count); r["FNew"] = 0; } else { r["Balance"] = 0; r["FNew"] = 1; } } else if (nCategoryID == 3 || nCategoryID == 4 || nCategoryID == 5 || nCategoryID == 6) // Service Session { serviceSession.NPackageID = nPackageID; DataView serviceSessionTable = serviceSession.SelectAllWnPackageIDLogic().DefaultView; serviceSessionTable.RowFilter = "nStatusID = 5 or nStatusID = 6"; if (serviceSessionTable.Count > 0) { // r["Balance"] = ACMS.Convert.ToInt32(r["nMaxSession"]) - serviceSessionTable.Count; r["Balance"] =ACMS.Convert.ToInt32(r["mlistprice"])- (ACMS.Convert.ToInt32(r["mbaseunitprice"]) * serviceSessionTable.Count); r["FNew"] = 0; } else { r["Balance"] = 0; r["FNew"] = 1; } } } } table.DefaultView.RowFilter = " Balance > 0 OR (Balance = 0 AND FNew = 1)"; return table.DefaultView; }
//19032012 public static void CalculateCreditMemberPackageBalance(DataTable memberPackageTable) { if (!memberPackageTable.Columns.Contains("Balance")) { DataColumn colBalance = new DataColumn("Balance", System.Type.GetType("System.Int32")); memberPackageTable.Columns.Add(colBalance); } DataTable gymTable = new DataTable(); DataColumn colDtdate = new DataColumn("dtDate", typeof(string)); DataColumn colPackageID = new DataColumn("nPackageID", typeof(int)); DataColumn colAttendanceID = new DataColumn("nAttendanceID", typeof(int)); gymTable.Columns.Add(colDtdate); gymTable.Columns.Add(colPackageID); gymTable.Columns.Add(colAttendanceID); TblClassAttendance classAttendance = new TblClassAttendance(); TblServiceSession serviceSession = new TblServiceSession(); foreach (DataRow r in memberPackageTable.Rows) { r["Balance"] = r["nMaxSession"]; // here to put the free class limit if (ACMS.Convert.ToInt32(r["nMaxSession"]) == 9999) { r["Balance"] = 9999; continue; } int nCategoryID = ACMS.Convert.ToInt32(r["nCategoryID"]); int nPackageID = ACMS.Convert.ToInt32(r["nPackageID"]); // class Attendance if (nCategoryID == 1 || nCategoryID == 2) { classAttendance.NPackageID = nPackageID; DataTable classAttendanceTable = classAttendance.SelectAllWnPackageIDLogic(); if (classAttendanceTable == null || classAttendanceTable.Rows.Count == 0) { if (ACMS.Convert.ToDBInt32(r["nAdjust"]) >= 1 && ACMS.Convert.ToInt32(r["nMaxSession"]) < 9999) { r["Balance"] = ACMS.Convert.ToDBInt32(r["Balance"]) - ACMS.Convert.ToDBInt32(r["nAdjust"]); } continue; } DataView classAttendanceTableView = classAttendanceTable.DefaultView; // Need to filter out the non GYM attendance here classAttendanceTableView.RowFilter = "((nStatusID = 1 or nStatusID = 2) AND nTypeID = 0)"; //dw testing TblMemberPackage MemPackage = new TblMemberPackage(); if (ACMS.Convert.ToDBInt32(r["nAdjust"]) >= 1 && ACMS.Convert.ToInt32(r["nMaxSession"]) < 9999) { r["Balance"] = ACMS.Convert.ToDBInt32(r["Balance"]) - ACMS.Convert.ToDBInt32(r["nAdjust"]); } int nPackBalance; if (classAttendanceTableView.Count > 0) { r["Balance"] = ACMS.Convert.ToInt32(r["Balance"]) - classAttendanceTableView.Count; nPackBalance = ACMS.Convert.ToInt32(r["Balance"]); if (nPackBalance <= 0) MemPackage.nBalance = 1; } // Start calculate the POWER Package // It is consider PWR Package if the class attendance is GYM Class classAttendanceTableView.RowFilter = "((nStatusID = 1 or nStatusID = 2) AND nTypeID = 1)"; if (classAttendanceTableView.Count > 0) { for (int i = 0; i < classAttendanceTableView.Count; i++) { DataRow row = classAttendanceTableView[i].Row; string dtDate = ACMS.Convert.ToDateTime(row["dtDate"]).ToString("yyyy/MM/dd"); int nAttendanceID = ACMS.Convert.ToInt32(row["nAttendanceID"]); DataRow[] foundRow = gymTable.Select("dtDate = '" + dtDate + "'"); if (foundRow.Length == 0) { DataRow addRow = gymTable.NewRow(); addRow["dtDate"] = dtDate; addRow["nPackageID"] = nPackageID; addRow["nAttendanceID"] = nAttendanceID; gymTable.Rows.Add(addRow); } } foreach (DataRow pRow in gymTable.Rows) { DateTime dtDate = ACMS.Convert.ToDateTime(pRow["dtDate"]); int nPackageIDInGymTable = ACMS.Convert.ToInt32(pRow["nPackageID"]); string strFilter = string.Format("(nStatusID = 1 or nStatusID = 2) " + " AND nTypeID = 0 AND nPackageID = {0} AND DtDate = #{1}#", nPackageIDInGymTable.ToString(), dtDate.ToString("yyyy/MM/dd")); DataRow[] foundRow = classAttendanceTable.Select(strFilter, "nPackageID", DataViewRowState.CurrentRows); if (foundRow.Length > 0) r["Balance"] = ACMS.Convert.ToInt32(r["Balance"]) + 1; } r["Balance"] = ACMS.Convert.ToInt32(r["Balance"]) - gymTable.Rows.Count; } } else if (nCategoryID == 3 || nCategoryID == 4 || nCategoryID == 5 || nCategoryID == 6) // Service Session { serviceSession.NPackageID = nPackageID; DataView serviceSessionTable = serviceSession.SelectAllWnPackageIDLogic().DefaultView; serviceSessionTable.RowFilter = "nStatusID = 5 or nStatusID = 6"; if (serviceSessionTable.Count > 0) { r["Balance"] = ACMS.Convert.ToInt32(r["Balance"]) - serviceSessionTable.Count; } if (ACMS.Convert.ToDBInt32(r["nAdjust"]) >= 1 && ACMS.Convert.ToInt32(r["nMaxSession"]) < 9999) { r["Balance"] = ACMS.Convert.ToDBInt32(r["Balance"]) - ACMS.Convert.ToDBInt32(r["nAdjust"]); } } } }
private void ActionTakeWhenVoidReceiptForCategory_2(string strReceiptNo, ConnectionProvider connProvider) { TblMemberPackage memberPackage = new TblMemberPackage(); TblGIRO giro = new TblGIRO(); giro.MainConnectionProvider = connProvider; memberPackage.MainConnectionProvider = connProvider; memberPackage.StrReceiptNo = strReceiptNo; DataTable table = memberPackage.SelectAllWstrReceiptNo(strReceiptNo); TblClassAttendance sqlClassAttendance = new TblClassAttendance(); TblServiceSession sqlServiceSession = new TblServiceSession(); sqlClassAttendance.MainConnectionProvider = connProvider; sqlServiceSession.MainConnectionProvider = connProvider; if (table.Rows.Count > 0) { int nPackageID = 0; foreach (DataRow r in table.Rows) { nPackageID = ACMS.Convert.ToInt32(r["nPackageID"]); sqlClassAttendance.NPackageID = nPackageID; DataTable classAttTable = sqlClassAttendance.SelectAllWnPackageIDLogic(); if (classAttTable.Rows.Count > 0) throw new Exception("The item(s) has been used, you are not allow to void the receipt"); else { sqlServiceSession.NPackageID = nPackageID; classAttTable = sqlServiceSession.SelectAllWnPackageIDLogic(); if (classAttTable.Rows.Count > 0) throw new Exception("The item(s) has been used, you are not allow to void the receipt"); } r["nEmployeeID"] = User.EmployeeID; r["nStatusID"] = 2; r["strRemarks"] = "Voided Receipt"; r["dtLastEdit"] = System.DateTime.Now; if (r["nGIRORefID"] != DBNull.Value) { int nGiroRefID = ACMS.Convert.ToInt32(r["nGIRORefID"]); giro.NGIRORefID = nGiroRefID; giro.SelectOne(); giro.NEmployeeID = User.EmployeeID; giro.NStatusID = 4; giro.StrRemarks = "Voided Receipt" + " - " + System.DateTime.Now.ToString("dd/MM/yyyy"); giro.Update(); } } memberPackage.SaveData(table); } }
private void ActionTakeWhenVoidReceiptForCategory_1_3_4_5_6_8_9_14_23(string strReceiptNo, ConnectionProvider connProvider) { //1 Fitness Package //3 PT Package //4 Spa Single Treatment //5 Spa Package //6 IPL Package //8 Fitness Combined Package //9 Spa Combined Package TblMemberPackage memberPackage = new TblMemberPackage(); memberPackage.MainConnectionProvider = connProvider; memberPackage.StrReceiptNo = strReceiptNo; DataTable table = memberPackage.SelectAllWstrReceiptNo(strReceiptNo); TblClassAttendance sqlClassAttendance = new TblClassAttendance(); TblServiceSession sqlServiceSession = new TblServiceSession(); sqlClassAttendance.MainConnectionProvider = connProvider; sqlServiceSession.MainConnectionProvider = connProvider; if (table.Rows.Count > 0) { int nPackageID = 0; foreach (DataRow r in table.Rows) { nPackageID = ACMS.Convert.ToInt32(r["nPackageID"]); sqlClassAttendance.NPackageID = nPackageID; DataTable classAttTable = sqlClassAttendance.SelectAllWnPackageIDLogic(); if (classAttTable.Rows.Count > 0) throw new Exception("The item(s) has been used, you are not allow to void the receipt"); else { sqlServiceSession.NPackageID = nPackageID; classAttTable = sqlServiceSession.SelectAllWnPackageIDLogic(); if (classAttTable.Rows.Count > 0) throw new Exception("The item(s) has been used, you are not allow to void the receipt"); } r["nEmployeeID"] = User.EmployeeID; r["nStatusID"] = 2; r["strRemarks"] = "Voided Receipt"; r["dtLastEdit"] = System.DateTime.Now; } memberPackage.SaveData(table); } TblMemberCreditPackage memberCreditPackage = new TblMemberCreditPackage(); memberCreditPackage.MainConnectionProvider = connProvider; memberCreditPackage.StrReceiptNo = strReceiptNo; DataTable table2 = memberCreditPackage.SelectAllWstrReceiptNo(strReceiptNo); TblMemberPackage sqlMemberPackage = new TblMemberPackage(); sqlMemberPackage.MainConnectionProvider = connProvider; if (table2.Rows.Count > 0) { int nCreditPackageID = 0; foreach (DataRow r in table2.Rows) { nCreditPackageID = ACMS.Convert.ToInt32(r["nCreditPackageID"]); DataTable mpTable = sqlMemberPackage.SelectAllWnCreditPackageIDLogic(); if (mpTable.Rows.Count > 0) throw new Exception("The item(s) has been used, you are not allow to void the receipt"); r["nEmployeeID"] = User.EmployeeID; r["nStatusID"] = 2; r["strRemarks"] = "Voided Receipt"; r["dtLastEditDate"] = System.DateTime.Now; } memberCreditPackage.SaveData(table2); } }
private void ActionTakeWhenVoidReceiptForCategory_19(string strReceiptNo, ConnectionProvider connProvider) { //Top-up Single Treatment // strServiceSession = strCode // nSessionID = strReferenceCode // find out the service Session and void it.. TblServiceSession sqlServiceSession = new TblServiceSession(); sqlServiceSession.MainConnectionProvider = connProvider; TblReceiptEntries sqlReceiptEntries = new TblReceiptEntries(); sqlReceiptEntries.MainConnectionProvider = connProvider; sqlReceiptEntries.StrReceiptNo = strReceiptNo; DataTable tableReceiptEntries = sqlReceiptEntries.SelectAllWstrReceiptNoLogic(); if (tableReceiptEntries.Rows.Count > 0) { int nSessionID = 0; foreach (DataRow r in tableReceiptEntries.Rows) { if (!CheckIsRegistrationRow(r)) { nSessionID = ACMS.Convert.ToInt32(r["strReferenceNo"]); sqlServiceSession.NSessionID = nSessionID; sqlServiceSession.SelectOne(); sqlServiceSession.StrRemarks = "Void Receipt : " + strReceiptNo; sqlServiceSession.NStatusID = 1; sqlServiceSession.Update(); } } } }
public void DeleteCreditPackageUsage(int nPackageID) { int nCreditPackageID; TblServiceSession ssUsage = new TblServiceSession(); ssUsage.NPackageID = nPackageID; DataTable tblUsage = ssUsage.SelectAllWnPackageIDLogic(); if (tblUsage.Rows.Count > 0) throw new Exception("You Cant deleted a Used Package."); TblMemberPackage mmbPckg = new TblMemberPackage(); mmbPckg.NPackageID = nPackageID; DataTable table = mmbPckg.SelectOne(); if (table == null || table.Rows.Count == 0) throw new Exception("The Data has been deleted from database."); mmbPckg.NStatusID = 2; mmbPckg.Update(); nCreditPackageID = mmbPckg.NCreditPackageID.Value; //Check any package redeemed from this credit package ACMSDAL.TblMemberPackage memberPackage = new TblMemberPackage(); string cmdText = "Select COUNT(*) from TblMemberPackage Where (nStatusID = 0 or nStatusID = 1) AND " + " nCreditPackageID = @nCreditPackageID "; int nExist = (int) memberPackage.ExecuteScalar(cmdText, new string [] {"@nCreditPackageID"}, new object[] {nCreditPackageID}); if (nExist==0) { TblMemberCreditPackage creditPackage = new TblMemberCreditPackage(); creditPackage.NCreditPackageID = nCreditPackageID; creditPackage.SelectOne(); creditPackage.DtStartDate = SqlDateTime.Null; creditPackage.DtExpiryDate = SqlDateTime.Null; creditPackage.Update(); } }
private void Init() { myServiceSession = new TblServiceSession(); }
/// <summary> /// Use to Transfer Service Session or Update the service Session /// </summary> /// <param name="nSessionID"></param> /// <param name="dtDate"></param> /// <param name="startTime"></param> /// <param name="endTime"></param> /// <param name="strBranchCode"></param> /// <param name="nPackageID"></param> /// <param name="strServiceCode"></param> /// <param name="nEmployeeInChargeID"></param> /// <param name="remark"></param> /// <param name="isTransfer"></param> public void UpdateServiceSession(int nSessionID, DateTime dtDate, DateTime startTime, DateTime endTime, string strBranchCode, int nPackageID, string strServiceCode, int nEmployeeInChargeID, string remark, int status, bool isTransfer) { TblServiceSession serviceSession = new TblServiceSession(); serviceSession.NSessionID = nSessionID; DataTable table = serviceSession.SelectOne(); if (table == null || table.Rows.Count == 0) throw new Exception("failed to update this package. Record not found"); TblService service = new TblService(); service.StrServiceCode = strServiceCode; DataTable serviceTable = service.SelectOne(); if (serviceTable == null || serviceTable.Rows.Count == 0) throw new Exception("The service is not available."); int duration = ACMS.Convert.ToInt32(service.NDuration); bool isPT = ACMS.Convert.ToInt32(service.NServiceTypeID) == 0; if (!isTransfer) { if (!isPT && !ACMSLogic.SpaBooking.VerifyMemberPackageAllowCertainService(nPackageID, strServiceCode)) throw new Exception("this member package is not allow to use the service"); if (endTime == DateTime.MinValue) endTime = startTime.AddMinutes((Double)duration); if (dtDate != DateTime.MinValue) serviceSession.DtDate = dtDate; if (startTime != DateTime.MinValue) serviceSession.DtStartTime = startTime; if (endTime != DateTime.MinValue) serviceSession.DtEndTime= endTime; if (strBranchCode != "") serviceSession.StrBranchCode = strBranchCode; if (strServiceCode != "") serviceSession.StrServiceCode = strServiceCode; if (nEmployeeInChargeID != -1) serviceSession.NServiceEmployeeID = nEmployeeInChargeID; if (nPackageID != -1) serviceSession.NPackageID = nPackageID; if (remark != "") serviceSession.StrRemarks = remark; if (status != -1) serviceSession.NStatusID = status; if (status == 5) serviceSession.NMarkedByID = User.EmployeeID; } else { serviceSession.NPackageID = nPackageID; } myMemberPackage.NPackageID = nPackageID; DataTable memberPackageTable = myMemberPackage.SelectOne(); if (memberPackageTable == null || memberPackageTable.Rows.Count == 0) throw new Exception("Failed to create new service session. Member Package with npackageID = "+ nPackageID.ToString() + "has been deleted"); DataRow masterRow = memberPackageTable.Rows[0]; if (masterRow["dtStartDate"] == DBNull.Value) { // Means new class Attendance gonna insert TblPackage package = new TblPackage(); package.StrPackageCode = masterRow["strPackageCode"].ToString(); DataTable tablePackage = package.SelectOne(); if (tablePackage == null && tablePackage.Rows.Count == 0) throw new Exception("Failed to update service session. Package no found."); myMemberPackage.DtStartDate = serviceSession.DtDate.Value; myMemberPackage.DtExpiryDate = serviceSession.DtDate.Value.AddMonths(package.NPackageDuration.Value).AddDays(-1); } else { DateTime memberPackageStartDate = ACMS.Convert.ToDateTime(masterRow["DtStartDate"]); DateTime memberPackageExpiryDate = ACMS.Convert.ToDateTime(masterRow["dtExpiryDate"]); if (memberPackageStartDate > serviceSession.DtDate.Value) { myMemberPackage.DtExpiryDate = memberPackageExpiryDate.Subtract(memberPackageStartDate.Subtract(serviceSession.DtDate.Value)); } } serviceSession.NEmployeeID = User.EmployeeID; serviceSession.DtLastEditDate = DateTime.Now; ACMSDAL.ConnectionProvider connProvider = new ConnectionProvider(); try { myMemberPackage.MainConnectionProvider = connProvider; serviceSession.MainConnectionProvider = connProvider; connProvider.OpenConnection(); connProvider.BeginTransaction("SaveServiceSession"); myMemberPackage.Update(); serviceSession.Update(); connProvider.CommitTransaction(); } catch (Exception) { connProvider.RollbackTransaction("SaveServiceSession"); throw new Exception("Failed to save Service Session"); } finally { if (connProvider.CurrentTransaction != null) connProvider.CurrentTransaction.Dispose(); if (connProvider.DBConnection != null) { if (connProvider.DBConnection.State == ConnectionState.Open) connProvider.DBConnection.Close(); } myMemberPackage.MainConnactionIsCreatedLocal = true; serviceSession.MainConnactionIsCreatedLocal = true; } }
private void ActionTakeWhenVoidReceiptForCategory_7(string strReceiptNo, ConnectionProvider connProvider) { TblMemberCreditPackage memberCreditPackage = new TblMemberCreditPackage(); memberCreditPackage.MainConnectionProvider = connProvider; DataTable table = memberCreditPackage.SelectAllWstrReceiptNo(strReceiptNo); TblMemberPackage sqlMemberPackage = new TblMemberPackage(); sqlMemberPackage.MainConnectionProvider = connProvider; if (table.Rows.Count > 0) { int nCreditPackageID = 0; foreach (DataRow r in table.Rows) { nCreditPackageID = ACMS.Convert.ToInt32(r["nCreditPackageID"]); sqlMemberPackage.NCreditPackageID = nCreditPackageID; DataTable memberPackagetable = sqlMemberPackage.SelectAllWnCreditPackageIDLogic(); if (Convert.ToInt32(memberPackagetable.Compute("COUNT(nStatusID)", "nStatusID=0 OR nStatusID=1")) > 0) throw new Exception("The item(s) has been used, you are not allow to void the receipt"); r["nEmployeeID"] = User.EmployeeID; r["nStatusID"] = 2; r["strRemarks"] = "Voided Receipt"; r["dtLastEditDate"] = System.DateTime.Now; } memberCreditPackage.SaveData(table); } sqlMemberPackage.StrReceiptNo = strReceiptNo; DataTable tblMemPackage = sqlMemberPackage.SelectAllWstrReceiptNo(strReceiptNo); TblClassAttendance sqlClassAttendance = new TblClassAttendance(); TblServiceSession sqlServiceSession = new TblServiceSession(); sqlClassAttendance.MainConnectionProvider = connProvider; sqlServiceSession.MainConnectionProvider = connProvider; if (tblMemPackage.Rows.Count > 0) { int nPackageID = 0; foreach (DataRow row in tblMemPackage.Rows) { nPackageID = ACMS.Convert.ToInt32(row["nPackageID"]); sqlClassAttendance.NPackageID = nPackageID; DataTable classAttTable = sqlClassAttendance.SelectAllWnPackageIDLogic(); if (classAttTable.Rows.Count > 0) throw new Exception("The item(s) has been used, you are not allow to void the receipt"); else { sqlServiceSession.NPackageID = nPackageID; classAttTable = sqlServiceSession.SelectAllWnPackageIDLogic(); if (classAttTable.Rows.Count > 0) throw new Exception("The item(s) has been used, you are not allow to void the receipt"); } row["nEmployeeID"] = User.EmployeeID; row["nStatusID"] = 2; row["strRemarks"] = "Voided Receipt"; row["dtLastEdit"] = System.DateTime.Now; } sqlMemberPackage.SaveData(tblMemPackage); } }
private void CalculateBalance(string strMembershipID,string strMembershipPackageCode) { if (myDataTable != null) { if (!myDataTable.Columns.Contains("strBalNew")) { DataColumn colBalNew = new DataColumn("strBalNew", System.Type.GetType("System.String")); myDataTable.Columns.Add(colBalNew); } if (!myDataTable.Columns.Contains("Balance")) { DataColumn colBalance = new DataColumn("Balance", System.Type.GetType("System.Int32")); myDataTable.Columns.Add(colBalance); } if (!myDataTable.Columns.Contains("strPackageType")) { DataColumn colPackageType = new DataColumn("strPackageType", System.Type.GetType("System.String")); myDataTable.Columns.Add(colPackageType); } TblClassAttendance classAttendance = new TblClassAttendance(); TblServiceSession serviceSession = new TblServiceSession(); DataTable gymTable = new DataTable(); DataColumn colDtdate = new DataColumn("dtDate", typeof(string)); DataColumn colPackageID = new DataColumn("nPackageID", typeof(int)); DataColumn colAttendanceID = new DataColumn("nAttendanceID", typeof(int)); gymTable.Columns.Add(colDtdate); gymTable.Columns.Add(colPackageID); gymTable.Columns.Add(colAttendanceID); foreach (DataRow r in myDataTable.Rows) { r["Balance"] = r["nMaxSession"]; if (ACMS.Convert.ToInt32(r["nMaxSession"]) == 9999) { r["Balance"] = 9999; r["strBalNew"] = r["Balance"].ToString(); if (r["dtStartDate"] == DBNull.Value) r["strBalNew"] = "New"; else { if (r["strPackageType"].ToString() == "Normal Package") { if (ACMS.Convert.ToInt32(r["nMaxSession"]) == ACMS.Convert.ToInt32(r["Balance"]) && ACMS.Convert.ToInt32(r["nMaxSession"])!=9999) r["strBalNew"] = "New"; } } continue; } int nCategoryID = ACMS.Convert.ToInt32(r["nCategoryID"]); int nPackageID = ACMS.Convert.ToInt32(r["nPackageID"]); // class Attendance if (nCategoryID == 1 || nCategoryID == 2) { classAttendance.NPackageID = nPackageID; DataTable classAttendanceTable = classAttendance.SelectAllWnPackageIDLogic(); if (classAttendanceTable == null || classAttendanceTable.Rows.Count == 0) { if (ACMS.Convert.ToDBInt32(r["nAdjust"])>=1 && ACMS.Convert.ToInt32(r["nMaxSession"]) < 9999) { r["Balance"]=ACMS.Convert.ToDBInt32(r["Balance"])-ACMS.Convert.ToDBInt32(r["nAdjust"]); } r["strBalNew"] = r["Balance"].ToString(); if (r["dtStartDate"] == DBNull.Value) r["strBalNew"] = "New"; else { if (r["strPackageType"].ToString() == "Normal Package") { if (ACMS.Convert.ToInt32(r["nMaxSession"]) == ACMS.Convert.ToInt32(r["Balance"])) r["strBalNew"] = "New"; } } continue; } DataView classAttendanceTableView = classAttendanceTable.DefaultView; // Need to filter out the non GYM attendance here classAttendanceTableView.RowFilter = "((nStatusID = 1 or nStatusID = 2) AND nTypeID = 0)"; if (classAttendanceTableView.Count > 0) { ACMSDAL.TblMemberPackage sqlFindPackageCode = new ACMSDAL.TblMemberPackage(); string strPackageCode = sqlFindPackageCode.GetPackageCode(strMembershipID, nPackageID); //if (strPackageCode == "AA(1080/12)" || strPackageCode == "AA(2160/24)" ) //{ // r["Balance"] = ACMS.Convert.ToInt32(r["Balance"]) - myDTransactionID; //} if (r["fEntries"].ToString()=="True") { if (nCategoryID == 2) //2604 { string strPackageID = nPackageID.ToString(); ACMSDAL.TblMemberPackage sqlCalcTotalGIRO = new ACMSDAL.TblMemberPackage();//jackie 15/03/2012 int intTotalGIRO = sqlCalcTotalGIRO.CalculateTotalGIRO(strMembershipID, strPackageID, strPackageCode); ACMSDAL.TblMemberPackage sqlCalcPackages = new ACMSDAL.TblMemberPackage(); int myDTransactionID = sqlCalcPackages.CalculateSpecialSessionPackages(strMembershipID, nPackageID); r["Balance"] = (intTotalGIRO * ACMS.Convert.ToInt32(r["Balance"])) - myDTransactionID; } else { //1203 jackie ACMSDAL.TblMemberPackage sqlCalcPackages = new ACMSDAL.TblMemberPackage(); int myDTransactionID = sqlCalcPackages.CalculateSpecialSessionPackages(strMembershipID, nPackageID); r["Balance"] = ACMS.Convert.ToInt32(r["Balance"]) - myDTransactionID; } } else//2604 if ( strPackageCode == "FTRIAL") { r["Balance"] = classAttendanceTableView.Count; } else { if (nCategoryID == 2 || ACMS.Convert.ToInt32(r["Balance"]) == 9999) //2604 { string strPackageID = nPackageID.ToString(); ACMSDAL.TblMemberPackage sqlCalcTotalGIRO = new ACMSDAL.TblMemberPackage();//jackie 15/03/2012 int intTotalGIRO = sqlCalcTotalGIRO.CalculateTotalGIRO(strMembershipID, strPackageID,strPackageCode); r["Balance"] = (intTotalGIRO * ACMS.Convert.ToInt32(r["Balance"])) - classAttendanceTableView.Count; } else { r["Balance"] = ACMS.Convert.ToInt32(r["Balance"]) - classAttendanceTableView.Count; } } } else { if (nCategoryID == 2) //2604 { if (r["fEntries"].ToString() == "True") { ACMSDAL.TblMemberPackage sqlFindPackageCode = new ACMSDAL.TblMemberPackage(); string strPackageCode = sqlFindPackageCode.GetPackageCode(strMembershipID, nPackageID); string strPackageID = nPackageID.ToString(); ACMSDAL.TblMemberPackage sqlCalcTotalGIRO = new ACMSDAL.TblMemberPackage();//jackie 15/03/2012 int intTotalGIRO = sqlCalcTotalGIRO.CalculateTotalGIRO(strMembershipID, strPackageID, strPackageCode); ACMSDAL.TblMemberPackage sqlCalcPackages = new ACMSDAL.TblMemberPackage(); int myDTransactionID = sqlCalcPackages.CalculateSpecialSessionPackages(strMembershipID, nPackageID); r["Balance"] = (intTotalGIRO * ACMS.Convert.ToInt32(r["Balance"])); } else { ACMSDAL.TblMemberPackage sqlFindPackageCode = new ACMSDAL.TblMemberPackage(); string strPackageCode = sqlFindPackageCode.GetPackageCode(strMembershipID, nPackageID); string strPackageID = nPackageID.ToString(); ACMSDAL.TblMemberPackage sqlCalcTotalGIRO = new ACMSDAL.TblMemberPackage();//jackie 15/03/2012 int intTotalGIRO = sqlCalcTotalGIRO.CalculateTotalGIRO(strMembershipID, strPackageID, strPackageCode); r["Balance"] = (intTotalGIRO * ACMS.Convert.ToInt32(r["Balance"])); } } } if (ACMS.Convert.ToDBInt32(r["nAdjust"])>=1 && ACMS.Convert.ToInt32(r["nMaxSession"]) < 9999) { r["Balance"]=ACMS.Convert.ToDBInt32(r["Balance"])-ACMS.Convert.ToDBInt32(r["nAdjust"]); } // Start calculate the POWER Package // It is consider PWR Package if the class attendance is GYM Class classAttendanceTableView.RowFilter = "((nStatusID = 1 or nStatusID = 2) AND nTypeID = 1 AND nPackageID ='" +nPackageID+ "')"; if (classAttendanceTableView.Count > 0) { for (int i = 0; i < classAttendanceTableView.Count; i ++) { DataRow row = classAttendanceTableView[i].Row; string dtDate = ACMS.Convert.ToDateTime(row["dtDate"]).ToString("yyyy/MM/dd"); int nAttendanceID = ACMS.Convert.ToInt32(row["nAttendanceID"]); DataRow[] foundRow = gymTable.Select("dtDate = '" + dtDate + "'" + "AND nPackageID = '" + nPackageID + "'"); if (foundRow.Length == 0) { DataRow addRow = gymTable.NewRow(); addRow["dtDate"] = dtDate; addRow["nPackageID"] = nPackageID; addRow["nAttendanceID"] = nAttendanceID; gymTable.Rows.Add(addRow); } } foreach (DataRow pRow in gymTable.Rows) { DateTime dtDate = ACMS.Convert.ToDateTime(pRow["dtDate"]); int nPackageIDInGymTable = ACMS.Convert.ToInt32(pRow["nPackageID"]); string strFilter = string.Format("(nStatusID = 1 or nStatusID = 2) " + " AND nTypeID = 0 AND nPackageID = {0} AND DtDate = #{1}#", nPackageID, dtDate.ToString("yyyy/MM/dd")); DataRow[] foundRow = classAttendanceTable.Select(strFilter, "nPackageID", DataViewRowState.CurrentRows); if (foundRow.Length > 0) r["Balance"] = ACMS.Convert.ToInt32(r["Balance"]) + 1; } if (gymTable.Rows.Count>0) r["Balance"] = ACMS.Convert.ToInt32(r["Balance"]) - gymTable.Rows.Count; gymTable.Rows.Clear(); //////////// //ACMSDAL.TblMemberPackage sqlCalcPackages = new ACMSDAL.TblMemberPackage();//jackie 15/03/2012 //int myDTransactionID = sqlCalcPackages.CalculateSpecialSessionPackages(strMembershipID, nPackageID); //ACMSDAL.TblMemberPackage sqlFindPackageCode = new ACMSDAL.TblMemberPackage(); //string strPackageCode = sqlFindPackageCode.GetPackageCode(strMembershipID, nPackageID); ////if (strPackageCode == "AA(1080/12)" || strPackageCode == "AA(2160/24)") ////{ //// r["Balance"] = ACMS.Convert.ToInt32(r["nMaxSession"]) - myDTransactionID; ////} //if (r["fEntries"].ToString() == "True") //{ // r["Balance"] = ACMS.Convert.ToInt32(r["nMaxSession"]) - myDTransactionID; //} //else // if (strPackageCode == "FTRIAL") // { // r["Balance"] = myDTransactionID; // } // else // ///////// // { // r["Balance"] = ACMS.Convert.ToInt32(r["Balance"]) - gymTable.Rows.Count; // } //gymTable.Rows.Clear(); } } else if (nCategoryID == 3 || nCategoryID == 4 || nCategoryID == 5 || nCategoryID == 6 || nCategoryID == 34) // Service Session { serviceSession.NPackageID = nPackageID; DataView serviceSessionTable = serviceSession.SelectAllWnPackageIDLogic().DefaultView; serviceSessionTable.RowFilter = "nStatusID = 5 or nStatusID = 6"; if (nCategoryID == 34) { r["Balance"] = ACMS.Convert.ToInt32(r["Balance"]) - serviceSessionTable.Count + ACMS.Convert.ToDBInt32(r["nAdjust"]); } else { ACMSDAL.TblMemberPackage sqlCalcPackages = new ACMSDAL.TblMemberPackage();//jackie 15/03/2012 int myDTransactionID = sqlCalcPackages.CalculateSpecialSessionPackages(strMembershipID, nPackageID); ACMSDAL.TblMemberPackage sqlFindPackageCode = new ACMSDAL.TblMemberPackage(); string strPackageCode = sqlFindPackageCode.GetPackageCode(strMembershipID, nPackageID); if (strPackageCode == "AA(1080/12)" || strPackageCode == "AA(2160/24)" ) { r["Balance"] = ACMS.Convert.ToInt32(r["Balance"]) - myDTransactionID; } else if (strPackageCode == "FTRIAL") { r["Balance"] = myDTransactionID; } else { if (nCategoryID == 2 || ACMS.Convert.ToInt32(r["Balance"]) == 9999) //2604 { string strPackageID = nPackageID.ToString(); ACMSDAL.TblMemberPackage sqlCalcTotalGIRO = new ACMSDAL.TblMemberPackage();//jackie 15/03/2012 int intTotalGIRO = sqlCalcTotalGIRO.CalculateTotalGIRO(strMembershipID, strPackageID,strPackageCode); r["Balance"] = (intTotalGIRO * ACMS.Convert.ToInt32(r["Balance"])) - serviceSessionTable.Count; } else { r["Balance"] = ACMS.Convert.ToInt32(r["Balance"]) - serviceSessionTable.Count; } } if (ACMS.Convert.ToDBInt32(r["nAdjust"]) >= 1 && ACMS.Convert.ToInt32(r["nMaxSession"]) < 9999) { //jackie r["Balance"] = ACMS.Convert.ToDBInt32(r["Balance"]) - ACMS.Convert.ToDBInt32(r["nAdjust"]); } } //if (dr["strFreePkgCode"].ToString() != string.Empty) //{ // myPOS.EditItemFreebieAndDiscount(dr["strFreePkgCode"].ToString()); //} } r["strBalNew"] = r["Balance"].ToString(); if (r["dtStartDate"] == DBNull.Value) r["strBalNew"] = "New"; else { if (r["strPackageType"].ToString() == "Normal Package") { if (ACMS.Convert.ToInt32(r["nMaxSession"]) == ACMS.Convert.ToInt32(r["Balance"])) r["strBalNew"] = "New"; } } } } }
private void simpleButton1_Click(object sender, System.EventArgs e) { //if (DateTime.Compare(dtEdtStartTime.DateTime.Date, DateTime.Today.Date) < 0) //{ // if (oUser.NRightsLevelID() >= 1003 && oUser.NRightsLevelID() <= 1004 ) // { // MessageBox.Show(this, "Invalid Date. Pls choose other date."); // this.DialogResult = DialogResult.None; // return; // } //} //this.DialogResult = DialogResult.OK; //DEREK if (lkpEdtBranchCode.Text == "") { MessageBox.Show(this, "No Branch Selected."); this.DialogResult = DialogResult.None; //return; } else if (lkpEdtEmployeeID.Text == "") { MessageBox.Show(this, "No Therapist Selected"); this.DialogResult = DialogResult.None; //return; } else if (lkpEdtServiceCode.Text == "") { MessageBox.Show(this, "No Treatment Selected."); this.DialogResult = DialogResult.None; //return; } else { try { TblEmployee myPT = new TblEmployee(); myPT.NEmployeeID = this.TherapistID; DataTable tblPT = myPT.SelectOne(); MemberPackage myMemPackage = new MemberPackage(); DataTable tblMemberPackageBalance = MemberPackage.CalculateMemberPackageBalance(this.ServiceCode, myMemberShipID, myPackageID); myPackageBalance = (Convert.ToInt32(tblMemberPackageBalance.Rows[0]["Balance"].ToString()) - 1); string strBalance = myPackageBalance.ToString(); string strTherapist = tblPT.Rows[0]["strEmployeeName"].ToString(); string strExpiryDate = Convert.ToDateTime(tblMemberPackageBalance.Rows[0]["dtExpiryDate"]).ToString("dd/MM/yyyy"); //** Insert Signature eric 15052009 //================================== string strSignatureID = ""; string strKeyData = ""; string strDateTime = DateTime.Now.ToString("dd/MM/yyyy hh:mm:ss tt"); string strDateTimeMM = DateTime.Now.ToString("dd/MM/yyyy hh:mm tt"); string strPdfExportPath = ""; //int mySessionID = 0; DataTable dtss = new DataTable(); dtss.Columns.Add("nSessionID", typeof(int)); dtss.Columns.Add("strMembershipID", typeof(string)); mydtSessionID = dtss; //Key data format for PT Service Utilisation //MemberID|DateTime|ExpiryDate|Branch|PT|PkgCode|ServCode|Qty|Bal strPdfExportPath = (string)ConfigurationSettings.AppSettings["SavePTServiceReceiptPath"].ToString() + "\\" + User.BranchCode + "\\" + myMemberShipID.Trim() + "_" + strDateTime.Replace(":", "").Replace(" ", "").Replace("/", "") + ".pdf"; strKeyData = myMemberShipID.Trim() + "|" + strExpiryDate + "|" + this.BranchCode + "|" + strTherapist + "|" + myPackageCode + "|" + this.ServiceCode + "|" + strBalance + "|1"; myKeyData = strKeyData; if (myPackageCategoryID == 3) { MemberPackage myMemberPackage = new MemberPackage(); myMemberPackage.NewServiceSession(myPackageID, this.ServiceCode, myMemberShipID.Trim(), this.TherapistID, this.BranchCode, this.Date, this.StartTime, this.StartTime, "", 1, this.bforfeit, myPackageCategoryID, strKeyData, strPdfExportPath, ref mydtSessionID, ""); } bool outputPrint = false; //Derek From Credit Package Usage Do not print if (!myIsFromCreditUsage) { if (myPackageCategoryID == 3) { DigSignature frmSig = new DigSignature(strKeyData, "ServiceUtilisation",null, null, dtServiceUtilization); DialogResult result1 = frmSig.ShowDialog(); if (result1 == DialogResult.OK) { strSignatureID = frmSig.ShowSignature(); //**DEREK Need Fixing here Update Service Session Signature ID ** try { //Derek Need Fixing Here loop throught mydtSessionID foreach (DataRow row in mydtSessionID.Rows) { //Derek Need Fixing Here - Update only strSignatureID and strPdfExportPath TblServiceSession myServiceSessionSigPath = new TblServiceSession(); if (strSignatureID.Trim() != "" && strSignatureID.Trim() != "300D0A300D0A") { myServiceSessionSigPath.UpdateServiceSessionSigPdfPath(strSignatureID, strKeyData, strPdfExportPath, Convert.ToInt32(row["nSessionID"]), myMemberShipID); } else { myServiceSessionSigPath.UpdateServiceSessionSigPdfPath(strPdfExportPath, Convert.ToInt32(row["nSessionID"]), myMemberShipID); } } } catch { } outputPrint = true; /*if (strSignatureID == null || strSignatureID == "") { DialogResult yes = MessageBox.Show(this, "Member haven't signed on signature pad. Confirm to print?", "Warning", MessageBoxButtons.YesNo); if (yes == DialogResult.No) return; }*/ //OnPrintMemberPackageUsage(tblTherapist.Rows[0]["strEmployeeName"].ToString(), CurrentMembershipID, MemberPackageStrPackageCode, frm.ServiceCode, strBalance);//eric 18052009 //**Call Print Package A/C report //rpt.PrintRpt(strSignatureID, CurrentMembershipID, strDateTime, frm.BranchCode, strTherapist, MemberPackageStrPackageCode, frm.ServiceCode, strBalance); } PackageAccountRpt rpt = new PackageAccountRpt(); rpt.PrintRpt("Personal Trainer :", strSignatureID, strKeyData, myMemberShipID.Trim(), strDateTimeMM, strExpiryDate, this.BranchCode, strTherapist, myPackageCode, this.ServiceCode, strBalance, 1); string exportPath = (string)ConfigurationSettings.AppSettings["SavePTServiceReceiptPath"].ToString(); rpt.ExportToPdf(exportPath + "\\" + User.BranchCode + "\\" + myMemberShipID.Trim() + "_" + strDateTime.Replace(":", "").Replace(" ", "").Replace("/", "") + ".pdf"); if (outputPrint) { rpt.Print(); } //InitMemberPackage(CurrentMembershipID); //OnMemberPackageGridFocusRowChanged(); } } else { if (myPackageCategoryID == 3) { //Update DataTable DataTable dt = new DataTable(); dt.Columns.Add("Caption", typeof(string)); dt.Columns.Add("MemberID", typeof(string)); dt.Columns.Add("DateTime", typeof(string)); dt.Columns.Add("ExpiryDate", typeof(string)); dt.Columns.Add("BranchCode", typeof(string)); dt.Columns.Add("StaffName", typeof(string)); dt.Columns.Add("PackageCode", typeof(string)); dt.Columns.Add("PackageDesc", typeof(string));//lblPackageDesc.Text dt.Columns.Add("ServiceCode", typeof(string)); dt.Columns.Add("Balance", typeof(string)); dt.Columns.Add("Quantity", typeof(int)); //dt.Columns.Add("mySessionID", typeof(int)); //**DEREK Need Fixing here dt.Rows.Add("Personal Trainer :", myMemberShipID.Trim(), strDateTimeMM, strExpiryDate, this.BranchCode, strTherapist, myPackageCode, lblPackageDesc.Text.ToString(), this.ServiceCode, strBalance, 1); mydtServiceUtilization = dt; } } } catch (Exception ex) { this.DialogResult = DialogResult.None; MessageBox.Show(this, ex.Message); } } }
public void DeleteServiceSession(int nPackageID, int nSessionID, string remark) { // i need to know it is only one record, and it is 1st record also TblServiceSession serviceSession = new TblServiceSession(); serviceSession.NPackageID = nPackageID; DataTable table = serviceSession.SelectAllWnPackageIDLogic(); bool setNullInMemberPackage = false; bool isDelete1stRecord = false; DateTime newfirstRecordServiceSessionDate = DateTime.MinValue; if (table != null && table.Rows.Count > 0) { if (table.Rows.Count == 1) { setNullInMemberPackage = true; } else { DataRow [] rowList = table.Select("", "nSessionID", DataViewRowState.CurrentRows); int firstRecord_nSessionID = ACMS.Convert.ToInt32(rowList[0]["nSessionID"]); if (firstRecord_nSessionID == nSessionID) { isDelete1stRecord = true; newfirstRecordServiceSessionDate = ACMS.Convert.ToDateTime(rowList[1]["dtDate"]); } } } serviceSession.NSessionID = nSessionID; serviceSession.SelectOne(); serviceSession.DtLastEditDate = DateTime.Now; serviceSession.NEmployeeID = ACMSLogic.User.EmployeeID; //serviceSession.NPackageID = -1; serviceSession.NStatusID = 1; serviceSession.StrRemarks = remark; TblAudit audit = new TblAudit(); audit.DtDate = DateTime.Now; audit.NAuditTypeID = 4; audit.NEmployeeID = User.EmployeeID; audit.StrAuditEntry = "Delete service session with nSessionID = " + nSessionID+ " and nPackageID = " + nPackageID; audit.StrReference = nSessionID.ToString(); TblMemberPackage memberPackage = new TblMemberPackage(); memberPackage.NPackageID = nPackageID; memberPackage.SelectOne(); if (setNullInMemberPackage) { bool isUnlimited = memberPackage.IsUnlimitedPackage(nPackageID); if (!isUnlimited) { memberPackage.DtStartDate = System.Data.SqlTypes.SqlDateTime.Null; memberPackage.DtExpiryDate = System.Data.SqlTypes.SqlDateTime.Null; memberPackage.DtLastEdit = DateTime.Now; memberPackage.NEmployeeID = User.EmployeeID; } } else if (isDelete1stRecord) { TimeSpan duration = memberPackage.DtExpiryDate.Value.Subtract(memberPackage.DtStartDate.Value); DateTime newExpriry = newfirstRecordServiceSessionDate.Add(duration); memberPackage.DtExpiryDate = newExpriry; memberPackage.DtStartDate = newfirstRecordServiceSessionDate; } ACMSDAL.ConnectionProvider connProvider = new ConnectionProvider(); try { memberPackage.MainConnectionProvider = connProvider; serviceSession.MainConnectionProvider = connProvider; audit.MainConnectionProvider = connProvider; connProvider.OpenConnection(); connProvider.BeginTransaction("DeleteServiceSession"); memberPackage.Update(); audit.Insert(); serviceSession.Update(); connProvider.CommitTransaction(); //return true; } catch (Exception) { connProvider.RollbackTransaction("DeleteServiceSession"); throw new Exception("Failed to delete Service Session"); } finally { if (connProvider.CurrentTransaction != null) connProvider.CurrentTransaction.Dispose(); if (connProvider.DBConnection != null) { if (connProvider.DBConnection.State == ConnectionState.Open) connProvider.DBConnection.Close(); } memberPackage.MainConnactionIsCreatedLocal = true; serviceSession.MainConnactionIsCreatedLocal = true; audit.MainConnactionIsCreatedLocal = true; } }
/// <summary> /// Balance for new member package is not allow to set nMaxSession is bcoz need the value zero /// to do calculation In POS /// </summary> /// <param name="strMembershipID"></param> /// <returns></returns> public DataView GetActive_n_NonFreeMemberPackage_For_POS_Calculation(string strMembershipID) { //DataTable table = myMemberPackage.GetActivenNonFreeMemberPackage(strMembershipID); DataTable table = myMemberPackage.GetActivenNonFreeMemberPackage(strMembershipID); if (table != null) { if (!table.Columns.Contains("Balance")) { DataColumn colBalance = new DataColumn("Balance", System.Type.GetType("System.Int32")); table.Columns.Add(colBalance); } if (!table.Columns.Contains("FNew")) { DataColumn colNew = new DataColumn("FNew", System.Type.GetType("System.Int32")); table.Columns.Add(colNew); } TblClassAttendance classAttendance = new TblClassAttendance(); TblServiceSession serviceSession = new TblServiceSession(); foreach (DataRow r in table.Rows) { int nCategoryID = ACMS.Convert.ToInt32(r["nCategoryID"]); int nPackageID = ACMS.Convert.ToInt32(r["nPackageID"]); // class Attendance if (nCategoryID == 1 || nCategoryID == 2) { classAttendance.NPackageID = nPackageID; DataView classAttendanceTable = classAttendance.SelectAllWnPackageIDLogic().DefaultView; classAttendanceTable.RowFilter = "nStatusID = 1 or nStatusID = 2"; if (classAttendanceTable.Count > 0) { r["Balance"] = ACMS.Convert.ToInt32(r["nMaxSession"]) - classAttendanceTable.Count; r["FNew"] = 0; } else { r["Balance"] = 0; r["FNew"] = 1; } } else if (nCategoryID == 3 || nCategoryID == 4 || nCategoryID == 5 || nCategoryID == 6) // Service Session { /// Checkout any Outstanding for nCategoryID == 3 PT 13/09/2012 //if (nCategoryID == 3) //{ // ACMSDAL.TblMemberPackage sqlCalcAnyOS = new ACMSDAL.TblMemberPackage(); // int dOutAmount = sqlCalcAnyOS.CalculateAnyOutStandingPayment(strMembershipID, nCategoryID); // if (dOutAmount > 0) // { // } //} /// serviceSession.NPackageID = nPackageID; DataView serviceSessionTable = serviceSession.SelectAllWnPackageIDLogic().DefaultView; serviceSessionTable.RowFilter = "nStatusID = 5 or nStatusID = 6"; if (serviceSessionTable.Count > 0) { r["Balance"] = ACMS.Convert.ToInt32(r["nMaxSession"]) - serviceSessionTable.Count; r["FNew"] = 0; } else { r["Balance"] = 0; r["FNew"] = 1; } } } } table.DefaultView.RowFilter = " Balance > 0 OR (Balance = 0 AND FNew = 1)"; return table.DefaultView; }
internal DataTable GetAttendedServiceCode(int nPackageID) { TblServiceSession serviceSession = new TblServiceSession(); return serviceSession.GetValidServiceCodeBasePackageID(nPackageID); }
public DataTable GetMemberServiceSessionBasePackageID(int nPackageID, string strMemberShipID, string strBranchCode) { TblServiceSession serviceSession = new TblServiceSession(); return serviceSession.GetMemberServiceSessionBasePackageID(nPackageID, strMemberShipID, strBranchCode); }
private int UpgradePackage(ACMSDAL.ConnectionProvider connProvider, ACMSLogic.POS pos) { int OriginalCategoryID = 10 ; if (pos.NCategoryID == 10 && pos.WantToUpgradeMemberPackageTable.Rows.Count == 1) { int wantToUpgrade_nPackageID = ACMS.Convert.ToInt32(pos.WantToUpgradeMemberPackageRow["nPackageID"]); string oldStrPackageCode = pos.WantToUpgradeMemberPackageRow["strPackageCode"].ToString(); foreach (DataRow r in pos.ReceiptItemsTable.Rows) { pos.CheckPackageWhenSave(r["strCode"].ToString(), wantToUpgrade_nPackageID); } // from here, we can get a list of strClassCode that already been used by member //DataTable attendedClassCodetable = GetAttendedClassCode(ACMS.Convert.ToInt32(myWantToUpgradeMemberPackageTable.Rows[0]["nPackageID"])); // from here, we can get a list of strClassCode that already been used by member //DataTable attendedServiceCodetable = GetAttendedServiceCode(ACMS.Convert.ToInt32(myWantToUpgradeMemberPackageTable.Rows[0]["nPackageID"])); TblMemberPackage memberPackage = new TblMemberPackage(); TblClassAttendance classAttendance = new TblClassAttendance(); TblServiceSession serviceSession = new TblServiceSession(); TblPackage freeSpaPackage = new TblPackage(); memberPackage.MainConnectionProvider = connProvider; classAttendance.MainConnectionProvider = connProvider; serviceSession.MainConnectionProvider = connProvider; freeSpaPackage.MainConnectionProvider = connProvider; DataTable memberPackagetable = memberPackage.FillSchema("Select * from tblMemberPackage"); //get old free spa package Code freeSpaPackage.StrPackageCode = oldStrPackageCode; DataTable OldFreePackageCode = freeSpaPackage.SelectSpaPackageFreebie(); string strOldFreePackage = OldFreePackageCode.Rows[0]["strFreePkgCode"].ToString(); foreach (DataRow r in pos.ReceiptItemsTable.Rows) { int nQuantity = ACMS.Convert.ToInt32(r["nQuantity"]); for (int i = 0; i < nQuantity; i++) { DataRow rowToAdd = memberPackagetable.NewRow(); MemberPackage.InitMemberPackageRowInPOS(rowToAdd, pos.StrReceiptNo, pos.StrMembershipID, r["strCode"].ToString(), "", false); memberPackagetable.Rows.Add(rowToAdd); } } //insert a new upgrade package to member package if (memberPackagetable.Rows.Count > 0) memberPackage.SaveData(memberPackagetable); DataTable newAddMemberPackageTable = memberPackage.SelectAllWstrReceiptNo(pos.StrReceiptNo); DataRow[] rowNewAddMemberPackage = newAddMemberPackageTable.Select("fFree = 0"); DataTable attendedClassTable = classAttendance.GetAllClassAttendancesBasePackageID(wantToUpgrade_nPackageID, pos.StrMembershipID, pos.StrBranchCode); DataTable serviceUsedTable = serviceSession.GetMemberServiceSessionBasePackageID(wantToUpgrade_nPackageID, pos.StrMembershipID, pos.StrBranchCode); //insert a new freebie package based on new added upgrade pacakge string newStrPackageCode = ""; for( int i = 0; i<newAddMemberPackageTable.Rows.Count; i++) { if (newAddMemberPackageTable.Rows[i]["fFree"].ToString() == "False") { if (newAddMemberPackageTable.Rows.Count > 1) newStrPackageCode = newAddMemberPackageTable.Rows[newAddMemberPackageTable.Rows.Count - 1]["strPackageCode"].ToString(); else newStrPackageCode = newAddMemberPackageTable.Rows[0]["strPackageCode"].ToString(); } } //get new free spa package Code freeSpaPackage.StrPackageCode = newStrPackageCode; DataTable NewFreePackageCode = freeSpaPackage.SelectSpaPackageFreebie(); string strNewFreePackage = NewFreePackageCode.Rows[0]["strFreePkgCode"].ToString(); if (strNewFreePackage != "") { DataTable FreememberPackagetable = memberPackage.FillSchema("Select * from tblMemberPackage"); DataRow rowToAdd2 = FreememberPackagetable.NewRow(); MemberPackage.InitMemberPackageRowInPOS(rowToAdd2, pos.StrReceiptNo, pos.StrMembershipID, strNewFreePackage, "", true); FreememberPackagetable.Rows.Add(rowToAdd2); if (FreememberPackagetable.Rows.Count > 0) memberPackage.SaveData(FreememberPackagetable); //move session from old freebie to new freebie //find old free package ID,via wantToUpgrade_nPackageID freeSpaPackage.NPackageID = wantToUpgrade_nPackageID; freeSpaPackage.StrPackageCode = oldStrPackageCode; DataTable OldFreePackageID = freeSpaPackage.SelectSpaPackageFreebieID(); int nOldFreePackageID; if (OldFreePackageID.Rows.Count > 0) nOldFreePackageID = ACMS.Convert.ToInt32(OldFreePackageID.Rows[OldFreePackageID.Rows.Count - 1]["nPackageID"]); else nOldFreePackageID = 0; DataTable newFreeMemberPackageTable = memberPackage.SelectAllWstrReceiptNo(pos.StrReceiptNo); DataRow[] rowNewFreeMemberPackage = newFreeMemberPackageTable.Select("fFree = 1"); DataTable freeserviceUsedTable = serviceSession.GetMemberServiceSessionBasePackageID(nOldFreePackageID, pos.StrMembershipID, pos.StrBranchCode); //foreach (DataRow FmemberPackageRow in rowNewFreeMemberPackage) //{ string strFreePackageCode =""; if (rowNewFreeMemberPackage.Length > 0) strFreePackageCode = rowNewFreeMemberPackage[rowNewFreeMemberPackage.Length - 1]["strPackageCode"].ToString(); DataRow[] tempRowList3 = freeserviceUsedTable.Select("nPackageID = '"+nOldFreePackageID+"'", "dtDate"); if (tempRowList3.Length > 0) { foreach (DataRow freeserviceUsedRow in tempRowList3) { freeserviceUsedRow["nPackageID"] = rowNewFreeMemberPackage[rowNewFreeMemberPackage.Length - 1]["nPackageID"]; } } if (tempRowList3.Length > 0) { //update the expiryDate TblPackage package = new TblPackage(); package.MainConnectionProvider = connProvider; package.StrPackageCode = strFreePackageCode; DataTable tablePackage = package.SelectOne(); if (tablePackage == null && tablePackage.Rows.Count == 0) throw new Exception("Package no found."); if (tempRowList3.Length > 0) { rowNewFreeMemberPackage[rowNewFreeMemberPackage.Length - 1]["DtStartDate"] = ACMS.Convert.ToDateTime(tempRowList3[0]["dtDate"]); rowNewFreeMemberPackage[rowNewFreeMemberPackage.Length - 1]["DtExpiryDate"] = ACMS.Convert.ToDateTime( rowNewFreeMemberPackage[rowNewFreeMemberPackage.Length - 1]["DtStartDate"]).AddMonths(ACMS.Convert.ToInt32(package.NPackageDuration.Value)).AddDays(-1); } } //} DataTable oldFreeMemberPackageTable = memberPackage.SelectPackageID(nOldFreePackageID); oldFreeMemberPackageTable.Rows[0]["nStatusID"] = 2; serviceSession.UpgradePackage(ACMS.Convert.ToInt32(rowNewFreeMemberPackage[rowNewFreeMemberPackage.Length - 1]["nPackageID"]), nOldFreePackageID, pos.StrMembershipID); memberPackage.SaveData(oldFreeMemberPackageTable); memberPackage.SaveData(newFreeMemberPackageTable); } //move session from old package to new package foreach (DataRow memberPackageRow in rowNewAddMemberPackage) { string strPackageCode = memberPackageRow["strPackageCode"].ToString(); DataRow[] tempRowList = attendedClassTable.Select("nPackageID = '" + wantToUpgrade_nPackageID + "'", "dtDate"); if (tempRowList.Length > 0) { foreach (DataRow attendedClassRow in tempRowList) { // new packageID attendedClassRow["nPackageID"] = memberPackageRow["nPackageID"]; } } DataRow[] tempRowList2 = serviceUsedTable.Select("nPackageID = '" + wantToUpgrade_nPackageID + "'", "dtDate"); if (tempRowList2.Length > 0) { foreach (DataRow serviceUsedRow in tempRowList2) { serviceUsedRow["nPackageID"] = memberPackageRow["nPackageID"]; } } if (tempRowList.Length > 0 || tempRowList2.Length > 0) { //update the expiryDate TblPackage package = new TblPackage(); package.MainConnectionProvider = connProvider; package.StrPackageCode = strPackageCode; DataTable tablePackage = package.SelectOne(); TblPackageExtension PackExtension = new TblPackageExtension(); PackExtension.MainConnectionProvider = connProvider; PackExtension.NPackageID = ACMS.Convert.ToInt32(rowNewAddMemberPackage[0]["nPackageID"]); PackExtension.NPackageIDOld = wantToUpgrade_nPackageID; int days = 0; DataTable tblPkgExt = PackExtension.SelectExtensionDays(); if (PackExtension.NDaysExtended.IsNull == false) days = System.Convert.ToInt32(PackExtension.NDaysExtended.Value); if (tablePackage == null && tablePackage.Rows.Count == 0) throw new Exception("Package no found."); if (tempRowList.Length > 0 && tempRowList2.Length == 0) { ///07/11/2012 Jackie DataTable myDataTable1; DateTime dtDate; ACMSDAL.TblClassAttendance ClassAttendance = new ACMSDAL.TblClassAttendance(); myDataTable1 = ClassAttendance.LoadData("Select top 1 dtDate From tblClassAttendance where nstatusid=1 and nPackageID= " + wantToUpgrade_nPackageID + " and " + " strMemberShipID = @strMembershipID order by dtDate", new string[] { "@strMembershipID" }, new object[] { pos.StrMembershipID }); dtDate = DateTime.Now; if (myDataTable1.Rows.Count > 0) dtDate = System.Convert.ToDateTime(myDataTable1.Rows[0][0]); memberPackageRow["DtStartDate"] = dtDate; // Stop memberPackageRow["DtExpiryDate"] = ACMS.Convert.ToDateTime( memberPackageRow["DtStartDate"]).AddMonths(ACMS.Convert.ToInt32(package.NPackageDuration.Value)).AddDays(days - 1); } else if (tempRowList2.Length > 0 && tempRowList.Length == 0) { memberPackageRow["DtStartDate"] = ACMS.Convert.ToDateTime(tempRowList2[0]["dtDate"]); memberPackageRow["DtExpiryDate"] = ACMS.Convert.ToDateTime( memberPackageRow["DtStartDate"]).AddMonths(ACMS.Convert.ToInt32(package.NValidMonths.Value)).AddDays(days - 1); } } } OriginalCategoryID= ACMS.Convert.ToDBInt32(pos.WantToUpgradeMemberPackageRow["nCategoryID"]) ; pos.WantToUpgradeMemberPackageRow["nStatusID"] = 2; serviceSession.UpgradePackage(ACMS.Convert.ToInt32(rowNewAddMemberPackage[0]["nPackageID"]), wantToUpgrade_nPackageID, pos.StrMembershipID); memberPackage.SaveData(pos.WantToUpgradeMemberPackageTable); memberPackage.SaveData(newAddMemberPackageTable); classAttendance.SaveData(wantToUpgrade_nPackageID,pos.StrMembershipID); } return OriginalCategoryID; }
public static bool VerifyMemberPackageAllowCertainService(int nPackageID, string strServiceCode) { string cmdText = " Select Count (*) from tblPackageService A " + " inner join tblMemberPackage B on A.strPackageCode = B.strPackageCode " + " Where B.nPackageID = @nPackageID and A.strServiceCode = @strServiceCode"; TblServiceSession serviceSession = new TblServiceSession(); object obj = serviceSession.ExecuteScalar(cmdText, new string[] {"@nPackageID", "@strServiceCode"}, new object[] {nPackageID, strServiceCode}); if (obj != null) { Int32 r = (Int32) obj; if (r > 0) return true; else return false; } else return true; }