private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex >= 0) { FrmResumeInfo fri = new FrmResumeInfo(((this.dataGridView1.SelectedRows[0].DataBoundItem as DataRowView).Row as humanresourcesDataSet.resumeRow).Resume_id); fri.MdiParent = this.MdiParent; fri.Show(); } }
private void btnSave_Click(object sender, EventArgs e) { try { if (string.IsNullOrEmpty(this.txtCandidate_name.Text)) { throw new Exception("候选人姓名必须填写!"); } if (EditCandidate == null) { EditCandidate = this.humanresourcesDataSet1.candidate.NewcandidateRow(); EditCandidate.Candidate_name = this.txtCandidate_name.Text; } EditCandidate.Candidate_birthday = Convert.ToDateTime(this.dtpCandidate_birthday.Value.ToShortDateString()); EditCandidate.Candidate_Email = this.txtCandidate_Email.Text; EditCandidate.Candidate_marriage = this.cboCandidate_marriage.SelectedItem as string; EditCandidate.Candidate_method1 = this.txtCandidate_method1.Text; EditCandidate.Candidate_method2 = this.txtCandidate_method2.Text; EditCandidate.Candidate_papersN = this.txtCandidate_papersN.Text; EditCandidate.Candidate_papersT = this.cboCandidate_papersT.SelectedItem as string; EditCandidate.Candidate_sex = this.rbtnCandidate_sexM.Checked ? 1 : 0; EditCandidate.Candidate_telephone = this.txtCandidate_telephone.Text.Trim(); EditCandidate.Comment = this.txtComment.Text; EditCandidate.incumbency_mode = this.cboincumbency_mode.SelectedItem as string; EditCandidate.Mingz_id =this.cboMingz.SelectedValue==null?0: Convert.ToInt32(this.cboMingz.SelectedValue); EditCandidate.Nationality_id =this.cboNationality.SelectedValue == null?0: Convert.ToInt32(this.cboNationality.SelectedValue); EditCandidate.recommend_mode = "未推荐"; EditCandidate.registered = this.txtregistered.Text; EditCandidate.User_id =this.cboUser.SelectedValue==null?0: Convert.ToInt32(this.cboUser.SelectedValue); int newID = 0; if (EditCandidate.Candidate_id > 0) { newID = EditCandidate.Candidate_id; this.tableAdapterManager1.UpdateAll(this.humanresourcesDataSet1); } else { this.humanresourcesDataSet1.candidate.AddcandidateRow(EditCandidate); this.tableAdapterManager1.UpdateAll(this.humanresourcesDataSet1); newID = Convert.ToInt32(this.tableAdapterManager1.candidateTableAdapter.Adapter.InsertCommand.LastInsertedId); } if (newID > 0) { if (Editresume == null) { Editresume = this.humanresourcesDataSet1.resume.NewresumeRow(); } Editresume.Candidate_id = newID; Editresume.Resume_ShowName = this.txtCandidate_name.Text; Editresume.City_id = Convert.ToInt32(this.cboCity.SelectedValue); Editresume.City_id1 = Convert.ToInt32(this.cboCityWant.SelectedValue); Editresume.Experience = Convert.ToInt32(this.nudExperience.Value); Editresume.Resume_annual = this.nudResume_annual.Value; Editresume.Resume_expectation = this.nudResume_expectation.Value; Editresume.Resume_evaluate = this.txtResume_evaluate.Text; Editresume.Resume_language = this.cboResume_language.SelectedItem as string; Editresume.Resume_overseas = this.txtResume_overseas.Text; string JArr = ""; foreach (humanresourcesDataSet.jobsdetailRow item in tempJL) { JArr += item.JobsDetail_id+ ","; } Editresume.JobsDetail_idArr = JArr; string TArr = ""; foreach (humanresourcesDataSet.tradeRow item in tempTL) { TArr += item.Trade_id + ","; } Editresume.Trade_IDArr = TArr; Editresume.update_time = DateTime.Now; int rusumeId = 0; if (Editresume.Resume_id > 0) { rusumeId = Editresume.Resume_id; this.tableAdapterManager1.UpdateAll(this.humanresourcesDataSet1); } else { this.humanresourcesDataSet1.resume.AddresumeRow(Editresume); this.tableAdapterManager1.UpdateAll(this.humanresourcesDataSet1); rusumeId = Convert.ToInt32(this.tableAdapterManager1.resumeTableAdapter.Adapter.InsertCommand.LastInsertedId); } foreach (humanresourcesDataSet.educationRow item in this.humanresourcesDataSet1.education) { item.Resume_id = item.Resume_id == 0 ? rusumeId : item.Resume_id; } foreach (humanresourcesDataSet.work_experienceRow item in this.humanresourcesDataSet1.work_experience) { item.Resume_id = item.Resume_id == 0 ? rusumeId : item.Resume_id; } if (!string.IsNullOrEmpty(this.txtEvaluate_value.Text) && !string.IsNullOrEmpty(this.txtEvaluate_Comment.Text)) { this.humanresourcesDataSet1.evaluate.AddevaluateRow(this.txtEvaluate_value.Text,rusumeId,this.txtEvaluate_Comment.Text,EditCandidate.User_id); } this.tableAdapterManager1.UpdateAll(this.humanresourcesDataSet1); MessageBox.Show("保存成功!"); FrmResumeInfo fri = new FrmResumeInfo(rusumeId); fri.MdiParent = this.MdiParent; fri.Show(); this.Close(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }