protected void btnAddLinq_Click(object sender, EventArgs e)
        {
            int index = KPI_LinqDal.LinqIDCounts();

            string sID = PageControl.GetGuid();

            LinqEntity ote = new LinqEntity();
            ote.LinqID = sID;
            ote.LinqName = "InputName";
            ote.LinqDesc = "";
            ote.LinqEngunit = "";
            ote.LinqIndex = index+1;
            ote.LinqIsValid = 1;
            ote.LinqNote = "";
            ote.LinqCreateTime = DateTime.Now.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss");
            ote.LinqModifyTime = ote.LinqCreateTime;

            if (KPI_LinqDal.Insert(ote))
            {
                //MessageBox.popupClientMessage(this.Page, "添加成功!", "call();");

                gvLinq.EditIndex = index;

                BindGrid();
            }
            else
            {
                MessageBox.popupClientMessage(this.Page, "添加错误!", "call();");

            }
        }
        protected void gvLinq_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            //从GridView获得数据
            string sID = ((HtmlInputHidden)(gvLinq.Rows[e.RowIndex].Cells[0].FindControl("linqid"))).Value;

            string sName = ((TextBox)(gvLinq.Rows[e.RowIndex].Cells[1].Controls[0])).Text.ToString().Trim().ToUpper();
            string sDesc = ((TextBox)(gvLinq.Rows[e.RowIndex].Cells[2].Controls[0])).Text.ToString().Trim().ToUpper();
            string sEngunit = ((TextBox)(gvLinq.Rows[e.RowIndex].Cells[3].Controls[0])).Text.ToString().Trim();

            string sValid = ((DropDownList)(gvLinq.Rows[e.RowIndex].Cells[4].FindControl("ddlValid"))).SelectedValue;
            string sNote = ((TextBox)(gvLinq.Rows[e.RowIndex].Cells[5].Controls[0])).Text.ToString().Trim();

            string msg = "";

            //检查名称
            if (sName == "")
            {
                msg += "名称不能为空!\r\n";
            }
            else if (KPI_LinqDal.LinqNameExists(sName, sID))
            {
                MessageBox.popupClientMessage(this.Page, "已存在相同的名称!");
                return;
            }

            if (msg != "")
            {
                MessageBox.popupClientMessage(this.Page, msg);
                return;
            }

            LinqEntity csE = new LinqEntity();

            csE.LinqID = sID;
            csE.LinqName = sName;
            csE.LinqDesc = sDesc;
            csE.LinqEngunit = sEngunit;
            csE.LinqIsValid = int.Parse(sValid);
            csE.LinqNote = sNote;
            csE.LinqModifyTime = DateTime.Now.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss");

            if (KPI_LinqDal.Update(csE))
            {
                MessageBox.popupClientMessage(this.Page, "修改成功!", "call();");

                gvLinq.EditIndex = -1;
                BindGrid();
            }
            else
            {
                MessageBox.popupClientMessage(this.Page, "修改错误!", "call();");
            }
        }