From bf9fc91992d34114594eaaa3d3ad4f09f0fae836 Mon Sep 17 00:00:00 2001 From: iyak Date: Thu, 23 Jan 2025 00:27:39 +0000 Subject: [PATCH] =?UTF-8?q?6432.=20=EA=B0=9C=EB=B0=9C=EA=B1=B4=20(?= =?UTF-8?q?=EC=A0=81=EC=9A=A9=EC=9D=80=20=EC=95=88=ED=95=A8)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Base/Controller/BasePartialController.cs | 54 ++---- Base/Controller/FOCommon.cs | 6 +- Dao/MyBatis/Maps/CRoom.xml | 93 ++++++---- FO/Views/CRoom/Estimation.cshtml | 221 +++++++++++++++++------ 4 files changed, 236 insertions(+), 138 deletions(-) diff --git a/Base/Controller/BasePartialController.cs b/Base/Controller/BasePartialController.cs index 0e712eb..1ad403f 100644 --- a/Base/Controller/BasePartialController.cs +++ b/Base/Controller/BasePartialController.cs @@ -1072,51 +1072,45 @@ namespace NP.Base [Obsolete] protected int SendEmail(String smtphost, int smtpport, String smtpid, String smtppw, int SendType, String rcvEmail, String sdEmail, String sdName, String title, String Html, String strFile = null, string bans = "") { - System.Web.Mail.MailMessage mail = null; + switch (SendType) { case 1: break; - default: - - break; + default: break; } + String result = rcvEmail; try { - mail = new System.Web.Mail.MailMessage(); + var mail = new System.Web.Mail.MailMessage(); mail.Subject = title; - mail.From = sdEmail; //보내는 사람 설정 + mail.From = "donetreplay@cte.or.kr"; // sdEmail; //보내는 사람 설정 mail.To = rcvEmail; // 받는 사람 설정 mail.BodyEncoding = System.Text.Encoding.UTF8; mail.BodyFormat = MailFormat.Html; + if ("" != bans) { Html = Html.Replace("^ban0^", bans.Split(':')[0]).Replace("^ban1^", bans.Split(':')[1]); } + var files = new NP.Model.VMBase() { }; mail.Body = Html.Replace("src=\"" + files.Files + "/Editor", "src=\"" + GetConfig("fronturl") + "/Files/Editor"); + if (!string.IsNullOrEmpty(strFile)) { System.Web.Mail.MailAttachment attachment;//첨부파일 만들기 attachment = new System.Web.Mail.MailAttachment(strFile);//첨부파일 붙이기 mail.Attachments.Add(attachment);//첨부파일 붙이기 } - - int cdoBasic = 1; + mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpusessl", true); mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserverport", smtpport); - mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", cdoBasic); + mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", 1); mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", smtpid); mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", smtppw); SmtpMail.SmtpServer = smtphost; - SmtpMail.Send(mail); - - //using (System.Net.Mail.SmtpClient SmtpServer = new System.Net.Mail.SmtpClient(smtphost, smtpport)) - //{ - // SmtpServer.Credentials = new System.Net.NetworkCredential(smtpid, smtppw); - // //SmtpServer.EnableSsl = true; - // SmtpServer.Send(mail); - //} + SmtpMail.Send(mail); } catch (Exception ex) { @@ -1127,6 +1121,7 @@ namespace NP.Base return 1; } + /// /// 메일발송 (추가) /// @@ -1158,13 +1153,14 @@ namespace NP.Base smtpClient.Credentials = new NetworkCredential(smtpUser, smtpPassword); smtpClient.EnableSsl = true; - + // SSL/TLS 설정 명시 smtpClient.DeliveryMethod = SmtpDeliveryMethod.Network; using (var mailMessage = new System.Net.Mail.MailMessage()) { mailMessage.From = new MailAddress(fromEmail, "영남건설기술교육원"); + mailMessage.ReplyToList.Add(new MailAddress(fromEmail)); mailMessage.Subject = title; mailMessage.Body = Html; mailMessage.IsBodyHtml = true; @@ -1208,22 +1204,19 @@ namespace NP.Base { var smtp = GetConfig("masteremail").Split(';'); string smtphost = smtp[1]; - int smtpport = Convert.ToInt32(smtp[2].Replace(" ","")); + int smtpport = Convert.ToInt32(smtp[2].Replace(" ", "")); string smtpid = smtp[3]; string smtppw = smtp[4]; - try { var mail = new System.Web.Mail.MailMessage(); mail.From = sdEmail; - mail.To =rcvEmail; + mail.To = rcvEmail; mail.Subject = title; mail.BodyFormat = MailFormat.Html; mail.Body = string.Empty; mail.BodyEncoding = System.Text.Encoding.UTF8; - FileInfo template_email = new FileInfo(Server.MapPath(string.Format(@"\Content/emailForm/\{0}", (templateType == "2" ? "template_email" : "template_email_" + templateType) + ".html"))); - string template_emailText = string.Empty; if (template_email.Exists) { @@ -1233,11 +1226,9 @@ namespace NP.Base { template_emailText = template_emailText.Replace("{" + i + "}", contents[i]); } - r.Dispose(); mail.Body = template_emailText; // 내용 설정 } - var files = new NP.Model.VMBase() { }; mail.Body = template_emailText.Replace("src=\"" + files.Files + "/Editor", "src=\"" + GetConfig("fronturl") + "/Files/Editor"); if (!string.IsNullOrEmpty(fileName)) @@ -1254,26 +1245,15 @@ namespace NP.Base mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", smtppw); SmtpMail.SmtpServer = smtphost; SmtpMail.Send(mail); - //using (System.Net.Mail.SmtpClient SmtpServer = new System.Net.Mail.SmtpClient(smtphost, smtpport)) - //{ - // SmtpServer.Credentials = new System.Net.NetworkCredential(smtpid, smtppw); - // //SmtpServer.EnableSsl = true; - // SmtpServer.Send(mail); - //} - //SmtpServer.Host = smtphost; - //SmtpServer.Port = Convert.ToInt32(smtpport); - //SmtpServer.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network; - //SmtpServer.EnableSsl = false; - //SmtpServer.Send(mail); } catch (Exception ex) { SetError("emailfail:" + rcvEmail + ":" + ex.Message + ex.StackTrace); return 0; } - return 1; } + /// /// mmstype (0: mms, 1: mmsurl, 7: html /// diff --git a/Base/Controller/FOCommon.cs b/Base/Controller/FOCommon.cs index 413c747..beac476 100644 --- a/Base/Controller/FOCommon.cs +++ b/Base/Controller/FOCommon.cs @@ -352,10 +352,8 @@ namespace NP.Base.Controllers "아래 링크를 클릭하셔서 비밀번호를 재설정해주세요.

" + "비밀번호 재설정

이 링크는 24시간 뒤 만료됩니다."; - int mailReuslt = SendEmailNew("[영남건설기술교육원] 비밀번호 찾기 안내", MHtml, email); - - - return JsonOK(mailReuslt == 1 ? 1000 : 0); + //int mailReuslt = SendEmailNew("[영남건설기술교육원] 비밀번호 찾기 안내", MHtml, email); + return JsonOK(SendEmail(masteremail.Split(';')[1], GetInt(masteremail.Split(';')[2]), masteremail.Split(';')[3], masteremail.Split(';')[4], 999, user.email, masteremail.Split(';')[0], "영남건설기술교육원 운영자", "[영남건설기술교육원] 비밀번호 찾기 안내", MHtml, "", "0:0")); } else { diff --git a/Dao/MyBatis/Maps/CRoom.xml b/Dao/MyBatis/Maps/CRoom.xml index bcc93d7..c3272c9 100644 --- a/Dao/MyBatis/Maps/CRoom.xml +++ b/Dao/MyBatis/Maps/CRoom.xml @@ -439,58 +439,68 @@ ) c on c.rscqno is not null where a.lectno=#lectno# and a.userno=#userno# and a0.lectno is null + + + + + + -@{ - List allowLectNos = Array.ConvertAll("104069,102553,105325,104402,106226,62683,104419".Split(','), long.Parse).ToList(); + @foreach (var d in Model.Datas.Where(w => w.dtype > -1)) + { + ViewBag.exCheck = allowLectNos.IndexOf(Model.croomlectno) > -1 ? true : false; + + + + + + @* + // 시험 응시 버튼 + /* + 시험응시가능조건(①, ② 필수 / ③or④) + ① 관리자가 시험등록 시 설정한 진도율 조건 만족 < -현재 되어 있음 + ② lect.sdate ~lect.edate 기간 내일 경우(현재 없음.어딘가 기능은 있을텐데.....) + ③ 집합교육이 출석 상태 + ④ 16시간 교육 + + // 3월이후에 아래 내용으로 복원한다 (dtype = 1 안에 if 문 조정) + =d.intval2?"02":"01")">@(d.intval4 == 1 ? "[평가완료]" : d.intval3 == 1 ? "[참여완료]" : d.intval3 == 0 && d.intval >=d.intval2 ? "[참여가능]" : "[참여불가]") + */ + *@ - } - @foreach (var d in Model.Datas.Where(w=>w.dtype > -1)) - { - if(allowLectNos.IndexOf(Model.croomlectno) > -1) - { - ViewBag.exCheck = true; - } - - - @if (d.dtype == 1 && ViewBag.exCheck == false) - { - - } - else - { - - } + // 최총 평가일 때 + if ( + ((currentProgresRate >= d.intval2) && IsDateInRange(d.time2, d.time)) || + ViewBag.exCheck || + dType1CmStudyTime == 16 + ) + { + + } + else + { + + + } + } + else + { + // 과제 등... + + + } + + } + + @* + // 하단 문구 + // - 16시간 교육X or 신청일이 2024-08-19 이후 + *@ - - } - @if (Model.Datas.Where(w => w.dtype > -1).Count() < 1) { } @@ -76,43 +149,77 @@ }
+ @* + // 당구장 설명 + /* + ① 16시간 교육O or 신청일이 2024-08-19 이전: 참여조건 표기 + ② 16시간 교육X or 신청일이 2024-08-19 이후: ※ 집체교육일에 교육장에서 평가진행 + + // 3월이후에 아래 내용으로 복원한다 (dtype = 1 안에 if 문 조정) +

※ 참여조건 : 진도율 90% 이상 / 집체교육 참석 완료 (집체교육일 : @d.time.ToShortDateString())

+ */ + *@ +
+ @(d.dtype == 0 ? "진행평가" : d.dtype == 1 ? "최종평가" : d.dtype == 2 ? "과제" : d.dtype == 3 ? "토론" : "") @d.strval +
+ + @if (d.dtype == 1) + { // 최종평가 + if (d.intval6 == 16 && d.time2 < Convert.ToDateTime("2024-08-19 00:00:00")) + { +

참여조건 : 진도율 @(d.intval2)% 이상 / 집체교육 참석일 (@d.time.ToShortDateString()) 전 까지

+ } + else + { +

※ 집체교육일에 교육장에서 평가진행

+ } + } + else if (d.dtype > 1) + { // 기타 +

참여조건 : 진도율 @(d.intval2)% 이상 / 집체교육 참석일 (@d.time.ToShortDateString()) 전 까지

+ } +
- @* 아래에 주석친 부분들은 2025년3월에 롤백될 예정 *@ -
@(d.dtype == 0 ? "진행평가":d.dtype==1?"최종평가":d.dtype == 2?"과제":d.dtype==3?"토론":"") @d.strval
@if (d.dtype == 1) { -

※ 집체교육일에 교육장에서 평가진행

- @*

※ 참여조건 : 진도율 90% 이상 / 집체교육 참석 완료 (집체교육일 : @d.time.ToShortDateString())

*@ - } - else if (d.dtype > 1) - { -

참여조건 : 진도율 @(d.intval2)% 이상 / 집체교육 참석일 (@d.time.ToShortDateString()) 전 까지

- } -
- @*=d.intval2?"02":"01")">@(d.intval4 == 1 ? "[평가완료]" : d.intval3 == 1 ? "[참여완료]" : d.intval3 == 0 && d.intval >=d.intval2 ? "[참여가능]" : "[참여불가]")*@ - =d.intval2?"02":"01")">@(d.intval4 == 1 ? "[평가완료]" : d.intval3 == 1 ? "[참여완료]" : d.intval3 == 0 && d.intval >=d.intval2 ? "[참여가능]" : "[참여불가]") - - =d.intval2?"02":"01")">@(d.intval4 == 1 ? "[평가완료]" : d.intval3 == 1 ? "[참여완료]" : d.intval3 == 0 && d.intval >=d.intval2 ? "[참여가능]" : "[참여불가]") - + + + + + = d.intval2 ? "02" : "01")">@(d.intval4 == 1 ? "[평가완료]" : d.intval3 == 1 ? "[참여완료]" : d.intval3 == 0 && d.intval >= d.intval2 ? "[참여가능]" : "[참여불가]") + + + + + = d.intval2 ? "02" : "01")">@(d.intval4 == 1 ? "[평가완료]" : d.intval3 == 1 ? "[참여완료]" : d.intval3 == 0 && d.intval >= d.intval2 ? "[참여가능]" : "[참여불가]") + + = d.intval2 ? "02" : "01")">@(d.intval4 == 1 ? "[평가완료]" : d.intval3 == 1 ? "[참여완료]" : d.intval3 == 0 && d.intval >= d.intval2 ? "[참여가능]" : "[참여불가]") +
- @if (Model.tabidx == 0 || Model.tabidx == 1) - { -

※ 24년 8월 22일 부터 건설기술진흥법 변경으로 집체교육 당일 교육장에서 시험평가가 진행됩니다.

- } -

- 평가할 항목이 없습니다.

+

- 평가할 항목이 없습니다.

@if (Model.tabidx == 0 || Model.tabidx == 1) - { -

※ 24년 8월 22일 부터 건설기술진흥법 변경으로 집체교육 당일 교육장에서 시험평가가 진행됩니다.

+ { // 전체, 시험 탭 + if (dType1CmStudyTime != 16 && dType1LectSDate > Convert.ToDateTime("2024-08-19 23:59:59")) + { +

※ 24년 8월 22일 부터 건설기술진흥법 변경으로 집체교육 당일 교육장에서 시험평가가 진행됩니다.

+ } } -

현재 진도율: @Model.Datas.Where(w => w.dtype == -1).First().intval5 %

+

현재 진도율: @currentProgresRate %

+ +
@Html.HiddenFor(m => m.croomlectno) @Html.HiddenFor(m => m.croomcmno) @Html.HiddenFor(m => m.tabidx) @Html.HiddenFor(m => m.estno)
+ @section scriptsHeader{ } + @section scripts{ +} +@functions { + + /// + /// 시작일~종료일이 범위내에 속해있는지 확인 + /// + /// 시작일 + /// 종료일 + /// true/false + public bool IsDateInRange(DateTime startDate, DateTime endDate) + { + // 현재일자 + DateTime currentDate = DateTime.Now; + // 현재일자가 시작일 이상 && 종료일 이하인지 확인 + return startDate <= currentDate && currentDate <= endDate; + } + } \ No newline at end of file