public bool Add(VerifyStatus v, Question q)
        {
            Hashtable hashtable       = new Hashtable();
            string    sqlVerifyStatus = "insert into VerifyStatus(QuestionId,UserId,VerifyTimes,IsPass,VerifyTime) values(@QuestionId,@UserId,@VerifyTimes,@IsPass,@VerifyTime)";

            SqlParameter[] Vpara =
            {
                new SqlParameter("@QuestionId",  SqlDbType.Int),
                new SqlParameter("@UserId",      SqlDbType.Int),
                new SqlParameter("@VerifyTimes", SqlDbType.Int),
                new SqlParameter("@IsPass",      SqlDbType.Bit),
                new SqlParameter("@VerifyTime",  SqlDbType.DateTime),
            };
            Vpara[0].Value = v.QuestionId;
            Vpara[1].Value = v.UserId;
            Vpara[2].Value = v.VerifyTimes;
            Vpara[3].Value = v.IsPass;
            Vpara[4].Value = v.VerifyTime;
            string sqlQuestion = "UPDATE Question SET VerifyTimes =VerifyTimes+1 WHERE QuestionId = @QuestionId";

            SqlParameter[] Qpara =
            {
                new SqlParameter("@QuestionId", SqlDbType.Int)
            };
            Qpara[0].Value = q.QuestionId;
            hashtable.Add(sqlVerifyStatus, Vpara);
            hashtable.Add(sqlQuestion, Qpara);
            DbHelperSQL.ExecuteSqlTran(hashtable);//SQL语句的哈希表(key为sql语句,value是该语句的SqlParameter[])
            return(true);
        }
Exemple #2
0
 public void VerifyUser(VerifyStatus status, long @operator, string reason, out bool isOpenTrail)
 {
     isOpenTrail = false;
     ExceptionHelper.ThrowIfNotId(@operator, nameof(@operator));
     ExceptionHelper.ThrowIfTrue(status == VerifyStatus.Unpass && string.IsNullOrWhiteSpace(reason), "请输入认证失败原因");
     using (var scope = new TransactionScope())
     {
         _LazyValue.Value.verifyDate = DateTime.Now;
         var userServiceState = GetUserSeriviceState();
         if (UserVerifyStatus == VerifyStatus.None || UserVerifyStatus == VerifyStatus.Unpass)         //用户认证状态为未认证 或者 审核不通过情况下
         {
             if (userServiceState.UserLevel == UserServiceLevel.Normal && status == VerifyStatus.Pass) //用户等级为普通会员 并且 当前操作为审核通过
             {
                 userServiceState.OpenTrail(7);                                                        //增加7天试用期
                 isOpenTrail = true;
             }
         }
         _LazyValue.Value.verifyStatus = status;
         if (status == VerifyStatus.Unpass)
         {
             _LazyValue.Value.isNeedVerify = true;
         }
         else
         {
             _LazyValue.Value.isNeedVerify = false;
         }
         _LazyValue.Value.verifyUser = @operator;
         if (status == VerifyStatus.Unpass && !string.IsNullOrWhiteSpace(reason))
         {
             _LazyValue.Value.verifyFailReason = reason;
         }
         _UserRepository.SaveChanges();
         scope.Complete();
     }
 }
Exemple #3
0
        public void setGlobalStatus()
        {
            if (
                this.NoMacroOrExe == VerifyStatus.Invalid ||
                this.Signature == VerifyStatus.Invalid ||
                this.Signature == VerifyStatus.Expired ||
                this.CrlStatus == VerifyStatus.Invalid ||
                this.CrlStatus == VerifyStatus.Expired ||
                this.TimeStampStatus == VerifyStatus.Invalid ||
                this.FileFormatOK == VerifyStatus.Invalid ||
                this.FileHashOK == VerifyStatus.Invalid
                )
            {
                this.Status = VerifyStatus.Invalid;
            }
            else
            {
                this.Status = VerifyStatus.Valid;
            }

            //per la firma
            if (this.Signature == VerifyStatus.InProgress ||
                this.CrlStatus == VerifyStatus.InProgress)
            {
                this.Status = VerifyStatus.InProgress;
            }
        }
        public void VerifyPasswordByIdTest_Id_Equals_Alex_Password_1234_Should_Passed()
        {
            //Arrange

            AuthenticationService target = new AuthenticationService();

            DataTable  dt = new DataTable();
            DataColumn dc = new DataColumn("Password", typeof(string));

            dt.Columns.Add(dc);

            DataRow dr = dt.NewRow();

            dr["Password"] = "******";
            dt.Rows.Add(dr);

            //Stub物件初使化
            IAuthenticationDao stubDao = MockRepository.GenerateStub <IAuthenticationDao>();

            stubDao.Stub(x => x.QueryPasswordById("Alex", "1234")).Return(dt);
            target.MyAuthenticationDao = stubDao;

            string id       = "Alex";
            string password = "******";

            VerifyStatus expected = VerifyStatus.Passed;
            VerifyStatus actual;

            //Act
            actual = target.VerifyPasswordById(id, password);

            //Assert
            Assert.AreEqual(expected, actual);
        }
 /// <summary>
 /// 更新一个待审文本状态
 /// </summary>
 /// <param name="_id">id</param>
 /// <param name="vs">更新状态枚举</param>
 /// <param name="admin_id">管理员id</param>
 /// <param name="text">修改后的文本</param>
 /// <returns></returns>
 public static CBB.ExceptionHelper.OperationResult UpdateFilterText(ObjectId _id, VerifyStatus vs, string admin_id,string text)
 {
     try{
         new Moooyo.BiZ.FilterText.FilterTextOperation().UpdateFilterText(_id, vs, admin_id, text);
         return new CBB.ExceptionHelper.OperationResult(true);
     }
     catch (Exception ex)
     {
         throw new CBB.ExceptionHelper.OperationException(
            CBB.ExceptionHelper.ErrType.SystemErr,
            CBB.ExceptionHelper.ErrNo.DBOperationError,
            ex);
     }
 }
Exemple #6
0
        public bool UpdateL2VerifyStatus(Guid id, VerifyStatus verifyStatus, string remark)
        {
            string SQL = "UPDATE MerchantProfiles SET L2VerifyStatus=@VerifyStatus,L2Remark=@Remark WHERE MerchantId=@MerchantId";

            using (var con = WriteConnection())
            {
                return(con.Execute(SQL, new
                {
                    MerchantId = id,
                    VerifyStatus = verifyStatus,
                    Remark = remark
                }) > 0);
            }
        }
Exemple #7
0
        /// <summary>
        /// 更新L2身份认证状态
        /// </summary>
        /// <param name="id"></param>
        /// <param name="verifyStatus"></param>
        /// <param name="remark"></param>
        /// <returns></returns>
        public bool UpdateL2Status(Guid id, VerifyStatus verifyStatus, string remark)
        {
            var result = false;
            var router = QueryKYCRouter(id);

            if (router == null)
            {
                throw new InvalidProfileServiceException();
            }

            var dac = new UserProfileRPC(router);

            result = dac.UpdateL2Status(id, (int)verifyStatus, remark);
            return(result);
        }
        private string GetImageCheckDetails(VerifyStatus status)
        {
            string result = string.Empty;

            if (status.Equals(VerifyStatus.Valid))
            {
                result = IMAGE_CHECK;
            }
            else
            if (status.Equals(VerifyStatus.Invalid))
            {
                result = IMAGE_NO_CHECK;
            }
            return(result);
        }
        internal bool UpdateL2VerifyStatus(Guid id, VerifyStatus verifyStatus, string remark)
        {
            var url = $"{baseAddress}/UpdateL2VerifyStatus";
            UpdateVerifyStatusIM im = new UpdateVerifyStatusIM()
            {
                Id = id, VerifyStatus = verifyStatus, Remark = remark
            };
            var result = RestUtilities.PostJson(url, headers, JsonConvert.SerializeObject(im));
            var data   = JsonConvert.DeserializeObject <ServiceResult <bool> >(result);

            if (data.Code == 0)
            {
                return(data.Data);
            }
            throw new CommonException(10000, data.Message);
        }
        public void VerifyPasswordByIdTest_Without_Data()
        {
            //Arrange

            AuthenticationService target = new AuthenticationService();

            target.MyAuthenticationDao = new mockDao();

            string id       = string.Empty;
            string password = string.Empty;

            VerifyStatus expected = VerifyStatus.NoExist;
            VerifyStatus actual;

            //Act
            actual = target.VerifyPasswordById(id, password);

            //Assert
            Assert.AreEqual(expected, actual);
        }
Exemple #11
0
        private static string setValueAt(string inputfield, int position, VerifyStatus status)
        {
            if (position > inputfield.Length)
            {
                return(inputfield);
            }

            if ((STATUS_FIELD_LEN - position) < 0 ||
                ((STATUS_FIELD_LEN - position) > STATUS_FIELD_LEN))
            {
                return(inputfield);
            }

            try
            {
                string strVal = ((int)status).ToString();
                char[] chars  = inputfield.ToCharArray();
                chars[STATUS_FIELD_LEN - position] = strVal.ToCharArray()[0];
                return(new string(chars));
            }
            catch { } // non loggo :(
            return(null);
        }
        public bool UpdateL2VerifyStatus(Guid id, VerifyStatus verifyStatus, string remark)
        {
            bool result = false;
            MerchantAccountDAC merchantAccountDAC = new MerchantAccountDAC();
            var merchantAccount = merchantAccountDAC.GetById(id);

            if (merchantAccount == null)
            {
                return(result);//查无此人
            }
            var router = ProfileFactory.GetByCountryId(merchantAccount.CountryId);

            if (router == null)
            {
                throw new InvalidProfileServiceException();
            }
            else
            {
                MerchantProfileRPC dac = new MerchantProfileRPC(router);
                result = dac.UpdateL2VerifyStatus(id, verifyStatus, remark);
            }
            return(result);
        }
 /// <summary>
 /// 返回总条数
 /// </summary>
 /// <param name="verifyStatus"></param>
 /// <returns></returns>
 public static long GetCount(VerifyStatus verifyStatus)
 {
     return new FilterTextOperation().GetCount(verifyStatus);
 }
Exemple #14
0
 /// <summary>
 /// 获取总记录数
 /// </summary>
 /// <param name="verifyStatus">类型枚举</param>
 /// <returns></returns>
 public long GetCount(VerifyStatus verifyStatus)
 {
     long count;
     try
     {
         MongoDatabase md = MongoDBHelper.MongoDB;
         MongoCollection<FilterTextModel> mc = md.GetCollection<FilterTextModel>("FilterText");
         count = mc.Count(Query.EQ("Verify_status", Convert.ToInt32(verifyStatus)));
         return count;
     }
     catch (System.Exception err)
     {
         throw new CBB.ExceptionHelper.OperationException(
             CBB.ExceptionHelper.ErrType.SystemErr,
             CBB.ExceptionHelper.ErrNo.DBOperationError,
             err);
     }
 }
Exemple #15
0
 /// <summary>
 /// 依据审核状态批量查询待审文本
 /// </summary>
 /// <param name="verifyStatus">待审状态枚举</param>
 /// <returns></returns>
 public List<FilterTextModel> GetFilterTexts(VerifyStatus verifyStatus, int pageno, int pagesize)
 {
     List<FilterTextModel> list = new List<FilterTextModel>();
     try
     {
         MongoCursor<FilterTextModel> mc = MongoDBHelper.GetCursor<FilterTextModel>(
         "FilterText",
         Query.EQ("Verify_status", Convert.ToInt32(verifyStatus)),
         new SortByDocument("Jion_time", -1),
         pageno,
         pagesize
         );
         List<FilterTextModel> objs = new List<FilterTextModel>();
         objs.AddRange(mc);
         return objs;
     }
     catch (Exception es)
     {
         throw new CBB.ExceptionHelper.OperationException(
            CBB.ExceptionHelper.ErrType.SystemErr,
            CBB.ExceptionHelper.ErrNo.DBOperationError,
            es);
     }
 }
 public VerifyResult(VerifyStatus status, SecondFactor[] factors)
 {
     Status  = status;
     Factors = factors;
 }
 public VerifyResult(VerifyStatus status) : this(status, new SecondFactor[0])
 {
 }
Exemple #18
0
        /// <summary>
        /// 修改单个待审文本的审核状态
        /// </summary>
        /// <param name="_id">id</param>
        /// <param name="Verify_status">待审状态枚举</param>
        /// <param name="text">修改后的文本(删除和通过的状态该值传"")</param>
        public void UpdateFilterText(ObjectId _id, VerifyStatus Verify_status, string Verify_id, string text)
        {
            try
            {
                if (Verify_status == VerifyStatus.waitaudit)
                    return;
                MongoDatabase md = MongoDBHelper.MongoDB;
                MongoCollection<FilterTextModel> mc = md.GetCollection<FilterTextModel>("FilterText");

                if (Verify_status == VerifyStatus.audimod && text.Trim() != "")
                {
                    mc.Update(Query.EQ("_id", _id),
                        Update.Set("Verify_status", Convert.ToInt32(Verify_status))
                        .Set("Verify_id", Verify_id)
                        .Set("Verify_time", DateTime.Now)
                     );
                    FilterTextModel ftm = GetFilterText(_id);
                    MongoCollection mc2 = md.GetCollection(ftm.Tablename);
                    QueryComplete qcl2 = Query.EQ("_id", ObjectId.Parse(ftm.Colid));
                    mc2.Update(qcl2, Update.Set(ftm.Colname, text));
                    UpdateContent(ftm, text);
                }
                else if (Verify_status == VerifyStatus.audidel)
                {
                    mc.Update(Query.EQ("_id", _id),
                        Update.Set("Verify_status", Convert.ToInt32(Verify_status))
                        .Set("Verify_id", Verify_id)
                        .Set("Verify_time", DateTime.Now)
                     );
                    FilterTextModel ftm = GetFilterText(_id);
                    MongoCollection mc2 = md.GetCollection(ftm.Tablename);
                    //删除原始表中的信息
                    //if (null == mc2)
                    //    return;
                    //QueryComplete qcl2 = Query.EQ("_id", ObjectId.Parse(ftm.Colid));
                    //mc.Remove(qcl2);
                    //修改原始表中的信息为“已经删除”
                    QueryComplete qcl2 = Query.EQ("_id", ObjectId.Parse(ftm.Colid));
                    mc2.Update(qcl2, Update.Set(ftm.Colname, msg));
                    UpdateContent(ftm, msg);
                }
                else if (Verify_status == VerifyStatus.auditpass)
                {
                    //mc.Update(Query.EQ("_id", _id),
                    //       Update.Set("Verify_status", Convert.ToInt32(Verify_status))
                    //       .Set("Verify_id", Verify_id)
                    //       .Set("Verify_time", DateTime.Now)
                    //    );
                    mc.Update(Query.EQ("_id", _id),
                        Update.Set("Verify_status", Convert.ToInt32(Verify_status))
                        .Set("Verify_id", Verify_id)
                        .Set("Verify_time", DateTime.Now)
                     );
                    FilterTextModel ftm = GetFilterText(_id);
                    MongoCollection mc2 = md.GetCollection(ftm.Tablename);
                    QueryComplete qcl2 = Query.EQ("_id", ObjectId.Parse(ftm.Colid));
                    mc2.Update(qcl2, Update.Set(ftm.Colname, text));
                    UpdateContent(ftm, text);
                }
                else
                {
                    return;
                }

            }
            catch (Exception es)
            {
                throw new CBB.ExceptionHelper.OperationException(
                   CBB.ExceptionHelper.ErrType.SystemErr,
                   CBB.ExceptionHelper.ErrNo.DBOperationError,
                   es);
            }
        }
Exemple #19
0
        /// <summary>
        /// 批量修改待审状态
        /// </summary>
        /// <param name="_id">处理id集合</param>
        /// <param name="verify_status">审核状态</param>
        /// <param name="Verify_id">审核人id</param>
        /// <param name="texts">修改后的文本,其他状态传Null</param>
        public void UpdateFilterTexts(List<ObjectId> _id, VerifyStatus verify_status, string Verify_id, List<string> texts)
        {
            if (_id.Count <= 0)
                return;
            try
            {
                MongoDatabase md = MongoDBHelper.MongoDB;
                MongoCollection<FilterTextModel> mc = md.GetCollection<FilterTextModel>("FilterText");
                if (verify_status == VerifyStatus.audidel)
                {

                    QueryConditionList qcl = Query.In("_id", new BsonArray(_id.ToArray()));
                    mc.Update(qcl, Update.Set("Verify_status", Convert.ToInt32(verify_status)).Set("Verify_id", Verify_id).Set("Verify_time", DateTime.Now), UpdateFlags.Multi);
                    ////逐行删除
                    //foreach (ObjectId id in _id)
                    //{
                    //    FilterTextModel ftm = GetFilterText(id);
                    //    MongoCollection mc2 = md.GetCollection(ftm.Tablename);
                    //    QueryComplete qcl2 = Query.EQ("_id", ObjectId.Parse(ftm.Colid));
                    //    mc2.Remove(qcl2);
                    //}
                    //删除时替换成“已经删除”
                    for (int i = 0; i < _id.Count; i++)
                    {

                        FilterTextModel ftm = GetFilterText(_id[i]);
                        MongoCollection mc2 = md.GetCollection(ftm.Tablename);
                        if (null == mc2)
                            return;
                        QueryComplete qcl2 = Query.EQ("_id", ObjectId.Parse(ftm.Colid));
                        mc2.Update(qcl2, Update.Set(ftm.Colname, msg));
                        UpdateContent(ftm, msg);
                    }

                }
                else if (verify_status == VerifyStatus.auditpass) //通过
                {
                    if (texts.Count <= 0)
                        return;
                    QueryConditionList qcl = Query.In("_id", new BsonArray(_id.ToArray()));
                    mc.Update(qcl, Update.Set("Verify_status", Convert.ToInt32(verify_status)).Set("Verify_id", Verify_id).Set("Verify_time", DateTime.Now), UpdateFlags.Multi);
                    //逐行修改
                    for (int i = 0; i < _id.Count; i++)
                    {

                        FilterTextModel ftm = GetFilterText(_id[i]);
                        MongoCollection mc2 = md.GetCollection(ftm.Tablename);
                        if (null == mc2)
                            return;
                        QueryComplete qcl2 = Query.EQ("_id", ObjectId.Parse(ftm.Colid));
                        mc2.Update(qcl2, Update.Set(ftm.Colname, texts[i]));
                        UpdateContent(ftm, texts[i]);
                    }
                }
                else if (verify_status == VerifyStatus.audimod) //修改
                {
                    if (texts.Count <= 0)
                        return;
                    QueryConditionList qcl = Query.In("_id", new BsonArray(_id.ToArray()));
                    mc.Update(qcl, Update.Set("Verify_status", Convert.ToInt32(verify_status)).Set("Verify_id", Verify_id).Set("Verify_time", DateTime.Now), UpdateFlags.Multi);
                    //逐行修改
                    for (int i = 0; i < _id.Count; i++)
                    {

                        FilterTextModel ftm = GetFilterText(_id[i]);
                        MongoCollection mc2 = md.GetCollection(ftm.Tablename);
                        if (null == mc2)
                            return;
                        QueryComplete qcl2 = Query.EQ("_id", ObjectId.Parse(ftm.Colid));
                        mc2.Update(qcl2, Update.Set(ftm.Colname, texts[i]));
                        UpdateContent(ftm, texts[i]);
                    }
                }
                else
                {
                    return;
                }

            }
            catch (Exception es)
            {
                throw new CBB.ExceptionHelper.OperationException(
                   CBB.ExceptionHelper.ErrType.SystemErr,
                   CBB.ExceptionHelper.ErrNo.DBOperationError,
                   es);
            }
        }
 /// <summary>
 /// 新增一条审核记录
 /// 此处应 新增一条审核记录 同时 修改 Question表中相应记录的 VerifyTimes 记录
 /// 故 此处采用 事务处理
 /// </summary>
 /// <param name="v">insert VerifyStatus</param>
 /// <param name="q">updata Question</param>
 /// <returns>新增的审核记录的VerifyStatusId</returns>
 public bool Add(VerifyStatus v, Question q)
 {
     return(dal.Add(v, q));
 }