/// <summary> /// 修改 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnEnter_Click(object sender, EventArgs e) { Song.Entities.TeacherHistory th = id == 0 ? new Song.Entities.TeacherHistory() : Business.Do <ITeacher>().HistorySingle(id); th = this.EntityFill(th) as Song.Entities.TeacherHistory; //如果没有填写结整时间,则为最大值 if (Thh_EndTime.Text.Trim() == "") { th.Thh_EndTime = DateTime.MaxValue; } //所属教师 Song.Entities.Teacher curth = Extend.LoginState.Accounts.Teacher; th.Th_ID = curth.Th_ID; th.Th_Name = curth.Th_Name; try { if (id < 1) { Business.Do <ITeacher>().HistoryAdd(th); } else { Business.Do <ITeacher>().HistorySave(th); } Master.AlertCloseAndRefresh("操作成功!"); } catch (Exception ex) { Master.Alert(ex.Message); } }
private void fill() { Song.Entities.TeacherHistory th = id == 0 ? new Song.Entities.TeacherHistory() : Business.Do <ITeacher>().HistorySingle(id); if (th == null) { return; } this.EntityBind(th); if (th.Thh_EndTime > DateTime.Now.AddYears(100)) { Thh_EndTime.Text = ""; } }