private bool Save()
 {
     if (string.IsNullOrWhiteSpace(txboxPracticeName.Text)) { MessageBox.Show("请填写实践经验名称"); return false; }
     // if (rtxboxPracticeDesc.Text == "") { MessageBox.Show("请填写使用时间"); return false; }
     List<SocialPractice> sps = datagvPratices.DataSource as List<SocialPractice>;
     try
     {
         if (curpractice == null)
         {
             curpractice = new SocialPractice(
                     null,
                     resume.Id,
                     txboxPracticeName.Text,
                     datetpStartDate.Value,
                     datetpEndDate.Value,
                     txboxPracticeDesc.Text,
                     sps.Count + 1);
             sps.Add(curpractice);
             datagvPratices.DataSource = null;
             datagvPratices.DataSource = sps;
             datagvPratices.Refresh();
         }
         else
         {
             curpractice.PracticeName = txboxPracticeName.Text;
             curpractice.PracticeDesc = txboxPracticeDesc.Text;
             curpractice.PracticeStartDate = datetpStartDate.Value;
             curpractice.PracticeEndDate = datetpEndDate.Value;
         }
         service.AddOrUpdate(curpractice);
         return true;
     }
     catch (Exception ex)
     {
         MessageBox.Show("保存专业技能时出错:" + ex.Message);
         return false;
     }
 }
 private void datagvPratices_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {
     if (datagvPratices.Columns[e.ColumnIndex].HeaderText == "删除")
     {
         List<SocialPractice> sps = datagvPratices.DataSource as List<SocialPractice>;
         SocialPractice sp = GetSocialPracticeFromDgv(e.RowIndex);
         if (MessageBox.Show("将直接删除数据信息且不可恢复,确定删除?", "删除", MessageBoxButtons.YesNo)
                 == DialogResult.Yes)
         {
             try
             {
                 service.Delete(sp);
             }
             catch (Exception ex)
             {
                 MessageBox.Show("删除记录时出错" + ex.Message);
             }
             datagvPratices.DataSource = null;
             sps.Remove(sp);
             datagvPratices.DataSource = sps;
         }
         return;
     }
     if (datagvPratices.Columns[e.ColumnIndex].HeaderText == "编辑")
     {
         List<SocialPractice> sps = datagvPratices.DataSource as List<SocialPractice>;
         curpractice = sps[e.RowIndex];
         txboxPracticeName.Text = curpractice.PracticeName;
         txboxPracticeDesc.Text = curpractice.PracticeDesc;
         datetpStartDate.Value = curpractice.PracticeStartDate == null ? DateTime.Now : curpractice.PracticeStartDate.Value;
         datetpEndDate.Value = curpractice.PracticeEndDate == null ? DateTime.Now : curpractice.PracticeEndDate.Value;
         return;
     }
 }
 private void ResetControlContent()
 {
     txboxPracticeName.Text = "";
     txboxPracticeDesc.Text = "";
     curpractice = null;
 }