private static string GetGroupName(int groupId)
 {
     return(BusTagUserType.GetTagUserTypeName(groupId));
 }
示例#2
0
        protected void settingList_ItemCreated(object sender, RepeaterItemEventArgs e)
        {
            DBViewTagSetting setting = e.Item.DataItem as DBViewTagSetting;

            if (setting != null)
            {
                Img icon = e.Item.FindControl("icon") as Img;
                icon.Src = CommonExtension.IdentityIcon((int)setting.Id);//TagId);


                Anchor     tagName  = (Anchor)e.Item.FindControl("tagName");
                SmartLabel userType = (SmartLabel)e.Item.FindControl("userType");
                SmartLabel userMemo = (SmartLabel)e.Item.FindControl("memo");
                tagName.Text = setting.HostName;

                HostTagGroupStatus tagUser = HostTagGroupStatus.SelectByTagId((int)setting.Id);//.TagId);
                int groupId = 0;
                if (tagUser != null)
                {
                    groupId       = tagUser.HostGroupId;
                    userType.Text = BusTagUserType.GetTagUserTypeName(tagUser.HostGroupId);
                    userMemo.Text = tagUser.Description;
                }
                tagName.Href = PathUtil.ResolveUrl(string.Format("/TagUsers/TagUser.aspx?id={0}&type={1}",
                                                                 setting.HostId, groupId));

                SmartLabel idSelection  = (SmartLabel)e.Item.FindControl("idSelection");
                string     disableOrNot = this.IsLocatingServiceAvailable ? "" : " disabled=\"disabled\"";
                idSelection.Text = "<input type=\"checkbox\" name=\"selection\"" + disableOrNot + " onclick=\"javascript:Locating.selectTag(this);\" value=\"" + setting.Id + "\" />";//setting.TagId + "\" />";


                if (setting.CommandState == null)
                {
                    return;     // <-----------------If never been configured ----------------------------------------------
                }

                SmartLabel    commandState = (SmartLabel)e.Item.FindControl("commandState");
                DateTimeLabel startTime    = (DateTimeLabel)e.Item.FindControl("startTime");
                Anchor        operate      = (Anchor)e.Item.FindControl("operate");

                switch ((LocatingCommandState)setting.CommandState)
                {
                case LocatingCommandState.WaitToStart:
                    operate.Text      = "N/A";
                    operate.CssClass  = "t3";
                    commandState.Text = "请求开始中";
                    commandState.Style.Add("color", "Green");
                    break;

                case LocatingCommandState.WaitToStop:
                    operate.Text      = "N/A";
                    operate.CssClass  = "t3";
                    commandState.Text = "请求停止中";
                    commandState.Style.Add("color", "Red");
                    break;

                default:
                case LocatingCommandState.Executed:
                    if (setting.WorkingStatus == (byte)TagWorkingStatus.Locating)
                    {
                        operate.Text           = "停止";
                        operate.Href           = "javascript:Locating.quickStop(" + setting.Id + ");"; //setting.TagId + ");";
                        startTime.DisplayValue = (DateTime)setting.UpdateTime;
                    }
                    else
                    {
                        operate.Text    = "快速启动";
                        operate.ToolTip = "按照已设定参数快速启动";
                        operate.Href    = "javascript:Locating.quickStart(" + setting.Id + ");"; //setting.TagId + ");";
                    }
                    operate.Attributes["id"] = "op_" + setting.Id;                               //setting.TagId;
                    break;
                }

                if (!this.IsLocatingServiceAvailable)
                {
                    operate.Text     = "N/A";
                    operate.Href     = null;
                    operate.CssClass = "t3";
                    operate.ToolTip  = "系统未检测到LocatingServer运行。";
                }
            }
        }