RSS订阅优然探索
你的位置:首页 » 学习收藏 » 正文

返回指标的显示效果

选择字号: 超大 标准 发布时间:2009-1-20 23:23:23 | 作者:admin | 0个评论 | 人浏览

         /// <summary>
        /// 返回指标的显示效果
        /// </summary>
        /// <param name="oKPIEDetailID">指标编号</param>
        /// <param name="osShowType">指标类型</param>
        /// <param name="osValue">指标的默认数据</param>
        /// <returns>HTML显示效果</returns>
       
        protected string SwayShowDetail(object oKPIEDetailID, object osShowType, object osValue)
        {

            string KPIEDetailID, sShowType, sValue;
            KPIEDetailID = oKPIEDetailID.ToString();
            sShowType = osShowType.ToString();
            sValue = osValue.ToString();
            string sReturn = string.Empty;
            string[] sZ;                        //分组数据
            string sTmp, sID, sID1;             //临时变量 控件Name,ID
            if (sShowType.ToUpper() == "R")
            {
               
                sValue = sValue.Trim(sDefaultSplit.ToCharArray());
                sZ = sValue.Split(sDefaultSplit.ToCharArray());
                for (int i = 0; i < sZ.Length; i++)
                {

                    sID = sKpiInputName + sKpiInputSplit + KPIEDetailID;
                    sID1 = sID + sKpiInputSplit + i.ToString();
                    if (i == 0)
                    {
                        //第一个需要选择上
                        sTmp = "<input id=\"" + sID1 + "\" type=\"radio\" name=\"" + sID + "\" value=\"" + sZ[i] + "\" checked=\"checked\">";
                    }
                    else
                    {
                        sTmp = "<input id=\"" + sID1 + "\" type=\"radio\" name=\"" + sID + "\" value=\"" + sZ[i] + "\" >";
                    }
                   

                    sTmp += "<label for=\"" + sID1 + "\">" + sZ[i] + "</label>&nbsp;" + KPI_FILEENTER;
                    sReturn += sTmp;
                }

            }
            else if (sShowType.ToUpper() == "S")
            {
           
                sValue = sValue.Trim(sDefaultSplit.ToCharArray());
                sZ = sValue.Split(sDefaultSplit.ToCharArray());
                for (int i = 0; i < sZ.Length; i++)
                {
                    sTmp = "<option value=\"" + sZ[i] + "\">" + sZ[i] + "</option>" + KPI_FILEENTER;
                    sReturn += sTmp;
                }
                sID= sKpiInputName + sKpiInputSplit + KPIEDetailID;
                sReturn = "<select name=\"" + sID + "\" id=\"" + sID + "\" style=\"width:128px;\">" + sReturn + "</select>" + KPI_FILEENTER;

           
            }
            else
            {
                sID = sKpiInputName + sKpiInputSplit + KPIEDetailID;
                sReturn = "<input name=\"txtName\"" + sID + "' type=\"text\" value=\"" + sValue.ToString() + "\">";
            }
            return sReturn;
        }

        /// <summary>
        /// 取得指标的状态
        /// </summary>
        /// <param name="sState"></param>
        /// <returns></returns>
       
        protected string SwayGetDGState(object sState)
        {
            //分组指标的状态0禁止状态 1 第一步骤 2 第二步骤 3 完成状态,可以投入使用
            string state="";
            state = sState.ToString();
            switch (state)
            {
                case "0":
                    state = "<font color=\"#EEEEEE\">禁止状态</font>";
                    break;
                case "1":
                    state = "<font color=\"#0000FF\">第一步骤</font>";
                    break;
                case "2":
                    state = "<font color=\"#00FF00\">第二步骤</font>";
                    break;
                case "3":
                    state = "<font color=\"#000000\">正常状态</font>";
                    break;
                default:
                    state = "<font color=\"#FF0000\">错误状态</font>";
                    break;
            }
            return state;
        }

        /// <summary>
        /// 循环的把信息增加到指定的DropDownList上
        /// </summary>
        /// <param name="drp"></param>
        /// <param name="ds"></param>
        /// <param name="sID"></param>
        /// <param name="iDepth"></param>

        public void SwayInitDrpFor(ref DropDownList drp, DataSet ds, string sID, int iDepth)
        {
            string sTmp, sNPID, sAD;
            DataRow[] dr;
            ListItem lst;
            dr = ds.Tables[0].Select("DepT_AdScript=" + sID);
            for (int i = 0; i < dr.Length; i++)
            {
                sTmp = IsDBNull(dr[i]["DeptName"]);
                sNPID = IsDBNull(dr[i]["DepTcode"]);
                lst = new ListItem();

                sAD = "";
                for (int j = 0; j < iDepth; j++)
                {
                    if (j == 0)
                    {
                        sAD += "┖";
                    }
                    else
                    {
                        sAD += "─";
                    }

                }
                lst.Text = sAD + sTmp;
                lst.Value = sNPID;
                drp.Items.Add(lst);
                SwayInitDrpFor(ref drp, ds, sNPID, iDepth + 1);
            }
        }

标签:

猜你喜欢

发表评论

必填

选填

选填

必填,不填不让过哦,嘻嘻。

记住我,下次回复时不用重新输入个人信息

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。