コード例 #1
0
        /// <summary>
        /// 添加编辑积分规则
        /// </summary>
        /// <param name="scoreDefineInfo"></param>
        /// <returns></returns>
        public bool PutScoreDefine(Model.ScoreDefineInfo scoreDefineInfo)
        {
            //    if (ExistsScoreDefine(scoreDefineInfo))
            //    {
            //        Model.ScoreDefineInfo oldScoreDefineInfo = GetScoreDefineInfo(scoreDefineInfo.ScoreType, scoreDefineInfo.WebsiteOwner);
            //        oldScoreDefineInfo.Score = scoreDefineInfo.Score;
            //        oldScoreDefineInfo.IsHide = scoreDefineInfo.IsHide;
            //        oldScoreDefineInfo.DayLimit = scoreDefineInfo.DayLimit;
            //        oldScoreDefineInfo.TotalLimit = scoreDefineInfo.TotalLimit;
            //        oldScoreDefineInfo.Description = scoreDefineInfo.Description;
            //        oldScoreDefineInfo.OrderNum = scoreDefineInfo.OrderNum;
            //        oldScoreDefineInfo.Ex1 = scoreDefineInfo.Ex1;
            //        return Update(oldScoreDefineInfo);
            //    }
            //    else
            //    {
            //        scoreDefineInfo.ScoreId = int.Parse(GetGUID(TransacType.CommAdd));
            //        return Add(scoreDefineInfo);
            //    }

            Model.ScoreDefineInfo oldScoreDefineInfo = GetScoreDefineInfo(scoreDefineInfo.ScoreId, scoreDefineInfo.WebsiteOwner);
            if (oldScoreDefineInfo == null) //新增
            {
                if (scoreDefineInfo.ScoreType == "Customize")
                {
                    if (GetCount <ScoreDefineInfo>(string.Format(" ScoreEvent='{0}' And WebsiteOwner='{1}'", scoreDefineInfo.ScoreEvent, WebsiteOwner)) > 0)
                    {
                        return(false);
                    }
                }
                else
                {
                    if (GetCount <ScoreDefineInfo>(string.Format(" ScoreType='{0}' And WebsiteOwner='{1}'", scoreDefineInfo.ScoreType, WebsiteOwner)) > 0)
                    {
                        return(false);
                    }
                }


                scoreDefineInfo.ScoreId = int.Parse(GetGUID(TransacType.CommAdd));
                return(Add(scoreDefineInfo));
            }
            else//编辑
            {
                oldScoreDefineInfo.Score         = scoreDefineInfo.Score;
                oldScoreDefineInfo.IsHide        = scoreDefineInfo.IsHide;
                oldScoreDefineInfo.DayLimit      = scoreDefineInfo.DayLimit;
                oldScoreDefineInfo.TotalLimit    = scoreDefineInfo.TotalLimit;
                oldScoreDefineInfo.Description   = scoreDefineInfo.Description;
                oldScoreDefineInfo.OrderNum      = scoreDefineInfo.OrderNum;
                oldScoreDefineInfo.Ex1           = scoreDefineInfo.Ex1;
                oldScoreDefineInfo.ScoreEvent    = scoreDefineInfo.ScoreEvent;
                oldScoreDefineInfo.BaseRateValue = scoreDefineInfo.BaseRateValue;
                oldScoreDefineInfo.BaseRateScore = scoreDefineInfo.BaseRateScore;
                return(Update(oldScoreDefineInfo));
            }
        }
コード例 #2
0
 /// <summary>
 /// 检查是否存在
 /// </summary>
 /// <param name="scoreDefineInfo"></param>
 /// <returns></returns>
 public bool ExistsScoreDefine(Model.ScoreDefineInfo scoreDefineInfo)
 {
     return(GetScoreDefineInfo(scoreDefineInfo.ScoreType, scoreDefineInfo.WebsiteOwner) == null ? false : true);
 }