public void SyncStates() { lock (_libAtemStateLock) { _libAtemState = SdkClient.BuildState(); } }
/// <summary> /// 获取学生卡打印信息 /// <para>作 者: Huan GaoLiang </para> /// <para>创建时间: 2019-03-06 </para> /// </summary> /// <param name="studentId">学生编号</param> /// <param name="schoolId">校区编号</param> /// <returns>返回学生证信息</returns> /// <returns>修改结果数</returns> /// <exception> /// 异常ID:1,系统不存在该学生 /// </exception> public StudentCardResponse GetStudentCard(long studentId, string schoolId) { StudentCardResponse studentCar = new StudentCardResponse(); // 1、根据学生编号查询学生信息 TblCstStudent student = _studentRepository.Value.GetCstStudentId(studentId); if (student == null) { throw new BussinessException((byte)ModelType.Customer, 1); } studentCar.StudentId = student.StudentId; studentCar.HeadFaceUrl = student.HeadFaceUrl; studentCar.StudentNo = student.StudentNo; studentCar.StudentName = student.StudentName; // 2、获取基础配置中的公司log和学生证反面信息 var companyId = SdkClient.CreateDimCommonService().GetAllSchool().FirstOrDefault(m => m.SchoolId == schoolId)?.CompanyId; var schoolSetting = new HomeSchoolSettingService().GetSettingList(companyId); studentCar.CompanyImage = schoolSetting.FirstOrDefault(m => m.FuntionId == (int)HomeSchoolBusinessType.StudentCradUp)?.DataValue; studentCar.NegativeImage = schoolSetting.FirstOrDefault(m => m.FuntionId == (int)HomeSchoolBusinessType.StudentCradDown)?.DataValue; return(studentCar); }
private void btnInstall_ClickAsync(object sender, EventArgs e) { var dot = installDtoBindingSource.Current as InstallDto; if (dot != null) { btnInstall.Enabled = false; Task.Run(async() => { try { var Client = SdkClient.Create <InstallerClient>(); var result = await Client.InstallAsync(dot); Invoke((MethodInvoker) delegate { btnInstall.Enabled = true; if (result.Installed) { DialogResult = DialogResult.OK; } }); } catch (SwaggerException se) { this.Invoke((MethodInvoker) delegate { libinfo.Text = se.ToResult().Msg; btnInstall.Enabled = true; }); } }); } }
public async Task <IPlatformResponse <IAuthorization> > Login(string mojioApiToken, CancellationToken?cancellationToken = null, IProgress <ISDKProgress> progress = null) { if (this.Authorization == null) { this.Authorization = new CoreAuthorization(); } this.Authorization.MojioApiToken = mojioApiToken; this.Authorization.ExpiresIn = int.MaxValue; return(await SdkClient.Login(this.Authorization)); }
static void Main(string[] args) { // Demo environment Initialize(); // Get these values from environment vars - could do this in an Azure App to retrieve from App Settings string endpoint = Environment.GetEnvironmentVariable(COSMOS_DB_ENDPOINT); string primaryKey = Environment.GetEnvironmentVariable(COSMOS_DB_KEY); SdkClient sdkClient = new SdkClient(endpoint, primaryKey); SdkClientResult listDatabasesResult = sdkClient.ListDatabasesAsync().Result; WriteOut("List Databases", listDatabasesResult.RequestInfo.AsJson(true), listDatabasesResult.Content.AsJson(true)); SdkClientResult getDatabaseResult = sdkClient.GetDatabaseAsync(_databaseId).Result; WriteOut($"Get Database {_databaseId}", getDatabaseResult.RequestInfo.AsJson(true), getDatabaseResult.Content.AsJson(true)); SdkClientResult listCollectionsResult = sdkClient.ListCollectionsAsync(_databaseId).Result; WriteOut("List Collections", listCollectionsResult.RequestInfo.AsJson(true), listCollectionsResult.Content.AsJson(true)); SdkClientResult getCollectionResult = sdkClient.GetCollectionAsync(_databaseId, _collectionId).Result; WriteOut($"Get Collection {_collectionId}", getCollectionResult.RequestInfo.AsJson(true), getCollectionResult.Content.AsJson(true)); SdkClientResult listDocumentsResult = sdkClient.ListDocumentsAsync(_databaseId, _collectionId).Result; WriteOut("List Documents", listDocumentsResult.RequestInfo.AsJson(true), listDocumentsResult.Content.AsJson(true)); SdkClientResult <SampleItem> getDocumentResult = sdkClient.GetDocumentAsync <SampleItem>(_databaseId, _collectionId, _documentId, _partitionKey).Result; WriteOut($"Get Document {_documentId} with partition key {_partitionKey}", getDocumentResult.RequestInfo.AsJson(true), getDocumentResult.Content.AsJson(true)); SampleItem newDoc = GetNewDocument(); SdkClientResult <SampleItem> upsertResult = sdkClient.UpsertAsync <SampleItem>(_databaseId, _collectionId, newDoc, _partitionKey).Result; WriteOut("Upsert", upsertResult.RequestInfo.AsJson(true), upsertResult.Content.AsJson(true)); string query = $"SELECT * FROM c WHERE c.partitionKey = \"{_partitionKey}\""; SdkClientResult <List <SampleItem> > queryResult = sdkClient.QueryAsync <SampleItem>(_databaseId, _collectionId, query).Result; WriteOut($"Query: {query}", queryResult.RequestInfo.AsJson(true), queryResult.Content.AsJson(true)); string sprocName = "getItem"; SdkClientResult <SampleItem> sprocResult = sdkClient.ExecSprocAsync <SampleItem>(_databaseId, _collectionId, sprocName, _documentId, _partitionKey).Result; WriteOut($"Sproc: {sprocName}", sprocResult.RequestInfo.AsJson(true), sprocResult.Content.AsJson(true)); Console.WriteLine("Press any key to exit"); Console.ReadKey(); }
private async void btnAttTest_ItemClick(object sender, ItemClickEventArgs e) { var dev = SdkClient.Create <DevicesClient>(); var dis = new Dictionary <string, object>(); dis.Add("boolvalue", true); dis.Add("jsonvalue", new { a = 1, b = "sss", c = false, e = DateTime.Now }); dis.Add("longvalue", 2342343L); dis.Add("Doublevalue", 2332.322); await dev.Attributes2Async(txtToken.EditValue.ToString(), dis); await ReloadLatest(); }
public async Task <IPlatformResponse <IAuthorization> > Login(string username, string password, string scope = "full", CancellationToken?cancellationToken = null, IProgress <ISDKProgress> progress = null) { SdkClient = Container.Resolve <IClient>(); var result = await SdkClient.Login(username, password, scope, cancellationToken, progress); Authorization = result.Response; if (!string.IsNullOrEmpty(Authorization?.MojioApiToken) && !Authorization.HasExpired && _authManager != null) { await _authManager.SaveAuthorization(result.Response); } return(result); }
public async Task <IPlatformResponse <IAuthorization> > Login(IAuthorization authorization, CancellationToken?cancellationToken = null, IProgress <ISDKProgress> progress = null) { SetupTokenAndProgress(cancellationToken, progress); var result = await SdkClient.Login(authorization, cancellationToken, progress); Authorization = result.Response; if (_authManager != null && (authorization?.Signature != Authorization?.Signature) && !string.IsNullOrEmpty(authorization?.Signature) && !string.IsNullOrEmpty(Authorization?.Signature)) { await _authManager.SaveAuthorization(Authorization); } return(result); }
private async Task ReloadLatest() { try { Device row = null; this.Invoke((MethodInvoker) delegate { row = FocusedRow; if (row != null) { rpgModBus.Enabled = row.DeviceType == DeviceType.Gateway; if (row.DeviceType == DeviceType.Gateway) { modBusConfigBindingSource.DataSource = new ModBusConfig() { Address = "100", KeyNameOrPrefix = "ModBus", ModBusUri = new Uri("modbus://127.0.0.1:502/1"), Lenght = 1, ValueType = "UInt32", DataType = "Telemetry" };; } } }); if (row != null) { var dev = SdkClient.Create <DevicesClient>(); var al = await dev.GetTelemetryLatestAllAsync(row.Id); var tl = await dev.GetAttributeLatestAllAsync(row.Id); var ddds = from d in tl select new DeviceDataDto(d); this.Invoke((MethodInvoker) delegate { attributeLatestBindingSource.DataSource = al; deviceDataDtoBindingSource.DataSource = ddds; telemetryLatestBindingSource.DataSource = tl; }); } } catch (Exception ex) { this.Invoke((MethodInvoker) delegate { lblInfo.Caption = ex.Message; }); } }
private async void BtnConfigBus_ItemClickAsync(object sender, ItemClickEventArgs e) { ModBusConfig modBus = new ModBusConfig() { Address = txtAddress.EditValue.ToString(), DataType = cbxDataType.EditValue.ToString(), KeyNameOrPrefix = txtExtModbus.EditValue.ToString(), Lenght = int.Parse(txtLenght.EditValue.ToString()), ModBusUri = new Uri(txtModBusUri.EditValue.ToString()), ValueType = cbxValueType.EditValue.ToString() }; var dev = SdkClient.Create <DevicesClient>(); var dis = new Dictionary <string, object>(); dis.Add("ModBusConfig", modBus); await dev.Attributes2Async(txtToken.EditValue.ToString(), dis); await ReloadLatest(); }
private async void btnLogin_ClickAsync(object sender, EventArgs e) { var Client = SdkClient.Create <IoTSharp.Sdk.Http.AccountClient>(); string username = txtUserName.Text; string password = txtPassword.Text; if (string.IsNullOrEmpty(username) || string.IsNullOrEmpty(password)) { lblInfo.Text = "密码或用户名为空"; } else { try { var result = await Client.LoginAsync(username, password); if (result.IsLogin) { DialogResult = DialogResult.OK; } else { lblInfo.Text = "密码错误"; } } catch (SwaggerException sex) { var result = sex.ToResult(); if (result != null) { lblInfo.Text = $"错误代码:{result.Code},错误:{result.Msg}"; } else { lblInfo.Text = sex.Message; } } catch (Exception) { throw; } } }
private void frmLogin_Load(object sender, EventArgs e) { lblVersion.Text = "V" + AppUtils.AssemblyVersion; btnLogin.Enabled = false; lblInfo.Text = "正在检查服务器..."; cts.Token.Register(() => Console.WriteLine(DateTime.Now.ToString() + "取消")); Task.Run(async() => { try { var Client = SdkClient.Create <IoTSharp.Sdk.Http.InstallerClient>(); var fr = await Client.InstanceAsync(); this.Invoke((MethodInvoker) delegate { if (fr.Installed) { btnLogin.Enabled = true; lblInfo.Text = "服务器就绪"; lblVersion.Text = fr.Version; } else { DialogResult = DialogResult.No; } }); } catch (SwaggerException se) { this.Invoke((MethodInvoker) delegate { lblInfo.Text = se.ToResult().ToString(); }); } catch (Exception ex) { this.Invoke((MethodInvoker) delegate { lblInfo.Text = ex.Message; }); } }, cts.Token); }
private async void btnGetToken_ItemClickAsync(object sender, ItemClickEventArgs e) { try { var row = FocusedRow; if (row != null) { var dev = SdkClient.Create <DevicesClient>(); var ids = await dev.GetIdentityAsync(row.Id); txtToken.EditValue = ids.IdentityId; //XtraMessageBox.Show(ids.ToJson()); lblInfo.Caption = "已经获取到该设备Token"; } } catch (Exception ex) { XtraMessageBox.Show(ex.Message); } }
private async Task ReloadLatest() { try { var row = FocusedRow; if (row != null) { var dev = SdkClient.Create <DevicesClient>(); var al = await dev.GetAttributeLatestAsync(row.Id); var tl = await dev.GetTelemetryLatestAsync(row.Id); attributeLatestBindingSource.DataSource = al; telemetryLatestBindingSource.DataSource = tl; } } catch (Exception ex) { lblInfo.Caption = ex.Message; } }
private async Task ReloadLatest() { try { Device row = null; this.Invoke((MethodInvoker)async delegate { var dev = SdkClient.Create <DevicesClient>(); var ids = await dev.GetIdentityAsync(Device.Id); txtToken.EditValue = ids.IdentityId; //XtraMessageBox.Show(ids.ToJson()); lblInfo.Caption = "已经获取到该设备Token"; }); if (row != null) { var dev = SdkClient.Create <DevicesClient>(); var al = await dev.GetAttributeLatestAllAsync(row.Id); var tl = await dev.GetTelemetryLatestAllAsync(row.Id); this.Invoke((MethodInvoker) delegate { attributeLatestBindingSource.DataSource = al; telemetryLatestBindingSource.DataSource = tl; }); } } catch (Exception ex) { this.Invoke((MethodInvoker) delegate { lblInfo.Caption = ex.Message; }); } }
private void frmCustomerAdmin_Load(object sender, EventArgs e) { InitializeGridView(gridView1, colId); Client = SdkClient.Create <DevicesClient>(); enumKeyValueBindingSource.BindingEnum <DeviceType>(); }
public PaymentController(RegisterUserService registerUserService, InstitutionService institutionService) { BuckarooClient = new SdkClient(); _registerUser = registerUserService; _institutionService = institutionService; }
private void frmCustomerAdmin_Load(object sender, EventArgs e) { InitializeGridView(gridView, colId); Client = SdkClient.Create <CustomersClient>(); }
public void Setup() { this._sdkClient = new SdkClient(Constants.TestSettings.Logger); }
public async Task <IPlatformResponse <IGroup> > CreateGroup(IGroup @group, CancellationToken?cancellationToken = null, IProgress <ISDKProgress> progress = null) { SetupTokenAndProgress(cancellationToken, progress); return(await SdkClient.CreateGroup(@group, cancellationToken, progress)); }
public AtemState BuildSdkState() => SdkClient.BuildState();
public async Task <IPlatformResponse <IApp> > CreateApp(IApp application, CancellationToken?cancellationToken = null, IProgress <ISDKProgress> progress = null) { SetupTokenAndProgress(cancellationToken, progress); return(await SdkClient.CreateApp(application, cancellationToken, progress)); }
public void Setup() { this._buckarooClient = new SdkClient(TestSettings.Logger); }
public async Task <IPlatformResponse <IMessageResponse> > DeleteTag(TagEntities entityType, Guid entityId, string tag, CancellationToken?cancellationToken = null, IProgress <ISDKProgress> progress = null) { SetupTokenAndProgress(cancellationToken, progress); return(await SdkClient.DeleteTag(entityType, entityId, tag, cancellationToken, progress)); }
public async Task <IPlatformResponse <IMessageResponse> > DeleteApp(Guid id, CancellationToken?cancellationToken = null, IProgress <ISDKProgress> progress = null) { SetupTokenAndProgress(cancellationToken, progress); return(await SdkClient.DeleteApp(id, cancellationToken, progress)); }
public frmTenantAdmin() { InitializeComponent(); InitializeGridView(gridView, colId); Client = SdkClient.Create <TenantsClient>(); }
public async Task <IPlatformResponse <IList <string> > > AddUserToGroup(Guid id, IList <Guid> users, CancellationToken?cancellationToken = null, IProgress <ISDKProgress> progress = null) { SetupTokenAndProgress(cancellationToken, progress); return(await SdkClient.AddUserToGroup(id, users, cancellationToken, progress)); }
public async Task <IPlatformResponse <IMessageResponse> > RemoveUserFromGroup(Guid id, Guid userId, CancellationToken?cancellationToken = null, IProgress <ISDKProgress> progress = null) { SetupTokenAndProgress(cancellationToken, progress); return(await SdkClient.RemoveUserFromGroup(id, userId, cancellationToken, progress)); }
public void TearDown() { this._buckarooClient = null; }
public async Task <IPlatformResponse <IAppResponse> > Apps(int skip = 0, int top = 1000, string filter = null, string select = null, string orderby = null, CancellationToken?cancellationToken = null, IProgress <ISDKProgress> progress = null) { SetupTokenAndProgress(cancellationToken, progress); return(await SdkClient.Apps(skip, top, filter, select, orderby, cancellationToken, progress)); }