private void FrmDoorSelection_Load(object sender, EventArgs e)
        {
            List <Door> doors = new DoorClient(AppSettings.Current.ConnStr).GetItems(null, true).QueryObjects;

            if (doors != null && doors.Count > 0)
            {
                doors = (from item in doors
                         orderby item.Name ascending
                         select item).ToList();
                foreach (var door in doors)
                {
                    int row = dataGridView1.Rows.Add();
                    ShowItemInGridViewRow(dataGridView1.Rows[row], door);
                }
            }
        }
Exemplo n.º 2
0
    void OnTriggerExit(Collider other)
    {
        DoorClient client = other.GetComponent <DoorClient>();

        if (!client)
        {
            return;
        }

        Rigidbody rigid = other.GetComponent <Rigidbody>();

        if (rigid)
        {
            rigid.isKinematic = true;
        }

        Register(client, false);
        CloseDoor();
    }
        private void ShowRegion(Region region)
        {
            txtName.Text         = region.Name;
            chk不显示超时未出人员.Checked = region.HideTimeOutPerson;
            var doors = new DoorClient(AppSettings.Current.ConnStr).GetItems(null, true).QueryObjects;

            if (doors == null || doors.Count == 0)
            {
                return;
            }
            viewEntrance.Rows.Clear();
            if (region.EnterDoors != null && region.EnterDoors.Count > 0)
            {
                foreach (var doorID in region.EnterDoors)
                {
                    var door = doors.SingleOrDefault(it => it.ID == doorID);
                    if (door != null)
                    {
                        var row = viewEntrance.Rows.Add();
                        viewEntrance.Rows[row].Tag = door;
                        viewEntrance.Rows[row].Cells["colIDEnter"].Value   = door.ID;
                        viewEntrance.Rows[row].Cells["colNameEnter"].Value = door.Name;
                    }
                }
            }
            viewExit.Rows.Clear();
            if (region.ExitDoors != null && region.ExitDoors.Count > 0)
            {
                foreach (var doorID in region.ExitDoors)
                {
                    var door = doors.SingleOrDefault(it => it.ID == doorID);
                    if (door != null)
                    {
                        var row = viewExit.Rows.Add();
                        viewExit.Rows[row].Tag = door;
                        viewExit.Rows[row].Cells["colIDExit"].Value   = door.ID;
                        viewExit.Rows[row].Cells["colNameExit"].Value = door.Name;
                    }
                }
            }
        }
Exemplo n.º 4
0
    // Add/remove clients using door
    void Register(DoorClient client, bool register)
    {
        DoorClient found = null;

        foreach (DoorClient c in clients)
        {
            if (c == client)
            {
                found = c;
                break;
            }
        }
        if (register && !found && client)
        {
            clients.Add(client);
        }
        else if (found && !register)
        {
            clients.Remove(client);
        }
    }
Exemplo n.º 5
0
    void OnTriggerEnter(Collider other)
    {
        DoorClient client = other.GetComponent <DoorClient>();

        if (!client)
        {
            return;
        }

        Rigidbody rigid = other.GetComponent <Rigidbody>();

        if (rigid)
        {
            rigid.isKinematic = false;
        }

        if (client.PassingThrough(passPlane))
        {
            Register(client, true);
            float dir = Mathf.Sign(Vector3.Dot(passPlane, other.transform.position) + passPlane.w);
            OpenDoor(dir);
        }
    }
Exemplo n.º 6
0
 /// <summary>
 /// 验证门禁,更新小区信息之前操作
 /// </summary>
 public void AuthDoor()
 {
     if (this.IsAuth)
     {
         return;
     }
     try
     {
         DoorClient dc       = new DoorClient();
         var        response = dc.Create(this.PId, this.DepartId, this.Name);
         if (response.Code == "0")
         {
             this.IsAuth = true;
         }
         else
         {
             this.IsAuth = false;
         }
     }
     catch (Exception)
     {
         this.IsAuth = false;
     }
 }