Example #1
0
        static void Work(string rpcUrl)
        {
            //使用分布式事务
            using (DistributedTransaction distributedTransaction = new DistributedTransaction(rpcUrl))
            {
                var list = new List <ParticipantInfo>();

                var pi1 = new ParticipantInfo()
                {
                    Participant = _rpcServiceProxy.OrderService,
                    Method      = "AddOrderTry",
                    Args        = new object[] { "aaa", 10 }
                };


                var pi2 = new ParticipantInfo()
                {
                    Participant = _rpcServiceProxy.InventoryService,
                    Method      = "ReduceInventoryTry",
                    Args        = new object[] { "bbb", 10 }
                };

                list.Add(pi1);

                list.Add(pi2);

                distributedTransaction.Regist(list);
            }
        }
Example #2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                string strErrMsg = "";
                if (ValidatePaticipantControls(ref strErrMsg))
                {
                    if (PaticipantData == null)
                    {
                        PaticipantData = new ParticipantInfo();
                    }

                    PaticipantData.ParticipantName = txtName.Text;
                    PaticipantData.StructureNo     = txtStructNo.Text;
                    PaticipantData.Grade           = txtGrade.Text;
                    PaticipantData.ParticipantType = (string)cmbType.SelectedItem;
                    PaticipantData.Structure       = ChemRenditor.MolfileString;
                    PaticipantData.StructureImage  = (object)ChemRenditor.Image;
                    PaticipantData.InchiKey        = Convert.ToString(ChemistryOperations.GetStructureInchiKey(ChemRenditor.MolfileString));

                    DialogResult = System.Windows.Forms.DialogResult.OK;
                }
                else
                {
                    MessageBox.Show(strErrMsg.Trim(), GlobalVariables.MessageCaption, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            catch (Exception ex)
            {
                ErrorHandling.WriteErrorLog(ex.ToString());
            }
        }
        /// <summary>
        /// Unknown Visitor incident.
        /// </summary>
        /// <param name="incidentRequestData">The incident data.</param>
        /// <returns>The task for await.</returns>
        public async Task <ICall> CallUnknownVisitorAsync(IncidentRequestData incidentRequestData)
        {
            // A tracking id for logging purposes. Helps identify this call in logs.
            var    scenarioId         = string.IsNullOrEmpty(incidentRequestData.ScenarioId) ? Guid.NewGuid() : new Guid(incidentRequestData.ScenarioId);
            string incidentId         = Guid.NewGuid().ToString();
            var    incidentStatusData = new IncidentStatusData(incidentId, incidentRequestData);
            var    incident           = this.IncidentStatusManager.AddIncident(incidentId, incidentStatusData);
            var    receptionObjectId  = incidentRequestData.ObjectIds.First(); // call the receptionist
            var    buildingObjectId   = incidentRequestData.ObjectIds.Last();  // call the building

            var receptionTarget =
                new ParticipantInfo
            {
                Identity = new IdentitySet
                {
                    User = new Identity
                    {
                        Id = receptionObjectId,
                    },
                },
            };
            var buildingTarget =
                new ParticipantInfo
            {
                Identity = new IdentitySet
                {
                    User = new Identity
                    {
                        Id = buildingObjectId,
                    },
                },
            };

            var call = new Call
            {
                Targets             = new[] { receptionTarget },
                MediaConfig         = new ServiceHostedMediaConfig {
                },
                RequestedModalities = new List <Modality> {
                    Modality.Video
                },
                TenantId = incidentRequestData.TenantId,
            };

            // call the receptionist
            var statefulCall = await this.Client.Calls().AddAsync(call, scenarioId: scenarioId).ConfigureAwait(false);

            // add the building
            var addParticipantRequestData = new AddParticipantRequestData()
            {
                ObjectId = buildingObjectId,
            };

            await this.MyAddParticipantAsync(statefulCall.Id, addParticipantRequestData).ConfigureAwait(false);

            this.graphLogger.Info($"Call creation complete: {statefulCall.Id}");

            // return botMeetingCall;
            return(null);
        }
Example #4
0
        public async Task JoinRetrospectivePage_KnownRetrospective_JoinAsFacilitatorUpdatesParticipantListInRealtime()
        {
            // Given
            string retroId = await this.CreateRetrospective("scrummaster", "secret");

            string myName = Name.Create();

            this.Page.Navigate(this.App, retroId);

            var secondInstance = this.App.CreatePageObject <JoinRetrospectivePage>().RegisterAsTestDisposable();

            secondInstance.Navigate(this.App, retroId);

            // When
            this.Page.NameInput.SendKeys(myName);
            new SelectElement(this.Page.ColorSelect).SelectByIndex(2);
            this.Page.IsFacilitatorCheckbox.Click();
            this.Page.WebDriver.Retry(_ => {
                this.Page.FacilitatorPassphraseInput.SendKeys("scrummaster");
                return(true);
            });
            this.Page.Submit();

            Thread.Sleep(500);

            using IServiceScope scope = this.App.CreateTestServiceScope();
            scope.SetNoAuthenticationInfo();
            ParticipantsInfoList participants = await scope.Send(new GetParticipantsInfoQuery(retroId));

            ParticipantInfo facilitator = participants.Participants.First(x => x.Name == myName);

            // Then
            Assert.That(() => secondInstance.OnlineList.OnlineListItems.Select(x => x.Text), Has.One.Contains(myName));
            Assert.That(() => secondInstance.OnlineList.GetListItem(facilitator.Id).FindElements(By.ClassName("fa-crown")), Is.Not.Empty.Retry());
        }
Example #5
0
        private static List <ParticipantInfo> GetParticipantsFromTableOnStepID(DataTable partpntsData, int rxnStepID)
        {
            List <ParticipantInfo> lstPartpnts = null;

            try
            {
                if (partpntsData != null)
                {
                    EnumerableRowCollection <DataRow> rows = from row in partpntsData.AsEnumerable()
                                                             where row.Field <Int64>("RXN_STEP_ID") == rxnStepID
                                                             select row;

                    lstPartpnts = new List <ParticipantInfo>();
                    foreach (DataRow drow in rows)
                    {
                        ParticipantInfo partpntInfo = new ParticipantInfo();
                        //partpntInfo.ReactionID = reactionID;
                        partpntInfo.RxnStepID       = rxnStepID;
                        partpntInfo.ParticipantID   = Convert.ToInt32(drow["PRPNT_ID"]);
                        partpntInfo.ParticipantName = drow["PRPNT_NAME"].ToString();
                        partpntInfo.ParticipantType = drow["PRPNT_TYPE"].ToString();
                        partpntInfo.Structure       = drow["PRPNT_STRUCTURE"];
                        partpntInfo.StructureNo     = drow["STRUCTURE_NO"].ToString();
                        partpntInfo.InchiKey        = drow["INCHI_KEY"].ToString();
                        partpntInfo.Grade           = drow["GRADE"].ToString();
                        lstPartpnts.Add(partpntInfo);
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorHandling.WriteErrorLog(ex.ToString());
            }
            return(lstPartpnts);
        }
Example #6
0
        private void btnAddParticipant_Click(object sender, EventArgs e)
        {
            try
            {
                FrmEditParticipants frmEditPartpnt = new FrmEditParticipants();
                if (frmEditPartpnt.ShowDialog() == DialogResult.OK)
                {
                    ParticipantInfo objPartpnt = frmEditPartpnt.PaticipantData;
                    objPartpnt.ReactionID = ReactionID;
                    objPartpnt.RxnStepID  = StepID;
                    objPartpnt.StepNo     = SerialNo == 0 ? 1 : SerialNo;
                    objPartpnt.Option     = objPartpnt.ParticipantID > 0 ? DmlOperations.UPDATE.ToString() : DmlOperations.INSERT.ToString();

                    DataTable dtPartpnt = new DataTable();

                    if (ReactionCurationDB.SaveReactionParticipants(objPartpnt, out dtPartpnt))
                    {
                        MessageBox.Show("Participant updated successfully.", GlobalVariables.MessageCaption, MessageBoxButtons.OK, MessageBoxIcon.Information);
                        BindDataToParticipantsGrid(dtPartpnt);
                    }
                    else
                    {
                        MessageBox.Show("Error accured in participant updation.", GlobalVariables.MessageCaption, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorHandling.WriteErrorLog(ex.ToString());
            }
        }
Example #7
0
        void ReadSetup(string path)
        {
            IniFile ini = new IniFile(path);

            inputDirectory         = ini.IniReadValue("Directories", "InputDirectory");
            outputDirectory        = ini.IniReadValue("Directories", "OutputDirectory");
            exceptionDaysDirectory = ini.IniReadValue("Directories", "ExceptionsDirectory");
            toEmailList            = ini.IniReadValue("Email", "To Email List");
            ccEmailList            = ini.IniReadValue("Email", "CC Email List");
            bccEmailList           = ini.IniReadValue("Email", "BCC Email List");

            int    count = 1;
            string pData;

            while ((pData = ini.IniReadValue("Participants", "Participant" + count.ToString())) != "")
            {
                string[] partInfo = pData.Split(new char[] { ';' });

                Array.Resize(ref Participants, count);
                Participants[count - 1] = new ParticipantInfo();
                Participants[count - 1].ParticipantFile          = partInfo[0];
                Participants[count - 1].ParticipantName          = partInfo[1];
                Participants[count - 1].ParticipantSubject       = partInfo[2];
                Participants[count - 1].ParticipantExtention     = partInfo[3];
                Participants[count - 1].ParticipantExceptionDays = GetExceptionDays(partInfo[4]);
                count++;
            }
        }
 public static  EditParticipantInfoDialog Initalize(ParticipantInfo _partInfo, JsonValue _json, Activity _context)
 {
     var dialogFragment = new EditParticipantInfoDialog();
     dialogFragment.json = _json;
     dialogFragment.context = _context;
     dialogFragment.partInfo = _partInfo;
     return dialogFragment;
 }
 public ParticipantInfo Get(Guid activityId)
 {
     if (_participantInfo == null)
     {
         _participantInfo = GetContactIdFromParticipant(activityId);
     }
     return(_participantInfo);
 }
        /// <summary>
        /// Add a specialized message listener (e.g., a MamdaQuoteListener,
        /// MamdaTradeListener, etc.) for a participant.
        ///
        /// Multiple listeners for each participant can be added.
        /// </summary>
        /// <param name="listener">Concrete instance of the MamdaMsgListener interface.</param>
        /// <param name="partId">The participant id for the instrument.</param>
        public void addParticipantListener(
            MamdaMsgListener listener,
            string partId)
        {
            ParticipantInfo participantInfo = getParticipantInfo(partId);

            participantInfo.mParticipantListeners.Add(listener);
        }
Example #11
0
 internal void FillTimingInfo(DriverInfo driverInfo, ParticipantInfo pcVehicleInfo, PCars2SharedMemory pCars2SharedMemory, int vehicleIndex)
 {
     driverInfo.Timing.LastSector1Time = CreateTimeSpan(pCars2SharedMemory.mCurrentSector1Times[vehicleIndex]);
     driverInfo.Timing.LastSector2Time = CreateTimeSpan(pCars2SharedMemory.mCurrentSector2Times[vehicleIndex]);
     driverInfo.Timing.LastSector3Time = CreateTimeSpan(pCars2SharedMemory.mCurrentSector3Times[vehicleIndex]);
     driverInfo.Timing.LastLapTime     = CreateTimeSpan(pCars2SharedMemory.mLastLapTimes[vehicleIndex]);
     driverInfo.Timing.CurrentSector   = pcVehicleInfo.mCurrentSector + 1;
     driverInfo.Timing.CurrentLapTime  = TimeSpan.Zero;
 }
Example #12
0
 private void InsertParticipantInfo(int id, ParticipantInfo item)
 {
     using (var connection = new SqlConnection(ConnectionString))
     {
         item.BICDirectoryEntryId = id;
         string sql = @"insert into ParticipantInfo(BICDirectoryEntryId, NameP, CntrCd, Rgn, Ind, Tnp, Nnp, Adr, DateIn, PtType, Srvcs, XchType, UID, ParticipantStatus, RegN)
                        values(@BICDirectoryEntryId, @NameP, @CntrCd, @Rgn, @Ind, @Tnp, @Nnp, @Adr, @DateIn, @PtType, @Srvcs, @XchType, @UID, @ParticipantStatus, @RegN)";
         connection.Query(sql, item);
     }
 }
Example #13
0
        /// <summary>
        /// Bot calls users.
        /// </summary>
        /// <param name="participantsCallingRequestData">Input data.</param>
        /// <returns>The <see cref="Task"/>.</returns>
        public async Task BotCallsUsersAsync(ParticipantsCallingRequestData participantsCallingRequestData)
        {
            Guid            scenarioId = Guid.NewGuid();
            ParticipantInfo source     = new ParticipantInfo
            {
                Identity = new IdentitySet
                {
                    Application = new Identity
                    {
                        Id = this.appId,
                    },
                },
            };

            Call requestCall = new Call
            {
                Source              = source,
                Targets             = new List <InvitationParticipantInfo>(),
                MediaConfig         = new ServiceHostedMediaConfig {
                },
                RequestedModalities = new List <Modality> {
                    Modality.Audio
                },
                TenantId    = participantsCallingRequestData.TenantId,
                Direction   = CallDirection.Outgoing,
                CallbackUri = new Uri(this.botBaseUri, ControllerConstants.CallbackPrefix).ToString(),
            };

            List <InvitationParticipantInfo> listTargets = new List <InvitationParticipantInfo>();

            foreach (string userId in participantsCallingRequestData.ObjectIds)
            {
                InvitationParticipantInfo target = new InvitationParticipantInfo
                {
                    Identity = new IdentitySet
                    {
                        User = new Identity
                        {
                            Id = userId,
                        },
                    }
                };
                listTargets.Add(target);
            }
            requestCall.Targets = listTargets;
            var callRequest = this.RequestBuilder.Communications.Calls;
            var request     = new GraphRequest <Call>(new Uri(callRequest.RequestUrl), requestCall, RequestType.Create);
            var response    = await this.GraphApiClient.SendAsync <Call, Call>(request, requestCall.TenantId, scenarioId).ConfigureAwait(false);

            Call responseMeetingCall = response.Content;

            this.GraphLogger.Log(
                TraceLevel.Verbose,
                $"Bot called users {participantsCallingRequestData.ObjectIds}, the responded state is {responseMeetingCall?.State}");
        }
Example #14
0
        public void AddParticipantToDb(string ipAddress, string portNumber, string databaseName)
        {
            // TO DO: update the UI to confirm that the message was sent
            ParticipantInfo info = new ParticipantInfo();

            info.IpAddress    = ipAddress;
            info.PortNumber   = Convert.ToInt32(portNumber);
            info.DatabaseName = databaseName;

            SendMessage(BuildMessage(Json.SeralizeObject(info), MessageConsoleAction.Database.Add_Participant, MessageActionType.Database));
        }
Example #15
0
        private IMessage HandleAddParticipant(Message message)
        {
            ParticipantInfo info = new ParticipantInfo();

            info = message.GetContentAs <ParticipantInfo>();
            var db          = _process.GetDatabase(info.DatabaseName);
            var participant = new Participant(new Location(Guid.NewGuid(), info.IpAddress, Convert.ToInt32(info.PortNumber), string.Empty));

            db.AddPendingParticipant(participant);
            return(_messageBuilder.BuildMessage(message.Origin, string.Empty, MessageConsoleAction.Database.Add_Participant_Response, message.Content.GetType(), message.Id, MessageActionType.Database));
        }
        /// <summary>
        /// Returns the participant info object for the specified participant.
        /// If the info object is not already in the map one will be created and
        /// added to the map.
        /// </summary>
        /// <param name="partId"></param>
        /// <returns></returns>
        private ParticipantInfo getParticipantInfo(string partId)
        {
            ParticipantInfo partInfo = (ParticipantInfo)mParticipants.valueOf(partId);

            if (partInfo == null)
            {
                partInfo = new ParticipantInfo();
                mParticipants.put(partId, partInfo);
            }
            return(partInfo);
        }
Example #17
0
 public bool Equals(ParticipantInfo other)
 {
     if (other is null)
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     return(this.Id == other.Id);
 }
 /// <summary>
 /// Process initial images. This is most likely when we will be
 /// notify of consolidate/participant creation.
 /// </summary>
 /// <param name="subscription"></param>
 /// <param name="msg"></param>
 /// <param name="msgType"></param>
 /// <param name="partId"></param>
 private void handleFullImage(
     MamdaSubscription subscription,
     MamaMsg msg,
     mamaMsgType msgType,
     string partId)
 {
     if (partId == null)             /*This is a consolidated initial*/
     {
         checkConsolidatedCreateNotify(subscription);
     }
     else             /*This is a participant initial*/
     {
         ParticipantInfo partInfo = getParticipantInfo(partId);
         checkParticipantCreateNotify(subscription, partId, partInfo);
     }
 }
Example #19
0
    public static string GetChatRequestHtml(UserInfoProxy userInfo, bool forceUpdate)
    {
        LoginUser     loginUser = new LoginUser(userInfo.UserID, userInfo.OrganizationID, null);
        StringBuilder builder   = new StringBuilder();

        ChatRequests requests = new ChatRequests(loginUser);

        requests.LoadWaitingRequests(loginUser.UserID, loginUser.OrganizationID);

        foreach (ChatRequest request in requests)
        {
            ParticipantInfo participant = ChatParticipant.GetParticipantInfo(loginUser, request.RequestorID, request.RequestorType);
            string          row         = "<tr><td class=\"col1\">{0}</td><td class=\"col2\">{1}</td></tr>";
            string          stateClass  = request.RequestType != ChatRequestType.External ? "ui-state-highlight" : "ui-state-default";
            builder.Append(string.Format("<div class=\"ts-panellist-header ui-helper-reset {0} ui-corner-all\" role=\"tab\" aria-expanded=\"false\" tabindex=\"-1\">", stateClass));
            builder.Append("<span class=\"ui-icon ui-icon-triangle-1-e \" />");
            builder.Append("<a href=\"#\">" + participant.FirstName + " " + participant.LastName + " - " + request.DateCreated.ToString("t", loginUser.CultureInfo) + "</a>");
            builder.Append("</div>");
            builder.Append("<div class=\"content\">");
            builder.Append("<table border=\"0\" cellpadding=\"0\" cellspacing=\"5\">");
            builder.Append(string.Format(row, "Email:", participant.Email));
            if (participant.CompanyName != "")
            {
                builder.Append(string.Format(row, "Company:", participant.CompanyName));
            }
            builder.Append(string.Format(row, "Time:", request.DateCreated.ToString("t", loginUser.CultureInfo)));
            builder.Append(string.Format(row, "Message:", request.Message));
            builder.Append("</table>");
            builder.Append(string.Format("<div class=\"accept\"><a class=\"ts-link-button {0} ui-corner-all \" href=\"#\" onclick=\"AcceptRequest({1}); return false;\">Accept</a></div>", stateClass, request.ChatRequestID.ToString()));
            builder.Append("</div>");
        }
        string html = builder.ToString().Trim();

        if (html == "")
        {
            html = "<div class=\"content\">There are no chat requests.</div>";
        }


        if (!forceUpdate && HttpContext.Current.Session["LastRequestHtml"] != null && (string)HttpContext.Current.Session["LastRequestHtml"] == html)
        {
            return("");
        }

        HttpContext.Current.Session["LastRequestHtml"] = html;
        return(html);
    }
 private void checkParticipantCreateNotify(
     MamdaSubscription subscription,
     string partId,
     ParticipantInfo partInfo)
 {
     /*
      * Check if we need to notify of participant creation. A user may have
      * added a listener up front so the PartInfo will exist but we will
      * not have already notified them of the first update for this
      * participant.
      */
     if (!partInfo.mNotifiedPartCreate)
     {
         foreach (MamdaMultiParticipantHandler handler in mHandlers)
         {
             handler.onParticipantCreate(subscription, this, partId, mIsPrimaryParticipant);
         }
         partInfo.mNotifiedPartCreate = true;
     }
 }
Example #21
0
        internal void AddDriversData(SimulatorDataSet data, PCars2SharedMemory pcarsData)
        {
            if (pcarsData.mNumParticipants < 1)
            {
                return;
            }

            data.DriversInfo = new DriverInfo[pcarsData.mNumParticipants];
            DriverInfo playersInfo = null;

            for (int i = 0; i < pcarsData.mNumParticipants; i++)
            {
                ParticipantInfo pcVehicleInfo = pcarsData.mParticipantData[i];
                DriverInfo      driverInfo    = CreateDriverInfo(pcarsData, pcVehicleInfo, i);
                driverInfo.CurrentLapValid = pcarsData.mLapsInvalidated[i] == 0;
                data.DriversInfo[i]        = driverInfo;

                if (driverInfo.IsPlayer)
                {
                    playersInfo = driverInfo;
                }

                if (driverInfo.Position == 1)
                {
                    data.SessionInfo.LeaderCurrentLap = driverInfo.CompletedLaps + 1;
                    data.LeaderInfo = driverInfo;
                }

                AddLappingInformation(data, pcarsData, driverInfo);
                FillTimingInfo(driverInfo, pcVehicleInfo, pcarsData, i);
            }

            _lastPlayer = playersInfo;

            if (playersInfo != null)
            {
                data.PlayerInfo = playersInfo;
            }
        }
Example #22
0
        private DriverInfo CreateDriverInfo(PCars2SharedMemory pcarsData, ParticipantInfo pcVehicleInfo, int vehicleIndex)
        {
            DriverInfo driverInfo = new DriverInfo
            {
                DriverName    = StringExtensions.FromArray(pcVehicleInfo.mName),
                CompletedLaps = (int)pcVehicleInfo.mLapsCompleted,
                CarName       = StringExtensions.FromArray(pcarsData.mCarNames, vehicleIndex * 64),
                CarClassName  = StringExtensions.FromArray(pcarsData.mCarClassNames, vehicleIndex * 64),
                InPits        = pcarsData.mPitModes[vehicleIndex] != 0
            };

            driverInfo.CarClassId    = driverInfo.CarClassName;
            driverInfo.IsPlayer      = vehicleIndex == pcarsData.mViewedParticipantIndex;
            driverInfo.Position      = (int)pcVehicleInfo.mRacePosition;
            driverInfo.Speed         = Velocity.FromMs(pcarsData.mSpeeds[vehicleIndex]);
            driverInfo.LapDistance   = pcVehicleInfo.mCurrentLapDistance;
            driverInfo.TotalDistance = (pcVehicleInfo.mLapsCompleted * pcarsData.mTrackLength) + driverInfo.LapDistance;
            driverInfo.FinishStatus  = FromPCarStatus((RaceState)pcarsData.mRaceStates[vehicleIndex]);
            driverInfo.WorldPosition = new Point3D(Distance.FromMeters(-pcVehicleInfo.mWorldPosition[0]), Distance.FromMeters(pcVehicleInfo.mWorldPosition[1]), Distance.FromMeters(pcVehicleInfo.mWorldPosition[2]));
            ComputeDistanceToPlayer(_lastPlayer, driverInfo, pcarsData.mTrackLength);
            return(driverInfo);
        }
        private void forwardMsg(
            MamdaSubscription subscription,
            MamaMsg msg,
            mamaMsgType msgType,
            String partId)
        {
            if (partId == null)             /*Participant message*/
            {
                /* We may not have an entry for this partId at this stage as
                 * we may not be receiving initial values for the subscription. */
                ParticipantInfo partInfo = getParticipantInfo(partId);

                /* Need to check if we have notified. We may well not be receiving
                 * initials*/
                checkParticipantCreateNotify(subscription, partId, partInfo);

                /* We may have a ParticipantInfo entry for the partId but there is
                 * still no guarantee that any listeners have been registered.
                 * This is quite acceptable as users may not be interested in all
                 * participants. */
                if (partInfo.mParticipantListeners.Count > 0)
                {
                    forwardMsg(partInfo.mParticipantListeners, subscription, msg, msgType);
                }
            }
            else             /*Consolidated message*/
            {
                /* We may not have notified the user that a consolidated message
                 * has arrived. If not using initials this can be the case.*/
                checkConsolidatedCreateNotify(subscription);

                /* Forward the message if we have any listeners*/
                if (mConsolidatedListeners.Count > 0)
                {
                    forwardMsg(mConsolidatedListeners, subscription, msg, msgType);
                }
            }
        }
        /// <summary>
        /// Gets the participant.
        /// </summary>
        /// <param name="serialized">The serialized.</param>
        /// <returns>List&lt;IParticipant&gt;.</returns>
        public List <IParticipant> GetParticipant(SerializableAudioMediaBuffer serialized)
        {
            var list = new List <IParticipant>();

            if (serialized.SerializableUnmixedAudioBuffers != null)
            {
                foreach (var i in serialized.SerializableUnmixedAudioBuffers)
                {
                    var participant = new Participant();
                    var info        = new ParticipantInfo();
                    var identity    = new IdentitySet();
                    var user        = new Identity();

                    user.DisplayName    = i.DisplayName;
                    user.AdditionalData = i.AdditionalData;
                    user.Id             = i.AdId;

                    identity.User    = user;
                    info.Identity    = identity;
                    participant.Info = info;

                    var media = new Microsoft.Graph.MediaStream()
                    {
                        SourceId = i.ActiveSpeakerId.ToString()
                    };
                    participant.MediaStreams = new List <Microsoft.Graph.MediaStream>()
                    {
                        media
                    };

                    participant.IsInLobby = false;

                    list.Add(new ParticipantExtension(participant));
                }
            }

            return(list);
        }
Example #25
0
 public void SetOpponent(ParticipantInfo opponent)
 {
     Opponent = opponent;
 }
		private void checkParticipantCreateNotify(
			MamdaSubscription subscription,
			string            partId,
			ParticipantInfo   partInfo)
		{
			/*
			   Check if we need to notify of participant creation. A user may have
			   added a listener up front so the PartInfo will exist but we will
			   not have already notified them of the first update for this
			   participant.
			 */
			if (!partInfo.mNotifiedPartCreate) 
			{
				foreach (MamdaMultiParticipantHandler handler in mHandlers)
				{
					handler.onParticipantCreate(subscription, this, partId, mIsPrimaryParticipant);
				}
				partInfo.mNotifiedPartCreate = true;
			}
		}
		/// <summary>
		/// Returns the participant info object for the specified participant.
		/// If the info object is not already in the map one will be created and
		/// added to the map.
		/// </summary>
		/// <param name="partId"></param>
		/// <returns></returns>
		private ParticipantInfo getParticipantInfo(string partId)
		{
			ParticipantInfo partInfo = (ParticipantInfo)mParticipants.valueOf(partId);
			if (partInfo == null)
			{
				partInfo = new ParticipantInfo();
				mParticipants.put(partId, partInfo);
			}
			return partInfo;
		}
 public TMController(TableManagerHost h, Tournament t, ParticipantInfo p, BridgeEventBus bus) : base(t, p, bus)
 {
     this.host = h;
 }
 public RetrospectiveJoinedNotification(string retroId, ParticipantInfo participantInfo) : base(retroId)
 {
     this.ParticipantInfo = participantInfo;
 }
        void PopulateParticipantsInfo()
        {
            gVar.dictIdName = new Dictionary<int, string>();
            for (int i = 0; i < jsonParticipants.Count; i++)
            {

                ParticipantInfo _info = new ParticipantInfo();

                _info.displayName = jsonParticipants[i]["participant"]["display_name"];
                _info.userName = jsonParticipants[i]["participant"]["challonge_username"];
                _info.seed = jsonParticipants[i]["participant"]["seed"];
                _info.imgURL = jsonParticipants[i]["participant"]["attached_participatable_portrait_url"];
                _info.id = jsonParticipants[i]["participant"]["id"];

                if (jsonTournament["state"] == "complete")
                    _info.rank = jsonParticipants[i]["participant"]["final_rank"];
                else
                    _info.rank = -1;

                itemsParticipants.Add(_info);

                gVar.dictIdName.Add(jsonParticipants[i]["participant"]["id"], jsonParticipants[i]["participant"]["display_name"]);
            }
        }
Example #31
0
        private void ProcessData()
        {
            EGameState    gameState    = (EGameState)_data.MGameState;
            ESessionState sessionState = (ESessionState)_data.MSessionState;

            if (gameState != _lastGameState)
            {
                if (gameState == EGameState.GameFrontEnd)
                {
                    Reset();
                }
                _lastGameState = gameState;
            }

            if (gameState != EGameState.GameFrontEnd)
            {
                lock (_timingData)
                {
                    if (_timingData.RaceInfo.TrackLongName == null)
                    {
                        if (_data.MTrackLocation.Value != "")
                        {
                            _timingData.RaceInfo.TrackLongName  = _data.MTrackLocation.Value + " " + _data.MTrackVariation.Value;
                            _timingData.RaceInfo.TrackShortName = _data.MTrackLocation.Value;
                            _timingData.RaceInfo.TrackName      = _data.MTrackLocation.Value + " " + _data.MTrackVariation.Value;
                            _timingData.RaceInfo.TrackVariation = _data.MTrackVariation.Value;
                            _timingData.RaceInfo.TrackLength    = (int)_data.MTrackLength;

                            _timingData.RaceInfo.TrackTemperature   = _data.MTrackTemperature;
                            _timingData.RaceInfo.AmbientTemperature = _data.MAmbientTemperature;

                            _trackManager.LoadCurrentTrack(_timingData.RaceInfo.TrackName, _displayName);
                        }
                    }
                }

                if (gameState != EGameState.GameIngamePaused)
                {
                    lock (_telemetryData)
                    {
                        _telemetryData.Car.InCar = true;

                        _telemetryData.Engine.RPM        = _data.MRpm;
                        _telemetryData.Car.Speed         = ConvertSpeedToMPH(_data.MSpeed);
                        _telemetryData.Car.Gear          = _data.MGear;
                        _telemetryData.Car.FuelRemaining = _data.MFuelLevel * _data.MFuelCapacity;
                        _telemetryData.Car.FuelCapacity  = _data.MFuelCapacity;

                        _telemetryData.Engine.WaterTemp = _data.MWaterTempCelsius;

                        _telemetryData.Timing.CurrentLapTime = _data.MCurrentTime;

                        DateTime utcNow = DateTime.UtcNow;
                        if ((utcNow - _lastAnalysisTimeStamp).TotalMilliseconds >= 2000)
                        {
                            ParticipantInfo pi = _data.MParticipantInfo[_data.MViewedParticipantIndex];
                            _analysisData.AddDataPoint(_data.MViewedParticipantIndex, pi.mCurrentLap, _telemetryData.Car.Speed, _telemetryData.Engine.RPM);
                            _lastAnalysisTimeStamp = utcNow;
                        }

                        if (_recording)
                        {
                            SetTrackname(_timingData.RaceInfo.TrackName);

                            for (int i = 0; i < _data.MNumParticipants; i++)
                            {
                                float lapDistance = _data.MParticipantInfo[i].mCurrentLapDistance;

                                if (_lastLapDistance[i] == -1 || (Math.Abs(_lastLapDistance[i] - lapDistance) > _recordingDelta))
                                {
                                    AddTrackPoint(i, _data.MParticipantInfo[i].mCurrentLap, _data.MParticipantInfo[i].mWorldPosition);
                                    _lastLapDistance[i] = lapDistance;
                                }
                            }
                        }

                        if (_trackManager.CurrentTrack != null)
                        {
                            _telemetryData.ResetPlayers();
                            for (int i = 0; i < _data.MNumParticipants; i++)
                            {
                                float x    = -_data.MParticipantInfo[i].mWorldPosition[0] + Math.Abs(_trackManager.CurrentTrack.TrackBounds.MaxGameX);
                                float y    = _data.MParticipantInfo[i].mWorldPosition[2] + Math.Abs(_trackManager.CurrentTrack.TrackBounds.MinGameY);
                                float z    = _data.MParticipantInfo[i].mWorldPosition[1] + Math.Abs(_trackManager.CurrentTrack.TrackBounds.MinGameZ);
                                bool  isMe = false;
                                if (i == _data.MViewedParticipantIndex)
                                {
                                    isMe = true;
                                }
                                _telemetryData.AddPlayer(x, y, z, isMe);
                            }
                        }
                    }
                }
            }
            else
            {
                _telemetryData.Car.InCar = false;
            }
        }
Example #32
0
 public MatchInfo(ParticipantInfo player, ParticipantInfo opponent)
 {
     Player   = player;
     Opponent = opponent;
 }
Example #33
0
        public static bool SaveReactionParticipants(ParticipantInfo rxnPartpnt, out DataTable dtResult)
        {
            bool      blStatus    = false;
            string    strTemp     = String.Empty;
            DataTable dtReactions = new DataTable();

            try
            {
                using (OracleConnection oraCon = ConnectionDB.GetOracleConnection())
                {
                    using (OracleCommand oraCmd = new OracleCommand())
                    {
                        oraCmd.Connection  = oraCon;
                        oraCmd.CommandText = "REACTION_ANALYSIS.DML_PARTICIPANTS";
                        oraCmd.CommandType = CommandType.StoredProcedure;

                        oraCmd.Parameters.Add("PIN_PRPNT_ID", OracleDbType.Int32).Value        = rxnPartpnt.ParticipantID;
                        oraCmd.Parameters.Add("PIN_REACTION_ID", OracleDbType.Int32).Value     = rxnPartpnt.ReactionID;
                        oraCmd.Parameters.Add("PIN_RXN_STEP_ID", OracleDbType.Int32).Value     = rxnPartpnt.RxnStepID;
                        oraCmd.Parameters.Add("PIC_PRPNT_TYPE", OracleDbType.Varchar2).Value   = rxnPartpnt.ParticipantType;
                        oraCmd.Parameters.Add("PIC_PRPNT_STRUCTURE", OracleDbType.Clob).Value  = rxnPartpnt.Structure;
                        oraCmd.Parameters.Add("PIC_INCHI_KEY", OracleDbType.Varchar2).Value    = rxnPartpnt.InchiKey;
                        oraCmd.Parameters.Add("PIC_PRPNT_NAME", OracleDbType.Varchar2).Value   = rxnPartpnt.ParticipantName;
                        oraCmd.Parameters.Add("PIC_STRUCTURE_NO", OracleDbType.Varchar2).Value = rxnPartpnt.StructureNo;
                        oraCmd.Parameters.Add("PIC_GRADE", OracleDbType.Varchar2).Value        = rxnPartpnt.Grade;

                        oraCmd.Parameters.Add("PIC_OPTION", OracleDbType.Varchar2).Value = rxnPartpnt.Option.ToString();

                        OracleParameter paramStatus = new OracleParameter();
                        paramStatus.ParameterName = "POC_STATUS";
                        paramStatus.Direction     = ParameterDirection.Output;
                        paramStatus.OracleDbType  = OracleDbType.Varchar2;
                        paramStatus.Size          = 200;
                        oraCmd.Parameters.Add(paramStatus);


                        oraCmd.Parameters.Add("PORC_PARITCIPANTS", OracleDbType.RefCursor).Direction = ParameterDirection.Output;

                        //TODO: Need to discuss with sairam to add UR_ID.
                        // oraCmd.Parameters.Add("PIN_UR_ID", OracleDbType.Int32).Value = usrInfo.UserID;

                        using (OracleDataAdapter dataAdapter = new OracleDataAdapter(oraCmd))
                        {
                            dataAdapter.Fill(dtReactions);
                        }
                        if (paramStatus.Value != null)
                        {
                            if (paramStatus.Value.ToString().Length > 0)
                            {
                                strTemp = Convert.ToString(oraCmd.Parameters["POC_STATUS"].Value);
                                if (strTemp.ToUpper() == "UPDATE SUCCESS" || strTemp.ToUpper() == "INSERT SUCCESS" || strTemp.ToUpper() == "DELETE SUCCESS")
                                {
                                    blStatus = true;
                                }
                            }
                        }
                        dtResult = dtReactions;
                        return(blStatus);
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
            dtResult = dtReactions;
            return(blStatus);
        }
Example #34
0
 public ParticipantChangedNotification(ParticipantInfo changedInfo)
 {
     this.ChangedInfo = changedInfo;
 }