public AlienTransReport(AlienTransaction aTran, string dateFmt, bool loadPhoto = false) { if (aTran != null) { this.TypeName = aTran.TypeName; this.Code = aTran.Code; this.RequestDate = aTran.RequestDate.ToString(dateFmt); this.FullName = aTran.Alien.Name.FullName; this.PassportCard = aTran.PassportCard.DocNo; this.DateOfBirth = aTran.Alien.DateOfBirth.ToString(dateFmt); this.Sex = aTran.Alien.Sex; this.Nationality = aTran.Alien.Nationality; this.Age = aTran.Age; this.RequestAge = aTran.RequestAge; if (aTran.Invoice != null) { this.Invoice_InvoiceNo = aTran.Invoice.InvoiceNo; this.Invoice_Charge = aTran.Invoice.Charge ?? 0m; } this.PermitToDate = aTran.PermitToDate.ToString(dateFmt); this.DateArrive = aTran.DateArrive.ToString(dateFmt); if (loadPhoto) { this.Photo = aTran.Alien.Photo; } } }
public async Task <IActionResult> GetImage(int id) { PhotoImage ph = await service.GetImageAsync(id); if (ph == null) { return(NotFound()); } return(File(ph.PhotoFile, ph.ImageMimeType)); }
public void ChangeLogo(PhotoImage logo) { if (null == this.Camera || logo == null) { return; } this.Camera.Logo = logo; this.Camera.PhotoImageID = logo.ID; OnPropertyChanged("HasLogo"); OnPropertyChanged("NoLogo"); OnPropertyChanged("ChangeLogo"); }
public void RunQueryThread() { //开启一个线程,不停的获取数据,然后查询数据 System.Threading.Thread thread = new System.Threading.Thread(new System.Threading.ThreadStart(async() => { var db = new ApplicationDbContext(); var rep = new PhotoImageRepository(db); var service = new UFaceService(); while (true) { var b = false; lock (exitLock) { b = bExit; } if (b) { break; } if (queuePhoto.Count == 0) { System.Threading.Thread.Sleep(10); continue; } PhotoImageQueryItem item = null; lock (queueLock) { item = queuePhoto.Dequeue(); } if (item == null) { continue; } try { //查询数据 var list = await service.FaceFind(item.Camera, item.PersonID); if (list != null && list.Length > 0) { //找到对应的;然后更新 foreach (var v in list) { if (string.Compare(v.faceId, item.FaceID) == 0) { var photo = new PhotoImage() { ID = item.PhotoImageID, Feature = v.feature, FeatureKey = v.featureKey, }; rep.UpdateFeature(photo, null); break; } } } } catch (Exception exp) { System.Diagnostics.Debug.WriteLine(exp); } // System.Threading.Thread.Sleep(10); } })); thread.IsBackground = true; thread.Start(); }