Пример #1
0
        public void AddOrUpdateAccess(User user, bool hasAccess)
        {
            if (AccessList.ContainsKey(user.Id))
            {
                AccessList[user.Id] = hasAccess;
            }
            else
            {
                AccessList.Add(user.Id, hasAccess);
            }

            if (hasAccess)
            {
                ServerContext.Current.Chat.AddOrUpdateChannelToUser(user, this, false);
            }
        }
Пример #2
0
        public void AddToAccessList(Mobile from)
        {
            if (!AccessList.Contains(from))
            {
                AccessList.Add(from);
            }

            if (ShameAltar.AllowParties)
            {
                Party p = Party.Get(from);

                if (p != null)
                {
                    foreach (PartyMemberInfo info in p.Members.Where(info => !AccessList.Contains(info.Mobile)))
                    {
                        AccessList.Add(info.Mobile);
                    }
                }
            }

            //Timer.DelayCall(TimeSpan.FromMinutes(ShameAltar.CoolDown), ClearAccessList);
        }
Пример #3
0
        private void LoadDoorInf(int aid)
        {
            AccessList_ = new List <AccessModel>();

            try
            {
                string strSQL = "";
                if (aid != 0)
                {
                    strSQL = "select * from  XXCLOUD.dbo.T_MJAPMachineInf where AId='" + aid + "' ";
                }
                else
                {
                    //全部区域
                    strSQL = "select * from  XXCLOUD.dbo.T_MJAPMachineInf  ";
                }
                DataTable myTable = SQLHelper.DTQuery(strSQL);
                if (myTable.Rows.Count > 0)
                {
                    DoorCount = myTable.Rows.Count;//保存总门数

                    for (int i = 0; i < myTable.Rows.Count; i++)
                    {
                        string MSNo       = myTable.Rows[i]["MSNo"].ToString().Trim();
                        string MIPAddress = myTable.Rows[i]["MIPAddress"].ToString();
                        string MCommType  = myTable.Rows[i]["MCommType"].ToString().Trim();
                        uint   MCommPort  = Convert.ToUInt32(myTable.Rows[i]["MCommPort"].ToString().Trim());
                        string MCommPwd   = myTable.Rows[i]["MCommPwd"].ToString().Trim();

                        if (!isExist(MSNo + ""))
                        {
                            UpdateFimware UpdateSys1 = new UpdateFimware();
                            AcsTcpClass   TcpipObj1  = new AcsTcpClass(true);
                            TcpipObj1.OnEventHandler  += XXY_VisitorMJAsst.D_RemoterControlFrm.eventHandler;
                            TcpipObj1.OnStatusHandler += XXY_VisitorMJAsst.D_RemoterControlFrm.statusHandler;
                            TcpipObj1.OnDisconnect    += XXY_VisitorMJAsst.D_RemoterControlFrm.disconnect;
                            //TcpipObj.OnDataDebug += XXY_VisitorMJAsst.D_RemoterControlFrm.showHexMsg;
                            bool blIsActive = TcpipObj1.SetControl(1, 2, false, 0, 10, 180, 5, false, false, "1234578", "ab", "cd", "ef123");

                            var model = new AccessModel()
                            {
                                MSNo      = MSNo + "",
                                IPAddress = myTable.Rows[i]["MIPAddress"].ToString().Trim(),
                                MCommPort = MCommPort + "",
                                MCommPwd  = MCommPwd,
                                MCommType = MCommType,
                                AId       = aid,
                                IsActive  = true,

                                TcpipObj  = TcpipObj1,
                                UpdateSys = UpdateSys1,
                            };

                            if (TcpipObj1.OpenIP(myTable.Rows[i]["MIPAddress"].ToString().Trim(), Convert.ToInt32(myTable.Rows[i]["MCommPort"].ToString().Trim()), MCommPwd) == true)
                            {
                                // MessageBox.Show ("连接成功");
                            }
                            else
                            {
                                // MessageBox.Show("连接失败");
                            }
                            AccessList.Add(model);
                        }
                    }
                }
                else
                {
                    //没有控制器及其门信息
                }
            }
            catch (Exception exp)
            {
                MessageBox.Show(exp.ToString());
            }
        }