本文整理汇总了C#中PhoneNumber类的典型用法代码示例。如果您正苦于以下问题:C# PhoneNumber类的具体用法?C# PhoneNumber怎么用?C# PhoneNumber使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PhoneNumber类属于命名空间,在下文中一共展示了PhoneNumber类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddClient
public void AddClient(PhoneNumber phoneNumber, ITariff tariff)
{
_tariffsMap.Add(phoneNumber, tariff);
_canChangeTariffMap.Add(phoneNumber, true);
_callsMap.Add(phoneNumber, new List<CallInfo>());
_debtMap.Add(phoneNumber, 0);
}
示例2: SetTerminalsStateTo
private void SetTerminalsStateTo(PhoneNumber source, PhoneNumber target, TerminalState state)
{
var sourceTerminal = GetTerminalByPhoneNumber(source) as TestTerminal;
var targetTerminal = GetTerminalByPhoneNumber(target) as TestTerminal;
if (sourceTerminal != null) sourceTerminal.State = state;
if (targetTerminal != null) targetTerminal.State = state;
}
示例3: TestTerminal
public TestTerminal(PhoneNumber number)
: base(number)
{
this.IncomingRequest += this.OnIncomingRequest;
this.Online += (sender, args) => { Console.WriteLine("Terminal {0} turned to online mode", Number); };
this.Offline += (sender, args) => { Console.WriteLine("Terminal {0} turned to offline mode", Number); };
}
示例4: Post
/// <summary>
/// Posts the specified phone number.
/// </summary>
/// <param name="phoneNumber">The phone number.</param>
/// <returns></returns>
public override System.Net.Http.HttpResponseMessage Post( PhoneNumber phoneNumber )
{
var changes = new List<string>();
string newPhoneNumber = phoneNumber.NumberFormattedWithCountryCode;
History.EvaluateChange(
changes,
string.Format( "{0} Phone", DefinedValueCache.GetName( phoneNumber.NumberTypeValueId ) ),
string.Empty,
newPhoneNumber );
var rockContext = (RockContext)Service.Context;
System.Web.HttpContext.Current.Items.Add( "CurrentPerson", GetPerson() );
int? modifiedByPersonAliasId = phoneNumber.ModifiedAuditValuesAlreadyUpdated ? phoneNumber.ModifiedByPersonAliasId : (int?)null;
HistoryService.SaveChanges(
rockContext,
typeof( Person ),
Rock.SystemGuid.Category.HISTORY_PERSON_DEMOGRAPHIC_CHANGES.AsGuid(),
phoneNumber.PersonId,
changes,
true,
modifiedByPersonAliasId );
return base.Post( phoneNumber );
}
示例5: Person
public Person()
{
Adresse = new Address();
Telefon = new PhoneNumber();
Rights = new Rights();
ID = Guid.NewGuid();
}
示例6: Insert
///<summary>Inserts one PhoneNumber into the database. Returns the new priKey.</summary>
internal static long Insert(PhoneNumber phoneNumber)
{
if(DataConnection.DBtype==DatabaseType.Oracle) {
phoneNumber.PhoneNumberNum=DbHelper.GetNextOracleKey("phonenumber","PhoneNumberNum");
int loopcount=0;
while(loopcount<100){
try {
return Insert(phoneNumber,true);
}
catch(Oracle.DataAccess.Client.OracleException ex){
if(ex.Number==1 && ex.Message.ToLower().Contains("unique constraint") && ex.Message.ToLower().Contains("violated")){
phoneNumber.PhoneNumberNum++;
loopcount++;
}
else{
throw ex;
}
}
}
throw new ApplicationException("Insert failed. Could not generate primary key.");
}
else {
return Insert(phoneNumber,false);
}
}
示例7: EqualsOperator
public void EqualsOperator()
{
var phoneNumber1 = new PhoneNumber("01234 567890");
var phoneNumber2 = new PhoneNumber("01234 567890");
Assert.True(phoneNumber1 == phoneNumber2);
}
示例8: TestEquality
public void TestEquality()
{
var phone1 = new PhoneNumber("2055551212");
Assert.AreEqual(phone1, phone1);
var phone2 = new PhoneNumber("2055551212");
Assert.AreEqual(phone1, phone2);
}
示例9: EqualsMethod
public void EqualsMethod()
{
var phoneNumber1 = new PhoneNumber("01234 567890");
var phoneNumber2 = new PhoneNumber("01234 567890");
Assert.True(phoneNumber1.Equals(phoneNumber2));
}
示例10: Call
public virtual void Call(PhoneNumber target)
{
if (IsOnline)
{
OnOutgoingCall(this, new CallInfo(target, Number, TerminalState.OutGoingCall));
}
}
示例11: MessageRequest
public MessageRequest(PhoneNumber sender, string message)
{
if (message == null) throw new ArgumentNullException(nameof(message));
Sender = sender;
Message = message;
}
示例12: NumericPhoneNumberWithWhiteSpaces
public void NumericPhoneNumberWithWhiteSpaces()
{
const string phoneNumber = "02 588 4430";
sut = PhoneNumber.Create(phoneNumber);
Assert.AreEqual(phoneNumber, sut.ToString());
}
示例13: NumericPhoneNumber
public void NumericPhoneNumber()
{
const string phoneNumber = "0100100";
sut = PhoneNumber.Create(phoneNumber);
Assert.AreEqual(phoneNumber, sut.ToString());
}
示例14: USPhoneNumber
public void USPhoneNumber()
{
var phoneNumber = new PhoneNumber("8015461234");
Assert.Equal("801", phoneNumber.AreaCode);
Assert.Equal("546", phoneNumber.Prefix);
Assert.Equal("1234", phoneNumber.Postfix);
Assert.Equal("(801) 546-1234", phoneNumber.Formatted);
}
示例15: Constructor_OnlyDigits_SetsNumber
public void Constructor_OnlyDigits_SetsNumber()
{
string number = "5555555555";
var phoneNumber = new PhoneNumber(number);
Assert.Equal(number, phoneNumber.Number);
}