/// <summary> /// 创建新的介绍信 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnCreatLetter_Click(object sender, EventArgs e) { if (!flagCreating) { FormCoverLetterAdd formcoverletterAdd = new FormCoverLetterAdd(); formcoverletterAdd.StartPosition = FormStartPosition.CenterScreen; formcoverletterAdd.AutoSize = false; formcoverletterAdd.Owner = this; formcoverletterAdd.setResume = this.resume; // formcoverletterAdd.Visible = true; formcoverletterAdd.ShowDialog(); } else return; }
/// <summary> /// 操作数据列表 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void dgvCoverLetterList_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex < 0) return; if (dgvCoverLetterList.Columns[e.ColumnIndex].Name == "Modify") { List<CoverLetter> clList = dgvCoverLetterList.DataSource as List<CoverLetter>; coverletter = clList[e.RowIndex]; FormCoverLetterAdd fclAdd = new FormCoverLetterAdd(); fclAdd.setCoverLetter = coverletter; fclAdd.Text = "修改求职信..."; //this.flagCreating = true; fclAdd.ShowDialog(); } if (dgvCoverLetterList.Columns[e.ColumnIndex].Name == "Delete") { List<CoverLetter> temp =dgvCoverLetterList.DataSource as List<CoverLetter>; CoverLetter cl = GetCoverLetterFromDgv(e.RowIndex); DialogResult result = MessageBox.Show("确定要删除该项?删除后不可恢复", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (result == DialogResult.Yes) { coverletterservice = new CoverLetterService(); try { coverletterservice.Delete(cl); } catch (Exception ex) { MessageBox.Show("删除记录出错" + ex.Message); } dgvCoverLetterList.DataSource = null; temp.Remove(cl); dgvCoverLetterList.DataSource = temp; } } }