Example #1
0
 public void ShowPeople(InRegionPerson p)
 {
     try
     {
         txtName.Text       = p.UserName;
         txtCardID.Text     = p.CardID;
         txtDepartment.Text = p.Department;
         txtDoor.Text       = p.DoorName;
         txtEventDT.Text    = p.EnterDateTime.ToString("yyyy-MM-dd HH:mm:ss");
         txtPhone.Text      = string.Empty;
         picPhoto.Image     = null;
         var person = new WebAPIClient.PersonDetailClient(AppSettings.Current.ConnStr).GetByID(p.UserID, true).QueryObject;
         if (person != null)
         {
             txtPhone.Text = person.Phone;
             if (!string.IsNullOrEmpty(person.PhotoUrl))
             {
                 using (var client = new System.Net.WebClient())
                 {
                     var data = client.DownloadData(person.PhotoUrl);
                     if (data != null && data.Length > 0)
                     {
                         using (var fs = new MemoryStream(data))
                         {
                             picPhoto.Image = Image.FromStream(fs);
                         }
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
     }
 }
        private void GetPersonDetail(string userID)
        {
            if (_DicPerson.ContainsKey(userID))
            {
                return;
            }
            var person = new WebAPIClient.PersonDetailClient(_Url).GetByID(userID, true).QueryObject;

            if (person != null)
            {
                if (!string.IsNullOrEmpty(person.PhotoUrl))
                {
                    var bytes = DownloadPhoto(person.PhotoUrl);
                    person.Photo = bytes;
                }
                _DicPerson.Add(userID, person);
            }
        }