spDbContext.cs 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574
  1. using Microsoft.EntityFrameworkCore;
  2. using Microsoft.Extensions.Configuration;
  3. using System.Collections.Generic;
  4. using System.Configuration;
  5. using System.Data;
  6. using wispro.sp.entity;
  7. namespace wispro.sp.api
  8. {
  9. public partial class spDbContext : DbContext
  10. {
  11. public spDbContext()
  12. {
  13. }
  14. public spDbContext(DbContextOptions<spDbContext> options)
  15. : base(options)
  16. {
  17. }
  18. public virtual DbSet<CalMonth> CalMonths { get; set; }
  19. public virtual DbSet<Customer> Customers { get; set; }
  20. public virtual DbSet<ItemStaff> ItemStaffs { get; set; }
  21. public virtual DbSet<PerformanceItem> PerformanceItems { get; set; }
  22. public virtual DbSet<StaffGrade> StaffGrades { get; set; }
  23. public virtual DbSet<VerifyCoefficient> VerifyCoefficients { get; set; }
  24. public virtual DbSet<Staff> Staffs { get; set; }
  25. public virtual DbSet<Message> Messages { get; set; }
  26. public virtual DbSet<MessageReadRecord> MessageReadRecords { get;set;}
  27. public virtual DbSet<MessagePerformanceItem> MessagePerformanceItems { get; set; }
  28. public virtual DbSet<AttachFile> AttachFiles { get; set; }
  29. public virtual DbSet<BasePointRule> BasePointRules { get; set; }
  30. public virtual DbSet<InputField> InputFields { get; set; }
  31. public virtual DbSet<InputFieldValue> InputFieldValues { get; set; }
  32. public virtual DbSet<AppealType> AppealTypes { get; set; }
  33. public virtual DbSet<AppealRecord> AppealRecords { get; set; }
  34. public virtual DbSet<SelectValue> SelectValues { get; set; }
  35. protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
  36. {
  37. if (!optionsBuilder.IsConfigured)
  38. {
  39. optionsBuilder.UseSqlServer(utility.ConfigHelper.GetSectionValue("ConnectionStrings:DefaultConnect"));// "Data Source=(local);Initial Catalog=spDB;User ID=sa;Password=Lqftiu807005");// Configuration.GetConnectionString("DefaultConnect"));
  40. //ConfigurationManager.AppSettings["ValidAudience"]
  41. }
  42. }
  43. protected override void OnModelCreating(ModelBuilder modelBuilder)
  44. {
  45. modelBuilder.Entity<BasePointRule>(entity=> {
  46. entity.ToTable("BasePointRule");
  47. entity.Property(e => e.PointExpress).HasMaxLength(100);
  48. entity.Property(e => e.Rule).HasMaxLength(1000);
  49. entity.Property(e => e.Type).HasMaxLength(20);
  50. });
  51. modelBuilder.Entity<CalMonth>(entity =>
  52. {
  53. entity.ToTable("CalMonth");
  54. entity.Property(e => e.Year).HasColumnName("year");
  55. entity.Property(e => e.Month).HasColumnName("month");
  56. entity.Property(e => e.Status).HasColumnName("status");
  57. }
  58. ) ;
  59. modelBuilder.Entity<Customer>(entity =>
  60. {
  61. entity.ToTable("Customer");
  62. entity.Property(e => e.Address).HasMaxLength(500);
  63. entity.Property(e => e.ContactMan).HasMaxLength(50);
  64. entity.Property(e => e.Name)
  65. .IsRequired()
  66. .HasMaxLength(200);
  67. entity.Property(e => e.Phone).HasMaxLength(50);
  68. entity.HasOne(d => d.ResponseMan)
  69. .WithMany(p => p.Customers)
  70. .HasForeignKey(d => d.ResponseManId)
  71. .HasConstraintName("FK_Customer_Staff");
  72. });
  73. modelBuilder.Entity<ItemStaff>(entity =>
  74. {
  75. entity.HasKey(e => new { e.ItemId, e.DoPersonId });
  76. entity.ToTable("ItemStaff");
  77. entity.Property(e => e.PerformancePoint);//.HasColumnType("numeric(18, 2)");
  78. entity.HasOne(d => d.DoPerson)
  79. .WithMany(p => p.ItemStaffs)
  80. .HasForeignKey(d => d.DoPersonId)
  81. .OnDelete(DeleteBehavior.ClientSetNull)
  82. .HasConstraintName("FK_ItemStaff_Staff");
  83. entity.HasOne(d => d.Item)
  84. .WithMany(p => p.ItemStaffs)
  85. .HasForeignKey(d => d.ItemId)
  86. .OnDelete(DeleteBehavior.ClientSetNull)
  87. .HasConstraintName("FK_ItemStaff_PerformanceItem");
  88. });
  89. modelBuilder.Entity<PerformanceItem>(entity =>
  90. {
  91. entity.ToTable("PerformanceItem");
  92. entity.Property(e => e.ApplicationName).HasMaxLength(200);
  93. entity.Property(e => e.ApplicationType).HasMaxLength(50);
  94. entity.Property(e => e.BasePoint).HasColumnType("numeric(18, 2)");
  95. entity.Property(e => e.BusinessType).HasMaxLength(50);
  96. entity.Property(e => e.CaseCoefficient).HasMaxLength(10);
  97. entity.Property(e => e.CaseName).HasMaxLength(500);
  98. entity.Property(e => e.CaseNo).HasMaxLength(50);
  99. entity.Property(e => e.CaseStage).HasMaxLength(50);
  100. entity.Property(e => e.CaseState).HasMaxLength(50);
  101. entity.Property(e => e.CaseType).HasMaxLength(50);
  102. entity.Property(e => e.EntrustingDate).HasColumnType("date");
  103. entity.Property(e => e.CustomerLimitDate).HasColumnType("date");
  104. entity.Property(e => e.DoItem).HasMaxLength(50);
  105. entity.Property(e => e.DoItemCoefficient).HasMaxLength(50);
  106. entity.Property(e => e.DoItemMemo).HasMaxLength(500);
  107. entity.Property(e => e.DoItemState).HasMaxLength(50);
  108. entity.Property(e => e.FinalizationDate).HasColumnType("date");
  109. entity.Property(e => e.FinishedDate).HasColumnType("date");
  110. entity.Property(e => e.FirstDraftDate).HasColumnType("date");
  111. entity.Property(e => e.InternalDate).HasColumnType("date");
  112. entity.Property(e => e.OverDueMemo).HasMaxLength(100);
  113. entity.Property(e => e.PreOastaffId).HasColumnName("PreOAStaffId");
  114. entity.Property(e => e.ReturnDate).HasColumnType("date");
  115. entity.HasOne(d => d.Customer)
  116. .WithMany(p => p.PerformanceItems)
  117. .HasForeignKey(d => d.CustomerId)
  118. .HasConstraintName("FK_PerformanceItem_Customer");
  119. entity.HasOne(d => d.PreOastaff)
  120. .WithMany()
  121. .HasForeignKey(d => d.PreOastaffId)
  122. .HasConstraintName("FK_PerformanceItem_Staff");
  123. entity.HasOne(d => d.Reviewer)
  124. .WithMany(p => p.ReviewerItems)
  125. .HasForeignKey(d => d.ReviewerId)
  126. .HasConstraintName("FK_PerformanceItem_Reviewer");
  127. entity.HasOne(d => d.CalMonth)
  128. .WithMany(p => p.PerformanceItems)
  129. .HasForeignKey(d => d.CalMonthId)
  130. .HasConstraintName("FK_PerformanceItem_CalMonth");
  131. });
  132. modelBuilder.Entity<StaffGrade>(entity =>
  133. {
  134. entity.ToTable("StaffGrade");
  135. entity.Property(e => e.Coefficient);//.HasColumnType("numeric(18, 2)");
  136. entity.Property(e => e.Grade)
  137. .IsRequired()
  138. .HasMaxLength(5)
  139. .IsFixedLength(true);
  140. });
  141. modelBuilder.Entity<VerifyCoefficient>(entity =>
  142. {
  143. entity.HasKey(e => new { e.CheckerId, e.DoPersonId });
  144. entity.ToTable("VerifyCoefficient");
  145. entity.Property(e => e.Coefficient);//.HasColumnType("numeric(18, 2)");
  146. entity.HasOne(d => d.Checker)
  147. .WithMany(p => p.VerifyCoefficientCheckers)
  148. .HasForeignKey(d => d.CheckerId)
  149. .OnDelete(DeleteBehavior.ClientSetNull)
  150. .HasConstraintName("FK_VerifyCoefficient_StaffGrade");
  151. entity.HasOne(d => d.DoPerson)
  152. .WithMany(p => p.VerifyCoefficientDoPeople)
  153. .HasForeignKey(d => d.DoPersonId)
  154. .OnDelete(DeleteBehavior.ClientSetNull)
  155. .HasConstraintName("FK_VerifyCoefficient_StaffGrade1");
  156. });
  157. modelBuilder.Entity<Staff>(entity =>
  158. {
  159. entity.ToTable("Staff");
  160. //entity.Property(e => e.Id).ValueGeneratedNever();
  161. entity.Property(e => e.Account)
  162. .IsRequired()
  163. .HasMaxLength(50);
  164. entity.Property(e => e.Department).HasMaxLength(50);
  165. entity.Property(e => e.EntyDate).HasColumnType("date");
  166. entity.Property(e => e.IsCalPerformsnce).HasColumnName("isCalPerformsnce");
  167. entity.Property(e => e.Name)
  168. .IsRequired()
  169. .HasMaxLength(50);
  170. entity.Property(e => e.Password).IsRequired();
  171. entity.Property(e => e.Status)
  172. .IsRequired()
  173. .HasMaxLength(25);
  174. entity.Property(e => e.WorkPlace).HasMaxLength(50);
  175. entity.HasOne(d => d.StaffGrade)
  176. .WithMany(p => p.Staff)
  177. .HasForeignKey(d => d.StaffGradeId)
  178. .OnDelete(DeleteBehavior.ClientSetNull)
  179. .HasConstraintName("FK_Staff_StaffGrade");
  180. });
  181. modelBuilder.Entity<Message>(entity =>
  182. {
  183. //entity.HasKey(e => e.Id);
  184. entity.ToTable("Message");
  185. entity.Property(e => e.Type);
  186. entity.Property(e => e.MessageInfo).HasMaxLength(500);
  187. entity.HasOne(d => d.From)
  188. .WithMany()
  189. .HasForeignKey(d => d.FromId)
  190. .OnDelete(DeleteBehavior.ClientSetNull)
  191. .HasConstraintName("FK_From_Staff");
  192. });
  193. modelBuilder.Entity<MessageReadRecord>(entity =>
  194. {
  195. entity.HasKey(e => new { e.MessageId,e.StaffId});
  196. entity.ToTable("MessageReadRecord");
  197. entity.Property(e => e.isReaded);
  198. entity.HasOne(d => d.Staff)
  199. .WithMany()
  200. .HasForeignKey(d => d.StaffId)
  201. .OnDelete(DeleteBehavior.ClientSetNull)
  202. .HasConstraintName("FK_MessageReadRecord_Staff");
  203. entity.HasOne(d => d.Message)
  204. .WithMany()
  205. .HasForeignKey(d => d.MessageId)
  206. .OnDelete(DeleteBehavior.ClientSetNull)
  207. .HasConstraintName("FK_MessageReadRecord_Message");
  208. });
  209. modelBuilder.Entity<MessagePerformanceItem>( entity =>
  210. {
  211. entity.HasKey(e=> new { e.ItemId,e.MessageId});
  212. entity.HasOne(d => d.Message)
  213. .WithMany(m => m.RelatedItem)
  214. .HasForeignKey(d => d.MessageId)
  215. .HasConstraintName("FK_MessagePerformanceItem_Message");
  216. entity.HasOne(d => d.Item )
  217. .WithMany()
  218. .HasForeignKey(d => d.ItemId)
  219. .HasConstraintName("FK_MessagePerformanceItem_Item");
  220. });
  221. modelBuilder.Entity<AttachFile>(entity =>
  222. {
  223. entity.ToTable("AttachFile");
  224. entity.Property(e=>e.Name).HasMaxLength(200);
  225. entity.Property(e => e.SavePath).HasMaxLength(200);
  226. entity.HasOne(d => d.UploadUser)
  227. .WithMany()
  228. .HasForeignKey(d => d.UploadUserId)
  229. .HasConstraintName("FK_AttachFile_UpdateUser")
  230. .OnDelete(DeleteBehavior.NoAction);
  231. entity.HasOne(d => d.AppealRecord)
  232. .WithMany()
  233. .HasForeignKey(d => d.AppealRecordId)
  234. .HasConstraintName("FK_AttachFile_AppealRecord");
  235. });
  236. modelBuilder.Entity<AppealType>(entity =>
  237. {
  238. entity.ToTable("AppealType");
  239. entity.Property(e => e.Name).HasMaxLength(50);
  240. entity.Property(e => e.ReviewerExpress).HasMaxLength(500);
  241. entity.Property(e => e.CanDoExpress).HasMaxLength(500);
  242. });
  243. modelBuilder.Entity<AppealRecord>(entity =>
  244. {
  245. entity.ToTable("AppealRecord");
  246. entity.Property(e => e.Reason).HasMaxLength(500);
  247. entity.HasOne(d => d.Creater)
  248. .WithMany()
  249. .HasForeignKey(d => d.CreaterId);
  250. entity.HasOne(d => d.Reviewer)
  251. .WithMany().OnDelete(DeleteBehavior.NoAction)
  252. .HasForeignKey(d => d.ReviewerId);
  253. entity.HasOne(d => d.Type)
  254. .WithMany()
  255. .OnDelete(DeleteBehavior.NoAction)
  256. .HasForeignKey(d => d.TypeId);
  257. }) ;
  258. modelBuilder.Entity<InputField>(entity=> {
  259. entity.ToTable("InputField");
  260. entity.Property(e=>e.FieldName).HasMaxLength(50);
  261. entity.Property(e => e.FieldType).HasMaxLength(50);
  262. entity.Property(e => e.MapObjectField).HasMaxLength(50);
  263. entity.HasOne(d => d.AppealType)
  264. .WithMany()
  265. .HasForeignKey(d=>d.AppealTypeId);
  266. //entity.HasKey(d=>new { d.AppealTypeId,d.AppealState});
  267. });
  268. modelBuilder.Entity<SelectValue>(entity => {
  269. entity.ToTable("SelectValue");
  270. entity.HasOne(d => d.InputField)
  271. .WithMany(s=>s.SelectValues)
  272. .HasForeignKey(d => d.InputFieldId);
  273. //entity.HasKey(d=>new { d.AppealTypeId,d.AppealState});
  274. });
  275. modelBuilder.Entity<InputFieldValue>(entity => {
  276. entity.ToTable("InputFieldValue");
  277. entity.Property(e => e.Value).HasMaxLength(500);
  278. entity.HasOne(d => d.InputField)
  279. .WithMany()
  280. .HasForeignKey(d => d.InputFieldId);
  281. entity.HasOne(d => d.AppealRecord)
  282. .WithMany()
  283. .HasForeignKey(d => d.AppealRecordId);
  284. //entity.HasKey(d=>new { d.AppealRecordId,d.InputFieldId});
  285. });
  286. modelBuilder.Entity<StaffGrade>().HasData(
  287. new StaffGrade[]
  288. {
  289. new StaffGrade() {Id=1, Grade = "S级", Coefficient = 1.2},
  290. new StaffGrade() {Id=2, Grade = "A3级", Coefficient = 1.1},
  291. new StaffGrade() {Id =3, Grade = "A2级", Coefficient = 1.1},
  292. new StaffGrade() {Id=4, Grade = "A1级", Coefficient = 1.1},
  293. new StaffGrade() {Id=5, Grade = "B3级", Coefficient = 1.0},
  294. new StaffGrade() {Id=6, Grade = "B2级", Coefficient = 1.0},
  295. new StaffGrade() {Id=7, Grade = "B1级", Coefficient = 0.9},
  296. new StaffGrade() {Id=8, Grade = "C3级", Coefficient = 0.9},
  297. new StaffGrade() {Id=9, Grade = "C2级", Coefficient = 0.7},
  298. new StaffGrade() {Id= 10, Grade = "C1级", Coefficient = 0.7},
  299. new StaffGrade() {Id=11, Grade = "D3级", Coefficient = 0.6},
  300. new StaffGrade() {Id=12, Grade = "D2级", Coefficient = 0.6},
  301. new StaffGrade() {Id=13, Grade = "D1级", Coefficient = 0.5},
  302. new StaffGrade() {Id=14, Grade = "A级", Coefficient = 1.1},
  303. new StaffGrade() {Id=15, Grade = "C级", Coefficient = 1.0},
  304. new StaffGrade() {Id=16, Grade = "D级", Coefficient = 0.9}
  305. });
  306. modelBuilder.Entity<VerifyCoefficient>().HasData(
  307. new VerifyCoefficient[]
  308. {
  309. new VerifyCoefficient() { CheckerId = 1, DoPersonId =5, Coefficient =0.3},
  310. new VerifyCoefficient() { CheckerId = 1, DoPersonId =6, Coefficient =0.3},
  311. new VerifyCoefficient() { CheckerId = 1, DoPersonId =7, Coefficient =0.3},
  312. new VerifyCoefficient() { CheckerId = 1, DoPersonId =8, Coefficient =0.3},
  313. new VerifyCoefficient() { CheckerId = 1, DoPersonId =9, Coefficient =0.4},
  314. new VerifyCoefficient() { CheckerId = 1, DoPersonId =10, Coefficient =0.4},
  315. new VerifyCoefficient() { CheckerId = 1, DoPersonId =11, Coefficient =0.5},
  316. new VerifyCoefficient() { CheckerId = 1, DoPersonId =12, Coefficient =0.5},
  317. new VerifyCoefficient() { CheckerId = 1, DoPersonId =13, Coefficient =0.6},
  318. new VerifyCoefficient() { CheckerId = 2, DoPersonId =5, Coefficient =0.2},
  319. new VerifyCoefficient() { CheckerId = 2, DoPersonId =6, Coefficient =0.2},
  320. new VerifyCoefficient() { CheckerId = 2, DoPersonId =7, Coefficient =0.2},
  321. new VerifyCoefficient() { CheckerId = 2, DoPersonId =8, Coefficient =0.2},
  322. new VerifyCoefficient() { CheckerId = 2, DoPersonId =9, Coefficient =0.3},
  323. new VerifyCoefficient() { CheckerId = 2, DoPersonId =10, Coefficient =0.3},
  324. new VerifyCoefficient() { CheckerId = 2, DoPersonId =11, Coefficient =0.4},
  325. new VerifyCoefficient() { CheckerId = 2, DoPersonId =12, Coefficient =0.4},
  326. new VerifyCoefficient() { CheckerId = 2, DoPersonId =13, Coefficient =0.5},
  327. new VerifyCoefficient() { CheckerId = 3, DoPersonId =5, Coefficient =0.2},
  328. new VerifyCoefficient() { CheckerId = 3, DoPersonId =6, Coefficient =0.2},
  329. new VerifyCoefficient() { CheckerId = 3, DoPersonId =7, Coefficient =0.2},
  330. new VerifyCoefficient() { CheckerId = 3, DoPersonId =8, Coefficient =0.2},
  331. new VerifyCoefficient() { CheckerId = 3, DoPersonId =9, Coefficient =0.3},
  332. new VerifyCoefficient() { CheckerId = 3, DoPersonId =10, Coefficient =0.3},
  333. new VerifyCoefficient() { CheckerId = 3, DoPersonId =11, Coefficient =0.4},
  334. new VerifyCoefficient() { CheckerId = 3, DoPersonId =12, Coefficient =0.4},
  335. new VerifyCoefficient() { CheckerId = 3, DoPersonId =13, Coefficient =0.5},
  336. new VerifyCoefficient() { CheckerId = 4, DoPersonId =5, Coefficient =0.2},
  337. new VerifyCoefficient() { CheckerId = 4, DoPersonId =6, Coefficient =0.2},
  338. new VerifyCoefficient() { CheckerId = 4, DoPersonId =7, Coefficient =0.2},
  339. new VerifyCoefficient() { CheckerId = 4, DoPersonId =8, Coefficient =0.2},
  340. new VerifyCoefficient() { CheckerId = 4, DoPersonId =9, Coefficient =0.3},
  341. new VerifyCoefficient() { CheckerId = 4, DoPersonId =10, Coefficient =0.3},
  342. new VerifyCoefficient() { CheckerId = 4, DoPersonId =11, Coefficient =0.4},
  343. new VerifyCoefficient() { CheckerId = 4, DoPersonId =12, Coefficient =0.4},
  344. new VerifyCoefficient() { CheckerId = 4, DoPersonId =13, Coefficient =0.5},
  345. new VerifyCoefficient() { CheckerId = 5, DoPersonId =5, Coefficient =0.2},
  346. new VerifyCoefficient() { CheckerId = 5, DoPersonId =6, Coefficient =0.2},
  347. new VerifyCoefficient() { CheckerId = 5, DoPersonId =7, Coefficient =0.2},
  348. new VerifyCoefficient() { CheckerId = 5, DoPersonId =8, Coefficient =0.2},
  349. new VerifyCoefficient() { CheckerId = 5, DoPersonId =9, Coefficient =0.3},
  350. new VerifyCoefficient() { CheckerId = 5, DoPersonId =10, Coefficient =0.3},
  351. new VerifyCoefficient() { CheckerId = 5, DoPersonId =11, Coefficient =0.4},
  352. new VerifyCoefficient() { CheckerId = 5, DoPersonId =12, Coefficient =0.4},
  353. new VerifyCoefficient() { CheckerId = 5, DoPersonId =13, Coefficient =0.5},
  354. new VerifyCoefficient() { CheckerId = 6, DoPersonId =5, Coefficient =0.2},
  355. new VerifyCoefficient() { CheckerId = 6, DoPersonId =6, Coefficient =0.2},
  356. new VerifyCoefficient() { CheckerId = 6, DoPersonId =7, Coefficient =0.2},
  357. new VerifyCoefficient() { CheckerId = 6, DoPersonId =8, Coefficient =0.2},
  358. new VerifyCoefficient() { CheckerId = 6, DoPersonId =9, Coefficient =0.3},
  359. new VerifyCoefficient() { CheckerId = 6, DoPersonId =10, Coefficient =0.3},
  360. new VerifyCoefficient() { CheckerId = 6, DoPersonId =11, Coefficient =0.4},
  361. new VerifyCoefficient() { CheckerId = 6, DoPersonId =12, Coefficient =0.4},
  362. new VerifyCoefficient() { CheckerId = 6, DoPersonId =13, Coefficient =0.5}
  363. }
  364. );
  365. #region 初始化绩效点数规则
  366. //List<BasePointRule> rules = new List<BasePointRule>();
  367. //DataTable dt = wispro.sp.utility.NPOIExcel.ExcelToDataTable("ExcelFiles\\20211109-绩效点数规则-lcy-v1.xlsx", true);
  368. //foreach (DataRow row in dt.Rows)
  369. //{
  370. // BasePointRule rule = new BasePointRule()
  371. // {
  372. // Rule = row["规则"].ToString(),
  373. // PointExpress = row["点数计算"].ToString(),
  374. // Priority = int.Parse(row["优先级修订"].ToString()),
  375. // Type = row["类型"].ToString()
  376. // };
  377. //}
  378. //for (int i = 0; i < rules.Count; i++)
  379. //{
  380. // rules[i].Id = i + 1;
  381. //}
  382. //modelBuilder.Entity<BasePointRule>().HasData(rules);
  383. #endregion
  384. AppealType[] appealTypes = new AppealType[]
  385. {
  386. new AppealType(){Id=1, Name ="绩效点数分配比率",CanDoExpress = "p.ItemStaffs.Count()>1"},
  387. new AppealType(){Id=2,Name ="案件系数复核",CanDoExpress = "p.DoItem==\"新申请\"",ReviewerExpress ="p.Reviewer"},
  388. new AppealType(){Id=3,Name ="处理事项系数复核",CanDoExpress = "p.DoItem==\"新申请\"",ReviewerExpress ="p.Reviewer"},
  389. new AppealType(){Id=4,Name ="案件缺漏申诉",CanDoExpress ="",ReviewerExpress ="p.Reviewer",Type =1},
  390. new AppealType(){Id=5,Name ="案件严重超期说明",CanDoExpress ="p.isDanger()"}
  391. };
  392. InputField[] inputFields = new InputField[] {
  393. new InputField(){Id=1,AppealTypeId =1,AppealState =0,FieldName ="分配比率", MapObjectField ="ItemStaffs.PerformancePoint",FieldType = typeof(double).ToString() },
  394. new InputField(){Id=2,AppealTypeId =1,AppealState =0,FieldName ="处理人", MapObjectField ="ItemStaffs.DoPerson.Name" ,FieldType =typeof(string).ToString() },
  395. new InputField(){Id=3,AppealTypeId =1,AppealState =0,FieldName ="原因",FieldType =typeof(string).ToString() },
  396. new InputField(){Id=4,AppealTypeId =1,AppealState =1,FieldName ="备注",FieldType =typeof(string).ToString() },
  397. new InputField(){Id=5,AppealTypeId =1,AppealState =1,FieldName ="审核意见",FieldType =typeof(string).ToString()},
  398. new InputField(){Id=6,AppealTypeId =2,AppealState =0,FieldName ="案件系数", MapObjectField ="CaseCoefficient",FieldType = typeof(double).ToString() },
  399. new InputField(){Id=9,AppealTypeId =2,AppealState =1,FieldName ="备注",FieldType =typeof(string).ToString() },
  400. new InputField(){Id=10,AppealTypeId =2,AppealState =1,FieldName ="审核意见",FieldType =typeof(string).ToString()},
  401. new InputField(){Id=11,AppealTypeId =3,AppealState =0,FieldName ="处理事项系数", MapObjectField ="DoItemCoefficient",FieldType = typeof(double).ToString() },
  402. new InputField(){Id=12,AppealTypeId =3,AppealState =1,FieldName ="备注",FieldType =typeof(string).ToString() },
  403. new InputField(){Id=13,AppealTypeId =3,AppealState =1,FieldName ="审核意见",FieldType =typeof(string).ToString()},
  404. new InputField(){Id=14,AppealTypeId =4,AppealState =0,FieldName ="我方文号", FieldType = typeof(double).ToString() },
  405. new InputField(){Id=15,AppealTypeId =4,AppealState =0,FieldName ="处理事项", FieldType = typeof(double).ToString() },
  406. new InputField(){Id=16,AppealTypeId =4,AppealState =1,FieldName ="备注",FieldType =typeof(string).ToString() },
  407. new InputField(){Id=17,AppealTypeId =4,AppealState =1,FieldName ="审核意见",FieldType =typeof(string).ToString()}
  408. };
  409. List<SelectValue> selectValues = new List<SelectValue>() {
  410. new SelectValue(){Id =1, InputFieldId =5, Value ="同意" },
  411. new SelectValue(){Id =2, InputFieldId =5, Value ="拒绝" },
  412. new SelectValue(){Id =3, InputFieldId =10, Value ="同意" },
  413. new SelectValue(){Id =4, InputFieldId =10, Value ="拒绝" },
  414. new SelectValue(){Id =5, InputFieldId =13, Value ="同意" },
  415. new SelectValue(){Id =6, InputFieldId =13, Value ="拒绝" },
  416. new SelectValue(){Id =7, InputFieldId =17, Value ="同意" },
  417. new SelectValue(){Id =8, InputFieldId =17, Value ="拒绝" }
  418. };
  419. modelBuilder.Entity<AppealType>().HasData(appealTypes);
  420. modelBuilder.Entity<InputField>().HasData(inputFields);
  421. modelBuilder.Entity<SelectValue>().HasData(selectValues);
  422. OnModelCreatingPartial(modelBuilder);
  423. }
  424. partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
  425. }
  426. }