コード例 #1
0
        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);
        }
コード例 #2
0
        public async Task <ActionResult <ClientItem> > PostClientItem(ClientItem clientItem)
        {
            _context.ClientItems.Add(clientItem);
            await _context.SaveChangesAsync();

            return(CreatedAtAction(nameof(GetClientItem), new { id = clientItem.Id }, clientItem));
        }
コード例 #3
0
        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());
        }
コード例 #4
0
        /// <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));
            }
        }
コード例 #5
0
    private void AddClientItem(Photon.Realtime.Player player)
    {
        ClientItem newClientItem = Instantiate(clientItemPrefab, transform).GetComponent <ClientItem>();

        newClientItem.Setup(player);
        players.Add(player);
        clientItems.Add(player, newClientItem);
    }
コード例 #6
0
ファイル: ClientList.cs プロジェクト: Dyzalonius/Sugondese
    private void RemoveClientItem(Photon.Realtime.Player player)
    {
        ClientItem clientItem = clientItems[player];

        clientItems.Remove(player);
        players.Remove(player);
        Destroy(clientItem.gameObject);
    }
コード例 #7
0
ファイル: OkrItemViewModel.cs プロジェクト: buffer38324/OKR
        public int Monitor(ClientItem clientItem)
        {
            //用来监测是否有任务完成
            //实际上返回值应该为int型,但是不知道为什么返回值为int就警告
            //当有任务完成时判断任务等级,加相应的分数

            return(clientItem.Level_grade);
        }
コード例 #8
0
 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));
 }
コード例 #9
0
ファイル: Extensions.cs プロジェクト: lurienanofab/lnf
        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"])));
        }
コード例 #10
0
 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();
     }
 }
コード例 #11
0
        private void AddClientToCache(ClientItem item)
        {
            var list = getClientsCache();

            if (list != null)
            {
                list.Items.Add(item);
            }
        }
コード例 #12
0
ファイル: Inventory.cs プロジェクト: Horsuna/server
 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);
     }
 }
コード例 #13
0
        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();
        }
コード例 #14
0
        public void LogExitClient()
        {
            var client = new ClientItem()
            {
                Id      = this.Id,
                EndDate = DateTime.Now
            };

            ClientManager.Update(client, _cs);
        }
コード例 #15
0
        private void RegisterClient()
        {
            var clientItem = new ClientItem
            {
                Id        = this.Id,
                StartDate = this.StartTime
            };

            ClientManager.Save(clientItem, _cs);
        }
コード例 #16
0
        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();
        }
コード例 #17
0
        public IHttpActionResult Generate(string password)
        {
            ClientItem response = clientService.GenerateNewClient(password);

            if (response == null)
            {
                return(StatusCode(HttpStatusCode.Forbidden));
            }

            return(Json(response));
        }
コード例 #18
0
        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);
        }
コード例 #19
0
        public IActionResult Post([FromBody] ClientItem value)
        {
            ClientEvent evenement = new ClientEvent()
            {
                dateEvenement = value.dateEvenement,
                evenementClientTypeCourant = value.evenementClientTypeCourant,
                nom = value.nom,
            };

            _busEvenement.Publier(evenement);
            return(Ok());
        }
コード例 #20
0
        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);
                        // }
                    }
                }
            }
        }
コード例 #21
0
        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);
            }
        }
コード例 #22
0
        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);
        }
コード例 #23
0
        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);
        }
コード例 #24
0
ファイル: ThriftClient.cs プロジェクト: staoran/SuperGMS
 /// <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");
     }
 }
コード例 #25
0
        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));
        }
コード例 #26
0
        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();
            }
        }
コード例 #27
0
 /// <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");
     }
 }
コード例 #28
0
        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);
        }
コード例 #29
0
        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);
        }
コード例 #30
0
        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());
        }