public void OnBringToFront(object data) { resume = data as Resume; try { datagvAward.AutoGenerateColumns = false; datagvAward.DataSource = service.GetAwards(resume); if (datagvAward.DataSource == null) datagvAward.DataSource = new List<Award>(); activity = service.GetSchoolActivity(resume); txboxSchoolActivity.Text = activity == null ? "" : activity.Activity; scholarships = service.GetScholarships(resume); if (scholarships != null) { if (scholarships.Count >= 1) { cmboxType1.Text = scholarships[0].ScholarshipType; cmboxLevel1.Text = scholarships[0].ScholarshipLevel; } if (scholarships.Count >= 2) { cmboxType2.Visible = cmboxLevel2.Visible = linkDeleteSecond.Visible = true; cmboxType2.Text = scholarships[1].ScholarshipType; cmboxLevel2.Text = scholarships[1].ScholarshipLevel; } else { cmboxType2.Visible = cmboxLevel2.Visible = linkDeleteSecond.Visible = false; cmboxType2.Text = cmboxLevel2.Text = "请选择"; } if (scholarships.Count >= 3) { cmboxType3.Visible = cmboxLevel3.Visible = linkDeleteThird.Visible = true; cmboxType3.Text = scholarships[2].ScholarshipType; cmboxLevel3.Text = scholarships[2].ScholarshipLevel; } else { cmboxType3.Visible = cmboxLevel3.Visible = linkDeleteThird.Visible = false; cmboxType3.Text = cmboxLevel3.Text = "请选择"; } } else { cmboxType1.Text = cmboxLevel1.Text = "请选择"; cmboxType2.Text = cmboxLevel2.Text = "请选择"; cmboxType3.Text = cmboxLevel3.Text = "请选择"; cmboxLevel2.Visible = cmboxType2.Visible = false; cmboxLevel3.Visible = cmboxType3.Visible = false; } } catch (Exception ex) { MessageBox.Show("加载专业技能发生异常:" + ex.Message); } }
private void btnSaveAndNext_Click(object sender, EventArgs e) { try { if (!string.IsNullOrWhiteSpace(txboxSchoolActivity.Text)) { if (activity == null) activity = new SchoolActivity(null, resume.Id, txboxSchoolActivity.Text); service.AddOrUpdateSchoolActivity(activity); } List<Scholarship> lss = new List<Scholarship>(); if (cmboxType1.Text != "请选择" && cmboxLevel1.Text != "请选择") { lss.Add(new Scholarship(null, resume.Id, cmboxType1.Text, cmboxLevel1.Text)); } if (cmboxType2.Visible && cmboxType2.Text != "请选择" && cmboxLevel2.Text != "请选择") { lss.Add(new Scholarship(null, resume.Id, cmboxType2.Text, cmboxLevel2.Text)); } if (cmboxType3.Visible && cmboxType3.Text != "请选择" && cmboxLevel3.Text != "请选择") { lss.Add(new Scholarship(null, resume.Id, cmboxType3.Text, cmboxLevel3.Text)); } if (lss.Count != 0) { service.UpdateScholarships(resume, lss); } // NEXT PAGE (this.Owner as FormDetails).NextPage(); } catch (Exception ex) { } }