/// <summary>
        /// Cancel prediction : 3 step
        ///     1. Update record in table ExpectPoint.
        ///     2. Insert 2 records in table PointHistory.
        ///     3. Update possession point in table Point
        /// </summary>
        /// <param name="expectPointID">ExpectPointID</param>
        /// <param name="pointID">PointID</param>
        /// <returns>True : Cancel success.</returns>
        /// <returns>False : Cancel fail.</returns>
        public JsonResult CancelPrediction(string expectPointID, string pointID, int deletedPoint)
        {
            string strNewTotalPoint = string.Empty;
            using (var dbContextTransaction = com.Database.BeginTransaction())
            {
                try
                {
                    if (Session["CurrentUser"] != null)
                    {
                        var memberID = Session["CurrentUser"].ToString();
                        var expPointID = Convert.ToInt64(StringProtector.Unprotect(expectPointID));
                        var pID = Convert.ToInt64(StringProtector.Unprotect(pointID));

                        //0. Find expected point in table expectPoint.
                        //0.1 Not exist : rollback transaction.
                        //0.2 Exists : continue to step 1.
                        var expectRecord = com.ExpectPoint.Where(m => m.ExpectPointID == expPointID).FirstOrDefault();
                        if (expectRecord != null)
                        {
                            //TODO SituationStatus 要確認(1,2以外のときを規定したほうがベター)
                            if(expectRecord.SituationStatus == 1)
                            {
                                //1. Update record in table ExpectPoint.
                                expectRecord.SituationStatus = 2;
                                expectRecord.ModifiedAccountID = memberID;
                                expectRecord.ModifiedDate = DateTime.Now;

                                //2. Insert 2 records in table PointHistory.
                                //First record.
                                PointHistory his = new PointHistory();
                                his.PointId = pID;
                                his.ExpectPointId = expPointID;
                                his.CampaignId = null;
                                his.PointClass = 3;
                                his.Points = deletedPoint;
                                his.HistoryClass = 6;
                                his.AdjustmentClass = 2;
                                his.OperationClass = 1;
                                his.Status = true;
                                his.CreatedAccountID = memberID;
                                his.CreatedDate = DateTime.Now;
                                com.PointHistory.Add(his);

                                //Second record.
                                PointHistory his1 = new PointHistory();
                                his1.PointId = pID;
                                his1.ExpectPointId = expPointID;
                                his1.CampaignId = null;
                                his1.PointClass = 2;
                                his1.Points = deletedPoint;
                                his1.HistoryClass = 6;
                                his1.AdjustmentClass = 1;
                                his1.OperationClass = 1;
                                his1.Status = true;
                                his1.CreatedAccountID = memberID;
                                his1.CreatedDate = DateTime.Now;
                                com.PointHistory.Add(his1);

                                //3. Update possession point in table Point : add deleted point to possession point.
                                var newTablePoint = com.Point.Where(m => m.PointID == pID).FirstOrDefault();
                                var newPossPoint = newTablePoint.PossesionPoint + deletedPoint;
                                newTablePoint.PossesionPoint = newPossPoint;
                                newTablePoint.ModifiedAccountID = memberID;
                                newTablePoint.ModifiedDate = DateTime.Now;

                                com.SaveChanges();
                                dbContextTransaction.Commit();
                                strNewTotalPoint = newPossPoint.ToString();
                            }
                            else if (expectRecord.SituationStatus == 2)
                            {
                                //Just return the possession point
                                var possPoint = com.Point.Where(m => m.PointID == pID).Select(m => m.PossesionPoint).FirstOrDefault();
                                strNewTotalPoint = possPoint.ToString();
                                dbContextTransaction.Commit();
                            }
                        }
                        else
                        {
                            dbContextTransaction.Rollback();
                        }
                    }
                    else
                    {
                        dbContextTransaction.Rollback();
                    }
                }
                catch (Exception)
                {
                    dbContextTransaction.Rollback();
                }
            }
            return Json(strNewTotalPoint, JsonRequestBehavior.AllowGet);
        }
        public JsonResult UpdatePrediction(string expectPointID, string pointID, int newPoint, string oldPoint)
        {
            string strNewTotalPoint = string.Empty;
            int? betSelectId = null;
            int expectPoint = newPoint;

            using (var dbContextTransaction = com.Database.BeginTransaction())
            {
                try
                {
                    if (Session["CurrentUser"] != null)
                    {
                        var memberID = Session["CurrentUser"].ToString();
                        int oPoint = Convert.ToInt32(oldPoint);

                        //Decrypt expectPointID and pointID.
                        var expPointID = Convert.ToInt64(StringProtector.Unprotect(expectPointID));
                        var pID = Convert.ToInt64(StringProtector.Unprotect(pointID));

                        //1.Update expectPoint in table ExpectPoint
                        var expectRecord = com.ExpectPoint.Where(m => m.ExpectPointID == expPointID).FirstOrDefault();
                        if (expectRecord != null)
                        {
                            expectRecord.ExpectPoint1 = newPoint;
                            expectRecord.ModifiedAccountID = memberID;
                            expectRecord.ModifiedDate = DateTime.Now;
                            betSelectId = expectRecord.BetSelectID;
                        }

                        //2. Insert 2 records to table PointHistory.
                        //2.1 Calculate range from old point to new point.
                        int range=0;
                        int possessionPoint = com.Point.Where(m => m.PointID == pID).Select(m => m.PossesionPoint).FirstOrDefault();
                        int newPossPoint = 0;
                        bool isIncrease = false;
                        if(newPoint > oPoint)
                        {
                            range = newPoint - oPoint;
                            newPossPoint = possessionPoint - range;
                            isIncrease = true;
                        }
                        else
                        {
                            range = oPoint - newPoint;
                            newPossPoint = possessionPoint + range;
                        }

                        //2.2 Start insert 2 records  to table PointHistory.
                        //First record.
                        PointHistory his = new PointHistory();
                        his.PointId = pID;
                        his.ExpectPointId = expPointID;
                        his.CampaignId = null;
                        his.PointClass = 2;
                        his.Points = range;
                        his.HistoryClass = 2;
                        his.AdjustmentClass = (short)(isIncrease ? 2 : 1);
                        his.OperationClass = 1;
                        his.Status = true;
                        his.CreatedAccountID = memberID;
                        his.CreatedDate = DateTime.Now;
                        com.PointHistory.Add(his);

                        //Second record.
                        PointHistory his1 = new PointHistory();
                        his1.PointId = pID;
                        his1.ExpectPointId = expPointID;
                        his1.CampaignId = null;
                        his1.PointClass = 3;
                        his1.Points = range;
                        his1.HistoryClass = 2;
                        his1.AdjustmentClass = (short)(isIncrease ? 1 : 2);
                        his1.OperationClass = 1;
                        his1.Status = true;
                        his1.CreatedAccountID = memberID;
                        his1.CreatedDate = DateTime.Now;
                        com.PointHistory.Add(his1);

                        //3. Update possession point in table Point.
                        var newTablePoint = com.Point.Where(m => m.PointID == pID).FirstOrDefault();
                        newTablePoint.PossesionPoint = newPossPoint;
                        newTablePoint.ModifiedAccountID = memberID;
                        newTablePoint.ModifiedDate = DateTime.Now;

                        //Commit transaction.
                        com.SaveChanges();
                        dbContextTransaction.Commit();
                        strNewTotalPoint = newPossPoint.ToString();
                    }
                }
                catch (Exception)
                {
                    dbContextTransaction.Rollback();
                }
            }

            return Json(new object[] { strNewTotalPoint, betSelectId, expectPoint }, JsonRequestBehavior.AllowGet);
            //return Json(strNewTotalPoint, JsonRequestBehavior.AllowGet);
        }
Exemple #3
0
        /// <summary>
        /// Cancel prediction : 3 step
        ///     1. Update record in table ExpectPoint.
        ///     2. Insert 2 records in table PointHistory.
        ///     3. Update possession point in table Point
        /// </summary>
        /// <param name="expectPointID">ExpectPointID</param>
        /// <param name="pointID">PointID</param>
        /// <param name="deletedPoint"></param>
        /// <param name="currentUser">ログイン中のユーザ</param>
        /// <returns>True : Cancel success.</returns>
        /// <returns>False : Cancel fail.</returns>
        public long CancelPrediction(string expectPointID, string pointID, int deletedPoint, long currentUser)
        {
            long newTotalPoint = 0;
            using (var dbContextTransaction = this.comEntities.Database.BeginTransaction())
            {
                try
                {
                    //if (Session["CurrentUser"] != null)
                    {
                        var memberID = "";
                        //var memberID = Session["CurrentUser"].ToString();
                        var expPointID = Convert.ToInt64(StringProtector.Unprotect(expectPointID));
                        var pID = Convert.ToInt64(StringProtector.Unprotect(pointID));

                        //0. Find expected point in table expectPoint.
                        //0.1 Not exist : rollback transaction.
                        //0.2 Exists : continue to step 1.
                        var expectRecord = this.comEntities.ExpectPoint.Where(m => m.ExpectPointID == expPointID).FirstOrDefault();
                        if (expectRecord != null)
                        {
                            //TODO SituationStatus 要確認(1,2以外のときを規定したほうがベター)
                            if (expectRecord.SituationStatus == 1)
                            {
                                //1. Update record in table ExpectPoint.
                                expectRecord.SituationStatus = 2;
                                expectRecord.ModifiedAccountID = memberID;
                                expectRecord.ModifiedDate = DateTime.Now;

                                //2. Insert 2 records in table PointHistory.
                                //First record.
                                PointHistory his = new PointHistory();
                                his.PointId = pID;
                                his.ExpectPointId = expPointID;
                                his.CampaignId = null;
                                his.PointClass = 3;
                                his.Points = deletedPoint;
                                his.HistoryClass = 6;
                                his.AdjustmentClass = 2;
                                his.OperationClass = 1;
                                his.Status = true;
                                his.CreatedAccountID = memberID;
                                his.CreatedDate = DateTime.Now;
                                this.comEntities.PointHistory.Add(his);

                                //Second record.
                                PointHistory his1 = new PointHistory();
                                his1.PointId = pID;
                                his1.ExpectPointId = expPointID;
                                his1.CampaignId = null;
                                his1.PointClass = 2;
                                his1.Points = deletedPoint;
                                his1.HistoryClass = 6;
                                his1.AdjustmentClass = 1;
                                his1.OperationClass = 1;
                                his1.Status = true;
                                his1.CreatedAccountID = memberID;
                                his1.CreatedDate = DateTime.Now;
                                this.comEntities.PointHistory.Add(his1);

                                //3. Update possession point in table Point : add deleted point to possession point.
                                var newTablePoint = this.comEntities.Point.Where(m => m.PointID == pID).FirstOrDefault();
                                var newPossPoint = newTablePoint.PossesionPoint + deletedPoint;
                                newTablePoint.PossesionPoint = newPossPoint;
                                newTablePoint.ModifiedAccountID = memberID;
                                newTablePoint.ModifiedDate = DateTime.Now;

                                this.comEntities.SaveChanges();
                                dbContextTransaction.Commit();
                                newTotalPoint = newPossPoint;
                            }
                            else if (expectRecord.SituationStatus == 2)
                            {
                                //Just return the possession point
                                var possPoint = this.comEntities.Point.Where(m => m.PointID == pID).Select(m => m.PossesionPoint).FirstOrDefault();
                                newTotalPoint = possPoint;
                                dbContextTransaction.Commit();
                            }
                        }
                        else
                        {
                            dbContextTransaction.Rollback();
                        }
                    }
                    //else
                    {
                        dbContextTransaction.Rollback();
                    }
                }
                catch (Exception)
                {
                    //// TODO:とりあえずログ出力
                    //// JS呼出時の集約例外処理の対応後に集約例外処理へthrow,ここでのRollbackは行わないように修正する
                    //var writeLogFileService = new WriteLogFileService(WriteLogFileConst.ExceptionLoggerName);
                    ////例外書き込み用
                    //var exceptionLogModel = new ExceptionLogModel()
                    //{
                    //    MemberId = HttpContext.Current.Session["CurrentUser"].GetNullableLong(),
                    //    Url = HttpContext.Current.Request.Url.UriString(),
                    //    UserAgent = HttpContext.Current.Request.UserAgent,
                    //    UrlReferrer = HttpContext.Current.Request.UrlReferrer.UriString(),
                    //    SessionId = HttpContext.Current.Session.SessionID,
                    //};

                    //int httpStatusCode = ex.GetHttpCode();

                    //writeLogFileService.Fatal(ex, exceptionLogModel, httpStatusCode);

                    dbContextTransaction.Rollback();
                }
            }

            return newTotalPoint;
        }
Exemple #4
0
        public static bool IsExpectCancel(MyExpectedListInfoModel.ExpectChangeModel ViewModel, Int64 memberID)
        {
            bool isResult = false;
            int sports_id = ViewModel.SportsID;
            int gameID = ViewModel.GameID;
            int gamePoints = ViewModel.ExpectPoint;

            using (var dbContextTransaction = com.Database.BeginTransaction())
            {
                try
                {
                    if (gameID > 0 && memberID > 0)
                    {
                        List<long> lstPointID = com.Point.Where(m => m.MemberID == memberID).Select(m => m.PointID).ToList();

                        //Get these games that not end : not start or ongoing.
                        var upd_ep = (from et in com.ExpectTarget
                                      join ep in com.ExpectPoint on et.ExpectTargetID equals ep.ExpectTargetID
                                      where lstPointID.Contains(ep.PointID)
                                    && et.UniqueID == gameID
                                 && et.SportsID == sports_id
                                 && et.ClassClass == MyPageCommon.CLASSCLASS_GAME
                                      select ep).FirstOrDefault();

                        if (upd_ep != null)
                        {
                            upd_ep.SituationStatus = 2; // 1・・予想、2・・キャンセル、3・・中止、4・・結果確定

                            var newPHexpect = new PointHistory
                            {
                                PointId = upd_ep.PointID,
                                ExpectPointId = upd_ep.ExpectPointID,
                                CampaignId = null,
                                PointClass = 3, //1・・原資、2・・所持、3・・予想、4・・獲得、5・・精算
                                Points = upd_ep.ExpectPoint1,
                                HistoryClass = 6,// 1・・付与、2・・予想、3・・獲得、4・・予想失敗、5・・精算、6・・キャンセル、7・・払い戻し、8・・失効
                                AdjustmentClass = 2, // 1・・加算、2・・減算
                                OperationClass = 1, // 1・・フロント、2・・バッチ、3・・バックオフィス
                                Status = true, // 0・・エラー  1・・正常終了
                                CreatedAccountID = memberID.ToString(),
                                CreatedDate = DateTime.Now
                            };
                            com.PointHistory.Add(newPHexpect);
                            var newPHpossesion = new PointHistory
                            {
                                PointId = upd_ep.PointID,
                                ExpectPointId = upd_ep.ExpectPointID,
                                CampaignId = null,
                                PointClass = 2, //1・・原資、2・・所持、3・・予想、4・・獲得、5・・精算
                                Points = upd_ep.ExpectPoint1,
                                HistoryClass = 6,// 1・・付与、2・・予想、3・・獲得、4・・予想失敗、5・・精算、6・・キャンセル、7・・払い戻し、8・・失効
                                AdjustmentClass = 1, // 1・・加算、2・・減算
                                OperationClass = 1, // 1・・フロント、2・・バッチ、3・・バックオフィス
                                Status = true, // 0・・エラー  1・・正常終了
                                CreatedAccountID = memberID.ToString(),
                                CreatedDate = DateTime.Now
                            };
                            com.PointHistory.Add(newPHpossesion);

                            var upd_pt = (from pt in com.Point
                                          where pt.PointID == upd_ep.PointID
                                          && pt.MemberID == memberID
                                          select pt).FirstOrDefault();
                            if (upd_pt != null)
                            {
                                upd_pt.PossesionPoint = upd_pt.PossesionPoint + upd_ep.ExpectPoint1;
                            }

                            com.SaveChanges();
                            dbContextTransaction.Commit();
                        }
                        isResult = true;
                    }
                    else
                    {
                        //Rollback transaction.
                        dbContextTransaction.Rollback();
                    }
                }
                catch (Exception)
                {
                    dbContextTransaction.Rollback();
                }

                return isResult;
            }
        }
Exemple #5
0
        public static MyPageJsonResultModel UpdateExpectPoint(MyExpectedListInfoModel.ExpectChangeModel ViewModel, Int64 memberID)
        {
            int sportsID = ViewModel.SportsID;
            int gameID = ViewModel.GameID;
            int newExpectPoints = ViewModel.ExpectPoint;
            int oldExpectPoints = ViewModel.OldExpectPoint;
            MyPageJsonResultModel result = new MyPageJsonResultModel();

            string errMsg = "";
            errMsg = ValidChkInputPoint(ViewModel, memberID);

            if (errMsg != "")
            {
                result.HasError = true;
                result.Message = errMsg;

            }
            else
            {
                using (var dbContextTransaction = com.Database.BeginTransaction())
                {
                    try
                    {
                        if (gameID > 0 && memberID > 0)
                        {
                            var expectPointRecord = (from ep in com.ExpectPoint
                                                     join et in com.ExpectTarget
                                                     on ep.ExpectTargetID equals et.ExpectTargetID
                                                     join pt in com.Point
                                                     on ep.PointID equals pt.PointID
                                                     where et.UniqueID == gameID
                                                     && et.ClassClass == CLASSCLASS_GAME
                                                     && et.SportsID == sportsID
                                                     && pt.MemberID == memberID
                                                     select ep).FirstOrDefault();

                            if (expectPointRecord != null)
                            {
                                //TODO SituationStatus 要確認(!=2でなくていいの?)
                                expectPointRecord.SituationStatus = 1; // 1・・予想、2・・キャンセル、3・・中止、4・・結果確定

                                var newPHexpect = new PointHistory
                                {
                                    PointId = expectPointRecord.PointID,
                                    ExpectPointId = expectPointRecord.ExpectPointID,
                                    CampaignId = null,
                                    PointClass = 2, //1・・原資、2・・所持、3・・予想、4・・獲得、5・・精算
                                    Points = newExpectPoints,
                                    HistoryClass = 2,// 1・・付与、2・・予想、3・・獲得、4・・予想失敗、5・・精算、6・・キャンセル、7・・払い戻し、8・・失効
                                    AdjustmentClass = 2, // 1・・加算、2・・減算
                                    OperationClass = 1, // 1・・フロント、2・・バッチ、3・・バックオフィス
                                    Status = true, // 0・・エラー  1・・正常終了
                                    CreatedAccountID = memberID.ToString(),
                                    CreatedDate = DateTime.Now
                                };
                                com.PointHistory.Add(newPHexpect);
                                var newPHpossesion = new PointHistory
                                {
                                    PointId = expectPointRecord.PointID,
                                    ExpectPointId = expectPointRecord.ExpectPointID,
                                    CampaignId = null,
                                    PointClass = 3, //1・・原資、2・・所持、3・・予想、4・・獲得、5・・精算
                                    Points = newExpectPoints,
                                    HistoryClass = 2,// 1・・付与、2・・予想、3・・獲得、4・・予想失敗、5・・精算、6・・キャンセル、7・・払い戻し、8・・失効
                                    AdjustmentClass = 1, // 1・・加算、2・・減算
                                    OperationClass = 1, // 1・・フロント、2・・バッチ、3・・バックオフィス
                                    Status = true, // 0・・エラー  1・・正常終了
                                    CreatedAccountID = memberID.ToString(),
                                    CreatedDate = DateTime.Now
                                };

                                com.PointHistory.Add(newPHpossesion);

                                var upd_pt = (from pt in com.Point
                                              where pt.PointID == expectPointRecord.PointID
                                              && pt.MemberID == memberID
                                              select pt).FirstOrDefault();
                                if (upd_pt != null)
                                {
                                    upd_pt.PossesionPoint = upd_pt.PossesionPoint - (newExpectPoints - oldExpectPoints);
                                }
                                expectPointRecord.ExpectPoint1 = newExpectPoints;

                                com.SaveChanges();
                                dbContextTransaction.Commit();
                            }

                        }
                        else
                        {
                            result.HasError = true;
                            //Rollback transaction.
                            dbContextTransaction.Rollback();
                        }
                    }
                    catch (Exception)
                    {
                        // TODO:とりあえずログ出力
                        // JS呼出時の集約例外処理の対応後に集約例外処理へthrow,ここでのRollbackは行わないように修正する
                        result.HasError = true;
                        dbContextTransaction.Rollback();
                    }
                }
            }

            return result;
        }
Exemple #6
0
        public JsonResult StartPrediction(string expectTargetID, int gameID, int betSelectID, string memberID, int teamID, int gameDate)
        {
            bool isResult = false;
            long mID = 0;
            //Decrypt text
            long lgExtTarget = Convert.ToInt64(StringProtector.Unprotect(expectTargetID));
            int gID = gameID;
            using (var dbContextTransaction = com.Database.BeginTransaction())

            {
                try
                {
                    if (!string.IsNullOrEmpty(memberID))
                    {
                        mID = Convert.ToInt64(memberID);
                    }
                    //1.Test possession point must larger default point
                    //1.1 Get pointID that have time available with BetStartDate and BetEndDate.
                    DateTime gDate = DateTime.ParseExact(gameDate.ToString(), "yyyyMMdd", null);
                    var pointID = com.Point.Where(m => m.MemberID == mID && m.BetStartDate <= gDate && m.BetEndDate >= gDate).Select(m => m.PointID).FirstOrDefault();

                    //1.2 Get Possession point for PointID and subtract possession with expectpoint.
                    var possPoint = com.Point.Where(m => m.PointID == pointID).FirstOrDefault();
                    var pointRemain = possPoint.PossesionPoint - Constants.POINT_DEFAULT;

                    //Continue to step 2.
                    if (pointRemain > 0)
                    {
                        //2.Insert to table ExpectPoint.
                        //2.1.Test that record exists in db or not.
                        var query = (from et in com.ExpectTarget
                                     join ep in com.ExpectPoint on et.ExpectTargetID equals ep.ExpectTargetID
                                     where et.ExpectTargetID == lgExtTarget && et.UniqueID == gID && ep.PointID == possPoint.PointID
                                     select ep).FirstOrDefault();

                        //2.2.If not exist in ExpectPoint, insert new record
                        if (query == null)
                        {
                            ExpectPoint ep = new ExpectPoint();
                            ep.ExpectTargetID = lgExtTarget;
                            ep.PointID = pointID;
                            ep.ExpectPoint1 = Constants.POINT_DEFAULT;
                            ep.AcquisitionPoint = null;
                            ep.ClassClass = 2;
                            ep.UniqueID = teamID;
                            ep.BetSelectID = betSelectID;
                            ep.VorD = null;
                            ep.SituationStatus = 1;
                            ep.CreatedAccountID = memberID;
                            ep.CreatedDate = DateTime.Now;
                            ep.ModifiedAccountID = null;
                            ep.ModifiedDate = null;
                            com.ExpectPoint.Add(ep);
                        }
                        //2.3 Record exists : test user cancel prediction or not.
                        else
                        {

                            if(query.SituationStatus == 2)
                            {
                                //Update expectPoint with default point, change status.
                                query.SituationStatus = 1;
                                query.BetSelectID = betSelectID;
                                query.ExpectPoint1 = Constants.POINT_DEFAULT;
                                query.UniqueID = teamID;
                                query.ModifiedAccountID = memberID;
                                query.ModifiedDate = DateTime.Now;
                            }
                            else if(query.SituationStatus == 1)
                            {
                                dbContextTransaction.Rollback();
                            }
                        }
                        com.SaveChanges();

                        //2.4 Get ExpectPointID from record that have been inserted.
                        var expectPointID = com.ExpectPoint.Where(m => m.ExpectTargetID == lgExtTarget && m.PointID == pointID
                            && m.UniqueID == teamID && m.BetSelectID == betSelectID && m.CreatedAccountID == memberID).Select(m => m.ExpectPointID).FirstOrDefault();

                        //3.Insert 2 record to table PointHistory
                        if (expectPointID != null)
                        {
                            //First record.
                            PointHistory his = new PointHistory();
                            his.PointId = pointID;
                            his.ExpectPointId = expectPointID;
                            his.CampaignId = null;
                            his.PointClass = 2;
                            his.Points = Constants.POINT_DEFAULT;
                            his.HistoryClass = 2;
                            his.AdjustmentClass = 2;
                            his.OperationClass = 1;
                            his.Status = true;
                            his.CreatedAccountID = memberID;
                            his.CreatedDate = DateTime.Now;
                            com.PointHistory.Add(his);

                            //Second record.
                            PointHistory his1 = new PointHistory();
                            his1.PointId = pointID;
                            his1.ExpectPointId = expectPointID;
                            his1.CampaignId = null;
                            his1.PointClass = 3;
                            his1.Points = Constants.POINT_DEFAULT;
                            his1.HistoryClass = 2;
                            his1.AdjustmentClass = 1;
                            his1.OperationClass = 1;
                            his1.Status = true;
                            his1.CreatedAccountID = memberID;
                            his1.CreatedDate = DateTime.Now;
                            com.PointHistory.Add(his1);
                        }

                        //4.Update table Point : decrease possession point
                        //4.1 Update table point with new possession point.
                        possPoint.PossesionPoint = pointRemain;
                        possPoint.ModifiedAccountID = memberID;
                        possPoint.ModifiedDate = DateTime.Now;

                        com.SaveChanges();
                        dbContextTransaction.Commit();
                        isResult = true;
                    }
                    else
                    {
                        //Rollback transaction.
                        dbContextTransaction.Rollback();
                    }
                }
                catch (Exception)
                {
                    dbContextTransaction.Rollback();
                }
            }
            return Json(isResult, JsonRequestBehavior.AllowGet);
        }