Former-commit-id: 25c42c6c03dd802f050475a834aa463467dea694
Former-commit-id: 3e3f5d1ffa21a33cebc21bd811c9f87475c4e893
1.0
wanggang 5 years ago
parent 3dc4fd2288
commit a0c5da3f1f

@ -2,6 +2,7 @@
using Infrastructure.Data;
using Infrastructure.Extensions;
using Infrastructure.Web.Mvc;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.EntityFrameworkCore;
@ -26,6 +27,15 @@ namespace TeacherExt.Controllers
this._teacherRepo = teacherRepo;
}
public override IActionResult Add(EditTeacherModel model)
{
var teacher = new Teacher();
teacher.From(model);
this._teacherRepo.Add(teacher);
this._teacherRepo.SaveChanges();
return RedirectToAction();
}
public override void OnActionExecuting(ActionExecutingContext context)
{
}

@ -6,6 +6,10 @@ namespace TeacherExt.Entities
{
public class Teacher : EntityBase<Guid>
{
public Teacher()
{
this.Id = Guid.NewGuid();
}
public TeacherInfo Info { get; set; }
public TeacherProp Prop { get; set; }
@ -25,7 +29,7 @@ namespace TeacherExt.Entities
public string Sex { get; set; }
[Required]
public DateTime Birthday { get; set; }
public DateTime? Birthday { get; set; }
[Required]
public string Nation { get; set; }
@ -40,13 +44,13 @@ namespace TeacherExt.Entities
public string IdNumber { get; set; }
//[Required]
public DateTime JobStart { get; set; }
public DateTime? JobStart { get; set; }
//[Required]
public DateTime TeachDate { get; set; }
public DateTime? TeachDate { get; set; }
[Required]
public DateTime CurrentJobStart { get; set; }
public DateTime? CurrentJobStart { get; set; }
public bool CurrentJobStartChecked { get; set; }
@ -54,7 +58,7 @@ namespace TeacherExt.Entities
public string Politics { get; set; }
//[Required]
public DateTime JoinPartyDate { get; set; }
public DateTime? JoinPartyDate { get; set; }
[Required]
public string MaxTitle { get; set; }
@ -62,13 +66,13 @@ namespace TeacherExt.Entities
public bool MaxTitleChecked { get; set; }
[Required]
public DateTime MaxTitleStart { get; set; }
public DateTime? MaxTitleStart { get; set; }
public bool MaxTitleStartChecked { get; set; }
public bool IsJobAsMaxTitle { get; set; }
public DateTime JobAsMaxTitleDate { get; set; }
public DateTime? JobAsMaxTitleDate { get; set; }
public bool JobAsMaxTitleDateChecked { get; set; }
@ -80,11 +84,11 @@ namespace TeacherExt.Entities
public bool NotMaxTitleChecked { get; set; }
public DateTime NotMaxTitleStart { get; set; }
public DateTime? NotMaxTitleStart { get; set; }
public bool NotMaxTitleStartChecked { get; set; }
public DateTime JobAsNotMaxTitleDate { get; set; }
public DateTime? JobAsNotMaxTitleDate { get; set; }
public bool JobAsNotMaxTitleDateChecked { get; set; }
@ -97,17 +101,15 @@ namespace TeacherExt.Entities
public bool PostGradeChecked { get; set; }
[Required]
public DateTime CurrentPostGradeStart { get; set; }
public DateTime? CurrentPostGradeStart { get; set; }
public bool CurrentPostGradeStartChecked { get; set; }
[Required]
public string EducationGrade { get; set; }
public bool EducationGradeChecked { get; set; }
[Required]
public DateTime EducationGradeDate { get; set; }
public DateTime? EducationGradeDate { get; set; }
public bool EducationGradeDateChecked { get; set; }
@ -124,7 +126,7 @@ namespace TeacherExt.Entities
public string FullTimeSchoolEducation { get; set; }
[Required]
public string JobTimeSchoolEducationDate { get; set; }
public DateTime? JobTimeSchoolEducationDate { get; set; }
[Required]
public string JobTimeSchoolType { get; set; }
@ -139,7 +141,7 @@ namespace TeacherExt.Entities
public string JobTimeSchoolEducation { get; set; }
[Required]
public string FullTimeSchoolEducationDate { get; set; }
public DateTime? FullTimeSchoolEducationDate { get; set; }
[Required]
public string MaxEducation { get; set; }
@ -166,12 +168,10 @@ namespace TeacherExt.Entities
public bool MainTeachGradeChecked { get; set; }
[Required]
public string OtherTeachPeriod { get; set; }
public bool OtherTeachPeriodChecked { get; set; }
[Required]
public string OtherTeachSubject { get; set; }
public bool OtherTeachSubjectChecked { get; set; }
@ -184,7 +184,7 @@ namespace TeacherExt.Entities
public bool PositionChecked { get; set; }
public DateTime PositionStart { get; set; }
public DateTime? PositionStart { get; set; }
public bool PositionStartChecked { get; set; }
@ -194,7 +194,7 @@ namespace TeacherExt.Entities
public bool NotOnPostReasonChecked { get; set; }
public DateTime NotOnPostReasonDate { get; set; }
public DateTime? NotOnPostReasonDate { get; set; }
public bool NotOnPostReasonDateChecked { get; set; }

@ -11,17 +11,16 @@ namespace TeacherExt.Models
[Display(Name = "教师")]
public class EditTeacherModel
{
[SkipSearch,SkipList]
[SkipSearch, SkipList]
[HiddenInput]
[ReadOnly(true)]
public Guid Id { get; set; }
public Guid Id { get; set; } = Guid.NewGuid();
[SelectList]
[HiddenInput]
[ReadOnly(true)]
[Required(ErrorMessage = "必填项")]
[Display(Order = 0, Name = "审核状态")]
public string CheckStatus { get; set; }
public string CheckStatus { get; set; } = "未提交";
[Description("是否使用已有字段:所属单位/学校")]
[ReadOnly(true)]
@ -142,10 +141,8 @@ namespace TeacherExt.Models
[Display(Order = 150, Name = "政治面貌")]
public string Politics { get; set; }
[Description("是否必填")]
[SkipSearch, SkipList]
[DataType(DataType.Date)]
[Required(ErrorMessage = "必填项")]
[Display(Order = 160, Name = "入党(派)时间")]
public DateTime? JoinPartyDate { get; set; }
@ -203,7 +200,6 @@ namespace TeacherExt.Models
[HtmlData("JobAsMaxTitle2")]
[SkipSearch, SkipList]
[SelectList]
[Required(ErrorMessage = "必填项")]
[Header("最高职称聘任时间-未聘-现聘任职称")]
[Display(Order = 210, Name = "现聘任职称")]
public string NotMaxTitle { get; set; }
@ -268,7 +264,6 @@ namespace TeacherExt.Models
[SkipSearch, SkipList]
[SelectList]
[Required(ErrorMessage = "必填项")]
[Display(Order = 270, Name = "享受学历待遇等级")]
public string EducationGrade { get; set; }
@ -411,7 +406,6 @@ namespace TeacherExt.Models
[SkipSearch, SkipList]
[SelectList]
[Required(ErrorMessage = "必填项")]
[Display(Order = 450, Name = "兼职任教学段")]
public string OtherTeachPeriod { get; set; }
@ -422,7 +416,6 @@ namespace TeacherExt.Models
[Description("选择项中没有则手动填写")]
[SkipSearch, SkipList]
[SelectList]
[Required(ErrorMessage = "必填项")]
[Display(Order = 460, Name = "兼职任教学科")]
public string OtherTeachSubject { get; set; }
@ -432,6 +425,7 @@ namespace TeacherExt.Models
[SkipSearch, SkipList]
[SelectList]
[Required(ErrorMessage = "必填项")]
[Display(Order = 463, Name = "在编在岗")]
public bool? HasPosition { get; set; }

@ -19,6 +19,7 @@
<ItemGroup>
<PackageReference Include="NJsonSchema" Version="10.3.2" />
<PackageReference Include="NPOI" Version="2.5.2" />
<PackageReference Include="UoN.ExpressiveAnnotations.NetCore" Version="1.0.0" />
</ItemGroup>
<ItemGroup>

Loading…
Cancel
Save