Exemplo n.º 1
0
        /// <summary>
        /// ������֤��״̬
        /// </summary>
        /// <param name="item">��֤����</param>
        /// <param name="value">���÷�</param>
        public void SetValidateCodeIsEnabled(ValidateCodeItem item, bool isEnabled)
        {
            string strFlag = "";
            string value = isEnabled ? "1" : "0";

            if (item == ValidateCodeItem.Register) strFlag = "register";

            if (item == ValidateCodeItem.Login) strFlag = "login";

            if (item == ValidateCodeItem.Comment) strFlag = "comment";

            if (item == ValidateCodeItem.Message) strFlag = "message";

            if (item == ValidateCodeItem.MakeTheOrder) strFlag = "order";

            if (item == ValidateCodeItem.QuickPost) strFlag = "quickpost";

            validateCodeItem = System.Text.RegularExpressions.Regex.Replace(validateCodeItem, strFlag + ",(0|1)", strFlag + "," + value);
        }
Exemplo n.º 2
0
        /// <summary>
        /// �Ƿ�������֤��
        /// </summary>
        /// <param name="item">��֤�������</param>
        /// <returns></returns>
        public bool IsEnabledValidateCode(ValidateCodeItem item)
        {
            string strFlag = "";

            if (item == ValidateCodeItem.Register) strFlag = "register";

            if (item == ValidateCodeItem.Login) strFlag = "login";

            if (item == ValidateCodeItem.Comment) strFlag = "comment";

            if (item == ValidateCodeItem.Message) strFlag = "message";

            if (item == ValidateCodeItem.MakeTheOrder) strFlag = "order";

            if (item == ValidateCodeItem.QuickPost) strFlag = "quickpost";

            string str = Regex.Match(validateCodeItem, strFlag + ",[(0,1)]").Groups[0].ToString();

            if (str.Equals("")) return false;

            try
            {
                if (str.Split(',')[1].ToString().Equals("1"))
                    return true;
            }
            catch { }

            return false;
        }