public void CheckCallInStatus_AnyCallIds_IsCallerTrue() { // Setup dependence var settingMock = new Mock<ISettings>(); var componentMock = new Mock<IComponents>(); var uowMock = new Mock<IUnitOfWork>(); var repositoryMock = new Mock<IRepository>(); var serviceLocatorMock = new Mock<IServiceLocator>(); serviceLocatorMock.Setup(r => r.GetInstance<IRepository>()) .Returns(repositoryMock.Object); ServiceLocator.SetLocatorProvider(() => serviceLocatorMock.Object); // Arrange data Guid id = Guid.NewGuid(); bool expectedResult = true; string status = "Pending"; bool isCaller = true; Call call = new Call { Id = id, CallerStatus = status }; repositoryMock.Setup(r => r.FindById<Call>(id)).Returns(call); // Act CallService callService = new CallService(uowMock.Object, repositoryMock.Object, settingMock.Object, componentMock.Object); bool currentResult = callService.CheckCallInStatus(id, status, isCaller); // Assert repositoryMock.Verify(r => r.FindById<Call>(id)); Assert.AreEqual(expectedResult, currentResult); }
private void onSkypeCallStatus(Call call, TCallStatus status) { switch (status) { //new call //TODO: check why clsInprogress doesnt work here! case TCallStatus.clsRinging: TCallType type = call.Type; if ((type == TCallType.cltIncomingP2P) || (type == TCallType.cltOutgoingP2P)) { foreach (DCallStartedHandler callStartedHandler in callStartedHandlers) { callStartedHandler(call.PartnerHandle, call.Id, type == TCallType.cltOutgoingP2P); } } break; //call closed case TCallStatus.clsMissed: case TCallStatus.clsFinished: case TCallStatus.clsRefused: case TCallStatus.clsCancelled: foreach (DCallEndedHandler callEndedHandler in callEndedHandlers) { callEndedHandler(call.PartnerHandle, call.Id); } break; default: Logger.log(TLogLevel.logEverything, "Info: Call status changed to: " + status); break; } }
private void Fill(DbDataReader reader, Call call) { call.Start = DateUtils.ConvertFromLinuxStamp(reader.GetValueObject<long>("begin_timestamp")); call.Duration = TimeSpan.FromSeconds(reader.GetValueObject<long>("duration")); call.Host_Identity = reader.GetObject<string>("host_identity"); call.Id = reader.GetValueObject<long>("id"); }
static void Main() { DateTime date1 = new DateTime(2013, 5, 24, 11, 11, 30); DateTime date2 = new DateTime(2013, 5, 24, 15, 23, 2); DateTime date3 = new DateTime(2013, 5, 31, 9, 00, 00); DateTime date4 = new DateTime(2013, 5, 31, 18, 12, 20); Call call1 = new Call(date1, "0888313233", 850); Call call2 = new Call(date2, "0888909090", 95); Call call3 = new Call(date3, "0889556677", 213); Call call4 = new Call(date4, "0888313233", 37); Battery battery = new Battery ("PX8", BatteryType.LiIon, 300, 8); Display display = new Display(4, 16000000); GSM gsm = new GSM("I900", "Samsung", 500, "Me", battery, display); gsm.AddCalls(call1); gsm.AddCalls(call2); gsm.AddCalls(call3); gsm.AddCalls(call4); foreach (var call in gsm.CallHistory) { Console.WriteLine(call); } Console.WriteLine("Total amount to pay: {0:C}",gsm.TotalCallsPrice); gsm.DeleteCalls(call1); Console.WriteLine("Total amount to pay: {0:C}", gsm.TotalCallsPrice); gsm.ClearHistory(); Console.WriteLine("Total amount to pay: {0:C}", gsm.TotalCallsPrice); }
static void Main() { try { BatteryEnumeration battery = BatteryEnumeration.CreateBattery(); DisplayEnumeration display = DisplayEnumeration.CreateDisplay(); GSMStatic phone = GSMProperty.CreatePhone<GSMStatic>(battery, display); string info = phone.ToString(); Console.WriteLine("Phone info:"); Console.WriteLine(info); Console.WriteLine(); Console.WriteLine("Phone info about iPhone 4S:"); Console.WriteLine(GSMStatic.IPhone4S); Console.WriteLine(); Console.WriteLine("Enter dailed phone number"); string dialedNumber = Console.ReadLine(); Call call = new Call(phone, dialedNumber); Console.WriteLine("You called {0}", call.DailedPhone); Console.WriteLine("Date {0:dd:MM:yyyy}", call.Date); Console.WriteLine("at {0} o'clock", call.StartTime); Console.WriteLine("Press enter to finish the call"); Console.ReadLine(); Console.WriteLine("The call duration was {0}", call.FinishCall()); } catch (Exception ex) { Console.WriteLine(ex); } }
//Problem 12. Call history test //Write a class GSMCallHistoryTest to test the call history functionality of the GSM class. //Create an instance of the GSM class. //Add few calls. //Display the information about the calls. //Assuming that the price per minute is 0.37 calculate and print the total price of the calls in the history. //Remove the longest call from the history and calculate the total price again. //Finally clear the call history and print it. public static GSM CallHistory() { Console.WriteLine(new string('=' , 60)); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("Now showing the call history!"); Console.ResetColor(); var phone = new GSM("Xperia Z2", "Sony", 1200.99M, "Rocho", new Battery(BatteryType.LiIon), new Display(5.1, 16000000), ColorOfPhones.Black); phone.AddCalls(new Call(DateTime.Parse("03/03/2003 12:00:44"), "0888454124", 154)); phone.AddCalls(new Call(DateTime.Parse("02/04/2003 13:00:44"), "0899975412", 647)); phone.AddCalls(new Call(DateTime.Parse("06/10/2003 23:40:44"), "0894526475", 345)); var callMoney = phone.TotalPriceOfCalls(); Console.WriteLine("Total calls price: {0:F2} лв.", callMoney); Call longestCall = new Call(DateTime.Parse("06/10/2003 23:40:44"), "", 0); foreach (var call in phone.CallHistory) { if (call.DurationInSeconds > longestCall.DurationInSeconds) { longestCall = call; } } phone.DeleteCalls(longestCall); callMoney = phone.TotalPriceOfCalls(); Console.WriteLine("Total calls price without the longest call: {0:F2} лв.", callMoney); phone.ClearCalls(); Console.WriteLine("Call histroy has been cleared!"); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("This test was done on this device:"); Console.ResetColor(); return phone; }
static void Main() { Console.WriteLine("Creating a new phone"); MobilePhone yourPhone = new MobilePhone("tPhone", "Telerik", 250, "Pesho"); Call firstCall = new Call(new DateTime(2015,03,12,21,15,59),"0887654321", 123); Call secondCall = new Call(new DateTime(2015, 03, 12, 22, 37, 01), "Mum", 1235); Call thirdCall = new Call(new DateTime(2015, 03, 13, 02, 49, 10), "Ex girlfriend", 30); yourPhone.AddCall(firstCall); yourPhone.AddCall(secondCall); yourPhone.AddCall(thirdCall); var result = yourPhone.SomeCalls; foreach (var call in result) { Console.WriteLine(call.PrintCalls()); } double billToPay = yourPhone.CalculateInvoice(0.37, yourPhone.SomeCalls); Console.WriteLine(); Console.WriteLine("Your invoice to pay is {0:C}",billToPay); var longestCall = yourPhone.SomeCalls.OrderBy(x => x.Duration).Last(); yourPhone.RemoveCall(longestCall); billToPay = yourPhone.CalculateInvoice(0.37, yourPhone.SomeCalls); Console.WriteLine("Your invoice to pay after removing the call to your mother is {0:C}", billToPay); yourPhone.ClearHistory(yourPhone.SomeCalls); billToPay = yourPhone.CalculateInvoice(0.37, yourPhone.SomeCalls); Console.WriteLine("Your invoice after last payment is {0:C}", billToPay); }
public static GSMHistory MakeHistory() { BatteryEnumeration battery = BatteryEnumeration.CreateBattery(); DisplayEnumeration display = DisplayEnumeration.CreateDisplay(); GSMHistory phone = GSMProperty.CreatePhone<GSMHistory>(battery, display); string info = phone.ToString(); Console.WriteLine("Phone info:"); Console.WriteLine(info); Console.WriteLine(); Console.WriteLine("Phone info about iPhone 4S:"); Console.WriteLine(GSMHistory.IPhone4S); Console.WriteLine(); byte dialing = 0; do { Console.WriteLine("For new dial enter 1, for last dial enter 0"); dialing = byte.Parse(Console.ReadLine()); Console.WriteLine("Enter dailed phone number"); string dialedNumber = Console.ReadLine(); Call call = new Call(phone, dialedNumber); Console.WriteLine("Press enter to finish the call"); Console.ReadLine(); call.FinishCall(); phone.AddCall(call); } while (dialing == 1); return phone; }
public static void Main() { GSM myGSM = new GSM( "Asha 205 ", "Nokia", "Nikolay Kostadinov", 120m, "Nokia", 200, 10, 4, 65000u); Random rnd = new Random(); for (int i = 1; i < 50; i++) { Call call = new Call("+359886630111", (uint)rnd.Next(45, 200)); myGSM.AddCall(call); } Console.WriteLine(GSM.Iphone4S); DisplayCallHistory(myGSM); Console.ReadKey(); DeleteMaxDurationCall(myGSM); DisplayCallHistory(myGSM); }
internal static string getRequest(string parentkey, string id, string proc, object[] args, bool connect_as) { if (proc == "writegroup") { List<object> newArgs = new List<object>(); foreach (Dictionary<string, object> dict in args) { foreach (KeyValuePair<string, object> kvp in dict) { object[] formattingArray = new object[2]; formattingArray[0] = kvp.Key; formattingArray[1] = kvp.Value; newArgs.Add(formattingArray); } args[0] = newArgs.ToArray(); } } Call call = new Call { id = 1, procedure = proc, arguments = args }; Call[] calls = new Call[] { call }; Auth auth; if (connect_as) { auth = new Auth { cik = parentkey, client_id = id }; } else { auth = new Auth { cik = parentkey, resource_id = id }; } Request req = new Request { auth = auth, calls = calls }; return JsonConvert.SerializeObject(req, Formatting.None, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore }); }
static void Main() { const decimal PricePerMinute = 0.37m; //Array of 5 phones GSM[] phones = new GSM[5]; // Different types of batteries and displays Battery battery1 = new Battery(Battery.BatteryType.NiMH, 50, 10); Battery battery2 = new Battery(Battery.BatteryType.LiIon, 40, 5); Battery battery3 = new Battery(Battery.BatteryType.ZnChl, 100, 40); Display display1 = new Display(5.0, 1000000); Display display2 = new Display(5.5, 103530050); Display display3 = new Display(4, 425324); //Some phones created phones[0] = new GSM("Samsung Galaxy S4", "Samsung" , 1444.44 , "Pesho Ivanov" , battery: battery1 , display: display1); phones[1] = new GSM("iPhone 5", "Apple", 1500, "Bill Gates", battery: battery2, display: display3); phones[2] = new GSM("HTC One X", "HTC", 1200, "Someone Else", battery: battery3); phones[3] = new GSM("Nokia 3310", "Nokia",null,null,null,display: display2); phones[4] = GSM.PIPhone4S; //Using the class GSMtest we print all the phones using method Console.WriteLine("PHONES:"); Console.WriteLine(); GSMTest gsmTestPrint = new GSMTest(); gsmTestPrint.PrintAllPhones(phones); Console.WriteLine("CALLS:"); Console.WriteLine(); //For the first phone we create call history phones[0].CallHistory = new CallHistory(); CallHistory history = phones[0].CallHistory; //Adding 4 calls with different params Call testCall1 = new Call(DateTime.Now.AddHours(2), 450, 532423); Call testCall2 = new Call(DateTime.UtcNow, 440, 12532423); Call testCall3 = new Call(DateTime.MinValue, 29, 94532423); Call testCall4 = new Call(DateTime.MaxValue, 90, 3532423); history.AddCall(testCall1); history.AddCall(testCall2); history.AddCall(testCall3); history.AddCall(testCall4); //Then we test the history GSMCallHistoryTest callHistoryTest = new GSMCallHistoryTest(phones[0].CallHistory); //We print the list and then the first calculated price callHistoryTest.PrintList(); callHistoryTest.PrintCalculatedPrice(PricePerMinute); //Then we remove the longest call and print the total price again callHistoryTest.RemoveLongestCall(); callHistoryTest.PrintCalculatedPrice(PricePerMinute); //Then we remove a call on position in the list - 1 and print the price we have to pay again callHistoryTest.RemoveCallTest(position:1); callHistoryTest.PrintCalculatedPrice(PricePerMinute); //We print the remaining calls on the list to show it's not empty yet Console.WriteLine(); Console.WriteLine("The remaining items on the call list:"); callHistoryTest.PrintList(); //Finally we clear the list and print it callHistoryTest.ClearList(); callHistoryTest.PrintList(); }
public void SerializeDeserialize_WithResultReturnArrayOfComplexObjects_ShouldWork() { var inputCall = new Call { Result = new CallResult { Return = new[] { SampleObject.GetSampleObject(), SampleObject.GetSampleObject(), SampleObject.GetSampleObject() } } }; Call outputCall = SerializeDeserialize(inputCall); AssertThatCallsAreEqual(outputCall, inputCall); }
public void SerializeDeserialize_WithResultReturnString_ShouldWork() { var inputCall = new Call { Result = new CallResult { Return = "TestReturn" } }; Call outputCall = SerializeDeserialize(inputCall); AssertThatCallsAreEqual(outputCall, inputCall); }
public void SerializeDeserialize_WithEmptyCall_ShouldWork() { var inputCall = new Call(); Call outputCall = SerializeDeserialize(inputCall); AssertThatCallsAreEqual(outputCall, inputCall); }
static void Main() { Console.WriteLine("Pres Enter to stop!"); Call call = new Call(TimeNow); Timer time = new Timer(call.Invoke, null, 0, 1000); Console.Read(); }
public static Task<CallMessageData> TransferAsync(this AudioVideoCall self, Call callToReplace) { return Task.Factory.FromAsync<Call, CallMessageData>( self.BeginTransfer, self.EndTransfer, callToReplace, null); }
public void Setup() { _provider = _fixture.Freeze<Mock<ICallApiProvider>>(); _provider.Setup(x => x.GetInfo(It.IsAny<int>())) .Returns(new CallInfo() { MediaStatus = CallMediaState.Active }); _fixture.Register<ICallManagerInternal>(() => _fixture.CreateAnonymous<DefaultCallManager>()); _sut = _fixture.Build<Call>().OmitAutoProperties().CreateAnonymous(); }
private void callToolStripMenuItem_Click(object sender, EventArgs e) { Call newMDIChild = new Call(); // Set the Parent Form of the Child window. newMDIChild.MdiParent = this; // Display the new form. newMDIChild.Show(); }
public void Animate(Call call, Response response, CallContext context) { JSON js = new JSON(); js.serialized = call.GetParameterString("animation"); lock (queueLock) { callQueue.Enqueue(new GuideCall(AvatarGuide.State.ANIMATING, (AvatarAnimation)js.ToJSON("avatarAnimation"))); } }
public SignallingSession(Call owner, ICallManagerInternal callManager) { _callManager = callManager; Helper.GuardNotNull(owner); Helper.GuardNotNull(callManager); _call = new WeakReference(owner); _state = owner.IsIncoming ? (AbstractState) new IncomingInviteState(this) : new NullInviteState(this); }
public static void Main(string[] args){ Comunication write = new Write(); Comunication call = new Call(); write.comunicate(); call.comunicate(); }
private static Call SerializeDeserialize(Call inputCall) { var callSerializer = new JsonCallSerializer(); var stringWriter = new StringWriter(); callSerializer.SerializeCall(inputCall, stringWriter); var json = stringWriter.GetStringBuilder().ToString(); var outputCall = callSerializer.DeserializeCall(new StringReader(json)); return outputCall; }
public DefaultCallBuilder(Call call, ICallManagerInternal callManager, IAccountManager accountManager) { Helper.GuardNotNull(callManager); Helper.GuardNotNull(accountManager); Helper.GuardNotNull(call); _call = call; _callManager = callManager; _accountManager = accountManager; }
/// <summary> /// Builds the next element. /// </summary> /// <param name="runner">The runner.</param> /// <param name="currentElement">The current element.</param> /// <param name="endElement">The end element.</param> /// <param name="wfInstance">The wf instance.</param> private void BuildNextElement(WFRunner runner, WFElement currentElement,WFElement endElement, Workflow wfInstance) { WFElement outElement = null; if (currentElement.GetType() == typeof (Boundary)) { // This should only be entered into during the top level invocation // i.e. for the "Start" boundary itself. string nextActivity = currentElement.NextActivityID(); //TransformationEngine.Call aCall = // wfInstance.Call.Find(x => x.activityID.Equals(nextActivity)); TransformationEngine.Call aCall = wfInstance.Call.Find(x=>x.activityID.Equals(nextActivity));//[WorkflowFactory.IndexOfActivity(nextActivity)]; if ( null != aCall ) { // Create and add the new call...set this boundary as one of it's predecessors outElement = new Call(aCall, wfInstance); outElement.PreviousElements.Add(currentElement); runner.WorkflowElements.Add(outElement); BuildNextElement(runner, outElement, endElement, wfInstance); } else { if (currentElement.NextActivityID().Equals(endElement.GetActivityID())) { // Empty workflow...just add the start as a previous element to the end. endElement.PreviousElements.Add(currentElement); } } } else if (currentElement.GetType() == typeof(Call)) { ConstructCall(runner, currentElement, endElement, wfInstance); } else if (currentElement.GetType() == typeof(Decision)) { TransformationEngine.Decision decision = ((Decision) currentElement).DecisionModel; string successID = decision.successPathID; string failID = decision.failPathID; currentElement.DefaultNextActivityID = successID; if (null == runner.WorkflowElements.Find(x => (x.GetActivityID().Equals(successID)))) { // Find the item that this is // Construct the Success Branch ConstructDecisionBranch(runner,currentElement,successID,endElement,wfInstance); } if (null == runner.WorkflowElements.Find(x => x.GetActivityID().Equals(failID))) { // Find the item that this is // Construct the Fail Branch ConstructDecisionBranch(runner, currentElement, failID, endElement, wfInstance); } } }
protected override bool Check(Call call, LogRegistry logRegistry) { var simpleAction = call.GetAction(); if (!simpleAction.IsObjTypeOf<TestActions.LogExtensions>()) return false; var logExtensions = simpleAction.CastObj<TestActions.LogExtensions>(); logExtensions.SetConditionLog(); return true; }
public void RotateQuaternion(Call call, Response response, CallContext context) { string paramMember = call.GetParameterString("member"); float[] paramRotation = (float[])call.GetParameter("rotation"); lock (rotationLock) { memberRotations.Add(paramMember, paramRotation); eulerAngles = false; } }
public IEnumerable<Member> GetCallMembers(Call call) { var members = ExecuteReaderItems<Member>("SELECT * FROM CallMembers WHERE call_db_id = @callid", (reader, member) => { member.Name = reader.GetObject<string>("identity"); member.DisplayName = reader.GetObject<string>("dispname"); }, new[] { CreateParameter("@callid", call.Id) }); return members; }
public void CtorShouldReadInExistingCallsInDirectory() { SetupTestDirectory(); var call = new Call { Input = CallInput.CreateWithNextCallNumber() }; var fileName = Path.Combine(_directoryName, "tmp.json"); CallFileRepository.SaveCallToFile(call, fileName); var repository = new CallFileRepository(_directoryName); Assert.That(repository.Count, Is.EqualTo(1)); }
private void Skype_CallStatus(Call pCall, TCallStatus Status) { if (skypeManager.Logger.IsDebugEnabled) { skypeManager.Logger.Debug("Skype_CallStatus " + Status); } var callStatus = Status.ToCallStatus(); skypeManager.PublishCallStatus(callStatus); }
public void SerializeCall(Call call, TextWriter textWriter) { using (var jsonTextWriter = new JsonTextWriter(textWriter)) { jsonTextWriter.Formatting = Formatting.Indented; GetSerializer().Serialize(jsonTextWriter, call); } //// JsonConvert.SerializeObject(entry, new IsoDateTimeConverter()); // Proper date time handling //// var json = JsonConvert.SerializeObject(call); //// var json = JSON.Instance.ToJSON(call, true, true, true, true); //// textWriter.Write(json); }
/// <summary> /// Textured button /// </summary> /// <param name="callbackMethod">Method called on click</param> public Button(Rectangle rectangle, Texture2D texture, Color normalColor, Color hoverColor, Color clickedColor, Call callbackMethod) { this.rectangle = rectangle; colors = new Color[3] { normalColor, hoverColor, clickedColor }; this.texture = texture; textured = true; // All fields must be asigned before local methods can be called currentState = GUIButtonState.Neutral; currentState = GetState(); if (currentState == GUIButtonState.Click) { callbackMethod.Invoke(); } }
// UI context private void AddSampleUI(Call call, object state) { AddSample(); }
protected void Page_Load(object sender, EventArgs e) { function.AccessRulo(); Call.SetBreadCrumb(Master, "<li>后台管理</li><li>CRM应用</li><li><a href='Projects.aspx'>项目管理</a></li>"); //DataTable dt = bpj.GetBaseByID(DataConverter.CLng(GetID())); if (!IsPostBack) { BindType(); BindProcess(); ListItem lt = new ListItem(); lt.Text = "--请选择--"; lt.Value = "0"; DDListProcess.Items.Insert(0, lt); BindProject(); //lblHtml.Text = bpf.GetUpdateHtml(dt); } if (IsSupperAdmin()) { TxtLeader.Enabled = true; WebCoding.Enabled = true; TxtBeginTime.Enabled = true; TxtLeader.Enabled = true; RBListStatus.Enabled = true; DDListProcess.Enabled = true; TxtCompleteTime.Enabled = true; TxtEvaluation.Enabled = true; TxtRating.Enabled = true; TxtBeginTime.Enabled = true; DDListProcess.Enabled = true; TxtCompleteTime.Enabled = true; TxtEvaluation.Enabled = true; TxtRating.Enabled = true; TxtCompleteTime.Enabled = true; TxtEvaluation.Enabled = true; TxtRating.Enabled = true; TxtBeginTime.Enabled = true; TxtLeader.Enabled = true; DDListProcess.Enabled = true; TxtCompleteTime.Enabled = true; TxtEvaluation.Enabled = true; TxtRating.Enabled = true; TxtProName.Enabled = true; DDListType.Enabled = true; TxtOrderID.Enabled = true; TxtUserID.Enabled = true; //TxtRequire.EnableTheming = true; TxtPrice.Enabled = true; TxtApplicationTime.Enabled = true; RBLAudit.Enabled = true; this.BtnCommit.Enabled = true; } else { TxtLeader.Enabled = false; WebCoding.Enabled = false; TxtBeginTime.Enabled = false; RBListStatus.Enabled = false; DDListProcess.Enabled = false; TxtCompleteTime.Enabled = false; TxtEvaluation.Enabled = false; TxtRating.Enabled = false; TxtBeginTime.Enabled = false; DDListProcess.Enabled = false; TxtCompleteTime.Enabled = false; TxtEvaluation.Enabled = false; TxtRating.Enabled = false; TxtCompleteTime.Enabled = false; TxtEvaluation.Enabled = false; TxtRating.Enabled = false; TxtBeginTime.Enabled = false; TxtLeader.Enabled = false; DDListProcess.Enabled = false; TxtCompleteTime.Enabled = false; TxtEvaluation.Enabled = false; TxtRating.Enabled = false; TxtProName.Enabled = false; DDListType.Enabled = false; TxtOrderID.Enabled = false; TxtUserID.Enabled = false; TxtRequire.Attributes.Add("readonly", "readonly"); TxtPrice.Enabled = false; TxtApplicationTime.Enabled = false; RBLAudit.Enabled = false; this.BtnCommit.Enabled = false; } }
public override void Load(Call call, TabModel model) { model.AddData(Tab.TestItem); }
/// <summary> /// Evaluate and perform any policies for the incoming call. /// </summary> /// <param name="call">The incoming call.</param> /// <returns>The <see cref="HttpResponseMessage"/> depending on the policy.</returns> private static async Task <HttpResponseMessage> EvaluateAndHandleIncomingCallPoliciesAsync(Call call) { if (string.IsNullOrWhiteSpace(call?.IncomingContext?.ObservedParticipantId)) { // Call not associated with a participant (not a CR call). return(null); } if (call.IncomingContext.ObservedParticipantId != call.IncomingContext?.SourceParticipantId || call.Source == null) { // Note: This should never happen. // Source participant is not the observed participant or // the source participant is missing. return(null); } // Here we know the identity of the participant // we are observing and we can perform policy evaluations. var onBehalfOfIdentity = call.IncomingContext.OnBehalfOf; // The identity of the observed participant. var observedParticipantIdentity = call.Source.Identity; // The dynamic location of the participant. var observedParticipantLocation = call.Source.CountryCode; // Get the redirect location of the specified participant, if any. var redirectUri = await GetRedirectLocationOfParticipantAsync( onBehalfOfIdentity ?? observedParticipantIdentity, observedParticipantLocation).ConfigureAwait(false); if (redirectUri != null) { // This call should be redirected to another region. var response = new HttpResponseMessage(HttpStatusCode.TemporaryRedirect); response.Headers.Location = redirectUri; return(response); } return(null); }
public override string ToString() { return("APPLY " + Call.ToString() + " ON " + ListExpression.ToString()); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Request.QueryString["OrderID"] != null) { string OrderID = Request.QueryString["OrderID"].ToString(); this.OrderID.Value = OrderID; this.DropDownList4.SelectedValue = "订单"; this.DropDownList3.SelectedValue = "网页表单"; } B_User ull = new B_User(); this.txtUserName.Text = ull.GetLogin().UserName; } Call.SetBreadCrumb(Master, "<li><a href='" + CustomerPageAction.customPath2 + "Main.aspx'>工作台</a></li><li><a href='BiServer.aspx?num=-3&strTitle='>有问必答</a></li><li class='active'>添加问题记录</li>" + Call.GetHelp(50)); }
public static Task <CallMessageData> EstablishAsync(this Call call) { return(Task <CallMessageData> .Factory.FromAsync( call.BeginEstablish, call.EndEstablish, null)); }
/// <summary> /// Provides the list of elements read by this statement /// </summary> /// <param name="retVal">the list to fill</param> public override void ReadElements(List <Types.ITypedElement> retVal) { Call.ReadElements(retVal); }
private void Reset(Call call) { Reintialize(true); }
public static Task <CallMessageData> AcceptAsync(this Call call) { return(Task <CallMessageData> .Factory.FromAsync(call.BeginAccept, call.EndAccept, null)); }
public void AddCall(Call call) { this.callHistory.Add(call); }
public void Dispose() { Call.Dispose(); CancellationTokenSource.Dispose(); }
protected override T Get <T>(Call <T> call) { string s = "module".Equals(call.FunctionName) ? moduleResponse : learningPathResponse; return(call.ResponseParser(new MemoryStream(System.Text.Encoding.UTF8.GetBytes(s)))); }
public async Task OnInvoke(Call call) { CallCount++; await call.Next(); }
/// <summary> /// Provides the statement which modifies the variable /// </summary> /// <param name="variable"></param> /// <returns>null if no statement modifies the element</returns> public override VariableUpdateStatement Modifies(Types.ITypedElement variable) { VariableUpdateStatement retVal = Call.Modifies(variable); return(retVal); }
private void AddEntry(Call call) { Invoke(call, AddSampleUI); }
public void Content_Add() { M_Node nodeMod = nodeBll.SelReturnModel(NodeID); M_CommonData CData = new M_CommonData(); if (Mid > 0) { CData = conBll.GetCommonData(Mid); if (!CData.Inputer.Equals(mu.UserName)) { function.WriteErrMsg("你无权修改该内容"); } } else { CData.NodeID = NodeID; CData.ModelID = ModelID; CData.TableName = modBll.GetModelById(CData.ModelID).TableName; } DataTable dt = fieldBll.SelByModelID(CData.ModelID, false); Call commonCall = new Call(); DataTable table = commonCall.GetDTFromMVC(dt, Request); CData.Title = Request.Form["title"]; CData.Subtitle = Request["Subtitle"]; CData.PYtitle = Request["PYtitle"]; CData.TagKey = Request.Form["tagkey"]; CData.Status = nodeMod.SiteContentAudit; string parentTree = ""; CData.FirstNodeID = nodeBll.SelFirstNodeID(CData.NodeID, ref parentTree); CData.ParentTree = parentTree; CData.TitleStyle = Request.Form["TitleStyle"]; //CData.TopImg = Request.Form["selectpic"];//首页图片 if (Mid > 0)//修改内容 { conBll.UpdateContent(table, CData); } else { CData.DefaultSkins = 0; CData.EliteLevel = 0; CData.UpDateType = 2; CData.InfoID = ""; CData.RelatedIDS = ""; CData.Inputer = mu.UserName; CData.GeneralID = conBll.AddContent(table, CData); //插入信息给两个表,主表和从表:CData-主表的模型,table-从表 } if (Mid <= 0) //添加时增加积分 { //积分 if (SiteConfig.UserConfig.InfoRule > 0) { buser.ChangeVirtualMoney(mu.UserID, new M_UserExpHis() { UserID = mu.UserID, detail = "添加内容:" + CData.Title + "增加积分", score = SiteConfig.UserConfig.InfoRule, ScoreType = (int)M_UserExpHis.SType.Point }); } } string url = "MyContent?NodeID=" + CData.NodeID; if (nodeMod.CUName == "能力中心")//nodeMod.CUName.Equals("能力中心") { M_Blog_Msg msgMod = new M_Blog_Msg(); M_User_Plat upMod = B_User_Plat.GetLogin(); //M_Common_Notify comMod = new M_Common_Notify(); B_Blog_Msg msgBll = new B_Blog_Msg(); //B_Common_Notify comBll = new B_Common_Notify(); RegexHelper regHelper = new RegexHelper(); string msg = "#" + nodeMod.NodeName + "#[" + upMod.TrueName + "]发布了[<a href='/Item/" + CData.GeneralID + ".aspx' title='点击访问'>" + CData.Title + "</a>]"; string deftopic = "#插入话题#"; if (msg.Contains("#")) { msg = msg.Replace(deftopic, ""); string tlp = "<a href='/Plat/Blog?Skey={0}' title='话题浏览'>{1}</a>"; Dictionary <string, string> itemDic = new Dictionary <string, string>(); for (int i = 0; !string.IsNullOrEmpty(regHelper.GetValueBySE(msg, "#", "#", false)) && i < 5; i++)//最多不能超过5个话题 { string topic = "#" + regHelper.GetValueBySE(msg, "#", "#", false) + "#"; msg = msg.Replace(topic, "{" + i + "}"); topic = topic.Replace(" ", "").Replace(",", ""); itemDic.Add("{" + i + "}", string.Format(tlp, Server.UrlEncode(topic), topic)); msgMod.Topic += topic + ","; } foreach (var item in itemDic) { msg = msg.Replace(item.Key, item.Value); } } msgMod.MsgType = 1; msgMod.Status = 1; msgMod.CUser = upMod.UserID; msgMod.CUName = upMod.TrueName; msgMod.CompID = upMod.CompID; msgMod.ProID = 0; msgMod.pid = 0; msgMod.ReplyID = 0; msgMod.GroupIDS = ""; msgMod.ColledIDS = ""; msgMod.MsgContent = msg; msgMod.Title = CData.Title; msgMod.ID = msgBll.Insert(msgMod); url = "/Plat/Blog/"; } function.WriteSuccessMsg("操作成功!", url); }
/// <summary> /// Provides the list of update statements induced by this statement /// </summary> /// <param name="retVal">the list to fill</param> public override void UpdateStatements(List <VariableUpdateStatement> retVal) { Call.UpdateStatements(retVal); }
public void ReceiveCall(Call call) { }
public string VisitCallExpr(Call call) { throw new NotImplementedException(); }
public void Content_Add1() { M_Node nodeMod = nodeBll.SelReturnModel(NodeID); M_CommonData CData = new M_CommonData(); if (Mid > 0) { CData = conBll.GetCommonData(Mid); if (!CData.Inputer.Equals(mu.UserName)) { function.WriteErrMsg("你无权修改该内容"); } } else { CData.NodeID = NodeID; CData.ModelID = ModelID; CData.TableName = modBll.GetModelById(CData.ModelID).TableName; } DataTable dt = fieldBll.SelByModelID(CData.ModelID, false); Call commonCall = new Call(); DataTable table = commonCall.GetDTFromMVC(dt, Request); CData.Title = Request.Form["title"]; CData.Subtitle = Request["Subtitle"]; CData.PYtitle = Request["PYtitle"]; CData.TagKey = Request.Form["tagkey"]; CData.Status = nodeMod.SiteContentAudit; string parentTree = ""; CData.FirstNodeID = nodeBll.SelFirstNodeID(CData.NodeID, ref parentTree); CData.ParentTree = parentTree; CData.TitleStyle = Request.Form["TitleStyle"]; //CData.TopImg = Request.Form["selectpic"];//首页图片 if (Mid > 0)//修改内容 { conBll.UpdateContent(table, CData); } else { CData.DefaultSkins = 0; CData.EliteLevel = 0; CData.UpDateType = 2; CData.InfoID = ""; CData.RelatedIDS = ""; CData.Inputer = mu.UserName; CData.GeneralID = conBll.AddContent(table, CData);//插入信息给两个表,主表和从表:CData-主表的模型,table-从表 } //if (Mid <= 0)//添加时增加积分 //{ // //积分 // if (SiteConfig.UserConfig.InfoRule > 0) // { // buser.ChangeVirtualMoney(mu.UserID, new M_UserExpHis() // { // UserID = mu.UserID, // detail = "添加内容:" + CData.Title + "增加积分", // score = SiteConfig.UserConfig.InfoRule, // ScoreType = (int)M_UserExpHis.SType.Point // }); // } //} function.WriteSuccessMsg("操作成功!", "MyContent?NodeID=" + CData.NodeID); }
public void DispatchCall(Caller caller) { Call call = new Call(caller); DispatchCall(call); }
public void SetViewHolerCall(Call call) { TextViewName.Text = call.Name; TextViewTime.Text = call.Time.ToLongTimeString(); }
internal protected virtual T Visit(Call node) { return(Visit(node as Expression)); }
/// <summary> /// Makes outgoing call asynchronously. /// </summary> /// <param name="makeCallBody">The outgoing call request body.</param> /// <param name="scenarioId">The scenario identifier.</param> /// <returns>The <see cref="Task"/>.</returns> public async Task <ICall> MakeCallAsync(MakeCallRequestData makeCallBody, Guid scenarioId) { if (makeCallBody == null) { throw new ArgumentNullException(nameof(makeCallBody)); } if (makeCallBody.TenantId == null) { throw new ArgumentNullException(nameof(makeCallBody.TenantId)); } if (makeCallBody.ObjectId == null) { throw new ArgumentNullException(nameof(makeCallBody.ObjectId)); } var target = makeCallBody.IsApplication ? new InvitationParticipantInfo { Identity = new IdentitySet { Application = new Identity { Id = makeCallBody.ObjectId, DisplayName = $"Responder {makeCallBody.ObjectId}", }, }, } : new InvitationParticipantInfo { Identity = new IdentitySet { User = new Identity { Id = makeCallBody.ObjectId, }, }, }; var mediaToPrefetch = new List <MediaInfo>(); foreach (var m in this.MediaMap) { mediaToPrefetch.Add(m.Value.MediaInfo); } var call = new Call { Targets = new[] { target }, MediaConfig = new ServiceHostedMediaConfig { PreFetchMedia = mediaToPrefetch }, RequestedModalities = new List <Modality> { Modality.Audio }, TenantId = makeCallBody.TenantId, }; var statefulCall = await this.Client.Calls().AddAsync(call, scenarioId: scenarioId).ConfigureAwait(false); this.graphLogger.Info($"Call creation complete: {statefulCall.Id}"); return(statefulCall); }
static Notify DecodeNotifyOrInvoke(Notify notify, ByteBuffer stream, RtmpHeader header) { long start = stream.Position; RtmpReader reader = new RtmpReader(stream); string action = reader.ReadData() as string; if (!(notify is Invoke)) { //Don't decode "NetStream.send" requests stream.Position = start; notify.Data = ByteBuffer.Allocate(stream.Remaining); notify.Data.Put(stream); //notify.setData(in.asReadOnlyBuffer()); return(notify); } if (header == null || header.StreamId == 0) { double invokeId = (double)reader.ReadData(); notify.InvokeId = (int)invokeId; } object[] parameters = Call.EmptyArguments; if (stream.HasRemaining) { #if !(NET_1_1) List <object> paramList = new List <object>(); #else ArrayList paramList = new ArrayList(); #endif object obj = reader.ReadData(); if (obj is IDictionary) { // for connect we get a map notify.ConnectionParameters = obj as IDictionary; } else if (obj != null) { paramList.Add(obj); } while (stream.HasRemaining) { paramList.Add(reader.ReadData()); } parameters = paramList.ToArray(); } int dotIndex = action.LastIndexOf("."); string serviceName = (dotIndex == -1) ? null : action.Substring(0, dotIndex); string serviceMethod = (dotIndex == -1) ? action : action.Substring(dotIndex + 1, action.Length - dotIndex - 1); if (notify is Invoke) { PendingCall call = new PendingCall(serviceName, serviceMethod, parameters); notify.ServiceCall = call; } else { Call call = new Call(serviceName, serviceMethod, parameters); notify.ServiceCall = call; } return(notify); }
public Call GenerateCall(InboundMessage email, string managingUser, List <string> users, Department department, List <Call> activeCalls, List <Unit> units, int priority) { if (email == null) { return(null); } if (String.IsNullOrEmpty(email.HtmlBody)) { return(null); } if (!email.Subject.Contains("Parkland County Incident") && !email.Subject.Contains("Incident Message")) { return(null); } bool is2ndPage = false; string priorityChar = null; DateTime callTimeUtc = DateTime.UtcNow; var c = new Call(); c.Notes = email.HtmlBody; try { var data = new List <string>(); string[] rawData = email.HtmlBody.Split(new string[] { "\r\n", "\r\n\r\n" }, StringSplitOptions.None); if (rawData != null && rawData.Any()) { foreach (string s in rawData) { if (!string.IsNullOrWhiteSpace(s)) { data.Add(s); } } if (data.Count > 0) { c.Name = data[1].Trim().Replace("Type: ", ""); var priorityString = c.Name.Substring(0, c.Name.IndexOf(char.Parse("-"))).Trim(); priorityChar = Regex.Replace(priorityString, @"\d", "").Trim(); TimeZoneInfo timeZone = TimeZoneInfo.FindSystemTimeZoneById(department.TimeZone); callTimeUtc = new DateTimeOffset(DateTime.Parse(data[0].Replace("Date:", "").Trim()), timeZone.BaseUtcOffset).UtcDateTime; is2ndPage = c.Notes.Contains("WCT2ndPage"); try { var location = data.FirstOrDefault(x => x.StartsWith("Location:")); if (!String.IsNullOrWhiteSpace(location)) { c.Address = location.Replace("//", "").Replace("Business Name:", ""); } var coordinates = data.FirstOrDefault(x => x.Contains("(") && x.Contains(")")); if (!String.IsNullOrWhiteSpace(coordinates)) { coordinates = coordinates.Replace("Common Place:", ""); coordinates = coordinates.Trim(); c.GeoLocationData = coordinates.Replace("(", "").Replace(")", ""); } } catch { } } } else { c.Name = "Call Import Type: Unknown"; } } catch { c.Name = "Call Import Type: Unknown"; } c.NatureOfCall = email.HtmlBody; c.LoggedOn = callTimeUtc; c.Priority = PriorityMapping(priorityChar, is2ndPage, priority); c.ReportingUserId = managingUser; c.Dispatches = new List <CallDispatch>(); c.UnitDispatches = new List <CallDispatchUnit>(); c.CallSource = (int)CallSources.EmailImport; c.SourceIdentifier = email.MessageID; foreach (var u in users) { var cd = new CallDispatch(); cd.UserId = u; c.Dispatches.Add(cd); } if (units != null && units.Any()) { foreach (var unit in units) { var ud = new CallDispatchUnit(); ud.UnitId = unit.Id; ud.LastDispatchedOn = DateTime.UtcNow; c.UnitDispatches.Add(ud); } } // Search for an active call if (activeCalls != null && activeCalls.Any()) { var activeCall = activeCalls.FirstOrDefault(x => x.Name == c.Name && x.LoggedOn == c.LoggedOn); if (activeCall != null) { activeCall.Priority = c.Priority; activeCall.Notes = c.Notes; activeCall.LastDispatchedOn = DateTime.UtcNow; activeCall.DispatchCount++; return(activeCall); } } return(c); }
protected void Page_Load(object sender, EventArgs e) { Call.SetBreadCrumb(Master, "<li><a href='" + CustomerPageAction.customPath2 + "Main.aspx'>工作台</a></li><li><a href='../Config/SiteOption.aspx'>系统设置</a></li><li><a href='TemplateSet.aspx'>模板风格</a></li><li class='active'>从云端免费获取全站方案</li>" + Call.GetHelp(23)); }
public Employee GetHandlerForCall(Call call) => throw new NotImplementedException();