Beispiel #1
0
        public async Task <ActionResult <PhoneList> > PostPhoneList(PhoneList phoneList)
        {
            _context.PhoneList.Add(phoneList);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetPhoneList", new { id = phoneList.Id }, phoneList));
        }
        private async Task <Tuple <string, bool?> > Check(int i = 0)
        {
            while (PhoneList.Count == 0)
            {
                await Task.Run(() => Thread.Sleep(1));
            }
            var phone = PhoneList.First();

            try
            {
                TLRequestImportContacts requestImportContacts = new TLRequestImportContacts();
                requestImportContacts.Contacts = new TLVector <TLInputPhoneContact>();
                requestImportContacts.Contacts.Add(new TLInputPhoneContact()
                {
                    Phone     = phone,
                    FirstName = "",
                    LastName  = ""
                });
                var o2 = await Client.SendRequestAsync <TLImportedContacts>(requestImportContacts);

                return(new Tuple <string, bool?>(phone, o2.Imported.Count > 0));
            }
            catch (TLSharp.Core.Network.FloodException err)
            {
                await Task.Run(() => Thread.Sleep(err.TimeToWait));

                return(await Check());
            }
            catch when(i < 5)
                {
                    return(await Check(i + 1));
                }
Beispiel #3
0
        public async Task <IActionResult> PutPhoneList(int id, PhoneList phoneList)
        {
            if (id != phoneList.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Beispiel #4
0
        protected void PopulatePhoneData(PhoneList phoneList)
        {
            string _number = null;
            string _name   = null;

            do
            {
                Console.Write("Enter name for phone number (e.g., Main, Home, Mobile) or end if no more: ");
                _name = Console.ReadLine();

                if (!_name.Equals("end"))
                {
                    Console.Write("Enter phone number: ");
                    _number = Console.ReadLine();
                    Console.Write("Is this number the primary contact number? ");

                    if (Console.ReadLine().Substring(0, 1).ToLower().Equals("y"))
                    {
                        phoneList[_name] = new PhoneNumber(_number, true);
                    }
                    else
                    {
                        phoneList[_name] = new PhoneNumber(_number, false);
                    }
                }
            } while (_name != "end");
        }
Beispiel #5
0
 public PhoneListViewModel()
 {
     phoneList = XmlDataDeserializer.GetData <PhoneList>("Resources.PhoneListData.xml");
     alphabeticalyPhoneListData = GroupByParameter(GroupParameterName.Alphabeticaly);
     categoryPhoneListData      = GroupByParameter(GroupParameterName.Category);
     currentGroupParameter      = GroupParameterName.Alphabeticaly;
 }
Beispiel #6
0
        public IActionResult Phonedetail(int?id)
        {
            ViewData["Message"] = "Your application Phonedetail page.";
            PhoneList pl = new PhoneList();

            pl.p = _dbContext.Phone.Single <Phone>(e => e.ObjId == id);
            return(View(pl));
        }
Beispiel #7
0
        async void Init()
        {
            var soapClient = new Bubble.ContactsSoapClient();
            IEnumerable <Person>  persons;
            IEnumerable <Email>   ems;
            IEnumerable <Address> ads;
            IEnumerable <Phone>   phs;

            persons = await soapClient.GetPeopleAsync();

            foreach (var dude in persons)
            {
                ContactList.Add(dude);
            }
            ems = await soapClient.GetEmailsAsync();

            foreach (var e in ems)
            {
                EmailList.Add(e);
            }
            ads = await soapClient.GetAddressesAsync();

            foreach (var a in ads)
            {
                AddressList.Add(a);
            }
            phs = await soapClient.GetPhonesAsync();

            foreach (var p in phs)
            {
                PhoneList.Add(p);
            }

            foreach (var dude in ContactList)
            {
                foreach (var e in EmailList)
                {
                    if (dude.PID == e.PersonID)
                    {
                        dude.elist.Add(e);
                    }
                }
                foreach (var a in AddressList)
                {
                    if (dude.PID == a.PersonID)
                    {
                        dude.alist.Add(a);
                    }
                }
                foreach (var p in PhoneList)
                {
                    if (dude.PID == p.PersonID)
                    {
                        dude.plist.Add(p);
                    }
                }
            }
        }
    private void Llenar()
    {
        cdc = new ConexionBDDataContext();
        //rpt_Smartphones.DataSource = cdc.Smartphone.OrderBy(x => x.id_Fabricante);
        //rpt_Smartphones.DataBind();

        PhoneList.DataSource = cdc.vPhones();
        PhoneList.DataBind();
    }
        public WebDialerOptions()
        {
            InitializeComponent();

            phoneList = new PhoneList(Globals.WebDialerAddIn.phoneList);

            if (phoneList.Count == 0)
                phoneList.Add(newPhone());
        }
 protected override void OnAppearing()
 {
     PhonebookViewModel.LoadContactsCommand.Execute(null);
     MessagingCenter.Subscribe <PhonebookViewModel>(this, "ScrollToTop", e =>
     {
         PhoneList.ScrollTo(e.Contacts.FirstOrDefault(), ScrollToPosition.MakeVisible,
                            false);
     });
     base.OnAppearing();
 }
Beispiel #11
0
    static void Main()
    {
        // The following code is OK because Friend
        // inherits PhoneNumber.
        PhoneList <Friend> plist = new PhoneList <Friend>();

        plist.Add(new Friend("Tom", "555-1234", true));
        plist.Add(new Friend("Gary", "555-6756", true));
        plist.Add(new Friend("Matt", "555-9254", false));

        try
        {
            // Find the number of a friend given a name.
            Friend frnd = plist.FindByName("Gary");
            Console.Write(frnd.Name + ": " + frnd.Number);
            if (frnd.IsWorkNumber)
            {
                Console.WriteLine(" (work)");
            }
            else
            {
                Console.WriteLine();
            }
        }
        catch (NotFoundException)
        {
            Console.WriteLine("Not Found");
        }
        Console.WriteLine();

        // The following code is also OK because Supplier
        // inherits PhoneNumber.
        PhoneList <Supplier> plist2 = new PhoneList <Supplier>();

        plist2.Add(new Supplier("Global Hardware", "555-8834"));
        plist2.Add(new Supplier("Computer Warehouse", "555-9256"));
        plist2.Add(new Supplier("NetworkCity", "555-2564"));


        try
        {
            // Find the name of a supplier given a number.
            Supplier sp = plist2.FindByNumber("555-2564");
            Console.WriteLine(sp.Name + ": " + sp.Number);
        }
        catch (NotFoundException)
        {
            Console.WriteLine("Not Found");
        }

        // The following declaration is invalid because EmailFriend
        // does NOT inherit PhoneNumber.
        // PhoneList<EmailFriend> plist3 =
        // new PhoneList<EmailFriend>(); // Error!
    }
    static void Main()
    {
        // The Following code is Ok because Friend
        // implements IPhoneNumber
        PhoneList <Friend> pList = new PhoneList <Friend>();

        pList.Add(new Friend("Tom", "555-1234", true));
        pList.Add(new Friend("Gary", "123-1234", true));
        pList.Add(new Friend("Dick", "333-1234", true));
        pList.Add(new Friend("Harry", "666-1234", true));

        try
        {
            // Find the number of a friend given a name
            Friend frnd = pList.FindByName("Tom");
            Console.Write(frnd.Name + ":" + frnd.Number);
            if (friend.IsWorkNumber)
            {
                Console.WriteLine(" (work)");
            }
            else
            {
                Console.WriteLine();
            }
        }catch (NotFoundException)
        {
            Console.WriteLine("Not Found");
        }

        Console.WriteLine();

        // The Following code is also Ok beacause Supplier implements IPhoneNumber
        PhoneList <Supplier> pList2 = new PhoneList <Supplier>();

        pList2.Add(new Supplier("Mr. A", "111-1111"));
        pList2.Add(new Supplier("Mr. B", "111-4444"));
        pList2.Add(new Supplier("Mr. C", "111-3333"));
        pList2.Add(new Supplier("Mr. D", "111-2222"));

        try
        {
            // Find the Name of the Supplier given a number
            Supplier sp = pList2.FindByNumber();
            Console.WriteLine(sp.Name + ":" + sp.Number);
        }
        catch (NotFoundException)
        {
            Console.WriteLine(Not Found);
        }

        // The Following Declaration is invalid because EmailFriend Does not
        // Implement IPhoneNumber
        // PhoneList<EmailFriend> pList3 = new PhoneList<EmailFriend>(); // Error
    }
Beispiel #13
0
 protected void DisplayPhoneData(PhoneList phoneList)
 {
     foreach (KeyValuePair <string, PhoneNumber> item in phoneList)
     {
         if (item.Value.Primary)
         {
             Console.WriteLine($"{item.Key} {item.Value.Number} (This is the primary number) ");
         }
         else
         {
             Console.WriteLine($"{item.Key} {item.Value.Number}");
         }
     }
 }
    static void Main()
    {
        // The Following code is Ok because Friend
        // implements IPhoneNumber
        PhoneList<Friend> pList = new PhoneList<Friend>();
        pList.Add(new Friend("Tom", "555-1234", true));
        pList.Add(new Friend("Gary", "123-1234", true));
        pList.Add(new Friend("Dick", "333-1234", true));
        pList.Add(new Friend("Harry", "666-1234", true));

        try
        {
            // Find the number of a friend given a name
            Friend frnd = pList.FindByName("Tom");
            Console.Write(frnd.Name + ":" + frnd.Number);
            if(friend.IsWorkNumber)
                Console.WriteLine(" (work)");
            else
                Console.WriteLine();
        }catch(NotFoundException)
        {
            Console.WriteLine("Not Found");
        }

        Console.WriteLine();

        // The Following code is also Ok beacause Supplier implements IPhoneNumber
        PhoneList<Supplier> pList2 = new PhoneList<Supplier>();
        pList2.Add(new Supplier("Mr. A", "111-1111"));
        pList2.Add(new Supplier("Mr. B", "111-4444"));
        pList2.Add(new Supplier("Mr. C", "111-3333"));
        pList2.Add(new Supplier("Mr. D", "111-2222"));

        try
        {
            // Find the Name of the Supplier given a number
            Supplier sp = pList2.FindByNumber();
            Console.WriteLine(sp.Name + ":" + sp.Number);
        }
        catch(NotFoundException)
        {
            Console.WriteLine(Not Found);
        }

        // The Following Declaration is invalid because EmailFriend Does not
        // Implement IPhoneNumber
        // PhoneList<EmailFriend> pList3 = new PhoneList<EmailFriend>(); // Error
    }
        /// <summary>
        /// Gets the phone numbers from API.
        /// </summary>
        /// <param name="v">The v.</param>
        private async Task GetPhoneNumbersFromApi(string v)
        {
            using (var client = new HttpClient())
            {
                client.BaseAddress = new Uri(v);
                var response = client.GetAsync("api/Phones/" + PersonContactDetails?.ContactId.ToString()).Result;
                if (response.IsSuccessStatusCode)
                {
                    PhoneList = await response.Content.ReadAsAsync <ObservableCollection <PhoneNumbers> >();

                    SelectedPhone = PhoneList?.FirstOrDefault();
                }
                else
                {
                    MessageBox.Show("Some Error occured on getting list of emails");
                }
            }
        }
Beispiel #16
0
        public IActionResult AllPhone()
        {
            ViewData["Message"] = "Your application AllPhone page.";
            HomeIndexViewModel ivm = new HomeIndexViewModel();

            ivm.AllPhones = new List <PhoneList>();
            var AllPhones = _dbContext.Phone.Where <Phone>(e => e.ObjId > 0);

            foreach (var p in AllPhones)
            {
                PhoneList pl = new PhoneList();
                pl.p = new Phone {
                    ObjId = p.ObjId, Name = p.Name, Introduce = p.Introduce, Img = p.Img, Price = p.Price, Price2 = p.Price2
                };
                ivm.AllPhones.Add(pl);
            }
            return(View(ivm));
        }
Beispiel #17
0
    static void Main()
    {
        PhoneList <FriendNumber> pList = new PhoneList <FriendNumber>();

        pList.Add(new FriendNumber("Ivan", "891277777777", false));
        pList.Add(new FriendNumber("Paul", "891275675677", true));
        pList.Add(new FriendNumber("Tom", "891745645777", false));

        try {
            FriendNumber frnd = pList.FindByName("Ivan");

            Console.WriteLine(frnd.Name + " " + frnd.Number);

            if (frnd.isWorkNumber)
            {
                Console.WriteLine(" (рабочий)");
            }
            else
            {
                Console.WriteLine();
            }
        }

        catch (NotFoundException) { Console.WriteLine("Not found"); }

        Console.WriteLine();


        PhoneList <Supplier> pList2 = new PhoneList <Supplier>();

        pList2.Add(new Supplier("Ivan", "891277777777"));
        pList2.Add(new Supplier("Paul", "891275675677"));
        pList2.Add(new Supplier("Tom", "891745645777"));

        try {
            Supplier frnd2 = pList2.FindByNumber("891275675677");

            Console.WriteLine(frnd2.Name + " " + frnd2.Number);
        }

        catch (NotFoundException) { Console.WriteLine("Not found"); }
    }
Beispiel #18
0
    public static void Main1()
    {
        PhoneList <Friends> plist = new PhoneList <Friends>();

        plist.Add(new Friends("Tom", "555-1234", true));
        plist.Add(new Friends("Garry", "555-6756", true));
        plist.Add(new Friends("Matt", "555-9254", false));

        try
        {
            Friends frnd = plist.FindByName("Garry");
            System.Console.Write(frnd.Name + " " + frnd.Number);
            if (frnd.IsWorkNumber)
            {
                Console.WriteLine(" (рабочий)");
            }
            else
            {
                System.Console.WriteLine();
            }
        }
        catch (NotFoundException)
        {
            System.Console.WriteLine("Не найдено.");
        }
        System.Console.WriteLine();
        PhoneList <Supplier> plist2 = new PhoneList <Supplier>();

        plist2.Add(new Supplier("Company Global Hardware", "555-8834"));
        plist2.Add(new Supplier("Agency Computer Warehouse", "555-9256"));
        plist2.Add(new Supplier("Company NetworkCity", "555-2564"));
        try
        {
            Supplier sp = plist2.FindByNumber("555-2564");
            System.Console.WriteLine(sp.Name + " " + sp.Number);
        }
        catch (NotFoundException)
        {
            System.Console.WriteLine("Не найдено.");
        }
    }
Beispiel #19
0
    public IEnumerator PhoneList()
    {
        PhoneList SQL_PL  = new PhoneList();
        JSONNode  JSON_PL = JSONReader.Read("GetPhoneList");
        List <Dictionary <string, object> > CSV_PL = CSVReader.Read("Doc_id_lut table");

        for (int i = 0; i < JSON_PL.Count; i++)
        {
            SQL_PL.StakeHolder_ID = int.Parse(JSON_PL[i]["Stakeholder_id"]);
            SQL_PL.Document_ID    = 0;

            SQL_PL.PreferredFirstName = JSON_PL[i]["PreferredFirstName"];
            SQL_PL.FirstName          = JSON_PL[i]["FirstName"];
            SQL_PL.LastName           = JSON_PL[i]["LastName"];
            SQL_PL.ComputingID        = JSON_PL[i]["ComputingID"];
            SQL_PL.Biographic         = JSON_PL[i]["Biographic"];
            SQL_PL.EmailAddress       = JSON_PL[i]["EmailAddress"];
            SQL_PL.Room        = JSON_PL[i]["Room"];
            SQL_PL.PhoneNumber = JSON_PL[i]["Phonenumber"];
            SQL_PL.Title       = JSON_PL[i]["PAD"];

            // --- PICTURE ---
            for (int j = 0; j < CSV_PL.Count; j++)
            {
                string ID = JSON_PL[i]["Stakeholder_id"].ToString();

                if (CSV_PL[j]["stakeholder_id"].ToString() == ID.Substring(1, ID.Length - 2))
                {
                    SQL_PL.Document_ID = int.Parse(CSV_PL[j]["document_id"].ToString());
                    break;
                }
            }

            dbLink.Insert(SQL_PL);
        }

        yield break;
    }
Beispiel #20
0
        public IActionResult Index()
        {
            ViewBag.navs = new[] { "手机好店", "热门", "新品", "周边", "服务" };
            //var phones = _dbContext.Phone.AsQueryable<Phone>();
            //return View(phones);
            HomeIndexViewModel ivm = new HomeIndexViewModel();

            ivm.AllPhones = new List <PhoneList>();
            ivm.SpeedBuy  = new List <PhoneList>();
            var AllPhones = _dbContext.Phone.Where <Phone>(e => e.ObjId > 0);

            //var AllPhones = _dbContext.Phone.Where<Phone>(e => e.ObjId > 0).Take<Phone>(4);
            foreach (var p in AllPhones)
            {
                PhoneList pl = new PhoneList();
                pl.p = new Phone {
                    ObjId = p.ObjId, Name = p.Name, Introduce = p.Introduce, Img = p.Img, Price = p.Price, Price2 = p.Price2
                };
                ivm.AllPhones.Add(pl);
            }
            return(View(ivm));
            //return View();
        }
 protected void PhoneList_PagePropertiesChanging(object sender, PagePropertiesChangingEventArgs e)
 {
     (PhoneList.FindControl("DataPager1") as DataPager).SetPageProperties(e.StartRowIndex, e.MaximumRows, false);
     this.Llenar();
 }
Beispiel #22
0
 public Person()
 {
     Address      = new Address();
     phoneNumbers = new PhoneList();
 }
Beispiel #23
0
        public IActionResult Index()
        {
            ViewBag.navs       = new[] { "手机好店", "热门", "新品", "周边", "服务" };
            ViewBag.phoneclass = new[] { "小米", "华为", "苹果", "三星" };
            //var phones = _dbContext.Phone.AsQueryable<Phone>();
            //return View(phones);
            HomeIndexViewModel ivm = new HomeIndexViewModel();

            ivm.Phones    = new List <PhoneList>();
            ivm.SpeedBuy  = new List <PhoneList>();
            ivm.SpeedBuy2 = new List <PhoneList>();
            ivm.Hot       = new List <PhoneList>();
            ivm.Hot2      = new List <PhoneList>();
            ivm.Hot3      = new List <PhoneList>();
            ivm.Hot4      = new List <PhoneList>();
            var Phones    = _dbContext.Phone.Where <Phone>(e => e.ObjId > 0).Take <Phone>(6);
            var SpeedBuy  = _dbContext.Phone.Where <Phone>(e => e.ObjId > 6).Take <Phone>(4);
            var SpeedBuy2 = _dbContext.Phone.Where <Phone>(e => e.ObjId > 10).Take <Phone>(4);
            //var AllPhones = _dbContext.Phone.Where<Phone>(e => e.ObjId > 0).Take<Phone>(4);
            var Hot  = _dbContext.Phone.Where <Phone>(e => e.Brand == "小米").Take <Phone>(4);
            var Hot2 = _dbContext.Phone.Where <Phone>(e => e.Brand == "华为").Take <Phone>(4);
            var Hot3 = _dbContext.Phone.Where <Phone>(e => e.Brand == "苹果").Take <Phone>(4);
            var Hot4 = _dbContext.Phone.Where <Phone>(e => e.Brand == "三星").Take <Phone>(4);

            foreach (var p in Phones)
            {
                PhoneList pl = new PhoneList();
                pl.p = new Phone {
                    ObjId = p.ObjId, Name = p.Name, Introduce = p.Introduce, Img = p.Img, Price = p.Price, Price2 = p.Price2
                };
                ivm.Phones.Add(pl);
            }
            foreach (var p in SpeedBuy)
            {
                PhoneList left = new PhoneList();
                left.p = new Phone {
                    ObjId = p.ObjId, Name = p.Name, Introduce = p.Introduce, Img = p.Img, Price = p.Price, Price2 = p.Price2
                };
                ivm.SpeedBuy.Add(left);
            }
            foreach (var p in SpeedBuy2)
            {
                PhoneList right = new PhoneList();
                right.p = new Phone {
                    ObjId = p.ObjId, Name = p.Name, Introduce = p.Introduce, Img = p.Img, Price = p.Price, Price2 = p.Price2
                };
                ivm.SpeedBuy2.Add(right);
            }
            foreach (var p in Hot)
            {
                PhoneList mi = new PhoneList();
                mi.p = new Phone {
                    ObjId = p.ObjId, Name = p.Name, Introduce = p.Introduce, Img = p.Img, Price = p.Price, Price2 = p.Price2
                };
                ivm.Hot.Add(mi);
            }
            foreach (var p in Hot2)
            {
                PhoneList p1 = new PhoneList();
                p1.p = new Phone {
                    ObjId = p.ObjId, Name = p.Name, Introduce = p.Introduce, Img = p.Img, Price = p.Price, Price2 = p.Price2
                };
                ivm.Hot2.Add(p1);
            }
            foreach (var p in Hot3)
            {
                PhoneList p1 = new PhoneList();
                p1.p = new Phone {
                    ObjId = p.ObjId, Name = p.Name, Introduce = p.Introduce, Img = p.Img, Price = p.Price, Price2 = p.Price2
                };
                ivm.Hot3.Add(p1);
            }
            foreach (var p in Hot4)
            {
                PhoneList p1 = new PhoneList();
                p1.p = new Phone {
                    ObjId = p.ObjId, Name = p.Name, Introduce = p.Introduce, Img = p.Img, Price = p.Price, Price2 = p.Price2
                };
                ivm.Hot4.Add(p1);
            }

            return(View(ivm));
            //return View();
        }
Beispiel #24
0
        public bool SavePhoneList(PhoneList phoneList)
        {
            bool result      = true;
            int  phoneListId = 0;

            try
            {
                if (_loanEntities.PhoneList.Select(o => o.phone == phoneList.phone).Count() == 0)
                {
                    _loanEntities.PhoneList.Add(phoneList);
                    _loanEntities.SaveChanges();
                    phoneListId = phoneList.id;

                    if (phoneList.billData != null)
                    {
                        foreach (BillData billData in phoneList.billData)
                        {
                            billData.phoneListId = phoneListId;
                            _loanEntities.BillData.Add(billData);
                        }
                    }

                    if (phoneList.flowBill != null)
                    {
                        foreach (FlowBill flowBill in phoneList.flowBill)
                        {
                            flowBill.phoneListId = phoneListId;
                            _loanEntities.FlowBill.Add(flowBill);
                        }
                    }

                    if (phoneList.flowDetail != null)
                    {
                        foreach (FlowDetail flowDetail in phoneList.flowDetail)
                        {
                            flowDetail.phoneListId = phoneListId;
                            _loanEntities.FlowDetail.Add(flowDetail);
                        }
                    }

                    if (phoneList.messageData != null)
                    {
                        foreach (MessageData messageData in phoneList.messageData)
                        {
                            messageData.phoneListId = phoneListId;
                            _loanEntities.MessageData.Add(messageData);
                        }
                    }

                    if (phoneList.telData != null)
                    {
                        foreach (TelData telData in phoneList.telData)
                        {
                            telData.phoneListId = phoneListId;
                            _loanEntities.TelData.Add(telData);
                        }
                    }
                    _loanEntities.SaveChanges();
                }
            }
            catch (Exception e)
            {
                if (phoneListId != 0)
                {
                    _loanEntities.PhoneList.Remove(phoneList);
                }
            }
            return(result);
        }