Пример #1
0
        private void FilterSearchComputers()
        {
            string key = "";

            if (!this.buttonEdit1.Text.Equals(this.buttonEdit1.Properties.NullText))
            {
                key = this.buttonEdit1.Text;
            }

            COMPUTERSTATUS status = COMPUTERSTATUS.无;

            if (this.comboBoxEdit1.SelectedIndex > 0)
            {
                Enum.TryParse <COMPUTERSTATUS>(this.comboBoxEdit1.Text, out status);
            }

            int areaId = -1;

            if (this.comboBoxEdit2.SelectedIndex > 0)
            {
                AreaTypeModel model = this.areas[this.comboBoxEdit2.SelectedIndex - 1];
                areaId = model.areaId;
            }
            HomePageMessageManage.GetFilterComputers(status, areaId, key);
        }
Пример #2
0
        //初始化UI
        private void InitUI()
        {
            COMPUTERSTATUS status = COMPUTERSTATUS.空闲;

            Enum.TryParse <COMPUTERSTATUS>(currentCom.Status, out status);
            if (status == COMPUTERSTATUS.异常 || status == COMPUTERSTATUS.空闲)
            {
                this.simpleButton1.Enabled = this.simpleButton2.Enabled = false;
            }
            char[] sp = { ':', ':' };

            //姓名
            this.label1.Text = string.Format("{0}:{1}", this.label1.Text.Split(sp)[0], currentCom.Name);
            //卡号
            this.label3.Text = string.Format("{0}:{1}", this.label3.Text.Split(sp)[0], currentCom.Cardnumber);
            //会员等级
            this.label4.Text = string.Format("{0}:{1}", this.label4.Text.Split(sp)[0], SysManage.GetMemberTypeName(currentCom.Usertype));
            //上网开始时间
            this.label5.Text = string.Format("{0}:{1}", this.label5.Text.Split(sp)[0], currentCom.Starttime);
            //上网时长
            this.label6.Text = string.Format("{0}:{1}", this.label6.Text.Split(sp)[0], currentCom.Usedtime);
            //账户余额
            this.label7.Text = string.Format("{0}:{1}", this.label7.Text.Split(sp)[0], currentCom.Balance);

            //状态
            this.label8.Text = string.Format("{0}:{1}", this.label8.Text.Split(sp)[0], Enum.GetName(typeof(COMPUTERSTATUS), status));
            //区域
            this.label9.Text = string.Format("{0}:{1}", this.label9.Text.Split(sp)[0], SysManage.GetAreaName(currentCom.Area));
            //ip
            this.label10.Text = string.Format("{0}:{1}", this.label10.Text.Split(sp)[0], currentCom.Ip);
            //mac
            this.label11.Text = string.Format("{0}:{1}", this.label11.Text.Split(sp)[0], currentCom.Mac);
        }
Пример #3
0
        /// <summary>
        /// 过滤条件获取设备数组
        /// </summary>
        /// <param name="status">状态</param>
        /// <param name="areaId">区域</param>
        /// <param name="key">关键字</param>
        public static void GetFilterComputers(COMPUTERSTATUS status, int areaId, string key)
        {
            Manage().filterComs = Manage().computers.ToList <StructRealTime>();
            //是否是过滤状态
            Manage().isFilter = false;
            Manage().s_status = COMPUTERSTATUS.无;
            Manage().s_areaId = -1;
            Manage().s_key    = "";

            if (status != COMPUTERSTATUS.无)
            {
                Manage().filterComs = Manage().filterComs.Where(tem => tem.Status.Equals(((int)status).ToString())).ToList <StructRealTime>();
                Manage().isFilter   = true;
                Manage().s_status   = status;
            }
            if (areaId >= 0)
            {
                Manage().filterComs = Manage().filterComs.Where(tem => tem.Area.Equals(areaId.ToString())).ToList <StructRealTime>();
                Manage().isFilter   = true;
                Manage().s_areaId   = areaId;
            }
            if (key != null && !key.Equals(""))
            {
                Manage().filterComs = Manage().filterComs.Where(tem => (tem.Ip.Contains(key) || tem.Mac.Contains(key) || tem.Computer.Contains(key))).ToList <StructRealTime>();
                Manage().isFilter   = true;
                Manage().s_key      = key;
            }
            if (Manage().FilterComputersEvent != null)
            {
                Manage().FilterComputersEvent();
            }
        }
Пример #4
0
 /// <summary>
 /// 获取所需状态的电脑数组
 /// </summary>
 /// <param name="tem">接收数组</param>
 /// <param name="status">状态</param>
 public static void GetStatusComputers(out List <StructRealTime> tem, COMPUTERSTATUS status)
 {
     tem = new List <StructRealTime>();
     if (HomePageMessageManage.Manage().computers != null)
     {
         IEnumerable <StructRealTime> statusComs = from StructRealTime com in Manage().computers where com.Status.Equals(((int)status).ToString()) select com;
         tem = statusComs.ToList <StructRealTime>();
     }
 }
Пример #5
0
        // 刷新电脑状态(开机。下机。认证)
        public void UpdateHomePageData(StructRealTime com)
        {
            this.Invoke(new RefreshUIHandle(delegate {
                //获取所对应的电脑
                List <StructRealTime> coms = new List <StructRealTime>();
                if (areaComsDict.Keys.Contains(com.Area))
                {
                    coms = areaComsDict[com.Area];
                }
                else
                {
                    coms = areaComsDict["-1"];
                }
                //获取电脑所在数组的索引
                int comIndex = -1;
                try
                {
                    comIndex = coms.Select((StructRealTime tem, int
                                            index) => new { tem, index }).Where(a => a.tem.Computerid == com.Computerid).First().index;
                }
                catch (Exception exc)
                {
                    comIndex = -1;
                }

                //通过索引获取电脑
                if (comIndex < 0)
                {
                    return;
                }
                Control[] res = this.comsBg.Controls.Find(string.Format("name_{0}", com.Computerid), true);
                if (res.Count() > 0)
                {
                    coms[comIndex]            = com;
                    AreaComView updateComView = res.First() as AreaComView;
                    updateComView.Tag         = com;
                    COMPUTERSTATUS status     = COMPUTERSTATUS.无;
                    Enum.TryParse <COMPUTERSTATUS>(com.Status, out status);
                    updateComView.ComStatus = status;
                }
                //修改过滤数组的值
                int comindex = HomePageMessageManage.GetComputerIndex(com.Computerid, this.filterComs);
                if (comindex < 0)
                {
                    return;
                }
                this.filterComs[comindex] = com;
                this.comsBg.Refresh();
            }));
        }
Пример #6
0
        //添加新行
        private void AddNewRow(StructRealTime computer, DataRow row)
        {
            //this.gridView1.RefreshRow

            if (row == null)
            {
                row = this.mainDataTable.NewRow();
                this.mainDataTable.Rows.Add(row);
            }
            else
            {
                int index = this.mainDataTable.Rows.IndexOf(row);
                this.mainDataTable.Rows.Remove(row);
                row = this.mainDataTable.NewRow();
                this.mainDataTable.Rows.InsertAt(row, index);
            }

            row[TitleList.EpNumber.ToString()] = computer.Computer;
            row[TitleList.Area.ToString()]     = SysManage.GetAreaName(computer.Area);

            COMPUTERSTATUS status = COMPUTERSTATUS.在线;

            Enum.TryParse <COMPUTERSTATUS>(computer.Status, out status);
            //TODO:状态需要判断
            row[TitleList.State.ToString()]     = Enum.GetName(typeof(COMPUTERSTATUS), status);
            row[TitleList.IdCard.ToString()]    = computer.Cardnumber;
            row[TitleList.CardType.ToString()]  = SysManage.GetMemberTypeName(computer.Usertype);
            row[TitleList.MoneyType.ToString()] = computer.Billing;

            if (computer.Verify.Equals(""))
            {
                row[TitleList.VerifyType.ToString()] = "";
            }
            else
            {
                row[TitleList.VerifyType.ToString()] = computer.Verify.Equals("1") ? "已验证" : "未验证";
            }
            row[TitleList.ResMoney.ToString()]  = computer.Balance;
            row[TitleList.ResTime.ToString()]   = computer.Remaintime;
            row[TitleList.BeginTime.ToString()] = computer.Starttime;
            row[TitleList.UseTime.ToString()]   = computer.Usedtime;
            row[TitleList.EndTime.ToString()]   = computer.Stoptime;
            row[TitleList.MacLoc.ToString()]    = computer.Mac;
            row[TitleList.IpLoc.ToString()]     = computer.Ip;
        }
Пример #7
0
        /// <summary>
        /// 设置电脑
        /// </summary>
        public void SetComs(List <StructRealTime> coms, PaintEventHandler paint)
        {
            for (int i = 0; i < coms.Count; i++)
            {
                StructRealTime com  = coms[i];
                AreaComView    view = new AreaComView();
                view.Tag    = com;
                view.Name   = string.Format("name_{0}", com.Computerid);
                view.Title  = com.Computer;
                view.Click += ComLabel_Click;
                view.Paint += paint;
                this.flowLayoutPanel1.Controls.Add(view);



                COMPUTERSTATUS status = COMPUTERSTATUS.无;
                Enum.TryParse <COMPUTERSTATUS>(com.Status, out status);
                view.ComStatus = status;
            }
        }