private bool EndLogicAlarm() { AlarmHandleGetRequest getRequest = new AlarmHandleGetRequest { Id = _alarmId }; var getresponse = alarmHandleService.GetJC_AlarmHandleById(getRequest); if (getresponse != null && getresponse.IsSuccess && getresponse.Data != null) { JC_AlarmHandleInfo alarmHandelInfo = getresponse.Data; alarmHandelInfo.ExceptionReason = reasonEdit.Text; alarmHandelInfo.Handling = measureEdit.Text; //alarmHandelInfo.EndTime = DateTime.Now; alarmHandelInfo.HandlingTime = DateTime.Now; ClientItem _ClientItem = Basic.Framework.Data.PlatRuntime.Items[KeyConst.ClientItemKey] as ClientItem; if (_ClientItem != null) { alarmHandelInfo.HandlingPerson = _ClientItem.UserName; } AlarmHandleUpdateRequest updateRequest = new AlarmHandleUpdateRequest { JC_AlarmHandleInfo = alarmHandelInfo }; var updateResonse = alarmHandleService.UpdateJC_AlarmHandle(updateRequest); if (updateResonse != null && updateResonse.IsSuccess && updateResonse.Data != null) { return(true); } } return(false); }
public async Task <ActionResult <ClientItem> > PostClientItem(ClientItem clientItem) { _context.ClientItems.Add(clientItem); await _context.SaveChangesAsync(); return(CreatedAtAction(nameof(GetClientItem), new { id = clientItem.Id }, clientItem)); }
public async Task <IActionResult> PutClientItem(long id, ClientItem clientItem) { if (id != clientItem.Id) { return(BadRequest()); } _context.Entry(clientItem).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ClientItemExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
/// <summary> /// 初始化窗体 /// </summary> public void LoadForm() { largedataAnalysisConfigBusiness = new LargedataAnalysisConfigBusiness(); alarmNotificationPersonnelBusiness = new AlarmNotificationPersonnelBusiness(); //初始化报警类型 DataTable dt = GetAlarmShow(); checkedCBEAlarm.Properties.DisplayMember = "show"; checkedCBEAlarm.Properties.ValueMember = "alarmShow"; checkedCBEAlarm.Properties.SeparatorChar = ','; //逗号 隔开 存储的 值是 编号(ID)如 2,3,4 checkedCBEAlarm.Properties.DataSource = dt; checkedCBEAlarm.RefreshEditValue(); try { ClientItem _ClientItem = Basic.Framework.Data.PlatRuntime.Items[KeyConst.ClientItemKey] as ClientItem; if (!string.IsNullOrEmpty(_ClientItem.UserName)) { UserName = _ClientItem.UserName; } if (!string.IsNullOrEmpty(_ClientItem.UserID)) { UserID = _ClientItem.UserID; } AlarmNotificationPersonnelConfigBusinessModel model = alarmNotificationPersonnelBusiness.GetAlarmNotificationPersonnelByanalysisModelId(analysisModelId); gridControlModule.DataSource = model.AlarmNotificationPersonnelInfoList; if (dataType == "edit") { lookUpAnalysisModels.Properties.DataSource = largedataAnalysisConfigBusiness.LoadAnalysisTemplate(); lookUpAnalysisModels.EditValue = analysisModelId; lookUpAnalysisModels.SelectedText = analysisModelId; lookUpAnalysisModels.Properties.ReadOnly = true; //设置选中 for (int i = 0; i < gridViewModule.RowCount; i++) { var alarmNotificationPersonnelInfo = gridViewModule.GetRow(i) as Sys.Safety.DataContract.JC_AlarmNotificationPersonnelInfo; if (alarmNotificationPersonnelInfo != null && alarmNotificationPersonnelInfo.IsCheck) { gridViewModule.SelectRow(i); } } //2、设置默认值: checkedCBEAlarm.EditValue = model.AlarmNotificationPersonnelConfigInfo.AlarmType; checkedCBEAlarm.RefreshEditValue(); colorPickEdit.Color = Color.FromArgb(int.Parse(model.AlarmNotificationPersonnelConfigInfo.AlarmColor)); } else { lookUpAnalysisModels.Properties.DataSource = largedataAnalysisConfigBusiness.GetAnalysisModelWithoutAlarmConfig(); } } catch (Exception ex) { LogHelper.Error(string.Format("获取报警推送人员出错, 错误消息{0}", ex.Message)); } }
private void AddClientItem(Photon.Realtime.Player player) { ClientItem newClientItem = Instantiate(clientItemPrefab, transform).GetComponent <ClientItem>(); newClientItem.Setup(player); players.Add(player); clientItems.Add(player, newClientItem); }
private void RemoveClientItem(Photon.Realtime.Player player) { ClientItem clientItem = clientItems[player]; clientItems.Remove(player); players.Remove(player); Destroy(clientItem.gameObject); }
public int Monitor(ClientItem clientItem) { //用来监测是否有任务完成 //实际上返回值应该为int型,但是不知道为什么返回值为int就警告 //当有任务完成时判断任务等级,加相应的分数 return(clientItem.Level_grade); }
public IActionResult Create(ClientItem clientItem) { clientItem.id = Guid.NewGuid(); context.ClientItems.Add(clientItem); context.SaveChanges(); clientCreatedProducer.sendEvent(clientItem); return(CreatedAtRoute("GetClient", new { id = clientItem.id }, clientItem)); }
public static IHtmlString SiteMenu(this HtmlHelper helper, ClientItem client, string target = null, bool https = false) { if (helper.ViewContext.HttpContext.Session["SiteMenu"] == null) { helper.ViewContext.HttpContext.Session["SiteMenu"] = WebUtility.GetSiteMenu(client.ClientID, target, https); } return(new HtmlString(Convert.ToString(helper.ViewContext.HttpContext.Session["SiteMenu"]))); }
public static void Update(ClientItem client, string cs) { using (var ctx = new ExchangeDataContext(cs)) { var c = ctx.Clients.Single(x => x.Id == client.Id); c.EndDateTime = client.EndDate; ctx.SubmitChanges(); } }
private void AddClientToCache(ClientItem item) { var list = getClientsCache(); if (list != null) { list.Items.Add(item); } }
public void askDrag(int x_0, int y_0, int x_1, int y_1, bool all) { if (x_0 != x_1 || y_0 != y_1) { ClientItem clientItem = this.items[x_0, y_0]; ClientItem clientItem1 = this.items[x_1, y_1]; if (clientItem.id == clientItem1.id && ItemStackable.getStackable(clientItem.id) && (x_0 != x_1 || y_0 != y_1)) { if (this.items[x_1, y_1].amount <= Inventory.MAX_STACK) { this.items[x_1, y_1].amount = this.items[x_1, y_1].amount + clientItem.amount; if (this.items[x_1, y_1].amount <= Inventory.MAX_STACK) { this.items[x_0, y_0].id = -1; this.items[x_0, y_0].amount = 0; this.items[x_0, y_0].state = string.Empty; } else { this.items[x_0, y_0].amount = this.items[x_1, y_1].amount - Inventory.MAX_STACK; this.items[x_1, y_1].amount = Inventory.MAX_STACK; } } else { this.items[x_0, y_0] = clientItem1; this.items[x_1, y_1] = clientItem; } } else if (all) { this.items[x_0, y_0] = clientItem1; this.items[x_1, y_1] = clientItem; } else if (clientItem1.id != -1 || !ItemStackable.getStackable(clientItem.id)) { this.items[x_0, y_0] = clientItem1; this.items[x_1, y_1] = clientItem; } else { this.items[x_1, y_1] = clientItem; if (clientItem.amount <= 1) { this.items[x_0, y_0] = clientItem1; } else { this.items[x_1, y_1].amount = Mathf.FloorToInt((float)clientItem.amount / 2f); this.items[x_0, y_0].amount = Mathf.CeilToInt((float)clientItem.amount / 2f); } } this.syncItem(x_0, y_0); this.syncItem(x_1, y_1); } }
private void DrawItemHandler(object sender, DrawItemEventArgs ev) { if (this.plugin == null || ev.Index == -1) { return; } Rectangle bounds = ev.Bounds; // draw background ev.DrawBackground(); // draw border ev.Graphics.DrawRectangle(Pens.Gray, bounds); ServerItem serverItem = (ServerItem)this.Items[ev.Index]; // Find the area in which to put the text and draw. this.layoutRect.X = bounds.Left + 32 + (3 * ItemMargin); this.layoutRect.Y = bounds.Top + (ItemMargin * 2); this.layoutRect.Width = bounds.Right - ItemMargin - this.layoutRect.X; this.layoutRect.Height = bounds.Bottom - ItemMargin - this.layoutRect.Y; // draw server item id and name if ((ev.State & DrawItemState.Selected) == DrawItemState.Selected) { this.pen.Brush = WhiteBrush; ev.Graphics.DrawString(serverItem.ToString(), this.Font, WhiteBrush, this.layoutRect); } else { this.pen.Brush = BlackBrush; ev.Graphics.DrawString(serverItem.ToString(), this.Font, BlackBrush, this.layoutRect); } this.destRect.Y = bounds.Top + ItemMargin; ClientItem clientItem = this.plugin.GetClientItem(serverItem.ClientId); if (clientItem != null) { Bitmap bitmap = clientItem.GetBitmap(); if (bitmap != null) { this.sourceRect.Width = bitmap.Width; this.sourceRect.Height = bitmap.Height; ev.Graphics.DrawImage(bitmap, this.destRect, this.sourceRect, GraphicsUnit.Pixel); } } // draw item border ev.Graphics.DrawRectangle(this.pen, this.destRect); // draw focus rect ev.DrawFocusRectangle(); }
public void LogExitClient() { var client = new ClientItem() { Id = this.Id, EndDate = DateTime.Now }; ClientManager.Update(client, _cs); }
private void RegisterClient() { var clientItem = new ClientItem { Id = this.Id, StartDate = this.StartTime }; ClientManager.Save(clientItem, _cs); }
private void UpdateCreateUser(R_CallInfo tempCallInfo) { ClientItem clientItem = new ClientItem(); if (Basic.Framework.Data.PlatRuntime.Items.ContainsKey(KeyConst.ClientItemKey)) { clientItem = Basic.Framework.Data.PlatRuntime.Items[KeyConst.ClientItemKey] as ClientItem; } tempCallInfo.CreateUserName = clientItem.UserName; tempCallInfo.CreateClientIP = Basic.Framework.Common.HardwareHelper.GetIPAddress(); }
public IHttpActionResult Generate(string password) { ClientItem response = clientService.GenerateNewClient(password); if (response == null) { return(StatusCode(HttpStatusCode.Forbidden)); } return(Json(response)); }
public ClientItem DonneClient(string id) { var client = _httpClientFactory.CreateClient("ApiClientV1"); string strUrl = $"/api/v1/clients/{id}"; var donneesJson = client.GetStringAsync(strUrl).Result; ClientItem retour = JsonConvert.DeserializeObject <ClientItem>(donneesJson); return(retour); }
public IActionResult Post([FromBody] ClientItem value) { ClientEvent evenement = new ClientEvent() { dateEvenement = value.dateEvenement, evenementClientTypeCourant = value.evenementClientTypeCourant, nom = value.nom, }; _busEvenement.Publier(evenement); return(Ok()); }
private void gridControl1_MouseDown(object sender, MouseEventArgs e) { GridHitInfo hInfo = gridView1.CalcHitInfo(new Point(e.X, e.Y)); if (e.Button == MouseButtons.Left && e.Clicks == 2) { //判断光标是否在行范围内 if (hInfo.InRow) { SensorCalibrationDetail dig = new SensorCalibrationDetail(); dig.ShowDialog(); if (dig.isSave) { string csStr = dig.csStr; //var alarmId = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "id"); //if (alarmId != null) //{ // ClientAlarmServer.UpdateCalibrationRecord(alarmId.ToString(), csStr); //} //else //{ Jc_BxexInfo bxInfo = new Jc_BxexInfo(); bxInfo.ID = IdHelper.CreateLongId().ToString(); bxInfo.PointID = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "pointid").ToString(); bxInfo.Point = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "Point").ToString(); ClientItem clientItem = new ClientItem(); if (Basic.Framework.Data.PlatRuntime.Items.ContainsKey(KeyConst.ClientItemKey)) { clientItem = Basic.Framework.Data.PlatRuntime.Items[KeyConst.ClientItemKey] as ClientItem; } bxInfo.Name = clientItem.UserName; bxInfo.Stime = dig.stime; bxInfo.Etime = dig.etime; bxInfo.Cx = (int)(dig.etime - dig.stime).TotalSeconds; bxInfo.Zdz = 0; bxInfo.Zxz = 0; bxInfo.Pjz = 0; bxInfo.Zdztime = dig.etime; bxInfo.Zxztime = dig.etime; bxInfo.Bxzt = 3; bxInfo.Cs = dig.csStr; ClientAlarmServer.InsertCalibrationRecord(bxInfo); // } } } } }
public void ClientConnected() { for (var i = 0; i < 50; i++) { var clientItem = new ClientItem { Id = Guid.NewGuid(), StartDate = DateTime.Now }; DAL.Managers.ClientManager.Save(clientItem, _cs); } }
public bool Delete(int id) { bool result = false; ClientItem item = db.ClientItem.Where(u => u.Id == id).FirstOrDefault(); db.ClientItem.DeleteOnSubmit(item); try { db.SubmitChanges(); result = true; } catch (Exception ex) { } return(result); }
private float CalculateDistance(Cluster cluster, ClientItem wineItem) { List <float> centroidLocation = cluster.Centroid.WineData; List <float> wineItemLocation = wineItem.WineData; double distance = 0; for (int i = 0; i < wineItemLocation.Count; i++) { distance += Math.Pow(wineItemLocation[i] - centroidLocation[i], 2); } return((float)distance); }
/// <summary> /// 打开一个Thrift 连接 /// </summary> /// <param name="client">连接配置</param> public ThriftClient(ClientItem client) { try { clientItem = client; transport = new TSocket(client.Ip, client.Port, client.TimeOut); transport.Open(); this.client = new ThriftService.Client(new TBinaryProtocol(transport)); isConnected = true; } catch (Exception ex) { logger.LogError(ex, "SuperGMS.GrantRpc.Thrift.Client.RpcClientRegister.Error"); } }
public ICommandResult Handle(CreateClient command) { command.Validate(); if (command.Invalid) { return(new GenericResult(ERROR_MESSAGE, false, command.Notifications)); } var client = new ClientItem(command.Name, command.Email, command.Phone, command.BirthDate); _repository.Create(client); return(new GenericResult(SUCESS_MESSAGE, true, client)); }
public static void Save(ClientItem client, string cs) { using (var ctx = new ExchangeDataContext(cs)) { var c = new Client { Id = client.Id, StartDateTime = client.StartDate, EndDateTime = client.EndDate }; ctx.Clients.InsertOnSubmit(c); ctx.SubmitChanges(); } }
/// <summary> /// 打开一个Thrift 连接 /// </summary> /// <param name="client">连接配置</param> public GrantThriftClient(ClientItem client) { try { clientItem = client; transport = new TSocket(client.Ip, client.Port, client.TimeOut); transport.Open(); this.client = new GrantService.Client(new TBinaryProtocol(transport)); isConnected = true; logger.LogDebug($"创建链接:{transport.GetHashCode()},{client.Ip}:{client.Port},"); } catch (Exception ex) { logger.LogError(ex, "GrantMicroService.GrantRpc.Thrift.Client.RpcClientRegister.Error"); } }
private void AddClientToContext(ClientItem client) { IIdentity ident = new GenericIdentity(client.UserName); IPrincipal user = new GenericPrincipal(ident, client.Roles()); HttpContext.Current.User = user; HttpCookie authCookie = FormsAuthentication.GetAuthCookie(client.UserName, true); FormsAuthenticationTicket formInfoTicket = FormsAuthentication.Decrypt(authCookie.Value); FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(formInfoTicket.Version, formInfoTicket.Name, formInfoTicket.IssueDate, formInfoTicket.Expiration, formInfoTicket.IsPersistent, string.Join("|", client.Roles()), formInfoTicket.CookiePath); authCookie.Value = FormsAuthentication.Encrypt(ticket); authCookie.Expires = formInfoTicket.Expiration; HttpContext.Current.Request.Cookies.Add(authCookie); HttpContext.Current.Response.Cookies.Add(authCookie); }
public IClient GetCurrent() { // this endpoint is used by the scheduler when displaying helpdesk tickets - do not delete! IClient result = null; if (RequestContext.Principal.Identity.IsAuthenticated) { result = DA.Current.Query <ClientInfo>().Where(x => x.UserName == RequestContext.Principal.Identity.Name).CreateModels <IClient>().FirstOrDefault(); } if (result == null) { result = new ClientItem(); //return an empty object when not logged in } return(result); }
public IActionResult Update(Guid id, ClientItem clientItem) { var item = context.ClientItems.Find(id); if (item == null) { return(NotFound()); } item.firstname = clientItem.firstname; item.lastname = clientItem.lastname; item.street = clientItem.street; item.city = clientItem.city; context.ClientItems.Update(item); context.SaveChanges(); clientChangedProducer.sendEvent(item); return(NoContent()); }