protected void Add()
        {
            if (!noteReciver.Exist(txtName.Text.Trim()))
            {
                Model.TN_NoteReciver reciver = new Model.TN_NoteReciver();

                reciver.CoalCode = ddlCoal.SelectedValue;
                reciver.CoalName = ddlCoal.SelectedItem.Text;
                reciver.Department = txtDepartment.Text;
                reciver.Describe = txtDescribe.Text;
                reciver.Duty = txtDuty.Text;
                reciver.Name = txtName.Text;
                reciver.PhoneNo = txtPhoneNo.Text;

                int retVal = noteReciver.Add(reciver);
                if (retVal == 1)
                {
                    MessageBox.Show(this.Page, "添加成功!");
                    ClearText();
                }
                else
                {
                    MessageBox.Show(this.Page, "添加失败!");
                }
            }
            else
            {
                MessageBox.Show(this.Page,"该接收人姓名已经在系统中存在!");
            }
        }
        protected void Update()
        {
            if (!noteReciver.Exist(Id, txtName.Text.Trim()))
            {
                Model.TN_NoteReciver reciver = new Model.TN_NoteReciver();

                reciver.CoalCode = ddlCoal.SelectedValue;
                reciver.CoalName = ddlCoal.SelectedItem.Text;
                reciver.Department = txtDepartment.Text;
                reciver.Describe = txtDescribe.Text;
                reciver.Duty = txtDuty.Text;
                reciver.Name = txtName.Text;
                reciver.PhoneNo = txtPhoneNo.Text;
                reciver.Id = Id;

                if (noteReciver.Update(reciver) == 1)
                {
                    ClientScript.RegisterStartupScript(Page.GetType(), "", "alert('修改成功!');this.top.currForm.close();", true);
                }
                else
                {
                    MessageBox.Show(this.Page, "修改失败!");
                }
            }
            else
            {
                MessageBox.Show(this.Page,"该接收人姓名已经在系统中存在!");
            }
        }
        /// <summary>
        /// 获取特定的Model
        /// </summary>
        /// <param name="id">主键</param>
        /// <returns>Model</returns>
        public TDTK.IndustryPlatform.SafetyMonitor.Model.TN_NoteReciver GetModel(int id)
        {
            StringBuilder sb = new StringBuilder();
            sb.AppendFormat("select * from TN_NoteReciver where Id={0}",id);
            DataSet dst = dal.GetDataSet(sb.ToString());

            if (dst != null)
            {
                Model.TN_NoteReciver reciver = new Model.TN_NoteReciver();

                reciver.Id = Convert.ToInt32(dst.Tables[0].Rows[0]["Id"]);
                reciver.CoalCode = dst.Tables[0].Rows[0]["CoalCode"].ToString();
                reciver.CoalName = dst.Tables[0].Rows[0]["CoalName"].ToString();
                reciver.Department = dst.Tables[0].Rows[0]["Department"].ToString();
                reciver.Describe = dst.Tables[0].Rows[0]["Describe"].ToString();
                reciver.Duty = dst.Tables[0].Rows[0]["Duty"].ToString();
                reciver.Name = dst.Tables[0].Rows[0]["Name"].ToString();
                reciver.PhoneNo = dst.Tables[0].Rows[0]["PhoneNo"].ToString();

                return reciver;
            }
            else
            {
                return null;
            }
        }