private void SaveLog(BcLog log)
 {
     log.Save();
     foreach (BcNotificationSystem sys in IdentificationServer.NotificationSystems)
     {
         IdentificationServer.SendNotifyFunc sendNotifyFunc = new IdentificationServer.SendNotifyFunc(IdentificationServer.SendNotify);
         sendNotifyFunc.BeginInvoke(this._device, log, true, sys, (AsyncCallback)null, (object)sendNotifyFunc);
     }
 }
 private void SaveResults(IEnumerable <CompareResult> analiticResults)
 {
     foreach (CompareResult compareResult in analiticResults)
     {
         try
         {
             if (compareResult.AccessId != -1 || this._device.SaveNonCategory)
             {
                 BcLog log = CompareRequest.FrameToLogBcLog(compareResult.SourceFrame);
                 log.FaceId  = compareResult.FaceId;
                 log.ImageId = compareResult.ImageId;
                 log.Score   = Convert.ToSingle(compareResult.Score);
                 this.SaveLog(log);
                 ++this._device.ResultCount;
             }
         }
         catch (Exception ex)
         {
             this._logger.Error((object)"Error saving - ", ex);
         }
     }
 }
Exemple #3
0
        private void gridView1_DoubleClick(object sender, EventArgs e)
        {
            if (gridView1.FocusedRowHandle < 0)
            {
                return;
            }
            DataRow          dataRow          = gridView1.GetDataRow(gridView1.FocusedRowHandle);
            FrmCompareImages frmCompareImages = new FrmCompareImages();

            frmCompareImages.StartPosition = FormStartPosition.CenterScreen;
            try
            {
                Bitmap bitmap = new Bitmap(new MemoryStream(BcLog.LoadById((int)dataRow["LogID"]).Image));
                frmCompareImages.pbMainImage.Image = pictureEdit1.Image;
                frmCompareImages.pbCamImage.Image  = bitmap;
                int num = (int)frmCompareImages.ShowDialog();
            }
            catch (Exception ex)
            {
                int num = (int)XtraMessageBox.Show(ex.Message, Messages.Error, MessageBoxButtons.OK, MessageBoxIcon.Hand);
            }
        }
Exemple #4
0
        public static void SendNotify(BcDevices dev, BcLog log, bool hasface, BcNotificationSystem sys)
        {
            QueueParameters notificationQueue = new QueueParameters()
            {
                HostName    = sys.HostName,
                Password    = sys.Password,
                UserName    = sys.UserName,
                VirtualHost = sys.VirtualHost,
                QueueName   = string.Concat(new object[4]
                {
                    (object)sys.Fqdn,
                    (object)".",
                    (object)sys.SystemId,
                    (object)".NotificationAPI.input"
                })
            };
            string str1 = "";
            string str2 = "";
            string str3 = "";
            string str4 = "";

            try
            {
                byte[]   numArray = (byte[])null;
                DateTime dateTime = DateTime.Now;
                Guid     faceId   = log.FaceId;
                try
                {
                    if (hasface)
                    {
                        using (SqlCommand sqlCommand = new SqlCommand("Select ImageIcon,Surname,FirstName,LastName, Birthday, AccessCategory.Name as category from Faces left outer join\r\n                                AccessCategory on Accesscategory.ID = Faces.AccessID  Where Faces.ID=@ID", new SqlConnection(CommonSettings.ConnectionString)))
                        {
                            sqlCommand.Parameters.Add(new SqlParameter("@ID", (object)log.FaceId));
                            sqlCommand.Connection.Open();
                            SqlDataReader sqlDataReader = sqlCommand.ExecuteReader();
                            sqlDataReader.Read();
                            numArray = (byte[])sqlDataReader[0];
                            str1     = sqlDataReader["category"].ToString();
                            str3     = sqlDataReader["FirstName"].ToString();
                            str4     = sqlDataReader["Surname"].ToString();
                            str2     = sqlDataReader["LastName"].ToString();
                            dateTime = (DateTime)sqlDataReader["Birthday"];
                            sqlCommand.Connection.Close();
                        }
                    }
                }
                catch (Exception ex)
                {
                    IdentificationServer.Logger.Error((object)"Notification error", ex);
                }
                NotificationParameters parameters = new NotificationParameters()
                {
                    Id        = Guid.NewGuid(),
                    Category  = str1,
                    Camera    = dev.Name,
                    EventTime = DateTime.Now,
                    Image1    = log.Image,
                    Image2    = numArray
                };
                if (hasface)
                {
                    parameters.NotificationData.Add("Birthday", dateTime.ToString());
                    parameters.NotificationData.Add("FaceID", faceId.ToString());
                }
                parameters.NotificationData["Lastname"] = str2;
                parameters.NotificationData["Name"]     = str3;
                parameters.NotificationData["Surname"]  = str4;
                using (NotificationProtocolClient notificationProtocolClient = new NotificationProtocolClient(notificationQueue))
                {
                    notificationProtocolClient.Open();
                    notificationProtocolClient.SendNotification("Identification", parameters);
                }
            }
            catch (Exception ex)
            {
                IdentificationServer.Logger.Error((object)"Notification error", ex);
            }
        }