2025-10-01 16:59:10 +09:00
using Newtonsoft.Json ;
2025-09-25 17:05:25 +09:00
using Newtonsoft.Json.Linq ;
using NP.Model ;
using System ;
using System.Collections ;
2020-10-12 14:39:23 +09:00
using System.Collections.Generic ;
using System.Linq ;
2025-10-01 16:59:10 +09:00
using System.Text.RegularExpressions ;
2020-10-12 14:39:23 +09:00
using System.Web ;
2025-09-25 17:05:25 +09:00
using System.Web.Mvc ;
2020-12-10 10:57:07 +09:00
2025-12-11 14:32:17 +09:00
namespace NP.Base.Controllers {
public partial class FOCommonController : NP . Base . BaseController {
protected override void OnActionExecuting ( ActionExecutingContext filterContext ) {
2020-10-12 14:39:23 +09:00
base . OnActionExecuting ( filterContext ) ;
}
2025-12-11 14:32:17 +09:00
protected override void OnException ( ExceptionContext filterContext ) {
2020-10-12 14:39:23 +09:00
base . OnException ( filterContext ) ;
2025-12-11 14:32:17 +09:00
if ( Request . IsAjaxRequest ( ) ) {
2020-10-12 14:39:23 +09:00
filterContext . Result = new RedirectResult ( "/Account/NoPermit?_code=" + NP . Base . ENUM . JSONCode . Error + "&_msg=알수없는오류" ) ;
2025-12-11 14:32:17 +09:00
} else {
2020-10-12 14:39:23 +09:00
filterContext . Result = new RedirectResult ( "/Account/Error?_code=" + NP . Base . ENUM . JSONCode . Error + "&_msg=알수없는오류" ) ;
}
}
2025-12-11 14:32:17 +09:00
public JsonResult Html ( int pno ) {
2020-10-12 14:39:23 +09:00
return JsonBack ( Dao . Get < MenuPage > ( "mm.pages" , new Hashtable ( ) { { "pno" , pno } } ) . First ( ) ) ;
}
2025-12-11 14:32:17 +09:00
public JsonResult HidePop ( int pno ) {
2020-10-12 14:39:23 +09:00
var p = CookieGet ( "popup" , "" ) ;
CookieSet ( "popup" , p = = "" ? pno . ToString ( ) : ( p + "p" + pno ) , 7 ) ;
return JsonOK ( 1 ) ;
}
2025-12-11 14:32:17 +09:00
public void DownFile ( Int64 fno , int getdel = 0 , String loginfo = "" , int issubject = 0 ) {
2020-10-12 14:39:23 +09:00
Dao . Save ( "sys.file.down" , fno ) ;
var file = Dao . Get < File > ( "sys.file.get" + ( getdel > 0 ? "all" : "" ) , fno ) . FirstOrDefault ( ) ;
2025-10-01 16:59:10 +09:00
2025-12-11 14:32:17 +09:00
if ( Request . UrlReferrer = = null | | ( ! SUserInfo . IsAdmin & & file . tablename = = "lectsd" & & file . columnname = = "fgno" & & SUserInfo . UserNo ! = file . cno ) ) {
2020-10-12 14:39:23 +09:00
Response . Clear ( ) ;
Response . ClearHeaders ( ) ;
Response . ClearContent ( ) ;
Response . ContentType = "Application/octet-stream" ;
2025-12-11 14:32:17 +09:00
Response . AppendHeader ( "Content-Disposition" , "attachment;filename=" + Server . UrlEncode ( "권한없음.png" ) ) ;
2020-10-12 14:39:23 +09:00
Response . TransmitFile ( string . Format ( "{0}" , Server . MapPath ( "/img/repute_tail.png" ) ) ) ;
Response . Flush ( ) ;
Response . End ( ) ;
2025-12-11 14:32:17 +09:00
} else {
string fileurl = Server . MapPath ( ( issubject = = 1 ? file . fullurl2 : file . fullurl ) ) ;
2020-10-12 14:39:23 +09:00
Response . Clear ( ) ;
Response . ClearHeaders ( ) ;
2025-12-11 14:32:17 +09:00
Response . ClearContent ( ) ;
2025-02-25 10:22:13 +09:00
Response . ContentType = "text/plain" ;
2020-10-12 14:39:23 +09:00
Response . AppendHeader ( "Content-Disposition" , "attachment;filename=" + Server . UrlEncode ( file . orgname ) ) ;
Response . AppendHeader ( "Content-Length" , file . filesize . ToString ( ) ) ;
Response . TransmitFile ( string . Format ( "{0}" , fileurl ) ) ;
Response . Flush ( ) ;
Response . End ( ) ;
}
}
[HttpPost]
2025-12-11 14:32:17 +09:00
public JsonResult Login ( VMUser vm , String uid , String upw , int logincnt , bool issaveid ) {
if ( issaveid ) {
2020-10-12 14:39:23 +09:00
CookieSet ( "savedid" , uid ) ;
2025-12-11 14:32:17 +09:00
} else {
2020-10-12 14:39:23 +09:00
CookieClear ( "savedid" ) ;
}
2025-07-23 13:21:57 +09:00
2025-12-11 14:32:17 +09:00
if ( ! string . IsNullOrEmpty ( uid ) & & ! string . IsNullOrEmpty ( upw ) ) {
2020-10-12 14:39:23 +09:00
var u = GoLogin ( uid , upw ) ;
2025-07-23 13:21:57 +09:00
2025-12-11 14:32:17 +09:00
if ( u ! = null ) {
if ( u . intv1 = = 1 ) {
2024-01-05 08:47:23 +09:00
+ + logincnt ;
2025-12-11 14:32:17 +09:00
if ( logincnt > 4 ) {
2024-01-05 08:47:23 +09:00
Dao . Save ( "users.disable" , new Hashtable ( ) { { "userno" , u . userno } } ) ;
}
return JsonBack ( new JsonRtn ( ) { code = 1000 , msg = "-4" , obj = u . userno } ) ;
2021-12-14 15:37:46 +09:00
}
2024-08-26 10:56:50 +09:00
if ( u . intv1 = = 2 | | u . status = = 8 ) // 휴면상태 포함
2024-01-19 16:56:15 +09:00
{
// 비활성 상태(비번 5회 이상)
return JsonBack ( new JsonRtn ( ) { code = 1000 , msg = "-5" , obj = u . userno } ) ;
2025-12-11 14:32:17 +09:00
} else {
2024-01-05 08:47:23 +09:00
2025-12-11 14:32:17 +09:00
if ( u . userno < 0 ) {
2024-01-05 08:47:23 +09:00
return JsonBack ( new JsonRtn ( ) { code = 1000 , obj = - 1 , msg = u . subdomain } ) ;
}
//비밀번호 변경 90일 경과
2025-12-11 14:32:17 +09:00
if ( u . udt . AddDays ( 90 ) < DateTime . Now ) {
2024-01-05 08:47:23 +09:00
return JsonBack ( new JsonRtn ( ) { code = 1000 , msg = "-2" , obj = u . userno } ) ;
}
// 휴면상태
2025-12-11 14:32:17 +09:00
if ( u . status = = 8 ) {
2024-01-05 08:47:23 +09:00
return JsonBack ( new JsonRtn ( ) { code = 1000 , msg = "-3" , obj = u . userno } ) ;
}
2025-07-23 13:21:57 +09:00
2025-12-11 14:32:17 +09:00
if ( u . status = = 98 ) {
2025-07-23 13:21:57 +09:00
// 탈퇴신청중
u = null ;
CookieClear ( null , true ) ;
return JsonBack ( new JsonRtn ( ) { code = 1000 , msg = "-6" , obj = null } ) ;
}
2024-01-05 08:47:23 +09:00
return JsonOK ( u . userno ) ;
2021-12-14 15:37:46 +09:00
}
2020-10-12 14:39:23 +09:00
}
}
return JsonOK ( 0 ) ;
}
2021-12-14 15:37:46 +09:00
/// <summary>
/// 비밀번호 변경 저장 (비밀번호 변경 90일 지난 사용자)
/// </summary>
/// <param name="vm"></param>
/// <returns></returns>
2025-12-11 14:32:17 +09:00
public JsonResult PwChange ( VMUser vm ) {
if ( string . IsNullOrEmpty ( vm . User . userpass ) | | vm . User . userpass . Trim ( ) = = "" ) {
2021-12-14 15:37:46 +09:00
Dao . Save ( "users.resetuserpass" , new Hashtable ( ) { { "userno" , vm . userno } } ) ;
return JsonOK ( 1 ) ;
}
2025-12-11 14:32:17 +09:00
if ( vm . userno > 0 & & ! string . IsNullOrEmpty ( vm . User . userpass ) & & vm . User . userpass . Trim ( ) ! = "" ) {
2023-03-13 10:30:27 +09:00
//if (Dao.Save("users.resetuserpass", new Hashtable() { { "userpass", NP.Base.Lib.KISA_SHA256.SHA256Hash(vm.User.userpass) }, { "userno", vm.userno } }) == 1)
//{
// var u = GoLogin(vm.User.userid, vm.User.userpass);
// if (u != null)
// {
// return JsonOK(1);
// }
//}
2025-12-11 14:32:17 +09:00
if ( Dao . Save ( "users.resetuserpass" , new Hashtable ( ) { { "userpass" , NP . Base . Lib . KISA_SHA256 . SHA256Hash ( vm . User . userpass ) } , { "userno" , vm . userno } } ) > 0 ) {
2021-12-14 15:37:46 +09:00
var u = GoLogin ( vm . User . userid , vm . User . userpass ) ;
2025-12-11 14:32:17 +09:00
if ( u ! = null ) {
2021-12-14 15:37:46 +09:00
return JsonOK ( 1 ) ;
}
}
}
return JsonOK ( 0 ) ;
}
/// <summary>
/// 휴면해제
/// </summary>
/// <param name="userno"></param>
/// <returns></returns>
2025-12-11 14:32:17 +09:00
public JsonResult DormantCancel ( int userno ) {
if ( Dao . Get < Users > ( "users.dormants" , new Hashtable ( ) { { "userno" , userno } } ) . Count ( ) < 1 ) {
2021-12-14 15:37:46 +09:00
return JsonBack ( new JsonRtn ( ) { code = 1 } ) ;
}
var result = Dao . Save ( "users.dormant.cancel" , new Hashtable ( ) { { "usernos" , userno } , { "uno" , SUserInfo . UserNo } , { "uip" , GetUserIP ( ) } } ) ;
var user = Dao . Get < Users > ( "users.findmes" , new Hashtable ( ) { { "userno" , userno } } ) . FirstOrDefault ( ) ;
2025-12-11 14:32:17 +09:00
if ( user ! = null ) {
2021-12-14 15:37:46 +09:00
var u = GoLogin ( user . userid , "rhksflwkfhrmdls999" ) ;
2025-12-11 14:32:17 +09:00
if ( u ! = null ) {
2021-12-14 15:37:46 +09:00
return JsonOK ( result ) ;
2025-12-11 14:32:17 +09:00
} else {
2021-12-14 15:37:46 +09:00
return JsonBack ( new JsonRtn ( ) { code = 2 } ) ;
}
}
return JsonOK ( 0 ) ;
}
2020-10-12 14:39:23 +09:00
[HttpPost]
2025-12-11 14:32:17 +09:00
public JsonResult GetBoards ( int btype , int pn , int prc , String sc ) {
2020-10-12 14:39:23 +09:00
return JsonBackList < Board > ( Dao . Get < Board > ( "board.list" , new Hashtable ( ) { { "BType" , btype } , { "SubjectContents" , sc . Trim ( ) = = "" ? null : sc . Trim ( ) } , { "PAGENUM" , pn } , { "PAGEROWSIZE" , prc } } ) ) ;
}
[HttpPost]
2025-12-11 14:32:17 +09:00
public JsonResult CMInnings ( int cmno ) {
2020-10-12 14:39:23 +09:00
return JsonBack ( Dao . Get < CMInning > ( "cm.cminnings" , new System . Collections . Hashtable ( ) { { "cmno" , cmno } } ) ) ;
}
[HttpPost]
2025-12-11 14:32:17 +09:00
public JsonResult CMRelays ( int cmno ) {
2020-10-12 14:39:23 +09:00
var cms = Dao . Get < CM > ( "cm.cmrelays" , new System . Collections . Hashtable ( ) { { "cmno" , cmno } , { "userno" , SUserInfo . UserNo } } ) ;
return JsonBack ( new Hashtable ( ) { { "pre" , cms . Where ( w = > w . ispre = = 1 ) . ToList ( ) } , { "after" , cms . Where ( w = > w . ispre = = 0 ) . ToList ( ) } } ) ;
}
[HttpPost]
2025-12-11 14:32:17 +09:00
public JsonResult AssignFind ( String brno , int? pno ) {
2020-10-12 14:39:23 +09:00
brno = ( brno ? ? "" ) . Replace ( "-" , "" ) ;
return JsonBack ( Dao . Get < Assign > ( "users.assigns" , new Hashtable ( ) { { "brno" , brno } , { "pagenum" , pno } , { "pagerowsize" , 10 } } ) ) ;
}
[HttpPost]
2025-12-11 14:32:17 +09:00
public JsonResult AssignSave ( String brno , String asname , String ceoname ) {
var ht = new Hashtable ( ) { { "asno" , 0 } , { "isjoin" , 0 } , { "ascode" , Dao . Get < int > ( "users.assign.newascode" , 1 ) . First ( ) } , { "joinprice" , 0 } , { "asname" , asname } , { "brno" , brno . Replace ( "-" , "" ) } , { "ceoname" , ceoname } , { "salesamount" , 0 } , { "mcount" , 0 } , { "status" , 1 } , { "isdel" , 0 } , { "uno" , SUserInfo . UserNo } , { "uip" , GetUserIP ( ) } } ;
2020-10-12 14:39:23 +09:00
Dao . Insert ( "users.assign.in" , ht ) ;
return JsonOK ( GetInt ( ht [ "asno" ] ) ) ;
}
[HttpPost]
2025-12-11 14:32:17 +09:00
public JsonResult Join ( Users u ) {
2020-10-12 14:39:23 +09:00
u . uip = GetUserIP ( ) ;
//이메일, 아이디 중복 체크
2025-12-11 14:32:17 +09:00
var u129 = Dao . Get < int > ( "users.checkuser" , new Hashtable ( ) { { "userid" , u . userid } , { "email" , u . email } , { "mobile" , u . mobile } } ) . First ( ) ;
if ( u129 ! = 9 ) {
2020-10-12 14:39:23 +09:00
return JsonOK ( u129 * - 1 ) ;
}
u . userpass = NP . Base . Lib . KISA_SHA256 . SHA256Hash ( u . userpass . Trim ( ) ) ;
2020-10-28 14:36:43 +09:00
u . birthday = u . birthday ! = null & & u . birthday . Length = = 8 ? ( u . birthday ? ? "" ) . Substring ( 0 , 4 ) + "-" + ( u . birthday ? ? "" ) . Substring ( 4 , 2 ) + "-" + ( u . birthday ? ? "" ) . Substring ( 6 , 2 ) : null ;
2020-10-12 14:39:23 +09:00
u . usertype = u . status = 1 ;
Dao . Insert ( "users.in" , u ) ;
return JsonOK ( u . userno ) ;
}
2024-05-21 16:29:40 +09:00
// 이후 전문건설과 같이 본인인증시 팝업을 제한할 경우 Join -> Join_new 서로 매서드 변경할것
2025-12-11 14:32:17 +09:00
public JsonResult Join_new ( Users u ) {
if ( ! string . IsNullOrWhiteSpace ( u . zstring0 ) ) {
2024-05-02 12:42:16 +09:00
// 인증 후 okcert3log.no와 sn 값으로 인증된 결과값 가져오기
string decStr = DecString ( u . zstring0 ) ;
string [ ] tempArr = decStr . Split ( ',' ) ;
string gubn = tempArr [ 2 ] ;
ViewBag . reason = tempArr [ 3 ] ;
ViewBag . rsltCd = tempArr [ 4 ] ;
string certiOkData = Dao . Get < string > ( "sys.okcert3.get" , new Hashtable { { "no" , tempArr [ 0 ] } , { "sn" , tempArr [ 1 ] } } ) . FirstOrDefault ( ) ;
JObject data = JObject . FromObject ( JsonConvert . DeserializeObject ( certiOkData ) ) ;
// 인증 후 강제로 수정된 정보를 인증 정보로 대체하기
u . username = data [ "RSLT_NAME" ] . ToString ( ) ;
u . ci = data [ "CI" ] . ToString ( ) ;
u . di = data [ "DI" ] . ToString ( ) ;
u . birthday = data [ "RSLT_BIRTHDAY" ] . ToString ( ) ;
2025-12-11 14:32:17 +09:00
if ( gubn = = "MOBI" ) {
2024-05-02 12:42:16 +09:00
u . mobile = data [ "TEL_NO" ] = = null ? "" : data [ "TEL_NO" ] . ToString ( ) ;
}
u . vssn = data [ "VSSN" ] = = null ? "" : data [ "VSSN" ] . ToString ( ) ;
u . uip = GetUserIP ( ) ;
//이메일, 아이디 중복 체크
var u129 = Dao . Get < int > ( "users.checkuser" , new Hashtable ( ) { { "userid" , u . userid } , { "email" , u . email } , { "mobile" , u . mobile } } ) . First ( ) ;
2025-12-11 14:32:17 +09:00
if ( u129 ! = 9 ) {
2024-05-02 12:42:16 +09:00
return JsonOK ( u129 * - 1 ) ;
}
u . userpass = NP . Base . Lib . KISA_SHA256 . SHA256Hash ( u . userpass . Trim ( ) ) ;
u . birthday = u . birthday ! = null & & u . birthday . Length = = 8 ? ( u . birthday ? ? "" ) . Substring ( 0 , 4 ) + "-" + ( u . birthday ? ? "" ) . Substring ( 4 , 2 ) + "-" + ( u . birthday ? ? "" ) . Substring ( 6 , 2 ) : null ;
u . usertype = u . status = 1 ;
Dao . Insert ( "users.in" , u ) ;
return JsonOK ( u . userno ) ;
2025-12-11 14:32:17 +09:00
} else {
2024-05-02 12:42:16 +09:00
return JsonOK ( 0 ) ;
}
}
2020-10-12 14:39:23 +09:00
[HttpPost]
2025-12-11 14:32:17 +09:00
public JsonResult FindMe ( String email ) {
2020-10-12 14:39:23 +09:00
if ( string . IsNullOrEmpty ( email ) ) { return JsonOK ( - 1 ) ; }
email = email . Replace ( " " , "" ) . Replace ( " " , "" ) ;
List < Users > users = new List < Users > ( ) { } ;
2025-12-11 14:32:17 +09:00
2020-10-12 14:39:23 +09:00
bool IsEmail = false ;
2025-12-11 14:32:17 +09:00
if ( email . Contains ( "@" ) ) {
2020-10-12 14:39:23 +09:00
IsEmail = true ;
users = Dao . Get < Users > ( "users.findme" , new Hashtable ( ) { { "email" , email } } ) . ToList ( ) ;
2025-12-11 14:32:17 +09:00
if ( users . Count ( ) < 1 ) {
2021-12-14 15:37:46 +09:00
// user 테이블 검색 뒤 없을 경우 휴면테이블에서 검색
users = Dao . Get < Users > ( "users.findmes" , new Hashtable ( ) { { "email" , email } } ) . ToList ( ) ;
}
2020-10-12 14:39:23 +09:00
}
2025-12-11 14:32:17 +09:00
if ( users . Count ( ) ! = 1 ) {
2020-10-12 14:39:23 +09:00
//검색결과 2개 개정이라면 보내면 안됨..다른사람일 수도
return JsonOK ( - 1 ) ;
}
var user = users . First ( ) ;
2025-01-21 17:36:45 +09:00
2020-10-12 14:39:23 +09:00
//메시지 전송시간 기록
Random r = new Random ( ) ;
int pwcallno = r . Next ( 1 , 30000 ) ;
Dao . Save ( "users.pwcalltime" , new Hashtable ( ) { { "userno" , user . userno } , { "pwcallno" , pwcallno } } ) ;
var masteremail = GetConfig ( "masteremail" ) ;
String fronturl = GetConfig ( "fronturl" ) ;
2025-01-21 17:36:45 +09:00
2025-12-11 14:32:17 +09:00
if ( IsEmail & & users . Count = = 1 ) {
2025-10-01 16:59:10 +09:00
var MHtml = $"안녕하세요, {user.username}님,<br />당신의 영남건설기술교육원 비밀번호를 재설정하기 위한 링크를 전달합니다.<br />" +
$"아래 링크를 클릭하셔서 비밀번호를 재설정해주세요.<br /><br />" +
$"<a href=\" { fronturl } / Account / FindMe ? pwcallno = { pwcallno } & userno = { user . userno } \ " target=\"_blank\" style=\"color: #0094ff;\">비밀번호 재설정</a><br /><br />이 링크는 24시간 뒤 만료됩니다." ;
2025-09-25 17:05:25 +09:00
var mailResult = SendEmail ( masteremail . Split ( ';' ) [ 1 ] , GetInt ( masteremail . Split ( ';' ) [ 2 ] ) , masteremail . Split ( ';' ) [ 3 ] , masteremail . Split ( ';' ) [ 4 ] , 999 , user . email , masteremail . Split ( ';' ) [ 0 ] , "영남건설기술교육원 운영자" , "[영남건설기술교육원] 비밀번호 찾기 안내" , MHtml , "" , "0:0" ) ;
return JsonOK ( mailResult ) ;
2025-12-11 14:32:17 +09:00
} else {
2025-01-21 17:36:45 +09:00
return JsonOK ( 0 ) ;
}
2025-12-11 14:32:17 +09:00
2020-10-12 14:39:23 +09:00
}
[HttpPost]
2025-12-11 14:32:17 +09:00
public JsonResult FindMeFinal ( VMUser vm ) {
if ( vm . userno > 0 & & vm . pwcallno > 0 & & ! string . IsNullOrEmpty ( vm . User . userpass ) & & vm . User . userpass . Trim ( ) ! = "" ) {
if ( Dao . Save ( "users.resetuser" , new Hashtable ( ) { { "userpass" , NP . Base . Lib . KISA_SHA256 . SHA256Hash ( vm . User . userpass ) } , { "userno" , vm . userno } , { "pwcallno" , vm . pwcallno } } ) = = 1 ) {
2020-10-12 14:39:23 +09:00
//자동로그인처리
var u = GoLogin ( vm . User . userid , vm . User . userpass ) ;
2025-12-11 14:32:17 +09:00
if ( u ! = null ) {
2020-10-12 14:39:23 +09:00
return JsonOK ( 1 ) ;
}
}
}
return JsonOK ( 0 ) ;
}
[HttpPost]
2025-12-11 14:32:17 +09:00
public JsonResult MyPageLeftMenu ( String on ) {
2020-10-12 14:39:23 +09:00
CookieSet ( "mypageleftmenutoggle" , on ) ;
return JsonOK ( 1 ) ;
}
[HttpPost]
2025-12-11 14:32:17 +09:00
public JsonResult CRoomPageLeftMenu ( String on ) {
2020-10-12 14:39:23 +09:00
CookieSet ( "croompageleftmenutoggle" , on ) ;
return JsonOK ( 1 ) ;
}
[HttpPost]
2025-12-11 14:32:17 +09:00
public JsonResult IsAuth ( ) {
if ( SUserInfo . UserNo > 0 ) {
2020-10-12 14:39:23 +09:00
return JsonOK ( 1 ) ;
}
return JsonOK ( 0 ) ;
}
[HttpPost]
2024-06-24 12:45:12 +09:00
/// 반환값이 100일때 플레이바 및 다음페이지이동 허용
2025-12-11 14:32:17 +09:00
public JsonResult PRGRS ( Int64 lectno , Int64 cmino ) {
if ( SUserInfo . UserNo > 0 ) {
try {
2020-11-03 15:54:31 +09:00
return Json ( Dao . Get < int > ( "cr.getprogress" , new Hashtable ( ) { { "lectno" , lectno } , { "cmino" , cmino } } ) . First ( ) , JsonRequestBehavior . AllowGet ) ;
2025-12-11 14:32:17 +09:00
} catch ( Exception ex ) {
2020-11-03 15:54:31 +09:00
Console . WriteLine ( ex . Message ) ;
}
}
return Json ( - 1 , JsonRequestBehavior . AllowGet ) ;
2025-12-11 14:32:17 +09:00
}
2020-11-03 15:54:31 +09:00
[HttpPost]
2025-12-11 14:32:17 +09:00
public JsonResult StudyLog ( Int64 logno , Int64 lectno , Int64 cmino , int cpno , int studysec , int ispc , int nextcpno , int getiframe , int issample = 0 , int psec = 0 ) {
if ( SUserInfo . UserNo > 0 | | issample > 0 ) {
2020-10-12 14:39:23 +09:00
int rtn = 0 ;
2025-12-11 14:32:17 +09:00
if ( issample < 1 ) {
2020-10-12 14:39:23 +09:00
rtn = Dao . Save ( "cr.studylog" , new Hashtable ( ) { { "logno" , logno } , { "lectno" , lectno } , { "cmino" , cmino } , { "userno" , SUserInfo . UserNo } ,
{ "psec" , psec } ,
{ "cpno" , cpno } , { "studysec" , studysec } , { "ispc" , ispc } , { "uno" , SUserInfo . UserNo } , { "uip" , GetUserIP ( ) } } ) ;
}
2025-12-11 14:32:17 +09:00
if ( nextcpno > 0 ) {
2020-10-12 14:39:23 +09:00
String ua = "" ;
2025-12-11 14:32:17 +09:00
try {
2020-10-12 14:39:23 +09:00
ua = ( Request . UserAgent ? ? "" ) . ToLower ( ) ;
2025-12-11 14:32:17 +09:00
} catch ( Exception ex ) {
2020-10-12 14:39:23 +09:00
Logger . Error ( "ExamStart Get UserAgent Info Error" + ex . StackTrace ) ;
}
var lip = new LectInningPage ( ) { lectno = lectno , cmino = cmino , cpno = nextcpno , userno = SUserInfo . UserNo , uno = SUserInfo . UserNo , uip = GetUserIP ( ) , ispc = ispc , webkitinfo = ua } ;
2025-12-11 14:32:17 +09:00
if ( issample < 1 ) {
2020-10-12 14:39:23 +09:00
Dao . Insert ( "cr.lectinningpage.in" , lip ) ;
2025-12-11 14:32:17 +09:00
if ( lip . logno < 1 | | getiframe = = 0 ) {
2020-10-12 14:39:23 +09:00
return JsonOK ( lip . logno ) ;
}
}
return JsonBack ( new JsonRtn ( ) { code = 1000 , msg = Dao . Get < String > ( "cr.ctpage.iframe" , new Hashtable ( ) { { "cpno" , nextcpno } , { "src" , ispc > 1 ? "srcp" : "srcm" } } ) . First ( ) , obj = lip . logno } ) ;
}
return JsonOK ( rtn ) ;
2025-12-11 14:32:17 +09:00
} else {
2020-10-12 14:39:23 +09:00
return JsonOK ( 0 ) ;
}
}
[HttpPost]
2025-12-11 14:32:17 +09:00
public JsonResult StudyClose ( Int64 logno , int issample = 0 ) {
if ( SUserInfo . UserNo > 0 | | issample > 0 ) {
2021-08-23 15:10:15 +09:00
int rtn = 0 ;
2025-12-11 14:32:17 +09:00
if ( issample < 1 ) {
rtn = Dao . Save ( "cr.studyclose" , new Hashtable ( ) { { "logno" , logno } , { "uno" , SUserInfo . UserNo } , { "uip" , GetUserIP ( ) } } ) ;
2021-08-23 15:10:15 +09:00
}
return JsonOK ( rtn ) ;
2025-12-11 14:32:17 +09:00
} else {
2021-08-23 15:10:15 +09:00
return JsonOK ( 0 ) ;
}
}
[HttpPost]
2025-12-11 14:32:17 +09:00
public JsonResult checklectdate ( Int64 lectno ) {
2021-01-26 10:17:53 +09:00
Lect lect = Dao . Get < Lect > ( "cr.checklectdate" , new Hashtable ( ) { { "lectno" , lectno } } ) . First ( ) ;
if ( DateTime . Now < = lect . edate ) //lect.수강종료일 이후 클릭시, 학습만 허용하나 로그는 쌓지 않음
return Json ( new { result = 1 } ) ;
else
return Json ( new { result = - 1 } ) ;
}
[HttpPost]
2025-12-11 14:32:17 +09:00
public JsonResult StudyLogMid ( Int64 lectno , Int64 cmino ) {
if ( SUserInfo . UserNo > 0 ) {
2020-10-12 14:39:23 +09:00
return JsonOK ( Dao . Save ( "cr.studymid" , new Hashtable ( ) { { "lectno" , lectno } , { "cmino" , cmino } } ) ) ;
}
return JsonOK ( 0 ) ;
}
[HttpPost]
2025-12-11 14:32:17 +09:00
public JsonResult CheckInningChange ( Int64 lectno , Int64 cmino , bool ispre ) {
if ( SUserInfo . UserNo > 0 ) {
2020-10-12 14:39:23 +09:00
var cmi = Dao . Get < LectInning > ( "cr.inningchange." + ( ispre ? "pre" : "next" ) , new Hashtable ( ) { { "lectno" , lectno } , { "cmino" , cmino } } ) . FirstOrDefault ( ) ;
2025-12-11 14:32:17 +09:00
if ( cmi = = null ) {
2020-10-12 14:39:23 +09:00
return JsonBack ( new JsonRtn ( ) { code = 1000 , obj = - 1 } ) ;
2025-12-11 14:32:17 +09:00
} else if ( cmi . iseq > 1 & & cmi . precmino > 0 & & cmi . isseq = = 1 & & cmi . preistatus ! = 2 ) {
2020-10-12 14:39:23 +09:00
return JsonBack ( new JsonRtn ( ) { code = 1000 , obj = - 2 } ) ;
2025-12-11 14:32:17 +09:00
} else {
var intval = Dao . Get < LectInning > ( "cr.lectinnings" , new System . Collections . Hashtable ( ) { /*{ "lectno", lectno }*/ { "userno" , SUserInfo . UserNo } , { "isfinishtoday" , 1 } } ) . Count ( ) ;
if ( intval > Convert . ToInt32 ( ( GetConfig ( "inninglimit" ) ? ? "10" ) ) & & cmi . istatus < 2 ) {
2020-10-12 14:39:23 +09:00
return JsonBack ( new JsonRtn ( ) { code = 1000 , obj = - 3 } ) ;
}
}
return JsonOK ( cmi . cmino ) ;
}
return JsonOK ( 0 ) ;
}
2020-10-28 10:06:43 +09:00
[HttpPost]
2025-12-11 14:32:17 +09:00
public JsonResult idchk ( String id ) {
2020-10-28 10:06:43 +09:00
//이메일, 아이디 중복 체크
2025-12-11 14:32:17 +09:00
var u129 = Dao . Get < Users > ( "users.usersbyuserids" , new Hashtable ( ) { { "userids" , "'" + id + "'" } , { "usertype" , 1 } } ) ;
if ( u129 . Count ( ) > 0 ) {
2020-10-28 10:06:43 +09:00
return JsonOK ( - 1 ) ;
}
return JsonOK ( 1 ) ;
}
2020-11-04 17:04:10 +09:00
[HttpPost]
2025-12-11 14:32:17 +09:00
public JsonResult GetSubCm ( int cmno , int? studyplace = null ) {
2022-08-02 13:25:57 +09:00
//20220726 소스 정리
2025-12-11 14:32:17 +09:00
Hashtable hsData = new Hashtable ( ) ;
2022-08-02 13:25:57 +09:00
hsData . Add ( "cmno" , cmno ) ;
hsData . Add ( "studyplace" , studyplace ) ;
var result = Dao . Get < CM > ( "cm.subcms" , hsData ) . Where ( w = > w . isuse = = 1 ) . ToList ( ) ;
//var result = Dao.Get<CM>("cm.subcms", new System.Collections.Hashtable() { { "cmno", cmno }, { "studyplace", studyplace } }).Where(w => w.isuse == 1).ToList();
2020-11-04 17:04:10 +09:00
return JsonBack ( result ) ;
}
[HttpPost]
2025-12-11 14:32:17 +09:00
public JsonResult GetCmUser ( int cmno ) {
2020-12-10 15:19:50 +09:00
var comcodes = GetComCodes ( "typeman,typeedu,typegrade,typejob" , true ) ;
2020-11-04 17:04:10 +09:00
var result = Dao . Get < CM > ( "cm.cmuser" , new System . Collections . Hashtable ( ) { { "cmno" , cmno } } ) ;
2025-12-11 14:32:17 +09:00
foreach ( var r in result ) {
2020-12-10 15:19:50 +09:00
string [ ] typemanArr = r . typeman . Split ( ',' ) ;
2025-12-11 14:32:17 +09:00
for ( int i = 0 ; i < typemanArr . Length ; i + + ) {
2020-12-10 15:19:50 +09:00
r . typemans + = comcodes . Where ( x = > x . cgroup = = "typeman" & & x . ccode = = Convert . ToInt32 ( typemanArr [ i ] ) ) . FirstOrDefault ( ) . cname ;
2025-12-11 14:32:17 +09:00
if ( i < typemanArr . Length - 1 )
2020-12-10 15:19:50 +09:00
r . typemans + = "," ;
}
string [ ] typeeduArr = r . typeedu . Split ( ',' ) ;
2025-12-11 14:32:17 +09:00
for ( int i = 0 ; i < typeeduArr . Length ; i + + ) {
2020-12-10 15:19:50 +09:00
r . typeedus + = comcodes . Where ( x = > x . cgroup = = "typeedu" & & x . ccode = = Convert . ToInt32 ( typeeduArr [ i ] ) ) . FirstOrDefault ( ) . cname ;
if ( i < typeeduArr . Length - 1 )
r . typeedus + = "," ;
}
string [ ] typegradeArr = r . typegrade . Split ( ',' ) ;
2025-12-11 14:32:17 +09:00
for ( int i = 0 ; i < typegradeArr . Length ; i + + ) {
2020-12-10 15:19:50 +09:00
r . typegrades + = comcodes . Where ( x = > x . cgroup = = "typegrade" & & x . ccode = = Convert . ToInt32 ( typegradeArr [ i ] ) ) . FirstOrDefault ( ) . cname ;
if ( i < typegradeArr . Length - 1 )
r . typegrades + = "," ;
}
string [ ] typejobArr = r . typejob . Split ( ',' ) ;
2025-12-11 14:32:17 +09:00
for ( int i = 0 ; i < typejobArr . Length ; i + + ) {
2020-12-10 15:19:50 +09:00
r . typejobs + = comcodes . Where ( x = > x . cgroup = = "typejob" & & x . ccode = = Convert . ToInt32 ( typejobArr [ i ] ) ) . FirstOrDefault ( ) . cname ;
if ( i < typejobArr . Length - 1 )
r . typejobs + = "," ;
}
}
2020-11-04 17:04:10 +09:00
return JsonBack ( result ) ;
}
2025-12-11 14:32:17 +09:00
2020-11-06 09:13:04 +09:00
[HttpPost]
2025-12-11 14:32:17 +09:00
public JsonResult GetScdForMixEdu ( int cmno , int? lectno , int? month , int? studyPlace ) {
2022-08-02 13:25:57 +09:00
Hashtable hsData = new Hashtable ( ) ;
hsData . Add ( "cmno" , cmno ) ;
hsData . Add ( "lectno" , lectno ) ;
hsData . Add ( "month" , month ) ;
hsData . Add ( "studyplace" , studyPlace ) ;
var result = Dao . Get < CMinningscd > ( "cm.cminningscds.applyedu" + ( lectno ! = null ? ".lectno" : "" ) , hsData ) ;
2022-08-03 16:50:01 +09:00
2023-07-10 14:18:15 +09:00
IList < CMinningscd > result2 = new List < CMinningscd > ( ) ;
2025-12-11 14:32:17 +09:00
if ( result . Count ( ) > 0 ) {
2023-07-10 14:18:15 +09:00
long cmino = result . First ( ) . cmino ;
result2 = Dao . Get < CMinningscd > ( "cm.cminningscds.attr2Check" , new System . Collections . Hashtable ( ) { { "cmno" , cmno } , { "cmino" , cmino } } ) ;
}
2022-08-03 16:50:01 +09:00
hsData . Clear ( ) ;
hsData . Add ( "cmno" , cmno ) ;
var resultTmp = Dao . Get < CM > ( "cm.cms" , hsData ) . FirstOrDefault ( ) ;
2023-07-10 14:18:15 +09:00
2022-08-02 13:25:57 +09:00
//var result = Dao.Get<CMinningscd>("cm.cminningscds.applyedu"+(lectno != null ? ".lectno" : ""), new System.Collections.Hashtable() { { "cmno", cmno },{"lectno",lectno }, { "month", (month == null) ? null : month } });
<기능개선>
1. PMS NO : 7146, 7149, 7152, 7158, 7179, 7181, 7184, 7187, 7202, 7210, 7214, 7215, 7218, 7220, 7224
2. (주요)작업내용
(1) 2022년 12월 추가 개발 및 유지보수 요청건 일괄 업로드
2023-01-03 08:59:38 +09:00
DateTime now = DateTime . Now ;
2024-08-26 10:56:50 +09:00
result = result . Where ( c = > c . estart > now . AddYears ( - 1 ) & & c . estart < now . AddYears ( 1 ) & & c . estart > now . AddDays ( 2 ) ) . ToList ( ) ;
2025-12-11 14:32:17 +09:00
foreach ( var item in result ) {
2021-07-05 09:54:49 +09:00
//item.scdInfoSummary = string.Format("[{0}] {1}", item.studyplacename, item.estart.ToString("yyyy년 MM월 dd일 ddd요일 HH:mm"));
2022-08-03 16:50:01 +09:00
//item.scdInfoSummary = string.Format("{0}", item.estart.ToString("yyyy년 MM월 dd일까지"));
2025-12-11 14:32:17 +09:00
if ( resultTmp . cshape = = 1 ) {
2022-08-03 16:50:01 +09:00
item . scdInfoSummary = string . Format ( "{0} ~ {1}" , item . estart . ToString ( "yyyy년 MM월 dd일" ) , item . eend . ToString ( "MM월 dd일" ) ) ;
2025-12-11 14:32:17 +09:00
} else {
//item.scdInfoSummary = string.Format("{0}", item.estart.ToString("yyyy년 MM월 dd일까지"));
item . scdInfoSummary = string . Format ( "{0}" , item . estart . ToString ( "yyyy년 MM월 dd일" ) ) ;
2022-08-03 16:50:01 +09:00
}
2025-12-11 14:32:17 +09:00
if ( item . estart < Convert . ToDateTime ( DateTime . Now . ToString ( "yyyy-MM-dd 00:00:00" ) ) )
item . isEnd = true ;
if ( result2 . Count ( ) > 0 ) {
item . intv1 = result2 . Where ( c = > c . cmino = = item . cmino & & c . cmisno = = item . cmisno & & c . intv1 = = 2 ) . Count ( ) ;
item . remainPeople + = item . intv1 ;
}
}
return JsonBack ( result ) ;
}
/// <summary>
/// 마이페이지 > 교육일정변경 (2025-12-09 / KHJ / 강좌 시작일 기준으로 교육일정리스트 출력)
/// </summary>
/// <param name="cmno"></param>
/// <param name="lectno"></param>
/// <param name="month"></param>
/// <param name="studyPlace"></param>
/// <param name="lectSdate"></param>
/// <returns></returns>
[HttpPost]
public JsonResult GetMyScdForMixEdu ( int cmno , int? lectno , int? month , int? studyPlace ) {
Hashtable hsData = new Hashtable ( ) ;
hsData . Add ( "cmno" , cmno ) ;
hsData . Add ( "lectno" , lectno ) ;
hsData . Add ( "month" , month ) ;
hsData . Add ( "studyplace" , studyPlace ) ;
var result = Dao . Get < CMinningscd > ( "cm.cminningscds.applyedu" + ( lectno ! = null ? ".lectno" : "" ) , hsData ) ;
IList < CMinningscd > result2 = new List < CMinningscd > ( ) ;
if ( result . Count ( ) > 0 ) {
long cmino = result . First ( ) . cmino ;
result2 = Dao . Get < CMinningscd > ( "cm.cminningscds.attr2Check" , new System . Collections . Hashtable ( ) { { "cmno" , cmno } , { "cmino" , cmino } } ) ;
}
hsData . Clear ( ) ;
hsData . Add ( "cmno" , cmno ) ;
var resultTmp = Dao . Get < CM > ( "cm.cms" , hsData ) . FirstOrDefault ( ) ;
//var result = Dao.Get<CMinningscd>("cm.cminningscds.applyedu"+(lectno != null ? ".lectno" : ""), new System.Collections.Hashtable() { { "cmno", cmno },{"lectno",lectno }, { "month", (month == null) ? null : month } });
DateTime now = ( DateTime ) resultTmp . rstime ;
result = result . Where ( c = > c . estart > now . AddYears ( - 1 ) & & c . estart < now . AddYears ( 1 ) & & c . estart > now . AddDays ( 2 ) ) . ToList ( ) ;
foreach ( var item in result ) {
//item.scdInfoSummary = string.Format("[{0}] {1}", item.studyplacename, item.estart.ToString("yyyy년 MM월 dd일 ddd요일 HH:mm"));
//item.scdInfoSummary = string.Format("{0}", item.estart.ToString("yyyy년 MM월 dd일까지"));
if ( resultTmp . cshape = = 1 ) {
item . scdInfoSummary = string . Format ( "{0} ~ {1}" , item . estart . ToString ( "yyyy년 MM월 dd일" ) , item . eend . ToString ( "MM월 dd일" ) ) ;
} else {
2023-01-04 12:44:00 +09:00
//item.scdInfoSummary = string.Format("{0}", item.estart.ToString("yyyy년 MM월 dd일까지"));
item . scdInfoSummary = string . Format ( "{0}" , item . estart . ToString ( "yyyy년 MM월 dd일" ) ) ;
2022-08-03 16:50:01 +09:00
}
2021-12-20 12:49:13 +09:00
if ( item . estart < Convert . ToDateTime ( DateTime . Now . ToString ( "yyyy-MM-dd 00:00:00" ) ) )
2020-11-11 16:26:18 +09:00
item . isEnd = true ;
2023-07-10 14:18:15 +09:00
2025-12-11 14:32:17 +09:00
if ( result2 . Count ( ) > 0 ) {
2023-07-10 14:18:15 +09:00
item . intv1 = result2 . Where ( c = > c . cmino = = item . cmino & & c . cmisno = = item . cmisno & & c . intv1 = = 2 ) . Count ( ) ;
item . remainPeople + = item . intv1 ;
}
2020-11-06 09:13:04 +09:00
}
return JsonBack ( result ) ;
}
2020-11-09 13:29:54 +09:00
[HttpPost]
2025-12-11 14:32:17 +09:00
public JsonResult GetCheckLectIsComplete ( int cmno ) {
var result = Dao . Get < int > ( "cm.lectcheckuser" , new System . Collections . Hashtable ( ) { { "userno" , SUserInfo . UserNo } , { "cmno" , cmno } } ) . First ( ) ;
2020-11-09 13:29:54 +09:00
return JsonBack ( result ) ;
}
2022-03-11 11:18:44 +09:00
[HttpPost]
2024-01-05 08:47:23 +09:00
/// ### ty 교육신청제한
2025-12-11 14:32:17 +09:00
public JsonResult GetCheckLectIs ( string man , string cgcode , string edu , string grade , int cmno , int pcmno , string job1 = "" ) {
2025-11-18 17:15:56 +09:00
//int result = 0; // 0 이면 수강 가능, 그외 수강 불가
//result = CheckUserLect(man, cgcode, edu, grade, cmno, pcmno, SUserInfo.UserNo);
2025-09-25 17:05:25 +09:00
#region + // 2025-09 (스마트검색 개발 건 미사용으로 주석처리, 필요시 복원)
2025-11-18 17:15:56 +09:00
var result = new KeyValuePair < int , string > ( ) ;
2025-12-11 14:32:17 +09:00
result = CheckUserLectInfo ( cmno , pcmno , SUserInfo . UserNo , man , cgcode , edu , grade , job1 ) ;
2025-09-25 17:05:25 +09:00
2025-11-18 17:15:56 +09:00
return JsonBack ( result . Key ) ;
2025-09-25 17:05:25 +09:00
#endregion
2024-08-26 10:56:50 +09:00
2025-11-18 17:15:56 +09:00
//return JsonBack(result);
2024-08-26 10:56:50 +09:00
}
2025-09-25 17:05:25 +09:00
#region + 이 건 과 거 로 직 이 다 아 마 도 앞 으 로 사 용 하 지 않 을 것 같 다
2024-10-23 12:40:50 +09:00
// pms: 5640 적용
2025-02-06 16:13:57 +09:00
//public int CheckUserLect(string man, string cgcode, string edu, string grade, int cmno, int pcmno, long userno)
//{
// int result = 0; // 1:신청불가, 0:신청가능
// int rst = 0;
// string[] cgcodes = new string[0];
// string[] edus = new string[0];
// // 29:기본교육 ,30:최초교육 ,31:계속교육 ,32:안전관리계속교육(16시간) ,33:PQ가점교육 ,34:기타교육 ,35:승급교육
// // 36:초급 ,37:중급 ,38:고급 ,39:특급
// cgcodes = "102,103,104,105".Split(','); // 직무분야:(102), 역량강화:(103,104), 전문분야(105)
// edus = "30,31,35".Split(','); // 최초교육, 계속교육, 승급교육
// // man == 28 : 건설사업관리기술인(typeman)
// if (man == "28" && cgcodes.Contains(cgcode) && edus.Contains(edu))
// {
// switch(cgcode)
// {
// case "102": // 직무분야
// if(edu == "35" && (grade == "38" || grade == "39")) // 승급교육 && (고급 || 특급)
// {
// // '(역량강화 또는 전문분야) + 직무분야' 조건에 의하여 직무분야 1건이상 신청불가
// rst = Dao.Get<int>("lect.count.user6", new Hashtable() { { "userno", userno }, { "pcmno", pcmno } }).First();
// }
// break;
// case "103": // 역량강화
// case "104":
// switch (edu)
// {
// case "30": // 최초교육
// // 1건이상 신청불가
// rst = Dao.Get<int>("lect.count.user5", new Hashtable() { { "userno", userno }, { "cgcode", cgcode }, { "edu", edu }, { "grade", grade }, { "cmno", cmno }, { "pcmno", pcmno } }).First();
// break;
// case "31": // 계속교육
// if(grade == "36" || grade == "37") // 초급 || 중급
// {
// result = 1; // 신청불가
// }
// // 그외는 제한 없음
// break;
// case "35": // 승급교육
// if(grade == "38" || grade == "39")
// {
// // '(역량강화 또는 전문분야) + 직무분야' 조건에 의하여 역량강화 또는 전문분야중 1건이상 신청불가
// rst = Dao.Get<int>("lect.count.user6", new Hashtable() { { "userno", userno }, { "pcmno", pcmno } }).First();
// }
// // 그외는 제한 없음
// break;
// }
// break;
// case "105": // 전문분야
// switch(edu)
// {
// case "30": // 최초교육
// result = 1; // 신청불가
// break;
// case "31": // 계속교육
// if (grade == "36" || grade == "37") // 초급 || 중급
// {
// result = 1; // 신청불가
// }
// // 그외는 제한 없음
// break;
// case "35": // 승급교육
// if (grade == "36" || grade == "37") // 초급 || 중급
// {
// result = 1; // 신청불가
// }
// else
// {
// // '(역량강화 또는 전문분야) + 직무분야' 조건에 의하여 역량강화 또는 전문분야중 1건이상 신청불가
// rst = Dao.Get<int>("lect.count.user6", new Hashtable() { { "userno", userno }, { "pcmno", pcmno } }).First();
// }
// break;
// }
// break;
// }
// }
// if (result == 0)
// {
// //-1= 짧은문구, smartSearch에서 오류중 짧은문구 처리할 경우 -1를 곱하여 0이하값 만들어야함
// result = rst == 0 ? 0 : ((rst > 0) ? 1 : -1); //
// }
// return result;
2025-09-25 17:05:25 +09:00
//}
#endregion
#region + 2025 - 09 ( 스 마 트 검 색 개 발 건 미 사 용 으 로 주 석 처 리 , 필 요 시 복 원 )
// 본문에 주석이 너무많아 주석처리는 아니고 그냥 미사용
// FO > CourseController.CheckUserLect, FOCommonController.CheckUserLect 동일한 코드 (Dao문제로 2개구현, 공통이나, 서비스로 뺴야한다)
/// <summary>
/// 수강 제약조건 확인 (FO > CourseController.CheckUserLect 와 동일, 함께 수정해야함 => Dao문제로 2개구현)
/// </summary>
/// <param name="cmno">강좌키</param>
/// <param name="pcmno">연계강좌키</param>
/// <param name="userno">회원번호</param>
/// <param name="man">기술인분류</param>
/// <param name="cgcode"></param>
/// <param name="edu">교육목적</param>
/// <param name="grade">등급</param>
/// <returns> Code (0:수강가능, -2,동일한과정 재신청 제약, -10:최초교육제약, -20:승급교육제약, -100:에러) , Message </returns>
2025-12-11 14:32:17 +09:00
public KeyValuePair < int , string > CheckUserLectInfo ( int cmno , int pcmno , long userno , string man , string cgcode , string edu , string grade , string job1 = "" ) {
2025-09-25 17:05:25 +09:00
var result = new KeyValuePair < int , string > ( 0 , "수강신청 가능" ) ;
#region + DB에서 코 드 값 찾 기
/ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* a ) 기 술 인 분 류 SELECT * FROM comcode WHERE cgroup = ' typeman ' AND isUse = 1
* b ) 과 정 분 류 SELECT * FROM cg WHERE isUse = 1
* c ) 교 육 목 적 SELECT * FROM comcode WHERE cgroup = ' typeedu ' AND isUse = 1
* d ) 등 급 SELECT * FROM comcode WHERE cgroup = ' typegrade ' AND isUse = 1
* e ) 직 무 분 야 SELECT * FROM comcode WHERE cgroup = ' typejob ' AND isUse = 1
* f ) 직 무 분 야 전 체 SELECT * FROM comcode WHERE cgroup LIKE ' typejob % ' AND isUse = 1
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
#endregion
// result (0:수강가능, 이 외 수강불가)
2025-12-11 14:32:17 +09:00
try {
2025-09-25 17:05:25 +09:00
#region + ( 탈 출 ) 1. 건 설 사 업 관 리 기 술 인 관 련 제 한 조 건 ( lectEnrolls 참 조 하 지 않 음 , Request 값 만 . . . )
// 조건: 건설사업관리기술인(28) + 초급/중급(36,37) + 역량강화(103,104) 은 신청불가
2025-12-11 14:32:17 +09:00
if ( edu = = "31" ) {
2025-09-25 17:05:25 +09:00
bool isRestrictedContinueEdu =
man = = "28"
& & ( grade = = "36" | | grade = = "37" )
& & ( cgcode = = "103" | | cgcode = = "104" ) ;
2025-12-11 14:32:17 +09:00
if ( isRestrictedContinueEdu ) {
2025-09-25 17:05:25 +09:00
return new KeyValuePair < int , string > ( - 30 , "계속교육 제약" ) ;
}
}
#endregion
#region + Get : lect . enroll . get ( lectEnrolls = 회 원 수 강 신 청 내 역 )
var p = new Hashtable ( ) ;
p . Add ( "uno" , userno ) ;
IList < LectEnroll > lectEnrolls = Dao . Get < LectEnroll > ( "lect.enroll.get" , p ) ;
#endregion
// 회원의 이전 수강신청내역이 있다면
2025-12-11 14:32:17 +09:00
if ( lectEnrolls ! = null & & lectEnrolls . Any ( ) ) {
2025-09-25 17:05:25 +09:00
#region + ( 탈 출 ) 2. 동 일 한 과 정 은 1 개 만 수 강 가 능 ( cm . cmno )
2025-12-11 14:32:17 +09:00
if ( lectEnrolls . Any ( l = > l . cmno = = cmno ) ) {
2025-09-25 17:05:25 +09:00
// -2는 동일 과정 중복
return new KeyValuePair < int , string > ( - 2 , "동일강좌 중복제약" ) ;
}
#endregion
#region + ( 탈 출 ) 3. 교 육 목 적 - > 기 본 교 육 ( 29 ) 관 련 제 한 조 건
2025-12-11 14:32:17 +09:00
if ( edu = = "29" ) {
2025-09-25 17:05:25 +09:00
// 기존 신청 내역 중 기본교육(29)이 있는지 확인 (기본교육은 1개만 신청가능)
bool hasExistingBasicEdu = lectEnrolls . Any ( l = > l . TYPEEDU = = 29 ) ;
2025-12-11 14:32:17 +09:00
if ( hasExistingBasicEdu ) {
2025-09-25 17:05:25 +09:00
return new KeyValuePair < int , string > ( - 30 , "기본교육 제약" ) ;
}
}
#endregion
#region + ( 탈 출 ) 4. 교 육 목 적 - > 최 초 교 육 ( 30 ) 관 련 제 한 조 건
// - 최초교육(30)의 기술인분류(25,27,28)가 과정분류 역량강화(103,104)인 최초교육은 1개만 신청 가능.
2025-12-11 14:32:17 +09:00
if ( edu = = "30" ) {
2025-09-25 17:05:25 +09:00
// 1) 현재 신청하는 교육이 제한 대상인지 확인
bool isApplyingForRestrictedFirstEdu =
( man = = "25" | | man = = "27" | | man = = "28" )
& & ( cgcode = = "103" | | cgcode = = "104" ) ;
2025-12-11 14:32:17 +09:00
if ( isApplyingForRestrictedFirstEdu ) {
2025-09-25 17:05:25 +09:00
// 2) 이미 신청 내역 중에 제한 대상에 해당하는 최초교육이 있는지 확인
bool hasExistingRestrictedFirstEdu = lectEnrolls . Any ( l = >
l . TYPEEDU = = 30
& & ( l . TYPEMAN = = 25 | | l . TYPEMAN = = 27 | | l . TYPEMAN = = 28 )
& & ( l . CGCODE = = "103" | | l . CGCODE = = "104" )
) ;
// 조건을 만족하는 기존 교육이 발견되면, 중복신청 막기 처리
2025-12-11 14:32:17 +09:00
if ( hasExistingRestrictedFirstEdu ) {
2025-09-25 17:05:25 +09:00
return new KeyValuePair < int , string > ( - 10 , "최초교육 제약" ) ;
}
}
}
//if (edu == "30")
//{
// // 1) 현재 신청하는 교육이 제한 대상인지 확인
// bool isApplyingForRestrictedFirstEdu =
// (man == "25" || man == "27" || man == "28")
// && (cgcode == "103" || cgcode == "104");
// if (isApplyingForRestrictedFirstEdu)
// {
// // 2) 이미 신청 내역 중에 제한 대상에 해당하는 최초교육이 있는지 확인
// bool hasExistingRestrictedFirstEdu = lectEnrolls.Any(l =>
// l.TYPEEDU == 30
// && (l.TYPEMAN == 25 || l.TYPEMAN == 27 || l.TYPEMAN == 28)
// && (l.CGCODE == "107")
// );
// // 조건을 만족하는 기존 교육이 발견되면, 중복신청 막기 처리
// if (hasExistingRestrictedFirstEdu)
// {
// return new KeyValuePair<int, string>(-10, "최초교육 제약");
// }
// }
//}
#endregion
#region + ( 탈 출 ) 5. 교 육 목 적 - > 승 급 교 육 ( 35 ) 관 련 제 한 조 건
// 승급교육(35) 관련 제한 조건 (A, B, C, D 그룹)
2025-11-18 17:15:56 +09:00
if ( edu = = "35" ) //교육목적
2025-09-25 17:05:25 +09:00
{
// 제약의 공통 전제조건: 고급(38) 또는 특급(39) 등급인 경우에만 적용
bool isAdvancedGrade = grade = = "38" | | grade = = "39" ;
2025-12-11 14:32:17 +09:00
if ( isAdvancedGrade ) {
2025-09-25 17:05:25 +09:00
// A: 동일 등급, 동일 직무분야 내에서 1개만 신청 가능
2025-11-18 17:15:56 +09:00
// ((설계시공 또는 건설사업관리) / (역량강화(103,104) 또는 전문분야(105)))
bool isApplyingForGroupA = ( man = = "25" | | man = = "28" ) & & ( cgcode = = "103" | | cgcode = = "104" | | cgcode = = "105" ) ;
2025-12-11 14:32:17 +09:00
if ( isApplyingForGroupA ) {
2025-11-18 17:15:56 +09:00
//설계시공기술인
bool hasExistingInGroupA25 = lectEnrolls . Any ( l = >
l . TYPEEDU = = 35 //승급교육
2025-12-11 14:32:17 +09:00
& & ( l . TYPEGRADE . ToString ( ) = = grade )
2025-09-25 17:05:25 +09:00
& & l . TYPEJOB . ToString ( ) = = job1
& & (
2025-11-18 17:15:56 +09:00
( l . TYPEMAN . ToString ( ) = = "25" )
& & ( l . CGCODE = = "103" | | l . CGCODE = = "104" | | l . CGCODE = = "105" )
2025-09-25 17:05:25 +09:00
)
) ;
2025-12-11 14:32:17 +09:00
if ( hasExistingInGroupA25 ) {
2025-09-25 17:05:25 +09:00
return new KeyValuePair < int , string > ( - 20 , "승급교육 제약A" ) ;
}
2025-11-18 17:15:56 +09:00
//건설사업관리기술인
bool hasExistingInGroupA28 = lectEnrolls . Any ( l = >
l . TYPEEDU = = 35 //승급교육
& & ( l . TYPEGRADE . ToString ( ) = = grade )
& & l . TYPEJOB . ToString ( ) = = job1
& & (
( l . TYPEMAN . ToString ( ) = = "28" )
& & ( l . CGCODE = = "103" | | l . CGCODE = = "104" | | l . CGCODE = = "105" )
)
) ;
if ( hasExistingInGroupA28 ) {
return new KeyValuePair < int , string > ( - 20 , "승급교육 제약A" ) ;
}
2025-09-25 17:05:25 +09:00
}
bool isApplyingForGroupA2 = ( man = = "25" | | man = = "28" ) & & ( cgcode = = "105" ) ;
2025-12-11 14:32:17 +09:00
if ( isApplyingForGroupA2 ) {
2025-11-18 17:15:56 +09:00
bool hasExistingInGroupA2 = lectEnrolls . Any ( l = >
2025-09-25 17:05:25 +09:00
l . TYPEEDU = = 35
& & l . TYPEGRADE . ToString ( ) = = grade
& & l . TYPEJOB . ToString ( ) = = job1
& & (
( l . TYPEMAN . ToString ( ) = = "25" | | l . TYPEMAN . ToString ( ) = = "28" )
& & ( l . CGCODE = = "105" )
)
) ;
2025-12-11 14:32:17 +09:00
if ( hasExistingInGroupA2 ) {
2025-09-25 17:05:25 +09:00
return new KeyValuePair < int , string > ( - 20 , "승급교육 제약A" ) ;
}
}
bool isApplyingForGroupA3 = ( man = = "25" | | man = = "28" ) & & ( cgcode = = "107" ) ;
2025-12-11 14:32:17 +09:00
if ( isApplyingForGroupA3 ) {
2025-09-25 17:05:25 +09:00
bool hasExistingInGroupA3 = lectEnrolls . Any ( l = >
l . TYPEEDU = = 35
& & l . TYPEGRADE . ToString ( ) = = grade
& & l . TYPEJOB . ToString ( ) = = job1
& & (
( l . TYPEMAN . ToString ( ) = = "25" | | l . TYPEMAN . ToString ( ) = = "28" )
& & ( l . CGCODE = = "107" )
)
) ;
2025-12-11 14:32:17 +09:00
if ( hasExistingInGroupA3 ) {
2025-09-25 17:05:25 +09:00
return new KeyValuePair < int , string > ( - 20 , "승급교육 제약A" ) ;
}
}
// B: 동일 등급, 동일 직무분야 내에서 1개만 신청 가능
// ((설계시공/특성화) 또는 (건설사업관리/전문분야))
bool isApplyingForGroupB = ( man = = "25" & & cgcode = = "107" ) | | ( man = = "28" & & cgcode = = "105" ) ;
2025-12-11 14:32:17 +09:00
if ( isApplyingForGroupB ) {
2025-09-25 17:05:25 +09:00
bool hasExistingInGroupB = lectEnrolls . Any ( l = >
2025-12-11 14:32:17 +09:00
l . TYPEEDU = = 35
& & l . TYPEGRADE . ToString ( ) = = grade
& & l . TYPEJOB . ToString ( ) = = job1
2025-09-25 17:05:25 +09:00
& & (
2025-12-11 14:32:17 +09:00
( l . TYPEMAN . ToString ( ) = = "25" & & l . CGCODE = = "107" )
2025-09-25 17:05:25 +09:00
| | ( l . TYPEMAN . ToString ( ) = = "28" & & l . CGCODE = = "105" )
)
) ;
2025-02-06 16:13:57 +09:00
2025-12-11 14:32:17 +09:00
if ( hasExistingInGroupB ) {
return new KeyValuePair < int , string > ( - 20 , "승급교육 제약B" ) ;
2025-09-25 17:05:25 +09:00
}
}
// C: 등급, 동일 직무분야 내에서 1개만 신청 가능
// ((설계시공/특성화) 또는 (건설사업관리/역량강화))
bool isApplyingForGroupC = ( man = = "25" & & cgcode = = "107" ) | | ( man = = "28" & & ( cgcode = = "103" | | cgcode = = "104" ) ) ;
2025-12-11 14:32:17 +09:00
if ( isApplyingForGroupC ) {
2025-09-25 17:05:25 +09:00
bool hasExistingInGroupC = lectEnrolls . Any ( l = >
2025-12-11 14:32:17 +09:00
l . TYPEEDU = = 35
& & l . TYPEGRADE . ToString ( ) = = grade
& & l . TYPEJOB . ToString ( ) = = job1
2025-09-25 17:05:25 +09:00
& & (
2025-12-11 14:32:17 +09:00
( l . TYPEMAN . ToString ( ) = = "25" & & l . CGCODE = = "107" )
2025-09-25 17:05:25 +09:00
| | ( l . TYPEMAN . ToString ( ) = = "28" & & ( l . CGCODE = = "103" | | l . CGCODE = = "104" ) )
)
) ;
2025-12-11 14:32:17 +09:00
if ( hasExistingInGroupC ) {
2025-09-25 17:05:25 +09:00
return new KeyValuePair < int , string > ( - 20 , "승급교육 제약C" ) ;
}
}
2025-12-11 14:32:17 +09:00
2025-09-25 17:05:25 +09:00
// D: 동일 등급, 동일 직무분야 내에서 1개만 신청 가능
// ((건설사업관리/건설기술인 전문교육))
bool isApplyingForGroupD = man = = "28" & & cgcode = = "102" ;
2025-12-11 14:32:17 +09:00
if ( isApplyingForGroupD ) {
2025-09-25 17:05:25 +09:00
bool hasExistingInGroupD = lectEnrolls . Any ( l = >
l . TYPEEDU = = 35
& & l . TYPEGRADE . ToString ( ) = = grade
& & l . TYPEJOB . ToString ( ) = = job1
& & ( l . TYPEMAN . ToString ( ) = = "28" & & l . CGCODE = = "102" )
) ;
2025-12-11 14:32:17 +09:00
if ( hasExistingInGroupD ) {
2025-09-25 17:05:25 +09:00
return new KeyValuePair < int , string > ( - 20 , "승급교육 제약D" ) ;
}
}
}
}
#endregion
2025-12-11 14:32:17 +09:00
} else {
2025-09-25 17:05:25 +09:00
// 이전에 수강 신청한 내역이 아무것도 없기에 제약조건을 걸 필요가 없음.
result = new KeyValuePair < int , string > ( 0 , "이전에 아무것도 수강신청한 내역이 없음" ) ;
}
2025-12-11 14:32:17 +09:00
} catch ( Exception ex ) {
2025-09-25 17:05:25 +09:00
SetError ( $"CheckUserLectInfo: {ex.Message}" ) ;
result = new KeyValuePair < int , string > ( - 100 , ex . Message ) ;
}
return result ;
}
#endregion
2025-02-06 16:13:57 +09:00
2025-12-11 14:32:17 +09:00
public int CheckUserLect ( string man , string cgcode , string edu , string grade , int cmno , int pcmno , long userno ) {
2025-02-06 16:13:57 +09:00
int result = 0 ;
2024-01-05 08:47:23 +09:00
int rst = 0 ;
string [ ] cgcodes = new string [ 0 ] ;
string [ ] edus = new string [ 0 ] ;
2022-04-19 16:54:01 +09:00
2025-09-25 17:05:25 +09:00
// 실제로직은 ELSE절이다.
if ( DateTime . Now > DateTime . Parse ( "2099-01-02 00:00" ) ) // ### ty 2024년 추가건이나 현재 적용대기로 전달 받음
2025-02-06 16:13:57 +09:00
{
// ### ty 2024년 적용!!!
// 29:기본교육 ,30:최초교육 ,31:계속교육 ,32:안전관리계속교육(16시간) ,33:PQ가점교육 ,34:기타교육 ,35:승급교육
// 36:초급 ,37:중급 ,38:고급 ,39:특급
cgcodes = "103,104,105" . Split ( ',' ) ;
edus = "30,31,35,107,108" . Split ( ',' ) ; // 최초교육, 계속교육, 승급교육
// man == 28 : 건설사업관리기술인(typeman)
2025-12-11 14:32:17 +09:00
if ( man = = "28" & & cgcodes . Contains ( cgcode ) & & edus . Contains ( edu ) ) {
2025-02-06 16:13:57 +09:00
// 계속교육(31)
if ( ( edu = = "31" | | edu = = "107" | | edu = = "108" ) & & ( cgcode = = "103" | | cgcode = = "104" | | cgcode = = "105" ) & & ( grade = = "36" | | grade = = "37" ) ) // 계속교육, (103 or 104 or 105), (초급 or 중급)
{
result = 1 ; // 신청불가
}
// 계속교육(31)
else if ( ( edu = = "31" | | edu = = "107" | | edu = = "108" ) & & ( cgcode = = "103" | | cgcode = = "104" | | cgcode = = "105" ) & & ( grade = = "38" | | grade = = "39" ) ) // 계속교육, (103 or 104 or 105), (고급 or 특급)
{
rst = 0 ; // 신청가능
}
// 최초교육(30)
else if ( edu = = "30" & & cgcode = = "105" ) // 최초교육, 전문분야(105)
{
result = 1 ; // 신청불가
}
// 승급교육(35)
else if ( edu = = "35" & & cgcode = = "105" & & ( grade = = "36" | | grade = = "37" ) ) // 최초교육, 전문분야(105), 36:초급 ,37:중급
{
result = 1 ; // 신청불가
} // 승급교육(35)
else if ( edu = = "35" & & ( cgcode = = "103" | | cgcode = = "104" ) & & ( grade = = "36" | | grade = = "37" ) ) // 승급교육 , 103,104, 36:초급 ,37:중급
{
rst = 0 ; // 신청가능
2025-12-11 14:32:17 +09:00
} else {
2025-02-06 16:13:57 +09:00
// 갯수를 가져오기
/ *
* 기 본 설 계 쿼 리
select t5 . typegrade , t5 . typeman , t5 . typeedu , t3 . cgcode , t1 . lectno , t1 . userno
from lect t1
inner join cm t2 on t1 . cmno = t2 . cmno
inner join cg t3 on t2 . cgno = t3 . cgno
inner join pay t4 on t1 . payno = t4 . payno
inner join pplog t5 on t1 . cmno = t5 . cmno and t1 . userno = t5 . userno and t4 . pplno = t5 . pplno
where t1 . status = 1 and t4 . pstatus = 1
and t3 . cgcode = 103 - - and t1 . userno = 82 - - 82 , 5 , 31
// 29:기본교육 ,30:최초교육 ,31:계속교육 ,32:안전관리계속교육(16시간) ,33:PQ가점교육 ,34:기타교육 ,35:승급교육
// 36:초급 ,37:중급 ,38:고급 ,39:특급
* /
// "lect.count.user2" > 103,104,105
// "lect.count.user3" > 103,104
// 최초교육(30) , (103,104),
2025-12-11 14:32:17 +09:00
if ( edu = = "30" & & ( cgcode = = "103" | | cgcode = = "104" ) ) {
2025-02-06 16:13:57 +09:00
var lectCount = Dao . Get < int > ( "lect.count.user3" , new Hashtable ( ) { { "userno" , userno } , { "cgcode" , cgcode } , { "edu" , edu } , { "grade" , grade } , { "cmno" , cmno } , { "pcmno" , pcmno } } ) ;
rst = lectCount . First ( ) ;
2024-10-23 12:40:50 +09:00
}
2025-02-06 16:13:57 +09:00
// 승급교육(35), 38:고급 ,39:특급
2025-12-11 14:32:17 +09:00
else if ( edu = = "35" & & ( grade = = "38" | | grade = = "39" ) ) {
2025-02-06 16:13:57 +09:00
var lectCount = Dao . Get < int > ( "lect.count.user2" , new Hashtable ( ) { { "userno" , userno } , { "cmno" , cmno } , { "pcmno" , pcmno } } ) ;
rst = lectCount . First ( ) ;
2024-10-23 12:40:50 +09:00
}
2025-02-06 16:13:57 +09:00
}
2024-10-23 12:40:50 +09:00
2025-02-06 16:13:57 +09:00
}
2025-12-11 14:32:17 +09:00
} else {
2025-02-06 16:13:57 +09:00
// 29:기본교육 ,30:최초교육 ,31:계속교육 ,32:안전관리계속교육(16시간) ,33:PQ가점교육 ,34:기타교육 ,35:승급교육
// 36:초급 ,37:중급 ,38:고급 ,39:특급
cgcodes = "103,104,105" . Split ( ',' ) ;
edus = "30,31,35" . Split ( ',' ) ; // 최초교육, 계속교육, 승급교육
// man == 28 : 건설사업관리기술인(typeman)
2025-12-11 14:32:17 +09:00
if ( man = = "28" & & cgcodes . Contains ( cgcode ) & & edus . Contains ( edu ) ) {
2025-02-06 16:13:57 +09:00
// 계속교육(31)
if ( edu = = "31" & & ( cgcode = = "103" | | cgcode = = "104" ) & & ( grade = = "36" | | grade = = "37" ) ) // 계속교육, (103 or 104), (초급 or 중급)
{
result = 1 ; // 신청불가
2025-12-11 14:32:17 +09:00
} else {
2025-02-06 16:13:57 +09:00
// 갯수를 가져오기
// 최초교육(30)
if ( edu = = "30" & & cgcode = = "105" ) // 최초교육 , 105
2024-10-23 12:40:50 +09:00
{
2025-02-06 16:13:57 +09:00
rst = 0 ; // 신청가능
2024-10-23 12:40:50 +09:00
}
2025-02-06 16:13:57 +09:00
// 계속교육(31)
else if ( edu = = "31" & & cgcode = = "105" & & ( grade = = "36" | | grade = = "37" ) ) // 계속교육, 105, (초급 or 중급)
{
rst = 0 ; // 신청가능
}
// 승급교육(35)
else if ( edu = = "35" & & ( cgcode = = "103" | | cgcode = = "104" | | cgcode = = "105" ) & & ( grade = = "36" | | grade = = "37" ) ) // 승급교육, (103 or 104 or 105), (초급 or 중급)
{
rst = 0 ; // 신청가능
2025-12-11 14:32:17 +09:00
} else {
2025-02-06 16:13:57 +09:00
/ *
* 기 본 설 계 쿼 리
select t5 . typegrade , t5 . typeman , t5 . typeedu , t3 . cgcode , t1 . lectno , t1 . userno
from lect t1
inner join cm t2 on t1 . cmno = t2 . cmno
inner join cg t3 on t2 . cgno = t3 . cgno
inner join pay t4 on t1 . payno = t4 . payno
inner join pplog t5 on t1 . cmno = t5 . cmno and t1 . userno = t5 . userno and t4 . pplno = t5 . pplno
where t1 . status = 1 and t4 . pstatus = 1
and t3 . cgcode = 103 - - and t1 . userno = 82 - - 82 , 5 , 31
// 29:기본교육 ,30:최초교육 ,31:계속교육 ,32:안전관리계속교육(16시간) ,33:PQ가점교육 ,34:기타교육 ,35:승급교육
// 36:초급 ,37:중급 ,38:고급 ,39:특급
* /
// "lect.count.user2" > 103,104,105
// "lect.count.user3" > 103,104
if ( ( edu = = "31" | | edu = = "35" ) & & ( grade = = "38" | | grade = = "39" ) ) // 계속교육, 승급교육 && 고급, 특급
{
var lectCount = Dao . Get < int > ( "lect.count.user2" , new Hashtable ( ) { { "userno" , userno } , { "cgcode" , cgcode } , { "edu" , edu } , { "grade" , grade } , { "cmno" , cmno } , { "pcmno" , pcmno } } ) ;
rst = lectCount . First ( ) ;
2025-12-11 14:32:17 +09:00
} else if ( ( cgcode = = "103" | | cgcode = = "104" ) & & edu = = "30" ) // 최초
{
2025-02-06 16:13:57 +09:00
var lectCount = Dao . Get < int > ( "lect.count.user3" , new Hashtable ( ) { { "userno" , userno } , { "cmno" , cmno } , { "pcmno" , pcmno } } ) ;
rst = lectCount . First ( ) ;
2025-12-11 14:32:17 +09:00
} else {
2025-02-06 16:13:57 +09:00
var lectCount = Dao . Get < int > ( "lect.count.user" , new Hashtable ( ) { { "userno" , userno } , { "cgcode" , cgcode } , { "edu" , edu } , { "cmno" , cmno } , { "pcmno" , pcmno } } ) ;
rst = lectCount . First ( ) ;
}
}
}
2024-10-23 12:40:50 +09:00
}
}
2025-12-11 14:32:17 +09:00
if ( result = = 0 ) {
2025-02-06 16:13:57 +09:00
//-1= 짧은 문구
2024-10-23 12:40:50 +09:00
result = rst = = 0 ? 0 : ( ( rst > 0 ) ? 1 : - 1 ) ; //
}
2024-01-05 08:47:23 +09:00
2024-10-23 12:40:50 +09:00
return result ;
2022-03-11 11:18:44 +09:00
2024-10-23 12:40:50 +09:00
}
2025-02-06 16:13:57 +09:00
2025-12-11 14:32:17 +09:00
public int CheckUserLectOld_backukp241007 ( string man , string cgcode , string edu , string grade , int cmno , int pcmno , long userno ) {
2024-10-23 12:40:50 +09:00
int result = 0 ;
int rst = 0 ;
string [ ] cgcodes = new string [ 0 ] ;
string [ ] edus = new string [ 0 ] ;
2025-12-11 14:32:17 +09:00
2024-10-23 12:40:50 +09:00
// 29:기본교육 ,30:최초교육 ,31:계속교육 ,32:안전관리계속교육(16시간) ,33:PQ가점교육 ,34:기타교육 ,35:승급교육
// 36:초급 ,37:중급 ,38:고급 ,39:특급
cgcodes = "103,104,105" . Split ( ',' ) ;
edus = "30,31,35" . Split ( ',' ) ; // 최초교육, 계속교육, 승급교육
// man == 28 : 건설사업관리기술인(typeman)
2025-12-11 14:32:17 +09:00
if ( man = = "28" & & cgcodes . Contains ( cgcode ) & & edus . Contains ( edu ) ) {
2024-10-23 12:40:50 +09:00
// 계속교육(31)
if ( edu = = "31" & & ( cgcode = = "103" | | cgcode = = "104" ) & & ( grade = = "36" | | grade = = "37" ) ) // 계속교육, (103 or 104), (초급 or 중급)
2024-01-05 08:47:23 +09:00
{
2024-10-23 12:40:50 +09:00
result = 1 ; // 신청불가
2025-12-11 14:32:17 +09:00
} else {
2024-10-23 12:40:50 +09:00
// 갯수를 가져오기
// 최초교육(30)
if ( edu = = "30" & & cgcode = = "105" ) // 최초교육 , 105
2022-03-11 11:18:44 +09:00
{
2024-10-23 12:40:50 +09:00
rst = 0 ; // 신청가능
2022-03-11 11:18:44 +09:00
}
2024-01-05 08:47:23 +09:00
// 계속교육(31)
2024-10-23 12:40:50 +09:00
else if ( edu = = "31" & & cgcode = = "105" & & ( grade = = "36" | | grade = = "37" ) ) // 계속교육, 105, (초급 or 중급)
2022-03-11 11:18:44 +09:00
{
rst = 0 ; // 신청가능
}
2024-01-05 08:47:23 +09:00
// 승급교육(35)
2024-10-23 12:40:50 +09:00
else if ( edu = = "35" & & ( cgcode = = "103" | | cgcode = = "104" | | cgcode = = "105" ) & & ( grade = = "36" | | grade = = "37" ) ) // 승급교육, (103 or 104 or 105), (초급 or 중급)
2022-03-11 11:18:44 +09:00
{
rst = 0 ; // 신청가능
2025-12-11 14:32:17 +09:00
} else {
2022-03-11 11:18:44 +09:00
/ *
2024-01-05 08:47:23 +09:00
* 기 본 설 계 쿼 리
select t5 . typegrade , t5 . typeman , t5 . typeedu , t3 . cgcode , t1 . lectno , t1 . userno
from lect t1
inner join cm t2 on t1 . cmno = t2 . cmno
inner join cg t3 on t2 . cgno = t3 . cgno
inner join pay t4 on t1 . payno = t4 . payno
inner join pplog t5 on t1 . cmno = t5 . cmno and t1 . userno = t5 . userno and t4 . pplno = t5 . pplno
where t1 . status = 1 and t4 . pstatus = 1
and t3 . cgcode = 103 - - and t1 . userno = 82 - - 82 , 5 , 31
// 29:기본교육 ,30:최초교육 ,31:계속교육 ,32:안전관리계속교육(16시간) ,33:PQ가점교육 ,34:기타교육 ,35:승급교육
// 36:초급 ,37:중급 ,38:고급 ,39:특급
* /
// "lect.count.user2" > 103,104,105
// "lect.count.user3" > 103,104
2024-10-23 12:40:50 +09:00
if ( ( edu = = "31" | | edu = = "35" ) & & ( grade = = "38" | | grade = = "39" ) ) // 계속교육, 승급교육 && 고급, 특급
2022-03-16 10:23:00 +09:00
{
2024-10-23 12:40:50 +09:00
var lectCount = Dao . Get < int > ( "lect.count.user2" , new Hashtable ( ) { { "userno" , userno } , { "cgcode" , cgcode } , { "edu" , edu } , { "grade" , grade } , { "cmno" , cmno } , { "pcmno" , pcmno } } ) ;
2022-03-16 10:23:00 +09:00
rst = lectCount . First ( ) ;
2025-12-11 14:32:17 +09:00
} else if ( ( cgcode = = "103" | | cgcode = = "104" ) & & edu = = "30" ) // 최초
{
2024-10-23 12:40:50 +09:00
var lectCount = Dao . Get < int > ( "lect.count.user3" , new Hashtable ( ) { { "userno" , userno } , { "cmno" , cmno } , { "pcmno" , pcmno } } ) ;
2022-03-16 10:23:00 +09:00
rst = lectCount . First ( ) ;
2025-12-11 14:32:17 +09:00
} else {
2024-10-23 12:40:50 +09:00
var lectCount = Dao . Get < int > ( "lect.count.user" , new Hashtable ( ) { { "userno" , userno } , { "cgcode" , cgcode } , { "edu" , edu } , { "cmno" , cmno } , { "pcmno" , pcmno } } ) ;
rst = lectCount . First ( ) ;
2022-03-16 10:23:00 +09:00
}
2024-10-23 12:40:50 +09:00
2022-03-11 11:18:44 +09:00
}
}
}
2025-12-11 14:32:17 +09:00
if ( result = = 0 ) {
2024-01-05 08:47:23 +09:00
//-1= 짧은 문구
result = rst = = 0 ? 0 : ( ( rst > 0 ) ? 1 : - 1 ) ; //
}
2022-03-11 11:18:44 +09:00
2024-08-26 10:56:50 +09:00
return result ;
}
2024-05-20 13:06:04 +09:00
/// <summary>
/// 교육신청 제한 해제시 GetCheckLectIs_stay를 GetCheckLectIs로 변경하여 반영한다.
/// </summary>
/// <param name="man"></param>
/// <param name="cgcode"></param>
/// <param name="edu"></param>
/// <param name="grade"></param>
/// <param name="cmno"></param>
/// <param name="pcmno"></param>
/// <returns></returns>
2025-12-11 14:32:17 +09:00
public JsonResult GetCheckLectIs_stay ( string man , string cgcode , string edu , string grade , int cmno , int pcmno ) {
2024-05-20 13:06:04 +09:00
int result = 0 ; // 0 이면 수강 가능, 그외 수강 불가
2025-12-11 14:32:17 +09:00
2024-05-20 13:06:04 +09:00
return JsonBack ( result ) ;
}
2022-08-03 16:50:01 +09:00
/// <summary>
/// 수강신청시 가능인원 체크하기
/// 20220803
/// </summary>
/// <param name="cmisno"></param>
/// <returns></returns>
2020-11-11 16:26:18 +09:00
[HttpPost]
2025-12-11 14:32:17 +09:00
public JsonResult CheckQtyScd ( int cmno , int cmino , int cmisno ) {
var pass = Dao . Get < int > ( "cm.cminningscdcheck" , new System . Collections . Hashtable ( ) { { "cmisno" , cmisno } } ) . First ( ) ;
2023-07-10 14:18:15 +09:00
IList < CMinningscd > result2 = Dao . Get < CMinningscd > ( "cm.cminningscds.attr2Check" , new System . Collections . Hashtable ( ) { { "cmno" , cmno } , { "cmino" , cmino } , { "cmisno" , cmisno } } ) ;
2025-12-11 14:32:17 +09:00
if ( result2 . Count ( ) > 0 ) {
2023-07-10 14:18:15 +09:00
int addPass = result2 . Where ( c = > c . intv1 = = 2 ) . Count ( ) ;
pass + = addPass ;
}
2025-12-11 14:32:17 +09:00
if ( pass = = 0 ) {
2022-08-03 16:50:01 +09:00
return JsonBack ( new JsonRtn ( ) { code = 0 , msg = "해당 일정은 모집 인원이 마감되었습니다." } ) ;
2025-12-11 14:32:17 +09:00
} else if ( pass > 0 ) {
2022-08-03 16:50:01 +09:00
return JsonBack ( new JsonRtn ( ) { code = 1000 , msg = "" } ) ;
}
return JsonBack ( new JsonRtn ( ) { code = - 1 , msg = "개발자에게 문의하세요." } ) ;
}
/// <summary>
///
/// </summary>
/// <param name="cmisno"></param>
/// <param name="lectno"></param>
/// <returns></returns>
[HttpPost]
2025-12-11 14:32:17 +09:00
public JsonResult UpdateScd ( int cmno , int cmino , int cmisno , int lectno ) {
2022-08-03 16:50:01 +09:00
var pass = Dao . Get < int > ( "cm.cminningscdcheck" , new System . Collections . Hashtable ( ) { { "cmisno" , cmisno } } ) . First ( ) ;
2023-07-10 14:18:15 +09:00
IList < CMinningscd > result2 = new List < CMinningscd > ( ) ;
result2 = Dao . Get < CMinningscd > ( "cm.cminningscds.attr2Check" , new System . Collections . Hashtable ( ) { { "cmno" , cmno } , { "cmino" , cmino } } ) ;
2025-12-11 14:32:17 +09:00
if ( result2 . Count ( ) > 0 ) {
2023-07-10 14:18:15 +09:00
int tempInt = result2 . Where ( c = > c . cmino = = cmino & & c . cmisno = = cmisno & & c . intv1 = = 2 ) . Count ( ) ;
pass + = tempInt ;
}
2020-11-11 16:26:18 +09:00
if ( pass = = 0 )
2020-11-12 08:53:49 +09:00
return JsonBack ( new JsonRtn ( ) { code = 0 , msg = "해당 일정은 모집 인원이 마감되었습니다." } ) ;
2025-12-11 14:32:17 +09:00
else if ( pass > 0 ) {
Dao . Save ( "cm.lectcmisno.up" , new System . Collections . Hashtable ( ) { { "cmisno" , cmisno } , { "lectno" , lectno } , { "uno" , SUserInfo . UserNo } , { "uip" , GetUserIP ( ) } } ) ;
2020-11-11 16:26:18 +09:00
return JsonBack ( new JsonRtn ( ) { code = 1 , msg = "일정을 변경하였습니다." } ) ;
}
return JsonBack ( new JsonRtn ( ) { code = - 1 , msg = "개발자에게 문의하세요." } ) ;
}
2020-11-24 15:39:09 +09:00
[HttpPost]
2025-12-11 14:32:17 +09:00
public JsonResult CheckExistSnsId ( string snsid , int jointype ) {
2020-11-24 15:39:09 +09:00
var result = Dao . Get < Users > ( "users.check.snsid" , new Hashtable ( ) { { "snsid" , snsid } , { "jointype" , jointype } } ) . Count ( ) ;
2025-12-11 14:32:17 +09:00
if ( result > 0 ) {
2020-11-24 15:39:09 +09:00
return JsonBack ( new JsonRtn ( ) { code = 1 } ) ;
2025-12-11 14:32:17 +09:00
} else {
2020-11-24 15:39:09 +09:00
return JsonBack ( new JsonRtn ( ) { code = - 1 } ) ;
}
}
2020-11-11 16:26:18 +09:00
2020-11-24 15:39:09 +09:00
[HttpPost]
2025-12-11 14:32:17 +09:00
public JsonResult SnsLogin ( String uid , bool isSns = false ) {
if ( ! string . IsNullOrEmpty ( uid ) ) {
2020-11-24 15:39:09 +09:00
var u = GoLogin ( uid , "" , isSns ) ;
2025-12-11 14:32:17 +09:00
if ( u ! = null ) {
if ( u . userno < 0 ) {
2020-11-24 15:39:09 +09:00
return JsonBack ( new JsonRtn ( ) { code = 1000 , obj = - 1 , msg = u . subdomain } ) ;
}
return JsonOK ( u . userno ) ;
}
}
return JsonOK ( 0 ) ;
}
2020-11-30 14:44:19 +09:00
[HttpPost]
2025-12-11 14:32:17 +09:00
public JsonResult SnsLink ( String snsid , int jointype = 0 ) {
try {
2021-07-14 11:20:48 +09:00
if ( string . IsNullOrEmpty ( snsid ) & & jointype = = 0 ) //SNS 연동을 해제
{
Dao . Save ( "users.snslink.up" , new System . Collections . Hashtable ( ) { { "userno" , SUserInfo . UserNo } , { "snsid" , snsid } , { "jointype" , jointype } , { "uno" , SUserInfo . UserNo } , { "uip" , GetUserIP ( ) } } ) ;
return JsonBack ( new JsonRtn ( ) { code = 1 } ) ;
2025-12-11 14:32:17 +09:00
} else //SNS 연동
{
2021-07-14 11:20:48 +09:00
var result = Dao . Get < Users > ( "users.check.snsid" , new Hashtable ( ) { { "snsid" , snsid } , { "jointype" , jointype } } ) . Count ( ) ;
if ( result > 0 ) //SNS 연동 중복체크
{
return JsonBack ( new JsonRtn ( ) { code = - 99 } ) ;
2025-12-11 14:32:17 +09:00
} else {
2021-07-14 11:20:48 +09:00
Dao . Save ( "users.snslink.up" , new System . Collections . Hashtable ( ) { { "userno" , SUserInfo . UserNo } , { "snsid" , snsid } , { "jointype" , jointype } , { "uno" , SUserInfo . UserNo } , { "uip" , GetUserIP ( ) } } ) ;
return JsonBack ( new JsonRtn ( ) { code = 1 } ) ;
}
}
2025-12-11 14:32:17 +09:00
} catch ( Exception e ) {
2020-11-30 14:44:19 +09:00
return JsonBack ( new JsonRtn ( ) { code = - 1 } ) ;
}
}
2020-11-30 14:13:00 +09:00
[HttpPost]
2025-12-11 14:32:17 +09:00
public JsonResult SendLakey ( Int64 lectno , String mobile ) {
2020-11-30 14:13:00 +09:00
Random r = new Random ( ) ;
int lakey = r . Next ( 100000 , 999999 ) ;
2025-12-11 14:32:17 +09:00
SmsAuth sa = new SmsAuth ( ) { lakey = lakey . ToString ( ) , lectno = lectno } ;
2020-12-03 09:00:31 +09:00
String msg = "[영남건설기술교육원]\n\n영남건설기술교육원 인증번호 [" + lakey + "] 입니다." ;
2020-11-30 14:13:00 +09:00
var users = Dao . Get < Users > ( "users.findme" , new Hashtable ( ) { { "mobile" , mobile } } ) . ToList ( ) ;
2025-12-11 14:32:17 +09:00
if ( users . Count ( ) = = 0 ) {
2020-11-30 14:13:00 +09:00
return JsonBack ( new JsonRtn ( ) { code = - 2 } ) ;
}
2025-12-11 14:32:17 +09:00
if ( users . Count ( ) ! = 1 ) {
2020-11-30 14:13:00 +09:00
return JsonBack ( new JsonRtn ( ) { code = - 1 } ) ;
}
Dao . Insert ( "common.smsauth" , sa ) ;
2020-12-10 10:57:07 +09:00
IList < NP . Model . MemoUser > us = new List < NP . Model . MemoUser > ( ) ;
2025-12-11 14:32:17 +09:00
us . Add ( new MemoUser ( ) {
2020-12-10 10:57:07 +09:00
userno = SUserInfo . UserNo ,
mobile = mobile ,
title = "인증번호" ,
mcontents = msg ,
smstype = "A" ,
isok = 1
} ) ;
SaveTalk ( us , "alarm" ) ;
2021-03-31 11:23:40 +09:00
//Dao.Insert("common.atalk.send", new Hashtable() { { "senderkey", GetConfig("mastersms").Split(';')[0] }, { "method", "alarm" }, { "DEST_PHONE", mobile.Replace(" ", "").Replace("-", "") }, { "SEND_PHONE", GetConfig("mtssendnum").Split(';')[0] }, { "title", "인증번호" }, { "MSG_BODY", msg }, { "replace_type", "S" } });
2020-11-30 14:13:00 +09:00
return JsonOK ( sa . authno ) ;
}
[HttpPost]
2025-12-11 14:32:17 +09:00
public JsonResult ExtendLakey ( int authno ) {
2020-11-30 14:13:00 +09:00
return JsonOK ( Dao . Save ( "common.sms.extend" , new Hashtable ( ) { { "authno" , authno } } ) ) ;
}
[HttpPost]
2025-12-11 14:32:17 +09:00
public JsonResult ChkLakey ( String lakey , int authno ) {
2020-11-30 14:13:00 +09:00
IList < Data > datas = Dao . Get < Data > ( "common.sms.chk" , new Hashtable ( ) { { "authno" , authno } } ) ;
2025-12-11 14:32:17 +09:00
if ( datas . Count ( ) < 1 ) {
2020-11-30 14:13:00 +09:00
return JsonOK ( 0 ) ;
2025-12-11 14:32:17 +09:00
} else if ( datas . Where ( w = > w . strval . Replace ( " " , "" ) . Equals ( lakey . Replace ( " " , "" ) ) & & w . time . AddMinutes ( 3 ) < DateTime . Now ) . Count ( ) > 0 ) {
2020-11-30 14:13:00 +09:00
return JsonBack ( new JsonRtn ( ) { code = 1 } ) ;
2025-12-11 14:32:17 +09:00
} else if ( datas . Where ( w = > w . strval . Replace ( " " , "" ) . Equals ( lakey . Replace ( " " , "" ) ) & & w . time . AddMinutes ( 3 ) > = DateTime . Now ) . Count ( ) > 0 ) {
Dao . Save ( "lect.isatt.in" , new System . Collections . Hashtable ( ) { { "lectno" , datas . FirstOrDefault ( ) . intval2 } , { "lakey" , datas . FirstOrDefault ( ) . strval } } ) ;
return JsonBack ( new JsonRtn ( ) { code = 1000 , obj = datas . First ( ) } ) ;
2020-11-30 14:13:00 +09:00
}
return JsonOK ( 0 ) ;
}
2021-04-15 16:13:10 +09:00
[HttpPost]
2025-12-11 14:32:17 +09:00
public JsonResult ChkLakeyForLectinning ( String lakey , int authno , long cmino ) {
2021-06-08 18:30:02 +09:00
IList < Data > datas = Dao . Get < Data > ( "common.sms.chk" , new Hashtable ( ) { { "authno" , authno } } ) ;
2025-12-11 14:32:17 +09:00
if ( datas . Count ( ) < 1 ) {
2021-06-08 18:30:02 +09:00
return JsonOK ( 0 ) ;
2025-12-11 14:32:17 +09:00
} else if ( datas . Where ( w = > w . strval . Replace ( " " , "" ) . Equals ( lakey . Replace ( " " , "" ) ) & & w . time . AddMinutes ( 3 ) < DateTime . Now ) . Count ( ) > 0 ) {
2021-06-08 18:30:02 +09:00
return JsonBack ( new JsonRtn ( ) { code = 1 } ) ;
2025-12-11 14:32:17 +09:00
} else if ( datas . Where ( w = > w . strval . Replace ( " " , "" ) . Equals ( lakey . Replace ( " " , "" ) ) & & w . time . AddMinutes ( 3 ) > = DateTime . Now ) . Count ( ) > 0 ) {
2021-06-08 18:30:02 +09:00
var lectno = datas . FirstOrDefault ( ) . intval2 ;
var lectInnings = Dao . Get < LectInning > ( "cr.cminnings" , new System . Collections . Hashtable ( ) { { "lectno" , lectno } , { "userno" , SUserInfo . UserNo } } ) ;
2025-12-11 14:32:17 +09:00
if ( lectInnings . Where ( w = > w . cmino = = cmino ) . Count ( ) > 0 ) {
2021-06-08 18:30:02 +09:00
var Hashtable = new System . Collections . Hashtable ( ) {
{ "lectno" , lectno } ,
{ "cmino" , cmino } ,
{ "isattcheck" , 1 } ,
{ "userno" , SUserInfo . UserNo } ,
{ "uno" , SUserInfo . UserNo } ,
{ "uip" , GetUserIP ( ) }
} ;
Dao . Save ( "lect.lectinning.isatt.in" , Hashtable ) ;
return JsonBack ( new JsonRtn ( ) { code = 1000 , obj = datas . First ( ) } ) ;
2025-12-11 14:32:17 +09:00
}
2021-06-08 18:30:02 +09:00
}
return JsonOK ( 0 ) ;
2025-12-11 14:32:17 +09:00
}
2021-06-08 18:30:02 +09:00
[HttpPost]
2025-12-11 14:32:17 +09:00
public JsonResult PageLearningTotalTime ( Int64 lectno , Int64 cmino , int cpno ) {
if ( SUserInfo . UserNo > 0 ) {
2021-04-15 16:13:10 +09:00
var totstudy = Dao . Get < int > ( "cr.lectinningpage.totstudy" , new Hashtable ( ) { { "lectno" , lectno } , { "cmino" , cmino } , { "cpno" , cpno } } ) . First ( ) ;
return JsonOK ( totstudy , true ) ;
}
return JsonOK ( 0 ) ;
}
2024-05-02 12:42:16 +09:00
2025-12-11 14:32:17 +09:00
public JsonResult GetOkCert3Rslt ( string stringval ) {
2024-05-02 12:42:16 +09:00
stringval = string . IsNullOrWhiteSpace ( stringval ) ? "" : stringval . Trim ( ) ;
//string result = "NoCert"; // 초기값
OkCert3Result result = new OkCert3Result ( ) ;
result . rsltCd = "NoCert" ;
2025-12-11 14:32:17 +09:00
if ( ! string . IsNullOrWhiteSpace ( stringval ) ) {
2024-05-02 12:42:16 +09:00
stringval = HttpUtility . UrlDecode ( stringval ) ;
string decStr = DecString ( stringval ) ;
string tempStr = "" ;
string [ ] tempArr = decStr . Split ( ',' ) ;
string gubn = tempArr [ 2 ] ;
result . reasonNo = int . Parse ( tempArr [ 3 ] . ToString ( ) ) ;
result . rsltCd = tempArr [ 4 ] ;
string certiOkData = Dao . Get < string > ( "sys.okcert3.get" , new Hashtable { { "no" , tempArr [ 0 ] } , { "sn" , tempArr [ 1 ] } } ) . FirstOrDefault ( ) ;
JObject data = JObject . FromObject ( JsonConvert . DeserializeObject ( certiOkData ) ) ;
result . no = long . Parse ( tempArr [ 0 ] ) ;
result . sn = tempArr [ 1 ] ;
result . gubn = gubn ;
result . ci = data [ "CI" ] . ToString ( ) ;
result . di = data [ "DI" ] . ToString ( ) ;
result . username = data [ "RSLT_NAME" ] . ToString ( ) ;
result . birthday = data [ "RSLT_BIRTHDAY" ] . ToString ( ) ;
result . mobile = data [ "TEL_NO" ] = = null ? "" : data [ "TEL_NO" ] . ToString ( ) ;
result . vssn = data [ "VSSN" ] = = null ? "" : data [ "VSSN" ] . ToString ( ) ;
2025-12-11 14:32:17 +09:00
if ( ! string . IsNullOrWhiteSpace ( result . mobile ) ) {
2024-05-02 12:42:16 +09:00
tempStr = result . mobile . Trim ( ) ;
2025-12-11 14:32:17 +09:00
if ( tempStr . Length = = 10 ) {
2024-05-02 12:42:16 +09:00
result . mobile = tempStr . Substring ( 0 , 3 ) + "-" + tempStr . Substring ( 3 , 3 ) + "-" + tempStr . Substring ( 6 , 4 ) ;
2025-12-11 14:32:17 +09:00
} else if ( tempStr . Length = = 11 ) {
2024-05-02 12:42:16 +09:00
result . mobile = tempStr . Substring ( 0 , 3 ) + "-" + tempStr . Substring ( 3 , 4 ) + "-" + tempStr . Substring ( 7 , 4 ) ;
}
// 10,11 개 아닐 경우 그대로 표현
}
}
return JsonOKObj ( result ) ;
}
2025-10-01 16:59:10 +09:00
/// <summary>
/// 비밀번호 변경
/// </summary>
/// <returns></returns>
[HttpPost]
[ValidateAntiForgeryToken]
2025-12-11 14:32:17 +09:00
public JsonResult UserChangePassword ( string userid , string password ) {
try {
2025-10-01 16:59:10 +09:00
#region + 유 효 성 검 사 ( 실 패 시 즉 시 반 환 )
// 1. 빈 문자열 확인
2025-12-11 14:32:17 +09:00
if ( string . IsNullOrEmpty ( userid ) | | string . IsNullOrEmpty ( password ) ) {
2025-10-01 16:59:10 +09:00
return Json ( new { success = false , message = "아이디 또는 비밀번호를 입력해주세요." , data = - 1 } ) ;
}
// 2. 비밀번호 복잡도 검사 (8자 이상, 영문, 숫자, 특수문자 포함)
var passwordRegex = new Regex ( "^(?=.*[a-zA-Z])(?=.*\\d)(?=.*[\\W_]).{8,}$" ) ;
2025-12-11 14:32:17 +09:00
if ( ! passwordRegex . IsMatch ( password ) ) {
2025-10-01 16:59:10 +09:00
return Json ( new { success = false , message = "비밀번호는 8자 이상이며, 영문, 숫자, 특수문자를 포함해야 합니다." , data = - 2 } ) ;
}
// 3. 3번 이상 연속되는 동일한 문자/숫자/기호 검사
var repeatRegex = new Regex ( "(.)\\1\\1" ) ;
2025-12-11 14:32:17 +09:00
if ( repeatRegex . IsMatch ( password ) ) {
2025-10-01 16:59:10 +09:00
return Json ( new { success = false , message = "연속으로 3번 이상 반복되는 문자를 사용할 수 없습니다." , data = - 3 } ) ;
}
#endregion
// 모든 유효성 검사를 통과한 경우 진행
var p = new Hashtable ( ) ;
long userNo = - 1 ;
2025-12-11 14:32:17 +09:00
2025-10-01 16:59:10 +09:00
#region + Get : users . findme
// userno 추출을 위한 목적
p . Clear ( ) ;
p . Add ( "userid" , userid ) ;
Users user = Dao . Get < Users > ( "users.findme" , p )
. FirstOrDefault ( ) ? ? new Users ( ) ;
userNo = user . userno ;
#endregion
#region + Save : users . change . password ( 비 밀 번 호 재 설 정 )
2025-12-11 14:32:17 +09:00
if ( userNo > 0 ) {
2025-10-01 16:59:10 +09:00
p . Clear ( ) ;
p . Add ( "userid" , userid ) ;
p . Add ( "userpass" , Base . Lib . KISA_SHA256 . SHA256Hash ( password ) ) ;
p . Add ( "userno" , userNo ) ;
p . Add ( "uip" , GetUserIP ( ) ) ;
2025-12-11 14:32:17 +09:00
Dao . Save ( "users.change.password" , p ) ;
2025-10-01 16:59:10 +09:00
}
#endregion
return Json ( new { success = true , message = "비밀번호가 성공적으로 변경되었습니다." , data = 0 } ) ;
2025-12-11 14:32:17 +09:00
} catch ( Exception ex ) {
2025-10-01 16:59:10 +09:00
SetError ( $"UserChangePassword: {ex.Message}" ) ;
return Json ( new { success = false , message = "처리 중 오류가 발생했습니다. 다시 시도해주세요." , data = - 10 } ) ;
}
}
2020-10-12 14:39:23 +09:00
}
2021-04-15 16:13:10 +09:00
}