Ejemplo n.º 1
0
        public int CompareTo(Rectangle3D other)
        {
            if (other == null)
            {
                return(1);
            }
            var result = Bottom.CompareTo(other.Bottom);

            if (result == 0)
            {
                result = Left.CompareTo(other.Left);
            }
            if (result == 0)
            {
                result = Near.CompareTo(other.Near);
            }
            if (result == 0)
            {
                result = Top.CompareTo(other.Top);
            }
            if (result == 0)
            {
                result = Right.CompareTo(other.Right);
            }
            if (result == 0)
            {
                result = Far.CompareTo(other.Far);
            }
            return(result);
        }
Ejemplo n.º 2
0
        public static void Near(object in_features, object near_features, object searchRadius = null)
        {
            Geoprocessor geoprocessor = new Geoprocessor()
            {
                OverwriteOutput = true,
                AddOutputsToMap = false
            };

            try
            {
                Near near = new Near(in_features, near_features)
                {
                    search_radius = searchRadius
                };

                geoprocessor.Execute(near, null);
            }
            catch (Exception)
            {
                if (geoprocessor.MessageCount > 0)
                {
                    string excMessage = null;
                    for (int Count = 0; Count <= geoprocessor.MessageCount - 1; Count++)
                    {
                        excMessage += geoprocessor.GetMessage(Count) + Environment.NewLine;
                    }
                    throw new Exception(excMessage);
                }
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        ///   Creates a new group matcher.
        /// </summary>
        /// <param name="averageFunc">
        ///   The function for the averaging near structures.</param>
        ///<param name="nearFunc">
        ///   The function which compares structures' distance.</param>
        /// <param name="minimumNeighbors">
        ///   The minimum number of neighbors needed to keep a detection. If a rectangle
        ///   has less than this minimum number, it will be discarded as a false positive.</param>
        /// <param name="threshold">
        ///   The minimum distance threshold to consider two structures as neighbors.
        ///   Default is 0.2.</param>
        /// 
        public GroupMatching(Average averageFunc, Near nearFunc, int minimumNeighbors = 1, double threshold = 0.2)
        {
            this.AverageFunc = averageFunc;
            this.NearFunc = nearFunc;

            this.minNeighbors = minimumNeighbors;
            this.threshold = threshold / 2.0;
        }
Ejemplo n.º 4
0
 public bool Equals(Rectangle3D other)
 {
     return(Bottom.Equals(other.Bottom) &&
            Left.Equals(other.Left) &&
            Near.Equals(other.Near) &&
            Top.Equals(other.Top) &&
            Right.Equals(other.Right) &&
            Far.Equals(other.Far));
 }
Ejemplo n.º 5
0
        public async Task ClassInitAsync()
        {
            _near = await TestUtils.SetUpTestConnection();

            var masterAccount = await _near.AccountAsync(accountId : TestUtils.TestAccountName);

            var amount = TestUtils.InitialBalance * new UInt128(100);

            _testAccount = await TestUtils.CreateAccount(masterAccount : masterAccount, amount : amount);
        }
Ejemplo n.º 6
0
        public override int GetHashCode()
        {
            int hashCode = 544882480;

            hashCode = hashCode * -1521134295 + Left.GetHashCode();
            hashCode = hashCode * -1521134295 + Bottom.GetHashCode();
            hashCode = hashCode * -1521134295 + Near.GetHashCode();
            hashCode = hashCode * -1521134295 + Right.GetHashCode();
            hashCode = hashCode * -1521134295 + Top.GetHashCode();
            hashCode = hashCode * -1521134295 + Far.GetHashCode();
            return(hashCode);
        }
Ejemplo n.º 7
0
 public async Task SetupBeforeEachTestAsync()
 {
     _keyStore = new InMemoryKeyStore();
     _nearFake = new Near(config: new NearConfig()
     {
         NetworkId    = "networkId",
         NodeUrl      = _walletUrl,
         ProviderType = ProviderType.JsonRpc,
         SignerType   = SignerType.InMemory,
         KeyStore     = _keyStore,
         ContractName = "contractId",
         WalletUrl    = _walletUrl
     });
     _authService   = new MockAuthService();
     _authStorage   = new MockAuthStorage();
     _walletAccount = new WalletAccount(_nearFake, "", _authService, _authStorage);
 }
Ejemplo n.º 8
0
 void Start()
 {
     Near = new Near(config: new NearConfig()
     {
         NetworkId    = "default",
         NodeUrl      = "https://rpc.nearprotocol.com",
         ProviderType = ProviderType.JsonRpc,
         SignerType   = SignerType.InMemory,
         KeyStore     = new InMemoryKeyStore(),
         ContractName = "myContractId",
         WalletUrl    = "https://wallet.nearprotocol.com"
     });
     WalletAccount = new WalletAccount(
         Near,
         "",
         new AuthService(),
         new AuthStorage());
 }
Ejemplo n.º 9
0
        /// <summary>
        /// Returns the string representation of this object</summary>
        /// <param name="format">Optional standard numeric format string for a floating point number.
        /// If null, "R" is used for round-trip support in case the string is persisted.
        /// http://msdn.microsoft.com/en-us/library/vstudio/dwhawy9k(v=vs.100).aspx </param>
        /// <param name="formatProvider">Optional culture-specific formatting provider. This is usually
        /// a CultureInfo object or NumberFormatInfo object. If null, the current culture is used.
        /// Use CultureInfo.InvariantCulture for persistence.</param>
        /// <returns>String representation of object</returns>
        public string ToString(string format, IFormatProvider formatProvider)
        {
            string listSeparator = StringUtil.GetNumberListSeparator(formatProvider);

            // For historic reasons, use "R" for round-trip support, in case this string is persisted.
            if (format == null)
            {
                format = "R";
            }

            return(String.Format(
                       "{0}{6} {1}{6} {2}{6} {3}{6} {4}{6} {5}",
                       Right.ToString(format, formatProvider),
                       Left.ToString(format, formatProvider),
                       Top.ToString(format, formatProvider),
                       Bottom.ToString(format, formatProvider),
                       Near.ToString(format, formatProvider),
                       Far.ToString(format, formatProvider),
                       listSeparator));
        }
Ejemplo n.º 10
0
        public static async Task <Near> SetUpTestConnection()
        {
            var keyStore = new InMemoryKeyStore();
            var key      = "ed25519:2wyRcSwSuHtRVmkMCGjPwnzZmQLeXLzLLyED1NDMt4BjnKgQL6tF85yBx6Jr26D2dUNeC716RBoTxntVHsegogYw";
            var keyPair  = KeyPair.FromString(key);
            await keyStore.SetKeyAsync(NetworkId, TestAccountName, keyPair);

            var environment = EnvironmentConfig.GetConfig(Environment.CI);
            var config      = new NearConfig()
            {
                NetworkId    = TestUtils.NetworkId,
                NodeUrl      = environment.NodeUrl.AbsoluteUri,
                ProviderType = ProviderType.JsonRpc,
                SignerType   = SignerType.InMemory,
                KeyStore     = keyStore,
                ContractName = "contractId",
                WalletUrl    = environment.NodeUrl.AbsoluteUri
            };

            return(await Near.ConnectAsync(config : config));
        }
Ejemplo n.º 11
0
        public async Task ClassInitAsync()
        {
            _contractId = TestUtils.GenerateUniqueString("test_contract");
            _near       = await TestUtils.SetUpTestConnection();

            _workingAccount = await TestUtils.CreateAccount(await _near.AccountAsync(TestUtils.TestAccountName), TestUtils.InitialBalance *(UInt128)100);

            var newPublicKey = await _near.Connection.Signer.CreateKeyAsync(_contractId, TestUtils.NetworkId);

            var data = Wasm.GetBytes();

            await _workingAccount.CreateAndDeployContractAsync(_contractId, newPublicKey, data, (UInt128)1000000);

            var contractOptions = new ContractOptions()
            {
                viewMethods   = new string[] { "hello", "getValue", "getAllKeys", "returnHiWithLogs" },
                changeMethods = new string[] { "setValue", "generateLogs", "triggerAssert", "testSetRemove" },
            };

            _contract = new ContractNear(_workingAccount, _contractId, contractOptions);
        }
Ejemplo n.º 12
0
        static void Main(string[] args)
        {
            Near n = null;

            try
            {
                //string url = "http://www.xianmi.me/qzxm/index.php/Wap/Wm/index/memid/511/lng/118.8702400000/lat/28.961739.html";
                //string result = Request(url);

                //int start = result.IndexOf("var near = ");
                //int end = result.IndexOf("</script>", start);

                //string json = result.Substring(start, end).Replace("var near = ", "");

                string json = "{'types':[{'id':'45','name':'衢名小吃','storeids':'42,1072','storenum':2},{'id':'44','name':'营养早餐','storeids':'42,588,1067,1072,1083,1090,1107,1128,1139','storenum':9},{'id':'40','name':'精品炒菜','storeids':'42,869,873,984','storenum':4},{'id':'37','name':'鲜米水果','storeids':'1022','storenum':1},{'id':'20','name':'中式快餐','storeids':'144,499,509,515,873,983,1012','storenum':7},{'id':'21','name':'西式快餐','storeids':'960,985,1013','storenum':3},{'id':'22','name':'特色小吃','storeids':'42,50,54,465,534,582,588,746,749,750,764,825,828,829,860,892,906,940,945,954,972,974,984,1019,1028,1042,1047,1049,1051,1103,1104,1107,1122,1123,1127,1128,1130,1134,1137,1138','storenum':40},{'id':'23','name':'甜品饮料','storeids':'55,283,472,496,528,586,748,756,785,1039,1057,1126','storenum':12},{'id':'24','name':'日韩料理','storeids':'61,944','storenum':2},{'id':'35','name':'西餐','storeids':'507,519','storenum':2}],'count':73,'stores':[{'id':'1130','delivery_mode':'1','name':'绝味鸭脖(坊门街)','pic':'/qzxm/Uploads/2016-07-20/578f5220db9b8.jpg','fee':3,'minconsumption':'10','status':1,'ordernum':17,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'54','delivery_mode':'1','name':'衢老高(原老高粉干)','pic':'/qzxm/Uploads/2015-11-18/564c574103ed2.png','fee':3,'minconsumption':'10','status':1,'ordernum':2478,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'1049','delivery_mode':'1','name':'荣华凉皮','pic':'/qzxm/Uploads/2016-05-02/5726ffa333bf8.jpg','fee':8,'minconsumption':'10','status':1,'ordernum':93,'delivery_desc':'10元起送,配送费8元','district':0.5},{'id':'940','delivery_mode':'1','name':'蒸食膳','pic':'/qzxm/Uploads/2015-10-20/56261113deac1.jpg','fee':3,'minconsumption':'10','status':1,'ordernum':340,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'55','delivery_mode':'1','name':'(衢州总店下街店)阿姨奶茶专卖(活动期间满二十送酸梅汤一杯)','pic':'/qzxm/Uploads/2015-01-18/54bb197f05490.jpg','fee':3,'minconsumption':'10','status':1,'ordernum':2779,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'984','delivery_mode':'1','name':'瘸子实惠饭店','pic':'/qzxm/Uploads/2016-01-15/5698697f7a22f.jpeg','fee':3,'minconsumption':'20','status':1,'ordernum':322,'delivery_desc':'20元起送,配送费3元','district':0.5},{'id':'873','delivery_mode':'1','name':'(下午1:30 —— 4:30休息)好食代(原国良鸭头)','pic':'/qzxm/Uploads/2015-08-06/55c319ba31857.jpg','fee':3,'minconsumption':'10','status':1,'ordernum':100,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'42','delivery_mode':'1','name':'余记烤饼(后街巷)','pic':'/qzxm/Uploads/2014-11-05/5459947e14968.gif','fee':3,'minconsumption':'10','status':1,'ordernum':8442,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'892','delivery_mode':'1','name':'斗潭粥铺(下午14:00--16:30休息)','pic':'/qzxm/Uploads/2015-08-28/55e007a9ad5c7.JPG','fee':3,'minconsumption':'10','status':1,'ordernum':616,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'1107','delivery_mode':'1','name':'(早餐-7-10点单配送,10-24点可接受预定)(新店上线)胖小妹肉圆,盖浇饭(下单满15送冷饮)','pic':'/qzxm/Uploads/2016-06-29/5773a67c643c1.JPG','fee':5,'minconsumption':'15','status':1,'ordernum':37,'delivery_desc':'15元起送,配送费5元','district':0.5},{'id':'144','delivery_mode':'1','name':'老焙粉干(斗潭东区)','pic':'/qzxm/Uploads/2014-10-11/54390c24bb8e7.jpg','fee':3,'minconsumption':'10','status':1,'ordernum':3503,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'582','delivery_mode':'1','name':'传世老北京卤肉卷','pic':'/qzxm/Uploads/2015-01-20/54be4a3cadedc.jpg','fee':3,'minconsumption':'10','status':1,'ordernum':1745,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'61','delivery_mode':'1','name':'(下街)鲜目录外带寿司','pic':'/qzxm/Uploads/2014-10-11/543907058c6ba.jpg','fee':3,'minconsumption':'10','status':1,'ordernum':1595,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'750','delivery_mode':'1','name':'原新旺煲仔(后街巷)','pic':'/qzxm/Uploads/2015-05-10/554eda86c22f6.jpg','fee':3,'minconsumption':'10','status':1,'ordernum':1361,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'50','delivery_mode':'1','name':'重庆酸辣粉(米兰对面弄堂棋坊巷)','pic':'/qzxm/Uploads/2015-03-26/55139e8245123.jpg','fee':3,'minconsumption':'10','status':1,'ordernum':1285,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'828','delivery_mode':'1','name':'精武鸭脖(十年老店,卖鸭头的小伙子)','pic':'/qzxm/Uploads/2015-07-02/5594f0f23724f.jpg','fee':3,'minconsumption':'20','status':1,'ordernum':1220,'delivery_desc':'20元起送,配送费3元','district':0.5},{'id':'465','delivery_mode':'1','name':'杨家巷烤饼','pic':'/qzxm/Uploads/2015-06-27/558e697fd7eea.JPG','fee':3,'minconsumption':'10','status':1,'ordernum':1193,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'283','delivery_mode':'1','name':'Rand B珍奶会所','pic':'/qzxm/Uploads/2014-07-30/53d8bdb7d7590.png','fee':3,'minconsumption':'10','status':1,'ordernum':1044,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'746','delivery_mode':'1','name':'爱之味铁板烧','pic':'/qzxm/Uploads/2015-05-09/554df6c441ffb.jpg','fee':3,'minconsumption':'20','status':1,'ordernum':1020,'delivery_desc':'20元起送,配送费3元','district':0.5},{'id':'528','delivery_mode':'1','name':'杨小贤','pic':'/qzxm/Uploads/2014-11-06/545b22a4edd30.gif','fee':3,'minconsumption':'10','status':1,'ordernum':996,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'499','delivery_mode':'1','name':'老杜酱果(斗潭东区)(下午14:00--16:00休息)','pic':'/qzxm/Uploads/2014-10-11/54390c683d25b.jpg','fee':3,'minconsumption':'10','status':1,'ordernum':973,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'869','delivery_mode':'1','name':'傅家小厨(炒菜)','pic':'/qzxm/Uploads/2015-08-05/55c1cdd9857d0.jpg','fee':3,'minconsumption':'10','status':1,'ordernum':839,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'748','delivery_mode':'1','name':'黑泷堂','pic':'/qzxm/Uploads/2015-05-09/554dff9b61159.jpg','fee':3,'minconsumption':'10','status':1,'ordernum':793,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'749','delivery_mode':'1','name':'陆老爹','pic':'/qzxm/Uploads/2015-05-10/554f072f1ec8c.jpg','fee':3,'minconsumption':'10','status':1,'ordernum':628,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'906','delivery_mode':'1','name':'拌面粥道','pic':'/qzxm/Uploads/2015-09-05/55ea9a7ef3490.jpg','fee':3,'minconsumption':'10','status':1,'ordernum':492,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'829','delivery_mode':'1','name':'口口乐私房面馆','pic':'/qzxm/Uploads/2015-07-02/559500ae96c76.jpg','fee':3,'minconsumption':'10','status':1,'ordernum':457,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'1072','delivery_mode':'1','name':'(早餐-10点-24点接受预定)兰溪煎饺(钟楼底店)','pic':'/qzxm/Uploads/2016-05-22/5741978d44adf.jpg','fee':5,'minconsumption':'8','status':1,'ordernum':421,'delivery_desc':'8元起送,配送费5元','district':0.5},{'id':'588','delivery_mode':'1','name':'煎饼哥','pic':'/qzxm/Uploads/2015-06-23/55892fe4c890f.jpg','fee':3,'minconsumption':'10','status':1,'ordernum':379,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'1019','delivery_mode':'1','name':'馋嘴花甲(新桥街店)','pic':'/qzxm/Uploads/2016-03-09/56df977335d93.jpg','fee':3,'minconsumption':'10','status':1,'ordernum':309,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'785','delivery_mode':'1','name':'甘茶度','pic':'/qzxm/Uploads/2015-06-19/5583db79ef2ea.jpg','fee':3,'minconsumption':'10','status':1,'ordernum':304,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'825','delivery_mode':'1','name':'衢福记','pic':'/qzxm/Uploads/2015-07-02/5594e49e2421b.jpg','fee':3,'minconsumption':'10','status':1,'ordernum':275,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'496','delivery_mode':'1','name':'muse手工烘焙','pic':'/qzxm/Uploads/2014-10-14/543cc8a9b38b2.gif','fee':3,'minconsumption':'10','status':1,'ordernum':258,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'534','delivery_mode':'1','name':'瘸子馄饨','pic':'/qzxm/Uploads/2014-11-20/546de100b1837.jpg','fee':3,'minconsumption':'10','status':1,'ordernum':254,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'974','delivery_mode':'1','name':'(新店上线)骨汤麻辣烫(推荐)','pic':'/qzxm/Uploads/2015-12-14/566e65211d9b7.JPG','fee':3,'minconsumption':'10','status':1,'ordernum':245,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'509','delivery_mode':'1','name':'飞鸿面馆','pic':'/qzxm/Uploads/2014-10-11/543906241486b.jpg','fee':3,'minconsumption':'10','status':1,'ordernum':239,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'945','delivery_mode':'1','name':'武汉黑鸭','pic':'/qzxm/Uploads/2015-10-26/562de8074522f.jpg','fee':3,'minconsumption':'10','status':1,'ordernum':197,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'1039','delivery_mode':'1','name':'(新店上线)50岚(鲜茶专卖连锁)','pic':'/qzxm/Uploads/2016-04-26/571f363e53076.JPG','fee':3,'minconsumption':'10','status':1,'ordernum':194,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'954','delivery_mode':'1','name':'渝口福重庆小面','pic':'/qzxm/Uploads/2015-11-09/56406d788433e.jpg','fee':3,'minconsumption':'10','status':1,'ordernum':192,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'472','delivery_mode':'1','name':'柒寿司(果沫奶茶)','pic':'/qzxm/Uploads/2014-10-11/54390ad75571f.jpg','fee':3,'minconsumption':'10','status':1,'ordernum':187,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'764','delivery_mode':'1','name':'重庆麻辣烫(十三香龙虾)','pic':'/qzxm/Uploads/2015-05-22/555edb2411222.jpg','fee':3,'minconsumption':'10','status':1,'ordernum':102,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'1090','delivery_mode':'1','name':'(早餐-7-10点单配送,10-24点可接受预定)乐行食','pic':'/qzxm/Uploads/2016-05-28/57491f81adc9b.jpg','fee':5,'minconsumption':'10','status':1,'ordernum':91,'delivery_desc':'10元起送,配送费5元','district':0.5},{'id':'586','delivery_mode':'1','name':'三公主奶茶','pic':'/qzxm/Uploads/2015-01-24/54c36fae07edb.jpg','fee':3,'minconsumption':'10','status':1,'ordernum':90,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'1051','delivery_mode':'1','name':'方记粥铺','pic':'/qzxm/Uploads/2016-05-08/572f09299d329.png','fee':3,'minconsumption':'10','status':1,'ordernum':89,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'756','delivery_mode':'1','name':'罗蒂爸爸','pic':'/qzxm/Uploads/2015-05-15/55558f82c68cd.jpg','fee':3,'minconsumption':'20','status':1,'ordernum':85,'delivery_desc':'20元起送,配送费3元','district':0.5},{'id':'507','delivery_mode':'1','name':'拉芳舍','pic':'/qzxm/Uploads/2014-10-11/5439066225598.jpg','fee':3,'minconsumption':'10','status':1,'ordernum':70,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'519','delivery_mode':'1','name':'英爵咖啡','pic':'/qzxm/Uploads/2014-11-06/545b332c65ffb.jpg','fee':3,'minconsumption':'10','status':1,'ordernum':69,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'944','delivery_mode':'1','name':'阿美丽韩式料理','pic':'/qzxm/Uploads/2015-10-25/562c782e47177.jpg','fee':3,'minconsumption':'10','status':1,'ordernum':54,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'985','delivery_mode':'1','name':'小西门咖啡','pic':'/qzxm/Uploads/2016-01-21/56a0b97c547ab.jpg','fee':3,'minconsumption':'10','status':1,'ordernum':54,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'1042','delivery_mode':'1','name':'豪大大鸡排','pic':'/qzxm/Uploads/2016-04-30/5724698be55ff.JPG','fee':3,'minconsumption':'10','status':1,'ordernum':54,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'1057','delivery_mode':'1','name':'大麦Bake(衢州店)','pic':'/qzxm/Uploads/2016-05-22/574162e6c3ce9.jpg','fee':3,'minconsumption':'10','status':1,'ordernum':48,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'1083','delivery_mode':'1','name':'(早餐-7-10点单配送,10-24点可接受预定)红樱桃美食','pic':'/qzxm/Uploads/2016-05-25/574530b1ed1e1.png','fee':5,'minconsumption':'5','status':1,'ordernum':46,'delivery_desc':'5元起送,配送费5元','district':0.5},{'id':'1103','delivery_mode':'1','name':'重庆小面(中河沿)','pic':'/qzxm/Uploads/2016-06-19/57663a630b1de.jpg','fee':3,'minconsumption':'10','status':1,'ordernum':46,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'1012','delivery_mode':'1','name':'三毛煲店','pic':'/qzxm/Uploads/2016-03-07/56dd1964c245c.jpg','fee':3,'minconsumption':'68','status':1,'ordernum':39,'delivery_desc':'68元起送,配送费3元','district':0.5},{'id':'1067','delivery_mode':'1','name':'(早餐-10点-24点接受预定)肯德基早餐(香溢)','pic':'/qzxm/Uploads/2016-05-22/574187da2a8e8.jpg','fee':10,'minconsumption':'0','status':1,'ordernum':35,'delivery_desc':'0元起送,配送费10元','district':0.5},{'id':'1013','delivery_mode':'1','name':'肯德基(香溢店)','pic':'/qzxm/Uploads/2016-03-07/56dd1a7c46da9.jpg','fee':10,'minconsumption':'10','status':1,'ordernum':34,'delivery_desc':'10元起送,配送费10元','district':0.5},{'id':'515','delivery_mode':'1','name':'香雪面馆','pic':'/qzxm/Uploads/2014-10-14/543ccaaab3e47.gif','fee':3,'minconsumption':'10','status':1,'ordernum':26,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'1022','delivery_mode':'1','name':'果缤纷','pic':'/qzxm/Uploads/2016-03-23/56f24791169dc.jpg','fee':3,'minconsumption':'15','status':1,'ordernum':21,'delivery_desc':'15元起送,配送费3元','district':0.5},{'id':'1104','delivery_mode':'1','name':'重庆小面(后街巷)','pic':'/qzxm/Uploads/2016-06-19/57663a7944055.jpg','fee':3,'minconsumption':'10','status':1,'ordernum':21,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'1127','delivery_mode':'1','name':'(新店上线)来自明洞(韩国炸鸡)','pic':'/qzxm/Uploads/2016-07-21/5790229ed9c48.jpg','fee':3,'minconsumption':'10','status':1,'ordernum':19,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'1047','delivery_mode':'1','name':'全旺山粉饺(裱背巷店)','pic':'/qzxm/Uploads/2016-05-02/57270025619db.jpg','fee':3,'minconsumption':'10','status':1,'ordernum':17,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'1122','delivery_mode':'1','name':'椿林麻辣烫(满十五送饮料一份)(另加打包费1元)','pic':'/qzxm/Uploads/2016-07-14/57870aaf7ac6d.JPG','fee':3,'minconsumption':'10','status':1,'ordernum':11,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'983','delivery_mode':'1','name':'爱吧餐厅(正常)','pic':'/qzxm/Uploads/2016-01-06/568ccbee44d5a.jpg','fee':3,'minconsumption':'10','status':1,'ordernum':7,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'1126','delivery_mode':'1','name':'(新店上线)享廿茶','pic':'/qzxm/Uploads/2016-07-20/578ee8249d8e3.jpg','fee':3,'minconsumption':'10','status':1,'ordernum':4,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'1138','delivery_mode':'1','name':'(新店上线)遵义虾子张六羊肉粉','pic':'/qzxm/Uploads/2016-08-19/57b68fa70cc02.JPG','fee':3,'minconsumption':'10','status':1,'ordernum':4,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'1123','delivery_mode':'1','name':'重庆小面(日新巷)','pic':'/qzxm/Uploads/2016-07-14/57870ae0c1689.JPG','fee':3,'minconsumption':'10','status':1,'ordernum':3,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'1134','delivery_mode':'1','name':'(新店上线)开心花甲粉','pic':'/qzxm/Uploads/2016-08-06/57a5d0d2b66d1.jpg','fee':3,'minconsumption':'10','status':1,'ordernum':1,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'1139','delivery_mode':'1','name':'(早餐-7-10点单配送,10-24点可接受预定)遵义虾子张六羊肉粉','pic':'/qzxm/Uploads/2016-08-19/57b68f8b0e704.JPG','fee':5,'minconsumption':'10','status':1,'ordernum':1,'delivery_desc':'10元起送,配送费5元','district':0.5},{'id':'960','delivery_mode':'1','name':'大茴香咖啡','pic':'/qzxm/Uploads/2015-11-14/5646ff5461019.jpg','fee':3,'minconsumption':'10','status':1,'ordernum':0,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'1028','delivery_mode':'1','name':'虞家面食','pic':'/qzxm/Uploads/2016-04-02/56ff66934014f.jpg','fee':3,'minconsumption':'10','status':1,'ordernum':0,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'1137','delivery_mode':'1','name':'(新店上线)蜀锦香厕所串串(另加1元打包费)(下午5:00——9:00休息)','pic':'/qzxm/Uploads/2016-08-19/57b69020a7d29.JPG','fee':3,'minconsumption':'10','status':1,'ordernum':0,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'1128','delivery_mode':'1','name':'(新店上线)玲珑生煎馆','pic':'/qzxm/Uploads/2016-07-20/578f1e1cd3947.JPG','fee':5,'minconsumption':'10','status':0,'ordernum':95,'delivery_desc':'10元起送,配送费5元','district':0.5},{'id':'860','delivery_mode':'1','name':'虾大大(龙虾每份两斤起做)(龙虾3斤以内打包费3元。主食打包每份1元,凉菜打包每份1元)(下午4:00-凌晨1:00营业)','pic':'/qzxm/Uploads/2015-07-30/55b9e33042e5b.jpg','fee':5,'minconsumption':'30','status':0,'ordernum':75,'delivery_desc':'30元起送,配送费5元','district':0.5},{'id':'972','delivery_mode':'1','name':'金氏精武鸭脖(四季青旁边)','pic':'/qzxm/Uploads/2015-12-05/56629f5a8587c.jpg','fee':3,'minconsumption':'10','status':0,'ordernum':134,'delivery_desc':'10元起送,配送费3元','district':0.5}],'tag':1}";
                n = JsonConvert.DeserializeObject <Near>(json);

                foreach (var store in n.stores)
                {
                    string url    = "http://www.xianmi.me/qzxm/index.php/Wap/Wm/getStore/memid/1/lng/138.854582/lat/28.968332.html?store_id=" + store.id;
                    string result = Request(url);

                    var sss = JsonConvert.DeserializeObject <Stores>(result);

                    store.dishes = sss.dishes;
                    store.types  = sss.types;
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }

            Console.WriteLine(n.count);

            Console.ReadLine();
        }
Ejemplo n.º 13
0
        public override Pose Output()
        {
            Fov.Calculate();
            Near.Calculate();

            Pose pose = Pose.Default;

            if (modifier != null)
            {
                pose = modifier.Prev.value;
            }

            if (!Fov.value.isNull)
            {
                pose.fov = Fov.value.value_f;
            }

            if (!Near.value.isNull)
            {
                pose.nearClip = Near.value.value_f;
            }

            return(pose);
        }
Ejemplo n.º 14
0
        public async Task ClassInitAsync()
        {
            _near = await TestUtils.SetUpTestConnection();

            _workingAccount = await TestUtils.CreateAccount(await _near.AccountAsync(TestUtils.TestAccountName), TestUtils.InitialBalance *(UInt128)100);
        }
Ejemplo n.º 15
0
 public void AddAdjacent(Node node, double weight)
 {
     Near.Add(new AdjacentNode(node, weight));
 }
Ejemplo n.º 16
0
        void AddRunKillDama(TCell StartPos, int dir, TNode Parent)
        {
            ArrayList arr = new ArrayList();

            TCell Near;

            if (StartPos == null)
            {
                Near = Pos.NearDama(dir, Pole);
            }
            else
            {
                Near = StartPos.NearDama(dir, Pole);
            }

            TCheck Who;

            Pole.Who(Near, out Who);

            if (Who == null)
            {
                return;
            }

            if (Who.C == C)
            {
                return;
            }

            Near = Near.Near(dir);

            TCheck W2;

            if (Pole.Who(Near, out W2))
            {
                if (W2 == null)
                {
                    TNode Cur = new TNode(Parent, Near, Who, dir);

                    if (Tree == null)
                    {
                        Tree = new TTree(Cur, Pole);
                    }
                    Tree.Count++;

                    int Count = Tree.Count;

                    TCell[] Nears;

                    for (int i = 1; i <= 4; i++)
                    {
                        if (((dir == 1) && (i == 4)) || ((dir == 2) && (i == 3)) ||
                            ((dir == 3) && (i == 2)) || ((dir == 4) && (i == 1)))
                        {
                            continue;
                        }

                        Nears = Near.NearsDama(dir, Pole);

                        for (int k = 0; k < Nears.Count(); k++)
                        {
                            AddRunKillDama(Nears[k], i, Cur);
                        }
                    }

                    if (Count == Tree.Count)
                    {
                        Tree.Lists.Add(Cur);
                    }
                }
            }
        }
Ejemplo n.º 17
0
 /// <summary>Returns a String that represents the current BoundingFrustum.</summary>
 public override string ToString()
 {
     return(string.Format(CultureInfo.CurrentCulture, "{{Near:{0} Far:{1} Left:{2} Right:{3} Top:{4} Bottom:{5}}}", new object[] { Near.ToString(), Far.ToString(), Left.ToString(), Right.ToString(), Top.ToString(), Bottom.ToString() }));
 }
Ejemplo n.º 18
0
        public IHttpActionResult ImportData()
        {
            // return BadRequest("导入关闭");
            Near n = null;

            try
            {
                //string url = "http://www.xianmi.me/qzxm/index.php/Wap/Wm/index/memid/511/lng/118.8702400000/lat/28.961739.html";
                //string result = Request(url);

                //int start = result.IndexOf("var near = ");
                //int end = result.IndexOf("</script>", start);

                //string json = result.Substring(start, end).Replace("var near = ", "");

                string json = "{'types':[{'id':'45','name':'衢名小吃','storeids':'42,1072','storenum':2},{'id':'44','name':'营养早餐','storeids':'42,588,1067,1072,1083,1090,1107,1128,1139','storenum':9},{'id':'40','name':'精品炒菜','storeids':'42,869,873,984','storenum':4},{'id':'37','name':'鲜米水果','storeids':'1022','storenum':1},{'id':'20','name':'中式快餐','storeids':'144,499,509,515,873,983,1012','storenum':7},{'id':'21','name':'西式快餐','storeids':'960,985,1013','storenum':3},{'id':'22','name':'特色小吃','storeids':'42,50,54,465,534,582,588,746,749,750,764,825,828,829,860,892,906,940,945,954,972,974,984,1019,1028,1042,1047,1049,1051,1103,1104,1107,1122,1123,1127,1128,1130,1134,1137,1138','storenum':40},{'id':'23','name':'甜品饮料','storeids':'55,283,472,496,528,586,748,756,785,1039,1057,1126','storenum':12},{'id':'24','name':'日韩料理','storeids':'61,944','storenum':2},{'id':'35','name':'西餐','storeids':'507,519','storenum':2}],'count':73,'stores':[{'id':'1130','delivery_mode':'1','name':'绝味鸭脖(坊门街)','pic':'/qzxm/Uploads/2016-07-20/578f5220db9b8.jpg','fee':3,'minconsumption':'10','status':1,'ordernum':17,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'54','delivery_mode':'1','name':'衢老高(原老高粉干)','pic':'/qzxm/Uploads/2015-11-18/564c574103ed2.png','fee':3,'minconsumption':'10','status':1,'ordernum':2478,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'1049','delivery_mode':'1','name':'荣华凉皮','pic':'/qzxm/Uploads/2016-05-02/5726ffa333bf8.jpg','fee':8,'minconsumption':'10','status':1,'ordernum':93,'delivery_desc':'10元起送,配送费8元','district':0.5},{'id':'940','delivery_mode':'1','name':'蒸食膳','pic':'/qzxm/Uploads/2015-10-20/56261113deac1.jpg','fee':3,'minconsumption':'10','status':1,'ordernum':340,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'55','delivery_mode':'1','name':'(衢州总店下街店)阿姨奶茶专卖(活动期间满二十送酸梅汤一杯)','pic':'/qzxm/Uploads/2015-01-18/54bb197f05490.jpg','fee':3,'minconsumption':'10','status':1,'ordernum':2779,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'984','delivery_mode':'1','name':'瘸子实惠饭店','pic':'/qzxm/Uploads/2016-01-15/5698697f7a22f.jpeg','fee':3,'minconsumption':'20','status':1,'ordernum':322,'delivery_desc':'20元起送,配送费3元','district':0.5},{'id':'873','delivery_mode':'1','name':'(下午1:30 —— 4:30休息)好食代(原国良鸭头)','pic':'/qzxm/Uploads/2015-08-06/55c319ba31857.jpg','fee':3,'minconsumption':'10','status':1,'ordernum':100,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'42','delivery_mode':'1','name':'余记烤饼(后街巷)','pic':'/qzxm/Uploads/2014-11-05/5459947e14968.gif','fee':3,'minconsumption':'10','status':1,'ordernum':8442,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'892','delivery_mode':'1','name':'斗潭粥铺(下午14:00--16:30休息)','pic':'/qzxm/Uploads/2015-08-28/55e007a9ad5c7.JPG','fee':3,'minconsumption':'10','status':1,'ordernum':616,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'1107','delivery_mode':'1','name':'(早餐-7-10点单配送,10-24点可接受预定)(新店上线)胖小妹肉圆,盖浇饭(下单满15送冷饮)','pic':'/qzxm/Uploads/2016-06-29/5773a67c643c1.JPG','fee':5,'minconsumption':'15','status':1,'ordernum':37,'delivery_desc':'15元起送,配送费5元','district':0.5},{'id':'144','delivery_mode':'1','name':'老焙粉干(斗潭东区)','pic':'/qzxm/Uploads/2014-10-11/54390c24bb8e7.jpg','fee':3,'minconsumption':'10','status':1,'ordernum':3503,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'582','delivery_mode':'1','name':'传世老北京卤肉卷','pic':'/qzxm/Uploads/2015-01-20/54be4a3cadedc.jpg','fee':3,'minconsumption':'10','status':1,'ordernum':1745,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'61','delivery_mode':'1','name':'(下街)鲜目录外带寿司','pic':'/qzxm/Uploads/2014-10-11/543907058c6ba.jpg','fee':3,'minconsumption':'10','status':1,'ordernum':1595,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'750','delivery_mode':'1','name':'原新旺煲仔(后街巷)','pic':'/qzxm/Uploads/2015-05-10/554eda86c22f6.jpg','fee':3,'minconsumption':'10','status':1,'ordernum':1361,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'50','delivery_mode':'1','name':'重庆酸辣粉(米兰对面弄堂棋坊巷)','pic':'/qzxm/Uploads/2015-03-26/55139e8245123.jpg','fee':3,'minconsumption':'10','status':1,'ordernum':1285,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'828','delivery_mode':'1','name':'精武鸭脖(十年老店,卖鸭头的小伙子)','pic':'/qzxm/Uploads/2015-07-02/5594f0f23724f.jpg','fee':3,'minconsumption':'20','status':1,'ordernum':1220,'delivery_desc':'20元起送,配送费3元','district':0.5},{'id':'465','delivery_mode':'1','name':'杨家巷烤饼','pic':'/qzxm/Uploads/2015-06-27/558e697fd7eea.JPG','fee':3,'minconsumption':'10','status':1,'ordernum':1193,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'283','delivery_mode':'1','name':'Rand B珍奶会所','pic':'/qzxm/Uploads/2014-07-30/53d8bdb7d7590.png','fee':3,'minconsumption':'10','status':1,'ordernum':1044,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'746','delivery_mode':'1','name':'爱之味铁板烧','pic':'/qzxm/Uploads/2015-05-09/554df6c441ffb.jpg','fee':3,'minconsumption':'20','status':1,'ordernum':1020,'delivery_desc':'20元起送,配送费3元','district':0.5},{'id':'528','delivery_mode':'1','name':'杨小贤','pic':'/qzxm/Uploads/2014-11-06/545b22a4edd30.gif','fee':3,'minconsumption':'10','status':1,'ordernum':996,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'499','delivery_mode':'1','name':'老杜酱果(斗潭东区)(下午14:00--16:00休息)','pic':'/qzxm/Uploads/2014-10-11/54390c683d25b.jpg','fee':3,'minconsumption':'10','status':1,'ordernum':973,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'869','delivery_mode':'1','name':'傅家小厨(炒菜)','pic':'/qzxm/Uploads/2015-08-05/55c1cdd9857d0.jpg','fee':3,'minconsumption':'10','status':1,'ordernum':839,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'748','delivery_mode':'1','name':'黑泷堂','pic':'/qzxm/Uploads/2015-05-09/554dff9b61159.jpg','fee':3,'minconsumption':'10','status':1,'ordernum':793,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'749','delivery_mode':'1','name':'陆老爹','pic':'/qzxm/Uploads/2015-05-10/554f072f1ec8c.jpg','fee':3,'minconsumption':'10','status':1,'ordernum':628,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'906','delivery_mode':'1','name':'拌面粥道','pic':'/qzxm/Uploads/2015-09-05/55ea9a7ef3490.jpg','fee':3,'minconsumption':'10','status':1,'ordernum':492,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'829','delivery_mode':'1','name':'口口乐私房面馆','pic':'/qzxm/Uploads/2015-07-02/559500ae96c76.jpg','fee':3,'minconsumption':'10','status':1,'ordernum':457,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'1072','delivery_mode':'1','name':'(早餐-10点-24点接受预定)兰溪煎饺(钟楼底店)','pic':'/qzxm/Uploads/2016-05-22/5741978d44adf.jpg','fee':5,'minconsumption':'8','status':1,'ordernum':421,'delivery_desc':'8元起送,配送费5元','district':0.5},{'id':'588','delivery_mode':'1','name':'煎饼哥','pic':'/qzxm/Uploads/2015-06-23/55892fe4c890f.jpg','fee':3,'minconsumption':'10','status':1,'ordernum':379,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'1019','delivery_mode':'1','name':'馋嘴花甲(新桥街店)','pic':'/qzxm/Uploads/2016-03-09/56df977335d93.jpg','fee':3,'minconsumption':'10','status':1,'ordernum':309,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'785','delivery_mode':'1','name':'甘茶度','pic':'/qzxm/Uploads/2015-06-19/5583db79ef2ea.jpg','fee':3,'minconsumption':'10','status':1,'ordernum':304,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'825','delivery_mode':'1','name':'衢福记','pic':'/qzxm/Uploads/2015-07-02/5594e49e2421b.jpg','fee':3,'minconsumption':'10','status':1,'ordernum':275,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'496','delivery_mode':'1','name':'muse手工烘焙','pic':'/qzxm/Uploads/2014-10-14/543cc8a9b38b2.gif','fee':3,'minconsumption':'10','status':1,'ordernum':258,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'534','delivery_mode':'1','name':'瘸子馄饨','pic':'/qzxm/Uploads/2014-11-20/546de100b1837.jpg','fee':3,'minconsumption':'10','status':1,'ordernum':254,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'974','delivery_mode':'1','name':'(新店上线)骨汤麻辣烫(推荐)','pic':'/qzxm/Uploads/2015-12-14/566e65211d9b7.JPG','fee':3,'minconsumption':'10','status':1,'ordernum':245,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'509','delivery_mode':'1','name':'飞鸿面馆','pic':'/qzxm/Uploads/2014-10-11/543906241486b.jpg','fee':3,'minconsumption':'10','status':1,'ordernum':239,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'945','delivery_mode':'1','name':'武汉黑鸭','pic':'/qzxm/Uploads/2015-10-26/562de8074522f.jpg','fee':3,'minconsumption':'10','status':1,'ordernum':197,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'1039','delivery_mode':'1','name':'(新店上线)50岚(鲜茶专卖连锁)','pic':'/qzxm/Uploads/2016-04-26/571f363e53076.JPG','fee':3,'minconsumption':'10','status':1,'ordernum':194,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'954','delivery_mode':'1','name':'渝口福重庆小面','pic':'/qzxm/Uploads/2015-11-09/56406d788433e.jpg','fee':3,'minconsumption':'10','status':1,'ordernum':192,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'472','delivery_mode':'1','name':'柒寿司(果沫奶茶)','pic':'/qzxm/Uploads/2014-10-11/54390ad75571f.jpg','fee':3,'minconsumption':'10','status':1,'ordernum':187,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'764','delivery_mode':'1','name':'重庆麻辣烫(十三香龙虾)','pic':'/qzxm/Uploads/2015-05-22/555edb2411222.jpg','fee':3,'minconsumption':'10','status':1,'ordernum':102,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'1090','delivery_mode':'1','name':'(早餐-7-10点单配送,10-24点可接受预定)乐行食','pic':'/qzxm/Uploads/2016-05-28/57491f81adc9b.jpg','fee':5,'minconsumption':'10','status':1,'ordernum':91,'delivery_desc':'10元起送,配送费5元','district':0.5},{'id':'586','delivery_mode':'1','name':'三公主奶茶','pic':'/qzxm/Uploads/2015-01-24/54c36fae07edb.jpg','fee':3,'minconsumption':'10','status':1,'ordernum':90,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'1051','delivery_mode':'1','name':'方记粥铺','pic':'/qzxm/Uploads/2016-05-08/572f09299d329.png','fee':3,'minconsumption':'10','status':1,'ordernum':89,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'756','delivery_mode':'1','name':'罗蒂爸爸','pic':'/qzxm/Uploads/2015-05-15/55558f82c68cd.jpg','fee':3,'minconsumption':'20','status':1,'ordernum':85,'delivery_desc':'20元起送,配送费3元','district':0.5},{'id':'507','delivery_mode':'1','name':'拉芳舍','pic':'/qzxm/Uploads/2014-10-11/5439066225598.jpg','fee':3,'minconsumption':'10','status':1,'ordernum':70,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'519','delivery_mode':'1','name':'英爵咖啡','pic':'/qzxm/Uploads/2014-11-06/545b332c65ffb.jpg','fee':3,'minconsumption':'10','status':1,'ordernum':69,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'944','delivery_mode':'1','name':'阿美丽韩式料理','pic':'/qzxm/Uploads/2015-10-25/562c782e47177.jpg','fee':3,'minconsumption':'10','status':1,'ordernum':54,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'985','delivery_mode':'1','name':'小西门咖啡','pic':'/qzxm/Uploads/2016-01-21/56a0b97c547ab.jpg','fee':3,'minconsumption':'10','status':1,'ordernum':54,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'1042','delivery_mode':'1','name':'豪大大鸡排','pic':'/qzxm/Uploads/2016-04-30/5724698be55ff.JPG','fee':3,'minconsumption':'10','status':1,'ordernum':54,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'1057','delivery_mode':'1','name':'大麦Bake(衢州店)','pic':'/qzxm/Uploads/2016-05-22/574162e6c3ce9.jpg','fee':3,'minconsumption':'10','status':1,'ordernum':48,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'1083','delivery_mode':'1','name':'(早餐-7-10点单配送,10-24点可接受预定)红樱桃美食','pic':'/qzxm/Uploads/2016-05-25/574530b1ed1e1.png','fee':5,'minconsumption':'5','status':1,'ordernum':46,'delivery_desc':'5元起送,配送费5元','district':0.5},{'id':'1103','delivery_mode':'1','name':'重庆小面(中河沿)','pic':'/qzxm/Uploads/2016-06-19/57663a630b1de.jpg','fee':3,'minconsumption':'10','status':1,'ordernum':46,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'1012','delivery_mode':'1','name':'三毛煲店','pic':'/qzxm/Uploads/2016-03-07/56dd1964c245c.jpg','fee':3,'minconsumption':'68','status':1,'ordernum':39,'delivery_desc':'68元起送,配送费3元','district':0.5},{'id':'1067','delivery_mode':'1','name':'(早餐-10点-24点接受预定)肯德基早餐(香溢)','pic':'/qzxm/Uploads/2016-05-22/574187da2a8e8.jpg','fee':10,'minconsumption':'0','status':1,'ordernum':35,'delivery_desc':'0元起送,配送费10元','district':0.5},{'id':'1013','delivery_mode':'1','name':'肯德基(香溢店)','pic':'/qzxm/Uploads/2016-03-07/56dd1a7c46da9.jpg','fee':10,'minconsumption':'10','status':1,'ordernum':34,'delivery_desc':'10元起送,配送费10元','district':0.5},{'id':'515','delivery_mode':'1','name':'香雪面馆','pic':'/qzxm/Uploads/2014-10-14/543ccaaab3e47.gif','fee':3,'minconsumption':'10','status':1,'ordernum':26,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'1022','delivery_mode':'1','name':'果缤纷','pic':'/qzxm/Uploads/2016-03-23/56f24791169dc.jpg','fee':3,'minconsumption':'15','status':1,'ordernum':21,'delivery_desc':'15元起送,配送费3元','district':0.5},{'id':'1104','delivery_mode':'1','name':'重庆小面(后街巷)','pic':'/qzxm/Uploads/2016-06-19/57663a7944055.jpg','fee':3,'minconsumption':'10','status':1,'ordernum':21,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'1127','delivery_mode':'1','name':'(新店上线)来自明洞(韩国炸鸡)','pic':'/qzxm/Uploads/2016-07-21/5790229ed9c48.jpg','fee':3,'minconsumption':'10','status':1,'ordernum':19,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'1047','delivery_mode':'1','name':'全旺山粉饺(裱背巷店)','pic':'/qzxm/Uploads/2016-05-02/57270025619db.jpg','fee':3,'minconsumption':'10','status':1,'ordernum':17,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'1122','delivery_mode':'1','name':'椿林麻辣烫(满十五送饮料一份)(另加打包费1元)','pic':'/qzxm/Uploads/2016-07-14/57870aaf7ac6d.JPG','fee':3,'minconsumption':'10','status':1,'ordernum':11,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'983','delivery_mode':'1','name':'爱吧餐厅(正常)','pic':'/qzxm/Uploads/2016-01-06/568ccbee44d5a.jpg','fee':3,'minconsumption':'10','status':1,'ordernum':7,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'1126','delivery_mode':'1','name':'(新店上线)享廿茶','pic':'/qzxm/Uploads/2016-07-20/578ee8249d8e3.jpg','fee':3,'minconsumption':'10','status':1,'ordernum':4,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'1138','delivery_mode':'1','name':'(新店上线)遵义虾子张六羊肉粉','pic':'/qzxm/Uploads/2016-08-19/57b68fa70cc02.JPG','fee':3,'minconsumption':'10','status':1,'ordernum':4,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'1123','delivery_mode':'1','name':'重庆小面(日新巷)','pic':'/qzxm/Uploads/2016-07-14/57870ae0c1689.JPG','fee':3,'minconsumption':'10','status':1,'ordernum':3,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'1134','delivery_mode':'1','name':'(新店上线)开心花甲粉','pic':'/qzxm/Uploads/2016-08-06/57a5d0d2b66d1.jpg','fee':3,'minconsumption':'10','status':1,'ordernum':1,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'1139','delivery_mode':'1','name':'(早餐-7-10点单配送,10-24点可接受预定)遵义虾子张六羊肉粉','pic':'/qzxm/Uploads/2016-08-19/57b68f8b0e704.JPG','fee':5,'minconsumption':'10','status':1,'ordernum':1,'delivery_desc':'10元起送,配送费5元','district':0.5},{'id':'960','delivery_mode':'1','name':'大茴香咖啡','pic':'/qzxm/Uploads/2015-11-14/5646ff5461019.jpg','fee':3,'minconsumption':'10','status':1,'ordernum':0,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'1028','delivery_mode':'1','name':'虞家面食','pic':'/qzxm/Uploads/2016-04-02/56ff66934014f.jpg','fee':3,'minconsumption':'10','status':1,'ordernum':0,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'1137','delivery_mode':'1','name':'(新店上线)蜀锦香厕所串串(另加1元打包费)(下午5:00——9:00休息)','pic':'/qzxm/Uploads/2016-08-19/57b69020a7d29.JPG','fee':3,'minconsumption':'10','status':1,'ordernum':0,'delivery_desc':'10元起送,配送费3元','district':0.5},{'id':'1128','delivery_mode':'1','name':'(新店上线)玲珑生煎馆','pic':'/qzxm/Uploads/2016-07-20/578f1e1cd3947.JPG','fee':5,'minconsumption':'10','status':0,'ordernum':95,'delivery_desc':'10元起送,配送费5元','district':0.5},{'id':'860','delivery_mode':'1','name':'虾大大(龙虾每份两斤起做)(龙虾3斤以内打包费3元。主食打包每份1元,凉菜打包每份1元)(下午4:00-凌晨1:00营业)','pic':'/qzxm/Uploads/2015-07-30/55b9e33042e5b.jpg','fee':5,'minconsumption':'30','status':0,'ordernum':75,'delivery_desc':'30元起送,配送费5元','district':0.5},{'id':'972','delivery_mode':'1','name':'金氏精武鸭脖(四季青旁边)','pic':'/qzxm/Uploads/2015-12-05/56629f5a8587c.jpg','fee':3,'minconsumption':'10','status':0,'ordernum':134,'delivery_desc':'10元起送,配送费3元','district':0.5}],'tag':1}";
                n = JsonConvert.DeserializeObject <Near>(json);

                foreach (var store in n.stores)
                {
                    string url    = "http://www.xianmi.me/qzxm/index.php/Wap/Wm/getStore/memid/1/lng/138.854582/lat/28.968332.html?store_id=" + store.id;
                    string result = SendRequest(url);

                    var sss = JsonConvert.DeserializeObject <Stores>(result);

                    store.dishes = sss.dishes;
                    store.types  = sss.types;
                }
            }
            catch (Exception e)
            {
            }

            string errorStore = "";

            var sCList = new List <QMTech.Core.Domain.Catalog.StoreCategory>();

            //遍历商家分类
            var k = 0;

            foreach (var type in n.types)
            {
                if (_categoryService.GetAllStoreCategories(type.name).Count > 0)
                {
                    continue;
                }

                var sCategory = new QMTech.Core.Domain.Catalog.StoreCategory
                {
                    Name         = type.name,
                    DisplayOrder = k,
                    Published    = true,
                    Description  = type.storeids
                };

                _categoryService.InsertStoreCategory(sCategory);

                sCList.Add(sCategory);
                k++;
            }

            if (sCList.Count == 0)
            {
                sCList = _categoryService.GetAllStoreCategories().ToList();
            }

            //先遍历商家
            foreach (var store in n.stores)
            {
                try
                {
                    #region 导入商家
                    var sCategory = sCList.Where(sc => sc.Description.Contains(store.id)).FirstOrDefault();
                    if (sCategory == null)
                    {
                        continue;
                    }

                    var storeDb = new QMTech.Core.Domain.Catalog.Store()
                    {
                        Name          = store.name,
                        AllOpened     = true,
                        Description   = store.id,
                        Lat           = 118.85F,
                        Lon           = 28.62F,
                        SelfSupport   = true,
                        DisplayOrder  = new Random().Next(0, 100),
                        Address       = "测试商家地址",
                        Published     = true,
                        StoreCategory = sCategory
                    };

                    //保存商店
                    _storeService.InsertStore(storeDb);

                    var url      = string.Format("http://www.xianmi.me{0}", store.pic);
                    var mimeType = GetMimeType(url);
                    var data     = DownloadPict(url, mimeType);

                    var picture = _pictureService.InsertPicture(data, mimeType, "");

                    //关联
                    var storePicture = new StorePicture
                    {
                        IsLogo       = true,
                        Picture      = picture,
                        Store        = storeDb,
                        DisplayOrder = 0
                    };

                    _storeService.InsertStorePicture(storePicture);

                    //保存商品分类
                    var i = 0;
                    foreach (var type in store.types)
                    {
                        var productCategory = new ProductCategory
                        {
                            Name         = type.name,
                            DisplayOrder = i,
                            StoreId      = storeDb.Id,
                            Published    = true,
                            Description  = type.id
                        };

                        _categoryService.InsertProductCategory(productCategory);
                        i++;
                    }

                    //保存商品
                    i = 0;
                    foreach (var dish in store.dishes)
                    {
                        var dishType = _categoryService.GetAllProductCategories(storeDb.Id).Where(pc => pc.Description.Contains(dish.dishtype)).FirstOrDefault();

                        if (dishType == null)
                        {
                            continue;
                        }

                        var product = new QMTech.Core.Domain.Catalog.Product()
                        {
                            Name            = dish.name,
                            Price           = decimal.Parse(dish.price),
                            OldPrice        = decimal.Parse(dish.price),
                            ProductCategory = dishType,
                            Published       = true,
                            Store           = storeDb
                        };

                        _productService.InsertProduct(product);

                        if (string.IsNullOrEmpty(dish.pic))
                        {
                            continue;
                        }
                        url      = string.Format("http://www.xianmi.me{0}", dish.pic);
                        mimeType = GetMimeType(url);
                        data     = DownloadPict(url, mimeType);

                        try
                        {
                            picture = _pictureService.InsertPicture(data, mimeType, "");
                            _productService.InsertProductPicture(
                                new ProductPicture
                            {
                                Picture = picture,
                                Product = product
                            });

                            i++;
                        }
                        catch (Exception ex)
                        {
                        }
                    }
                    #endregion
                }
                catch (Exception e)
                {
                    errorStore += store.name + ",";
                }
            }

            return(Ok("导入成功"));
        }