public ContractController(IMediator mediator, IDataRepositorySoftDeleteInt <Contract> repository, ILogger logger
                                  , IDataRepositorySoftDeleteInt <Company> parentRepository
                                  , IDataRepositorySoftDeleteInt <Lookup> lookupRepository
                                  , IConfigBase <int, ContractExpiresSoonCountDownConfig> contractExpiresSoonCountDownConfig)
            : base(mediator, repository, parentRepository, logger)
        {
            contractExpiresSoonCountDown = contractExpiresSoonCountDownConfig.Value;

            this.lookupRepository = lookupRepository;
        }
예제 #2
0
        public static IWorkingContext GetUIWorkingContext(this ICoreObject lifelistNode)
        {
            OnlineObjectService OnlineObjectService = lifelistNode.GetOnlineObjectService();
            IConfigBase         onlineProject       = OnlineObjectService.CreateOnlineProject();
            var PersistenceWorkingContext           = onlineProject.CoreObject.GetWorkingContext();

            var applicationWorkingContext = TiaStarter.m_ViewApplicationContext;
            UIContextCreator creator      = new UIContextCreator(PersistenceWorkingContext, applicationWorkingContext);
            IWorkingContext  context      = creator.PersistenceUIContext;

            return(context);
        }
예제 #3
0
 public DuplicateContractAsyncEngine(IDataRepositorySoftDeleteInt <Contract> dataRepository, IConfigBase <string, MainDbConnectionString> tenderSearchConnectionString)
 {
     this.dataRepository = dataRepository;
     this.tenderSearchConnectionString = tenderSearchConnectionString;
 }
예제 #4
0
        public static IDictionary TestCommonToObject(Stream stream, System.Type configType,
                                                     System.Type dictType, bool isLoadAll     = false,
                                                     UnityEngine.MonoBehaviour loadAllCortine = null, int maxAsyncReadCnt = 500)
        {
            if (stream == null || configType == null || dictType == null)
            {
                return(null);
            }

            ConfigFileHeader header = new ConfigFileHeader();

            if (!header.LoadFromStream(stream) || !header.IsVaild)
            {
                return(null);
            }

            // 读取索引
            stream.Seek(header.indexOffset, SeekOrigin.Begin);
            // 读取类型(之前已经获取到了)
            ConfigValueType valueType = (ConfigValueType)stream.ReadByte();

            IDictionary maps = null;

            switch (valueType)
            {
            case ConfigValueType.cvObject: {
                for (uint i = 0; i < header.Count; ++i)
                {
                    IConfigBase config = Activator.CreateInstance(configType) as IConfigBase;
                    config.stream = stream;
                    System.Object key = config.ReadKEY();
                    config.dataOffset = FilePathMgr.Instance.ReadLong(stream);
                    if (maps == null)
                    {
                        maps = Activator.CreateInstance(dictType) as IDictionary;
                    }
                    maps[key] = config;
                }
                break;
            }

            case ConfigValueType.cvList: {
                var vsType = typeof(List <>).MakeGenericType(configType);
                for (uint i = 0; i < header.Count; ++i)
                {
                    IConfigBase config = Activator.CreateInstance(configType) as IConfigBase;
                    config.stream = stream;
                    System.Object key        = config.ReadKEY();
                    long          dataOffset = FilePathMgr.Instance.ReadLong(stream);
                    config.dataOffset = dataOffset;
                    int listCnt = FilePathMgr.Instance.ReadInt(stream);
                    if (maps == null)
                    {
                        maps = Activator.CreateInstance(dictType) as IDictionary;
                    }
                    IList list = Activator.CreateInstance(vsType) as IList;
                    maps[key] = list;
                    list.Add(config);
                    for (int j = 1; j < listCnt; ++j)
                    {
                        config            = Activator.CreateInstance(configType) as IConfigBase;
                        config.stream     = stream;
                        config.dataOffset = dataOffset;
                        list.Add(config);
                    }
                }
                break;
            }

            // 有问题
            case ConfigValueType.cvMap: {
                Type[] vTypes = dictType.GetInterfaces();
                if (vTypes == null || vTypes.Length < 2)
                {
                    return(null);
                }
                Type k1 = vTypes[0];
                if (k1 == null)
                {
                    return(null);
                }

                Type vType = vTypes[1];
                if (vType == null)
                {
                    return(null);
                }

                if (!vType.IsSubclassOf(typeof(IDictionary)))
                {
                    return(null);
                }

                Type[] subTypes = vType.GetInterfaces();
                if (subTypes == null || subTypes.Length < 2)
                {
                    return(null);
                }

                Type k2 = subTypes[0];
                Type v  = subTypes[1];
                if (k2 == null || v == null)
                {
                    return(null);
                }

                var subDictType = typeof(Dictionary <System.Object, System.Object>).MakeGenericType(k2, v);
                if (subDictType == null)
                {
                    return(null);
                }

                for (uint i = 0; i < header.Count; ++i)
                {
                }

                break;
            }

            default:
                return(null);
            }

            if (isLoadAll && maps != null && maps.Count > 0)
            {
                StartLoadAllCortine(maps, loadAllCortine, valueType, null, maxAsyncReadCnt);
            }

            return(maps);
        }
예제 #5
0
        private static IEnumerator StartLoadCortine(IDictionary maps,
                                                    ConfigValueType valueType, Action <float> onProcess, int maxAsyncReadCnt)
        {
            if (maps == null || maps.Count <= 0)
            {
                yield break;
            }

            int curCnt = 0;
            int idx    = 0;

            if (valueType == ConfigValueType.cvObject)
            {
                var iter = maps.GetEnumerator();
                while (iter.MoveNext())
                {
                    IConfigBase config = iter.Value as IConfigBase;
                    if (!config.StreamSeek())
                    {
                        continue;
                    }
                    config.ReadValue();

                    if (onProcess != null)
                    {
                        ++idx;
                        float process = 0.5f + (float)idx / (float)maps.Count;
                        onProcess(process);
                    }

                    ++curCnt;
                    if (curCnt >= maxAsyncReadCnt)
                    {
                        curCnt = 0;
                        InitEndFrame();
                        yield return(m_EndFrame);
                    }
                }
                iter.DisposeIter();
            }
            else if (valueType == ConfigValueType.cvList)
            {
                var iter = maps.GetEnumerator();
                while (iter.MoveNext())
                {
                    IList       vs = iter.Value as IList;
                    IConfigBase v  = vs [0] as IConfigBase;
                    if (!v.StreamSeek())
                    {
                        continue;
                    }
                    for (int i = 0; i < vs.Count; ++i)
                    {
                        v = vs[i] as IConfigBase;
                        v.ReadValue();

                        ++curCnt;
                        if (curCnt >= maxAsyncReadCnt)
                        {
                            curCnt = 0;
                            InitEndFrame();
                            yield return(m_EndFrame);
                        }
                    }

                    if (onProcess != null)
                    {
                        ++idx;
                        float process = 0.5f + (float)idx / (float)maps.Count;
                        onProcess(process);
                    }
                }
                iter.DisposeIter();
            }
            else if (valueType == ConfigValueType.cvMap)
            {
                // 字典类型
                var iter = maps.GetEnumerator();
                while (iter.MoveNext())
                {
                    IDictionary map     = iter.Value as IDictionary;
                    var         subIter = map.GetEnumerator();
                    if (subIter.MoveNext())
                    {
                        IConfigBase v = subIter.Value as IConfigBase;
                        if (!v.StreamSeek())
                        {
                            continue;
                        }
                        v.ReadValue();
                        while (subIter.MoveNext())
                        {
                            v = subIter.Value as IConfigBase;
                            v.ReadValue();

                            ++curCnt;
                            if (curCnt >= maxAsyncReadCnt)
                            {
                                curCnt = 0;
                                InitEndFrame();
                                yield return(m_EndFrame);
                            }
                        }
                    }
                    subIter.DisposeIter();

                    if (onProcess != null)
                    {
                        ++idx;
                        float process = 0.5f + (float)idx / (float)maps.Count;
                        onProcess(process);
                    }
                }
                iter.DisposeIter();
            }
        }
예제 #6
0
        private static UnityEngine.Coroutine StartLoadAllCortine(IDictionary maps,
                                                                 UnityEngine.MonoBehaviour parent, ConfigValueType valueType, Action <float> onProcess, int maxAsyncReadCnt)
        {
            if (maps == null || maps.Count <= 0)
            {
                return(null);
            }
            if (parent != null)
            {
                return(parent.StartCoroutine(StartLoadCortine(maps, valueType, onProcess, maxAsyncReadCnt)));
            }
            else
            {
                if (valueType == ConfigValueType.cvObject)
                {
                    var iter = maps.GetEnumerator();
                    while (iter.MoveNext())
                    {
                        IConfigBase config = iter.Value as IConfigBase;
                        Stream      stream = config.stream;
                        if (stream == null)
                        {
                            continue;
                        }
                        stream.Seek(config.dataOffset, SeekOrigin.Begin);
                        config.ReadValue();
                    }
                    iter.DisposeIter();
                }
                else if (valueType == ConfigValueType.cvList)
                {
                    var iter = maps.GetEnumerator();
                    while (iter.MoveNext())
                    {
                        IList       vs     = iter.Value as IList;
                        IConfigBase v      = vs[0] as IConfigBase;
                        Stream      stream = v.stream;
                        if (stream == null)
                        {
                            continue;
                        }
                        stream.Seek(v.dataOffset, SeekOrigin.Begin);
                        for (int i = 0; i < vs.Count; ++i)
                        {
                            v = vs[i] as IConfigBase;
                            v.ReadValue();
                        }
                    }
                    iter.DisposeIter();
                }
                else if (valueType == ConfigValueType.cvMap)
                {
                    // 字典类型
                    var iter = maps.GetEnumerator();
                    while (iter.MoveNext())
                    {
                        IDictionary map     = iter.Value as IDictionary;
                        var         subIter = map.GetEnumerator();
                        if (subIter.MoveNext())
                        {
                            IConfigBase v = subIter.Value as IConfigBase;
                            if (!v.StreamSeek())
                            {
                                continue;
                            }
                            v.ReadValue();
                            while (subIter.MoveNext())
                            {
                                v = subIter.Value as IConfigBase;
                                v.ReadValue();
                            }
                        }
                        subIter.DisposeIter();
                    }
                    iter.DisposeIter();
                }
            }

            return(null);
        }
예제 #7
0
        internal static bool ToStream(Stream stream, System.Collections.IDictionary values)
        {
            if (stream == null || values == null || values.Count <= 0)
            {
                return(false);
            }

            ConfigFileHeader header = new ConfigFileHeader((uint)values.Count, 0);

            header.SaveToStream(stream);

            var             iter      = values.GetEnumerator();
            ConfigValueType valueType = ConfigValueType.cvObject;

            while (iter.MoveNext())
            {
                IList       vs     = iter.Value as IList;
                IDictionary subMap = iter.Value as IDictionary;
                if (vs != null)
                {
                    // 说明是List
                    valueType = ConfigValueType.cvList;
                    long dataOffset = stream.Position;
                    for (int i = 0; i < vs.Count; ++i)
                    {
                        IConfigBase v = vs[i] as IConfigBase;
                        v.stream     = stream;
                        v.dataOffset = dataOffset;
                        v.WriteValue();
                    }
                }
                else if (subMap != null)
                {
                    // 字典类型
                    valueType = ConfigValueType.cvMap;
                    long dataOffset = stream.Position;
                    var  subIter    = subMap.GetEnumerator();
                    while (subIter.MoveNext())
                    {
                        IConfigBase v = subIter.Value as IConfigBase;
                        v.stream     = stream;
                        v.dataOffset = dataOffset;
                        v.WriteValue();
                    }
                    subIter.DisposeIter();
                }
                else
                {
                    // 普通对象类型
                    valueType = ConfigValueType.cvObject;
                    IConfigBase v = iter.Value as IConfigBase;
                    v.stream     = stream;
                    v.dataOffset = stream.Position;
                    v.WriteValue();
                }
            }
            iter.DisposeIter();

            long indexOffset = stream.Position;

            stream.WriteByte((byte)valueType);

            if (valueType == ConfigValueType.cvList)
            {
                iter = values.GetEnumerator();
                while (iter.MoveNext())
                {
                    System.Object key = iter.Key;
                    IList         vs  = iter.Value as IList;
                    if (vs != null)
                    {
                        IConfigBase v = vs[0] as IConfigBase;
                        v.WriteKey(key);
                        // 偏移
                        FilePathMgr.Instance.WriteLong(stream, v.dataOffset);
                        // 数量
                        FilePathMgr.Instance.WriteInt(stream, vs.Count);
                    }
                }
                iter.DisposeIter();
            }
            else if (valueType == ConfigValueType.cvMap)
            {
                // 字典类型
                iter = values.GetEnumerator();
                while (iter.MoveNext())
                {
                    System.Object key = iter.Key;
                    IDictionary   vs  = iter.Value as IDictionary;
                    if (vs != null)
                    {
                        var subIter = vs.GetEnumerator();
                        // 取出第一个
                        if (subIter.MoveNext())
                        {
                            IConfigBase v = subIter.Value as IConfigBase;
                            FilePathMgr.Instance.WriteObject(stream, key, v.GetKeyType());
                            // 偏移
                            FilePathMgr.Instance.WriteLong(stream, v.dataOffset);
                            // 数量
                            FilePathMgr.Instance.WriteInt(stream, vs.Count);

                            System.Object key2 = subIter.Key;
                            v.WriteKey(key2);
                            while (subIter.MoveNext())
                            {
                                key2 = subIter.Key;
                                v.WriteKey(key2);
                            }
                        }
                        subIter.DisposeIter();
                    }
                }
                iter.DisposeIter();
            }
            else if (valueType == ConfigValueType.cvObject)
            {
                iter = values.GetEnumerator();
                while (iter.MoveNext())
                {
                    System.Object key = iter.Key;
                    IConfigBase   v   = iter.Value as IConfigBase;
                    v.WriteKey(key);
                    FilePathMgr.Instance.WriteLong(stream, v.dataOffset);
                }
                iter.DisposeIter();
            }

            // 重写Header
            header.indexOffset = indexOffset;
            header.SeekFileToHeader(stream);
            header.SaveToStream(stream);

            return(true);
        }
 public IntegrationTestDbMigrator(IConfigBase <string, MainDbConnectionString> mainDbConnectionString)
     : base(mainDbConnectionString.Value)
 {
 }
예제 #9
0
 public void SetConfig(IConfigBase config)
 {
     this.config = config;
 }