spDbContext.cs 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601
  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(a=>a.AttachFiles)
  233. .HasForeignKey(d => d.AppealRecordId)
  234. .HasConstraintName("FK_AttachFile_AppealRecord")
  235. .IsRequired(false);
  236. });
  237. modelBuilder.Entity<AppealType>(entity =>
  238. {
  239. entity.ToTable("AppealType");
  240. entity.Property(e => e.Name).HasMaxLength(50);
  241. entity.Property(e => e.ReviewerExpress).HasMaxLength(500);
  242. entity.Property(e => e.CanDoExpress).HasMaxLength(500);
  243. });
  244. modelBuilder.Entity<AppealRecord>(entity =>
  245. {
  246. entity.ToTable("AppealRecord");
  247. entity.Property(e => e.Reason).HasMaxLength(500);
  248. entity.HasOne(d => d.Creater)
  249. .WithMany()
  250. .HasForeignKey(d => d.CreaterId);
  251. entity.HasOne(d => d.Reviewer)
  252. .WithMany().OnDelete(DeleteBehavior.NoAction)
  253. .HasForeignKey(d => d.ReviewerId);
  254. entity.HasOne(d => d.Type)
  255. .WithMany()
  256. .OnDelete(DeleteBehavior.NoAction)
  257. .HasForeignKey(d => d.TypeId);
  258. entity.HasOne(d => d.Item)
  259. .WithMany()
  260. .HasForeignKey(d=>d.ItemId);
  261. }) ;
  262. modelBuilder.Entity<InputField>(entity=> {
  263. entity.ToTable("InputField");
  264. entity.Property(e=>e.FieldName).HasMaxLength(50);
  265. entity.Property(e => e.FieldType).HasMaxLength(50);
  266. entity.Property(e => e.MapObjectField).HasMaxLength(50);
  267. entity.HasOne(d => d.AppealType)
  268. .WithMany()
  269. .HasForeignKey(d=>d.AppealTypeId);
  270. //entity.HasKey(d=>new { d.AppealTypeId,d.AppealState});
  271. });
  272. modelBuilder.Entity<SelectValue>(entity => {
  273. entity.ToTable("SelectValue");
  274. entity.HasOne(d => d.InputField)
  275. .WithMany(s=>s.SelectValues)
  276. .HasForeignKey(d => d.InputFieldId);
  277. //entity.HasKey(d=>new { d.AppealTypeId,d.AppealState});
  278. });
  279. modelBuilder.Entity<InputFieldValue>(entity => {
  280. entity.ToTable("InputFieldValue");
  281. entity.Property(e => e.Value).HasMaxLength(500);
  282. entity.HasOne(d => d.InputField)
  283. .WithMany()
  284. .HasForeignKey(d => d.InputFieldId);
  285. entity.HasOne(d => d.AppealRecord)
  286. .WithMany()
  287. .HasForeignKey(d => d.AppealRecordId);
  288. //entity.HasKey(d=>new { d.AppealRecordId,d.InputFieldId});
  289. });
  290. modelBuilder.Entity<StaffGrade>().HasData(
  291. new StaffGrade[]
  292. {
  293. new StaffGrade() {Id=1, Grade = "S级", Coefficient = 1.2},
  294. new StaffGrade() {Id=2, Grade = "A3级", Coefficient = 1.1},
  295. new StaffGrade() {Id =3, Grade = "A2级", Coefficient = 1.1},
  296. new StaffGrade() {Id=4, Grade = "A1级", Coefficient = 1.1},
  297. new StaffGrade() {Id=5, Grade = "B3级", Coefficient = 1.0},
  298. new StaffGrade() {Id=6, Grade = "B2级", Coefficient = 1.0},
  299. new StaffGrade() {Id=7, Grade = "B1级", Coefficient = 0.9},
  300. new StaffGrade() {Id=8, Grade = "C3级", Coefficient = 0.9},
  301. new StaffGrade() {Id=9, Grade = "C2级", Coefficient = 0.7},
  302. new StaffGrade() {Id= 10, Grade = "C1级", Coefficient = 0.7},
  303. new StaffGrade() {Id=11, Grade = "D3级", Coefficient = 0.6},
  304. new StaffGrade() {Id=12, Grade = "D2级", Coefficient = 0.6},
  305. new StaffGrade() {Id=13, Grade = "D1级", Coefficient = 0.5},
  306. new StaffGrade() {Id=14, Grade = "A级", Coefficient = 1.1},
  307. new StaffGrade() {Id=15, Grade = "C级", Coefficient = 1.0},
  308. new StaffGrade() {Id=16, Grade = "D级", Coefficient = 0.9}
  309. });
  310. modelBuilder.Entity<VerifyCoefficient>().HasData(
  311. new VerifyCoefficient[]
  312. {
  313. new VerifyCoefficient() { CheckerId = 1, DoPersonId =5, Coefficient =0.3},
  314. new VerifyCoefficient() { CheckerId = 1, DoPersonId =6, Coefficient =0.3},
  315. new VerifyCoefficient() { CheckerId = 1, DoPersonId =7, Coefficient =0.3},
  316. new VerifyCoefficient() { CheckerId = 1, DoPersonId =8, Coefficient =0.3},
  317. new VerifyCoefficient() { CheckerId = 1, DoPersonId =9, Coefficient =0.4},
  318. new VerifyCoefficient() { CheckerId = 1, DoPersonId =10, Coefficient =0.4},
  319. new VerifyCoefficient() { CheckerId = 1, DoPersonId =11, Coefficient =0.5},
  320. new VerifyCoefficient() { CheckerId = 1, DoPersonId =12, Coefficient =0.5},
  321. new VerifyCoefficient() { CheckerId = 1, DoPersonId =13, Coefficient =0.6},
  322. new VerifyCoefficient() { CheckerId = 2, DoPersonId =5, Coefficient =0.2},
  323. new VerifyCoefficient() { CheckerId = 2, DoPersonId =6, Coefficient =0.2},
  324. new VerifyCoefficient() { CheckerId = 2, DoPersonId =7, Coefficient =0.2},
  325. new VerifyCoefficient() { CheckerId = 2, DoPersonId =8, Coefficient =0.2},
  326. new VerifyCoefficient() { CheckerId = 2, DoPersonId =9, Coefficient =0.3},
  327. new VerifyCoefficient() { CheckerId = 2, DoPersonId =10, Coefficient =0.3},
  328. new VerifyCoefficient() { CheckerId = 2, DoPersonId =11, Coefficient =0.4},
  329. new VerifyCoefficient() { CheckerId = 2, DoPersonId =12, Coefficient =0.4},
  330. new VerifyCoefficient() { CheckerId = 2, DoPersonId =13, Coefficient =0.5},
  331. new VerifyCoefficient() { CheckerId = 3, DoPersonId =5, Coefficient =0.2},
  332. new VerifyCoefficient() { CheckerId = 3, DoPersonId =6, Coefficient =0.2},
  333. new VerifyCoefficient() { CheckerId = 3, DoPersonId =7, Coefficient =0.2},
  334. new VerifyCoefficient() { CheckerId = 3, DoPersonId =8, Coefficient =0.2},
  335. new VerifyCoefficient() { CheckerId = 3, DoPersonId =9, Coefficient =0.3},
  336. new VerifyCoefficient() { CheckerId = 3, DoPersonId =10, Coefficient =0.3},
  337. new VerifyCoefficient() { CheckerId = 3, DoPersonId =11, Coefficient =0.4},
  338. new VerifyCoefficient() { CheckerId = 3, DoPersonId =12, Coefficient =0.4},
  339. new VerifyCoefficient() { CheckerId = 3, DoPersonId =13, Coefficient =0.5},
  340. new VerifyCoefficient() { CheckerId = 4, DoPersonId =5, Coefficient =0.2},
  341. new VerifyCoefficient() { CheckerId = 4, DoPersonId =6, Coefficient =0.2},
  342. new VerifyCoefficient() { CheckerId = 4, DoPersonId =7, Coefficient =0.2},
  343. new VerifyCoefficient() { CheckerId = 4, DoPersonId =8, Coefficient =0.2},
  344. new VerifyCoefficient() { CheckerId = 4, DoPersonId =9, Coefficient =0.3},
  345. new VerifyCoefficient() { CheckerId = 4, DoPersonId =10, Coefficient =0.3},
  346. new VerifyCoefficient() { CheckerId = 4, DoPersonId =11, Coefficient =0.4},
  347. new VerifyCoefficient() { CheckerId = 4, DoPersonId =12, Coefficient =0.4},
  348. new VerifyCoefficient() { CheckerId = 4, DoPersonId =13, Coefficient =0.5},
  349. new VerifyCoefficient() { CheckerId = 5, DoPersonId =5, Coefficient =0.2},
  350. new VerifyCoefficient() { CheckerId = 5, DoPersonId =6, Coefficient =0.2},
  351. new VerifyCoefficient() { CheckerId = 5, DoPersonId =7, Coefficient =0.2},
  352. new VerifyCoefficient() { CheckerId = 5, DoPersonId =8, Coefficient =0.2},
  353. new VerifyCoefficient() { CheckerId = 5, DoPersonId =9, Coefficient =0.3},
  354. new VerifyCoefficient() { CheckerId = 5, DoPersonId =10, Coefficient =0.3},
  355. new VerifyCoefficient() { CheckerId = 5, DoPersonId =11, Coefficient =0.4},
  356. new VerifyCoefficient() { CheckerId = 5, DoPersonId =12, Coefficient =0.4},
  357. new VerifyCoefficient() { CheckerId = 5, DoPersonId =13, Coefficient =0.5},
  358. new VerifyCoefficient() { CheckerId = 6, DoPersonId =5, Coefficient =0.2},
  359. new VerifyCoefficient() { CheckerId = 6, DoPersonId =6, Coefficient =0.2},
  360. new VerifyCoefficient() { CheckerId = 6, DoPersonId =7, Coefficient =0.2},
  361. new VerifyCoefficient() { CheckerId = 6, DoPersonId =8, Coefficient =0.2},
  362. new VerifyCoefficient() { CheckerId = 6, DoPersonId =9, Coefficient =0.3},
  363. new VerifyCoefficient() { CheckerId = 6, DoPersonId =10, Coefficient =0.3},
  364. new VerifyCoefficient() { CheckerId = 6, DoPersonId =11, Coefficient =0.4},
  365. new VerifyCoefficient() { CheckerId = 6, DoPersonId =12, Coefficient =0.4},
  366. new VerifyCoefficient() { CheckerId = 6, DoPersonId =13, Coefficient =0.5}
  367. }
  368. );
  369. #region 初始化绩效点数规则
  370. //List<BasePointRule> rules = new List<BasePointRule>();
  371. //DataTable dt = wispro.sp.utility.NPOIExcel.ExcelToDataTable("ExcelFiles\\20211109-绩效点数规则-lcy-v1.xlsx", true);
  372. //foreach (DataRow row in dt.Rows)
  373. //{
  374. // BasePointRule rule = new BasePointRule()
  375. // {
  376. // Rule = row["规则"].ToString(),
  377. // PointExpress = row["点数计算"].ToString(),
  378. // Priority = int.Parse(row["优先级修订"].ToString()),
  379. // Type = row["类型"].ToString()
  380. // };
  381. //}
  382. //for (int i = 0; i < rules.Count; i++)
  383. //{
  384. // rules[i].Id = i + 1;
  385. //}
  386. //modelBuilder.Entity<BasePointRule>().HasData(rules);
  387. #endregion
  388. AppealType[] appealTypes = new AppealType[]
  389. {
  390. new AppealType(){Id=1, Name ="绩效点数分配比率",CanDoExpress = "p.ItemStaffs.Count()>1"},
  391. new AppealType(){Id=2,Name ="案件系数复核",CanDoExpress = "p.DoItem==\"新申请\"",ReviewerExpress ="p.Reviewer"},
  392. new AppealType(){Id=3,Name ="处理事项系数复核",CanDoExpress = "p.DoItem==\"新申请\"",ReviewerExpress ="p.Reviewer"},
  393. new AppealType(){Id=4,Name ="案件缺漏申诉",CanDoExpress ="",ReviewerExpress ="p.Reviewer",Type =1},
  394. new AppealType(){Id=5,Name ="案件严重超期说明",CanDoExpress ="p.isDanger()"},
  395. new AppealType(){Id=6,Name ="按照翻译字数算绩效备注",CanDoExpress ="p.DoItem==\"新申请\" || p.DoItem==\"翻译\""}
  396. };
  397. InputField[] inputFields = new InputField[] {
  398. new InputField(){Id=1,AppealTypeId =1,AppealState =0,FieldName ="分配比率",
  399. MapObjectField ="ItemStaffs.PerformancePoint",
  400. FieldType = typeof(double).ToString(),
  401. MapObjectFieldLabel="ItemStaffs.DoPerson.Name"
  402. },
  403. new InputField(){Id=3,AppealTypeId =1,AppealState =0,FieldName ="原因",FieldType =typeof(string).ToString() },
  404. new InputField(){Id=4,AppealTypeId =1,AppealState =1,FieldName ="备注",FieldType =typeof(string).ToString() },
  405. new InputField(){Id=5,AppealTypeId =1,AppealState =1,FieldName ="审核意见",FieldType =typeof(string).ToString()},
  406. new InputField(){Id=6,AppealTypeId =2,AppealState =0,FieldName ="案件系数", MapObjectField ="CaseCoefficient",FieldType = typeof(string).ToString() },
  407. new InputField(){Id=9,AppealTypeId =2,AppealState =1,FieldName ="备注",FieldType =typeof(string).ToString() },
  408. new InputField(){Id=10,AppealTypeId =2,AppealState =1,FieldName ="审核意见",FieldType =typeof(string).ToString()},
  409. new InputField(){Id=11,AppealTypeId =3,AppealState =0,FieldName ="处理事项系数", MapObjectField ="DoItemCoefficient",FieldType = typeof(string).ToString() },
  410. new InputField(){Id=12,AppealTypeId =3,AppealState =1,FieldName ="备注",FieldType =typeof(string).ToString() },
  411. new InputField(){Id=13,AppealTypeId =3,AppealState =1,FieldName ="审核意见",FieldType =typeof(string).ToString()},
  412. new InputField(){Id=14,AppealTypeId =4,AppealState =0,FieldName ="我方文号", FieldType = typeof(string).ToString() },
  413. new InputField(){Id=15,AppealTypeId =4,AppealState =0,FieldName ="处理事项", FieldType = typeof(string).ToString() },
  414. new InputField(){Id=16,AppealTypeId =4,AppealState =1,FieldName ="备注",FieldType =typeof(string).ToString() },
  415. new InputField(){Id=17,AppealTypeId =4,AppealState =1,FieldName ="审核意见",FieldType =typeof(string).ToString()},
  416. new InputField(){Id=18,AppealTypeId =5,AppealState =0,FieldName ="超期说明",MapObjectField ="OverDueMemo", FieldType = typeof(string).ToString() },
  417. new InputField(){Id=19,AppealTypeId =6,AppealState =0,FieldName ="翻译类型", MapObjectField ="AgentFeedbackMemo", FieldType = typeof(string).ToString() },
  418. new InputField(){Id=20,AppealTypeId =6,AppealState =0,FieldName ="翻译字数", FieldType = typeof(int).ToString() },
  419. };
  420. List<SelectValue> selectValues = new List<SelectValue>() {
  421. new SelectValue(){Id =1, InputFieldId =5, Value ="同意" },
  422. new SelectValue(){Id =2, InputFieldId =5, Value ="拒绝" },
  423. new SelectValue(){Id =3, InputFieldId =10, Value ="同意" },
  424. new SelectValue(){Id =4, InputFieldId =10, Value ="拒绝" },
  425. new SelectValue(){Id =5, InputFieldId =13, Value ="同意" },
  426. new SelectValue(){Id =6, InputFieldId =13, Value ="拒绝" },
  427. new SelectValue(){Id =7, InputFieldId =17, Value ="同意" },
  428. new SelectValue(){Id =8, InputFieldId =17, Value ="拒绝" },
  429. new SelectValue(){Id =9, InputFieldId =6, Value ="S" },
  430. new SelectValue(){Id =10, InputFieldId =6, Value ="A" },
  431. new SelectValue(){Id =11, InputFieldId =6, Value ="B" },
  432. new SelectValue(){Id =12, InputFieldId =6, Value ="C" },
  433. new SelectValue(){Id =13, InputFieldId =6, Value ="D" },
  434. new SelectValue(){Id =14, InputFieldId =11, Value ="实质" },
  435. new SelectValue(){Id =15, InputFieldId =11, Value ="形式" },
  436. new SelectValue(){Id =16, InputFieldId =19, Value ="中-德" },
  437. new SelectValue(){Id =17, InputFieldId =19, Value ="中-英" },
  438. new SelectValue(){Id =18, InputFieldId =19, Value ="英-中" }
  439. };
  440. modelBuilder.Entity<AppealType>().HasData(appealTypes);
  441. modelBuilder.Entity<InputField>().HasData(inputFields);
  442. modelBuilder.Entity<SelectValue>().HasData(selectValues);
  443. OnModelCreatingPartial(modelBuilder);
  444. }
  445. partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
  446. }
  447. }