/// <summary> /// Method to Save Employees. Once the Employee is added in the database /// it will be added in the Employees observable collection and Property Changed will be raised /// </summary> /// <param name="emp"></param> void SaveDevice(DeviceInfoModel dev) { // int cc = _devices.Count; // _devices[0].strCardType = "EXC-4000PCIe"; // _devicesOnly[0].strCardType = "EXC-4000PCIe"; // Devices[0].strCardType = "EXC-4000PCIe"; // DevicesOnly[0].strCardType = "EXC-4000PCIe"; Devices = _serviceProxy.GetDevices(); DevicesOnly = _serviceProxy.GetDevicesOnly(); //DeviceScanner ds = new DeviceScanner(); //LauncherMvvmLight.Domain.Services.DeviceScannerService.DeviceScanner.sRegisteryDevices. RaisePropertyChanged("DevicesOnly"); RaisePropertyChanged("Devices"); SaveToRegistry(); // DevInfo.DevNo = _serviceProxy.CreateDevice(dev); // if (DevInfo.DevNo != 0) // { // Devices.Add(DevInfo); // RaisePropertyChanged("DevInfo"); // } }
private void notify_save() { DeviceInfoModel devInfo = new DeviceInfoModel { IDCardNo = idNo }; devInfo.UpdateData = DateTime.Now.ToString(); bool flag = TranslateClsResult.TranslateToModel(devInfo, this.baseInfo); DeviceInfoBLL deviceinfo2 = new DeviceInfoBLL(); if (!flag) { try { if (deviceinfo2.Add(devInfo) != 0) { TranslateClsResult.set_tj_content(devInfo); } } catch (Exception ex) { LogHelper.WriteLog(ex.ToString()); } } }
public DeviceInfoModel Update(DeviceInfoModel UpdateDevice) { SqlParameter Device_ID = new SqlParameter("@Device_ID", UpdateDevice.Device_ID); SqlParameter Subscriber_ID = new SqlParameter("@Subscriber_ID", UpdateDevice.Subscriber_ID); SqlParameter STAKEHOLDER_ID = new SqlParameter("@STAKEHOLDER_ID", UpdateDevice.STAKEHOLDER_ID); SqlParameter Imei_Number = new SqlParameter("@Imei_Number", UpdateDevice.Imei_Number); SqlParameter Device_Name = new SqlParameter("@Device_Name", UpdateDevice.Device_Name); SqlParameter IOTDEviceId = new SqlParameter("@IOTDEviceId", UpdateDevice.IOTDEviceId); SqlParameter TypeOfHouseStatus = new SqlParameter("@TypeOfHouseStatus", UpdateDevice.TypeOfHouseStatus); SqlParameter Address = new SqlParameter("@Address", UpdateDevice.Address); SqlParameter Bus_Stop = new SqlParameter("@Bus_Stop", UpdateDevice.Bus_Stop); SqlParameter State = new SqlParameter("@State", UpdateDevice.State); SqlParameter Lga = new SqlParameter("@Lga", UpdateDevice.Lga); SqlParameter Verify_Address = new SqlParameter("@Verify_Address", UpdateDevice.Verify_Address); SqlParameter Delivery_Flag = new SqlParameter("@Delivery_Flag", UpdateDevice.Delivery_Flag); SqlParameter Flag_Operation = new SqlParameter("@Flag_Operation", UpdateDevice.Flag_Operation); SqlParameter Country = new SqlParameter("@Country", UpdateDevice.Country); _context.Database.ExecuteSqlRaw("dbo.Update_DevicesDetails @Device_ID,@Subscriber_ID,@STAKEHOLDER_ID, @Imei_Number,@Device_Name,@IOTDEviceId,@TypeOfHouseStatus,@Address,@Bus_Stop,@State,@Lga,@Verify_Address,@Delivery_Flag,@Flag_Operation,@Country", Device_ID, Subscriber_ID, STAKEHOLDER_ID, Imei_Number, Device_Name, IOTDEviceId, TypeOfHouseStatus, Address, Bus_Stop, State, Lga, Verify_Address, Delivery_Flag, Flag_Operation, Country); //var deviceInfo = _context.deviceInfos.Attach(UpdateDevice); //UpdateDevice.Transaction_Date = DateTime.UtcNow; //deviceInfo.State = EntityState.Modified; //_context.SaveChanges(); return(UpdateDevice); }
public int Add(DeviceInfoModel model) { StringBuilder builder = new StringBuilder(); builder.Append("insert into ARCHIVE_DEVICEINFO("); builder.Append("DeviceType,DeviceName,Value1,Value2,Value3,Value4,Value5,Value6,Value7,Value8,Value9,Value10,Value11,Value12,Value13,IsUpload,UpdateData,IDCardNo)"); builder.Append(" values ("); builder.Append("@DeviceType,@DeviceName,@Value1,@Value2,@Value3,@Value4,@Value5,@Value6,@Value7,@Value8,@Value9,@Value10,@Value11,@Value12,@Value13,@IsUpload,@UpdateData,@IDCardNo)"); builder.Append(";select @@IDENTITY"); MySqlParameter[] cmdParms = new MySqlParameter[] { new MySqlParameter("@DeviceType", MySqlDbType.String), new MySqlParameter("@DeviceName", MySqlDbType.String), new MySqlParameter("@Value1", MySqlDbType.String), new MySqlParameter("@Value2", MySqlDbType.String), new MySqlParameter("@Value3", MySqlDbType.String), new MySqlParameter("@Value4", MySqlDbType.String), new MySqlParameter("@Value5", MySqlDbType.String), new MySqlParameter("@Value6", MySqlDbType.String), new MySqlParameter("@Value7", MySqlDbType.String), new MySqlParameter("@Value8", MySqlDbType.String), new MySqlParameter("@Value9", MySqlDbType.String), new MySqlParameter("@Value10", MySqlDbType.String), new MySqlParameter("@Value11", MySqlDbType.String), new MySqlParameter("@Value12", MySqlDbType.String), new MySqlParameter("@Value13", MySqlDbType.String), new MySqlParameter("@IsUpload", MySqlDbType.String), new MySqlParameter("@UpdateData", MySqlDbType.String), new MySqlParameter("@IDCardNo", MySqlDbType.String, 21) }; cmdParms[0].Value = model.DeviceType; cmdParms[1].Value = model.DeviceName; cmdParms[2].Value = model.Value1; cmdParms[3].Value = model.Value2; cmdParms[4].Value = model.Value3; cmdParms[5].Value = model.Value4; cmdParms[6].Value = model.Value5; cmdParms[7].Value = model.Value6; cmdParms[8].Value = model.Value7; cmdParms[9].Value = model.Value8; cmdParms[10].Value = model.Value9; cmdParms[11].Value = model.Value10; cmdParms[12].Value = model.Value11; cmdParms[13].Value = model.Value12; cmdParms[14].Value = model.Value13; cmdParms[15].Value = model.IsUpload; cmdParms[16].Value = model.UpdateData; cmdParms[17].Value = model.IDCardNo; object single = MySQLHelper.GetSingle(builder.ToString(), cmdParms); if (single == null) { return(0); } return(Convert.ToInt32(single)); }
void Start() { m_deviceInfoModel = MonitorManager.Instance.GetModel <DeviceInfoModel>(); m_deviceInfoText = transform.Find("Text").GetComponent <Text>(); m_deviceInfoText.text = GenDeviceInfo(); RectTransform rt = GetComponent <RectTransform>(); }
/// <summary> /// Method to Save Employees. Once the Employee is added in the database /// it will be added in the Employees observable collection and Property Changed will be raised /// </summary> /// <param name="emp"></param> void SaveDevice(DeviceInfoModel dev) { // DevInfo.DevNo = _serviceProxy.CreateDevice(dev); // if (DevInfo.DevNo != 0) // { // Devices.Add(DevInfo); // RaisePropertyChanged("DevInfo"); // } }
/// <summary> /// Saves the specified note. /// </summary> /// <param name="dev">The note.</param> public void Save(DeviceInfoModel dev) { if (!_devStore.Contains(dev)) { _devStore.Add(dev); } Serialize(); }
void _SaveConfig(DeviceInfoModel dev) { //_navigationService.NavigateTo("Shell"); selectedCard.strCardType = LstCardsSelectedItem.DeviceTypeName; Messenger.Default.Send <DeviceSlectedConfigMsg>(new DeviceSlectedConfigMsg(selectedCard)); _navigationService.GoBack(); }
/// <summary> /// The method to send the selected Employee from the DataGrid on UI /// to the View Model /// </summary> /// <param name="emp"></param> void SendDeviceInfo(DeviceInfoModel dev) { if (dev != null) { Messenger.Default.Send <MessageCommunicator>(new MessageCommunicator() { Dev = dev }); } }
public DeviceInfoModel GetLstClients() { var deviceInfo = new DeviceInfoModel(); using (_repository) { var jsSer = new JavaScriptSerializer(); GetDevices(_repository.GetLstClients(), jsSer, deviceInfo.LstClients); } return(deviceInfo); }
public DeviceInfoModel(DeviceInfoModel model) { UIM = model.UIM; CEM = model.CEM; RCM = model.RCM; MAC = model.MAC; Name = model.Name; GroupID = model.GroupID; FrontOff = model.FrontOff; RearOff = model.RearOff; PM = model.PM; }
/// <summary> /// Sets the info of device and app to model class /// </summary> public void SetInfo() { _deviceInfo = new DeviceInfoModel() { ApplicationVersion = CrossDeviceInfo.Current.AppVersion, DeviceModel = CrossDeviceInfo.Current.Model, Platform = Convert.ToString(CrossDeviceInfo.Current.Platform), Version = CrossDeviceInfo.Current.Version, Manufacturer = CrossDeviceInfo.Current.Manufacturer, AppPackage = DependencyService.Get <IPackageName>().PackageName }; }
public async Task <DbStatusResult> UpdateDeviceInfo(DeviceInfoModel entity) { var cmd = new DbStatusCommand(); await ExecuteSQLWithParams("[dbo].UpdateDeviceInfo", GetJsonParam("@DeviceInfo", entity), cmd.IdParam, cmd.StatusParam, cmd.MessageParam); return(cmd.StatusResult); }
public static DeviceInfoModel ToDeviceInfoModel(this JObject jobject) { if (jobject == null) { return(null); } var retVal = new DeviceInfoModel(); retVal.DeviceName = (string)jobject.Property("deviceName").Value; retVal.LastTelemetry = jobject.ToDeviceTelemetryModel(); return(retVal); }
public async void GetDeviceInformation(string uuid) { try { HttpClient client = new HttpClient { BaseAddress = new Uri(Settings.ConfigAPIUri) }; var response = await client.GetAsync($"GFBConfig/GetDeviceInfo/{uuid}").ConfigureAwait(true); var responceDevice = response.Content.ReadAsStringAsync().Result; if (!string.IsNullOrEmpty(responceDevice)) { DeviceInfoModel deviceInfoModel = JsonConvert.DeserializeObject <DeviceInfoModel>(responceDevice); if (deviceInfoModel != null && deviceInfoModel.IsResgistered == "true") { deviceLabel.Text = deviceInfoModel.Notes; } else if (deviceInfoModel.IsResgistered == "false") { Settings.IsUUIDregistered = "Device is not registered"; deviceLabel.Text = "Device is not registered"; hotelNameLabel.TextColor = Color.Red; versionLabel.TextColor = Color.Red; regStatLabel.TextColor = Color.Red; deviceLabel.TextColor = Color.Red; hotelNameLabel.Text = "N/A"; versionLabel.Text = Settings.AppVersion; regStatLabel.Text = Settings.IsUUIDregistered; registerButton.IsVisible = true; uuidEntry.IsEnabled = true; layoutConfig.IsVisible = true; uuidEntry.Focus(); await DisplayAlert("Alert!", "Device is not registered. Please register your device", "OK"); } } } catch (Exception) { } }
public bool IsDeviceValid(DeviceInfoModel device) { var result = true; if (this.DeviceNameFilter != null) { result &= device.DeviceName.Contains(this.DeviceNameFilter, StringComparison.OrdinalIgnoreCase); } if (this.DeviceIdFilter != null) { result &= device.DeviceId.Contains(this.DeviceIdFilter, StringComparison.OrdinalIgnoreCase); } return(result); }
private DevRecord GetRcd(DeviceInfoModel dev) { string str; DevRecord record = new DevRecord { RcdName = dev.DeviceName, RcdDate = dev.UpdateData }; switch (dev.DeviceType) { case "20": str = string.Format("收缩压{0}mmHg/舒张压{1}mmHg 心率{2}次/分钟", dev.Value1, dev.Value2, dev.Value3); break; case "22": str = string.Format("{0}Kg", dev.Value1); break; case "24": str = dev.Value1 + "mmol/L"; break; case "32": str = string.Format("血氧{0} 脉率{1}", dev.Value1, dev.Value2); break; case "33": str = string.Format("尿胆原{0}潜血{1}胆红素{2}酮体{3}葡萄糖{4}蛋白质{5}PH{6}亚硝酸盐{7}白细胞{8}比重{9}维生素{10}", new object[] { dev.Value1, dev.Value2, dev.Value3, dev.Value4, dev.Value5, dev.Value6, dev.Value7, dev.Value8, dev.Value9, dev.Value10, dev.Value11 }); break; case "35": str = dev.Value1; break; case "40": str = dev.Value1 + "℃"; break; case "98": str = "呼吸频率:" + dev.Value1; break; default: str = dev.Value1; break; } record.RcdResult = str; return(record); }
public async Task <IActionResult> OnGetAsync(int?id) { if (id == null) { return(NotFound()); } DeviceInfoModel = await _context.deviceInfos.FirstOrDefaultAsync(m => m.Device_ID == id); if (DeviceInfoModel == null) { return(NotFound()); } return(Page()); }
public DeviceInfoModel Delete(int id) { SqlParameter Device_ID = new SqlParameter("@Device_ID", id); SqlParameter Device_IDs = new SqlParameter("@Id", id); DeviceInfoModel deviceToDelete = _context.deviceInfos .FromSqlRaw <DeviceInfoModel>("dbo.GetDevices_ById @Id", Device_IDs) .ToList().FirstOrDefault(); if (deviceToDelete != null) { _context.Database.ExecuteSqlRaw("dbo.Delete_Devices @Device_ID", Device_ID); } return(deviceToDelete); }
public IActionResult Info() { DeviceInfoAttachedHardwareModel infoAttachedHardwareModel = new DeviceInfoAttachedHardwareModel(); DeviceInfoDataModel infoDataModel = new DeviceInfoDataModel(); infoDataModel.DeviceType = "hardwareEndpoint"; infoDataModel.IPV4Address = "10.187.85.73"; infoDataModel.ModelNumber = "Trio 8800"; infoDataModel.DeviceVendor = "Polycom"; infoDataModel.FirmwareRelease = "5.7.1.4095"; infoDataModel.UpTimeSinceLastReboot = "0 Day 0:12:25"; infoDataModel.MACAddress = "64167f298aea"; infoDataModel.IPV6Address = "::"; infoDataModel.AttachedHardware = infoAttachedHardwareModel; DeviceInfoModel infoModel = new DeviceInfoModel(); infoModel.data = infoDataModel; infoModel.Status = "2000"; // Middleware will take care of the headers // Alternatively // - Request.HttpContext.Response.Headers.Add("Server", "Polycom SoundPoint IP Telephone HTTPd"); // - HttpContext.Response.ContentType = "application/json"; if (!Request.HttpContext.Request.Headers.Keys.Contains("Authorization")) { // Return a 401 to simulate BASIC auth // Middleware will take care of the headers // Alternatively // - HttpContext.Response.StatusCode = 401; // - Request.HttpContext.Response.Headers.Add("WWW-Authenticate", "Basic realm=\"API Authentication\""); return(Unauthorized()); } // Read the file and display it line by line. StreamReader file = new StreamReader("response.txt"); string jsonTxtResponse = file.ReadLine(); file.Close(); return(Content(jsonTxtResponse.TrimEnd())); // return from JSON txt // return Ok(infoModel); // return the object }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } DeviceInfoModel = await _context.deviceInfos.FindAsync(id); if (DeviceInfoModel != null) { _context.deviceInfos.Remove(DeviceInfoModel); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }
public IActionResult OnGet(int?Device_ID) { if (Device_ID.HasValue) { deviceInfo = _DeviceData.GetDevice(Device_ID.Value); } else { deviceInfo = new DeviceInfoModel(); } if (deviceInfo == null) { return(RedirectToPage("/Error")); } return(Page()); }
public async Task <ActionResult <ResponseModel> > ValidateDeviceInfoRequest([FromBody] DeviceInfoModel deviceInfo) { var model = new ResponseModel(); var result = await _dataContext.ValidateDeviceInfoRequest(deviceInfo); if (!result.Status) { model.StatusCode = 404; model.Message = result.Message; } else { model.StatusCode = 200; deviceInfo.DeviceId = result.Id; model.ResponseObject = deviceInfo; } return(model); }
private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (this.bds.Position < 0) { this.m_Result.HasValue = false; } else { int position = this.bds.Position; DeviceInfoModel deviceinfo = this.bds.List[this.bds.Position] as DeviceInfoModel; if (deviceinfo != null) { this.m_Result.datetime = deviceinfo.UpdateData; this.m_Result.value1 = deviceinfo.Value1; if (this.m_DeviceType == "20") { this.m_Result.value2 = deviceinfo.Value2; this.m_Result.value3 = deviceinfo.Value3; } if (this.m_DeviceType == "33") { this.m_Result.value2 = deviceinfo.Value2; this.m_Result.value3 = deviceinfo.Value3; this.m_Result.value4 = deviceinfo.Value4; this.m_Result.value5 = deviceinfo.Value5; this.m_Result.value6 = deviceinfo.Value6; this.m_Result.value7 = deviceinfo.Value7; this.m_Result.value8 = deviceinfo.Value8; this.m_Result.value9 = deviceinfo.Value9; this.m_Result.value10 = deviceinfo.Value10; this.m_Result.value11 = deviceinfo.Value11; } if (this.m_DeviceType == "32") { this.m_Result.value2 = deviceinfo.Value2; } bool flag1 = this.m_DeviceType == "31"; bool flag2 = this.m_DeviceType == "35"; this.m_Result.HasValue = true; } base.DialogResult = DialogResult.OK; } }
public void SaveDeviceInfo(DeviceInfoModel model, string UserId) { try { using (SqlConnection DB = new SqlConnection(SiteKey.ConnectionString)) { #region InsertDeviceInfo if (model.device_id != null) { DB.ExecuteSql(@"DELETE from device_data where user_id = @UserId ", new { UserId, }); DB.ExecuteSql(@"INSERT INTO device_data (id, user_id, device_id, device_type, user_active, device_version, created, modified) VALUES (@id, @user_id, @device_id, @device_type, @user_active, @device_version, @created, @modified);", new { id = Guid.NewGuid().ToString(), user_id = UserId, model.device_id, model.device_type, user_active = 1, model.device_version, created = DateTime.UtcNow, modified = DateTime.UtcNow, }); } else { DB.ExecuteSql(@"DELETE from device_data where user_id = @UserId ", new { UserId, }); } #endregion } } catch (Exception ex) { LoggingRepository.SaveException(ex); } }
public static DeviceInfoModel ToDeviceInfoModel(this DurableEntityStatus entity) { if (entity == null) { return(null); } var retVal = new DeviceInfoModel(); var jobject = entity.State as JObject; if (jobject != null) { retVal = jobject.ToDeviceInfoModel(); } retVal.DeviceId = entity.EntityId.EntityKey; return(retVal); }
public async Task <DeviceInfoModel> UpdateDeviceInfo(UpdateDeviceViewModel updateDeviceViewModel, AccessPolicyModel accessPolicyModel, string deviceId, string access_token) { DeviceInfoModel deviceInfoModel = await GetDeviceInfo(accessPolicyModel, deviceId, access_token); deviceInfoModel.status = updateDeviceViewModel.status; deviceInfoModel.authentication.symmetricKey.primaryKey = updateDeviceViewModel.primaryKey; deviceInfoModel.authentication.symmetricKey.secondaryKey = updateDeviceViewModel.secondaryKey; RequestDeviceModel requestDeviceModel = new RequestDeviceModel { apiVersion = "2018-08-30-preview", authorizationPolicyKey = accessPolicyModel.SharedAccessKey, etag = deviceInfoModel.etag, authorizationPolicyName = accessPolicyModel.SharedAccessKeyName, hostName = accessPolicyModel.HostName, requestBody = JsonConvert.SerializeObject(deviceInfoModel), requestPath = string.Format("/devices/{0}", deviceId) }; string url = "https://main.iothub.ext.azure.cn/api/dataPlane/put"; var request = new HttpRequestMessage(HttpMethod.Post, url); var client = this._clientFactory.CreateClient(); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", access_token); string requestbody = JsonConvert.SerializeObject(requestDeviceModel); request.Content = new StringContent(requestbody, UnicodeEncoding.UTF8, "application/json"); var response = await client.SendAsync(request); string result = await response.Content.ReadAsStringAsync(); if (response.IsSuccessStatusCode) { TModel <DeviceInfoModel> job = JsonConvert.DeserializeObject <TModel <DeviceInfoModel> >(result); return(job.body); } else { return(null); } }
public async Task <ActionResult <ResponseModel> > AddDeviceInfo([FromBody] DeviceInfoModel deviceInfo) { var model = new ResponseModel(); var result = await _dataContext.AddDeviceInfo(deviceInfo); if (!result.Status) { model.StatusCode = 404; model.Message = result.Message; } else { model.StatusCode = 200; var objDeviceList = await _dataContext.GetDeviceInfoByKey(string.Empty, string.Empty, string.Empty, string.Empty, 0, 1000).ToListAsync(); if (objDeviceList != null) { model.ResponseObject = objDeviceList; } } return(model); }
public async Task <bool> GetDeviceInformation() { try { if (!string.IsNullOrEmpty(Settings.DeviceUUID)) { HttpClient client = new HttpClient { BaseAddress = new Uri(Settings.ConfigAPIUri) }; var response = await client.GetAsync($"GFBConfig/GetDeviceInfo/{Settings.DeviceUUID}").ConfigureAwait(true); var responceDevice = response.Content.ReadAsStringAsync().Result; if (!string.IsNullOrEmpty(responceDevice)) { DeviceInfoModel deviceInfoModel = JsonConvert.DeserializeObject <DeviceInfoModel>(responceDevice); if (deviceInfoModel != null && deviceInfoModel.IsResgistered == "false") { Settings.HotelCode = string.Empty; Settings.HotelIdentifier = string.Empty; Settings.HotelName = string.Empty; Settings.IsUUIDregistered = "Device is not registered"; return(true); } } } return(true); } catch (Exception) { return(true); } }
public IActionResult OnPost() { //if (ModelState.IsValid == false) //{ // return Page(); //} if (ModelState.IsValid == true) { //deviceInfo.STAKEHOLDER_ID = User.Identity.Name; if (deviceInfo.Device_ID > 0) { deviceInfo = _DeviceData.Update(deviceInfo); } else { deviceInfo = _DeviceData.Add(deviceInfo); } return(RedirectToPage("/Stackholders/DevicesList", new { deviceInfo.Device_ID })); } return(Page()); }