/// <summary> /// 初始化窗体信息 /// </summary> private void initForm() { if (this.hidAddNumberID.Value != "") { this.lstGuideID.Enabled = false; AddNumberMgr aMgr = new AddNumberMgr(); AddNumber addNumber = aMgr.GetAddNumber(this.hidAddNumberID.Value); if (addNumber.AddNumberID != 0) { this.lblPersonName.Text = addNumber.Person.PersonName; this.lstGuideID.ClearSelection(); if (this.lstGuideID.Items.FindByValue(addNumber.Guide.GuideID.ToString()) != null) { this.lstGuideID.Items.FindByValue(addNumber.Guide.GuideID.ToString()).Selected = true; } this.txtTitle.Text = addNumber.Title; this.txtContent.Text = addNumber.Content; if (addNumber.IsAudi == "是") { this.chkIsAudi.Checked = true; this.txtAddInt.Text = addNumber.AddInt.ToString(); this.btnOK.Enabled = false; } } else { this.btnOK.Enabled = false; this.SendMessage("没有找到该信息"); } } }
protected void btnOK_Click(object sender, EventArgs e) { AddNumberMgr sMgr = new AddNumberMgr(); AddNumber addNumber = sMgr.GetAddNumber(this.hidAddNumberID.Value); int AddInt = 0; if (this.chkIsAudi.Checked) { if (this.txtAddInt.Text.Trim() == "") { this.SendMessage("通过审核必须填写增加的分数"); } else if (!int.TryParse(this.txtAddInt.Text.Trim(), out AddInt)) { this.SendMessage("增加的分数必须为一个整数"); } else { addNumber.IsAudi = "是"; addNumber.AddInt = AddInt; sMgr.UpdateAddNumber(addNumber); AssesMgr mgr = new AssesMgr(); Asses asses = new Asses(); asses.Guide.GuideID = addNumber.Guide.GuideID; switch (asses.Guide.GuideID) { case 1: asses.Guide2.Guide2ID = 4; break; case 2: asses.Guide2.Guide2ID = 9; break; case 3: asses.Guide2.Guide2ID = 14; break; } asses.Memo = ""; asses.Person.PersonID = addNumber.Person.PersonID; asses.Scale1 = addNumber.AddInt; mgr.UpdateAsses(asses); this.btnOK.Enabled = false; } } else { addNumber.IsAudi = "否"; addNumber.AddInt = 0; sMgr.UpdateAddNumber(addNumber); } this.SendMessage("信息编辑成功"); }