示例#1
0
        /// <summary>
        /// 商品认证
        ///
        /// 返回结果
        /// 1.	已验证过
        /// 2.	验证成功
        /// 3.	验证失败
        /// </summary>
        /// <param name="loggingSessionInfo"></param>
        /// <param name="userId"></param>
        /// <param name="authCode"></param>
        /// <param name="captchaCode"></param>
        /// <returns></returns>
        public string CheckAuthCode(LoggingSessionInfo loggingSessionInfo, string userId, string authCode, string captchaCode)
        {
            string       result       = "";
            LItemAuthBLL lItemAuthBLL = new LItemAuthBLL(loggingSessionInfo);
            var          itemAuthList = lItemAuthBLL.QueryByEntity(new LItemAuthEntity()
            {
                AuthCode = authCode
            }, null);
            LItemAuthEntity itemAuthObj = null;

            if (itemAuthList != null && itemAuthList.Length > 0)
            {
                itemAuthObj            = itemAuthList[0];
                itemAuthObj.AuthCount += 1;
                lItemAuthBLL.Update(itemAuthObj, false);
                result = "1";
                return(result);
            }
            else
            {
                SaturnServiceReference.SaturnServiceSoapClient client = new SaturnServiceReference.SaturnServiceSoapClient();
                var resultStr = client.getAuthenticationCode("{\"common\":{\"userId\":\"" + userId + "\",\"version\":\"3.1\"},\"special\":{\"authCode\":\"" + authCode + "\",\"captchaCode\":\"" + captchaCode + "\"}}");
                var authObj   = resultStr.DeserializeJSONTo <CheckAuthCodeResp>();
                if (authObj.code == "200")
                {
                    if (authObj.content.isAuthCode == "1")
                    {
                        result = "2";
                    }
                    else
                    {
                        result = "3";
                    }
                    var newItemAuthObj = new LItemAuthEntity();
                    newItemAuthObj.ItemAuthId   = Utils.NewGuid();
                    newItemAuthObj.AuthCode     = authCode;
                    newItemAuthObj.CaptchaCode  = captchaCode;
                    newItemAuthObj.ItemName     = authObj.content.itemName;
                    newItemAuthObj.Norm         = authObj.content.norm;
                    newItemAuthObj.Alcohol      = authObj.content.alcohol;
                    newItemAuthObj.BaseWineYear = authObj.content.baseWineYear;
                    newItemAuthObj.AgePitPits   = authObj.content.agePitPits;
                    newItemAuthObj.Barcode      = authObj.content.barcode;
                    newItemAuthObj.IsAuthCode   = ToInt(authObj.content.isAuthCode);
                    newItemAuthObj.CategoryName = authObj.content.categoryName;
                    newItemAuthObj.CategoryId   = authObj.content.categoryId;
                    newItemAuthObj.BrandName    = authObj.content.brandName;
                    newItemAuthObj.DealerName   = authObj.content.dealerName;
                    newItemAuthObj.DealerId     = authObj.content.dealerId;
                    newItemAuthObj.AuthCount    = 1;
                    newItemAuthObj.StoreCode    = authObj.content.storeCode;
                    newItemAuthObj.VipId        = userId;

                    lItemAuthBLL.Create(newItemAuthObj);
                }
                else
                {
                    result = authObj.description;
                }
            }
            return(result);
        }
示例#2
0
 /// <summary>
 /// 更新
 /// </summary>
 /// <param name="pEntity">实体实例</param>
 /// <param name="pTran">事务实例,可为null,如果为null,则不使用事务来更新</param>
 public void Update(LItemAuthEntity pEntity, IDbTransaction pTran)
 {
     Update(pEntity, true, pTran);
 }
示例#3
0
 public void Update(LItemAuthEntity pEntity, bool pIsUpdateNullField, IDbTransaction pTran)
 {
     _currentDAO.Update(pEntity, pIsUpdateNullField, pTran);
 }
示例#4
0
 /// <summary>
 /// 创建一个新实例
 /// </summary>
 /// <param name="pEntity">实体实例</param>
 public void Create(LItemAuthEntity pEntity)
 {
     _currentDAO.Create(pEntity);
 }
示例#5
0
 /// <summary>
 /// 在事务内创建一个新实例
 /// </summary>
 /// <param name="pEntity">实体实例</param>
 /// <param name="pTran">事务实例,可为null,如果为null,则不使用事务来更新</param>
 public void Create(LItemAuthEntity pEntity, IDbTransaction pTran)
 {
     _currentDAO.Create(pEntity, pTran);
 }
示例#6
0
 /// <summary>
 /// 分页根据实体条件查询实体
 /// </summary>
 /// <param name="pQueryEntity">以实体形式传入的参数</param>
 /// <param name="pOrderBys">排序组合</param>
 /// <returns>符合条件的实体集</returns>
 public PagedQueryResult <LItemAuthEntity> PagedQueryByEntity(LItemAuthEntity pQueryEntity, OrderBy[] pOrderBys, int pPageSize, int pCurrentPageIndex)
 {
     return(_currentDAO.PagedQueryByEntity(pQueryEntity, pOrderBys, pPageSize, pCurrentPageIndex));
 }
示例#7
0
 /// <summary>
 /// 根据实体条件查询实体
 /// </summary>
 /// <param name="pQueryEntity">以实体形式传入的参数</param>
 /// <param name="pOrderBys">排序组合</param>
 /// <returns>符合条件的实体集</returns>
 public LItemAuthEntity[] QueryByEntity(LItemAuthEntity pQueryEntity, OrderBy[] pOrderBys)
 {
     return(_currentDAO.QueryByEntity(pQueryEntity, pOrderBys));
 }
示例#8
0
 /// <summary>
 /// 删除
 /// </summary>
 /// <param name="pEntity"></param>
 public void Delete(LItemAuthEntity pEntity)
 {
     _currentDAO.Delete(pEntity);
 }
示例#9
0
 public void Update(LItemAuthEntity pEntity, bool pIsUpdateNullField)
 {
     _currentDAO.Update(pEntity, pIsUpdateNullField);
 }
示例#10
0
 /// <summary>
 /// 更新
 /// </summary>
 /// <param name="pEntity">实体实例</param>
 public void Update(LItemAuthEntity pEntity)
 {
     Update(pEntity, true);
 }