示例#1
0
        private void AddEntity(object param)
        {
            int paramValue = GetParam(param);

            switch (paramValue)
            {
            case 0:
                Contacts.Add(new Contact {
                    ModelStateChanged = true
                });
                break;

            case 1:
                Emails.Add(new EmailAddress {
                    ModelStateChanged = true
                });
                break;

            case 2:
                Phones.Add(new PhoneNumber {
                    ModelStateChanged = true
                });
                break;

            case 3:
                Mails.Add(new MailingAddress {
                    ModelStateChanged = true
                });
                break;

            default:
                break;
            }
        }
示例#2
0
        void GetProducts()
        {
            Phones.Add(new Phone()
            {
                name        = "JBL Jam Beats",
                price       = 90,
                description = "Short product description will place here. This content is just a dummy. You will replace this content with the original content provided by the client.",
                image       = "phone_jam.png"
            });

            Phones.Add(new Phone()
            {
                name        = "JBL Black",
                price       = 150,
                description = "Short product description will place here. This content is just a dummy. You will replace this content with the original content provided by the client.",
                image       = "phone_jbl.png"
            });

            Phones.Add(new Phone()
            {
                name        = "JBL On-Ear",
                price       = 199,
                description = "Short product description will place here. This content is just a dummy. You will replace this content with the original content provided by the client.",
                image       = "phone_on_ear.png"
            });
        }
示例#3
0
        public void AddItem()
        {
            Object temp = new object();

            foreach (Window window in Application.Current.Windows)
            {
                if (window.GetType() == typeof(MainWindow))
                {
                    temp = (window as MainWindow).listboxItems.ItemsSource;
                }
            }
            if (temp != null)
            {
                WindowAddEdit window = new WindowAddEdit();
                if (window.ShowDialog() == true)
                {
                    if (temp is IEnumerable <Phone> )
                    {
                        Phones.Add((Phone) new Phone().ShopToItem(window.view.OtherElectronics));
                    }
                    else if (temp is IEnumerable <Laptop> )
                    {
                        Laptops.Add((Laptop) new Laptop().ShopToItem(window.view.OtherElectronics));
                    }
                    else if (temp is IEnumerable <TV> )
                    {
                        TVs.Add((TV) new TV().ShopToItem(window.view.OtherElectronics));
                    }
                    SaveChanges();
                }
            }
        }
        public override void OnNavigatedTo(INavigationParameters parameters)
        {
            base.OnNavigatedTo(parameters);
            Motel = parameters.GetValue <Motel>("MotelDetails");
            Name  = Motel.Name;
            //DONE: Get the current user's position and calculate distance
            GetDistance(Motel);

            foreach (var item in Motel.Images)
            {
                Images.Add(item);
            }
            foreach (var item in Motel.Phones)
            {
                Phones.Add(item);
            }
            foreach (var item in Motel.Services)
            {
                Services.Add(item);
            }

            var analyticsData = new Dictionary <string, string> {
                { "Name", Motel.Name }
            };

            Analytics.TrackEvent("Motel selected", analyticsData);
        }
示例#5
0
        public override void OnNavigatedTo(INavigationParameters parameters)
        {
            base.OnNavigatedTo(parameters);
            Court   = parameters.GetValue <Court>("CourtDetails");
            Name    = Court.Name;
            Address = Court.Address;
            Blindex = Court.Blindex ? "SI" : "NO";
            InDoor  = Court.Indoor ? "SI" : "NO";
            Price   = Court.Price;


            //TODO: Get the current user's position and calculate distance
            //Court.Latitude / Longitude => with apiGoogle calculate distance My Position and PIN
            Distance = "0.2 KMs";


            foreach (var item in Court.Images)
            {
                Images.Add(item);
            }
            foreach (var item in Court.Phones)
            {
                Phones.Add(item);
            }
        }
示例#6
0
        private void UpdateContacts(Slot slot, string stringValue)
        {
            if (slot.Value is UriReferent uriReferent)
            {
                switch (uriReferent.Scheme)
                {
                case "mailto":
                    Emails.Add(uriReferent.Value);
                    break;

                case "http":
                case "https":
                {
                    if (Company == null)
                    {
                        Company = new CompanyReferent();
                    }

                    Company.Site = stringValue;
                    Site         = stringValue;
                    break;
                }
                }
            }

            if (slot.Value is EP.Ner.Phone.PhoneReferent phoneReferent)
            {
                Phones.Add(new PhoneReferent(phoneReferent));
            }

            if (slot.Value is AddressReferent addressReferent)
            {
                UpdateDescription($"Адрес: {addressReferent}");
            }
        }
 private async void setPhones()
 {
     for (var i = Phones.Count - 1; i >= 0; i--)
     {
         var pair = Phones[i];
         if (pair.Key.Equals("Home"))
         {
             Phones.Remove(pair);
         }
         else if (pair.Key.Equals("Mobile"))
         {
             Phones.Remove(pair);
         }
         else if (pair.Key.Equals("Work"))
         {
             Phones.Remove(pair);
         }
     }
     if (HomePhoneEntered)
     {
         Phones.Add(new KeyValuePair <string, string>("Home", Prospect.HomePhoneNumber.Phone));
     }
     if (MobilePhoneEntered)
     {
         Phones.Add(new KeyValuePair <string, string>("Mobile", Prospect.MobilePhoneNumber.Phone));
     }
     if (WorkPhoneEntered)
     {
         Phones.Add(new KeyValuePair <string, string>("Work", Prospect.WorkPhoneNumber.Phone));
     }
     await RaisePropertyChanged(() => Phones);
 }
        public void AddEmployeeForm_AddPhone(object e)
        {
            var newPhone = new PhoneModel();

            newPhone.Number = _newPhoneNumber;
            newPhone.Type   = _newPhoneType;
            Phones.Add(newPhone);
        }
示例#9
0
        public void AddPhone(Phone phone)
        {
            var phones = Phones ?? new List <Phone>();

            if (!phones.Any(o => o.Equals(phone)))
            {
                Phones.Add(phone);
            }
            else
            {
                throw Validator.ErrorValidation(("Phone", "Was Exists"));
            }
        }
示例#10
0
 public void AddPhone(string vendor, string model, decimal price)
 {
     MobilePhones phones = new MobilePhones(vendor, model, price);
     if(Phones.ContainsKey(List<M>)
     {
         Console.WriteLine("Duplicate phone");
     }
     else
     {
         Phones.Add(phones);
         Console.WriteLine("Phone added");
     }
 }
示例#11
0
        private void AddPhone(Phone phone)
        {
            var view = new AddPhoneWindow
            {
                DataContext = phone,
                Owner       = _view
            };

            if (view.ShowDialog() == true)
            {
                Phones.Add(phone);
            }
        }
        public void InsertPhone(Phone newPhone)
        {
            if (Phones == null)
            {
                Phones = new List <Phone>();
            }

            if (Phones.Exists(ph => ph.PhoneId == newPhone.PhoneId))
            {
                return;
            }

            Phones.Add(newPhone);
        }
示例#13
0
        public void LoadContacts(int idCon)
        {
            Contacts.Clear();
            Phones.Clear();

            string        connString = @"Data Source=.\SQLEXPRESS; Initial Catalog=PhoneContacts; Integrated Security=True;";
            SqlConnection con        = new SqlConnection(connString);

            string     sqlQueryString2 = "Select * From Numbers ";
            SqlCommand cmd2            = new SqlCommand(sqlQueryString2, con);

            con.Open();
            SqlDataReader datareader1 = cmd2.ExecuteReader();

            while (datareader1.Read())
            {
                Phones.Add(new Phone
                {
                    Contact_id = (int)datareader1["Contact_id"],
                    Number     = datareader1["Phone"] as string,
                    Type       = (PhoneType)datareader1["Type_id"]
                });
            }

            con.Close();
            string     sqlQueryString = "SELECT* from  Contacts ";
            SqlCommand cmd            = new SqlCommand(sqlQueryString, con);

            con.Open();
            SqlDataReader dataReader = cmd.ExecuteReader();

            while (dataReader.Read())
            {
                Contacts.Add(new Contact
                {
                    Id         = (int)dataReader["id"],
                    Email      = dataReader["Email"] as string,
                    Name       = dataReader["Name"] as string,
                    LastName   = dataReader["LastName"] as string,
                    SecondName = dataReader["SecondName"] as string,
                    ImageBytes = dataReader["Image"] as byte[],
                    Bithday    = dataReader["Bithday"] as string,
                    Numbers    = Phones.FindAll(Phone => Phone.Contact_id == idCon)
                });
            }
            con.Close();
        }
示例#14
0
        public void AddnSetCurrent(string name)
        {
            if (string.IsNullOrWhiteSpace(name))
            {
                throw new ArgumentNullException("Имя не может быть пустым или null");
            }

            Phones = GetPhones();

            current_phone = Phones.SingleOrDefault(x => x.Name == name);
            if (current_phone == null)
            {
                current_phone = new Phone(name);
                Phones.Add(current_phone);
                newPhone = true;
                Save();
            }
        }
        private void SetupAddCommand()
        {
            AddCommand = ReactiveCommand.CreateFromTask <Unit, Phone>(async unit =>
            {
                var phoneWindow = new PhoneWindow(new PhoneViewModel());
                if (phoneWindow.ShowDialog() == true)
                {
                    var newPhone   = phoneWindow.PhoneViewModel;
                    var addedPhone = await _repository.AddAsync(newPhone).ConfigureAwait(true);
                    return(addedPhone);
                }

                return(null);
            });

            AddCommand.ObserveOn(MainThreadScheduler).Subscribe(newPhone => { Phones.Add(newPhone); });
            AddCommand.ThrownExceptions.Subscribe(ex => { MessageBox.Show(ex.Message); });
        }
        private Phones ParsePhoneNumbers(string[] elements)
        {
            Phones phoneList = null;

            if (elements.Length > 1 && elements.Length < 4)
            {
                phoneList = new Phones();
                for (int i = 1; i < elements.Length; i++)
                {
                    string number = elements[i].Trim();
                    if (!string.IsNullOrEmpty(number))
                    {
                        phoneList.Add(new Phone(number, i == 1 ? PhoneType.Mobile : PhoneType.Landline));
                    }
                }
            }
            return(phoneList);
        }
示例#17
0
        public void OnGet()
        {
            var chuildPhoneCategory = _categoryRepository.GetSome(x => x.IsDeleted == false && x.ParentId == 1);

            foreach (var item in chuildPhoneCategory)
            {
                var phone = _itemRepository.GetByCategory(item.Id);
                foreach (var _phone in phone)
                {
                    Phones.Add(_phone);
                }
            }
            var chuildLaptopCategory = _categoryRepository.GetSome(x => x.IsDeleted == false && x.ParentId == 2);

            foreach (var item in chuildLaptopCategory)
            {
                var laptop = _itemRepository.GetByCategory(item.Id);
                foreach (var _laptop in laptop)
                {
                    Laptops.Add(_laptop);
                }
            }
            var chuildTabletCategory = _categoryRepository.GetSome(x => x.IsDeleted == false && x.ParentId == 3);

            foreach (var item in chuildTabletCategory)
            {
                var tablet = _itemRepository.GetByCategory(item.Id);
                foreach (var _tablet in tablet)
                {
                    Tablets.Add(_tablet);
                }
            }
            var chuildAccessorieCategory = _categoryRepository.GetSome(x => x.IsDeleted == false && x.ParentId == 4);

            foreach (var item in chuildAccessorieCategory)
            {
                var accessorie = _itemRepository.GetByCategory(item.Id);
                foreach (var _accessorie in accessorie)
                {
                    Accessories.Add(_accessorie);
                }
            }
            var cus = _userManager.GetUserAsync(HttpContext.User).Result;
        }
示例#18
0
 public void AddPhone(string vendor, string model, decimal price)
 {
     if (Regex.IsMatch(vendor, validation) && Regex.IsMatch(model, validation) && price >= 0)
     {
         string pair = vendor + " " + model;
         if (Phones.ContainsKey(pair))
         {
             Console.WriteLine("Duplicate phone");
         }
         else
         {
             Phones.Add(pair, price);
             Console.WriteLine("Phone added");
         }
     }
     else
     {
         Console.WriteLine(message);
     }
 }
示例#19
0
        public bool UpsertPhone(Phone phone)
        {
            if (phone is null)
            {
                throw new EntityNotFoundException("User -> Phone");
            }

            var current = Phones.FirstOrDefault(r => r.Type == phone.Type);

            if (current is null)
            {
                Phones.Add(phone);
            }
            else
            {
                current = phone;
            }

            return(true);
        }
示例#20
0
        public virtual void AddFields(IEnumerable <Field> fields)
        {
            if (fields == null)
            {
                return;
            }

            // Add the fields to their corresponding container.
            foreach (Field field in fields)
            {
                if (field.GetType() == typeof(Data.Fields.Name))
                {
                    Names.Add((Data.Fields.Name)field);
                }
                else if (field.GetType() == typeof(Address))
                {
                    Addresses.Add((Address)field);
                }
                else if (field.GetType() == typeof(Phone))
                {
                    Phones.Add((Phone)field);
                }
                else if (field.GetType() == typeof(Email))
                {
                    Emails.Add((Email)field);
                }
                else if (field.GetType() == typeof(Job))
                {
                    Jobs.Add((Job)field);
                }
                else if (field.GetType() == typeof(Education))
                {
                    Educations.Add((Education)field);
                }
                else if (field.GetType() == typeof(Image))
                {
                    Images.Add((Image)field);
                }
                else if (field.GetType() == typeof(Username))
                {
                    Usernames.Add((Username)field);
                }
                else if (field.GetType() == typeof(UserID))
                {
                    UserIDs.Add((UserID)field);
                }
                else if (field.GetType() == typeof(DOB))
                {
                    DOB = (DOB)field;
                }
                else if (field.GetType() == typeof(Gender))
                {
                    Gender = (Gender)field;
                }
                else if (field.GetType() == typeof(Language))
                {
                    Languages.Add((Language)field);
                }
                else if (field.GetType() == typeof(Ethnicity))
                {
                    Ethnicities.Add((Ethnicity)field);
                }
                else if (field.GetType() == typeof(OriginCountry))
                {
                    OriginCountries.Add((OriginCountry)field);
                }
                else if (field.GetType() == typeof(URL))
                {
                    Urls.Add((URL)field);
                }
            }
        }
示例#21
0
 public void InputPhones(Phone newPhone)
 {
     Phones.Add(newPhone);
 }
示例#22
0
 public SmsDto(string phone, string message, SmsOptions options)
 {
     Phones.Add(phone);
     Message = message;
     Options = options;
 }
示例#23
0
 public void AddPhone(String PhoneNumber)
 {
     Phones.Add(PhoneNumber);
 }
示例#24
0
 public void AddPhone(Phone obj)
 {
     Phones.Add(obj);
 }
示例#25
0
 public void AddPhone(Pair <Guid, Pair <string, string> > phone)
 {
     Phones.Add(phone);
 }
示例#26
0
 internal void AddPhone()
 {
     Phones.Add(new Phone("Телефон", Phones.Count));
 }