public Excel() { int Year = DateTime.Now.Year; DateTime d0 = new DateTime(Year, 1, 1); var fd0 = FirstDayWeek(d0); DateTime d1 = new DateTime(Year - 1, 1, 1); var fd1 = FirstDayWeek(d1); DateTime d2 = new DateTime(Year - 2, 1, 1); var fd2 = FirstDayWeek(d2); YearAgoDay = (int)(fd0 - fd1).TotalDays; TwoYearAgoDay = (int)(fd0 - fd2).TotalDays; var CurDir = AppDomain.CurrentDomain.BaseDirectory; var AppConfiguration = new ConfigurationBuilder() .SetBasePath(CurDir).AddJsonFile("appsettings.json").Build(); MailConfig MailConfig = new MailConfig(); MailConfig.SmtpServer = AppConfiguration.GetSection("Report:Mail:SmtpServer").Value; MailConfig.From = AppConfiguration.GetSection("Report:Mail:From").Value; MailConfig.Login = AppConfiguration.GetSection("Report:Mail:Login").Value; MailConfig.Password = AppConfiguration.GetSection("Report:Mail:Password").Value; Mail = new Mail(MailConfig); EmailError = AppConfiguration.GetSection("Report:EmailError").Value; EmailSuccess = AppConfiguration.GetSection("Report:EmailSuccess").Value; }
public Mail(MailConfig pMailConfig) { Config = pMailConfig; }