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

            for (int i = 0; i < gvTable.Rows.Count; i++)
            {
                Race_TagEntity csE = new Race_TagEntity();
                csE.TagID = gvTable.Rows[i]["TagID"].ToString();
                csE.TagIndex = i + 1;

                Race_TagDal.Update(csE);
            }

            MessageBox.popupClientMessage(this.Page, "排序成功!", "call();");
        }
        protected bool ImportFromExcelToModify(DataSet ds)
        {
            //需要导入到机组ID
            string UnitID = ddlExcelUnitID.Value;
            //string PlantID = ddlExcelPlantID.Value;

            //if (UnitID == "NON")
            //{
            //    UnitID = "";
            //}

            //////////////////////////////////////////////////////
            try
            {
                System.Data.DataTable dt = ds.Tables[0];

                int nAll = dt.Rows.Count;
                int nModify = 0;
                int nNoExist = 0;

                foreach (System.Data.DataRow dr in dt.Rows)
                {
                    if (dr["SelectX"].ToString().ToLower() == "x")
                    {
                        string TagName = dr["TagName"].ToString().Trim();
                        //判断是否存在
                        if (!Race_TagDal.TagNameExist(TagName))
                        {
                            nNoExist += 1;

                            continue;
                        }

                        //main tag
                        string keyid = Race_TagDal.GetTagID(TagName, UnitID);

                        Race_TagEntity mEntity = new Race_TagEntity();

                        mEntity.TagID = keyid;
                        mEntity.UnitID = UnitID;
                        mEntity.TagName = TagName;
                        mEntity.TagDesc = dr["TagDesc"].ToString().Trim();
                        mEntity.TagType = dr["TagType"].ToString().Trim();
                        mEntity.TagEngunit = dr["TagEngunit"].ToString().Trim();

                        string sv = dr["TagIsValid"].ToString().Trim();
                        if (sv != "")
                        {
                            mEntity.TagIsValid = int.Parse(sv);
                        }
                        
                        sv = dr["TagIndex"].ToString().Trim();
                        if (sv != "")
                        {
                            mEntity.TagIndex = int.Parse(sv);
                        }

                        mEntity.TagFilterExp = dr["TagFilterExp"].ToString().Trim();//.Replace("'", "''");
                        mEntity.TagCalcExp = dr["TagCalcExp"].ToString().Trim();//.Replace("'", "''");

                        sv = dr["TagCalcExpType"].ToString().Trim();
                        if (sv != "")
                        {
                            mEntity.TagCalcExpType = int.Parse(sv);
                        }

                        sv = dr["TagCalcType"].ToString().Trim();
                        if (sv != "")
                        {
                            mEntity.TagCalcType = int.Parse(sv);
                        }

                        sv = dr["TagFactor"].ToString().Trim();
                        if (sv != "")
                        {
							mEntity.TagFactor = decimal.Parse(sv);
                        }

                        sv = dr["TagOffset"].ToString().Trim();
                        if (sv != "")
                        {
							mEntity.TagOffset = decimal.Parse(sv);
                        }


                        Race_TagDal.Update(mEntity);

                        nModify += 1;

                    }


                }

                string strInfor = "标签点总数为:{0}个, 编辑成功:{1}个,不存在标签点: {2}个。";
                strInfor = string.Format(strInfor, nAll, nModify, nNoExist);

                MessageBox.popupClientMessage(this.Page, strInfor, "call();");

                return true;

            }
            catch (Exception ee)
            {
                //
                MessageBox.popupClientMessage(this.Page, ee.Message, "call();");

                return false;
            }
        }