Example #1
0
        public static int addSignupUserItem(ref SignupUserItem item)
        {
            item.Name   = item.Name.Replace(" ", "").Trim();
            item.CardID = item.CardID.Replace(" ", "").Trim();
            item.Mobile = item.Mobile.Replace(" ", "").Trim();
            if (item.Name.Length == 0 || item.CardID.Length == 0 || item.Mobile.Length == 0)
            {
                throw new Exception("请填写您的姓名、身份证号码和手机号码!");
            }
            else if (item.CardID.Length > 0 && !Regex.Match(item.CardID, @"^\d{17}(\d|X)$", RegexOptions.IgnoreCase).Success)
            {
                throw new Exception("身份证号码格式不正确,请检查是否有误!");
            }
            else if (item.Mobile.Length > 0 && !Regex.Match(item.Mobile, @"^\d{11}$").Success)
            {
                throw new Exception("手机号码格式不正确,请检查是否有误!");
            }

            List <AnswerItem>   answers = item.Answers;
            List <QuestionItem> ques;

            DbSelect.getQuestionList(out ques, null);
            if (!ques.TrueForAll((QuestionItem q) => answers.Exists((AnswerItem ans) => ans.Question.ID == q.ID)))
            {
                throw new Exception("请确认是否已回答所有问题!");
            }

            List <SignupUserItem>         list;
            Dictionary <String, String[]> conditions = new Dictionary <String, String[]>();

            conditions.Add("Name", new String[] { new Operator(OperatorTypeEnum.Equal), item.Name });
            conditions.Add("CardID", new String[] { new Operator(OperatorTypeEnum.Equal), item.CardID });
            conditions.Add("Mobile", new String[] { new Operator(OperatorTypeEnum.Equal), item.Mobile });
            int ret = DbSelect.getSignupList(out list, conditions);

            if (ret != OK)
            {
                return(FAILED);
            }
            if (list.Count == 0)  // 无匹配用户
            {
                throw new Exception("考生信息不符,无法查询!");
            }
            else
            {
                item         = list[0];
                item.Answers = answers;
                if (list[0].SignupSequence.Length != 0) // 已签到
                {
                    return(CANCELLED);
                }
            }
            return(DbEdit.updateSignupUserItem(ref item));
        }
Example #2
0
 public static int deleteAllSignupUserItems()
 {
     return(DbEdit.deleteAllSignupUserItems());
 }
Example #3
0
 public static int recoverAllSignupUserItems()
 {
     return(DbEdit.recoverAllSignupUserItems());
 }
Example #4
0
 public static int deleteSignupUserItem(int ID)
 {
     return(DbEdit.deleteSignupUserItem(ID));
 }
Example #5
0
 public static int recoverSignupUserItem(int ID)
 {
     return(DbEdit.recoverSignupUserItem(ID));
 }