Пример #1
0
        //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();
            }
        }
Пример #2
0
        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();
            }
        }
Пример #3
0
        public bool SaveIntroduceFriend(string strMembershipID, string strIntroducerID, double point, int employeeID)
        {
            ACMSDAL.ConnectionProvider connProvider     = new ConnectionProvider();
            TblMember             sqlMember             = new TblMember();
            TblRewardsTransaction sqlRewardsTransaction = new TblRewardsTransaction();

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

                sqlMember.UpdateIntroducerMembershipID(strMembershipID, strIntroducerID);

                sqlRewardsTransaction.DRewardsPoints  = point;
                sqlRewardsTransaction.DtDate          = DateTime.Now;
                sqlRewardsTransaction.NEmployeeID     = employeeID;
                sqlRewardsTransaction.NTypeID         = 0;
                sqlRewardsTransaction.StrMembershipID = strIntroducerID;
                sqlRewardsTransaction.StrReferenceNo  = strMembershipID;
                sqlRewardsTransaction.Insert();

                for (int i = 0; i < 5; i++)
                {
                    sqlMember.InsertFWFChance(strIntroducerID);
                }

                connProvider.CommitTransaction();
                return(true);
            }
            catch (Exception ex)
            {
                connProvider.RollbackTransaction("SaveIntroduceFriend");
                if (ex.InnerException.Message.IndexOf("FK_tblMember_tblMember") >= 0 ||
                    ex.Message.IndexOf("FK_tblMember_tblMember") >= 0 ||
                    ex.InnerException.Message.IndexOf("FK_tblRewardsTransaction_tblMember") >= 0 ||
                    ex.Message.IndexOf("FK_tblRewardsTransaction_tblMember") >= 0)
                {
                    ACMS.Utils.UI.ShowErrorMessage(null, "Please enter a valid Membership ID.", "Error");
                    return(false);
                }
                else
                {
                    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();
            }
        }