Пример #1
0
        public void EndApply(string sender, ApplyResponse response)
        {
            try
            {
                if (!Cache.TryGetValue(sender, out KXTUserAppliesFile file))
                {
                    file = new KXTUserAppliesFile
                           (
                        RootPath + "\\" + sender + ".json"
                           );
                    Cache.TryAdd(sender, file);
                }

                if ("" == response.TargetID)
                {
                    file.EndApply(response.ApplierID);
                }
                else
                {
                    file.EndApply(response.ApplierID, response.TargetID);
                }

                file.Flush();
            }
            catch
            {
                Notify(LogLevel.Warning, "用户申请数据操作异常:文件异常");
            }
        }
Пример #2
0
        public void AddApply(Guid sender, string target, ApplyRequest request)
        {
            try
            {
                if (!Cache.TryGetValue(target, out KXTUserAppliesFile file))
                {
                    file = new KXTUserAppliesFile
                           (
                        RootPath + "\\" + target + ".json"
                           );
                    Cache.TryAdd(target, file);
                }

                file.AddApply(sender, request);

                file.Flush();
            }
            catch
            {
                Notify(LogLevel.Warning, "用户申请数据操作异常:文件异常");
            }
        }
Пример #3
0
        public KXTUserAppliesPackage[] ReadApplies(string user_id)
        {
            try
            {
                if (!Cache.TryGetValue(user_id, out KXTUserAppliesFile file))
                {
                    file = new KXTUserAppliesFile
                           (
                        RootPath + "\\" + user_id + ".json"
                           );
                    Cache.TryAdd(user_id, file);
                }

                file.Read(out KXTUserAppliesPackage[] applies);

                return(applies);
            }
            catch
            {
                Notify(LogLevel.Warning, "用户申请数据操作异常:文件异常");
                return(new KXTUserAppliesPackage[0]);
            }
        }