예제 #1
0
        public virtual IEnumerable UploadFile(PXAdapter adapter)
        {
            this.Save.Press();

            if (this.NewFacePanel.AskExt() == WebDialogResult.OK)
            {
                var person = this.Persons.Current;

                if (person != null)
                {
                    const string PanelSessionKey = "FaceFile";

                    var info = PXContext.SessionTyped <PXSessionStatePXData>().FileInfo[PanelSessionKey] as PX.SM.FileInfo;

                    try
                    {
                        var faceId = Api.AddPersonFace(person, info.BinData);

                        info.UID = faceId;

                        try
                        {
                            info.UID = faceId;

                            SaveFile(info);
                        }
                        catch (Exception ex)
                        {
                            PXTrace.WriteError(ex);

                            Api.DeletePersonFace(person, faceId);
                        }
                    }
                    finally
                    {
                        System.Web.HttpContext.Current.Session.Remove(PanelSessionKey);
                    }

                    PXLongOperation.StartOperation(this, () =>
                    {
                        Api.Train(person.GroupName);
                    });
                }
            }

            return(adapter.Get());
        }
예제 #2
0
 public Guid AddPersonFace(Person person, byte[] data)
 {
     return(Client.AddPersonFace(person, data));
 }