Пример #1
0
        /// <summary>
        /// Dictionary 非空验证
        /// </summary>
        /// <param name="list"></param>
        /// <returns></returns>
        public JsonResult NotEmptyVerify(Dictionary <string, string> list)
        {
            try
            {
                //无参数验证
                if (list == null || list.Count < 1)
                {
                    return(JsonResult.FailResult(MsgShowConfig.ObjectIsEmpty));
                }

                foreach (KeyValuePair <string, string> pair in list)
                {
                    if (String.IsNullOrEmpty(pair.Value))
                    {
                        return(JsonResult.FailResult(pair.Key + MsgShowConfig.NoEmpty));
                    }
                }
                return(JsonResult.SuccessResult(MsgShowConfig.Success));
            }
            catch (Exception ex)
            {
                throw new Exception(ex.ToString());
            }
        }