Example #1
0
 public static void SendCommand(BcDevices dev, int accessId, int sfinksId)
 {
     try
     {
         IdentificationServer.DeviceClient.SendCommand(IdentificationServer.LoginCom);
         IdentificationServer.DeviceClient.SendCommand(string.Concat(new object[4]
         {
             (object)"CASCADE_FACEDETECTED ",
             (object)sfinksId,
             (object)" ",
             (object)dev.Id.ToString().Replace("-", "")
         }));
         if (accessId == -1)
         {
             return;
         }
         BcAccessCategory catout;
         IdentificationServer.ReadWriteAccessCategory(false, accessId, (BcAccessCategory)null, out catout);
         if (catout == null || !IdentificationServer.DeviceClient.IsConnected)
         {
             return;
         }
         BcObjects bcObjects = Enumerable.FirstOrDefault <BcObjects>((IEnumerable <BcObjects>)catout.Data, (Func <BcObjects, bool>)(o => o.Id == dev.ObjectId));
         if (bcObjects == null)
         {
             return;
         }
         if (bcObjects.Device && dev.TableId == Guid.Empty)
         {
             try
             {
                 IdentificationServer.DeviceClient.SendCommand(IdentificationServer.LoginCom);
                 IdentificationServer.DeviceClient.SendCommand(IdentificationServer.AllowPass);
             }
             catch (Exception ex)
             {
                 IdentificationServer.Logger.Error((object)"sfinks net error", ex);
             }
         }
         else if (dev.TableId != Guid.Empty)
         {
             if (BcObjectsData.GetObjectById(bcObjects.Data, dev.TableId).Device)
             {
                 try
                 {
                     IdentificationServer.DeviceClient.SendCommand(IdentificationServer.LoginCom);
                     IdentificationServer.DeviceClient.SendCommand(IdentificationServer.AllowPass);
                 }
                 catch (Exception ex)
                 {
                     IdentificationServer.Logger.Error((object)"sfinks net error", ex);
                 }
             }
         }
     }
     catch (Exception ex)
     {
         IdentificationServer.Logger.Error((object)"sfinks net error", ex);
     }
 }
Example #2
0
 public void ReloadObjects()
 {
     Devices  = BcDevicesStorageExtensions.LoadAll();
     _objects = BcObjects.LoadAll();
     lvObjects.Items.Clear();
     foreach (BcDevices bcDevices in Devices)
     {
         lvObjects.Items.Add(bcDevices.Name);
         lvObjects.Items[lvObjects.Items.Count - 1].Value       = bcDevices.Id;
         lvObjects.Items[lvObjects.Items.Count - 1].Description = bcDevices.Name;
     }
 }
Example #3
0
        private BcObjects GetObjectById(int id)
        {
            BcObjects bcObjects1 = new BcObjects();

            foreach (BcObjects bcObjects2 in _objects)
            {
                if (id == bcObjects2.Id)
                {
                    return(bcObjects2);
                }
            }
            return(bcObjects1);
        }
Example #4
0
 public void WorkerThread(DataTable dt)
 {
     foreach (DataRow dataRow in (InternalDataCollectionBase)dt.Rows)
     {
         try
         {
             SqlCommand sqlCommand = new SqlCommand("Select Log.ID as ID,\r\nCascadeStream.dbo.Faces.Surname +' '\r\n+CascadeStream.dbo.Faces.FirstName+' '+\r\nCascadeStream.dbo.Faces.LastName as Name,Log.Date,ObjectID,TableID,isnull(\r\ncase when Category like '' then '" + (object)Messages.NonCategory + "' else Category\r\nend, '" + Messages.NonCategory + "') as 'Category',ImageKey,Log.ImageIcon\r\nfrom\r\nLog left outer join CascadeStream.dbo.Faces\r\non \r\nCascadeStream.dbo.Faces.ID = Log.FaceID WHERE Log.ID = " + (string)dataRow["ID"], new SqlConnection(CommonSettings.ConnectionStringLog));
             sqlCommand.Connection.Open();
             SqlDataReader sqlDataReader = sqlCommand.ExecuteReader();
             while (sqlDataReader.Read())
             {
                 try
                 {
                     BcObjects objectById1 = GetObjectById((int)sqlDataReader["ObjectID"]);
                     string    str         = objectById1.Name;
                     if ((Guid)sqlDataReader["TableID"] != Guid.Empty)
                     {
                         BcObjectsData objectById2 = BcObjectsData.GetObjectById(objectById1.Data, (Guid)sqlDataReader["TableID"]);
                         str = str + "-" + objectById2.Name;
                     }
                     try
                     {
                         Invoke(new AddNewRowFunc(AddNewRow), (object)new object[7]
                         {
                             (object)Convert.ToInt32(sqlDataReader["ID"]),
                             sqlDataReader["ImageIcon"],
                             (object)sqlDataReader["Name"].ToString(),
                             (object)(float)dataRow["Score"],
                             (object)(DateTime)sqlDataReader["Date"],
                             (object)sqlDataReader["Category"].ToString(),
                             (object)str
                         }, (object)0);
                     }
                     catch
                     {
                     }
                 }
                 catch
                 {
                 }
             }
             sqlCommand.Connection.Close();
         }
         catch
         {
         }
     }
     Invoke(new AddNewRowFunc(AddNewRow), null, (object)1);
 }
Example #5
0
 public FrmDevices(List <BcDevices> devs)
 {
     this.InitializeComponent();
     try
     {
         this._objects = BcObjects.LoadAll();
         BcDevices[] array = new BcDevices[devs.Count];
         devs.CopyTo(array, 0);
         this.ActiveDevices.AddRange((IEnumerable <BcDevices>)array);
         FrmImages.SqlServerState = true;
     }
     catch (Exception ex)
     {
         int num = (int)XtraMessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Hand);
         FrmImages.SqlServerState = false;
     }
 }
Example #6
0
 private void RefreshForm()
 {
     _dtmain.Dispose();
     _dtmain = new DataTable();
     _dtmain.Columns.AddRange(new DataColumn[4]
     {
         new DataColumn("ID"),
         new DataColumn("Name"),
         new DataColumn("Comment"),
         new DataColumn("Data")
     });
     _objects = BcObjects.LoadAll();
     foreach (BcObjects bcObjects in _objects)
     {
         _dtmain.Rows.Add((object)bcObjects.Id, (object)bcObjects.Name, (object)bcObjects.Comment, (object)bcObjects.Data);
     }
     gridControl1.DataSource = _dtmain;
 }
Example #7
0
 public void ReloadObjects()
 {
     try
     {
         Results.dtImageType.Rows.Clear();
         Results.dtCategories.Rows.Clear();
         Results.dtDevices.Rows.Clear();
         Devices  = BcDevicesStorageExtensions.LoadAll();
         _objects = BcObjects.LoadAll();
         _bases   = BcLogBases.LoadAll();
         lvObjects.Items.Clear();
         foreach (BcDevices bcDevices in Devices)
         {
             lvObjects.Items.Add("");
             lvObjects.Items[lvObjects.Items.Count - 1].Value       = bcDevices.Id;
             lvObjects.Items[lvObjects.Items.Count - 1].Description = bcDevices.Name + "-";
             foreach (BcObjects bcObjects in _objects)
             {
                 if (bcObjects.Id == bcDevices.ObjectId)
                 {
                     bcObjects.GetData();
                     if (bcDevices.TableId != Guid.Empty)
                     {
                         CheckedListBoxItem checkedListBoxItem = lvObjects.Items[lvObjects.Items.Count - 1];
                         string             str1 = checkedListBoxItem.Description + "(" + bcObjects.Name + "-" + BcObjectsData.GetObjectById(bcObjects.Data, bcDevices.TableId).Name + ")";
                         checkedListBoxItem.Description = str1;
                         string str2 = bcObjects.Name + "-" + BcObjectsData.GetObjectById(bcObjects.Data, bcDevices.TableId).Name;
                         Results.dtDevices.Rows.Add((object)bcDevices.Id, (object)bcDevices.Name, (object)bcDevices.ObjectId, (object)bcDevices.TableId, (object)str2);
                         break;
                     }
                     lvObjects.Items[lvObjects.Items.Count - 1].Description += bcObjects.Name;
                     string str = "(" + bcObjects.Name + ")";
                     Results.dtDevices.Rows.Add((object)bcDevices.Id, (object)bcDevices.Name, (object)bcDevices.ObjectId, (object)bcDevices.TableId, (object)str);
                     break;
                 }
             }
         }
     }
     catch
     {
     }
 }
Example #8
0
 private void LoadData()
 {
     tvObjects.BeginUnboundLoad();
     if (_editFlag)
     {
         tvObjects.ClearNodes();
         _objectData = BcObjects.LoadById(SelectedId);
         _objectData.GetData();
         LoadTree(null, null);
     }
     else
     {
         tvObjects.ClearNodes();
         tbComment2.Text  = "";
         tbName2.Text     = "";
         _objectData      = new BcObjects();
         _objectData.Name = "";
         tvObjects.AppendNode("[" + Messages.ControlledObject + "]", -1);
         tvObjects.Nodes[0].Tag = -1;
     }
     tvObjects.EndUnboundLoad();
     tvObjects.Selection.Set(tvObjects.Nodes[0]);
     tvObjects.Selection[0].ExpandAll();
 }
Example #9
0
 public FrmDevices()
 {
     this.InitializeComponent();
     this._objects = BcObjects.LoadAll();
 }