示例#1
0
        public void syncwelFareStore()
        {
            var interfaceName      = "syncwelFareStore";
            var loggingSessionInfo = BaseService.GetLoggingSession();
            var storeService       = new StoreBLL(loggingSessionInfo);

            var dsStores = new DataSet();
            var stores   = new StoreList();

            stores.storelist = new List <Store>();

            //更新接口同步表
            var queryList = UpdateInterfaceTimestamp(interfaceName, loggingSessionInfo);

            if (queryList != null && queryList.Length > 0)
            {
                //存在,根据日期条件查询
                dsStores = storeService.GetSynWelfareStoreList(queryList.FirstOrDefault().LatestTime.ToString());
            }
            else
            {
                //不存在,查询所有数据
                dsStores = storeService.GetSynWelfareStoreList(string.Empty);
            }

            if (dsStores != null && dsStores.Tables.Count > 0 && dsStores.Tables[0].Rows.Count > 0)
            {
                stores.storelist = DataTableToObject.ConvertToList <Store>(dsStores.Tables[0]);

                //上传数据
                var content = stores.ToJSON();
                var result  = UploadData(interfaceName, stores.ToJSON());

                //写入接口日志
                var logEntity = new ZInterfaceLogEntity()
                {
                    LogId         = Utils.NewGuid(),
                    InterfaceName = interfaceName,
                    Params        = content,
                    ResultCode    = result.code,
                    ResultDesc    = result.description
                };

                InsertInterfaceLog(logEntity, loggingSessionInfo);
            }
        }
示例#2
0
        public override bool CreateCollection(string name, StoreList columns)
        {
            if (CollectionExists(name))
            {
                return(false);
            }
            AddCollection(name);
            string columnsJSON = columns.ToJSON().ToString();

            Set("collections." + name, "[]");
            Set("meta.collections." + name, columnsJSON);
            return(true);
        }
示例#3
0
        public override IEnumerable <StoreDictionary> Get(string collection, StoreList columns, StoreDictionary where, int limit)
        {
            string columnsJSON  = columns.ToJSON().ToString();
            string whereJSON    = where != null ? where.ToJSON().ToString() : "";
            string recordsJSON  = native.CallStatic <string>("get", collection, columnsJSON, whereJSON, limit < 0 ? null : limit + "");
            JSON   recordsArray = JSON.Parse(recordsJSON);

            StoreDictionary[] records = new StoreDictionary[recordsArray.length];
            for (int i = 0; i < records.Length; i++)
            {
                records[i] = new StoreDictionary(recordsArray[i]);
            }
            return(records);
        }
示例#4
0
        public override IEnumerable <StoreDictionary> Get(string collection, StoreList columns, StoreDictionary where, int limit)
        {
            string columnsJSON = columns.ToJSON().ToString();
            string whereJSON   = where != null ? where.ToJSON().ToString() : "";

            System.IntPtr pointer     = iosStore_get(collection, columnsJSON, whereJSON, limit < 0 ? "" : limit + "");
            string        recordsJSON = Marshal.PtrToStringAnsi(pointer);

            Marshal.FreeHGlobal(pointer);
            JSON recordsArray = JSON.Parse(recordsJSON);

            StoreDictionary[] records = new StoreDictionary[recordsArray.length];
            for (int i = 0; i < records.Length; i++)
            {
                records[i] = new StoreDictionary(recordsArray[i]);
            }
            return(records);
        }
示例#5
0
        public override bool CreateCollection(string name, StoreList columns)
        {
            string columnsJSON = columns.ToJSON().ToString();

            return(native.CallStatic <bool>("createCollection", name, columnsJSON));
        }
示例#6
0
        public override bool CreateCollection(string name, StoreList columns)
        {
            string columnsJSON = columns.ToJSON().ToString();

            return(iosStore_createCollection(name, columnsJSON));
        }