protected void AddNewContactButton_Click(object sender, DirectEventArgs e) { PhoneBookContact NewContact; string statusMessage = string.Empty; if (!string.IsNullOrEmpty(NewContact_ContactNumber.Text) && NewContact_ContactType.SelectedItem.Index > -1) { string telephoneNumber = NewContact_ContactNumber.Text; string detectedCountry = Global.DATABASE.NumberingPlans.GetIso3CountryCodeByNumber(telephoneNumber); if (telephoneNumber.Length < 9 || string.IsNullOrEmpty(detectedCountry)) { statusMessage = "Number is invalid."; } else if (CurrentSession.Addressbook.ContainsKey(telephoneNumber)) { statusMessage = "Cannot add duplicate contacts."; } else { NewContact = new PhoneBookContact(); NewContact.DestinationNumber = telephoneNumber; NewContact.SipAccount = sipAccount; NewContact.Type = Convert.ToString(NewContact_ContactType.SelectedItem.Value); NewContact.Name = Convert.ToString(HelperFunctions.ReturnEmptyIfNull(NewContact_ContactName.Text)); NewContact.DestinationCountry = detectedCountry; Global.DATABASE.PhoneBooks.Insert(NewContact); GridsDataManager(true); //Update the session's phonebook dictionary and phonecalls list. UpdateSessionRelatedInformation(NewContact); AddNewContactWindowPanel.Hide(); } } else { statusMessage = "Please provide all the information."; } NewContact_StatusMessage.Text = statusMessage; }
protected void CancelNewContactButton_Click(object sender, DirectEventArgs e) { AddNewContactWindowPanel.Hide(); }