public virtual NYCInformationByAddressResultsNYCInformationByAddress[] NYCInformationByAddress([System.Xml.Serialization.XmlElementAttribute("NYCInformationByAddress", Namespace = "http://schools.nyc.gov/DOE.Services.Geography/GeoSupportService_v1_0")] AddressInfo nYCInformationByAddress1) { Log.Debug(string.Format("NYCInformationByAddress params: {0} --- {1} --- {2}", nYCInformationByAddress1.HouseNumber, nYCInformationByAddress1.StreetName, nYCInformationByAddress1.BoroughOrZipCode)); NYCInformationByAddressResultsNYCInformationByAddress[] results = ServiceLogic.NYCInformationByAddressResultsNYCInformationByAddress(nYCInformationByAddress1.HouseNumber, nYCInformationByAddress1.StreetName, nYCInformationByAddress1.BoroughOrZipCode); return(results); }
public void XmlToJson() { // Arrange string result = ServiceLogic.XmlToJson("<foo>hello</bar>"); Assert.AreEqual("Bad Xml format", result); result = ServiceLogic.XmlToJson("<TRANS><HPAY><ID>103</ID><STATUS>3</STATUS><EXTRA><IS3DS>0</IS3DS><AUTH>031183</AUTH></EXTRA><INT_MSG/><MLABEL>501767XXXXXX6700</MLABEL><MTOKEN>project01</MTOKEN></HPAY></TRANS>"); Assert.AreNotEqual(result, "Bad Xml format"); var testObject = new XMLJsonTester { XmlJsonProp1 = "Scott Hall A.K.A. Razor Ramon", XmlJsonProp2 = "Kevin Nash A.K.A. Disel", XmlJsonProp3 = "Sean Waltman A.K.A. 1 2 3 Kid", XmlJsonProp4 = "Hulk Hogan A.K.A. Hollywood", XmlJsonProp5 = "Jake Roberts A.K.A The Snake" }; var xmlValue = testObject.Serialize(); result = ServiceLogic.XmlToJson(xmlValue); var resultObj = JsonConvert.DeserializeObject <DeserializeContent>(result); Assert.AreEqual(testObject.XmlJsonProp1, resultObj.XMLJsonTester.XmlJsonProp1); Assert.AreEqual(testObject.XmlJsonProp2, resultObj.XMLJsonTester.XmlJsonProp2); Assert.AreEqual(testObject.XmlJsonProp3, resultObj.XMLJsonTester.XmlJsonProp3); Assert.AreEqual(testObject.XmlJsonProp4, resultObj.XMLJsonTester.XmlJsonProp4); Assert.AreEqual(testObject.XmlJsonProp5, resultObj.XMLJsonTester.XmlJsonProp5); }
public NewOrderWindow() { InitializeComponent(); dt = DeviceLogic.GetDeviceList(DeviceEnum.None, ""); DeviceList.ItemsSource = dt.DefaultView; Service.ItemsSource = ServiceLogic.GetService(); }
private void SaveAccountInfoInStorage() { var companyNumber = SelectedCompanyHeadNumber; var contactNumber = GetPhoneHeadNumber(SelectedContactHeadNumber); if (AccountInformation.AccountId != null) { ServiceLogic.Update(SelectedAccountInfo); // 여기서 업데이트를 할 것입니다..... // 아이디 값이 없으면 //AccountList.Add(ServiceLogic.Update(AccountInformation)); return; } if (IsCompatibility(companyNumber, contactNumber) != true) { MessageBox.Show("값을 넣어주세요"); return; } ShowAddedAccount(ServiceLogic.Insert(AccountInformation)); MessageBox.Show("성공"); }
public virtual ZoneInfoByAddressResultsZoneInfoByAddress[] ZoneInformationByAddress([System.Xml.Serialization.XmlElementAttribute("ZoneInformationByAddress", Namespace = "http://schools.nyc.gov/DOE.Services.Geography/GeoSupportService_v1_0")] AddressInfo zoneInformationByAddress1) { Log.Debug(string.Format("ZoneInformationByAddress params: {0} --- {1} --- {2}", zoneInformationByAddress1.HouseNumber, zoneInformationByAddress1.StreetName, zoneInformationByAddress1.BoroughOrZipCode)); ZoneInfoByAddressResultsZoneInfoByAddress[] results = ServiceLogic.ZoneInfobyAddressResultsZoneInfoByAddress(zoneInformationByAddress1.HouseNumber, zoneInformationByAddress1.StreetName, zoneInformationByAddress1.BoroughOrZipCode); Log.Debug("Service Logic Successful"); return(results); }
public async Task <IEnumerable <MessageResponse> > Get(string userNameTo, string dateFrom) { ServiceLogic serviceLogic = new ServiceLogic(); var userManager = new ApplicationUserManager(new UserStore <ApplicationUserEntity>(SqlDbContext.Create())); var currentUserTask = await userManager.FindByNameAsync(User.Identity.Name); var userToTask = await userManager.FindByNameAsync(userNameTo); return(serviceLogic.Get(currentUserTask.Id, userToTask.Id, DateTime.Parse(dateFrom))); }
public async Task <IHttpActionResult> Post([FromBody] Message message) { ServiceLogic serviceLogic = new ServiceLogic(); var userManager = new ApplicationUserManager(new UserStore <ApplicationUserEntity>(SqlDbContext.Create())); var userFromTask = await userManager.FindByNameAsync(User.Identity.Name); var userToTask = await userManager.FindByNameAsync(message.UserNameTo); serviceLogic.SendMessage(userFromTask.Id, userToTask.Id, DateTime.Now, message.MessageText); return(Ok()); }
public async Task OnGetAsync() { ClientUser clientUser = await UserLogic.GetUserAsync(User); Services = await ServiceLogic.GetMyServicesAsync(clientUser.Id); ActiveServices = ServiceLogic.GetMyActiveServices(Services); FinishedServices = ServiceLogic.GetMyFinishedServices(Services, ActiveServices); History = ServiceLogic.GetFullServiceHistory(Services); }
//Callback for MQTT publishing. async void IServiceCallback.MQTTPublish(string topic, string message) { await mqttClientSemaphore.WaitAsync(); try { await ServiceLogic.ManagedMqttPublish(managedMqtt, topic, message); } finally { mqttClientSemaphore.Release(); } }
public async void MQTTConnectClient(IManagedMqttClient managedMqtt, string brokerIP) { await mqttClientSemaphore.WaitAsync(); try { await ServiceLogic.ManagedMqttConnectWebSocket(managedMqtt, brokerIP); } finally { mqttClientSemaphore.Release(); } }
static void Main(string[] args) { string fakedServiceName = "MicrotingOdense"; ServiceLogic serveiceLogic = new ServiceLogic(); //serveiceLogic.OverrideServiceLocation("c:\\microtingservice\\" + fakedServiceName + "\\"); serveiceLogic.Start(); Console.WriteLine("Press any key to close"); Console.ReadKey(); serveiceLogic.Stop(); }
//Callback for MQTT connection. async void IServiceCallback.MQTTConnect(string brokerIP) { await mqttClientSemaphore.WaitAsync(); try { managedMqtt = ServiceLogic.CreateManagedClient(); await ServiceLogic.ManagedMqttConnectWebSocket(managedMqtt, brokerIP); } finally { mqttClientSemaphore.Release(); } }
//Callback for MQTT unsubscription. async void IServiceCallback.MQTTUnsubscribe(String topic) { await mqttClientSemaphore.WaitAsync(); try { ServiceLogic.ManagedMqttUnsubscribe(managedMqtt, topic); m_topicSet.Remove(topic); } finally { mqttClientSemaphore.Release(); } }
public void Search() { var logic = new ServiceLogic(new ServiceRepository()); try { var services = logic.SearchDescription("", 10, 1); Assert.Fail("You should get an exception!"); } catch (Exception ex) { Assert.AreEqual(ex.Message, "The filter is empty!"); } }
private void DataInitialize() { SelectedAccountInfo = new Account(); AccountInformation = new Account(); var accountList = ServiceLogic.GetAll(); if (accountList != null && accountList.Any()) { AccountList = new ObservableCollection <Account>(accountList); return; } AccountList = new ObservableCollection <Account>(); }
private void DeleteAccountInfoInStorage(object selectedList) { if (selectedList is null) { return; } var selectedAccount = selectedList as Account; ServiceLogic.Delete(selectedAccount.AccountId); if (AccountList.Count() > 0) { AccountList.Remove(selectedAccount); } MessageBox.Show($"{selectedAccount.CompanyName}이 삭제되었습니다."); }
public async Task AddService_AddingService_ServiceAdded() { var serviceData = new List <Service>().AsQueryable(); var serviceMockSet = new Mock <DbSet <Service> >(); serviceMockSet.As <IDbAsyncEnumerable <Service> >() .Setup(m => m.GetAsyncEnumerator()) .Returns(new TestDbAsyncEnumerator <Service>(serviceData.GetEnumerator())); serviceMockSet.As <IQueryable <Service> >() .Setup(m => m.Provider) .Returns(new TestDbAsyncQueryProvider <Service>(serviceData.Provider)); serviceMockSet.As <IQueryable <Service> >().Setup(m => m.Expression).Returns(serviceData.Expression); var serviceDateData = new List <ServiceDate>().AsQueryable(); var serviceDateMockSet = new Mock <DbSet <ServiceDate> >(); serviceDateMockSet.As <IDbAsyncEnumerable <ServiceDate> >() .Setup(m => m.GetAsyncEnumerator()) .Returns(new TestDbAsyncEnumerator <ServiceDate>(serviceDateData.GetEnumerator())); serviceDateMockSet.As <IQueryable <ServiceDate> >() .Setup(m => m.Provider) .Returns(new TestDbAsyncQueryProvider <ServiceDate>(serviceDateData.Provider)); serviceDateMockSet.As <IQueryable <ServiceDate> >() .Setup(m => m.Expression) .Returns(serviceDateData.Expression); var mockContext = new Mock <ExtremeSportDBEntities>(); mockContext.Setup(m => m.Service).Returns(serviceMockSet.Object); mockContext.Setup(m => m.ServiceDate).Returns(serviceDateMockSet.Object); var serviceLogic = new ServiceLogic { Context = mockContext.Object }; var b = await serviceLogic.AddService(new DtoService { InstructorId = 1, Dates = new List <DateTime> { new DateTime(1944, 05, 09) }, ServiceTypeId = 1 }); Assert.AreEqual(b, true); serviceMockSet.Verify(m => m.Add(It.IsAny <Service>()), Times.Once()); mockContext.Verify(m => m.SaveChangesAsync(), Times.Once()); }
public async Task EnrolCourse_EnrolingCourse_CourseEnrolled() { var serviceList = new List <Service> { new Service { id = 1 } }; var serviceData = serviceList.AsQueryable(); var serviceMockSet = new Mock <DbSet <Service> >(); serviceMockSet.As <IDbAsyncEnumerable <Service> >() .Setup(m => m.GetAsyncEnumerator()) .Returns(new TestDbAsyncEnumerator <Service>(serviceData.GetEnumerator())); serviceMockSet.As <IQueryable <Service> >() .Setup(m => m.Provider) .Returns(new TestDbAsyncQueryProvider <Service>(serviceData.Provider)); serviceMockSet.As <IQueryable <Service> >().Setup(m => m.Expression).Returns(serviceData.Expression); var customerList = new List <Customer> { new Customer { id = 1 } }; var customerData = customerList.AsQueryable(); var customerMockSet = new Mock <DbSet <Customer> >(); customerMockSet.As <IDbAsyncEnumerable <Customer> >() .Setup(m => m.GetAsyncEnumerator()) .Returns(new TestDbAsyncEnumerator <Customer>(customerData.GetEnumerator())); customerMockSet.As <IQueryable <Customer> >() .Setup(m => m.Provider) .Returns(new TestDbAsyncQueryProvider <Customer>(customerData.Provider)); customerMockSet.As <IQueryable <Customer> >().Setup(m => m.Expression).Returns(customerData.Expression); var mockContext = new Mock <ExtremeSportDBEntities>(); mockContext.Setup(m => m.Service).Returns(serviceMockSet.Object); mockContext.Setup(m => m.Customer).Returns(customerMockSet.Object); var serviceLogic = new ServiceLogic { Context = mockContext.Object }; var b = await serviceLogic.EnrolCourse(1, 1); Assert.AreEqual(b, true); mockContext.Verify(m => m.SaveChangesAsync(), Times.Once()); }
public async Task <JsonResult> CreateService([FromBody] CreateServiceHttpParams attr) { if (attr.Type == "node") { Logger.Log("Creating Node Js service"); Logger.Log(JsonConvert.SerializeObject(attr.Dependencies)); try { ICloudService service = ServiceLogic.CreateCloudService(attr.Id, attr.UserId, attr.FileBase64, attr.CountOfReplicas, attr.Dependencies, attr.Type); bool success = await service.Create(); ServiceLogic.Services.Add(service); return(new JsonResult(service)); } catch (Exception e) { Logger.Fail(e.Message); } } throw new Exception("Unknown type!"); }
//Callback for MQTT subscription. async void IServiceCallback.MQTTSubscribe(String topic) { await mqttClientSemaphore.WaitAsync(); try { if (m_topicSet.Contains(topic)) { return; } else { ServiceLogic.ManagedMqttSubscribe(managedMqtt, topic); m_topicSet.Add(topic); } } finally { mqttClientSemaphore.Release(); } }
private async Task <bool> makeReinitAsync(ReinitServiceHttpParams reinit, List <ReinitServiceHttpParams> attr, List <SwarmService> servicesList) { SwarmService swarmService = servicesList.Find(service => service.ID == reinit.DockerServiceId); Logger.Log($"Reinit service : {reinit.Id}, {reinit.DockerServiceId}, serviceList : {JsonConvert.SerializeObject(servicesList.Select(el => el.ID))}"); string dockerName = $"{reinit.UserId}-{reinit.Id}"; if (swarmService != null) { ICloudService service = ServiceLogic.CreateCloudService(reinit.Type); await service.Reinitialize(reinit, swarmService); ServiceLogic.Services.Add(service); } else { ICloudService service = ServiceLogic.CreateCloudService(reinit.Id, reinit.UserId, reinit.FileBase64, reinit.CountOfReplicas, reinit.Dependencies, reinit.Type); ServiceLogic.Services.Add(service); await service.Create(); } return(true); }
/// <summary> /// 添加构架应用程序 /// </summary> /// <param name="ProjectCommon"></param> private void AddSchameLib(bool overWrite = true) { try { if (SolutionCommon.infrastryctType == InfrastructType.CodeFirst) { InfrastructureLogic.CreateCodeFirst(overWrite); DomainEntityLogic.CreateCodeFirst(overWrite); } else { InfrastructureLogic.Create(overWrite); DomainEntityLogic.Create(overWrite); } RepositoryLogic.Create(overWrite); Data2ObjLogic.Create(overWrite); ApplicationLogic.Create(overWrite); if (SolutionCommon.IsAddService) { ServiceLogic.CreateFrame(overWrite); ServiceLogic.CreateCode(overWrite); } else { ProjectContainer.Service = null; } //保存解决方案 if (_dte.Solution.Saved == false) { _dte.Solution.SaveAs(_dte.Solution.FullName); } } catch (Exception ex) { MsgBoxHelp.ShowError("Entity2Code Error:", ex); } }
protected override void OnStart(string[] args) { try { createDirectories(); //Set the static callback reference and creates interface for WinForms by hosting a WCF Service. Host.Current = this; StartBroker(); // Log an event to indicate successful start. EventLog.WriteEntry("Successful start.", EventLogEntryType.Information); //Initialize MQTT Client. managedMqtt = ServiceLogic.CreateManagedClient(); //MQTT Broker connection string brokerIP = "dev-harmony-01.southeastasia.cloudapp.azure.com:8080/mqtt"; MQTTConnectClient(managedMqtt, brokerIP); //Initialize OPC Application Instance application = new ApplicationInstance { ApplicationName = "MQTT-OPC Broker", ApplicationType = ApplicationType.ClientAndServer, ConfigSectionName = "Opc.Ua.SampleClient" }; //load the application configuration. application.LoadApplicationConfiguration(false).Wait(); // check the application certificate. application.CheckApplicationInstanceCertificate(false, 0).Wait(); m_configuration = app_configuration = application.ApplicationConfiguration; // get list of cached endpoints. m_endpoints = m_configuration.LoadCachedEndpoints(true); m_endpoints.DiscoveryUrls = app_configuration.ClientConfiguration.WellKnownDiscoveryUrls; if (!app_configuration.SecurityConfiguration.AutoAcceptUntrustedCertificates) { app_configuration.CertificateValidator.CertificateValidation += new CertificateValidationEventHandler(CertificateValidator_CertificateValidation); } //If there was a pre-exising session before, attempt reconnection. foreach (string sessionFile in Directory.GetFiles(sessionsFolder, "*.json")) { String[] sessions = File.ReadAllLines(sessionFile); foreach (string retainedEndpoint in sessions) { if (retainedEndpoint != "") { try { OPCConnect(application, retainedEndpoint); sessionEndpoint = retainedEndpoint; break; } catch { //Ignore exception as server may not be up. } break; } } String readSession = File.ReadAllText(sessionFile); } serviceCheck = true; //Use timer callback to monitor and publish subscriptions. publishTimer = new System.Threading.Timer(x => OPCPublish(m_session), null, 5000, 1000); } catch (Exception ex) { EventLog.WriteEntry(ex.Message, EventLogEntryType.Error); } }
public virtual PropertyLevelInformationByAddressResults PropertyLevelInformationbyAddress([System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified, ElementName = "HouseNumber")] string HouseNumber, [System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified, ElementName = "StreetName")] string StreetName, [System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified, ElementName = "Borough")] string Borough) { return(ServiceLogic.PropertyLevelInformationbyAddress(HouseNumber, StreetName, Borough)); }
public virtual GeographicInformationByIntersectionResults GeographicInformationbyIntersection([System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified, ElementName = "StreetName1")] string StreetName1, [System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified, ElementName = "Borough1")] string Borough1, [System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified, ElementName = "StreetName2")] string StreetName2, [System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified, ElementName = "Borough2")] string Borough2) { return(ServiceLogic.GeographicInformationbyIntersection(StreetName1, Borough1, StreetName2, Borough2)); }
public void FaultCheck() { var service = new ServiceLogic(); service.AddEmployee(allBadEmployee, "строка подключения"); }
public void OnResultExecuted(ResultExecutedContext context) { ServiceLogic.EntryLog(); }
private void Service_SelectionChanged(object sender, SelectionChangedEventArgs e) { Sale.Content = $"Первоначальная стоимость услуги\n(Без учета затрат материалов)\nсоставляет : {ServiceLogic.GetSaleService(Service.SelectedIndex + 1)} рублей"; }
public int Fibonacci(int N) { return(ServiceLogic.Fibonacci(N)); }
public string XmlToJson(string xml) { return(ServiceLogic.XmlToJson(xml)); }