Form1.cs 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. using Autofac;
  10. using EMIS.Entities;
  11. using EMIS.CommonLogic.CalendarManage;
  12. using EMIS.Utility;
  13. using System.Reflection;
  14. using EMIS.CommonLogic.EducationSchedule;
  15. using EMIS.DataLogic;
  16. using EMIS.CommonLogic.Students;
  17. using EMIS.ViewModel;
  18. using Bowin.Common;
  19. using System.Net;
  20. using System.IO;
  21. using EMIS.CommonLogic.UniversityManage.AdministrativeOrgan;
  22. using EMIS.CommonLogic.SystemServices;
  23. namespace EMIS.TestProject
  24. {
  25. public partial class Form1 : Form
  26. {
  27. public Form1()
  28. {
  29. InitializeComponent();
  30. }
  31. private void Form1_Load(object sender, EventArgs e)
  32. {
  33. //UnitOfWork uow = new UnitOfWork();
  34. //uow.BulkInsert(new List<Sys_Role>(), (x => x.Sys_FunctionCode));
  35. }
  36. private void button1_Click(object sender, EventArgs e)
  37. {
  38. using (var scope = AutofacHelper.Container.BeginLifetimeScope())
  39. {
  40. EMIS.CommonLogic.EducationSchedule.IScheduleServices ScheduleServices = scope.Resolve<EMIS.CommonLogic.EducationSchedule.IScheduleServices>();
  41. ScheduleServices.GenerateSchedule();
  42. }
  43. }
  44. private void button2_Click(object sender, EventArgs e)
  45. {
  46. var result = this.folderBrowserDialog1.ShowDialog();
  47. if (result == DialogResult.OK)
  48. {
  49. using (var scope = AutofacHelper.Container.BeginLifetimeScope())
  50. {
  51. var rootPath = this.folderBrowserDialog1.SelectedPath;
  52. IStudentsServices StudentsServices = scope.Resolve<IStudentsServices>();
  53. List<Guid> clearPhotoUserID = new List<Guid>();
  54. var studentList = StudentsServices.GetStudentViewList(new ConfiguretView(), null, null, 2016, null, null, null, null, null, (int)CF_GeneralPurpose.IsYes,null,null,null,null,null,null).ToList();
  55. studentList.ForEach(x =>
  56. {
  57. WebClient conn = new WebClient();
  58. File.Delete(rootPath + "\\" + x.LoginID + ".jpg");
  59. string targetFile = x.PhotoUrl.Trim();
  60. if (!x.PhotoUrl.Trim().StartsWith("http://"))
  61. {
  62. targetFile = "http://jw.gdsspt.net";
  63. if (!x.PhotoUrl.StartsWith("/"))
  64. {
  65. targetFile += "/";
  66. }
  67. targetFile += x.PhotoUrl.Trim();
  68. }
  69. try
  70. {
  71. conn.DownloadFile(targetFile, rootPath + "\\" + x.LoginID + ".jpg");
  72. }
  73. catch
  74. {
  75. clearPhotoUserID.Add(x.UserID);
  76. }
  77. });
  78. StudentsServices.ClearPhotoUrl(clearPhotoUserID);
  79. MessageBox.Show("导出成功。");
  80. }
  81. }
  82. }
  83. private void button3_Click(object sender, EventArgs e)
  84. {
  85. using (var scop = AutofacHelper.Container.BeginLifetimeScope())
  86. {
  87. ISchoolYearServices SchoolYearServices = scop.Resolve<ISchoolYearServices>();
  88. SchoolYearServices.AutoCreateSchoolyearAndYearsSS();
  89. }
  90. }
  91. private void button4_Click(object sender, EventArgs e)
  92. {
  93. using (var scop = AutofacHelper.Container.BeginLifetimeScope())
  94. {
  95. IDepartmentServices DepartmentServices = scop.Resolve<IDepartmentServices>();
  96. IUserServices UserServices = scop.Resolve<IUserServices>();
  97. DepartmentServices.SynHRServices();
  98. UserServices.SynHRServices();
  99. }
  100. }
  101. }
  102. }