Exemplo n.º 1
0
        public async Task <string> GetStudentCode()
        {
            var cacheString = CacheFactory.Cache.GetCache <string>(CacheCodeKey);

            if (cacheString == null)
            {
                var result = await studentInfoService.GetCodeTop(DateTime.Now.ToString("yyyyMM"));

                string code = "";
                if (result == null || string.IsNullOrEmpty(result.Code))
                {
                    code = DateTime.Now.ToString("yyyyMM") + "0001";
                }
                else
                {
                    code = (double.Parse(result.Code) + 1).ToString();
                }
                CacheFactory.Cache.SetCache(CacheCodeKey, code);
                return(code);
            }
            else
            {
                cacheString = (double.Parse(cacheString) + 1).ToString();
                CacheFactory.Cache.SetCache(CacheCodeKey, cacheString);
                return(cacheString);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 获取最新一条数据
        /// </summary>
        /// <returns></returns>
        public async Task <TData <StudentInfoEntity> > GetCodeTop(string code)
        {
            TData <StudentInfoEntity> obj = new TData <StudentInfoEntity>();

            obj.Result = await studentInfoService.GetCodeTop(code);

            if (obj.Result != null)
            {
                obj.Tag = 1;
            }
            return(obj);
        }