protected void btnApply_Click(object sender, EventArgs e)
        {
            if (gvTable.Rows.Count <= 0)
            {
                return;
            }

            for (int i = 0; i < gvTable.Rows.Count; i++)
            {
                KPI_WebKeyEntity csE = new KPI_WebKeyEntity();
                csE.KeyID = gvTable.Rows[i]["KeyID"].ToString();
                csE.KeyIndex = (10+i);

                KPI_WebKeyDal.Update(csE);
            }

            MessageBox.popupClientMessage(this.Page, "排序成功!", "call();");
        }
        public void KPI_SubWeb_Edit(HttpContext context)
        {
            string KeyID = context.Request["KeyID"];
            if (KeyID == "")
            {
                context.Response.Write("{\"status\":\"没有对象!\"}");
                return;
            }

            //string WebCode = context.Request["WebCode"];
            //string ECCode = context.Request["ECCode"];
            //string ECName = context.Request["ECName"];
            //string KeyEngunit = context.Request["KeyEngunit"];
            //string KeyCalcType = context.Request["KeyCalcType"];
            string KeyIndex = context.Request["KeyIndex"];
            int iKeyIndex = 0;

            if (!int.TryParse(KeyIndex, out iKeyIndex))
            {
                context.Response.Write("{\"status\":\"序号数字不合法!\"}");
                return;
            }

            //if (KPI_WebKeyDal.KeyExists(ECCode, WebCode))
            //{
            //    context.Response.Write("{\"status\":\"该指标已存在!\"}");
            //    return;
            //}

            KPI_WebKeyEntity kwk = new KPI_WebKeyEntity();
            //
            kwk.KeyID = KeyID;
            //kwk.ECID = KPI_ECTagDal.GetECIDByCode(ECCode);
            //kwk.ECCode = ECCode;
            //kwk.ECName = ECName;
            //kwk.WebCode = WebCode;
            //kwk.KeyEngunit = KeyEngunit;
            //kwk.KeyCalcType = int.Parse(KeyCalcType);
            kwk.KeyIndex = iKeyIndex;
            kwk.KeyIsValid = 1;

            //kwk.KeyNote = "";
            //kwk.KeyCreateTime = DateTime.Now.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss");
            kwk.KeyModifyTime = DateTime.Now.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss");

            if (KPI_WebKeyDal.Update(kwk))
            {
                context.Response.Write("{\"status\":\"ok\"}");
            }
            else
            {
                context.Response.Write("{\"status\":\"修改失败!\"}");
                return;
            }
        }
        public void KPI_SubWeb_Add(HttpContext context)
        {
            //KeyID,WebCode,ECCode,ECName,KeyEngunit,KeyCalcType,KeyIndex
            string KeyID = Guid.NewGuid().ToString();
            string WebCode = context.Request["WebCode"];
            string ECCode = context.Request["ECCode"];
            string ECName = context.Request["ECName"];
            string KeyEngunit = context.Request["KeyEngunit"];
            string KeyCalcType = context.Request["KeyCalcType"];
            string KeyIndex = context.Request["KeyIndex"];
            int iKeyIndex = 0;

            if (!int.TryParse(KeyIndex, out iKeyIndex))
            {
                context.Response.Write("{\"status\":\"序号数字不合法!\"}");
                return;
            }

            if (KPI_WebKeyDal.KeyExists(ECCode, WebCode))
            {
                context.Response.Write("{\"status\":\"该指标已存在!\"}");
                return;
            }

            KPI_WebKeyEntity kwk = new KPI_WebKeyEntity();
            //
            kwk.KeyID = KeyID;
            kwk.ECID = ECTagDal.GetECIDByCode(ECCode);
            kwk.ECCode = ECCode;
            kwk.ECName = ECName;
            kwk.WebCode = WebCode;
            kwk.KeyEngunit = KeyEngunit;
            kwk.KeyCalcType = int.Parse(KeyCalcType);
            kwk.KeyIndex = iKeyIndex;
            kwk.KeyIsValid = 1;

            kwk.KeyNote = "";
            kwk.KeyCreateTime = DateTime.Now.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss");
            kwk.KeyModifyTime = kwk.KeyCreateTime;

            if (KPI_WebKeyDal.Insert(kwk))
            {
                context.Response.Write("{\"status\":\"ok\"}");
            }
            else
            {
                context.Response.Write("{\"status\":\"添加失败!\"}");
                return;
            }
        }