public static List <byte[]> getHiddenMatchAddresses() { if (cachedHiddenMatchAddresses != null) { return(cachedHiddenMatchAddresses); } lock (friends) { if (friends.Count() == 0) { return(null); } AddressClient ac = new AddressClient(); foreach (var friend in friends) { if (friend.approved) { ac.addAddress(friend.walletAddress); } } Random rnd = new Random(); cachedHiddenMatchAddresses = ac.generateHiddenMatchAddresses(rnd, CoreConfig.matcherBytesPerAddress); return(cachedHiddenMatchAddresses); } }
public void should_simple_synchronous_call_getaddressdisplaydata_hash_with_bad_address_returns_fail() { AddressClient client = new AddressClient(); AddressDisplayData result = client.GetDisplayData(Network.Doge, Consts.Wrong); Assert.IsNotNull(result); Assert.IsTrue(result.Status == Consts.Fail); }
public void simple_synchronous_call_getspenttx_returns_result_with_proxy() { AddressClient client = new AddressClient(); InputTx result = client.GetSpentTx(Network.Doge, "DRapidDiBYggT1zdrELnVhNDqyAHn89cRi", "e83d147c3bcd87c6efd5270896a179f6ecb1de8b8c8cc324645c5a14129baf8c"); Assert.IsNotNull(result); Assert.IsTrue(result.Status == Consts.Success); Assert.IsTrue(result.Data.Address == "DRapidDiBYggT1zdrELnVhNDqyAHn89cRi"); }
public ActionResult Create(CreateClientViewModel client) { if (ModelState.IsValid) { var nc = new Client { IdEmployee = client.IdEmployee, IdRUC = client.IdRUC, Name = client.Name }; var newc = this.db.Client.Add(nc); this.db.SaveChanges(); for (int i = 0; i < client.Addresses.Count(); i++) { var na = new AddressClient { AddressName = client.Addresses.ElementAt(i), IdClient = newc.Id, Description = "Default description" }; this.db.AddressClient.Add(na); this.db.SaveChanges(); } for (int i = 0; i < client.Telephones.Count(); i++) { var nt = new TelephoneClient { Description = "Default description", IdClient = newc.Id, Number = client.Telephones.ElementAt(i) }; this.db.TelephoneClient.Add(nt); this.db.SaveChanges(); } for (int i = 0; i < client.Emails.Count(); i++) { var ne = new EmailClient { IdClient = newc.Id, Emaill = client.Emails.ElementAt(i) }; this.db.EmailClient.Add(ne); this.db.SaveChanges(); } return(RedirectToAction("Index")); } ViewBag.IdEmployee = new SelectList(db.Employee, "Id", "Name", client.IdEmployee); ViewBag.IdRUC = new SelectList(db.RUC, "IdRUC", "RUCName", client.IdRUC); return(View(client)); }
public void should_simple_synchronous_call_isaddressvalid_with_bad_address_returns_false() { AddressClient client = new AddressClient(); AddressValid result = client.IsAddressValid(Network.Doge, Consts.Wrong); Assert.IsNotNull(result); Assert.IsTrue(result.Status == Consts.Success); Assert.IsTrue(!result.Data.IsValid); }
public void simple_synchronous_call_getspentvalue_returns_result_with_proxy() { AddressClient client = new AddressClient(); SpentValue result = client.GetSpentValue(Network.Doge, "DFundmtrigzA6E25Swr2pRe4Eb79bGP8G1"); Assert.IsNotNull(result); Assert.IsTrue(result.Status == Consts.Success); Assert.IsTrue(result.Data.Address == "DFundmtrigzA6E25Swr2pRe4Eb79bGP8G1"); }
public void simple_synchronous_call_getdisplaydata_returns_result_with_proxy() { AddressClient client = new AddressClient(); AddressDisplayData result = client.GetDisplayData(Network.Doge, "DM7Yo7YqPtgMsGgphX9RAZFXFhu6Kd6JTT"); Assert.IsNotNull(result); Assert.IsTrue(result.Status == Consts.Success); Assert.IsTrue(result.Data.Address == "DM7Yo7YqPtgMsGgphX9RAZFXFhu6Kd6JTT"); }
public void Create_Address() { AddressServiceReference.AddressClient address = new AddressClient("BasicHttpBinding_IAddress"); address.Open(); address.Create(_dto); AddressDTO result = address.Read(_dto.Id); Assert.IsNotNull(result); }
public void simple_synchronous_call_isaddressvalid_returns_result_with_proxy() { AddressClient client = new AddressClient(); AddressValid result = client.IsAddressValid(Network.Doge, "DM7Yo7YqPtgMsGgphX9RAZFXFhu6Kd6JTT"); Assert.IsNotNull(result); Assert.IsTrue(result.Status == Consts.Success); Assert.IsTrue(result.Data.Address == "DM7Yo7YqPtgMsGgphX9RAZFXFhu6Kd6JTT"); Assert.IsTrue(result.Data.IsValid); }
public void TestGetUnstructureAddress() { // arrange var statementService = new AddressClient(); // act var unstructureAddress = statementService.GetUnstructureAddress(new Guid("CDDF07A5-9617-4911-A6A4-122032151907")); // assert Assert.AreEqual(unstructureAddress, "Белгородская обл.,Красногвардейский р-н.,Палатово с.,"); }
static void Main(string[] args) { Console.WriteLine("ClientService Start。。。"); ServiceHost host = new ServiceHost(typeof(ServiceList)); host.Open(); Console.WriteLine("Call AddressClient"); var client = new AddressClient(new InstanceContext(new Program())); //配置文件中获取iis的地址 var iis = ConfigurationManager.AppSettings["iis"]; //将iis的地址告诉心跳 client.GetService(iis); Console.WriteLine("Call SearchClient"); ////从集群中获取search地址来对Search服务进行调用 //var factory = new ChannelFactory<IProduct>(new NetTcpBinding(SecurityMode.None), new EndpointAddress(ServiceList.Search)); ////根据userid获取了shopID的集合 ////比如说这里的ShopIDList是通过索引交并集获取的分页的一些shopID //var shopIDList = factory.CreateChannel().GetShopListByUserID(15); //var strSql = string.Join(",", shopIDList); //Console.WriteLine(string.Format("strSql:{0}", strSql)); //Stopwatch watch = new Stopwatch(); //watch.Start(); //SqlHelper.Query("select s.ShopID,u.UserName,s.ShopName from [User] as u ,Shop as s where s.ShopID in(" + strSql + ")"); //watch.Stop(); //Console.WriteLine("通过wcf索引获取的ID >>>花费时间:" + watch.ElapsedMilliseconds); ////普通的sql查询花费的时间 //StringBuilder builder = new StringBuilder(); //builder.Append("select * from "); //builder.Append("(select ROW_NUMBER() over(order by s.ShopID) as NumberID, "); //builder.Append(" s.ShopID, u.UserName, s.ShopName "); //builder.Append("from Shop s left join [User] as u on u.UserID=s.UserID "); //builder.Append("where s.UserID=15) as array "); //builder.Append("where NumberID>300000 and NumberID<300050"); //watch.Start(); //SqlHelper.Query(builder.ToString()); //watch.Stop(); //Console.WriteLine("普通的sql分页 >>>花费时间:" + watch.ElapsedMilliseconds); Console.Read(); }
public void TestGetFirstLevelByTfoms() { // arrange var statementService = new AddressClient(); // act var k = statementService.GetFirstLevelByTfoms("45000000000"); // assert Assert.IsNotNull(k); Assert.AreEqual(k.Name, "Москва"); }
public void TestGetAddressList() { // arrange var statementService = new AddressClient(); // act var list = statementService.GetAddressList(new Guid("EA5E1E3D-2848-486A-BD48-AFBA7419356E"), "П%а%л%а%т%", null); // assert Assert.IsNotNull(list); Assert.AreEqual(list.Count, 2); }
public void TestGetAddress() { // arrange var statementService = new AddressClient(); // act var k = statementService.GetAddress(new Guid("0C5B2444-70A0-4932-980C-B4DC0D3F02B5")); // assert Assert.IsNotNull(k); Assert.AreEqual(k.Name, "Москва"); }
public void TestHierarchyBuild() { // arrange var statementService = new AddressClient(); // act var hierarchyBuild = statementService.HierarchyBuild(new Guid("CDDF07A5-9617-4911-A6A4-122032151907")); // assert Assert.AreEqual( hierarchyBuild, "30547212-8edb-461e-a814-2101f0e72f5f;ea5e1e3d-2848-486a-bd48-afba7419356e;cddf07a5-9617-4911-a6a4-122032151907"); }
static void Main(string[] args) { ServiceHost host = new ServiceHost(typeof(ServiceList)); host.Open(); var client = new AddressClient(new InstanceContext(new Program())); //配置文件中获取iis的地址 var iis = ConfigurationManager.AppSettings["iis"]; //将iis的地址告诉心跳 client.GetService(iis); //从集群中获取search地址来对Search服务进行调用 var factory = new ChannelFactory<IProduct>(new NetTcpBinding(SecurityMode.None), new EndpointAddress(ServiceList.Search)); //根据userid获取了shopID的集合 //比如说这里的ShopIDList是通过索引交并集获取的分页的一些shopID var shopIDList = factory.CreateChannel().GetShopListByUserID(15); var strSql = string.Join(",", shopIDList); Stopwatch watch = new Stopwatch(); watch.Start(); SqlHelper.Query("select s.ShopID,u.UserName,s.ShopName from [User] as u ,Shop as s where s.ShopID in(" + strSql + ")"); watch.Stop(); Console.WriteLine("通过wcf索引获取的ID >>>花费时间:" + watch.ElapsedMilliseconds); //普通的sql查询花费的时间 StringBuilder builder = new StringBuilder(); builder.Append("select * from "); builder.Append("(select ROW_NUMBER() over(order by s.ShopID) as NumberID, "); builder.Append(" s.ShopID, u.UserName, s.ShopName "); builder.Append("from Shop s left join [User] as u on u.UserID=s.UserID "); builder.Append("where s.UserID=15) as array "); builder.Append("where NumberID>300000 and NumberID<300050"); watch.Start(); SqlHelper.Query(builder.ToString()); watch.Stop(); Console.WriteLine("普通的sql分页 >>>花费时间:" + watch.ElapsedMilliseconds); Console.Read(); }
public void TestGetStructureAddress() { // arrange var statementService = new AddressClient(); // act var structureAddress = statementService.GetStructureAddress(new Guid("CDDF07A5-9617-4911-A6A4-122032151907")); // assert Assert.IsNotNull(structureAddress); Assert.AreEqual(structureAddress.Subject, "Белгородская обл"); Assert.AreEqual(structureAddress.Area, "Красногвардейский р-н"); Assert.AreEqual(structureAddress.Town, "Палатово с"); Assert.AreEqual(structureAddress.Code, "3101200005702"); Assert.AreEqual(structureAddress.OkatoRn, "14242000000"); Assert.IsNull(structureAddress.City); Assert.IsNull(structureAddress.Street); }
public void should_simple_synchronous_call_getbalance_with_bad_address_throws_exception() { AddressClient client = new AddressClient(); ExceptionWithMessage <AddressError> typedException = null; try { client.GetBalance(Network.Doge, Consts.Wrong, 1000000); } catch (Exception e) { typedException = e?.InnerException as ExceptionWithMessage <AddressError>; } Assert.IsNotNull(typedException); Assert.IsNotNull(typedException.ErrorMessage); Assert.IsTrue(typedException.ErrorMessage.Status == Consts.Fail); Assert.IsTrue(typedException.ErrorMessage.Data.Address == "A valid address is required"); }
public void should_simple_synchronous_call_getspentvalue_with_bad_address_throws_exception() { AddressClient client = new AddressClient(); ExceptionWithMessage <AddressSentValueError> typedException = null; try { client.GetSpentValue(Network.Doge, Consts.Wrong); } catch (Exception e) { typedException = e?.InnerException as ExceptionWithMessage <AddressSentValueError>; } Assert.IsNotNull(typedException); Assert.IsNotNull(typedException.ErrorMessage); Assert.IsTrue(typedException.ErrorMessage.Status == Consts.Fail); Assert.IsTrue(typedException.ErrorMessage.Data.Address == Consts.ValidAddressRequired); }
public void should_simple_synchronous_call_getreceivedtx_with_bad_address_throws_exception() { AddressClient client = new AddressClient(); ExceptionWithMessage <AddressAfterTxError> typedException = null; try { client.GetReceivedTx(Network.Doge, Consts.Wrong, "e83d147c3bcd87c6efd5270896a179f6ecb1de8b8c8cc324645c5a14129baf8c"); } catch (Exception e) { typedException = e?.InnerException as ExceptionWithMessage <AddressAfterTxError>; } Assert.IsNotNull(typedException); Assert.IsNotNull(typedException.ErrorMessage); Assert.IsTrue(typedException.ErrorMessage.Status == Consts.Fail); Assert.IsTrue(typedException.ErrorMessage.Data.AfterTx == "Return 100 transactions that occurred after this Transaction ID"); }
public void should_simple_synchronous_call_getspenttx_with_bad_address_throws_exception() { AddressClient client = new AddressClient(); ExceptionWithMessage <AddressAfterTxError> typedException = null; try { client.GetSpentTx(Network.Doge, Consts.Wrong); } catch (Exception e) { typedException = e?.InnerException as ExceptionWithMessage <AddressAfterTxError>; } Assert.IsNotNull(typedException); Assert.IsNotNull(typedException.ErrorMessage); Assert.IsTrue(typedException.ErrorMessage.Status == Consts.Fail); Assert.IsTrue(typedException.ErrorMessage.Data.AfterTx == "Retrieve 100 transactions that occurred after this transaction ID"); }
private void Address_Click(object sender, RoutedEventArgs e) { var contract = new AddressRequest { Cep = Cep.Text }; var addressClient = new AddressClient(); var addressInfo = Task.Run(() => addressClient.GetAddressInfo(contract)).Result; if (addressInfo != null && string.IsNullOrWhiteSpace(addressInfo.Uf)) { AddressInfo.Text = "Erro ao recuperar os dados do endereço"; return; } AddressInfo.Text = $"{addressInfo.Logradouro}\n{addressInfo.Bairro} / {addressInfo.Localidade} / {addressInfo.Uf}\n{addressInfo.Cep}"; }
static void AddSearch() { startTime = DateTime.Now; Console.WriteLine("Search服务发送中.....\n\n*************************************************\n"); try { var heartClient = new AddressClient(new InstanceContext(new SearchHost())); string search = ConfigurationManager.AppSettings["search"]; heartClient.AddSearch(search); } catch (Exception ex) { Console.WriteLine("Search服务发送失败:" + ex.Message); } }
static void AddSearch() { startTime = DateTime.Now; Console.WriteLine("Search服务发送中.....\n\n*************************************************\n"); try { var heartClient = new AddressClient(new InstanceContext(new SearchHost())); //var heartClient = new AddressClient(new InstanceContext(new MyAddressCallback())); string search = ConfigurationManager.AppSettings["search"]; heartClient.AddSearch(search); } catch (Exception ex) { Console.WriteLine("Search服务发送失败:" + ex.Message); } }
public OperatorsController(OperatorClient operators, AddressClient addresses) { _operators = operators; _addresses = addresses; }