示例#1
0
        private bool ProcessCreateContactPhone(int contactId, int?areaCode, int?phone, int?phoneTypeId)
        {
            try
            {
                var contact = _dbContext.Contacts.FirstOrDefault(x => x.Id == contactId);
                if (contact == null)
                {
                    return(false);
                }

                PhoneType phoneType = null;
                if (phoneTypeId != null)
                {
                    phoneType = _dbContext.PhoneTypes.FirstOrDefault(x => x.Id == phoneTypeId);
                }

                var contactPhone = new ContactPhone()
                {
                    ContactId = contact.Id,
                    AreaCode  = areaCode,
                    Phone     = phone,
                    PhoneType = phoneType
                };

                contact.ContactPhones.Add(contactPhone);
                _dbContext.SaveChangesAsync();
                return(true);
            }
            catch (Exception ex)
            {
                Console.Write(ex);
                throw;
            }
        }
示例#2
0
        private bool ProcessUpdateContactPhone(int id, int?areaCode, int?phone, int?phoneTypeId)
        {
            try
            {
                var contactPhone = _dbContext.ContactPhones.FirstOrDefault(x => x.Id == id);
                if (contactPhone == null)
                {
                    return(false);
                }

                PhoneType phoneType = null;
                if (phoneTypeId != null)
                {
                    phoneType = _dbContext.PhoneTypes.FirstOrDefault(x => x.Id == phoneTypeId);
                }

                contactPhone.AreaCode  = areaCode;
                contactPhone.Phone     = phone;
                contactPhone.PhoneType = phoneType;

                _dbContext.SaveChangesAsync();
                return(true);
            }
            catch (Exception ex)
            {
                Console.Write(ex);
                throw;
            }
        }
示例#3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Phone"/> struct.
        /// </summary>
        /// <param name="type">the phone type (consonant or vowel)</param>
        /// <param name="phonation">the phonation (voice intensity)</param>
        /// <param name="place">the place of articulation for consonants.</param>
        /// <param name="manner">the manner of articulation for consonants.</param>
        /// <param name="height">the vowel height.</param>
        /// <param name="backness">the horizontal vowel position.</param>
        /// <param name="roundedness">the vowel roundedness.</param>
        /// <param name="isRhotic">a value indicating whether the phone is rhotic.</param>
        /// <param name="isSyllabic">a value indicating whether the phone is syllabic.</param>
        public Phone(
            PhoneType type,
            Phonation phonation,
            PlaceOfArticulation place,
            MannerOfArticulation manner,
            VowelHeight height,
            VowelBackness backness,
            VowelRoundedness roundedness,
            bool isRhotic,
            bool isSyllabic)
        {
            this.Type       = type;
            this.Phonation  = phonation;
            this.IsSyllabic = isSyllabic;

            if (type == PhoneType.Vowel)
            {
                this.Height      = height;
                this.Backness    = backness;
                this.Roundedness = roundedness;
                this.IsRhotic    = isRhotic;
                this.Place       = null;
                this.Manner      = null;
            }
            else
            {
                this.Height      = null;
                this.Backness    = null;
                this.Roundedness = null;
                this.IsRhotic    = null;
                this.Place       = place;
                this.Manner      = manner;
            }
        }
示例#4
0
        public void MapFullEmployeeModel()
        {
            bool      active       = _faker.Random.Bool();
            int       departmentID = _faker.Random.Int();
            string    phoneNumber  = _faker.Phone.PhoneNumber();
            decimal   salary       = _faker.Random.Decimal();
            Guid      managerID    = _faker.Random.Guid();
            DateTime  hireDate     = _faker.Date.Soon();
            PhoneType phoneType    = _faker.PickRandom <PhoneType>();

            List <KeyValuePair <string, object> > kvp = new List <KeyValuePair <string, object> >()
            {
                new KeyValuePair <string, object>("Earnings", salary),
                new KeyValuePair <string, object>("ManagerID", managerID),
                new KeyValuePair <string, object>("PhoneType", phoneType),
                new KeyValuePair <string, object>("Active", active),
                new KeyValuePair <string, object>("DepartmentID", departmentID),
                new KeyValuePair <string, object>("PhoneNumber", phoneNumber),
                new KeyValuePair <string, object>("HireDate", hireDate)
            };

            CustomDataRecord record = new CustomDataRecord(kvp);
            Employee         model  = _mapper.MapRecord <Employee>(record);

            Assert.AreEqual(active, model.Active);
            Assert.AreEqual(salary, model.Salary);
            Assert.AreEqual(hireDate, model.HireDate);
            Assert.AreEqual(departmentID, model.DepartmentID);
            Assert.AreEqual(managerID, model.ManagerID);
            Assert.AreEqual(phoneNumber, model.PhoneNumber);
            Assert.AreEqual(phoneType, model.PhoneType);
        }
示例#5
0
        public void MapRecordCreateInstance()
        {
            decimal   salary       = _faker.Random.Decimal();
            PhoneType type         = _faker.PickRandom <PhoneType>();
            Guid      id           = _faker.Random.Guid();
            string    title        = _faker.Random.AlphaNumeric(30);
            int       departmentID = _faker.Random.Int();

            List <KeyValuePair <string, object> > kvp = new List <KeyValuePair <string, object> >()
            {
                new KeyValuePair <string, object>("EmployeeID", id),
                new KeyValuePair <string, object>("Title", title),
                new KeyValuePair <string, object>("Salary", salary),
                new KeyValuePair <string, object>("DepartmentID", departmentID),
                new KeyValuePair <string, object>("PhoneType", type)
            };
            CustomDataRecord record = new CustomDataRecord(kvp);
            Employee         model  = _mapper.MapRecord <Employee>(record);

            Assert.AreEqual(salary, model.Salary);
            Assert.AreEqual(title, model.Title);
            Assert.AreEqual(id, model.EmployeeID);
            Assert.AreEqual(departmentID, model.DepartmentID);
            Assert.AreEqual(type, model.PhoneType);
        }
示例#6
0
        public void PhoneType_Equals_NoDifferences()
        {
            var otherPhoneType =
                new PhoneType(_targetPhoneType.ID, _targetPhoneType.Name);

            Assert.IsTrue(_targetPhoneType.Equals(otherPhoneType));
        }
示例#7
0
文件: Phone.cs 项目: younes21/abp
 public Phone(Guid personId, string number, PhoneType type = PhoneType.Mobile)
 {
     Id       = Guid.NewGuid();
     PersonId = personId;
     Number   = number;
     Type     = type;
 }
示例#8
0
        /// <summary>
        /// akes a validated phone number and removes all special characters and formats as specified
        /// </summary>
        /// <param name="sPhone">Validated phone number string</param>
        /// <param name="ptReturnType">The way the phone number will be formatted</param>
        /// <returns>Formatted phone number</returns>
        public static string StripPhoneNumber(this string sPhone, PhoneType ptReturnType, ref bool error)
        {
            sPhone = System.Text.RegularExpressions.Regex.Replace(sPhone, "[^0-9]", "");
            if (sPhone.Length != 10)
            {
                error = true;
                return("");
            }
            switch (ptReturnType)
            {
            case PhoneType.Dashed:
                sPhone = String.Format("{0}-{1}-{2}", sPhone.Substring(0, 3), sPhone.Substring(3, 3), sPhone.Substring(6, 4));
                break;

            case PhoneType.Styled:
                sPhone = String.Format("({0}) {1}-{2}", sPhone.Substring(0, 3), sPhone.Substring(3, 3), sPhone.Substring(6, 4));
                break;

            case PhoneType.Spaced:
                sPhone = String.Format("{0} {1} {2}", sPhone.Substring(0, 3), sPhone.Substring(3, 3), sPhone.Substring(6, 4));
                break;

            default:
                break;
            }
            error = false;
            return(sPhone);
        }
 public AbstractLibraryItem(string firstName, string lastName, PhoneType phoneType, string phoneNumber)
 {
     this.FirstName   = firstName;
     this.LastName    = lastName;
     this.PhoneType   = phoneType;
     this.PhoneNumber = phoneNumber;
 }
示例#10
0
        public void PhoneType_Equals_DifferenceInId()
        {
            var otherPhoneType =
                new PhoneType(_targetPhoneType.ID * 2, _targetPhoneType.Name);

            Assert.IsFalse(_targetPhoneType.Equals(otherPhoneType));
        }
示例#11
0
        /// <summary>
        /// Creates a stanard US based phone number value object
        /// </summary>
        /// <param name="type">The type of phone number. Mobile, Home, Work, Fax, ect.</param>
        /// <param name="phoneNumber">A string containing the entire phone number. Areacode, prefix, suffix. The format for
        /// this can be the entire number, 1234567890, or formatted (123)456-7890.
        /// </param>
        public PhoneNumber(PhoneType type, string phoneNumber)
        {
            // Trim any spaces from phone number.
            phoneNumber = phoneNumber.Replace(" ", "");
            phoneNumber = phoneNumber.Replace("(", "");
            phoneNumber = phoneNumber.Replace(")", "");
            phoneNumber = phoneNumber.Replace("-", "");

            if (phoneNumber.Length != 10)
            {
                throw new PhoneNumberOutOfBoundsException("A phone number must contain ten (10) numbers valued 0 through 9.");
            }
            var chars = phoneNumber.ToCharArray();

            for (int i = 0; i < chars.Length; i++)
            {
                if (!char.IsDigit(chars[i]))
                {
                    throw new PhoneNumberOutOfBoundsException("A phone number must contain ten(10) numbers valued 0 through 9.");
                }
            }

            var areaCode = phoneNumber.Substring(0, 3);
            var prefix   = phoneNumber.Substring(3, 3);
            var suffix   = phoneNumber.Substring(6, 4);

            this.Type = type;
            SetAreaCode(areaCode);
            SetPrefix(prefix);
            SetSuffix(suffix);
        }
示例#12
0
        }                        // Required by EF

        /// <summary>
        /// Creates a standard US based phone number value object
        /// </summary>
        /// <param name="type">The type of phone number. Mobile, Home, Work, Fax, ect.</param>
        /// <param name="areaCode">The area code portion of a phone number.</param>
        /// <param name="prefix">The prefix portion of a phone number.</param>
        /// <param name="suffix">The suffix portion of a phone number.</param>
        public PhoneNumber(PhoneType type, string areaCode, string prefix, string suffix)
        {
            this.Type = type;
            SetAreaCode(areaCode);
            SetPrefix(prefix);
            SetSuffix(suffix);
        }
        /// <summary>
        ///     akes a validated phone number and removes all special characters and formats as specified
        /// </summary>
        /// <param name="sPhone">Validated phone number string</param>
        /// <param name="ptReturnType">The way the phone number will be formatted</param>
        /// <param name="error"></param>
        /// <returns>Formatted phone number</returns>
        // ReSharper disable once RedundantAssignment
        public static string StripPhoneNumber(this string sPhone, PhoneType ptReturnType, ref bool error)
        {
            sPhone = Regex.Replace(sPhone, "[^0-9]", "");
            if (sPhone.Length != 10)
            {
                error = true;
                return("");
            }
            switch (ptReturnType)
            {
            case PhoneType.Dashed:
                sPhone = $"{sPhone.Substring(0, 3)}-{sPhone.Substring(3, 3)}-{sPhone.Substring(6, 4)}";
                break;

            case PhoneType.Styled:
                sPhone = $"({sPhone.Substring(0, 3)}) {sPhone.Substring(3, 3)}-{sPhone.Substring(6, 4)}";
                break;

            case PhoneType.Spaced:
                sPhone = $"{sPhone.Substring(0, 3)} {sPhone.Substring(3, 3)} {sPhone.Substring(6, 4)}";
                break;

            case PhoneType.Plain:
                break;
            }
            error = false;
            return(sPhone);
        }
        public async Task <IActionResult> PutPhoneType([FromRoute] int id, [FromBody] PhoneType phoneType)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != phoneType.Id)
            {
                return(BadRequest());
            }

            _context.Entry(phoneType).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!PhoneTypeExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
示例#15
0
        public void EditPhoneNumber(string firstName, string lastName, PhoneType typeOfPhone, string number, PhoneType newTypeOfPhone, string newNumber)
        {
            foreach (var user in ListOfAddedEntries)
            {
                foreach (var phone in user.ListOfPhones)
                {
                    if (newNumber == phone.PhoneNumber && newTypeOfPhone == phone.TypeOfNumber)
                    {
                        throw new System.ArgumentException("This phone entry already exists!");
                    }
                }
            }

            int userIndex = LocateUser(ListOfAddedEntries, firstName, lastName);

            if (userIndex <= 0)
            {
                throw new ArgumentException("The provided user does not exist!");
            }

            int phoneIndex = -1;

            foreach (var item in ListOfAddedEntries[userIndex].ListOfPhones)
            {
                if (item.PhoneNumber == number)
                {
                    phoneIndex = ListOfAddedEntries[userIndex].ListOfPhones.IndexOf(item);
                }
            }

            ListOfAddedEntries[userIndex].ListOfPhones[phoneIndex].PhoneNumber  = newNumber;
            ListOfAddedEntries[userIndex].ListOfPhones[phoneIndex].TypeOfNumber = newTypeOfPhone;
        }
示例#16
0
        public static OptionSetValue GetPhoneType(PhoneType phoneType)
        {
            int value = -1;

            switch (phoneType)
            {
            case PhoneType.NotSpecified:
                value = 950000002;
                break;

            case PhoneType.Home:
                value = 950000001;
                break;

            case PhoneType.Mobile:
                value = 950000000;
                break;

            case PhoneType.Business:
                value = 950000003;
                break;

            default:
                value = 950000002;
                break;
            }
            return(new OptionSetValue(value));
        }
示例#17
0
        /// <summary>
        /// Convertit le type utilisé par la librairie en type utilisé par agsXMPP
        /// </summary>
        /// <param name="type">Type de numéro</param>
        /// <returns>Type de numéro</returns>
        public static agsXMPP.protocol.iq.vcard.TelephoneType PhoneTypeConverter(PhoneType type)
        {
            switch (type)
            {
            case PhoneType.Bbs: return(agsXMPP.protocol.iq.vcard.TelephoneType.BBS);

            case PhoneType.Cell: return(agsXMPP.protocol.iq.vcard.TelephoneType.CELL);

            case PhoneType.Fax: return(agsXMPP.protocol.iq.vcard.TelephoneType.FAX);

            case PhoneType.Isdn: return(agsXMPP.protocol.iq.vcard.TelephoneType.ISDN);

            case PhoneType.Modem: return(agsXMPP.protocol.iq.vcard.TelephoneType.MODEM);

            case PhoneType.Msg: return(agsXMPP.protocol.iq.vcard.TelephoneType.MSG);

            case PhoneType.Number: return(agsXMPP.protocol.iq.vcard.TelephoneType.NUMBER);

            case PhoneType.Pager: return(agsXMPP.protocol.iq.vcard.TelephoneType.PAGER);

            case PhoneType.Pcs: return(agsXMPP.protocol.iq.vcard.TelephoneType.PCS);

            case PhoneType.Pref: return(agsXMPP.protocol.iq.vcard.TelephoneType.PREF);

            case PhoneType.Video: return(agsXMPP.protocol.iq.vcard.TelephoneType.VIDEO);

            case PhoneType.Voice: return(agsXMPP.protocol.iq.vcard.TelephoneType.VOICE);

            default: return(agsXMPP.protocol.iq.vcard.TelephoneType.NONE);
            }
        }
示例#18
0
 public void AddPhone(string number, string ext, ContactItemStatus status, PhoneType type, Person person)
 {
     if (_phones != null)
     {
         _phones.Add(new Phone(number, ext, status, type, person));
     }
 }
示例#19
0
        public async Task <ActionResult <PhoneType_PhoneTypeDTO> > Delete([FromBody] PhoneType_PhoneTypeDTO PhoneType_PhoneTypeDTO)
        {
            if (UnAuthorization)
            {
                return(Forbid());
            }
            if (!ModelState.IsValid)
            {
                throw new BindException(ModelState);
            }

            if (!await HasPermission(PhoneType_PhoneTypeDTO.Id))
            {
                return(Forbid());
            }

            PhoneType PhoneType = ConvertDTOToEntity(PhoneType_PhoneTypeDTO);

            PhoneType = await PhoneTypeService.Delete(PhoneType);

            PhoneType_PhoneTypeDTO = new PhoneType_PhoneTypeDTO(PhoneType);
            if (PhoneType.IsValidated)
            {
                return(PhoneType_PhoneTypeDTO);
            }
            else
            {
                return(BadRequest(PhoneType_PhoneTypeDTO));
            }
        }
示例#20
0
 public AbstractLibraryItem(string firstName, string lastName, PhoneType phoneType, string phoneNumber)
 {
     this.FirstName = firstName;
     this.LastName = lastName;
     this.PhoneType = phoneType;
     this.PhoneNumber = phoneNumber;
 }
示例#21
0
        public async Task <PhoneType> Get(long Id)
        {
            PhoneType PhoneType = await DataContext.PhoneType.AsNoTracking()
                                  .Where(x => x.Id == Id)
                                  .Where(x => x.DeletedAt == null)
                                  .Select(x => new PhoneType()
            {
                CreatedAt = x.CreatedAt,
                UpdatedAt = x.UpdatedAt,
                Id        = x.Id,
                Code      = x.Code,
                Name      = x.Name,
                StatusId  = x.StatusId,
                Used      = x.Used,
                RowId     = x.RowId,
                Status    = x.Status == null ? null : new Status
                {
                    Id   = x.Status.Id,
                    Code = x.Status.Code,
                    Name = x.Status.Name,
                },
            }).FirstOrDefaultAsync();

            if (PhoneType == null)
            {
                return(null);
            }

            return(PhoneType);
        }
示例#22
0
 public void UpdatePhoneType(PhoneType model)
 {
     using (var uow = new LookupsUnitOfWork()) {
         uow.LookupsRespository.UpdatePhoneType(model);
         uow.Save();
     }
 }
示例#23
0
        public async Task <IActionResult> Edit(string id, [Bind("Id,Type,InActive,InActiveDate")] PhoneType phoneType)
        {
            if (id != phoneType.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(phoneType);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PhoneTypeExists(phoneType.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(phoneType));
        }
示例#24
0
 public async Task <bool> Delete(PhoneType PhoneType)
 {
     if (await ValidateId(PhoneType))
     {
     }
     return(PhoneType.IsValidated);
 }
示例#25
0
        public ActionResult CreatePhoneType(PhoneType model, HttpPostedFileBase file)
        {
            if (ModelState.IsValid)
            {
            }

            return(RedirectToAction("GetPhoneTypes"));
        }
示例#26
0
 public Phone(string number, string ext, ContactItemStatus status, PhoneType type, Person person)
 {
     Person         = person;
     PhoneNumber    = number;
     PhoneExtension = ext;
     Status         = status;
     PhoneType      = type;
 }
示例#27
0
        public async Task <bool> Delete(PhoneType PhoneType)
        {
            await DataContext.PhoneType.Where(x => x.Id == PhoneType.Id).UpdateFromQueryAsync(x => new PhoneTypeDAO {
                DeletedAt = StaticParams.DateTimeNow, UpdatedAt = StaticParams.DateTimeNow
            });

            return(true);
        }
示例#28
0
 public Phone(Guid id, Guid candidateId, string phoneNumber, bool isDefault, PhoneType phoneType)
 {
     Id          = id;
     CandidateId = candidateId;
     PhoneNumber = phoneNumber;
     Default     = isDefault;
     PhoneType   = phoneType;
 }
示例#29
0
 private PhoneTypeModel Map(PhoneType i)
 {
     return(new PhoneTypeModel()
     {
         Id = i.Id,
         Name = i.Name
     });
 }
示例#30
0
 public AddPhoneCandidateCommand(Guid candidateId, string phoneNumber, bool isDefault, PhoneType phoneType)
 {
     AggregateId = candidateId;
     CandidateId = candidateId;
     PhoneNumber = phoneNumber;
     IsDefault   = isDefault;
     PhoneType   = phoneType;
 }
        public ActionResult DeleteConfirmed(int id)
        {
            PhoneType phoneType = db.PhoneTypes.Find(id);

            db.PhoneTypes.Remove(phoneType);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
示例#32
0
 private string PhoneFmt(string prefix, PhoneType type, string number)
 {
     var s = number.FmtFone(type + " ");
     if ((type == PhoneType.Home && _PhonePref == 10)
         || (type == PhoneType.Cell && _PhonePref == 20)
         || (type == PhoneType.Work && _PhonePref == 30))
         return number.FmtFone("*" + prefix + " ");
     return number.FmtFone(prefix + " ");
 }
        public IHttpActionResult PostPhoneType(PhoneType phoneType)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            _genericService.AddOrUpdate<PhoneType>(phoneType);

            return CreatedAtRoute("DefaultApi", new { id = phoneType.Id }, phoneType);
        }
示例#34
0
 public void AddPhoneToUser(string firstName, string lastName, PhoneType typeOfPhone, string number)
 {
     foreach (var user in ListOfAddedEntries)
     {
         foreach (var phone in user.ListOfPhones)
         {
             if (number == phone.PhoneNumber)
             {
                 throw new System.ArgumentException("Theis phone entry already exists!");
             }
         }
     }
     int index = LocateUser(ListOfAddedEntries, firstName, lastName);
     ListOfAddedEntries[index].ListOfPhones.Add(new Phone(number, typeOfPhone));
 }
示例#35
0
        public PhoneBookEntry CreatePhoneBookEntry(string firstName, string lastName, PhoneType typeOfPhone, string number)
        {
            int index = LocateUser(ListOfAddedEntries, firstName, lastName);

            if (index >= 0)
            {
                throw new System.ArgumentException("This user already exists!");
            }
            if (firstName.Length <= 1)
            {
                throw new System.ArgumentException("The name is too short!");
            }

            PhoneBookEntry newUser = new PhoneBookEntry(firstName, lastName, typeOfPhone, number);
            this.ListOfAddedEntries.Add(newUser);
            return newUser;
        }
示例#36
0
文件: Phone.cs 项目: gtochev/Validata
 public Phone(string phoneNumber, PhoneType typeOfNumber)
 {
     this.PhoneNumber = phoneNumber;
     this.TypeOfNumber = typeOfNumber;
 }
示例#37
0
 public void UpdateCellPhoneIcon(PhoneType phoneType, int colorNum, bool isBroken)
 {
     mHudModel.UpdateCellPhoneIcon(phoneType, colorNum, isBroken);
 }
示例#38
0
 public PhoneDL(string pNumber, PhoneType pType)
 {
     _number = pNumber;
     _type = pType;
 }
示例#39
0
 public Phone(PhoneType type, string number)
 {
     Type = type;
     Number = number;
 }
示例#40
0
 public PhoneNumber(string number, PhoneType phType)
     : this()
 {
     Number = number;
     _phType = phType;
 }
        public IHttpActionResult PutPhoneType(int id, PhoneType phoneType)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            if (id != phoneType.Id)
            {
                return BadRequest();
            }

            if (!PhoneTypeExists(id))
            {
                return NotFound();
            }
            else
            {
                _genericService.AddOrUpdate<PhoneType>(phoneType);
            }

            return StatusCode(HttpStatusCode.NoContent);
        }
示例#42
0
 public PhoneBookEntry(string firstName, string lastName, PhoneType typeOfPhone, string phoneNumber)
     : this(firstName, lastName)
 {
     this.ListOfPhones.Add(new Phone(phoneNumber, typeOfPhone));
 }
示例#43
0
 /// <summary>
 /// Gets the phone number of the contact
 /// </summary>
 /// <param name="strPhoneNumber">buffer to contain output string</param>
 /// <param name="nType">PhoneType to specify which phone number to retrieve</param>
 /// <returns>true on success</returns>
 public bool GetPhoneNumber(StringBuilder strPhoneNumber, PhoneType nType)
 {
     return ContactGetPhoneNumber(pObject, strPhoneNumber, strPhoneNumber.Capacity, (int)nType);
 }
示例#44
0
 public PhoneBuilder WithType(PhoneType type)
 {
     phone.Type = type;
     return this;
 }
示例#45
0
        public string Call(string callTo, string callFrom, string subscriberNumber, PhoneType phoneType)
        {
            Dictionary<string, string> callData = new Dictionary<string, string>(){
                {"outgoingNumber",callTo},
                {"forwardingNumber",callFrom},
                {"subscriberNumber",subscriberNumber},
                {"remember","0"},
                {"phoneType",((int)phoneType).ToString()}
            };

            return Request("call", callData);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="Appointment"/> class.
 /// </summary>
 /// <param name="moduleId">The module id.</param>
 /// <param name="appointmentTypeId">The appointment type id.</param>
 /// <param name="title">The title of the event.</param>
 /// <param name="description">The event description.</param>
 /// <param name="notes">The notes.</param>
 /// <param name="address1">The address1.</param>
 /// <param name="address2">The address2.</param>
 /// <param name="city">The city of the appointment.</param>
 /// <param name="regionId">The region id.</param>
 /// <param name="postalCode">The postal code.</param>
 /// <param name="phone">The phone number.</param>
 /// <param name="additionalAddressInfo">The additional address info.</param>
 /// <param name="contactStreet">The contact street.</param>
 /// <param name="contactPhone">The contact phone.</param>
 /// <param name="requestorName">Name of the requestor.</param>
 /// <param name="requestorPhoneType">Type of the requestor phone.</param>
 /// <param name="requestorPhone">The requestor phone.</param>
 /// <param name="requestorEmail">The requestor email.</param>
 /// <param name="requestorAltPhoneType">Type of the requestor alt phone.</param>
 /// <param name="requestorAltPhone">The requestor alt phone.</param>
 /// <param name="start">The start of the appointment.</param>
 /// <param name="end">The end of the appointment.</param>
 /// <param name="timeZoneOffset">The time zone offset.</param>
 /// <param name="numberOfParticipants">The number of participants.</param>
 /// <param name="participantGender">The participant gender.</param>
 /// <param name="isPresenterSpecial">The participant flag.</param>
 /// <param name="participantInstructions">The participant instructions.</param>
 /// <param name="numberOfSpecialParticipants">The number of special participants.</param>
 /// <param name="custom1">The first custom field.</param>
 /// <param name="custom2">The second custom field.</param>
 /// <param name="custom3">The third custom field.</param>
 /// <param name="custom4">The fourth custom field.</param>
 /// <param name="custom5">The fifth custom field.</param>
 /// <param name="custom6">The sixth custom field.</param>
 /// <param name="custom7">The seventh custom field.</param>
 /// <param name="custom8">The eighth custom field.</param>
 /// <param name="custom9">The ninth custom field.</param>
 /// <param name="custom10">The tenth custom field.</param>
 /// <param name="isAccepted"><c>null</c>if the <see cref="Appointment"/> has not bee accepted or declined yet,
 /// otherwise <c>true</c> for an accepted appointment, or <c>false</c> for a declined appointment.</param>
 private Appointment(
     int moduleId,
     int appointmentTypeId,
     string title,
     string description,
     string notes,
     string address1,
     string address2,
     string city,
     int? regionId,
     string postalCode,
     string phone,
     string additionalAddressInfo,
     string contactStreet,
     string contactPhone,
     string requestorName,
     PhoneType requestorPhoneType,
     string requestorPhone,
     string requestorEmail,
     PhoneType requestorAltPhoneType,
     string requestorAltPhone,
     DateTime start,
     DateTime end,
     TimeSpan timeZoneOffset,
     int numberOfParticipants,
     GroupGender participantGender,
     bool isPresenterSpecial,
     string participantInstructions,
     int numberOfSpecialParticipants,
     string custom1,
     string custom2,
     string custom3,
     string custom4,
     string custom5,
     string custom6,
     string custom7,
     string custom8,
     string custom9,
     string custom10,
     bool? isAccepted)
     : this()
 {
     this.ModuleId = moduleId;
     this.AppointmentTypeId = appointmentTypeId;
     this.Title = title;
     this.Description = description;
     this.Notes = notes;
     this.Address1 = address1;
     this.Address2 = address2;
     this.City = city;
     this.RegionId = regionId;
     this.PostalCode = postalCode;
     this.Phone = phone;
     this.AdditionalAddressInfo = additionalAddressInfo;
     this.ContactStreet = contactStreet;
     this.ContactPhone = contactPhone;
     this.RequestorName = requestorName;
     this.RequestorPhoneType = requestorPhoneType;
     this.RequestorPhone = requestorPhone;
     this.RequestorEmail = requestorEmail;
     this.RequestorAltPhoneType = requestorAltPhoneType;
     this.RequestorAltPhone = requestorAltPhone;
     this.StartDateTime = start;
     this.EndDateTime = end;
     this.NumberOfParticipants = numberOfParticipants;
     this.ParticipantGender = participantGender;
     this.IsPresenterSpecial = isPresenterSpecial;
     this.TimeZoneOffset = timeZoneOffset;
     this.ParticipantInstructions = participantInstructions;
     this.NumberOfSpecialParticipants = numberOfSpecialParticipants;
     this.Custom1 = custom1;
     this.Custom2 = custom2;
     this.Custom3 = custom3;
     this.Custom4 = custom4;
     this.Custom5 = custom5;
     this.Custom6 = custom6;
     this.Custom7 = custom7;
     this.Custom8 = custom8;
     this.Custom9 = custom9;
     this.Custom10 = custom10;
     this.IsAccepted = isAccepted;
 }
 /// <summary>
 /// Creates the specified <see cref="Appointment"/>.
 /// </summary>
 /// <param name="moduleId">The module ID.</param>
 /// <param name="appointmentTypeId">The appointment type ID of this appointment.</param>
 /// <param name="title">The title of this appointment.</param>
 /// <param name="description">The description.</param>
 /// <param name="notes">The notes.</param>
 /// <param name="address1">The address1.</param>
 /// <param name="address2">The address2.</param>
 /// <param name="city">The city of the appointment.</param>
 /// <param name="regionId">The region id.</param>
 /// <param name="postalCode">The postal code.</param>
 /// <param name="phone">The phone number.</param>
 /// <param name="additionalAddressInfo">The additional address info.</param>
 /// <param name="contactStreet">The contact street.</param>
 /// <param name="contactPhone">The contact phone.</param>
 /// <param name="requestorName">Name of the requestor.</param>
 /// <param name="requestorPhoneType">Type of the requestor phone.</param>
 /// <param name="requestorPhone">The requestor phone.</param>
 /// <param name="requestorEmail">The requestor email.</param>
 /// <param name="requestorAltPhoneType">Type of the requestor alt phone.</param>
 /// <param name="requestorAltPhone">The requestor alt phone.</param>
 /// <param name="start">The start of the appointment.</param>
 /// <param name="end">The end of the appointment.</param>
 /// <param name="timeZoneOffset">The time zone offset.</param>
 /// <param name="numberOfParticipants">The number of participants.</param>
 /// <param name="participantGender">The participant gender.</param>
 /// <param name="isPresenterSpecial">The participant flag.</param>
 /// <param name="participantInstructions">The participant instructions.</param>
 /// <param name="numberOfSpecialParticipants">The number of special participants.</param>
 /// <param name="custom1">The first custom field.</param>
 /// <param name="custom2">The second custom field.</param>
 /// <param name="custom3">The third custom field.</param>
 /// <param name="custom4">The fourth custom field.</param>
 /// <param name="custom5">The fifth custom field.</param>
 /// <param name="custom6">The sixth custom field.</param>
 /// <param name="custom7">The seventh custom field.</param>
 /// <param name="custom8">The eighth custom field.</param>
 /// <param name="custom9">The ninth custom field.</param>
 /// <param name="custom10">The tenth custom field.</param>
 /// <param name="isAccepted"><c>null</c>if the <see cref="Appointment"/> has not bee accepted or declined yet,
 /// otherwise <c>true</c> for an accepted appointment, or <c>false</c> for a declined appointment.</param>
 /// <returns>
 /// A new <see cref="Appointment"/> instance.
 /// </returns>
 public static Appointment Create(
     int moduleId,
     int appointmentTypeId,
     string title,
     string description,
     string notes,
     string address1,
     string address2,
     string city,
     int? regionId,
     string postalCode,
     string phone,
     string additionalAddressInfo,
     string contactStreet,
     string contactPhone,
     string requestorName,
     PhoneType requestorPhoneType,
     string requestorPhone,
     string requestorEmail,
     PhoneType requestorAltPhoneType,
     string requestorAltPhone,
     DateTime start,
     DateTime end,
     TimeSpan timeZoneOffset,
     int numberOfParticipants,
     GroupGender participantGender,
     bool isPresenterSpecial,
     string participantInstructions,
     int numberOfSpecialParticipants,
     string custom1,
     string custom2,
     string custom3,
     string custom4,
     string custom5,
     string custom6,
     string custom7,
     string custom8,
     string custom9,
     string custom10,
     bool? isAccepted)
 {
     return new Appointment(
             moduleId,
             appointmentTypeId,
             title,
             description,
             notes,
             address1,
             address2,
             city,
             regionId,
             postalCode,
             phone,
             additionalAddressInfo,
             contactStreet,
             contactPhone,
             requestorName,
             requestorPhoneType,
             requestorPhone,
             requestorEmail,
             requestorAltPhoneType,
             requestorAltPhone,
             start,
             end,
             timeZoneOffset,
             numberOfParticipants,
             participantGender,
             isPresenterSpecial,
             participantInstructions,
             numberOfSpecialParticipants,
             custom1,
             custom2,
             custom3,
             custom4,
             custom5,
             custom6,
             custom7,
             custom8,
             custom9,
             custom10,
             isAccepted);
 }
示例#48
0
 public Phone(PhoneType phoneType, string areaCode, string phoneNumber)
 {
     this.PhoneType = phoneType;
     this.AreaCode = areaCode;
     this.PhoneNumber = phoneNumber;
 }
示例#49
0
        public void EditPhoneNumber(string firstName, string lastName, PhoneType typeOfPhone, string number, PhoneType newTypeOfPhone, string newNumber)
        {
            foreach (var user in ListOfAddedEntries)
            {
                foreach (var phone in user.ListOfPhones)
                {
                    if (newNumber == phone.PhoneNumber && newTypeOfPhone == phone.TypeOfNumber)
                    {
                        throw new System.ArgumentException("This phone entry already exists!");
                    }
                }
            }

            int userIndex = LocateUser(ListOfAddedEntries, firstName, lastName);

            if (userIndex <= 0)
            {
                throw new ArgumentException("The provided user does not exist!");
            }

            int phoneIndex = -1;

            foreach (var item in ListOfAddedEntries[userIndex].ListOfPhones)
            {
                if (item.PhoneNumber == number)
                {
                    phoneIndex = ListOfAddedEntries[userIndex].ListOfPhones.IndexOf(item);
                }
            }

            ListOfAddedEntries[userIndex].ListOfPhones[phoneIndex].PhoneNumber = newNumber;
            ListOfAddedEntries[userIndex].ListOfPhones[phoneIndex].TypeOfNumber = newTypeOfPhone;
        }
		/// <summary>
		/// Constructor with arguments
	 	/// </summary>
	 	public PhoneNumber(PhoneType? type)
	 	{
			this.type = type;
		}
示例#51
0
        public void OnUpdatePhoneIconProxy(PhoneType phoneType, int colorNum, bool isBroken)
        {
            try
            {
                if (UpdatePhoneIcon != null)
                {
                    UpdatePhoneIcon(phoneType, colorNum, isBroken);

                }
            }
            catch (Exception e)
            {
                Common.Exception("OnUpdatePhoneIconPProxy", e);
            }
        }
示例#52
0
 /// <summary>
 /// Gets the name of the file.
 /// </summary>
 /// <param name="sensorType">Type of the sensor.</param>
 /// <param name="updateInterval">The update interval.</param>
 /// <param name="phoneType">Type of the phone.</param>
 /// <param name="annLogicType">Type of the ANN logic.</param>
 /// <returns></returns>
 public string GetFileName(SensorType sensorType, int updateInterval, PhoneType phoneType, ANNLogicType annLogicType)
 {
     return string.Format(sensorType.ToString(), "_", updateInterval.ToString(), "_", phoneType.ToString(), "_", annLogicType.ToString());
 }
示例#53
0
 /// <summary>
 /// Convertit le type utilis� par la librairie en type utilis� par agsXMPP
 /// </summary>
 /// <param name="type">Type de num�ro</param>
 /// <returns>Type de num�ro</returns>
 public static agsXMPP.protocol.iq.vcard.TelephoneType PhoneTypeConverter(PhoneType type)
 {
     switch (type)
     {
         case PhoneType.Bbs: return agsXMPP.protocol.iq.vcard.TelephoneType.BBS;
         case PhoneType.Cell: return agsXMPP.protocol.iq.vcard.TelephoneType.CELL;
         case PhoneType.Fax: return agsXMPP.protocol.iq.vcard.TelephoneType.FAX;
         case PhoneType.Isdn: return agsXMPP.protocol.iq.vcard.TelephoneType.ISDN;
         case PhoneType.Modem: return agsXMPP.protocol.iq.vcard.TelephoneType.MODEM;
         case PhoneType.Msg: return agsXMPP.protocol.iq.vcard.TelephoneType.MSG;
         case PhoneType.Number: return agsXMPP.protocol.iq.vcard.TelephoneType.NUMBER;
         case PhoneType.Pager: return agsXMPP.protocol.iq.vcard.TelephoneType.PAGER;
         case PhoneType.Pcs: return agsXMPP.protocol.iq.vcard.TelephoneType.PCS;
         case PhoneType.Pref: return agsXMPP.protocol.iq.vcard.TelephoneType.PREF;
         case PhoneType.Video: return agsXMPP.protocol.iq.vcard.TelephoneType.VIDEO;
         case PhoneType.Voice: return agsXMPP.protocol.iq.vcard.TelephoneType.VOICE;
         default: return agsXMPP.protocol.iq.vcard.TelephoneType.NONE;
     }
 }
示例#54
0
 public LibraryItem(string firstName, string lastName, PhoneType phoneType, string phoneNumber)
     : base(firstName, lastName, phoneType, phoneNumber)
 {
 }
        public void AddPhoneNumber(string phoneNum, PhoneType phoneType = PhoneType.Home)
        {
            try
            {
                if (_billingAddress == null)
                {
                    Logger.Error(this, new NullReferenceException());
                    return;
                }
                Regex regexObj = new Regex(@"^\(?([0-9]{3})\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})$");

                if (regexObj.IsMatch(phoneNum))
                {
                    List<string> nums = regexObj.Split(phoneNum).ToList();
                    BillingAddress.Contact.AddPhone(new Phone
                    {AreaCode = nums[1], FirstThree = nums[2], LastFour = nums[3], PhoneType = phoneType});

                    #if DEBUG
                        Logger.Debug(String.Format("Added Phone Number {0}-{1}-{2} to {3}", nums[1],nums[2],nums[3], InvoiceNumber));
                    #endif
                }
                else
                {
                    throw new Exception(String.Format("Invalid Phone Number! - {0}", phoneNum),
                                        new Exception("The phone number provided was invalid and didn't match regular expression characteristics"));
                }
            }
            catch (Exception e)
            {
                #if DEBUG
                    ConsoleText.ConsoleText.WriteObjXml(e.Message, ConsoleColor.Red);
                #endif
                Logger.Error(e.Message,e.InnerException);
            }
        }
示例#56
0
 /// <summary>
 /// Sets the phone number
 /// </summary>
 /// <param name="strPhoneNumber">string to set</param>
 /// <param name="nType">PhoneType to specify which phone number to set</param>
 /// <returns>true on success</returns>
 public bool SetPhoneNumber(string strPhoneNumber, PhoneType nType)
 {
     return ContactSetPhoneNumber(pObject, strPhoneNumber, (int)nType);
 }
示例#57
0
 public string Call(string callTo, string callFrom, PhoneType phoneType)
 {
     return Call(callTo, callFrom, "undefined", phoneType);
 }