duheng
2024-05-22 f0aaa59c3bb1ef75affcacadbcc8fae21149f52c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
 
namespace IStation.Bimface
{
    /// <summary>
    /// 返回结果辅助类
    /// </summary>
    internal class ResultHelper
    {
        //结果与描述的对应关系字典
        private static Dictionary<string, string> _dic = new Dictionary<string, string>() {
            {"system.error","BIMFACE系统异常"},
            {"authentication.failed","API访问合法性校验失败"},
            {"file.has.not.translated","文件未转换,不能获取viewToken"},
            {"file.translate.failed","文件转换失败,不能获取viewToken"},
            {"file.is.translating","文件转换中,不能获取viewToken"},
            {"integration.not.found","集成模型不存在,不能获取viewToken"},
            {"files.is.integrating","集成中,不能获取viewToken"},
            {"files.integrate.failed","集成失败,不能获取viewToken"},
            {"model.compare.not.found","对比模型不存在,不能获取viewToken"},
            {"model.compare.not.finished","对比未完成,不能获取viewToken"},
            {"model.compare.failed","对比失败,不能获取viewToken"},
            {"file.not.found","文件不存在"},
            {"success","成功"}
        };
 
        /// <summary>
        /// 获取枚举描述
        /// </summary>
        /// <param name="Code"></param>
        /// <returns></returns>
        internal static string GetResultDescription(string Code)
        {
            if (_dic.ContainsKey(Code))
                return _dic[Code];
            return null;
        }
 
        /// <summary>
        /// 获取结果枚举项
        /// </summary>
        /// <param name="Code"></param>
        /// <returns></returns>
        internal static eResultCode GetResultCode(string Code)
        {
            switch (Code)
            {
                case "system.error": return eResultCode.SystemError;
                case "authentication.failed": return eResultCode.AuthenticationFailed;
                case "file.has.not.translated": return eResultCode.FileHasNotTranslated;
                case "file.translate.failed": return eResultCode.FileTranslateFailed;
                case "file.is.translating": return eResultCode.FileIsTranslating;
                case "integration.not.found": return eResultCode.IntegrationNotFound;
                case "files.is.integrating": return eResultCode.FileIsIntegrating;
                case "files.integrate.failed": return eResultCode.FilesIntegrateFailed;
                case "model.compare.not.found": return eResultCode.ModelCompareNotFound;
                case "model.compare.not.finished": return eResultCode.ModelCompareNotFinished;
                case "model.compare.failed": return eResultCode.ModelCompareFailed;
                case "file.not.found": return eResultCode.FileNotFound;
                case "success": return eResultCode.Success;
                default: return eResultCode.UnKnown;
            }
        }
 
 
    }
}