当前位置: 首页>>代码示例>>C#>>正文


C# ConnectionProvider.CommitTransaction方法代码示例

本文整理汇总了C#中ConnectionProvider.CommitTransaction方法的典型用法代码示例。如果您正苦于以下问题:C# ConnectionProvider.CommitTransaction方法的具体用法?C# ConnectionProvider.CommitTransaction怎么用?C# ConnectionProvider.CommitTransaction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ConnectionProvider的用法示例。


在下文中一共展示了ConnectionProvider.CommitTransaction方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DeleteRedemption

        public void DeleteRedemption(int nTransactionID, int qtyOfItemToRestoreAfterDelete)
        {
            TblRewardsTransaction rewardTrans = new TblRewardsTransaction();
            rewardTrans.NTransactionID = nTransactionID;
            rewardTrans.SelectOne();

            if (rewardTrans.NTypeID != 2 || (Convert.ToDateTime(rewardTrans.DtDate.Value).Date != DateTime.Now.Date && ACMSLogic.User.RightsLevelID != 9000))
                throw new Exception("You have no right to delete this record. It is not a redemption or the redemption date is before today. ");

            string itemCode = rewardTrans.StrReferenceNo.IsNull ? "" : rewardTrans.StrReferenceNo.Value;

            //TblProductInventory productInvent = new TblProductInventory();
            //productInvent.StrProductCode = itemCode;
            //productInvent.SelectOne();

            //productInvent.NQuantity = ACMS.Convert.ToInt32(productInvent.NQuantity) + qtyOfItemToRestoreAfterDelete;

            ACMSDAL.ConnectionProvider connProvider = new ConnectionProvider();

            try
            {

                rewardTrans.MainConnectionProvider = connProvider;
                //productInvent.MainConnectionProvider = connProvider;

                connProvider.OpenConnection();
                connProvider.BeginTransaction("DeleteRedemption");
                rewardTrans.Delete();
                //productInvent.Update();

                connProvider.CommitTransaction();
            }
            catch (Exception)
            {
                connProvider.RollbackTransaction("DeleteRedemption");
                throw;
            }
            finally
            {
                if (connProvider.CurrentTransaction != null)
                    connProvider.CurrentTransaction.Dispose();

                if (connProvider.DBConnection != null)
                {
                    if (connProvider.DBConnection.State == ConnectionState.Open)
                        connProvider.DBConnection.Close();
                }
                rewardTrans.MainConnactionIsCreatedLocal = true;
                //productInvent.MainConnactionIsCreatedLocal = true;
            }
        }
开发者ID:kimykunjun,项目名称:test,代码行数:51,代码来源:LoyaltyProgram.cs

示例2: Delete

        public bool Delete(int nCaseID)
        {
            ACMSDAL.ConnectionProvider connProvider = new ConnectionProvider();

            try
            {
                myCase.MainConnectionProvider = connProvider;
                myCaseAction.MainConnectionProvider = connProvider;

                connProvider.OpenConnection();
                connProvider.BeginTransaction("CancelMemberPackage");

                myCase.NCaseID = nCaseID;
                myCaseAction.NCaseID = nCaseID;

                myCaseAction.DeleteAllWnCaseIDLogic();
                myCase.Delete();

                connProvider.CommitTransaction();
                return true;
            }
            catch (Exception)
            {
                connProvider.RollbackTransaction("DeleteCase");
                throw;
            }
            finally
            {
                if (connProvider.CurrentTransaction != null)
                    connProvider.CurrentTransaction.Dispose();
                if (connProvider.DBConnection != null)
                {
                    if (connProvider.DBConnection.State == ConnectionState.Open)
                        connProvider.DBConnection.Close();
                    //connProvider.DBConnection.Dispose();
                }
                myCase.MainConnactionIsCreatedLocal = true;
                myCaseAction.MainConnactionIsCreatedLocal = true;
            }
        }
开发者ID:kimykunjun,项目名称:test,代码行数:40,代码来源:CustomerVoice.cs

示例3: SaveIntroduceFriend

        public DataTable SaveIntroduceFriend(string strMembershipID, string strIntroducerID, string Freebie, string strBranchCode,int employeeID)
        {
            ACMSDAL.ConnectionProvider connProvider = new ConnectionProvider();
            TblMember sqlMember = new TblMember();
            try
            {
            sqlMember.MainConnectionProvider = connProvider;
            connProvider.OpenConnection();
            connProvider.BeginTransaction("SaveIntroduceFriend");

            sqlMember.UpdateIntroducerMembershipID(strMembershipID, strIntroducerID);
            DataTable IntroFriendFreebieTable =sqlMember.AddIntroFriendFreebie(strMembershipID,strIntroducerID,Freebie,strBranchCode,employeeID);

            connProvider.CommitTransaction();
            return IntroFriendFreebieTable;
            }
            catch (Exception ex)
            {
                    throw;
            }
            finally
            {
                if (connProvider.CurrentTransaction != null)
                    connProvider.CurrentTransaction.Dispose();
                if (connProvider.DBConnection != null)
                {
                    if (connProvider.DBConnection.State == ConnectionState.Open)
                        connProvider.DBConnection.Close();
                    connProvider.DBConnection.Dispose();
                }
                //sqlRewardsTransaction.Dispose();
                sqlMember.Dispose();
            }
        }
开发者ID:kimykunjun,项目名称:test,代码行数:34,代码来源:MemberRecord.cs

示例4: SavePOS


//.........这里部分代码省略.........
                        rewardTran.Insert();
                    }
                }

                if (pos.StrRewardsCode.ToString() == "Null") pos.StrRewardsCode = "";

                DataTable QtyTable = receiptEntries.Get_StrCodeReceiptNo(pos.StrReceiptNo);
                //check is the receipt fully paid
                string Nett = pos.MNettAmount.ToString();
                string Outstanding = pos.MOutstandingAmount.ToString();

                //if (pos.MOutstandingAmount == 0 && (pos.NCategoryID == 11 || pos.NCategoryID == 12))
                //    PostToStock(connProvider, QtyTable, pos);

                receiptTable = pos.ReceiptMasterTable.Copy();
                int PosCategory = ACMS.Convert.ToInt32(receiptTable.Rows[0]["nCategoryID"]);
                if (PosCategory == 24)
                {
                    receiptTable.Rows[0]["fDeposit"] = true;
                    receipt.SaveData(receiptTable);
                }

                if (pos.StrBillReferenceNo != "")
                {
                    receiptTable.Rows[0]["strBillReferenceNo"] = pos.StrBillReferenceNo;
                    receipt.SaveData(receiptTable);
                }

                if (pos.NCategoryID == 0 || pos.NCategoryID == 10)
                {
                    receipt.StrReceiptNo = pos.StrReceiptNo;
                    receipt.SelectOne();
                    receipt.MOutstandingAmount = Convert.ToDecimal(pos.MOutstandingAmount);
                    receipt.NCategoryID = ParentCategoryID;
                    receipt.Update();
                    //TblReceipt receipt3 = new TblReceipt();
                    //receipt3.StrReceiptNo = pos.StrReceiptNo;
                    //receipt3.SelectOne();
                    //receipt3.MOutstandingAmount = Convert.ToDecimal(pos.MOutstandingAmount);
                    //receipt3.NCategoryID = ParentCategoryID;
                    //receipt3.Update();
                }

                if (pos.StrDeposit != "")
                {
                    receipt.StrReceiptNo = pos.StrDeposit;
                    DataTable tblDeposit = receipt.SelectOne();
                    if (tblDeposit.Rows.Count > 0)
                    {
                        receipt.FDeposit = false;
                        receipt.Update();

                    }
                    else
                    {
                        TblMemberPackage ConvertedPackage = new TblMemberPackage();
                        ConvertedPackage.NPackageID = ACMS.Convert.ToSqlInt32(pos.StrDeposit);
                        ConvertedPackage.NStatusID = 1;
                        ConvertedPackage.UpdateConvertedPackageStatus();
                    }
                }

                if (pos.ReceiptItemsTable.Select("", "", DataViewRowState.ModifiedCurrent).Length > 0)
                {
                    receiptEntriesTable = pos.ReceiptItemsTable.Copy();
                    receipt.SaveData(receiptEntriesTable);
                }
                //1503
                branchReceiptNoTable.Rows[0]["nReceiptNo"] = latestReceiptNo;

                SaveUpToDateReceiptNo(connProvider, branchReceiptNoTable);
                connProvider.CommitTransaction();

                if (pos.StrDeposit != "")
                {
                    TblReceipt receipt2 = new TblReceipt();
                    receipt2.StrReceiptNo = pos.StrDeposit;
                    receipt2.SelectOne();
                    receipt2.StrChildReceiptNo = receiptNo;
                    receipt2.Update();
                }
                return true;

            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (connProvider.CurrentTransaction != null)
                    connProvider.CurrentTransaction.Dispose();
                if (connProvider.DBConnection != null)
                {
                    if (connProvider.DBConnection.State == ConnectionState.Open)
                        connProvider.DBConnection.Close();

                }
            }
        }
开发者ID:kimykunjun,项目名称:test,代码行数:101,代码来源:POS.cs

示例5: DeleteLastExtensionHistory

        public void DeleteLastExtensionHistory(int nPackageID, int last_nExtensionID)
        {
            myMemberPackage.NPackageID = nPackageID;
            myMemberPackage.SelectOne();

            TblPackageExtension packageExt = new TblPackageExtension();
            packageExt.NPackageID = nPackageID;
            DataTable packageExtTable = packageExt.SelectAllWnPackageIDLogic();

            if (packageExtTable == null)
                throw new Exception("This extension row has been deleted by others");
            if (packageExtTable.Rows.Count == 0)
                throw new Exception("This extension row has been deleted by others");

            if (packageExtTable.Rows.Count > 0)
            {
                DataRow [] rowList = packageExtTable.Select(" nStatusID = 0 AND nExtensionID > " + last_nExtensionID.ToString());
                if (rowList.Length > 0) // mean is not last package extension
                {
                    throw new Exception("Only the most recent package extension can be deleted.");
                }
            }

            DataRow[] deletedDataRowList = packageExtTable.Select("nStatusID = 0 and nExtensionID = " + last_nExtensionID, "nExtensionID", DataViewRowState.CurrentRows);
            if (deletedDataRowList.Length == 0)
                throw new Exception("This extension row has been deleted by others");
            //deletedDataRowList should be one row
            deletedDataRowList[0]["nStatusID"] = 1;
            TimeSpan durationToReverse = TimeSpan.FromDays((double) ACMS.Convert.ToInt32(deletedDataRowList[0]["nDaysExtended"]));

            DataRow[] tempDataRowList = packageExtTable.Select("nStatusID = 0", "nExtensionID", DataViewRowState.CurrentRows);
            // now need to use the last row's info to calculate the expriry date.
            // but if there is the only row in extension package for this member package, i have to use other info to calculate the expiry date for this memberpackage

            myMemberPackage.DtExpiryDate = myMemberPackage.DtExpiryDate.Value.Subtract(durationToReverse);

            ACMSDAL.ConnectionProvider connProvider = new ConnectionProvider();

            try
            {
                myMemberPackage.MainConnectionProvider = connProvider;
                packageExt.MainConnectionProvider = connProvider;
                connProvider.OpenConnection();
                connProvider.BeginTransaction("SaveExtension");
                myMemberPackage.Update();
                packageExt.SaveData(packageExtTable);
                connProvider.CommitTransaction();
            }
            catch (Exception)
            {
                connProvider.RollbackTransaction("SaveExtension");
                throw new Exception("Failed to Create New Extension");
            }
            finally
            {
                if (connProvider.CurrentTransaction != null)
                    connProvider.CurrentTransaction.Dispose();
                if (connProvider.DBConnection != null)
             		{
                    if (connProvider.DBConnection.State == ConnectionState.Open)
                        connProvider.DBConnection.Close();
                }
                myMemberPackage.MainConnactionIsCreatedLocal = true;
                packageExt.MainConnactionIsCreatedLocal = true;
            }
        }
开发者ID:kimykunjun,项目名称:test,代码行数:66,代码来源:MemberPackage.cs

示例6: Cancel

        public bool Cancel(int NPackageID)
        {
            myMemberPackage.NPackageID = NPackageID;
            myMemberPackage.SelectOne();
            myMemberPackage.NStatusID = 2;// 2 represent cancel
            myAudit.DtDate = DateTime.Today;
            myAudit.NAuditTypeID = 0;
            myAudit.NEmployeeID = ACMSLogic.User.EmployeeID;
            myAudit.StrAuditEntry = "Cancel Member Package " + NPackageID.ToString();
            myAudit.StrReference = NPackageID.ToString();

            ACMSDAL.ConnectionProvider connProvider = new ConnectionProvider();

            try
            {

                myMemberPackage.MainConnectionProvider = connProvider;
                myAudit.MainConnectionProvider = connProvider;
                connProvider.OpenConnection();
                connProvider.BeginTransaction("CancelMemberPackage");

                myMemberPackage.Update();
                myAudit.Insert();

                connProvider.CommitTransaction();
                return true;
            }
            catch (Exception)
            {
                connProvider.RollbackTransaction("CancelMemberPackage");
                throw;
            }
            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;
            }
        }
开发者ID:kimykunjun,项目名称:test,代码行数:46,代码来源:MemberPackage.cs

示例7: UpdateClassAttendance

        public void UpdateClassAttendance(int nAttendanceID, int nNewPackageID)
        {
            TblClassAttendance classAttendance = new TblClassAttendance();
            System.Data.SqlTypes.SqlInt32 nOldPackageID;

            classAttendance.NAttendanceID = nAttendanceID;
            DataTable table = classAttendance.SelectOne();
            if (table != null && table.Rows.Count > 0)
            {
                nOldPackageID = classAttendance.NPackageID;
                classAttendance.NEmployeeID = User.EmployeeID;
                classAttendance.NPackageID = nNewPackageID;

                myMemberPackage.NPackageID = nNewPackageID;
                DataTable memberPackageTable = myMemberPackage.SelectOne();
                if (memberPackageTable == null || memberPackageTable.Rows.Count == 0)
                    throw new Exception("Failed to update/transfer class attendance. Member Package with Package ID = "+ nNewPackageID.ToString() + "has been deleted");

                DataRow masterRow = memberPackageTable.Rows[0];
                TblPackage package = new TblPackage();
                package.StrPackageCode = masterRow["strPackageCode"].ToString();
                package.SelectOne();

                if (masterRow["dtStartDate"] == DBNull.Value)
                {
                    if (!package.FGIRO || package.FGIRO.IsNull)
                    {
                        myMemberPackage.DtStartDate = classAttendance.DtDate;
                        int iduration = package.NPackageDuration.Value;
                        if (package.StrDurationUnit.ToString().Trim() == "DAY")
                            myMemberPackage.DtExpiryDate = classAttendance.DtDate.Value.AddDays(iduration - 1).AddDays(0);
                        else if (package.StrDurationUnit.ToString().Trim() == "WEEK")
                        {
                            iduration = iduration * 7;
                            myMemberPackage.DtExpiryDate = classAttendance.DtDate.Value.AddDays(iduration - 1).AddDays(0);
                        }
                        else
                            myMemberPackage.DtExpiryDate = classAttendance.DtDate.Value.AddMonths(package.NPackageDuration.Value).AddDays(-1);
                    }
                }
                else
                {
                    if (!package.FGIRO || package.FGIRO.IsNull)
                    {
                        if (classAttendance.DtDate < ACMS.Convert.ToDateTime(masterRow["DtStartDate"]))
                        {
                            myMemberPackage.DtStartDate = classAttendance.DtDate;
                            int iduration = package.NPackageDuration.Value;
                            if (package.StrDurationUnit.ToString().Trim() == "DAY")
                                myMemberPackage.DtExpiryDate = classAttendance.DtDate.Value.AddDays(iduration - 1).AddDays(0);
                            else if (package.StrDurationUnit.ToString().Trim() == "WEEK")
                            {
                                iduration = iduration * 7;
                                myMemberPackage.DtExpiryDate = classAttendance.DtDate.Value.AddDays(iduration - 1).AddDays(0);
                            }
                            else
                                myMemberPackage.DtExpiryDate = classAttendance.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 > classAttendance.DtDate)
                            {
                                myMemberPackage.DtExpiryDate = memberPackageExpiryDate.Subtract(memberPackageStartDate.Subtract(classAttendance.DtDate.Value));
                                myMemberPackage.DtStartDate = classAttendance.DtDate;
                            }
                        }
                    }
                }

                ACMSDAL.ConnectionProvider connProvider = new ConnectionProvider();

                try
                {
                    myMemberPackage.MainConnectionProvider = connProvider;
                    classAttendance.MainConnectionProvider = connProvider;

                    connProvider.OpenConnection();
                    connProvider.BeginTransaction("SaveClassAttendance");

                    myMemberPackage.Update();
                    classAttendance.Update();
                    //UpdateStartExpiryDate(nOldPackageID);

                    connProvider.CommitTransaction();
                    connProvider.BeginTransaction("SaveClassAttendance");
                    UpdateStartExpiryDate(nOldPackageID);
                    connProvider.CommitTransaction();
                }
                catch (Exception)
                {
                    connProvider.RollbackTransaction("SaveClassAttendance");
                    throw new Exception("Failed to save Class Attendance");
                }
                finally
                {
                    if (connProvider.CurrentTransaction != null)
                        connProvider.CurrentTransaction.Dispose();
//.........这里部分代码省略.........
开发者ID:kimykunjun,项目名称:test,代码行数:101,代码来源:MemberPackage.cs

示例8: SaveExtensionHistory


//.........这里部分代码省略.........
                                myMemberPackage.DtExpiryDate = myMemberPackage.DtExpiryDate.Value.Add(duration).AddDays(1);
                            }
                        }
                    }

                    //To support extension for multiple package at once
                    object dtEndValue = packExtRow["dtEndDate"];
                    object dtStartDate = packExtRow["dtEndDate"];
                    if (dtEndValue == DBNull.Value && dtStartDate == DBNull.Value)
                    {
                        packExtRow["dtEndDate"] = EndDate;
                        packExtRow["dtStartDate"] = StartDate;
                    }
                    TimeSpan nDaysExtend = ACMS.Convert.ToDateTime(packExtRow["dtEndDate"]).Subtract(ACMS.Convert.ToDateTime(packExtRow["dtStartDate"]));

                    packExtRow["nDaysExtended"] = nDaysExtend.TotalDays+1;
                    packExtRow["dtOldExpiry"]=oldExpiryDate;
                    packExtRow["dtNewExpiry"]=	oldExpiryDate.AddDays(nDaysExtend.TotalDays+1);
                    packExtRow["dtCreateDate"] = System.DateTime.Now; //jackie 14032012
                    if (nReasonID != 0)
                        packExtRow["nReasonID"] = nReasonID;

                    packExtRow["nDaysExtended"]=(nDaysExtend.TotalDays)+1;
                    #region ====== Added By Albert ======
                    //To update member package status. If expiry date is greater than today date, change the status to active.
                    DateTime dtExpireDate = Convert.ToDateTime(myMemberPackage.DtExpiryDate.ToString());
                    if(DateTime.Compare(dtExpireDate,DateTime.Now)>0)
                        myMemberPackage.NStatusID = 0;
                    #endregion
                    myMemberPackage.Update();

                    packageExt.SaveData(packageExtensionTable);

                    connProvider.CommitTransaction();
                }
                catch (Exception ex)
                {
                    connProvider.RollbackTransaction("SaveExtension");
                    throw ex;
                }
                finally
                {
                    if (connProvider.CurrentTransaction != null)
                        connProvider.CurrentTransaction.Dispose();
                    if (connProvider.DBConnection != null)
                    {
                        if (connProvider.DBConnection.State == ConnectionState.Open)
                            connProvider.DBConnection.Close();
                    }
                    myMemberPackage.MainConnactionIsCreatedLocal = true;
                    packageExt.MainConnactionIsCreatedLocal = true;
                }
            }
            else
            {
                try
                {
                    myMemberPackage.MainConnectionProvider = connProvider;
                    packageExt.MainConnectionProvider = connProvider;

                    connProvider.OpenConnection();
                    connProvider.BeginTransaction("SaveExtension");

                    myMemberPackage.NPackageID = nPackageID;
                    myMemberPackage.SelectOne();
开发者ID:kimykunjun,项目名称:test,代码行数:66,代码来源:MemberPackage.cs

示例9: NewClassAttendance


//.........这里部分代码省略.........
                                    iduration = iduration * 7;
                                    masterRow["dtExpiryDate"] = classDate.AddDays(iduration - 1).AddDays(0);

                                }
                            }

                        }
                        else
                        {
                            int iduration = package.NPackageDuration.Value;
                            if (package.StrDurationUnit.ToString().Trim() == "DAY")
                                masterRow["dtExpiryDate"] = classDate.AddDays(iduration - 1).AddDays(0);
                            else if (package.StrDurationUnit.ToString().Trim() == "WEEK")
                            {
                                iduration = iduration * 7;
                                masterRow["dtExpiryDate"] = classDate.AddDays(iduration - 1).AddDays(0);
                            }
                            else if (package.StrDurationUnit.ToString().Trim() == "MONTH")
                                masterRow["dtExpiryDate"] = classDate.AddMonths(package.NPackageDuration.Value).AddDays(-1);
                        }
                        //jackie END 2/02/2012

                    }
                    else
                    {
                        // Kean Yiap
                        string strPackageCode = masterRow["strPackageCode"].ToString();
                        CalculateMemberPackageBalance(strPackageCode, strMemberShipID, memberPackageTable);
                        DateTime memberPackageStartDate = ACMS.Convert.ToDateTime(masterRow["DtStartDate"]);
                        DateTime memberPackageExpiryDate = ACMS.Convert.ToDateTime(masterRow["dtExpiryDate"]);

                        //if (memberPackageStartDate > classDate)
                        //{
                        //jackie why must change ExpiryDate 26042012
                        //	masterRow["dtExpiryDate"] = memberPackageExpiryDate.Subtract(memberPackageStartDate.Subtract(classDate));
                        //}
                    }
                }

                if (ACMS.Convert.ToInt32(memberPackageTable.Rows[0]["Balance"]) <= 1)
                {
                    if (masterRow["strPackageCode"].ToString() == "FTRIAL")
                    {
                        memberPackageTable.Rows[0]["nBalance"] = 1;
                    }
                    else
                    {
                        memberPackageTable.Rows[0]["nBalance"] = 0;
                    }
                }

            }

            ACMSDAL.ConnectionProvider connProvider = new ConnectionProvider();

            try
            {
                myMemberPackage.MainConnectionProvider = connProvider;
                classAttendance.MainConnectionProvider = connProvider;

                connProvider.OpenConnection();
                connProvider.BeginTransaction("SaveClassAttendance");

                if (needtoAddBackOneDayExpiryDate && memberPackageTable.Rows[0]["fGIRO"].ToString() != "1")
                {
                    memberPackageTable.Rows[0]["dtExpiryDate"] = ACMS.Convert.ToDateTime(memberPackageTable.Rows[0]["dtExpiryDate"]).AddDays(1);
                }

                myMemberPackage.SaveData(memberPackageTable);

                if (BalanceStatus)
                {
                    if (!isPostFromOtherRecord)
                        classAttendance.Insert();
                    else
                        classAttendance.Update();

                    connProvider.CommitTransaction();
                }

                return true;
            }
            catch (Exception)
            {
                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();
                }
                myMemberPackage.MainConnactionIsCreatedLocal = true;
                classAttendance.MainConnactionIsCreatedLocal = true;
            }
        }
开发者ID:kimykunjun,项目名称:test,代码行数:101,代码来源:MemberPackage.cs

示例10: ForfeitBooking

        public bool ForfeitBooking(int nSessionID)
        {
            myServiceSession.NSessionID = nSessionID;
            myServiceSession.SelectOne();

            myServiceSession.NStatusID = 6;
            myServiceSession.DtLastEditDate = DateTime.Now;
            myServiceSession.NEmployeeID = ACMSLogic.User.EmployeeID;

            TblAudit audit = new TblAudit();
            audit.DtDate = DateTime.Today;
            audit.NAuditTypeID = AuditTypeID.Service;
            audit.NEmployeeID = ACMSLogic.User.EmployeeID;
            audit.StrAuditEntry = "Cancel Booking " + nSessionID.ToString();
            audit.StrReference = nSessionID.ToString();

            ACMSDAL.ConnectionProvider connProvider = new ConnectionProvider();

            try
            {

                myServiceSession.MainConnectionProvider = connProvider;
                audit.MainConnectionProvider = connProvider;
                connProvider.OpenConnection();
                connProvider.BeginTransaction("ForfeitBooking");
                myServiceSession.Update();
                audit.Insert();
                connProvider.CommitTransaction();
                return true;
            }
            catch (Exception)
            {
                connProvider.RollbackTransaction("ForfeitBooking");
                throw;
            }
            finally
            {
                if (connProvider.CurrentTransaction != null)
                    connProvider.CurrentTransaction.Dispose();
                if (connProvider.DBConnection != null)
                {
                    if (connProvider.DBConnection.State == ConnectionState.Open)
                        connProvider.DBConnection.Close();
                    //connProvider.DBConnection.Dispose();
                }
                myServiceSession.MainConnactionIsCreatedLocal = true;
                audit.MainConnactionIsCreatedLocal = true;
            }
        }
开发者ID:kimykunjun,项目名称:test,代码行数:49,代码来源:SpaBooking.cs

示例11: UpdateMember


//.........这里部分代码省略.........
                                    string strRemark, 
                                    int nMediaSourceID, 
                                    string strMediaSource, 
                                    string strBeforePhoto,
			                        string strAfterPhoto, 
                                    byte[] imgPhoto, 
                                    User aUser, 
                                    bool fFemale,
                                    bool fPhoneCall,
                                    string strSecurityQuestion,
                                    string strSecurityAnswer,
                                    string strMobileAppPwd)
        {
            ACMSDAL.ConnectionProvider connProvider = new ConnectionProvider();
            TblMember sqlMember = new TblMember();
            TblAudit sqlAudit = new TblAudit();

            bool isSuccess = false;

            try
            {
                sqlMember.MainConnectionProvider = connProvider;
                sqlAudit.MainConnectionProvider = connProvider;
                connProvider.OpenConnection();
                connProvider.BeginTransaction("UpdateMemberRecord");

                sqlMember.StrMembershipID = strMembershipID;
                sqlMember.FFemale = fFemale;
                sqlMember.FAirCrew = fAirCrew;
                sqlMember.FBounceCheck = fBoundCheck;
                sqlMember.FEmail = fEmail;
                sqlMember.FGIROFailed = fGiroFailed;
                sqlMember.FPostalMail = fPostalMail;
                sqlMember.FSingaporean = fSingaporean;
                sqlMember.FSMS = fSMS;
                sqlMember.FPhoneCall = fPhoneCall;

                if (nLoyaltyStatusID != 0)
                {
                    sqlMember.NLoyaltyStatusID = nLoyaltyStatusID;
                }

                sqlMember.StrAddress1 = strAdd1;
                sqlMember.StrAddress2 = strAdd2;
                sqlMember.StrAltEmail = strAltEmail;
                sqlMember.StrCardName = strCardName;
                sqlMember.StrCompany = strCompany;
                sqlMember.StrCreditCardNo = strCreditCardNo;
                sqlMember.StrEmail = strEmail;
                sqlMember.StrEmergencyContactNumber = strEmergencyContactNo;
                sqlMember.StrEmergencyContactPerson = strEmergencyContactPerson;
                sqlMember.StrHomeNo = strHomeNo;
                sqlMember.StrMemberName = strMemberName;
                sqlMember.StrMobileNo = strMobileNo;
                sqlMember.StrNRICFIN = strNIRCFIN;
                sqlMember.StrOccupation = strOccupation;
                sqlMember.StrOfficeNo = strOfficeNo;
                sqlMember.StrPagerNo = strPagerNo;
                sqlMember.StrPostalCode = strPostalCode;
                sqlMember.StrRemarks = strRemark;
                sqlMember.NMediaSourceID = nMediaSourceID;
                sqlMember.StrMediaSource = strMediaSource;
                sqlMember.NEmployeeID = aUser.NEmployeeID();
                sqlMember.StrSecurityQuestion = strSecurityQuestion;
                sqlMember.StrSecurityAnswer = strSecurityAnswer;
                sqlMember.StrPassword = strMobileAppPwd;

                sqlMember.Update2(dateDob, strBeforePhoto, strAfterPhoto, imgPhoto);

                sqlAudit.NAuditTypeID = ACMSLogic.AuditTypeID.MemberRecord;
                sqlAudit.NEmployeeID = aUser.NEmployeeID();
                sqlAudit.StrAuditEntry = "Update member " +strMembershipID;
                sqlAudit.StrReference = strMembershipID;
                sqlAudit.DtDate = DateTime.Now;
                sqlAudit.Insert();

                connProvider.CommitTransaction();
                isSuccess = true;

            }
            catch (Exception)
            {
                connProvider.RollbackTransaction("UpdateMemberRecord");
                throw;
            }
            finally
            {
                if (connProvider.CurrentTransaction != null)
                    connProvider.CurrentTransaction.Dispose();
                if (connProvider.DBConnection != null)
                {
                    if (connProvider.DBConnection.State == ConnectionState.Open)
                        connProvider.DBConnection.Close();
                    connProvider.DBConnection.Dispose();
                }
                sqlMember.Dispose();
                sqlAudit.Dispose();
            }
            return isSuccess;
        }
开发者ID:kimykunjun,项目名称:test,代码行数:101,代码来源:MemberRecord.cs

示例12: BlockMembershipID

        public static bool BlockMembershipID(int numberOfNonMemberID, int numberOfMemberID, string strBranchCode)
        {
            ACMSDAL.ConnectionProvider connProvider = new ConnectionProvider();
            TblCompany sqlCompany = new TblCompany();
            TblBranch sqlBranch = new TblBranch();

            try
            {
                sqlCompany.MainConnectionProvider = connProvider;
                sqlBranch.MainConnectionProvider = connProvider;
                connProvider.OpenConnection();
                connProvider.BeginTransaction("BlockMembershipID");

                if (numberOfNonMemberID > 0)
                    sqlCompany.UpdateBlockNonMembershipID(numberOfNonMemberID);
                if (numberOfMemberID > 0)
                    sqlBranch.UpdateBlockMembershipID(strBranchCode, numberOfMemberID);

                connProvider.CommitTransaction();
                return true;
            }
            catch (Exception)
            {
                connProvider.RollbackTransaction("BlockMembershipID");
                throw;
            }
            finally
            {
                if (connProvider.CurrentTransaction != null)
                    connProvider.CurrentTransaction.Dispose();
                if (connProvider.DBConnection != null)
                {
                    if (connProvider.DBConnection.State == ConnectionState.Open)
                        connProvider.DBConnection.Close();
                    connProvider.DBConnection.Dispose();
                }
                sqlCompany.Dispose();
                sqlBranch.Dispose();
            }
        }
开发者ID:kimykunjun,项目名称:test,代码行数:40,代码来源:MemberRecord.cs

示例13: UpdateCardStatus

        public bool UpdateCardStatus(string strMembershipID, User aUser, CardStatusType myType, int nRequestID, 
			string strBranchCode)
        {
            ACMSDAL.ConnectionProvider connProvider = new ConnectionProvider();
            TblMember sqlMember = new TblMember();
            TblCardRequest sqlCardRequest = new TblCardRequest();
            TblAudit sqlAudit = new TblAudit();

            bool isSuccess = false;
            try
            {
                sqlMember.MainConnectionProvider = connProvider;
                sqlCardRequest.MainConnectionProvider = connProvider;
                sqlAudit.MainConnectionProvider = connProvider;
                connProvider.OpenConnection();
                connProvider.BeginTransaction("ChangeCardStatus");

                if (CardStatusType.RequestPrint == myType)
                    sqlMember.UpdateCardStatus(strMembershipID, (int)myType, "HQ");
                else
                    sqlMember.UpdateCardStatus(strMembershipID, (int)myType, strBranchCode);
                sqlCardRequest.NEmployeeID = aUser.NEmployeeID();
                sqlCardRequest.NRequestID = nRequestID;
                sqlCardRequest.NStatusID = (int)myType;
                sqlCardRequest.StrBranchCode = strBranchCode;
                sqlCardRequest.StrMembershipID = strMembershipID;
                sqlCardRequest.DtLastEditDate = DateTime.Now;
                sqlCardRequest.Update();

                sqlAudit.NAuditTypeID = ACMSLogic.AuditTypeID.MemberCard;
                sqlAudit.NEmployeeID = aUser.NEmployeeID();
                sqlAudit.StrAuditEntry = "Update member card to " +myType.ToString() +".";
                sqlAudit.StrReference = strMembershipID;
                sqlAudit.DtDate = DateTime.Now;
                sqlAudit.Insert();

                connProvider.CommitTransaction();
                isSuccess = true;
            }
            catch (Exception)
            {
                connProvider.RollbackTransaction("ChangeCardStatus");
                throw;
            }
            finally
            {
                if (connProvider.CurrentTransaction != null)
                    connProvider.CurrentTransaction.Dispose();
                if (connProvider.DBConnection != null)
                {
                    if (connProvider.DBConnection.State == ConnectionState.Open)
                        connProvider.DBConnection.Close();
                    connProvider.DBConnection.Dispose();
                }
                sqlMember.Dispose();
                sqlCardRequest.Dispose();
                sqlAudit.Dispose();
            }
            return isSuccess;
        }
开发者ID:kimykunjun,项目名称:test,代码行数:60,代码来源:MemberRecord.cs

示例14: SaveIntroduceFriendNew

        //2006
        // public DataTable SaveIntroduceFriendNew(string strMembershipID, string strIntroducerID, string strPackage, string strRemark, int employeeID)
        public bool SaveIntroduceFriendNew(string strMembershipID, string strIntroducerID, string strPackage, string strRemark, int employeeID,int nPackageID)
        {
            ACMSDAL.ConnectionProvider connProvider = new ConnectionProvider();
            TblMember sqlMember = new TblMember();
            TblMemberPackage sqlMemberPackage = new TblMemberPackage();
            TblPackage sqlPackage = new TblPackage();
            try
            {

                sqlMember.MainConnectionProvider = connProvider;
                connProvider.OpenConnection();
                connProvider.BeginTransaction("SaveIntroduceFriend");

              //  sqlMember.UpdateIntroducerMembershipID(strMembershipID, strIntroducerID);
                sqlMember.UpdateIntroducerMembershipID(strIntroducerID, strMembershipID);
                MemberPackage.CreateFreeMemberSpaPackage_IntroFriend(strMembershipID, strPackage, strRemark, ref nPackageID);
               // MemberPackage.CreateFreeMemberSpaPackage_IntroFriend(strIntroducerID, strPackage, strRemark, ref nPackageID);

                connProvider.CommitTransaction();
                return true;
            }
            catch (Exception ex)
            {
                throw;
            }
            finally
            {
                if (connProvider.CurrentTransaction != null)
                    connProvider.CurrentTransaction.Dispose();
                if (connProvider.DBConnection != null)
                {
                    if (connProvider.DBConnection.State == ConnectionState.Open)
                        connProvider.DBConnection.Close();
                    connProvider.DBConnection.Dispose();
                }
                sqlPackage.Dispose();
                sqlMember.Dispose();
            }
        }
开发者ID:kimykunjun,项目名称:test,代码行数:41,代码来源:MemberRecord.cs

示例15: SaveIntroduceFriendforPackage

        //Amended by TBBC on 22 September 2015 for Intro friend package.
        public bool SaveIntroduceFriendforPackage(string strMembershipID, string strIntroducerID, string strPromotionCode, int employeeID)
        {
            bool bolReturn = false;
            ACMSDAL.ConnectionProvider connProvider = new ConnectionProvider();
            TblMember sqlMember = new TblMember();
            try
            {
                sqlMember.MainConnectionProvider = connProvider;
                connProvider.OpenConnection();
                connProvider.BeginTransaction("SaveIntroduceFriendforPackage");

                //sqlMember.UpdateIntroducerMembershipID(strMembershipID, strIntroducerID);
                DataTable IntroFriendFreebieTable = sqlMember.AddIntroFriendPackage(strIntroducerID, "INTRO " + strMembershipID, strPromotionCode, employeeID);

                //if (IntroFriendFreebieTable.Rows.Count > 0)
                //{
                //    bolReturn = true;
                //}
                connProvider.CommitTransaction();
                return true;
            }
            catch (Exception ex)
            {
                throw;
            }
            finally
            {
                if (connProvider.CurrentTransaction != null)
                    connProvider.CurrentTransaction.Dispose();
                if (connProvider.DBConnection != null)
                {
                    if (connProvider.DBConnection.State == ConnectionState.Open)
                        connProvider.DBConnection.Close();
                    connProvider.DBConnection.Dispose();
                }
                //sqlRewardsTransaction.Dispose();
                sqlMember.Dispose();
            }
        }
开发者ID:kimykunjun,项目名称:test,代码行数:40,代码来源:MemberRecord.cs


注:本文中的ConnectionProvider.CommitTransaction方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。