6432. 개발건 (적용은 안함)

This commit is contained in:
iyak 2025-01-23 00:27:39 +00:00
parent 31ad5fe636
commit bf9fc91992
4 changed files with 236 additions and 138 deletions

View File

@ -1072,29 +1072,31 @@ 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;//첨부파일 만들기
@ -1102,21 +1104,13 @@ namespace NP.Base
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);
//}
}
catch (Exception ex)
{
@ -1127,6 +1121,7 @@ namespace NP.Base
return 1;
}
/// <summary>
/// 메일발송 (추가)
/// </summary>
@ -1165,6 +1160,7 @@ namespace NP.Base
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;
@ -1211,7 +1207,6 @@ namespace NP.Base
int smtpport = Convert.ToInt32(smtp[2].Replace(" ", ""));
string smtpid = smtp[3];
string smtppw = smtp[4];
try
{
var mail = new System.Web.Mail.MailMessage();
@ -1221,9 +1216,7 @@ namespace NP.Base
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;
}
/// <summary>
/// mmstype (0: mms, 1: mmsurl, 7: html
/// </summary>

View File

@ -352,10 +352,8 @@ namespace NP.Base.Controllers
"아래 링크를 클릭하셔서 비밀번호를 재설정해주세요.<br /><br />" +
"<a href=\"" + fronturl + "/Account/FindMe?pwcallno=" + pwcallno + "&userno=" + user.userno + "\" target=\"_blank\" style=\"color: #0094ff;\">비밀번호 재설정</a><br /><br />이 링크는 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
{

View File

@ -439,22 +439,28 @@
) c on c.rscqno is not null
where a.lectno=#lectno# and a.userno=#userno# and a0.lectno is null
</update>
<!-- 시험응시/과제제출 리스트 -->
<select id="cr.myestimation" parameterClass="hashtable" resultClass="data">
select a.*
from (
select 0 dtype
,null strval,0 intval10
,0 intval,0 intval2,0 intval3,0 intval4,0 intval5
,0 intval6
,0 rno
,null time
,null time2
from (select 1 col1) a
where a.col1=0
union all
select -1 dtype
,null strval,0 intval10
,0 intval,0 intval2,0 intval3,0 intval4,a.attrate intval5
,0 intval6
,0 rno
,null time
,null time2
from lect a
where a.lectno=#lectno# and a.userno=#userno#
<isNotNull property="exam">
@ -466,8 +472,10 @@
,case when c.eend is null then 0 else 1 end intval3
,a.attrate intval5
,null intval4
,a2.studytime intval6
,row_number() over (partition by b.extype order by b.extype, b.cdt) rno
,a.edate time
,a.sdate time2
from lect a
inner join cm a2 on a2.cmno=a.cmno
inner join cmex b on b.cmno=a.cmno and b.isdel=0
@ -483,8 +491,10 @@
,case when c.submittime is null then 0 else 1 end intval3
,case when c.checktime is null then 0 else 1 end intval4
,a.attrate intval5
,a2.studytime intval6
,row_number() over (order by b.cdt) rno
,a.edate time
,a.sdate time2
from lect a
inner join cm a2 on a2.cmno=a.cmno
inner join cmsd b on b.cmno=a.cmno and b.sdtype=0 and b.isdel=0
@ -500,8 +510,10 @@
,case when count(d.bno) &gt; 0 then 1 else 0 end intval3
,case when c.checktime is null then 0 else 1 end intval4
,a.attrate intval5
,a2.studytime intval6
,row_number() over (order by b.cdt) rno
,a.edate time
,a.sdate time2
from lect a
inner join cm a2 on a2.cmno=a.cmno
inner join cmsd b on b.cmno=a.cmno and b.sdtype=1 and b.isdel=0
@ -513,6 +525,7 @@
) a
order by a.dtype,a.rno
</select>
<select id="cr.lectex" parameterClass="hashtable" resultClass="lectex">
select a.lectno,a.attrate,a.iscomplete,a.sdate,a.edate
,b.sstime,b.setime

View File

@ -1,72 +1,145 @@
@model NP.Model.VMCRoom
@{
// 1. 하단 문구에서 사용
// 1-1)최종평가 일때 cm.studytime 값 intval6
int dType1CmStudyTime = Model.Datas
.Where(w => w.dtype == 1)
.Select(s => s.intval6)
.SingleOrDefault();
// 1-2)최종평가 일때 lect.sdate
DateTime dType1LectSDate = Model.Datas
.Where(w => w.dtype == 1)
.Select(s => s.time2)
.SingleOrDefault();
// 예외처리 과정코드들?
List<long> allowLectNos = Array
.ConvertAll("104069,102553,105325,104402,106226,62683,104419".Split(','), long.Parse)
.ToList();
// 현재 진도율
int currentProgresRate = Model.Datas.Where(w => w.dtype == -1).FirstOrDefault().intval5;
}
<ul class="lctpTab col3">
<li class="@(Model.tabidx == 0 ? "current" : "")"><a onclick="gotab(0, this)" style="@(Model.tabidx == 0 ? "cursor: default;" : "")" href="#;">전체</a></li>
<li class="@(Model.tabidx == 1 ? "current" : "")"><a onclick="gotab(1, this)" style="@(Model.tabidx == 1 ? "cursor: default;" : "")" href="#">시험</a></li>
<li class="@(Model.tabidx == 2 ? "current" : "")"><a onclick="gotab(2, this)" style="@(Model.tabidx == 2 ? "cursor: default;" : "")" href="#">과제</a></li>
@*<li class="@(Model.tabidx == 3 ? "current":"")"><a onclick="gotab(3, this)" style="@(Model.tabidx == 3 ? "cursor: default;":"")" href="#">토론</a></li>*@
</ul>
@*@if (Model.tabidx == 0 || Model.tabidx == 3)
{
<div style="color: #0094ff; text-align: right;">※ 토론은 참여완료 후에도 추가로 참여할 수 있습니다.</div>
}*@
<div class="evaList">
<input type="hidden" id="hdndType1StudyTime" value="@dType1CmStudyTime" />
<input type="hidden" id="hdnlectSDate" value="@dType1LectSDate" />
<input type="hidden" id="hdnCurrentProgresRate" value="@currentProgresRate" />
<table>
<tbody>
@{
List<long> 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))
{
if(allowLectNos.IndexOf(Model.croomlectno) > -1)
{
ViewBag.exCheck = true;
}
ViewBag.exCheck = allowLectNos.IndexOf(Model.croomlectno) > -1 ? true : false;
<tr>
<th>
@* 아래에 주석친 부분들은 2025년3월에 롤백될 예정 *@
<h5><b>@(d.dtype == 0 ? "진행평가":d.dtype==1?"최종평가":d.dtype == 2?"과제":d.dtype==3?"토론":"")</b><span> @d.strval</span></h5>
@*
// 당구장 설명
/*
① 16시간 교육O or 신청일이 2024-08-19 이전: 참여조건 표기
② 16시간 교육X or 신청일이 2024-08-19 이후: ※ 집체교육일에 교육장에서 평가진행
// 3월이후에 아래 내용으로 복원한다 (dtype = 1 안에 if 문 조정)
<p>※ 참여조건 : 진도율 90% 이상 / 집체교육 참석 완료 (집체교육일 : @d.time.ToShortDateString())</p>
*/
*@
<h5>
<b>@(d.dtype == 0 ? "진행평가" : d.dtype == 1 ? "최종평가" : d.dtype == 2 ? "과제" : d.dtype == 3 ? "토론" : "")</b><span> @d.strval</span>
</h5>
@if (d.dtype == 1)
{
<p>※ 집체교육일에 교육장에서 평가진행</p>
@*<p>※ 참여조건 : 진도율 90% 이상 / 집체교육 참석 완료 (집체교육일 : @d.time.ToShortDateString())</p>*@
}
else if (d.dtype > 1)
{ // 최종평가
if (d.intval6 == 16 && d.time2 < Convert.ToDateTime("2024-08-19 00:00:00"))
{
<p>참여조건 : 진도율 @(d.intval2)% 이상 / 집체교육 참석일 (@d.time.ToShortDateString()) 전 까지</p>
}
else
{
<p>※ 집체교육일에 교육장에서 평가진행</p>
}
}
else if (d.dtype > 1)
{ // 기타
<p>참여조건 : 진도율 @(d.intval2)% 이상 / 집체교육 참석일 (@d.time.ToShortDateString()) 전 까지</p>
}
</th>
@if (d.dtype == 1 && ViewBag.exCheck == false)
@*
// 시험 응시 버튼
/*
시험응시가능조건(①, ② 필수 / ③or④)
① 관리자가 시험등록 시 설정한 진도율 조건 만족 < -현재 되어 있음
② lect.sdate ~lect.edate 기간 내일 경우(현재 없음.어딘가 기능은 있을텐데.....)
③ 집합교육이 출석 상태
④ 16시간 교육
// 3월이후에 아래 내용으로 복원한다 (dtype = 1 안에 if 문 조정)
<a href="javascript:;" onclick="msg('시험 응시 조건이 충족되지 않아 시험평가 진행이 불가합니다. <br>진도율 90% 이상, 집체교육 출석 완료')"
class="evaType@(d.intval4==1?"04":d.intval3==1?"03":d.intval3==0 && d.intval >=d.intval2?"02":"01")">@(d.intval4 == 1 ? "[평가완료]" : d.intval3 == 1 ? "[참여완료]" : d.intval3 == 0 && d.intval >=d.intval2 ? "[참여가능]" : "[참여불가]")</a>
*/
*@
@if (d.dtype == 1)
{
// 최총 평가일 때
if (
((currentProgresRate >= d.intval2) && IsDateInRange(d.time2, d.time)) ||
ViewBag.exCheck ||
dType1CmStudyTime == 16
)
{
<td>
@*<a href="javascript:;" onclick="msg('시험 응시 조건이 충족되지 않아 시험평가 진행이 불가합니다. <br>진도율 90% 이상, 집체교육 출석 완료')"
class="evaType@(d.intval4==1?"04":d.intval3==1?"03":d.intval3==0 && d.intval >=d.intval2?"02":"01")">@(d.intval4 == 1 ? "[평가완료]" : d.intval3 == 1 ? "[참여완료]" : d.intval3 == 0 && d.intval >=d.intval2 ? "[참여가능]" : "[참여불가]")</a>*@
<a href="#" onclick="msg('24년 8월 22일 부터 건설기술진흥법 변경으로 <br>집체교육 당일 교육장에서 시험평가가 진행됩니다.')"
<input type="hidden" name="cmEcondition" value="@d.intval2" />
<input type="hidden" name="lectSDate" value="@d.time2" />
<input type="hidden" name="lectEDate" value="@d.time" />
<input type="hidden" name="isDateInRange" value="@IsDateInRange(d.time2, d.time).ToString()" />
<a href="javascript:;" onclick="eva(@d.dtype, @d.intval10, @(d.intval4 == 1 ? 4 : d.intval3 == 1 ? 3 : d.intval3 == 0 && d.intval >= d.intval2 ? 2 : 1))"
class="evaType@(d.intval4 == 1 ? "04" : d.intval3 == 1 ? "03" : d.intval3 == 0 && d.intval >= d.intval2 ? "02" : "01")">@(d.intval4 == 1 ? "[평가완료]" : d.intval3 == 1 ? "[참여완료]" : d.intval3 == 0 && d.intval >= d.intval2 ? "[참여가능]" : "[참여불가]")</a>
</td>
}
else
{
<td>
<a href="#" onclick="eva(@d.dtype, @d.intval10, @(d.intval4==1?4:d.intval3==1?3:d.intval3==0 && d.intval >=d.intval2?2:1))"
<input type="hidden" name="cmEcondition" value="@d.intval2" />
<input type="hidden" name="lectSDate" value="@d.time2" />
<input type="hidden" name="lectEDate" value="@d.time" />
<a href="javascript:;" onclick="msg('24년 8월 22일 부터 건설기술진흥법 변경으로 <br>집체교육 당일 교육장에서 시험평가가 진행됩니다.')"
class="evaType@(d.intval4 == 1 ? "04" : d.intval3 == 1 ? "03" : d.intval3 == 0 && d.intval >= d.intval2 ? "02" : "01")">@(d.intval4 == 1 ? "[평가완료]" : d.intval3 == 1 ? "[참여완료]" : d.intval3 == 0 && d.intval >= d.intval2 ? "[참여가능]" : "[참여불가]")</a>
</td>
}
}
}
else
{
// 과제 등...
<td>
<a href="javascript:;" onclick="eva(@d.dtype, @d.intval10, @(d.intval4 == 1 ? 4 : d.intval3 == 1 ? 3 : d.intval3 == 0 && d.intval >= d.intval2 ? 2 : 1))"
class="evaType@(d.intval4 == 1 ? "04" : d.intval3 == 1 ? "03" : d.intval3 == 0 && d.intval >= d.intval2 ? "02" : "01")">@(d.intval4 == 1 ? "[평가완료]" : d.intval3 == 1 ? "[참여완료]" : d.intval3 == 0 && d.intval >= d.intval2 ? "[참여가능]" : "[참여불가]")</a>
</td>
}
</tr>
}
@*
// 하단 문구
// - 16시간 교육X or 신청일이 2024-08-19 이후
*@
@if (Model.Datas.Where(w => w.dtype > -1).Count() < 1)
{
<tr>
<th colspan="2" style="text-align: center; font-weight: normal; height: 100px;">
@if (Model.tabidx == 0 || Model.tabidx == 1)
{
<p><b>※ 24년 8월 22일 부터 건설기술진흥법 변경으로 집체교육 당일 교육장에서 시험평가가 진행됩니다.</b></p>
}
<p>- 평가할 항목이 없습니다.</p>
</th>
</tr>
@ -76,43 +149,77 @@
<tr>
<th colspan="2" style="text-align: center; font-weight: normal; height: 100px;">
@if (Model.tabidx == 0 || Model.tabidx == 1)
{ // 전체, 시험 탭
if (dType1CmStudyTime != 16 && dType1LectSDate > Convert.ToDateTime("2024-08-19 23:59:59"))
{
<p><b>※ 24년 8월 22일 부터 건설기술진흥법 변경으로 집체교육 당일 교육장에서 시험평가가 진행됩니다.</b></p>
}
<p>현재 진도율: @Model.Datas.Where(w => w.dtype == -1).First().intval5 %</p>
}
<p>현재 진도율: @currentProgresRate <text>%</text></p>
</th>
</tr>
}
</tbody>
</table>
</div>
<form id="mform" action="/CRoom/Estimation?@Model.croomparam" method="get">
@Html.HiddenFor(m => m.croomlectno)
@Html.HiddenFor(m => m.croomcmno)
@Html.HiddenFor(m => m.tabidx)
@Html.HiddenFor(m => m.estno)
</form>
@section scriptsHeader{
}
@section scripts{
<script>
$(document).ready(function () {
});
/**
* 탭 변경
* @@param idx {int} - 탭번호 (0:전체, 1:평가, 2:과제)
* @@param a {event} - e
*/
function gotab(idx, a) {
if (!$(a).parent().hasClass("current")){
setv("tabidx", idx);
submit();
}
}
function eva(type, no, status) {
if (status == 1) {
msg("진도율 조건에 맞지않거나 수강일이 종료되어 참여하실 수 없습니다.");
} else {
}
else {
setv("estno", no);
$("#mform").attr("action", "/CRoom/Estimation" + (type < 2 ?"Exam":type==2?"Subject":"Discuss")).submit();
}
}
</script>
}
@functions {
/// <summary>
/// 시작일~종료일이 범위내에 속해있는지 확인
/// </summary>
/// <param name="startDate">시작일</param>
/// <param name="endDate">종료일</param>
/// <returns>true/false</returns>
public bool IsDateInRange(DateTime startDate, DateTime endDate)
{
// 현재일자
DateTime currentDate = DateTime.Now;
// 현재일자가 시작일 이상 && 종료일 이하인지 확인
return startDate <= currentDate && currentDate <= endDate;
}
}