Example #1
0
    public override void Handle(UserEvent e)
    {
        switch (e.type)
        {
            case UserEvent.EventType.LA:
                {
                    GameObjectLoader.LoadGameObject((e.rawContent as LA).AssetName);
                    break;
                }
            case UserEvent.EventType.GA:
                {
					var proto = e.rawContent as GA;
					//GOCollection.AddGameObject(proto.GOID,proto.AssetName);
				var go = GameObject.Instantiate(Resources.Load("Cube"))as GameObject;
//			Debug.Log("proto: " + proto.GOID + " " + (go == null));
			go.GetComponent<EventGenerator>().gameObjectId = proto.GOID;
			go.GetComponent<EventGenerator>().AddListener(EventCollection.OnEventTrigger);
					World.GetInstance().AddGameObject(proto.GOID,go);
					go.SetActive(true);
                    break;
                }
            case UserEvent.EventType.GR:
                {
					GOCollection.DeleteGameObjectByGOId((e.rawContent as GR).GOID);
                    break;
                }
            default:
                {
                    return;
                }
        }
    }
Example #2
0
 public void Add(UserEvent e)
 {
     lock (eventList)
     {
         eventList.Add(e);   
     }
 }
Example #3
0
	private void DetectStateTransfer() {
		var state = gameObject.GetComponent<CubeState> ();
		var e = new UserEvent ();
		e.sponsorId = base.gameObjectId;
		e.targetIdList = World.GetInstance ().GetAllGOIds ();
		var ste = new CubeSTE ();
		if (!state.transform.position.Equals (gameObject.transform.position)) {
			var content = new Content();
			content.state = StateEnum.POS;
			content.value.x = gameObject.transform.position.x;
			content.value.y = gameObject.transform.position.y;
			content.value.z = gameObject.transform.position.z;
			ste.content.Add(content);
		}
		if (!state.transform.eulerAngles.Equals (gameObject.transform.eulerAngles)) {
			var content = new Content();
			content.state = StateEnum.ROT;
			content.value.x = transform.eulerAngles.x;
			content.value.y = transform.eulerAngles.y;
			content.value.z = transform.eulerAngles.z;
			ste.content.Add(content);
		}
		e.rawContent = ste as object;
		if (ste.content.Count == 0) {
			return ;
		}

		base.BroadCastEvent (e);
	}
    public override byte[] SelfSerialize(UserEvent.EventType type, object content)
	{
		byte[] ret = null;
		switch (type) {
		case UserEvent.EventType.GA:
		{
			var proto = content as GA;
			using (var stream = new MemoryStream()) {
				Serializer.Serialize<GA>(stream,proto);
				ret = stream.ToArray();
			}
			break;
		}
		case UserEvent.EventType.GR:
		{
			var proto = content as GR;
			using (var stream = new MemoryStream()) {
				Serializer.Serialize<GR>(stream,proto);
				ret = stream.ToArray();
			}
			break;
		}
		case UserEvent.EventType.LA:
		{
			var proto = content as LA;
			using (var stream = new MemoryStream()) {
				Serializer.Serialize<LA>(stream,proto);
				ret = stream.ToArray();
			}
			break;
		}
		}

		return ret;
    }
        public override string ToString()
        {
            x = (UserEvent)base.Tag;

            Binding myBinding = new Binding("EventName");
            myBinding.Mode = BindingMode.TwoWay;
            myBinding.Source = x;
            txtevt.SetBinding(TextBox.TextProperty, myBinding);

            Binding myBinding2 = new Binding("Body");
            myBinding2.Mode = BindingMode.TwoWay;
            myBinding2.Source = x;
            txtbdy.SetBinding(TextBox.TextProperty, myBinding2);
           
            Binding myBinding3 = new Binding("URL");
            myBinding3.Mode = BindingMode.TwoWay;
            myBinding3.Source = x;
            txturl.SetBinding(TextBox.TextProperty, myBinding3);

            Binding myBinding4 = new Binding("APP");
            myBinding4.Mode = BindingMode.TwoWay;
            myBinding4.Source = x;
            txtapp.SetBinding(TextBox.TextProperty, myBinding4);


            Binding descbinding = new Binding("Description");
            descbinding.Mode = BindingMode.TwoWay;
            descbinding.Source = x;
            txtdesc.SetBinding(TextBox.TextProperty, descbinding);


            return base.ToString();
        }
        public void Setup()
        {
            // настроить фейковую БД из файлов CSV
            SetupDatabase();

            // получить из БД десяток счетов и их владельцев
            using (var ctx = DatabaseContext.Instance.Make())
            {
                var accounts = (from account in ctx.ACCOUNT select (int?) account.ID).Take(5).ToList();
                accountIds = accounts.Concat(Enumerable.Range(0, 10).Select(r => (int?)null)).OrderBy(a => rnd.Next()).ToArray();
                targetUsers = (from us in ctx.PLATFORM_USER select us).Take(10).ToArray();
            }

            const int eventsCount = 1000;
            var timeStart = DateTime.Now.AddSeconds(-eventsCount);

            sampleUserEvents = new List<UserEvent>();
            for (var i = 0; i < eventsCount; i++)
            {
                var evt = new UserEvent
                    {
                        AccountId = accountIds[i % accountIds.Length],
                        Action = AccountEventAction.DefaultAction,
                        Time = timeStart.AddSeconds(i),
                        User = targetUsers[i % targetUsers.Length].ID
                    };
                evt.Code = evt.AccountId.HasValue ? AccountEventCode.TradeSignal : AccountEventCode.AccountModified;
                evt.Text = evt.Code + " " + i;
                evt.Title = EnumFriendlyName<AccountEventCode>.GetString(evt.Code);
                sampleUserEvents.Add(evt);
            }
        }
Example #7
0
	private void DetectUserInput() {
		var e = new UserEvent ();
		e.type = UserEvent.EventType.CTR;
		e.sponsorId = base.gameObjectId;
		e.targetIdList = new List<string>(){base.gameObjectId};
		var ce = new CubeCE ();
		if (Input.GetKey (KeyCode.W)) {
			ce.key.Add("W");
		}
		if (Input.GetKey (KeyCode.S)) {
			ce.key.Add("S");
		}
		if (Input.GetKey (KeyCode.A)) {
			ce.key.Add("A");
		}
		if (Input.GetKey (KeyCode.D)) {
			ce.key.Add("D");
		}
		if (ce.key.Count == 0) {
			return ;
		}
//		Debug.Log ("Get key");
		e.rawContent = ce as object;
		base.BroadCastEvent (e);
	}
	private void Test() {
		var e = new UserEvent ();
		var ga = new GA ();
		ga.GOID = "tank1";
		e.sponsorId = "0";
		e.targetIdList = World.GetInstance ().GetAllGOIds ();
		e.type = UserEvent.EventType.GA;
		e.rawContent = ga as object;
		base.BroadCastEvent (e);
	}
Example #9
0
	void Test() {
		var e = new UserEvent ();
		var ga = new GA ();
		ga.AssetName = "cube";
		ga.GOID = "cube1";
		e.rawContent = ga as object;
		e.sponsorId = "0";
		e.targetIdList = World.GetInstance ().GetAllGOIds ();
		e.type = UserEvent.EventType.GA;
		EventCollection.OnEventTrigger (e);
	}
Example #10
0
 public static MsgType MsgTypeConverter(UserEvent.EventType origin) 
 {
     MsgType ret = MsgType.AssetUpload;
     switch (origin)
     {
         case UserEvent.EventType.CMD:
             {
                 ret = MsgType.Command;
                 break;
             }
         case UserEvent.EventType.CTR:
             {
                 ret = MsgType.Control;
                 break;
             }
         case UserEvent.EventType.ENV:
             {
                 ret = MsgType.Environment;
                 break; 
             }
         case UserEvent.EventType.GA:
             {
                 ret = MsgType.GameObjectAdd;
                 break;
             }
         case UserEvent.EventType.GR:
             {
                 ret = MsgType.GameObjectRemove;
                 break;
             }
         case UserEvent.EventType.LA:
             {
                 ret = MsgType.AssetLoad;
                 break;
             }
         case UserEvent.EventType.ST:
             {
                 ret = MsgType.StateTransfer;
                 break;
             }
         case UserEvent.EventType.UPA:
             {
                 ret = MsgType.AssetUpload;
                 break;
             }
     }
     return ret;
 }
Example #11
0
 public static void DispatchEvent(List<MsgResponse> command)
 {
     foreach (var c in command)
     {
         var e = new UserEvent();
         e.sponsorId = c.head.srcID;
         e.targetIdList = c.head.dstIDs;
         foreach (var m in c.content.msg)
         {
             e.type = Support.EventTypeConverter(m.type);
             switch (m.type)
             {
                 case MsgType.AssetLoad:
                 case MsgType.AssetUpload:
                 case MsgType.GameObjectAdd:
                 case MsgType.GameObjectRemove:
                     {
                         var prego = World.GetInstance().GetPredefiendGO();
                         var preHandler = prego.GetComponent<EventHandler>();
                         e.rawContent = preHandler.SelfDeserialize(e.type, m.body);
                         preHandler.Handle(e);
                         break;
                     }
                 case MsgType.Control:
                 case MsgType.Command:
                 case MsgType.Environment:
                 case MsgType.StateTransfer:
                     {
                         foreach (var item in e.targetIdList)
                         {
                             var go = World.GetInstance().GetGameObject(item);
                             var handler = go.GetComponent<EventHandler>();
                             e.rawContent = handler.SelfDeserialize(e.type, m.body);
                             handler.Handle(e);
                         }
                         break;
                     }
                 default:
                     {
                         break;
                     }
             }
         }
     }
 }
 public void SaveUserEvent(UserEvent userEvent)
 {
     if (userEvent.UserEventID == 0)
     {
         context.UserEvents.Add(userEvent);
     }
     else
     {
         UserEvent dbEntry = context.UserEvents.Find(userEvent.UserEventID);
         if (dbEntry != null)
         {
             dbEntry.UserEventDate = userEvent.UserEventDate;
             dbEntry.UserEventDescription = userEvent.UserEventDescription;
             dbEntry.UserID = userEvent.UserID;
         }
     }
     context.SaveChanges();
 }
Example #13
0
        public void Event_FireList()
        {
            var client = new Client();

            var userevent = new UserEvent()
            {
                Name = "foo"
            };

            var res = client.Event.Fire(userevent);

            Thread.Sleep(100);
            Assert.AreNotEqual(0, res.RequestTime);
            Assert.IsFalse(string.IsNullOrEmpty(res.Response));

            var events = client.Event.List();
            Assert.AreNotEqual(0, events.Response.Length);
            Assert.AreEqual(res.Response, events.Response[events.Response.Length - 1].ID);
            Assert.AreEqual(client.Event.IDToIndex(res.Response), events.LastIndex);
        }
Example #14
0
        public async Task Event_FireList()
        {
            var client = new ConsulClient();

            var userevent = new UserEvent()
            {
                Name = "foo"
            };

            var res = await client.Event.Fire(userevent);

            await Task.Delay(100);

            Assert.NotEqual(TimeSpan.Zero, res.RequestTime);
            Assert.False(string.IsNullOrEmpty(res.Response));

            var events = await client.Event.List();
            Assert.NotEqual(0, events.Response.Length);
            Assert.Equal(res.Response, events.Response[events.Response.Length - 1].ID);
            Assert.Equal(client.Event.IDToIndex(res.Response), events.LastIndex);
        }
Example #15
0
	public override byte[] SelfSerialize (UserEvent.EventType type, object content)
	{
		byte[] ret = null;
		using (var stream = new MemoryStream()) {
			switch(type) {
			case UserEvent.EventType.CTR:
			{
				Serializer.Serialize<CubeCE>(stream, content as CubeCE);
				ret = stream.ToArray();
				break;
			}
			case UserEvent.EventType.ST:
			{
				Serializer.Serialize<CubeSTE>(stream, content as CubeSTE);
				ret = stream .ToArray();
				break;
			}
			}
		}

		return ret;
	
	}
Example #16
0
	public override void Handle (UserEvent e)
	{
		var isSim = gameObject.GetComponent<State> ().isInSimulator;
		switch (e.type) {
		case UserEvent.EventType.CTR:
		{
			if (!isSim) {
				return;
			}
			PysicalMove(e.rawContent as CubeCE);
			break;
		}

		case UserEvent.EventType.ST:
		{
			if (isSim) {
				return ;
			}
			ApplyNewState(e.rawContent as CubeSTE);
			break;
		}
		}
	}
Example #17
0
    public override object SelfDeserialize(UserEvent.EventType type, byte[] body)
    {
		object ret = null;
		using (var stream = new MemoryStream(body)) {
			switch (type) {
			case UserEvent.EventType.GA:
			{
				ret = Serializer.Deserialize<GA>(stream);			
				break;
			}
			case UserEvent.EventType.GR:
			{
				ret = Serializer.Deserialize<GR>(stream);
				break;
			}
			case UserEvent.EventType.LA:
			{
				ret = Serializer.Deserialize<LA>(stream);
				break;
			}
			}
		}
		return ret;
    }
Example #18
0
 /// <summary>
 /// Create LogEvent instance
 /// </summary>
 /// <param name="userEvent">The UserEvent entity</param>
 /// <param name="logger">The ILogger entity</param>
 /// <returns>LogEvent instance</returns>
 public static LogEvent CreateLogEvent(UserEvent userEvent, ILogger logger)
 {
     return(CreateLogEvent(new UserEvent[] { userEvent }, logger));
 }
Example #19
0
 private void button1_Click(object sender, EventArgs e)
 {
     UserEvent?.Invoke(textBox1.Text.Trim(), textBox2.Text.Trim());
     this.Close();
 }
        public EditEvent(string eventid)
        {
            InitializeComponent();

            userEvent           = eventHelper.GetUserEvent(eventid);
            txt_name.Text       = userEvent.Title;
            txt_email.Text      = userEvent.Description;
            dtp_startdate.Value = userEvent.StartDate;
            dtp_starttime.Value = userEvent.StartDate;
            dtp_enddate.Value   = userEvent.StartDate;
            dtp_endtime.Value   = userEvent.EndDate;

            allContacts = contactHelper.GetUserContacts();
            allContacts.RemoveAll(x => contacts.Exists(y => y.ContactId == x.ContactId));

            if (userEvent.EventContacts != null)
            {
                foreach (EventContact eventContact in userEvent.EventContacts)
                {
                    ComboBoxItem comboBoxItem = new ComboBoxItem()
                    {
                        Id        = eventContact.Id,
                        ContactId = eventContact.ContactId,
                        Name      = this.GetContactName(eventContact.ContactId),
                    };
                    cmb_evetncollab.DisplayMember = "Name";
                    cmb_evetncollab.ValueMember   = "ContactId";
                    cmb_evetncollab.DisplayMember = "Name";
                    cmb_evetncollab.ValueMember   = "ContactId";
                    cmb_evetncollab.Items.Add(comboBoxItem);
                    comboBoxItems.Add(comboBoxItem);
                }
            }

            if (userEvent.Type.Equals("Task"))
            {
                rb_task.Checked = true;
            }
            else
            {
                rb_appointment.Checked = true;
            }



            if (allContacts != null)
            {
                foreach (Contact eventContact in allContacts)
                {
                    ComboBoxItem comboBoxItem = new ComboBoxItem()
                    {
                        ContactId = eventContact.ContactId,
                        Name      = eventContact.Name,
                    };

                    cmb_contacts.DisplayMember = "Name";
                    cmb_contacts.ValueMember   = "ContactId";
                    cmb_contacts.DisplayMember = "Name";
                    cmb_contacts.ValueMember   = "ContactId";
                    cmb_contacts.Items.Add(comboBoxItem);
                }
                cmb_contacts.Items.Remove("Loading....");
                //cmb_contacts.SelectedIndex = 0;
            }

            if (!userEvent.AddressLine1.Equals("") || !userEvent.AddressLine2.Equals("") || !userEvent.City.Equals("") || !userEvent.State.Equals("") || !userEvent.Zipcode.Equals(""))
            {
                this.AddAddressControls();
                this.changeConrolLocations("add");
            }
            else
            {
                PictureBox pbx = uiBuilder.GeneratePictureBox(17, 390, "dynamicpbx_chevdown", Properties.Resources.chevdown, 15, 15);
                pbx.Click += new EventHandler(this.AddUiClick);

                this.Controls.Add(pbx);

                Label label = uiBuilder.GenerateLabel(40, 390, "dynamiclbl_address", "Address");
                this.Controls.Add(label);
            }

            cmb_repeattype.SelectedItem = userEvent.RepeatType;
        }
Example #21
0
 public async Task DeleteAsync(string userId)
 {
     await _messageProducer.ProduceAsync(UserEvent.Delete(userId));
 }
Example #22
0
	protected void BroadCastEvent(UserEvent e) {
		if (OnEventGenerated != null) {
			OnEventGenerated(e);
		}
	}
 void HeadPointDown(UserEvent eventCall, UserAction action)
 {
     ac = 0;
 }
 public Task AddUserEventAsync(UserEvent entity)
 {
     context.UserEvents.Add(entity);
     return context.SaveChangesAsync();
 }
Example #25
0
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(UserEvent obj)
 {
     return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
 }
Example #26
0
        // This routine writes a User Event audit entry
        // into the SYS_USE_ADUIT table
        public void WriteUserEvent(string AppName, string UserID, UserEvent uEvent)
        {
            System.Data.OracleClient.OracleConnection ConnOracle;
            System.Data.OracleClient.OracleCommand    CmdOracle;

            //Parameters for the Oracle Package
            OracleParameter return_val = new OracleParameter("v_success", OracleType.VarChar, 1);

            return_val.Direction = ParameterDirection.ReturnValue;
            OracleParameter p_external_user_id = new OracleParameter("p_external_user_id", OracleType.VarChar, 250);
            OracleParameter p_system_use       = new OracleParameter("p_system_use", OracleType.VarChar, 250);
            OracleParameter p_system_activity  = new OracleParameter("p_system_activity", OracleType.VarChar, 250);

            ConnOracle = new System.Data.OracleClient.OracleConnection();
            CmdOracle  = new System.Data.OracleClient.OracleCommand();

            try
            {
                p_external_user_id.Value = UserID;
                switch (uEvent)
                {
                case UserEvent.LogonSuccessful:
                    p_system_activity.Value = "Logon successful";
                    break;

                case UserEvent.LogonFailed:
                    p_system_activity.Value = "Logon failed";
                    break;

                case UserEvent.Logoff:
                    p_system_activity.Value = "Logoff";
                    break;

                case UserEvent.SessionTimeout:
                    p_system_activity.Value = "Session timeout";
                    break;
                }
                p_system_use.Value = AppName;

                //Use Oracle Package
                ConnOracle.ConnectionString = GSA.R7BD.Utility.DataAccess.ConnStrBDFApps();
                CmdOracle.Connection        = ConnOracle;
                CmdOracle.CommandText       = "bdfapps.SYS_USE_AUDIT_PKG.CREATE_SYS_USE_AUDIT_REC";
                CmdOracle.CommandType       = CommandType.StoredProcedure;
                CmdOracle.Parameters.Clear();
                CmdOracle.Parameters.Add(p_external_user_id);
                CmdOracle.Parameters.Add(p_system_activity);
                CmdOracle.Parameters.Add(p_system_use);
                CmdOracle.Parameters.Add(return_val);

                if (ConnOracle.State != ConnectionState.Open)
                {
                    ConnOracle.Open();
                }
                CmdOracle.ExecuteScalar();

                //Check the return value
                if (CmdOracle.Parameters["v_success"].Value.ToString().Trim() == "F")
                {
                    GSA.R7BD.Utility.EventLog.AddWebErrors(AppName, "GSA.R7BD.Utility", "Audit", "Call to bdfapps.SYS_USE_AUDIT_PKG.CREATE_SYS_USE_AUDIT_REC failed.");
                }
            }
            catch (Exception ex)
            {
                // Write the exception to the error log
                GSA.R7BD.Utility.EventLog.AddWebErrors(AppName, "GSA.R7BD.Utility", "Audit", ex.Message);
            }
            finally
            {
                if (ConnOracle.State == ConnectionState.Open)
                {
                    ConnOracle.Close();
                }
            }
        }
 private void Awake()
 {
     if (Instance != null)
         return;
     Instance = this;
 }
Example #28
0
 void DragingC(UserEvent back, UserAction action, Vector2 v)
 {
     PointDownC(back, action);
 }
 public void Publish(UserEvent userEvent)
 {
     _rabbitMqClient.PushToExchange(Constants.UserEventsExchangeName, userEvent);
 }
Example #30
0
 public static void OnEventTrigger(UserEvent e)
 {
     EventBag.GetInstance().Add(e);
 }
Example #31
0
        //private readonly Object data;

        public UserEventArgs(UserEvent userEvent, object data)
        {
            this.userEvent = userEvent;
            this.data      = data;
        }
 public void SendTradeSignalEvent(ProtectedOperationContext ctx, int accountId, int tradeSignalCategory, UserEvent acEvent)
 {
     throw new NotImplementedException();
 }
Example #33
0
 public virtual void SendTradeSignalEvent(ProtectedOperationContext ctx, int accountId, int tradeSignalCategory,
                                          UserEvent acEvent)
 {
     Logger.InfoFormat("Текстовое сообщение робота: [{0:dd.MM.yyyy HH:mm}] {1} {2} {3}",
                       acEvent.Time, acEvent.Code, acEvent.Title, acEvent.Text);
 }
Example #34
0
        public bool SaveUserApply(UserApply model)
        {
            using (var context = new CRDatabase())
            {
                //根据model的NextCurrentNode字段来判断是否有选择
                //if (model.NextCurrentNode == "") //当为空的时候,默认就更新几个字段
                //{
                //    var entity = context.CTMS_USERAPPLY.FirstOrDefault(p => p.APPLYID == oldApplyId);
                //    entity.DOCTORSUGGEST = model.DOCTORSUGGEST;
                //    return context.SaveChanges() > 0;
                //}
                //else
                //{
                UserInfo currentUser = new UserInfoService().GetCurrentUser();

                UserEventBLL ueBll   = new UserEventBLL();
                UserEvent    ueModel = new UserEvent();

                UserEvent oldEvent = ueBll.Get(p => p.EVENTID == model.EventId);

                //更新原先的待办信息
                ueBll.CloseEvent(model.EventId);

                var entity = context.CTMS_USERAPPLY.FirstOrDefault(p => p.APPLYID == model.APPLYID);
                entity.STATUS = ((int)ActionStatus.Complete).ToString();

                var addModel = new CTMS_USERAPPLY();
                addModel.ID            = Guid.NewGuid().ToString();
                addModel.APPLYID       = model.APPLYID;
                addModel.USERID        = entity.USERID;
                addModel.GUIDELINEID   = entity.GUIDELINEID;
                addModel.CURRENTNODE   = model.NextCurrentNode;
                addModel.STATUS        = ((int)ActionStatus.Progress).ToString();
                addModel.DOCTORSUGGEST = model.DOCTORSUGGEST;
                addModel.ENTRYDATE     = model.ENTRYDATE;
                addModel.EXITDATE      = model.EXITDATE;
                addModel.ISDELETED     = false;

                context.CTMS_USERAPPLY.Add(addModel);

                //发送待办任务
                CancerUserInfoRepository _repository = new CancerUserInfoRepository();
                HR_CNR_USER user = _repository.FindOne(p => p.USERID == entity.USERID);
                ueModel.EventID = Guid.NewGuid().ToString();
                string userEventId = ueModel.EventID;
                ueModel.UserApplyId  = addModel.ID;
                ueModel.ActionType   = "1";
                ueModel.ActionInfo   = "您收到了Doc医生的建议,请查看";// + model.NextCurrentNodeName;
                ueModel.ReceiptTime  = System.DateTime.Now;
                ueModel.ActionStatus = ((int)ActionStatus.Progress).ToString();
                ueModel.FromUser     = currentUser.UserId;
                ueModel.ToUser       = entity.USERID;
                ueModel.CreateTime   = System.DateTime.Now;
                ueModel.LinkUrl      = "DoTreatmentView"; //用户待办界面
                ueModel.ModelId      = oldEvent.ModelId;

                ueBll.AddUserEvent(ueModel);

                #region 推荐产品与待办关联
                string _guidID = model.NextCurrentNode == "" ? model.CURRENTNODE : model.NextCurrentNode;
                GuidelineProductBLL            gpBLL    = new GuidelineProductBLL();
                IEnumerable <GuidelineProduct> products = gpBLL.GetList(p => p.GUIDELINEID.Equals(_guidID));
                EventProductBLL epdBLL = new EventProductBLL();
                foreach (GuidelineProduct item in products)
                {
                    EventProduct eventProduct = new EventProduct();
                    eventProduct.EventId      = ueModel.EventID;
                    eventProduct.ProductID    = item.ProductId;
                    eventProduct.ProductName  = item.ProductName;
                    eventProduct.ProductPrice = item.ProductPrice;
                    eventProduct.ProductDes   = item.Productdes;
                    eventProduct.IsAlreadyBuy = "0";

                    epdBLL.Add(eventProduct);
                }
                #endregion

                #region 发送客服待办
                ueModel              = new UserEvent();
                ueModel.EventID      = Guid.NewGuid().ToString();
                ueModel.UserApplyId  = addModel.ID;
                ueModel.ActionType   = "1";
                ueModel.ActionInfo   = string.Format("{0}收到了{1}对于病例的处理建议,请跟踪", user.USERNAME, currentUser.LoginName);
                ueModel.ReceiptTime  = System.DateTime.Now;
                ueModel.ActionStatus = ((int)ActionStatus.Progress).ToString();
                ueModel.FromUser     = currentUser.UserId;
                var toUserId = context.CTMS_SYS_USERINFO.FirstOrDefault(p => p.USERTYPE == (decimal)UserType.客服);
                ueModel.ToUser     = toUserId.USERID;
                ueModel.CreateTime = System.DateTime.Now;
                ueModel.LinkUrl    = "ServiceTask"; //客服待办
                ueModel.Remarks    = userEventId;
                ueModel.ModelId    = oldEvent.ModelId;
                ueBll.AddUserEvent(ueModel);
                #endregion

                return(context.SaveChanges() > 0);
                //}
            }
        }
Example #35
0
 public virtual void SendTradeSignalEvent(ProtectedOperationContext ctx, int accountId, int tradeSignalCategory,
     UserEvent acEvent)
 {
     Logger.InfoFormat("Текстовое сообщение робота: [{0:dd.MM.yyyy HH:mm}] {1} {2} {3}",
         acEvent.Time, acEvent.Code, acEvent.Title, acEvent.Text);
 }
Example #36
0
 public abstract byte[] SelfSerialize(UserEvent.EventType type, object content);
Example #37
0
 public void RaiseEvent(object sender, string eventType)
 {
     UserEvent?.Invoke(sender, eventType);
 }
Example #38
0
        public void MakePresignals(bool madeNewCandle, DateTime time, List<MarketOrder> orders)
        {
            if (!ShouldMakePresignals || PriceA == 0 || PriceB == 0) return;

            // "пресигналы" на вход
            if (madeNewCandle)
            {
                currentPresignalPrimeTimes = presignalMinutesToClose.ToList();
                return;
            }
            if (currentPresignalPrimeTimes.Count == 0) return;

            var minutesToClose = (int)Math.Round((packer.CandleCloseTime - time).TotalMinutes);
            if (minutesToClose > currentPresignalPrimeTimes[0]) return;
            currentPresignalPrimeTimes.RemoveAt(0);

            var level = PriceB + KoefEnter * (PriceA - PriceB);

            // уточнить уровень по открытым позам
            // может, уже есть позы, открытые "лучше"
            var deals = FiboRobotPosition.GetRobotPositions(ticker, orders, timeframe, PriceA, null);

            if (deals.Count > 0)
            {
                var priceLast = side > 0 ? deals.Min(d => d.order.PriceEnter) : deals.Max(d => d.order.PriceEnter);
                if ((side > 0 && priceLast < (float)level) || (side < 0 && priceLast > (float)level))
                    level = (decimal)priceLast;
            }

            var signalText = string.Format(
                "Планирую {0} {1} по цене {2} {3} в {4:HH:mm}",
                side > 0 ? "купить" : "продать",
                ticker,
                side > 0 ? "ниже" : "выше",
                DalSpot.Instance.FormatPrice(ticker, level),
                packer.CandleCloseTime);

            var acEvent = new UserEvent
            {
                //Account = robotContext.accountInfo.ID,
                Action = AccountEventAction.DefaultAction,
                Code = AccountEventCode.TradeSignal,
                Text = string.Join("#-#", ticker, timeframe.ToString(), signalText),
                Time = time,
                Title = "Торговый сигнал"
            };

            if (authoredTradeSignalCategory != 0)
            {
                try
                {
                    robotContext.SendTradeSignalEvent(
                        protectedContext.MakeProtectedContext(),
                        robotContext.AccountInfo.ID,
                        authoredTradeSignalCategory,
                        acEvent);
                }
                catch (Exception ex)
                {
                    Logger.Error("Ошибка отправки \"пресигнала\"", ex);
                }
            }

            // отправить "пресигнал" на сайт
            if (SendPresignalsOnSite)
                PostSignalOnSite(side, level, packer.CandleCloseTime);
        }
Example #39
0
 public Profile(Context context, string userId,
                bool isActivated, UserEvent _event, Theme theme)
 {
 }
Example #40
0
 public abstract void Handle(UserEvent e);
Example #41
0
 /// <summary>
 /// Makes a recommendation prediction. If using API Key based authentication,
 /// the API Key must be registered using the
 /// [PredictionApiKeyRegistry][google.cloud.recommendationengine.v1beta1.PredictionApiKeyRegistry]
 /// service. [Learn more](/recommendations-ai/docs/setting-up#register-key).
 /// </summary>
 /// <param name="name">
 /// Required. Full resource name of the format:
 /// `{name=projects/*/locations/global/catalogs/default_catalog/eventStores/default_event_store/placements/*}`
 /// The id of the recommendation engine placement. This id is used to identify
 /// the set of models that will be used to make the prediction.
 ///
 /// We currently support three placements with the following IDs by default:
 ///
 /// * `shopping_cart`: Predicts items frequently bought together with one or
 /// more catalog items in the same shopping session. Commonly displayed after
 /// `add-to-cart` events, on product detail pages, or on the shopping cart
 /// page.
 ///
 /// * `home_page`: Predicts the next product that a user will most likely
 /// engage with or purchase based on the shopping or viewing history of the
 /// specified `userId` or `visitorId`. For example - Recommendations for you.
 ///
 /// * `product_detail`: Predicts the next product that a user will most likely
 /// engage with or purchase. The prediction is based on the shopping or
 /// viewing history of the specified `userId` or `visitorId` and its
 /// relevance to a specified `CatalogItem`. Typically used on product detail
 /// pages. For example - More items like this.
 ///
 /// * `recently_viewed_default`: Returns up to 75 items recently viewed by the
 /// specified `userId` or `visitorId`, most recent ones first. Returns
 /// nothing if neither of them has viewed any items yet. For example -
 /// Recently viewed.
 ///
 /// The full list of available placements can be seen at
 /// https://console.cloud.google.com/recommendation/datafeeds/default_catalog/dashboard
 /// </param>
 /// <param name="userEvent">
 /// Required. Context about the user, what they are looking at and what action
 /// they took to trigger the predict request. Note that this user event detail
 /// won't be ingested to userEvent logs. Thus, a separate userEvent write
 /// request is required for event logging.
 /// </param>
 /// <param name="pageToken">
 /// The token returned from the previous request. A value of <c>null</c> or an empty string retrieves the first
 /// page.
 /// </param>
 /// <param name="pageSize">
 /// The size of page to request. The response will not be larger than this, but may be smaller. A value of
 /// <c>null</c> or <c>0</c> uses a server-defined page size.
 /// </param>
 /// <param name="callSettings">If not null, applies overrides to this RPC call.</param>
 /// <returns>
 /// A pageable asynchronous sequence of <see cref="PredictResponse.Types.PredictionResult"/> resources.
 /// </returns>
 public virtual gax::PagedAsyncEnumerable <PredictResponse, PredictResponse.Types.PredictionResult> PredictAsync(PlacementName name, UserEvent userEvent, string pageToken = null, int?pageSize = null, gaxgrpc::CallSettings callSettings = null) =>
 PredictAsync(new PredictRequest
 {
     PlacementName = gax::GaxPreconditions.CheckNotNull(name, nameof(name)),
     UserEvent     = gax::GaxPreconditions.CheckNotNull(userEvent, nameof(userEvent)),
     PageToken     = pageToken ?? "",
     PageSize      = pageSize ?? 0,
 }, callSettings);
Example #42
0
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(UserEvent obj)
 {
     return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr);
 }
Example #43
0
        void PointDownC(UserEvent back, UserAction action)
        {
            float x = action.CanPosition.x - back.GlobalPosition.x;
            float y = action.CanPosition.y - back.GlobalPosition.y;

            x /= back.GlobalScale.x;
            y /= back.GlobalScale.y;
            if (x < -128)
            {
                x = -128;
            }
            else if (x > 128)
            {
                x = 128;
            }
            if (y < -128)
            {
                y = -128;
            }
            else if (y > 128)
            {
                y = 128;
            }
            if (NobB != null)
            {
                NobB.localPosition = new Vector3(x, y, 0);
            }
            int dx = (int)x + 128;

            if (dx < 0)
            {
                dx = 0;
            }
            else if (dx > 255)
            {
                dx = 255;
            }
            int dy = (int)y + 128;

            if (dy < 0)
            {
                dy = 0;
            }
            else if (dy > 255)
            {
                dy = 255;
            }
            Index = dy * 256 + dx;
            if (Index >= 256 * 256)
            {
                Index = 256 * 256 - 1;
            }
            Color col = palette.buffer[Index];

            SelectColor.r = col.r;
            SelectColor.g = col.g;
            SelectColor.b = col.b;
            if (ColorChanged != null)
            {
                ColorChanged(this);
            }
        }
Example #44
0
 public override void SendTradeSignalEvent(ProtectedOperationContext ctx, int accountId,
     int tradeSignalCategory, UserEvent acEvent)
 {
     try
     {
         proxyTrade.proxy.SendTradeSignalEvent(ctx, accountId, tradeSignalCategory, acEvent);
     }
     catch (Exception ex)
     {
         Logger.ErrorFormat("Ошибка в SendTradeSignalEvent(acc: {0}, cat: {1}): {2}",
             accountId, tradeSignalCategory, ex);
     }
 }
Example #45
0
 void DragEnd(UserEvent callBack, UserAction action, Vector2 v)
 {
 }
Example #46
0
 public Builder setUserEvent(UserEvent _event)
 {
     mEvent = _event;
     return(this);
 }
Example #47
0
 public UserEventArgs(UserEvent userEvent, object data)
 {
     UserEvent = userEvent;
     Data      = data;
 }
Example #48
0
 public abstract object SelfDeserialize(UserEvent.EventType type, byte[] body);
Example #49
0
 public static USER_EVENT UndecorateUserEvent(UserEvent evt)
 {
     return new USER_EVENT
     {
         User = evt.User,
         Time = evt.Time,
         Action = (short)evt.Action,
         Code = (short)evt.Code,
         Text = evt.Text,
         Title = evt.Title,
         Account = evt.AccountId
     };
 }
Example #50
0
        void Scrolling(UserEvent back, Vector2 v)
        {
            if (Main == null)
            {
                return;
            }
            if (BindingData == null)
            {
                return;
            }
            v.x /= eventCall.Context.localScale.x;
            v.x  = -v.x;
            v.y /= eventCall.Context.localScale.y;
            switch (scrollType)
            {
            case ScrollType.None:
                v     = ScrollNone(v);
                _pos += v;
                break;

            case ScrollType.Loop:
                _pos.x += v.x;
                if (_pos.x < 0)
                {
                    _pos.x += _contentSize.x;
                }
                else
                {
                    _pos.x %= _contentSize.x;
                }
                _pos.y += v.y;
                if (_pos.y < 0)
                {
                    _pos.y += _contentSize.y;
                }
                else
                {
                    _pos.y %= _contentSize.y;
                }
                break;

            case ScrollType.BounceBack:
                v     = BounceBack(v);
                _pos += v;
                break;
            }
            Order();
            if (v != Vector2.zero)
            {
                if (Scroll != null)
                {
                    Scroll(this, v);
                }
            }
            else
            {
                if (ScrollEnd != null)
                {
                    ScrollEnd(this);
                }
            }
        }
 // Use this for initialization
 void Start()
 {
     userEvent = userObject.GetComponent<UserEvent>();
     userEvent.OnUserInput += EventHandler;
 }
Example #52
0
 /// <summary>
 /// 回弹滚动
 /// </summary>
 /// <param name="eventCall">用户事件</param>
 /// <param name="v">参考移动量</param>
 /// <param name="x"></param>
 /// <param name="y"></param>
 /// <returns></returns>
 protected Vector2 BounceBack(UserEvent eventCall, ref Vector2 v, ref float x, ref float y)
 {
     if (eventCall.Pressed)
     {
         float r = 1;
         if (y < 0)
         {
             if (v.y < 0)
             {
                 r += y / (Size.y * 0.5f);
                 if (r < 0)
                 {
                     r = 0;
                 }
                 eventCall.VelocityY = 0;
             }
         }
         else if (y + Size.y > height)
         {
             if (v.y > 0)
             {
                 r = 1 - (y - height + Size.y) / (Size.y * 0.5f);
                 if (r < 0)
                 {
                     r = 0;
                 }
                 else if (r > 1)
                 {
                     r = 1;
                 }
                 eventCall.VelocityY = 0;
             }
         }
         y += v.y * r;
     }
     else
     {
         x -= v.x;
         y += v.y;
         if (x < 0)
         {
             if (v.x > 0)
             {
                 if (eventCall.DecayRateX >= 0.99f)
                 {
                     eventCall.DecayRateX = 0.9f;
                     eventCall.VelocityX  = eventCall.VelocityX;
                 }
             }
         }
         else if (x + Size.x > ActualSize.x)
         {
             if (v.x < 0)
             {
                 if (eventCall.DecayRateX >= 0.95f)
                 {
                     eventCall.DecayRateX = 0.9f;
                     eventCall.VelocityX  = eventCall.VelocityX;
                 }
             }
         }
         if (y < 0)
         {
             if (v.y < 0)
             {
                 if (eventCall.DecayRateY >= 0.95f)
                 {
                     eventCall.DecayRateY = 0.9f;
                     eventCall.VelocityY  = eventCall.VelocityY;
                 }
             }
         }
         else if (y + Size.y > ActualSize.y)
         {
             if (v.y > 0)
             {
                 if (eventCall.DecayRateY >= 0.95f)
                 {
                     eventCall.DecayRateY = 0.9f;
                     eventCall.VelocityY  = eventCall.VelocityY;
                 }
             }
         }
     }
     return(v);
 }
 void CenterPointEntry(UserEvent callBack, UserAction action)
 {
     Cover.transform.localPosition = Vector3.zero;
     Cover.SizeDelta = model.SizeDelta;
     Cover.gameObject.SetActive(true);
 }
Example #54
0
 void PointDown(UserEvent callBack, UserAction action)
 {
     Origin  = callBack.ScreenToLocal(action.CanPosition);
     LastPos = Origin;
     loopBuffer.Clear();
 }
 void PointLeave(UserEvent callBack, UserAction action)
 {
     Cover.gameObject.SetActive(false);
 }
Example #56
0
 void ItemClick(UserEvent user, UserAction action)
 {
     Debug.Log("Item: " + (int)user.DataContext + " Click !");
 }
Example #57
0
        public void systemHandler(Dictionary <String, Object> data)
        {
            // Retrive context from dictionary
            HttpContext context = (HttpContext)data["HttpResponse"];

            // Set type of expected string
            context.Response.ContentType = "text/html;charset=UTF-8";

            // Initialize Value
            String userEventJSONObject = "";
            String docUUID             = "";

            // Get parameters from url
            userEventJSONObject = context.Request.Params["event"];
            docUUID             = context.Request.Params["ticket"];

            // Send values to be evaluated
            try
            {
                // Authenticate user to see if it has firstly logged in if not then
                // Redirect that person, also to see if event is not null as well as the uuid of new document
                if ((context.Session["userId"] == null &&
                     context.Session["userFistName"] == null &&
                     context.Session["userLastName"] == null) ||
                    (userEventJSONObject == null || userEventJSONObject == "") ||
                    (docUUID == null || docUUID == ""))
                {
                    context.Response.Redirect("", false);
                    context.ApplicationInstance.CompleteRequest();
                    return;
                }

                // get and set the properties to send across and insert them in database with extra property userId
                UserEvent userEvent = new UserEvent(
                    docUUID
                    , "JSON"
                    , "CE"
                    , userEventJSONObject
                    , 1
                    , DateTime.UtcNow
                    , "NewUserCalendarEvent"
                    , (Decimal)context.Session["userId"]);

                //Send Object with all Data remotely to be stored eventually
                userDocumentsFacade = new DocumentFacade();
                userDocumentsFacade.setEvent(userEvent);

                // I was thinking on hitting the DB again by executing a Store Proc that can retrive ONLY the new inserted Row
                // But since it will go its way I can just send back the JSON string I just saved to the view without having to retrive it again
                // From the DB, if its an error its going... I should change the interface so that it returns a success of fail and then evaluate
                // Whether to send back a null for failure or the event back, REMINDER: I'll do it after I can update and delete events
                //String test = JsonConvert.SerializeObject(portalData);

                // Send New Event back again
                context.Response.Write(userEventJSONObject);
            }

            catch (Exception e)
            {
                e.ToString();
            }
        }
        public void systemHandler(Dictionary <String, Object> data)
        {
            // Retrive context from dictionary
            HttpContext context = (HttpContext)data["HttpResponse"];

            // Set type of expected string
            context.Response.ContentType = "text/html;charset=UTF-8";

            // Initialize Value
            String userEventJSONObject = "";
            String docUUID             = "";

            // Get parameters from url
            userEventJSONObject = context.Request.Params["event"];
            docUUID             = context.Request.Params["ticket"];
            Dictionary <String, Object> portalData = new Dictionary <string, object>();

            try
            {
                // Authenticate user to see if it has firstly logged in if not then
                // Redirect that person, also to see if event is not null as well as the uuid of new document
                if ((context.Session["userId"] == null &&
                     context.Session["userFistName"] == null &&
                     context.Session["userLastName"] == null) ||
                    (userEventJSONObject == null || userEventJSONObject == "") ||
                    (docUUID == null || docUUID == ""))
                {
                    context.Response.Redirect("", false);
                    context.ApplicationInstance.CompleteRequest();
                    return;
                }

                // get and set the properties to send across and insert them in database with extra property userId
                // The docVersion should not be hardcoded I am just tired and I want to get the big Pic done
                UserEvent userEvent = new UserEvent(
                    docUUID
                    , "JSON"
                    , "CE"
                    , userEventJSONObject
                    , 2
                    , DateTime.UtcNow
                    , "DeleteCalendarEvent"
                    , (Decimal)context.Session["userId"]);

                //Send Object with all Data remotely to be stored eventually
                userDocumentsFacade = new DocumentFacade();
                userDocumentsFacade.deleteEvent(userEvent);

                // Get all the events
                portalData = userDocumentsFacade.getEvents((Decimal)context.Session["userId"]);

                // Test
                String test = JsonConvert.SerializeObject(portalData);

                // Send New Event back again
                context.Response.Write(JsonConvert.SerializeObject(portalData));
            }

            catch (Exception e)
            {
                e.ToString();
            }
        }
Example #59
0
 public static extern void al_unref_user_event(UserEvent *evt);