using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using Autofac; using EMIS.Entities; using EMIS.CommonLogic.CalendarManage; using EMIS.Utility; using System.Reflection; using EMIS.CommonLogic.EducationSchedule; using EMIS.DataLogic; using EMIS.CommonLogic.Students; using EMIS.ViewModel; using Bowin.Common; using System.Net; using System.IO; using EMIS.CommonLogic.UniversityManage.AdministrativeOrgan; using EMIS.CommonLogic.SystemServices; namespace EMIS.TestProject { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { //UnitOfWork uow = new UnitOfWork(); //uow.BulkInsert(new List(), (x => x.Sys_FunctionCode)); } private void button1_Click(object sender, EventArgs e) { using (var scope = AutofacHelper.Container.BeginLifetimeScope()) { EMIS.CommonLogic.EducationSchedule.IScheduleServices ScheduleServices = scope.Resolve(); ScheduleServices.GenerateSchedule(); } } private void button2_Click(object sender, EventArgs e) { var result = this.folderBrowserDialog1.ShowDialog(); if (result == DialogResult.OK) { using (var scope = AutofacHelper.Container.BeginLifetimeScope()) { var rootPath = this.folderBrowserDialog1.SelectedPath; IStudentsServices StudentsServices = scope.Resolve(); List clearPhotoUserID = new List(); 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(); studentList.ForEach(x => { WebClient conn = new WebClient(); File.Delete(rootPath + "\\" + x.LoginID + ".jpg"); string targetFile = x.PhotoUrl.Trim(); if (!x.PhotoUrl.Trim().StartsWith("http://")) { targetFile = "http://jw.gdsspt.net"; if (!x.PhotoUrl.StartsWith("/")) { targetFile += "/"; } targetFile += x.PhotoUrl.Trim(); } try { conn.DownloadFile(targetFile, rootPath + "\\" + x.LoginID + ".jpg"); } catch { clearPhotoUserID.Add(x.UserID); } }); StudentsServices.ClearPhotoUrl(clearPhotoUserID); MessageBox.Show("导出成功。"); } } } private void button3_Click(object sender, EventArgs e) { using (var scop = AutofacHelper.Container.BeginLifetimeScope()) { ISchoolYearServices SchoolYearServices = scop.Resolve(); SchoolYearServices.AutoCreateSchoolyearAndYearsSS(); } } private void button4_Click(object sender, EventArgs e) { using (var scop = AutofacHelper.Container.BeginLifetimeScope()) { IDepartmentServices DepartmentServices = scop.Resolve(); IUserServices UserServices = scop.Resolve(); DepartmentServices.SynHRServices(); UserServices.SynHRServices(); } } } }