protected void btnSave_Click(object sender, EventArgs e)
        {
            CheckBox chkSelected;
            Literal lblRealID;
            SATagMapEntity SATagMap;

            using (SATagMapDataAccess DataAccess = new SATagMapDataAccess()) {
                DataAccess.DeleteSATagMap(SAID);
                RepeaterItemCollection Items = TagRepeater.Items;
                foreach (RepeaterItem Item in Items) {
                    lblRealID = (Literal)Item.FindControl("lblRealID");
                    chkSelected = (CheckBox)Item.FindControl("chkSelected");
                    if (chkSelected.Checked) {
                        SATagMap = new SATagMapEntity {
                            SAID = SAID,
                            RealID = lblRealID.Text
                        };
                        DataAccess.SaveSATagMap(SATagMap);
                    }
                }
            }
            ScriptManager.RegisterClientScriptBlock(this, GetType(), "Msg", "alert('数据保存成功!')", true);
        }
 /// <summary>
 /// 保存安全指标与测点对应关系表数据
 /// </summary>
 /// <param name="KPI_SATagMap">安全指标与测点对应关系表实体</param>        
 /// <returns>成功保存的行数</returns>
 public int SaveSATagMap(SATagMapEntity SATagMap)
 {
     if (Exists(SATagMap)) return 0;
     return AddSATagMap(SATagMap);
 }
 /// <summary>
 /// 新增安全指标与测点对应关系表数据
 /// </summary>
 /// <param name="SATagMap">安全指标与测点对应关系表实体</param>        
 /// <returns>新增的数据行数</returns>
 private int AddSATagMap(SATagMapEntity SATagMap)
 {
     int Result = 0;
     string SqlText = @"Insert KPI_SATagMap (SAID,RealID) Values (@SAID,@RealID) ";
     SqlParameter[] parames = new SqlParameter[] {
         new SqlParameter("@SAID",SqlDbType.VarChar),
         new SqlParameter("@RealID",SqlDbType.VarChar)};
     parames[0].Value = SATagMap.SAID;
     parames[1].Value = SATagMap.RealID;
     Result = m_DB.ExecuteNonQuery(SqlText, parames);
     return Result;
 }
 /// <summary>
 /// 判断安全指标与测点对应关系表数据是否存在
 /// </summary>
 /// <param name="SATagMap">安全指标与测点对应关系表实体</param>        
 /// <returns>数据存在则返回true否则返回false</returns>
 private bool Exists(SATagMapEntity SATagMap)
 {
     string SqlText = "SELECT SAID FROM  KPI_SATagMap WHERE SAID=@SAID AND RealID=@RealID ";
     SqlParameter[] parames = new SqlParameter[] {
         new SqlParameter("@SAID",SqlDbType.VarChar),
         new SqlParameter("@RealID",SqlDbType.VarChar)};
     parames[0].Value = SATagMap.SAID;
     parames[1].Value = SATagMap.RealID;
     return m_DB.ExecuteScalar(SqlText, parames)!= null;
 }