Exemplo n.º 1
0
        private static StatusCode reconcileDataB <T, EType>(System.Collections.IDictionary dictA, System.Collections.IDictionary dictB, Models.ReconcileResult <T, EType> result, string strPrefix)
            where T : Models.BaseItemRecord, new()
            where EType : struct
        {
            StatusCode retVal = StatusCode.SUCCEED_STATUS;
            string     strKey = null;

            foreach (object key in dictB.Keys)
            {
                string strItem = null;
                if (key.GetType().IsEnum)
                {
                    strItem = EnumAccess.GetEnumValueDescription(key);
                }
                else
                {
                    strItem = key.ToString();
                }
                strKey = strPrefix;
                object valB = dictB[key];
                if (strKey == null)
                {
                    strKey = strItem;
                }
                else
                {
                    strKey += ":" + strItem;
                }

                if (dictA.Contains(key) == false)
                {
                    T item = new T();
                    result.Add(strKey, default(EType), null, item, null);
                    continue;
                }
                object valA = dictA[key];
                if (valB is System.Collections.IDictionary)
                {
                    System.Collections.IDictionary colA = (System.Collections.IDictionary)valA;
                    System.Collections.IDictionary colB = (System.Collections.IDictionary)valB;

                    retVal = reconcileDataB <T, EType>(colA, colB, result, strKey);
                    if (retVal.IsSucceeded == false)
                    {
                        return(retVal);
                    }
                }
            }

            return(retVal);
        }
Exemplo n.º 2
0
 public MarketDateAccess(SupportMarket market)
 {
     Market = EnumAccess.GetEnumValueDescription(market);
     init();
 }
Exemplo n.º 3
0
        private static StatusCode reconcileDataA <T, EType>(System.Collections.IDictionary dictA, System.Collections.IDictionary dictB, Models.ReconcileResult <T, EType> result, string strPrefix, int[] customFields)
            where T : Models.BaseItemRecord, new()
            where EType : struct
        {
            StatusCode retVal = StatusCode.SUCCEED_STATUS;
            string     strKey = null;

            foreach (object key in dictA.Keys)
            {
                string strItem = null;
                if (key.GetType().IsEnum)
                {
                    strItem = EnumAccess.GetEnumValueDescription(key);
                }
                else
                {
                    strItem = key.ToString();
                }
                strKey = strPrefix;
                object valA = dictA[key];
                if (strKey == null)
                {
                    strKey = strItem;
                }
                else
                {
                    strKey += ":" + strItem;
                }

                if (dictB.Contains(key) == false)
                {
                    T item = new T();
                    result.Add(strKey, default(EType), item, null, null);
                    continue;
                }
                object valB = dictB[key];
                if (valA is System.Collections.IDictionary colA)
                {
                    System.Collections.IDictionary colB = (System.Collections.IDictionary)valB;

                    retVal = reconcileDataA <T, EType>(colA, colB, result, strKey, customFields);
                    if (retVal.IsSucceeded == false)
                    {
                        return(retVal);
                    }
                }
                else if (valA is T tA)
                {
                    T tB = (T)valB;
                    if (customFields != null)
                    {
                        foreach (int fld in customFields)
                        {
                            if (tA[fld].Equals(tB[fld]) == false)
                            {
                                result.Add(strKey, (EType)((object)fld), tA, tB, null);
                            }
                        }
                    }
                    else
                    {
                        foreach (int fld in tA.Fields)
                        {
                            if (tA[fld].Equals(tB[fld]) == false)
                            {
                                result.Add(strKey, (EType)((object)fld), tA, tB, null);
                            }
                        }
                    }
                }
                else
                {
                    //Throw Exception
                }
            }

            return(retVal);
        }