spDbContext.cs 29 KB

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