2020-10-12 14:39:23 +09:00
using System ;
using System.Collections.Generic ;
using System.Linq ;
using System.Web ;
using System.Web.Mvc ;
using NP.Model ;
using System.Collections ;
using NP.Base.Auth ;
using NP.Base.ENUM ;
using System.Net.Http ;
2020-12-01 15:50:16 +09:00
using XPayClientNet ;
2021-04-28 18:23:25 +09:00
using NP.Base.Popbill ;
2020-10-12 14:39:23 +09:00
namespace NP.Base.Controllers
{
public partial class ACommonController : NP . Base . BaseController
{
[HttpPost]
public JsonResult LogSetExam ( int exno , int userno )
{
LogSet ( new ActLog ( ) { logtype = 80 , logtarget = 21 , logdata = "시험번호: " + exno , userno = userno , uno = SUserInfo . UserNo , uip = GetUserIP ( ) } ) ;
return JsonOK ( 1 ) ;
}
[HttpPost]
2021-01-19 15:57:17 +09:00
public JsonResult LectSEDateChange ( Int64 lectno , string sdate , string edate , int pstatus , int rstatus )
{
if ( pstatus ! = 1 | | rstatus ! = 0 )
{
return JsonBack ( new JsonRtn ( ) { code = - 1 } ) ;
}
return JsonOK ( Dao . Save ( "lect.sedate.change" , new Hashtable ( ) { { "lectno" , lectno } , { "sdate" , sdate } , { "edate" , edate + " 23:59:59" } , { "uno" , SUserInfo . UserNo } , { "uip" , GetUserIP ( ) } } ) ) ;
}
[HttpPost]
2020-10-12 14:39:23 +09:00
public JsonResult LectStatus ( Int64 lectno , int status , int pstatus )
{
if ( pstatus = = 1 )
{
return JsonBack ( new JsonRtn ( ) { code = - 1 } ) ;
}
return JsonOK ( Dao . Save ( "lect.status" , new Hashtable ( ) { { "lectno" , lectno } , { "status" , status } , { "uno" , SUserInfo . UserNo } , { "uip" , GetUserIP ( ) } } ) ) ;
}
[HttpPost]
2020-11-24 13:19:48 +09:00
public JsonResult LectStatus3 ( Int64 lectno , int status , int pstatus )
{
if ( pstatus = = 1 )
{
return JsonBack ( new JsonRtn ( ) { code = - 1 } ) ;
}
return JsonOK ( Dao . Save ( "lect.status3" , new Hashtable ( ) { { "lectno" , lectno } , { "status" , status } , { "uno" , SUserInfo . UserNo } , { "uip" , GetUserIP ( ) } } ) ) ;
}
[HttpPost]
public JsonResult LectStatus2 ( string lectnos , int status , string cname , string emailinfos )
{
int rtn = Dao . Save ( "lect.status2" , new Hashtable ( ) { { "lectnos" , lectnos } , { "status" , status } , { "uno" , SUserInfo . UserNo } , { "uip" , GetUserIP ( ) } } ) ;
if ( rtn > 0 & & status = = 4 & & ! string . IsNullOrEmpty ( emailinfos ) )
{
string [ ] mails = emailinfos . Split ( ',' ) ;
foreach ( var item in mails )
{
var masteremail = GetConfig ( "masteremail" ) ;
var senderemail = masteremail . Split ( ';' ) [ 0 ] ;
if ( ! string . IsNullOrEmpty ( item . Split ( ':' ) [ 1 ] ) )
{
string [ ] mailContents = { item . Split ( ':' ) [ 0 ] , cname , DateTime . Now . ToString ( "yyyy-MM-dd hh:mm" ) } ;
SendMailTemplate ( "2" , senderemail , "영남건설기술교육원" , item . Split ( ':' ) [ 1 ] , "[영남건설기술교육원]대기중인 강좌의 수강승인 처리안내" , mailContents , null , null ) ;
}
}
}
return JsonOK ( rtn ) ;
}
[HttpPost]
2020-10-12 14:39:23 +09:00
public JsonResult CMForChange ( int cmno )
{
return JsonBack ( Dao . Get < CM > ( "lect.cmforchange" , cmno ) ) ;
}
[HttpPost]
public JsonResult LectChange ( Int64 lectno , int cmno )
{
return JsonOK ( Dao . Save ( "lect.lectchange" , new Hashtable ( ) { { "lectno" , lectno } , { "cmno" , cmno } , { "uno" , SUserInfo . UserNo } , { "uip" , GetUserIP ( ) } } ) ) ;
}
[HttpPost]
2021-06-04 18:01:04 +09:00
public JsonResult LECTReg ( int ptype , int payamt , PPLog pplog )
2020-10-12 14:39:23 +09:00
{
2021-06-04 18:01:04 +09:00
#region PPLog
#region CM
var cm = Dao . Get < CM > ( "cm.cms" , new Hashtable ( ) { { "cmno" , pplog . cmno } } ) . First ( ) ;
cm . applicableCM = ( cm . quota ! = 0 & & cm . quota - cm . lectcnt < = 0 ) ? "대기접수" : "정상접수" ;
pplog . uno = SUserInfo . UserNo ;
pplog . uip = GetUserIP ( ) ;
pplog . isready = cm . applicableCM = = "정상접수" ? 0 : 1 ;
2021-06-07 11:06:55 +09:00
pplog . cgcode = cm . pcgcode = = "1" ? "0" : "1" ;
if ( pplog . cgcode = = "1" )
2021-06-04 18:01:04 +09:00
{
pplog . cgno = cm . cgno ;
}
pplog . cshape = cm . cshape ;
#endregion
#region User
var user = Dao . Get < Users > ( "users.users" , new Hashtable ( ) { { "userno" , pplog . userno } } ) . First ( ) ;
pplog . userpno = user . userpno ;
pplog . mobile = user . mobile ;
pplog . email = user . email ;
pplog . upost = user . post ;
pplog . uaddress1 = user . address1 ;
pplog . uaddress2 = user . address2 ;
pplog . isassignuser = user . isassignuser ;
pplog . uduty = user . uduty ;
pplog . slevel = user . slevel ;
#endregion
#region Assign
if ( pplog . asno ! = null )
2020-10-12 14:39:23 +09:00
{
2021-06-04 18:01:04 +09:00
var assign = Dao . Get < Assign > ( "users.assigns2" , new Hashtable ( ) { { "asno" , pplog . asno } , { "excel1" , ",a.post" } , { "orderby" , "a.asname" } } ) . First ( ) ;
pplog . asname = assign . asname ;
pplog . brno = assign . brno ;
pplog . ceoname = assign . ceoname ;
pplog . post = assign . post ;
pplog . address1 = assign . address1 ;
pplog . address2 = assign . address2 ;
pplog . btype = assign . btype ;
pplog . bkind = assign . bkind ;
pplog . fgnobno = assign . fgnobno ;
pplog . eino = assign . eino ;
pplog . mname = assign . mname ;
pplog . mphone = assign . mphone ;
pplog . taxemail = assign . taxemail ;
2020-10-12 14:39:23 +09:00
}
2021-06-09 17:11:16 +09:00
else
{
pplog . asname = string . Empty ;
}
2021-06-04 18:01:04 +09:00
#endregion
Dao . Insert ( "cm.pplog.applyedu.in" , pplog ) ;
#endregion
#region Users . asno update
Dao . Save ( "users.asno.save" , new Hashtable ( ) { { "asno" , pplog . asno } , { "userno" , pplog . userno } } ) ;
#endregion
#region Pay
2020-10-12 14:39:23 +09:00
var payitems = new List < PayItem > ( ) { } ;
var uip = GetUserIP ( ) ;
2021-06-04 18:01:04 +09:00
payitems . Add ( new PayItem ( )
2020-10-12 14:39:23 +09:00
{
2021-06-04 18:01:04 +09:00
ptype = 0 ,
pcno = null ,
itemno = pplog . cmno ,
userno = pplog . userno ,
status = 1 ,
ispc = 0 ,
pstatus = 1 ,
pcnt = 1 ,
payamt = payamt ,
payamtcash = 0 ,
2021-06-04 18:14:29 +09:00
payamtcard = 0 ,
cmisno = pplog . cmisno ,
2021-06-04 18:01:04 +09:00
isrebate = pplog . isrebate ? ? 0 ,
rbank = pplog . rbankname ,
rbankaccnum = pplog . rbankacc ,
tbankuser = pplog . rbankowner ,
2021-06-04 18:14:29 +09:00
uno = SUserInfo . UserNo ,
2021-06-04 18:01:04 +09:00
uip = uip
} ) ;
2020-10-12 14:39:23 +09:00
//정가확인
2021-06-04 18:01:04 +09:00
var cms = Dao . Get < CM > ( "cm.cms.forpay" , new Hashtable ( ) { { "userno" , pplog . userno } , { "cmno" , payitems . First ( ) . itemno } } ) ;
2020-10-12 14:39:23 +09:00
foreach ( var pi in payitems )
{
pi . orgamt = cms . Where ( w = > w . cmno = = pi . itemno ) . First ( ) . fee ;
pi . isjoin = cms . First ( ) . isjoin ;
}
var pay = new Pay ( )
{
ptype = ptype ,
2021-06-04 18:01:04 +09:00
userno = pplog . userno ,
username = user . username ,
2020-10-12 14:39:23 +09:00
pstatus = 1 ,
rstatus = 0 ,
refunding = 0 ,
orgamt = cms . Sum ( s = > s . fee ) ,
isinmoney = 1 ,
payamt = payitems . Sum ( s = > s . payamt ) ,
PIs = payitems ,
cmnos = string . Join ( "," , payitems . Select ( s = > s . itemno ) ) ,
2021-06-04 18:01:04 +09:00
iscashrct = 0 ,
2021-06-04 18:14:29 +09:00
pplno = pplog . pplno ,
2020-10-12 14:39:23 +09:00
uno = SUserInfo . UserNo ,
uip = GetUserIP ( )
2021-06-04 18:01:04 +09:00
} ;
#endregion
2020-10-12 14:39:23 +09:00
//등록된 교육생인가 확인
2021-06-04 18:01:04 +09:00
var checklectuser = Dao . Get < Lect > ( "lect.checkuser" , new Hashtable ( ) { { "userno" , pplog . userno } , { "cmnos" , pay . cmnos } } ) . Count ( ) ;
2020-10-12 14:39:23 +09:00
if ( checklectuser > 0 )
{
return JsonOK ( - 4 ) ;
}
2021-06-07 11:06:55 +09:00
return JsonOK ( Dao . SavePay ( pay , true , true ) ) ;
2020-10-12 14:39:23 +09:00
}
[HttpPost]
public JsonResult LectBatch ( String datas )
{
var lectdatas = "" ;
if ( datas ! = "" )
{
foreach ( var s in datas . Split ( ';' ) )
{
var v = s . Split ( ':' ) ;
if ( ! string . IsNullOrEmpty ( v [ 0 ] ) & & v [ 1 ] = = "0" )
{
//만약 패키지 번호라면 패키지에 해당하는 강좌번호 입력
var cms = Dao . Get < CM > ( "cm.cmpcsbycmnos" , new Hashtable ( ) { { "pcnos" , v [ 0 ] } } ) ;
for ( var i = 0 ; i < cms . Count ( ) ; i + + )
{
lectdatas + = ";" + v [ 0 ] + ":" + cms [ i ] . cmno + ":" + v [ 2 ] + ":" + v [ 3 ] + ":" + v [ 4 ] + ":" + v [ 5 ] + ":" + v [ 6 ] ;
}
}
else
{
lectdatas + = ";" + v [ 0 ] + ":" + v [ 1 ] + ":" + v [ 2 ] + ":" + v [ 3 ] + ":" + v [ 4 ] + ":" + v [ 5 ] + ":" + v [ 6 ] ;
}
}
}
//패키지강좌 교육생별 등록
return JsonOK ( Dao . SavePayBatch ( lectdatas . Substring ( 1 ) , SUserInfo . UserNo , GetUserIP ( ) ) ) ;
}
[HttpPost]
public JsonResult SCDLectSave ( String sd )
{
var scd = new SCDLect ( ) { uno = SUserInfo . UserNo , uip = GetUserIP ( ) , Ds = new List < SCDLect > ( ) { } } ;
foreach ( var s in sd . Split ( ';' ) )
{
var v = s . Split ( ':' ) ;
2020-11-05 11:07:44 +09:00
scd . Ds . Add ( new SCDLect ( ) { scdno = GetInt ( v [ 0 ] ) , dday = GetInt ( v [ 1 ] ) , dtime = GetInt ( v [ 2 ] ) , istalk = GetInt ( v [ 3 ] ) , isemail = GetInt ( v [ 4 ] ) , isuse = GetInt ( v [ 5 ] ) , issms = GetInt ( v [ 6 ] ) } ) ;
2020-10-12 14:39:23 +09:00
}
return JsonOK ( Dao . Save ( "lect.scdlect.save" , scd ) ) ;
}
/// <summary>
/// 자격검정 정보 추가
/// </summary>
[HttpPost]
[ValidateInput(false)]
public JsonResult ExamSave ( VMCM vm )
{
vm . Exam . uno = SUserInfo . UserNo ; vm . Exam . uip = GetUserIP ( ) ;
if ( Request . Files . GetMultiple ( "fgno" ) . Where ( w = > ! string . IsNullOrEmpty ( w . FileName ) ) . Count ( ) > 0 )
{
vm . Exam . fgno = SetFile ( Request . Files . GetMultiple ( "fgno" ) . Where ( w = > ! string . IsNullOrEmpty ( w . FileName ) ) . ToList ( ) , vm . Exam . fgno ? ? 0 , "exam" , "fgno" ) ;
}
vm . Exam . retime = Convert . ToDateTime ( vm . Exam . retime . ToString ( "yyyy-MM-dd" ) + " 23:59:59" ) ;
vm . Exam . estime = Convert . ToDateTime ( vm . Exam . estime . ToString ( "yyyy-MM-dd" ) + " " + vm . estime . ToString ( "00" ) + ":00" ) ;
vm . Exam . eetime = Convert . ToDateTime ( vm . Exam . estime . ToString ( "yyyy-MM-dd" ) + " " + vm . eetime . ToString ( "00" ) + ":00" ) ;
if ( ! ( vm . intval > 0 ) )
{
Dao . Insert < Exam > ( "exam.exam.in" , vm . Exam ) ;
}
else
{
vm . Exam . exno = vm . intval ;
Dao . Save ( "exam.exam.up" , vm . Exam ) ;
}
return JsonOK ( vm . Exam . exno ) ;
}
/// <summary>
/// 자격검정 정보 삭제
/// </summary>
[HttpPost]
public JsonResult ExamDel ( int exno )
{
return JsonOK ( Dao . Save ( "exam.del" , new Hashtable ( ) { { "exno" , exno } , { "uno" , SUserInfo . UserNo } , { "uip" , GetUserIP ( ) } } ) ) ;
}
/// <summary>
/// 자격검정 응시대상자 추가
/// </summary>
/// <param name="examuser"></param>
/// <returns></returns>
[HttpPost]
public JsonResult ExamUserSave ( ExamUser examuser )
{
examuser . uno = SUserInfo . UserNo ; examuser . uip = GetUserIP ( ) ; examuser . status = 1 ; examuser . pstatus = 4 ; examuser . avrg = 0 ;
return JsonOK ( Dao . Save ( "exam.examuser.save" , examuser ) ) ;
}
[HttpPost]
public JsonResult ExamUserDel ( String usernos , int exno )
{
//int chkcount = Dao.Get<ExamUser>("exam.iscompleteuser", new Hashtable() { { "exno", exno }, { "eunos", eunos } }).Select(s => s.userno).Count();
//if (chkcount>0){
// return JsonBack(new JsonRtn() {code = 1, obj = -1 });
//}
//eunos = string.Join(",", Dao.Get<ExamUser>("exam.nocompleteuser", new Hashtable() { { "exno", exno },{ "eunos", eunos} }).Select(s => s.userno));
//return JsonOK(Dao.Save("exam.examuserdel", new Hashtable() { { "exno", exno }, { "userno", eunos } }));
return JsonOK ( Dao . Save ( "exam.examuser.del" , new Hashtable ( ) { { "exno" , exno } , { "usernos" , usernos } } ) ) ;
}
[HttpPost]
public JsonResult PayDVRSave ( Int64 payno , String dvrcode )
{
return JsonOK ( Dao . Save ( "pay.paydvr.dvrcode" , new Hashtable ( ) { { "payno" , payno } , { "dvrcode" , dvrcode } , { "uno" , SUserInfo . UserNo } , { "uip" , GetUserIP ( ) } } ) ) ;
}
[HttpPost]
public JsonResult PayDVRTalk ( String paynos )
{
var m = new Memo ( ) { uno = SUserInfo . UserNo , uip = GetUserIP ( ) , Users = new List < MemoUser > ( ) { } } ;
var dvrs = Dao . Get < PayDVR > ( "pay.paydvrfortalk" , paynos ) ;
foreach ( var u in dvrs )
{
m . Users . Add ( new MemoUser ( )
{
userno = u . userno ,
smstype = "A" ,
isok = string . IsNullOrEmpty ( u . mobile ) ? - 1 : 1 ,
mobile = ( u . mobile ? ? "" ) . Replace ( "-" , "" ) ,
2020-10-12 15:32:10 +09:00
mcontents = string . Format ( "영남건설기술교육원입니다.\n\n{0}님, [{1}] 교재가 배송시작되었습니다.\n\n☞배송확인: https://www.ilogen.com/web/personal/trace/{2}\n☞사이트: https://edu.kfcf.or.kr" ,
2020-10-12 14:39:23 +09:00
u . username , u . dvrcount > 1 ? string . Format ( "{0} 외 {1}건" , u . bkname , u . dvrcount ) : u . bkname , u . dvrcode )
} ) ;
}
if ( m . Users . Where ( w = > w . isok = = 1 ) . Count ( ) > 0 )
{
Talk ( m . Users . Where ( w = > w . isok = = 1 ) . ToList ( ) , "delivery1" ) ;
m . Users . Clear ( ) ;
}
return JsonOK ( m . Users . Where ( w = > w . isok = = 1 ) . Count ( ) ) ;
}
[HttpPost]
public JsonResult AttOff ( Int64 cmino , bool isEnter , Int64 lectno )
{
if ( isEnter )
{
//입실
if ( Dao . Save ( "att.att.in" , new Hashtable ( ) { { "cmino" , cmino } , { "lectno" , lectno } , { "uno" , SUserInfo . UserNo } , { "uip" , GetUserIP ( ) } } ) = = 2 )
{
return JsonBack ( new JsonRtn ( ) { code = 1000 , obj = DateTime . Now . ToString ( "yyyy-MM-dd HH:mm" ) } ) ;
}
return JsonOK ( - 1 ) ;
}
//퇴실
if ( Dao . Save ( "att.att.out" , new Hashtable ( ) { { "cmino" , cmino } , { "lectno" , lectno } , { "uno" , SUserInfo . UserNo } , { "uip" , GetUserIP ( ) } } ) = = 2 )
{
return JsonBack ( new JsonRtn ( ) { code = 1000 , obj = DateTime . Now . ToString ( "yyyy-MM-dd HH:mm" ) } ) ;
}
return JsonOK ( - 2 ) ;
}
[HttpPost]
public JsonResult EUserGet ( int pstatus = 0 , int exno = 0 )
{
if ( pstatus > 0 & & exno > 0 )
{
return JsonBack ( Dao . Get < ExamUser > ( "exam.examusers" , new System . Collections . Hashtable ( ) { { "exno" , exno } , { "pstatus" , pstatus } } ) ) ;
}
return JsonNoData ( ) ;
}
/// <summary>
/// 수료처리
/// </summary>
/// <param name="cmno"></param>
/// <param name="lectnos"></param>
/// <param name="type">abs: 강제수료처리, calc: 계산수료처리, batch: 일괄계산수료처리(기수료처리자 존재 시 불가)</param>
/// <returns></returns>
[HttpPost]
public JsonResult LectComplete ( String type , String cmnos = null , String lectnos = null , int? cmno = null )
{
if ( type = = "all" )
{
return JsonOK ( Dao . Save ( "att.attend.allin" , new Hashtable ( ) { { "lectnos" , lectnos } , { "statusreason" , "관리자 일괄승인" } , { "uno" , SUserInfo . UserNo } , { "uip" , GetUserIP ( ) } } ) ) ;
}
else if ( type = = "abs" )
{
2020-11-12 13:12:08 +09:00
var Lects1 = Dao . Get < Lect > ( "grade.nocompletelect" , lectnos ) . Where ( w = > w . iscomplete ! = 1 & & lectnos . Contains ( w . lectno . ToString ( ) ) ) . ToList ( ) ;
if ( Lects1 . Count ( ) > 0 )
{
lectnos = string . Join ( "," , Lects1 . Select ( s = > s . lectno ) ) ;
var data1 = new Lect ( ) { lectnos = lectnos , uno = SUserInfo . UserNo , uip = GetUserIP ( ) } ;
return JsonOK ( Dao . Save ( "grade.lectcomplete.abs2" , data1 ) ) ;
}
else
{
return JsonBack ( new JsonRtn ( ) { code = 1 , msg = "이미 수료된 데이터는 다시 수료할 수 없습니다." } ) ;
}
//return JsonOK(Dao.Save("grade.lectcomplete.abs", new Hashtable() { { "lectnos", lectnos }, { "uno", SUserInfo.UserNo }, { "uip", GetUserIP() } }));
2020-10-12 14:39:23 +09:00
}
else if ( type = = "batch" )
{
//강좌별 기 수료처리 체크 후 처리
//cmnos 에서 기 수료처리 강좌 빼기
cmnos = string . Join ( "," , Dao . Get < CM > ( "grade.nocompletecm" , cmnos ) . Select ( s = > s . cmno ) ) ;
if ( string . IsNullOrEmpty ( cmnos ) )
{
return JsonOK ( 0 ) ;
}
2020-11-12 13:12:08 +09:00
lectnos = string . Join ( "," , Dao . Get < Lect > ( "grade.nocompletelectcm" , cmnos ) . Select ( s = > s . lectno ) ) ;
}
2021-06-28 17:16:10 +09:00
var lects = Dao . Get < Lect > ( "grade.nocompletelect" , lectnos ) . Where ( w = > lectnos . Contains ( w . lectno . ToString ( ) ) ) ;
var completecount = 0 ;
var cancelcount = 0 ;
foreach ( var lect in lects )
2020-11-12 13:12:08 +09:00
{
2021-06-28 17:16:10 +09:00
var ispass = Dao . Get < Lect > ( "grade.ispass" , new Hashtable ( ) { { "lectno" , lect . lectno } } ) . FirstOrDefault ( ) . ispass ;
if ( ispass = = 1 )
{
if ( lect . iscomplete = = 0 )
{
completecount + = Dao . Save ( "grade.lectcomplete2" , new Hashtable ( ) { { "lectno" , lect . lectno } , { "uno" , SUserInfo . UserNo } , { "uip" , GetUserIP ( ) } } ) ;
}
}
else
{
if ( lect . iscomplete = = 1 )
{
cancelcount + = Dao . Save ( "grade.lectcomplete.cancel" , new Hashtable ( ) { { "lectno" , lect . lectno } , { "uno" , SUserInfo . UserNo } , { "uip" , GetUserIP ( ) } } ) ;
}
}
2020-10-12 14:39:23 +09:00
}
2021-06-28 17:16:10 +09:00
return JsonBack ( new JsonRtn ( ) { code = 1000 , msg = "OK" , obj = new { completecount , cancelcount } } ) ;
2020-10-12 14:39:23 +09:00
}
[HttpPost]
public JsonResult CMInningGetForOff ( Int64 cmino )
{
var rtn = new Hashtable ( ) { } ;
rtn . Add ( "ci" , Dao . Get < CMInning > ( "cm.cminnings" , new Hashtable ( ) { { "cmino" , cmino } } ) . First ( ) ) ;
rtn . Add ( "li" , Dao . Get < LectInning > ( "lect.lectinnings.bycmino" , new Hashtable ( ) { { "cmino" , cmino } } ) ) ;
return JsonBack ( rtn ) ;
}
[HttpPost]
public JsonResult OffAttSave ( Int64 cmino , String lis , Int64 ? fgno )
{
var cmi = new CMInning ( ) { cmino = cmino , fgno = fgno , Ds = new List < CMInning > ( ) { } , uno = SUserInfo . UserNo , uip = GetUserIP ( ) } ;
if ( Request . Files . GetMultiple ( "file" ) . Where ( w = > ! string . IsNullOrEmpty ( w . FileName ) ) . Count ( ) > 0 )
{
cmi . fgno = SetFile ( Request . Files . GetMultiple ( "file" ) . Where ( w = > ! string . IsNullOrEmpty ( w . FileName ) ) . ToList ( ) , cmi . fgno ? ? 0 , "cminning" , "fgno" ) ;
}
var lectnos = "" ;
foreach ( var s in lis . Split ( ';' ) )
{
lectnos + = "," + s . Split ( ':' ) [ 0 ] ;
cmi . Ds . Add ( new CMInning ( ) { cmino = cmino , lectno = GetInt64 ( s . Split ( ':' ) [ 0 ] ) , istatus = s . Split ( ':' ) [ 1 ] = = "" ? ( Int32 ? ) null : GetInt ( s . Split ( ':' ) [ 1 ] ) } ) ;
}
cmi . lectnos = lectnos . Substring ( 1 ) ;
if ( cmi . fgno ! = null )
{
Dao . Save ( "cm.cminning.fgno" , cmi ) ;
}
return JsonOK ( Dao . Save ( "att.off.save" , cmi ) ) ;
}
[HttpPost]
public JsonResult AttABS ( Int64 lectno , Int64 cmino , String reason )
{
return JsonOK ( Dao . Save ( "att.abs" , new Hashtable ( ) { { "lectno" , lectno } , { "cmino" , cmino } , { "statusreason" , reason } , { "uno" , SUserInfo . UserNo } , { "uip" , GetUserIP ( ) } } ) = = 2 ? 1 : 0 ) ;
}
[HttpPost]
public JsonResult PageLogs ( int userno , String start , String end , int logsite )
{
return JsonBack ( Dao . Get < PageLog > ( "lect.pagelogs" , new System . Collections . Hashtable ( ) { { "start" , start } , { "end" , end + " 23:59:59" } , { "userno" , userno } , { "logsite" , logsite } } ) ) ;
}
[HttpPost]
public JsonResult LectEXes ( int cmno , int exno , int? isrebate = null , int? estate = null )
{
return JsonBack ( Dao . Get < LectEX > ( "lect.lectexes" , new System . Collections . Hashtable ( ) { { "cmno" , cmno } , { "exno" , exno } , { "isrebate" , isrebate } , { "estate" , estate } } ) ) ;
}
[HttpPost]
public JsonResult ReExam ( int exno , Int64 lectno )
{
return JsonOK ( Dao . Save ( "lect.reexam" , new Hashtable ( ) { { "exno" , exno } , { "lectno" , lectno } , { "uno" , SUserInfo . UserNo } , { "uip" , GetUserIP ( ) } } ) > 1 ? 1 : 0 ) ;
}
[HttpPost]
public JsonResult LectEX ( Int64 lectno , int exno )
{
var rtn = new Hashtable ( ) { } ;
var ht = new Hashtable ( ) { { "lectno" , lectno } , { "exno" , exno } , { "uno" , SUserInfo . UserNo } , { "uip" , GetUserIP ( ) } } ;
rtn . Add ( "lectex" , Dao . Get < LectEX > ( "lect.lectex" , ht ) . First ( ) ) ;
var lectexq = Dao . Get < LectEXQ > ( "lect.lectexq" , ht ) ;
rtn . Add ( "lectexq" , lectexq ) ;
ht . Add ( "eqnos" , string . Join ( "," , lectexq . Select ( s = > s . eqno ) ) ) ;
rtn . Add ( "lectexqs" , Dao . Get < QuestionItem > ( "lect.lectexqs" , ht ) ) ;
rtn . Add ( "qis" , Dao . Get < QuestionItem > ( "cm.questionitems" , new Hashtable ( ) { { "qnos" , string . Join ( "," , lectexq . Select ( s = > s . qno ) ) } } ) ) ;
return JsonBack ( rtn ) ;
}
[HttpPost]
public JsonResult LectEXQPoint ( int exno , Int64 lectno , int eqno , int cpoint )
{
return JsonOK ( Dao . Save ( "lect.lectexq.point" , new Hashtable ( ) { { "lectno" , lectno } , { "exno" , exno } , { "eqno" , eqno } , { "cpoint" , cpoint } , { "uno" , SUserInfo . UserNo } , { "uip" , GetUserIP ( ) } } ) ) ;
}
public JsonResult ExamUserBatch ( int intval , String datas )
{
var eu = new ExamUser ( ) { exno = intval , Ds = new List < ExamUser > ( ) { } , uno = SUserInfo . UserNo , uip = GetUserIP ( ) } ;
foreach ( var s in datas . Split ( ';' ) )
{
var v = s . Split ( ':' ) ;
if ( string . IsNullOrEmpty ( v [ 2 ] ) ) { v [ 2 ] = "0" ; }
if ( string . IsNullOrEmpty ( v [ 3 ] ) ) { v [ 3 ] = "0" ; }
if ( string . IsNullOrEmpty ( v [ 4 ] ) ) { v [ 4 ] = "0" ; }
eu . Ds . Add ( new ExamUser ( )
{
userno = Convert . ToInt32 ( v [ 1 ] ) ,
epoint1 = ( float? ) Convert . ToDouble ( v [ 2 ] ) ,
epoint2 = ( float? ) Convert . ToDouble ( v [ 3 ] ) ,
epoint3 = ( float? ) Convert . ToDouble ( v [ 4 ] ) ,
avrg = ( float ) Math . Round ( ( Convert . ToDouble ( v [ 2 ] ) + Convert . ToDouble ( v [ 3 ] ) + Convert . ToDouble ( v [ 4 ] ) ) / 3.0 , 1 ) ,
ispass = v [ 5 ] = = "1" ? 1 : 0
} ) ;
}
return JsonOK ( Dao . Save ( "exam.examuserbatch" , eu ) ) ;
}
[HttpPost]
public JsonResult ExamOpen ( int intval , int isresultopen )
{
return JsonOK ( Dao . Save ( "exam.examopen" , new Hashtable ( ) { { "exno" , intval } , { "isresultopen" , isresultopen } , { "uno" , SUserInfo . UserNo } , { "uip" , GetUserIP ( ) } } ) ) ;
}
[HttpPost]
public JsonResult LectSDs ( int cmno , int sdno , int? isrebate = null , int? sdstate = null )
{
return JsonBack ( Dao . Get < LectSD > ( "lect.lectsds" , new System . Collections . Hashtable ( ) { { "cmno" , cmno } , { "sdno" , sdno } , { "isrebate" , isrebate } , { "estate" , sdstate } } ) ) ;
}
[HttpPost]
public JsonResult LectSD ( Int64 lectno , int sdno )
{
return JsonBack ( Dao . Get < LectSD > ( "lect.lectsd" , new Hashtable ( ) { { "lectno" , lectno } , { "sdno" , sdno } } ) . First ( ) ) ;
}
[HttpPost]
public JsonResult LectSDSave ( LectSD d )
{
d . uno = SUserInfo . UserNo ; d . uip = GetUserIP ( ) ;
return JsonOK ( Dao . Save ( "lect.lectsd" + ( d . ccount = = 1 ? "2" : "" ) + ".save" + ( string . IsNullOrEmpty ( d . lectnos ) ? "" : "batch" ) , d ) ) ;
}
[HttpGet]
public JsonResult LectSDZip ( VMLect vm , int cmno , int classno , int sdno )
{
var sds = Dao . Get < LectSD > ( "lect.lectsdfiles" , sdno ) ;
if ( sds . Count ( ) < 1 )
{
return JsonOK ( 0 ) ;
}
//directory 없을시 생성
if ( ! System . IO . Directory . Exists ( Server . MapPath ( vm . Files + "/SubjectZip" ) ) )
{
System . IO . Directory . CreateDirectory ( Server . MapPath ( vm . Files + "/SubjectZip" ) ) ;
}
//zip으로 묶어서 다운로드
var zipName = "SubjectFile_" + cmno + "_" + classno + "_" + sdno + ".zip" ;
var zipUrl = vm . Files + "/SubjectZip/" + zipName ;
//이미 생성된 zip파일 존재하면 삭제
if ( System . IO . File . Exists ( Server . MapPath ( zipUrl ) ) )
{
System . IO . File . Delete ( Server . MapPath ( zipUrl ) ) ;
}
//zip 생성
List < File > newfile = new List < File > ( ) ;
foreach ( var f in sds )
{
2021-03-23 15:48:39 +09:00
newfile . Add ( new File ( ) { orgname = string . Format ( "{0}_{1}.{2}" , f . userid , f . username , f . fileurl . Split ( '.' ) . Last ( ) ) , fileurl = Server . MapPath ( vm . Subjects + f . fileurl ) } ) ;
2020-10-12 14:39:23 +09:00
}
if ( ! newfile . Count . Equals ( 0 ) )
{
if ( base . ZipFiles ( newfile , zipUrl , "" ) )
{
Response . ClearContent ( ) ;
Response . Clear ( ) ;
Response . ContentType = "text/plain" ;
Response . AddHeader ( "Content-Disposition" , "attachment; filename=" + HttpUtility . UrlEncode ( zipName , System . Text . Encoding . UTF8 ) + ";" ) ;
Response . TransmitFile ( Server . MapPath ( zipUrl ) ) ;
Response . Flush ( ) ;
Response . End ( ) ;
System . IO . File . Delete ( Server . MapPath ( zipUrl ) ) ;
//return Json(zipName);
}
}
return null ;
}
[HttpPost]
public JsonResult LectDiscusses ( int cmno , int sdno , int? isrebate = null , int? dcount = null )
{
var _ht = new System . Collections . Hashtable ( ) { { "cmno" , cmno } , { "sdno" , sdno } , { "isrebate" , isrebate } } ;
if ( dcount ! = null )
{
_ht . Add ( "dcount" , "=" + dcount ) ;
if ( dcount = = 3 )
{
_ht [ "dcount" ] = ">2" ;
}
}
return JsonBack ( Dao . Get < LectSD > ( "lect.lectdiscusses" , _ht ) ) ;
}
[HttpPost]
public JsonResult LectDiscuss ( Int64 lectno , int sdno )
{
var rtn = new Hashtable ( ) { } ;
var sd = Dao . Get < LectSD > ( "lect.lectdiscuss" , new Hashtable ( ) { { "lectno" , lectno } , { "sdno" , sdno } } ) . First ( ) ;
rtn . Add ( "sd" , sd ) ;
rtn [ "ds" ] = Dao . Get < LectSDBoard > ( "lect.lectsdboards" , new Hashtable ( ) { { "lectno" , lectno } , { "sdno" , sdno } } ) ;
return JsonBack ( rtn ) ;
}
[HttpPost]
public JsonResult ExamUserChange ( int exno , int userno , DateTime certdate , DateTime certindate , string renewreason )
{
if ( string . IsNullOrEmpty ( certdate . ToString ( ) ) | | string . IsNullOrEmpty ( certindate . ToString ( ) ) )
{
return JsonBack ( new JsonRtn ( ) { code = 1 , msg = "갱신날짜를 입력해주세요" , obj = "" } ) ;
}
return JsonOK ( Dao . Save ( "exam.examuser.renew" , new Hashtable ( ) { { "exno" , exno } , { "userno" , userno } , { "certdate" , certdate } , { "certindate" , certindate } , { "renewreason" , renewreason } , { "uno" , SUserInfo . UserNo } , { "uip" , GetUserIP ( ) } } ) ) ;
}
[HttpPost]
public JsonResult ExamUserRenews ( int exno , int userno )
{
return JsonBackList ( Dao . Get < ExamUserRenew > ( "exam.examuserrenews" , new Hashtable ( ) { { "exno" , exno } , { "userno" , userno } , { "orderby" , 1 } } ) ) ;
}
[HttpPost]
public JsonResult PayDVRSave2 ( PayDVR d )
{
d . uno = SUserInfo . UserNo ; d . uip = GetUserIP ( ) ;
return JsonOK ( Dao . Save ( "pay.paydvr.save" , d ) ) ;
}
[HttpPost]
public JsonResult ExamUserPayOK ( int exno , int userno , int ptype , DateTime payoktime )
{
var pay = new Pay ( ) { exno = exno , userno = userno , ptype = ptype , payoktime = payoktime , uno = SUserInfo . UserNo , uip = GetUserIP ( ) } ;
Dao . Insert ( "cr.examuserpayok" , pay ) ;
if ( pay . payno > 0 )
{
var payitem = new PayItem ( ) { payno = pay . payno , itemno = exno , userno = userno , uno = SUserInfo . UserNo , uip = GetUserIP ( ) } ;
Dao . Insert ( "cr.examuserpayok2" , payitem ) ;
if ( payitem . pino > 0 )
{
if ( Dao . Save ( "cr.examuserpayok3" , payitem ) > 0 )
{
return JsonOK ( payitem . payno ) ;
}
}
}
return JsonOK ( 0 ) ;
}
[HttpPost]
public JsonResult ExamUserPayCancel ( int exno , int userno )
{
return JsonOK ( Dao . Save ( "cr.examuserpaycancel" , new Hashtable ( ) { { "exno" , exno } , { "userno" , userno } , { "uno" , SUserInfo . UserNo } , { "uip" , GetUserIP ( ) } } ) ) ;
}
[HttpPost]
public JsonResult PayRfdSave ( PayRfd d )
{
d . uno = SUserInfo . UserNo ; d . uip = GetUserIP ( ) ;
return JsonOK ( Dao . Save ( "cr.payrfd.save" , d ) ) ;
}
[HttpPost]
public JsonResult PayRefund ( Int64 payno , String sd , int isrefunddvr , bool iscancel )
{
var p = Dao . Get < Pay > ( "cr.pay.forrfd" , payno ) . First ( ) ;
p . uno = SUserInfo . UserNo ; p . uip = GetUserIP ( ) ;
if ( iscancel ) { p . iscanceled = 1 ; }
else { p . iscanceled = 0 ; }
if ( p . pstatus = = 1 & & p . rstatus < 2 & & ! string . IsNullOrEmpty ( sd ) )
{
var pis = new List < PayItem > ( ) { } ;
foreach ( var d in sd . Split ( ';' ) )
{
var ds = d . Split ( ':' ) ;
pis . Add ( new PayItem ( ) { payno = payno , pino = GetLong ( ds [ 0 ] ) , refundamt = GetInt ( ds [ 1 ] ) , refundtime = Convert . ToDateTime ( ds [ 2 ] ) , refundinfo = ds [ 3 ] . Replace ( "phdpkpkphd" , ";" ) . Replace ( "jhpkpkjh" , ":" ) , refundstatus = GetInt ( ds [ 4 ] ) , rstatus = GetInt ( ds [ 5 ] ) } ) ;
}
//택배비환불
if ( isrefunddvr = = 1 )
{
if ( p . isrefunddvr = = 1 )
{
p . isrefunddvr = 0 ;
}
else
{
p . isrefunddvr = 1 ;
}
}
//현재취소금액만 합산
p . newrefundamt = pis . Sum ( s = > s . refundamt ) + ( p . isrefunddvr = = 1 ? p . deliamt : 0 ) ;
var pis2 = new List < PayItem > ( ) { } ;
var pis3 = new List < PayItem > ( ) { } ;
if ( pis . Where ( w = > w . rstatus = = 0 ) . Count ( ) > 0 )
{
pis2 = Dao . Get < PayItem > ( "cr.payitems.forcheck" , string . Join ( "," , pis . Where ( w = > w . rstatus = = 0 ) . Select ( s = > s . pino ) ) ) . ToList ( ) ;
}
if ( pis . Where ( w = > w . rstatus > 0 ) . Count ( ) > 0 )
{
pis3 = Dao . Get < PayItem > ( "cr.payitems.forcheck2" , string . Join ( "," , pis . Where ( w = > w . rstatus ! = 0 ) . Select ( s = > s . pino ) ) ) . ToList ( ) ;
}
if ( pis2 . Count ( ) = = pis . Where ( w = > w . rstatus = = 0 ) . Count ( ) & & pis3 . Count ( ) = = pis . Where ( w = > w . rstatus > 0 ) . Count ( ) )
{
//가상계좌는 수동환불해야 함
if ( p . ispg = = 1 & & p . ptype ! = 3 & & p . ptype ! = 6 & & ! iscancel & & pis . Where ( w = > w . rstatus = = 0 & & w . refundamt > 0 ) . Count ( ) > 0 )
{
try
{
2020-12-01 15:50:16 +09:00
2020-10-13 14:21:58 +09:00
//INIpay.SetField(ref intPInst, "oldTid", p.pgkey);//취소할 원거래번호(TID)
//INIpay.SetField(ref intPInst, "price", p.newrefundamt.ToString());//취소할 금액
//INIpay.SetField(ref intPInst, "confirm_price", (p.payamt - p.refundamt - p.newrefundamt).ToString());//이전승인금액(최초승인금액-부분취소금액)-부분취소금액
/ /
//if (resultcode != "00")
//{
// return JsonOK(0);
2020-10-12 14:39:23 +09:00
//}
2020-10-13 14:21:58 +09:00
//p.cancelcnt= GetInt(INIpay.GetResult(ref intPInst, "PRTC_Cnt"));//부분취소 요청횟수
2020-12-01 15:50:16 +09:00
string CST_PLATFORM = GetConfig ( "CST_PLATFORM" ) ;
string CST_MID = GetConfig ( "CST_MID" ) ;
string LGD_MID = ( ( "test" . Equals ( CST_PLATFORM . Trim ( ) ) ) ? "t" : "" ) + CST_MID ;
XPayClient xpay = new XPayClient ( ) ;
xpay . Init ( GetConfig ( "lgdacomConfigPath" ) , CST_PLATFORM ) ;
xpay . Init_TX ( LGD_MID ) ;
xpay . Set ( "LGD_TXNAME" , "PartialCancel" ) ;
xpay . Set ( "LGD_TID" , p . pgkey ) ;
xpay . Set ( "LGD_CANCELAMOUNT" , p . newrefundamt . ToString ( ) ) ;
//xpay.Set("LGD_REMAINAMOUNT", pd.RemainAmount);
//xpay.Set("LGD_CANCELREASON", pd.CancelReason);
//xpay.Set("LGD_RFACCOUNTNUM", pd.RfAccountNum);
//xpay.Set("LGD_RFBANKCODE", pd.RfBankCode);
//xpay.Set("LGD_RFCUSTOMERNAME", pd.RfCustomerName);
//xpay.Set("LGD_RFPHONE", pd.RfPhone);
xpay . Set ( "LGD_ENCODING" , "utf-8" ) ;
xpay . Set ( "LGD_BUYERIP" , Request . UserHostAddress ) ;
// 이하 PG 사 연동 전문 종료
/ *
* 1. 결 제 부 분 취 소 요 청 결 과 처 리
* /
//xpay.TX() 실행되면 실제 취소 처리가 이루어 집니다.
if ( xpay . TX ( ) )
{
if ( "0000" . Equals ( xpay . m_szResCode ) | | "AV11" . Equals ( xpay . m_szResCode ) )
{
}
else
{
Response . Write ( "취소요청이 실패하였습니다. <br>" ) ;
return JsonOK ( 0 ) ;
}
}
else
{
//2)API 요청 실패 화면처리
2020-12-30 10:25:07 +09:00
//Response.Write("결제 부분취소요청이 실패하였습니다. <br>");
//Response.Write("TX Response_code = " + xpay.m_szResCode + "<br>");
//Response.Write("TX Response_msg = " + xpay.m_szResMsg + "<p>");
2020-12-01 15:50:16 +09:00
return JsonOK ( 0 ) ;
}
}
catch ( Exception ex )
2020-10-12 14:39:23 +09:00
{
SetError ( ex . Message ) ;
return JsonOK ( 0 ) ;
}
}
//취소처리(db)
p . PIs = pis ;
//if(prstatus != null)
//{
// Dao.Save("cr.lectchange", p);
// return JsonBack(new JsonRtn() { code = -1, });
//}
//수강취소/시험취소
foreach ( var d in pis . Where ( w = > w . rstatus = = 0 & & w . refundstatus = = 1 ) )
{
if ( pis2 . Where ( w = > w . pino = = d . pino ) . First ( ) . ptype = = 3 )
{
p . pinosexamuser = p . pinosexamuser = = null ? ( "," + d . pino ) : ( p . pinosexamuser + "," + d . pino ) ;
}
else
{
p . pinoslect = p . pinoslect = = null ? ( "," + d . pino ) : ( p . pinoslect + "," + d . pino ) ;
}
}
//기환불건 상태변경 데이터
foreach ( var d in pis . Where ( w = > w . rstatus ! = 0 ) )
{
if ( pis3 . Where ( w = > w . pino = = d . pino ) . First ( ) . ptype = = 3 )
{
p . pinosexamuser2 = p . pinosexamuser2 = = null ? ( "," + d . pino ) : ( p . pinosexamuser2 + "," + d . pino ) ;
}
else
{
p . pinoslect2 = p . pinoslect2 = = null ? ( "," + d . pino ) : ( p . pinoslect2 + "," + d . pino ) ;
}
}
if ( p . pinosexamuser ! = null )
{
p . pinosexamuser = p . pinosexamuser . Substring ( 1 ) ;
}
if ( p . pinoslect ! = null )
{
p . pinoslect = p . pinoslect . Substring ( 1 ) ;
}
if ( p . pinosexamuser2 ! = null )
{
p . pinosexamuser2 = p . pinosexamuser2 . Substring ( 1 ) ;
}
if ( p . pinoslect2 ! = null )
{
p . pinoslect2 = p . pinoslect2 . Substring ( 1 ) ;
}
return JsonOK ( Dao . Save ( "cr.paycancel" , p ) ) ;
}
}
return JsonOK ( 0 ) ;
2021-03-24 14:34:38 +09:00
}
[HttpPost]
public JsonResult PayRefundInfoSave ( PayItem d )
{
d . uno = SUserInfo . UserNo ; d . uip = GetUserIP ( ) ;
return JsonOK ( Dao . Save ( "cr.payrefundinfo.up" , d ) ) ;
2020-10-12 14:39:23 +09:00
}
[HttpPost]
public JsonResult PayTaxSave ( PayTax d )
{
d . uno = SUserInfo . UserNo ; d . uip = GetUserIP ( ) ;
if ( d . iscancel ! = 1 & & Dao . Get < PayTax > ( "cr.paytaxes" , new Hashtable ( ) { { "payno" , d . payno } , { "cno" , d . cno } , { "iscancel" , 0 } , { "nottaxno" , d . taxno } } ) . Count ( ) > 0 )
{
return JsonBack ( new JsonRtn ( ) { code = - 1 } ) ;
}
return JsonOK ( Dao . Save ( "cr.paytax.save" , d ) ) ;
}
2021-04-26 18:19:17 +09:00
#region 세 금 계 산 서 임 시 저 장 ( 팝 빌 임 시 저 장 및 paytax . mgtkey 업 데 이 트 )
2021-04-23 18:18:52 +09:00
/// <summary>
2021-04-26 18:19:17 +09:00
/// 세금계산서 임시저장(팝빌 임시저장 및 paytax.mgtkey 업데이트)
2021-04-23 18:18:52 +09:00
/// </summary>
2021-04-26 18:19:17 +09:00
/// <param name="payTax">payTax</param>
2021-04-23 18:18:52 +09:00
/// <returns></returns>
[HttpPost]
2021-04-26 18:19:17 +09:00
public JsonResult PayTaxTempSave ( PayTax payTax )
2021-04-23 18:18:52 +09:00
{
2021-04-26 18:19:17 +09:00
payTax . uno = SUserInfo . UserNo ; payTax . uip = GetUserIP ( ) ;
if ( payTax . iscancel ! = 1 & & Dao . Get < PayTax > ( "cr.paytaxes" , new Hashtable ( ) { { "payno" , payTax . payno } , { "cno" , payTax . cno } , { "iscancel" , 0 } , { "nottaxno" , payTax . taxno } } ) . Count ( ) > 0 )
2021-04-23 18:18:52 +09:00
{
return JsonBack ( new JsonRtn ( ) { code = - 1 } ) ;
}
2021-04-26 18:19:17 +09:00
payTax . udt = DateTime . Now ;
if ( string . IsNullOrEmpty ( payTax . mgtkey ) )
{
2021-07-05 14:15:14 +09:00
payTax . mgtkey = Popbill . PopbillService . MakeMgtKey ( Dao , payTax . taxno , payTax . udt ) ;
2021-04-26 18:19:17 +09:00
}
if ( Dao . Save ( "cr.paytax.save" , payTax ) > 0 )
{
var payItems = Dao . Get < PayItem > ( "cr.paytaxitem2" , new System . Collections . Hashtable ( ) { { "taxno" , payTax . taxno } } ) ;
2021-04-28 18:23:25 +09:00
var result = Popbill . PopbillService . TempSave ( Dao , payTax , payItems ) ;
2021-04-26 18:19:17 +09:00
if ( result . IsSuccess )
{
return JsonOK ( result . Code ) ;
}
else
{
return JsonError ( JSONCode . Error , result . Message , result ) ;
}
}
return JsonOK ( 0 ) ;
2021-04-23 18:18:52 +09:00
}
2021-04-26 18:19:17 +09:00
#endregion
#region 세 금 계 산 서 발 행 ( 팝 빌 발 행 및 paytax . taxdate 업 데 이 트 )
2021-04-23 18:18:52 +09:00
/// <summary>
2021-04-26 18:19:17 +09:00
/// 세금계산서 발행(팝빌 발행 및 paytax.taxdate 업데이트)
2021-04-23 18:18:52 +09:00
/// </summary>
2021-04-26 18:19:17 +09:00
/// <param name="payTax"></param>
2021-04-23 18:18:52 +09:00
/// <returns></returns>
[HttpPost]
2021-04-26 18:19:17 +09:00
public JsonResult PayTaxIssue ( PayTax payTax )
2021-04-23 18:18:52 +09:00
{
2021-04-26 18:19:17 +09:00
payTax . uno = SUserInfo . UserNo ; payTax . uip = GetUserIP ( ) ;
if ( payTax . iscancel ! = 1 & & Dao . Get < PayTax > ( "cr.paytaxes" , new Hashtable ( ) { { "payno" , payTax . payno } , { "cno" , payTax . cno } , { "iscancel" , 0 } , { "nottaxno" , payTax . taxno } } ) . Count ( ) > 0 )
2021-04-23 18:18:52 +09:00
{
return JsonBack ( new JsonRtn ( ) { code = - 1 } ) ;
}
2021-04-26 18:19:17 +09:00
if ( payTax . taxdate = = null )
{
payTax . taxdate = new DateTime ( DateTime . Now . Year , DateTime . Now . Month , DateTime . Now . Day ) ;
}
if ( Dao . Save ( "cr.paytax.save" , payTax ) > 0 )
{
var result = Popbill . PopbillService . Issue ( payTax . mgtkey ) ;
if ( result . IsSuccess )
{
return JsonOK ( result . Code ) ;
}
else
{
return JsonError ( JSONCode . Error , result . Message , result ) ;
}
}
return JsonOK ( 0 ) ;
2021-04-23 18:18:52 +09:00
}
2021-04-26 18:19:17 +09:00
#endregion
#region 세 금 계 산 서 즉 시 발 행 ( 팝 빌 발 행 및 paytax . taxdate , paytax . mgtkey 업 데 이 트 )
2021-04-23 18:18:52 +09:00
/// <summary>
2021-04-26 18:19:17 +09:00
/// 세금계산서 즉시발행(팝빌 발행 및 paytax.taxdate ,paytax.mgtkey 업데이트)
2021-04-23 18:18:52 +09:00
/// </summary>
2021-04-26 18:19:17 +09:00
/// <param name="payTax">payTax</param>
2021-04-23 18:18:52 +09:00
/// <returns></returns>
[HttpPost]
2021-04-26 18:19:17 +09:00
public JsonResult PayTaxRegistIssue ( PayTax payTax )
2021-04-23 18:18:52 +09:00
{
2021-04-26 18:19:17 +09:00
payTax . uno = SUserInfo . UserNo ; payTax . uip = GetUserIP ( ) ;
if ( payTax . iscancel ! = 1 & & Dao . Get < PayTax > ( "cr.paytaxes" , new Hashtable ( ) { { "payno" , payTax . payno } , { "cno" , payTax . cno } , { "iscancel" , 0 } , { "nottaxno" , payTax . taxno } } ) . Count ( ) > 0 )
2021-04-23 18:18:52 +09:00
{
return JsonBack ( new JsonRtn ( ) { code = - 1 } ) ;
}
2021-04-26 18:19:17 +09:00
if ( payTax . taxdate = = null )
{
payTax . taxdate = new DateTime ( DateTime . Now . Year , DateTime . Now . Month , DateTime . Now . Day ) ;
}
payTax . udt = DateTime . Now ;
if ( string . IsNullOrEmpty ( payTax . mgtkey ) )
2021-07-05 14:15:14 +09:00
{
payTax . mgtkey = Popbill . PopbillService . MakeMgtKey ( Dao , payTax . taxno , payTax . udt ) ;
2021-04-26 18:19:17 +09:00
}
if ( Dao . Save ( "cr.paytax.save" , payTax ) > 0 )
{
var payItems = Dao . Get < PayItem > ( "cr.paytaxitem2" , new System . Collections . Hashtable ( ) { { "taxno" , payTax . taxno } } ) ;
2021-07-05 14:47:57 +09:00
var result = Popbill . PopbillService . RegistIssue ( Dao , payTax , payItems ) ;
if ( result . IsSuccess )
2021-04-26 18:19:17 +09:00
{
2021-07-05 14:47:57 +09:00
return JsonOK ( result . Code ) ;
2021-04-26 18:19:17 +09:00
}
else
{
2021-07-05 14:47:57 +09:00
return JsonError ( JSONCode . Error , result . Message , result ) ;
}
2021-04-26 18:19:17 +09:00
}
return JsonOK ( 0 ) ;
2021-04-23 18:18:52 +09:00
}
2021-04-26 18:19:17 +09:00
#endregion
#region 세 금 계 산 서 발 행 취 소 ( 발 행 전 : paytax . iscancel 상 태 값 변 경 , 발 행 완 료 : 팝 빌 발 행 취 소 및 paytax . iscancel 상 태 값 변 경 )
2021-04-23 18:18:52 +09:00
/// <summary>
2021-04-26 18:19:17 +09:00
/// 세금계산서 발행취소(발행전: paytax.iscancel 상태값 변경, 발행완료: 팝빌 발행취소 및 paytax.iscancel 상태값 변경)
2021-04-23 18:18:52 +09:00
/// </summary>
2021-04-26 18:19:17 +09:00
/// <param name="payTax"></param>
2021-04-23 18:18:52 +09:00
/// <returns></returns>
[HttpPost]
2021-04-26 18:19:17 +09:00
public JsonResult PayTaxCancelIssue ( PayTax payTax )
2021-04-23 18:18:52 +09:00
{
2021-04-26 18:19:17 +09:00
payTax . uno = SUserInfo . UserNo ; payTax . uip = GetUserIP ( ) ;
payTax . iscancel = 1 ;
2021-07-05 14:15:14 +09:00
//mgtkey 발급여부 체크
var nowPayTax = Dao . Get < PayTax > ( "cr.paytaxes" , new Hashtable ( ) { { "taxno" , payTax . taxno } } ) . FirstOrDefault ( ) ;
if ( nowPayTax ! = null & & ! string . IsNullOrEmpty ( nowPayTax . mgtkey ) )
{
payTax . mgtkey = nowPayTax . mgtkey ;
}
2021-04-26 18:19:17 +09:00
if ( ! string . IsNullOrEmpty ( payTax . mgtkey ) )
2021-04-23 18:18:52 +09:00
{
2021-04-26 18:19:17 +09:00
var taxinvoice = Popbill . PopbillService . GetTaxinvoice ( payTax ) . Data ;
if ( ! string . IsNullOrEmpty ( taxinvoice . ntsconfirmNum ) )
{
2021-04-28 18:23:25 +09:00
var result = Popbill . PopbillService . CancelIssue ( payTax . mgtkey ) ;
if ( result . IsSuccess )
2021-04-26 18:19:17 +09:00
{
2021-04-28 18:23:25 +09:00
return JsonOK ( Dao . Save ( "cr.paytax.save" , payTax ) ) ;
2021-04-26 18:19:17 +09:00
}
else
{
2021-04-28 18:23:25 +09:00
#region 팝 빌 에 서 수 동 으 로 취 소 한 상 태 면 디 비 취 소 처 리
var taxinvoiceInfo = PopbillService . GetTaxinvoiceInfo ( payTax ) . Data ;
if ( taxinvoiceInfo . stateCode = = 600 )
{
return JsonOK ( Dao . Save ( "cr.paytax.save" , payTax ) ) ;
}
#endregion
return JsonError ( JSONCode . Error , result . Message , result ) ;
2021-04-26 18:19:17 +09:00
}
}
else
{
return JsonOK ( Dao . Save ( "cr.paytax.save" , payTax ) ) ;
}
}
else
{
return JsonOK ( Dao . Save ( "cr.paytax.save" , payTax ) ) ;
2021-04-23 18:18:52 +09:00
}
}
2021-04-26 18:19:17 +09:00
#endregion
#region 세 금 계 산 서 조 회 ( 팝 빌 세 금 계 산 서 인 쇄 url 리 턴 )
/// <summary>
/// 세금계산서 조회(팝빌 세금계산서 인쇄 url 리턴)
/// </summary>
/// <param name="payTax"></param>
/// <returns></returns>
[HttpPost]
public JsonResult PayTaxView ( PayTax payTax )
{
var result = Popbill . PopbillService . GetPrintURL ( payTax . mgtkey ) ;
if ( result . IsSuccess )
{
return JsonObj < string > ( result . Data ) ;
}
else
{
return JsonError ( JSONCode . Error , result . Message , result ) ;
}
}
#endregion
2020-10-12 14:39:23 +09:00
[HttpPost]
public JsonResult SmartTaxView ( String csid )
{
var Datas = new List < Data > ( ) { } ;
var request = new SmartRequest ( )
{
MessageId = "kfcfkfcf" + DateTime . Now . ToString ( "yyyyMMddHHmmss" ) ,
Signal = "DTI_STATUS" ,
RequestTime = DateTime . Now . ToString ( "yyyyMMddHHmmss" ) ,
SendComRegno = "1048205661" ,
AuthToken = "d09OaVA0VXBsMzhnTWp3WE5SamZjRm1uQ245L3VYYjc4OWM3VG1WSlRoaz0K" ,
ServiceCode = "DTI" ,
ConversationId = new String [ 1 ] { csid }
} ;
System . Net . Http . HttpClient client = new System . Net . Http . HttpClient ( ) ;
client . BaseAddress = new Uri ( "http://demoapi.smartbill.co.kr/" ) ;
client . DefaultRequestHeaders . Accept . Add ( new System . Net . Http . Headers . MediaTypeWithQualityHeaderValue ( "application/json" ) ) ;
var response = client . PostAsJsonAsync ( "sb-api/request/" , request ) . Result ;
if ( response . IsSuccessStatusCode )
{
var result = response . Content . ReadAsAsync < SmartResult > ( ) . Result ;
if ( "30000" . Equals ( result . ResultCode ) )
{
var totalCount = result . ResultDataSet . Tables [ 0 ] . Rows . Count ;
if ( 0 < totalCount )
{
for ( var i = 0 ; i < totalCount ; i + + )
{
Datas . Add ( new Data ( )
{
strval = result . ResultDataSet . Tables [ 0 ] . Rows [ i ] . ItemArray [ 2 ] . ToString ( ) , //세금계산서 상태
strval2 = result . ResultDataSet . Tables [ 0 ] . Rows [ i ] . ItemArray [ 3 ] . ToString ( ) , //국세청 전송 상태
strval3 = result . ResultDataSet . Tables [ 0 ] . Rows [ i ] . ItemArray [ 4 ] . ToString ( ) , //국세청 전송 결과
strval4 = result . ResultDataSet . Tables [ 0 ] . Rows [ i ] . ItemArray [ 5 ] . ToString ( ) , //국세청 전송 일자
strval5 = result . ResultDataSet . Tables [ 0 ] . Rows [ i ] . ItemArray [ 9 ] . ToString ( ) , //세금계산서 작성일자
strval6 = result . ResultDataSet . Tables [ 0 ] . Rows [ i ] . ItemArray [ 10 ] . ToString ( ) , //세금계산서 발행일자
intval = GetInt ( result . ResultDataSet . Tables [ 0 ] . Rows [ i ] . ItemArray [ 7 ] . ToString ( ) ) , //세금계산서 공급가액
intval2 = GetInt ( result . ResultDataSet . Tables [ 0 ] . Rows [ i ] . ItemArray [ 8 ] . ToString ( ) ) , //세금계산서 세액
intval3 = GetInt ( result . ResultDataSet . Tables [ 0 ] . Rows [ i ] . ItemArray [ 6 ] . ToString ( ) ) //세금계산서 합계금액
} ) ;
//result.ResultDataSet.Tables[0].Rows[i].ItemArray[0].ToString();//참조번호
//result.ResultDataSet.Tables[0].Rows[i].ItemArray[1].ToString();//승인번호
//result.ResultDataSet.Tables[0].Rows[i].ItemArray[2].ToString();//세금계산서 상태
//result.ResultDataSet.Tables[0].Rows[i].ItemArray[3].ToString();//국세청 전송 상태
//result.ResultDataSet.Tables[0].Rows[i].ItemArray[4].ToString();//국세청 전송 결과
//result.ResultDataSet.Tables[0].Rows[i].ItemArray[5].ToString();//국세청 전송 일자
//result.ResultDataSet.Tables[0].Rows[i].ItemArray[6].ToString();//세금계산서 합계금액
//result.ResultDataSet.Tables[0].Rows[i].ItemArray[7].ToString();//세금계산서 공급가액
//result.ResultDataSet.Tables[0].Rows[i].ItemArray[8].ToString();//세금계산서 세액
//result.ResultDataSet.Tables[0].Rows[i].ItemArray[9].ToString();//세금계산서 작성일자
//result.ResultDataSet.Tables[0].Rows[i].ItemArray[10].ToString();//세금계산서 발행일자
//result.ResultDataSet.Tables[0].Rows[i].ItemArray[11].ToString();//세금계산서 수정코드
//result.ResultDataSet.Tables[0].Rows[i].ItemArray[12].ToString();//원본 세금계산서 승인번호
//result.ResultDataSet.Tables[0].Rows[i].ItemArray[13].ToString();//매출,매입 구분
//result.ResultDataSet.Tables[0].Rows[i].ItemArray[14].ToString();//세금계산서 유형
//result.ResultDataSet.Tables[0].Rows[i].ItemArray[15].ToString();//거래명세서 포함 여부
//result.ResultDataSet.Tables[0].Rows[i].ItemArray[16].ToString();//정,역 구분
//result.ResultDataSet.Tables[0].Rows[i].ItemArray[17].ToString();//공급받는자 회원 구분
//result.ResultDataSet.Tables[0].Rows[i].ItemArray[18].ToString();//영수,청구 구분
//result.ResultDataSet.Tables[0].Rows[i].ItemArray[19].ToString();//공급자 회사명
//result.ResultDataSet.Tables[0].Rows[i].ItemArray[20].ToString();//공급자 사업자번호
//result.ResultDataSet.Tables[0].Rows[i].ItemArray[21].ToString();//공급받는자 회사명
//result.ResultDataSet.Tables[0].Rows[i].ItemArray[22].ToString();//공급받는자 사업자번호
//result.ResultDataSet.Tables[0].Rows[i].ItemArray[23].ToString();//수탁자 회사명
//result.ResultDataSet.Tables[0].Rows[i].ItemArray[24].ToString();//수탁자 사업자번호
//result.ResultDataSet.Tables[0].Rows[i].ItemArray[25].ToString();//위수탁 여부
//result.ResultDataSet.Tables[0].Rows[i].ItemArray[26].ToString();//수정세금계산서 여부
//result.ResultDataSet.Tables[0].Rows[i].ItemArray[27].ToString();//공급자 이메일
//result.ResultDataSet.Tables[0].Rows[i].ItemArray[28].ToString();//공급받는자 이메일
//result.ResultDataSet.Tables[0].Rows[i].ItemArray[29].ToString();//수탁자 이메일
}
return JsonBack ( new JsonRtn ( ) { code = 1000 , obj = Datas , msg = "" } ) ;
}
else
{
return JsonBack ( new JsonRtn ( ) { code = 1000 , obj = Datas , msg = "데이터가 존재하지 않습니다." } ) ;
}
}
else
{
return JsonBack ( new JsonRtn ( ) { code = 1000 , obj = Datas , msg = result . ResultMessage } ) ;
}
}
return JsonBack ( new JsonRtn ( ) { code = 1000 , obj = Datas , msg = "관리자에게 문의해주세요." } ) ;
}
[HttpPost]
public JsonResult TalkTest ( int scdno , String mobile , String email )
{
var masteremail = GetConfig ( "masteremail" ) ;
var senderemail = masteremail . Split ( ';' ) [ 0 ] ;
var m = new Memo ( ) { Users = new List < MemoUser > ( ) { } } ;
//1~7. 온라인/혼합 출석 80% 미만, 진행평가, 최종평가, 과제, 토론, 강의평가 미참여
if ( scdno < 8 )
{
m . Users . Add ( new MemoUser ( )
{
smstype = "A" ,
isok = 1 ,
2020-12-10 13:20:35 +09:00
title = "[영남건설기술교육원] 진행평가 참여 알림" ,
2020-10-12 14:39:23 +09:00
mobile = mobile ,
2020-10-12 15:32:10 +09:00
mcontents = string . Format ( "영남건설기술교육원입니다.\n\n[{0}]님이 수강중인 [{1}] 강좌의 교육 종료일이 {2}일 남았습니다. 종료되기전에 서둘러 " +
2020-12-10 13:34:56 +09:00
( scdno < 3 ? "학습을 진행" : scdno = = 3 ? "진행평가에" : scdno = = 4 ? "최종평가에" : scdno = = 5 ? "과제을 제출" : scdno = = 6 ? "토론에 참여" : scdno = = 7 ? "강의평가에 참여" : "-" ) + "해주세요.\n\n☞사이트 : https://ynicte.nptc.kr/" ,
2020-10-12 14:39:23 +09:00
"test" , "테스트" , 1 ) } ) ;
if ( m . Users . Where ( w = > w . isok = = 1 ) . Count ( ) > 0 )
{
2020-12-10 13:20:35 +09:00
SaveTalk ( m . Users . Where ( w = > w . isok = = 1 ) . ToList ( ) , "encourage1" ) ;
2020-10-12 14:39:23 +09:00
m . Users . Clear ( ) ;
}
2020-12-11 15:31:15 +09:00
m . Users . Add ( new MemoUser ( )
{
smstype = "S" ,
isok = 1 ,
title = "[영남건설기술교육원] 진행평가 참여 알림" ,
mobile = mobile ,
mcontents = string . Format ( "영남건설기술교육원입니다.\n\n[{0}]님이 수강중인 [{1}] 강좌의 교육 종료일이 {2}일 남았습니다. 종료되기전에 서둘러 " +
( scdno < 3 ? "학습을 진행" : scdno = = 3 ? "진행평가에" : scdno = = 4 ? "최종평가에" : scdno = = 5 ? "과제을 제출" : scdno = = 6 ? "토론에 참여" : scdno = = 7 ? "강의평가에 참여" : "-" ) + "해주세요.\n\n☞사이트 : https://ynicte.nptc.kr/" ,
"test" , "테스트" , 1 )
} ) ;
if ( m . Users . Where ( w = > w . isok = = 1 ) . Count ( ) > 0 )
{
SaveSmsMulti ( m . Users . Where ( w = > w . isok = = 1 ) . ToList ( ) ) ;
m . Users . Clear ( ) ;
}
2020-10-12 14:39:23 +09:00
if ( IsEmail ( email ) )
{
SendEmail ( masteremail . Split ( ';' ) [ 1 ] , GetInt ( masteremail . Split ( ';' ) [ 2 ] ) , masteremail . Split ( ';' ) [ 3 ] , masteremail . Split ( ';' ) [ 4 ] , 999 ,
2020-10-12 15:32:10 +09:00
email , senderemail , "[영남건설기술교육원]" , "[영남건설기술교육원] 진행평가 참여 알림" ,
string . Format ( "영남건설기술교육원입니다.<br><br>[{0}]님이 수강중인 [{1}] 강좌의 교육 종료일이 {2}일 남았습니다. 종료되기전에 서둘러 " +
2020-12-10 13:34:56 +09:00
( scdno < 3 ? "학습을 진행" : scdno = = 3 ? "진행평가에" : scdno = = 4 ? "최종평가에" : scdno = = 5 ? "과제을 제출" : scdno = = 6 ? "토론에 참여" : scdno = = 7 ? "강의평가에 참여" : "-" ) + " 진행해주세요.<br><br>☞사이트 : https://ynicte.nptc.kr/" ,
2020-10-12 14:39:23 +09:00
"test" , "테스트" , 1 ) ) ;
}
}
else if ( scdno = = 8 ) //8. 오프라인 출석
{
m . Users . Add ( new MemoUser ( )
{
smstype = "A" ,
isok = 1 ,
2020-12-10 13:20:35 +09:00
title = "[영남건설기술교육원] 진행평가 참여 알림" ,
2020-10-12 14:39:23 +09:00
mobile = mobile ,
2020-12-10 13:34:56 +09:00
mcontents = string . Format ( "영남건설기술교육원입니다.\n\n{0}님이 신청중인 [{1}] 강좌의 교육이 [{2}]에 {3}에서 시작됩니다.\n\n☞사이트 : https://ynicte.nptc.kr/" ,
2020-10-12 15:32:10 +09:00
"test" , "테스트" , DateTime . Now . ToString ( "yyyy-MM-dd" ) , "영남건설기술교육원 대회의실" ) } ) ;
2020-12-11 15:31:15 +09:00
if ( m . Users . Where ( w = > w . isok = = 1 ) . Count ( ) > 0 )
{
SaveTalk ( m . Users . Where ( w = > w . isok = = 1 ) . ToList ( ) , "encourage7" ) ;
m . Users . Clear ( ) ;
}
m . Users . Add ( new MemoUser ( )
{
smstype = "S" ,
isok = 1 ,
title = "[영남건설기술교육원] 진행평가 참여 알림" ,
mobile = mobile ,
mcontents = string . Format ( "영남건설기술교육원입니다.\n\n{0}님이 신청중인 [{1}] 강좌의 교육이 [{2}]에 {3}에서 시작됩니다.\n\n☞사이트 : https://ynicte.nptc.kr/" ,
"test" , "테스트" , DateTime . Now . ToString ( "yyyy-MM-dd" ) , "영남건설기술교육원 대회의실" )
} ) ;
if ( m . Users . Where ( w = > w . isok = = 1 ) . Count ( ) > 0 )
{
SaveSmsMulti ( m . Users . Where ( w = > w . isok = = 1 ) . ToList ( ) ) ;
m . Users . Clear ( ) ;
}
2020-10-12 14:39:23 +09:00
if ( IsEmail ( email ) )
{
2020-10-12 15:32:10 +09:00
SendEmail ( masteremail . Split ( ';' ) [ 1 ] , GetInt ( masteremail . Split ( ';' ) [ 2 ] ) , masteremail . Split ( ';' ) [ 3 ] , masteremail . Split ( ';' ) [ 4 ] , 999 , email , senderemail , "[영남건설기술교육원]" , "[영남건설기술교육원] 진행평가 참여 알림" ,
2020-12-10 13:34:56 +09:00
string . Format ( "영남건설기술교육원입니다.<br><br>{0}님이 신청중인 [{1}] 강좌의 교육이 [{2}]에 {3}에서 시작됩니다.<br><br>☞사이트 : https://ynicte.nptc.kr/" ,
2020-10-12 15:32:10 +09:00
"test" , "테스트" , DateTime . Now . ToString ( "yyyy-MM-dd" ) , "영남건설기술교육원 대회의실" ) ) ;
2020-10-12 14:39:23 +09:00
}
}
else if ( scdno = = 9 ) //9. 자격검정 시험
{
m . Users . Add ( new MemoUser ( )
{
smstype = "A" ,
isok = 1 ,
2020-12-10 13:20:35 +09:00
title = "[영남건설기술교육원] 진행평가 참여 알림" ,
2020-10-12 14:39:23 +09:00
mobile = mobile ,
2020-12-10 13:34:56 +09:00
mcontents = string . Format ( "영남건설기술교육원입니다.\n\n{0}님이 수강중인 [{1}] 자격검정이 [{2}]에 영남건설기술교육원 대회의실에서 이뤄질 예정입니다.\n\n☞사이트: https://ynicte.nptc.kr/" ,
2020-10-12 14:39:23 +09:00
"test" , "테스트" , DateTime . Now . ToString ( "yyyy-MM-dd HH:mm" ) )
} ) ;
2020-12-11 15:31:15 +09:00
if ( m . Users . Where ( w = > w . isok = = 1 ) . Count ( ) > 0 )
{
SaveTalk ( m . Users . Where ( w = > w . isok = = 1 ) . ToList ( ) , "encourage8" ) ;
m . Users . Clear ( ) ;
}
m . Users . Add ( new MemoUser ( )
{
smstype = "S" ,
isok = 1 ,
title = "[영남건설기술교육원] 진행평가 참여 알림" ,
mobile = mobile ,
mcontents = string . Format ( "영남건설기술교육원입니다.\n\n{0}님이 수강중인 [{1}] 자격검정이 [{2}]에 영남건설기술교육원 대회의실에서 이뤄질 예정입니다.\n\n☞사이트: https://ynicte.nptc.kr/" ,
"test" , "테스트" , DateTime . Now . ToString ( "yyyy-MM-dd HH:mm" ) )
} ) ;
if ( m . Users . Where ( w = > w . isok = = 1 ) . Count ( ) > 0 )
{
SaveSmsMulti ( m . Users . Where ( w = > w . isok = = 1 ) . ToList ( ) ) ;
m . Users . Clear ( ) ;
}
if ( IsEmail ( email ) )
{
2020-10-12 15:32:10 +09:00
SendEmail ( masteremail . Split ( ';' ) [ 1 ] , GetInt ( masteremail . Split ( ';' ) [ 2 ] ) , masteremail . Split ( ';' ) [ 3 ] , masteremail . Split ( ';' ) [ 4 ] , 999 , email , senderemail , "[영남건설기술교육원]" , "[영남건설기술교육원] 진행평가 참여 알림" ,
2020-12-11 15:31:15 +09:00
string . Format ( "영남건설기술교육원입니다.<br><br>{0}님이 수강중인 [{1}] 자격검정이 [{2}]에 영남건설기술교육원 대회의실에서 이뤄질 예정입니다.<br><br>☞사이트: https://ynicte.nptc.kr/" ,
"test" , "테스트" , DateTime . Now . ToString ( "yyyy-MM-dd HH:mm" ) ) ) ;
}
2020-10-12 14:39:23 +09:00
}
return JsonOK ( 1 ) ;
}
[HttpPost]
public JsonResult PayUnPay ( Int64 payno )
{
return JsonOK ( Dao . Save ( "pay.unpay" , new Hashtable ( ) { { "payno" , payno } , { "uno" , SUserInfo . UserNo } , { "uip" , GetUserIP ( ) } } ) ) ;
}
[HttpPost]
public JsonResult PayABSPay ( Int64 payno , int ptype )
{
return JsonOK ( Dao . Save ( "pay.abspay" , new Hashtable ( ) { { "payno" , payno } , { "ptype" , ptype } , { "uno" , SUserInfo . UserNo } , { "uip" , GetUserIP ( ) } } ) ) ;
}
[HttpPost]
public JsonResult PayUnPayMoney ( Int64 payno , DateTime payoktime )
{
return JsonOK ( Dao . Save ( "pay.unpaymoney" , new Hashtable ( ) { { "payno" , payno } , { "payoktime" , payoktime } , { "uno" , SUserInfo . UserNo } , { "uip" , GetUserIP ( ) } } ) ) ;
}
2020-11-17 16:57:10 +09:00
[HttpPost]
public JsonResult LectTimeChange ( Int64 lectno , DateTime ? completetime , Int64 cshape )
{
return JsonOK ( Dao . Save ( "lect.completetime.change" , new Hashtable ( ) { { "lectno" , lectno } , { "completetime" , completetime } , { "uno" , SUserInfo . UserNo } , { "uip" , GetUserIP ( ) } } ) ) ;
}
2020-11-24 13:19:48 +09:00
2020-12-02 16:02:10 +09:00
[HttpPost]
2021-03-26 14:07:12 +09:00
public JsonResult GetScdForMixEdu ( int cmno , int iscmlects = 0 )
2020-12-02 16:02:10 +09:00
{
var result = Dao . Get < CMinningscd > ( "cm.cminningscds.applyedu" , new System . Collections . Hashtable ( ) { { "cmno" , cmno } } ) ;
foreach ( var item in result )
{
item . scdInfoSummary = string . Format ( "[{0}] {1}" , item . studyplacename , item . estart . ToString ( "yyyy년 MM월 dd일 ddd요일 HH:mm" ) ) ;
if ( item . estart < DateTime . Now )
item . isEnd = true ;
}
2021-03-26 14:07:12 +09:00
if ( iscmlects = = 1 )
return JsonBack ( result . OrderByDescending ( o = > o . estart ) ) ;
2020-12-02 16:02:10 +09:00
return JsonBack ( result ) ;
}
[HttpPost]
public JsonResult LectScdChange ( Int64 lectno , Int64 cmisno )
{
return JsonOK ( Dao . Save ( "lect.cmisno.up" , new Hashtable ( ) { { "lectno" , lectno } , { "cmisno" , cmisno } } ) ) ;
}
2021-03-18 17:14:50 +09:00
[HttpPost]
public JsonResult PPlogTypeChange ( Int64 pplno , string typeman , string typejob , string typeedu , string typegrade )
{
return JsonOK ( Dao . Save ( "pay.pplogtype.up" , new Hashtable ( ) { { "pplno" , pplno } , { "typeman" , typeman } , { "typejob" , typejob } , { "typeedu" , typeedu } , { "typegrade" , typegrade } } ) ) ;
}
2021-05-25 16:22:56 +09:00
[HttpPost]
public JsonResult DocumnetsPast ( Int64 no )
{
return JsonBack ( Dao . Get < Document > ( "cr.documnetspast" , new Hashtable ( ) { { "no" , no } } ) . First ( ) ) ;
}
2021-03-18 17:14:50 +09:00
2021-05-25 16:22:56 +09:00
[HttpPost]
public JsonResult DocumnetsPastUpdate ( Document document )
{
document . userpno = document . userpno . Replace ( "-" , "" ) ;
document . uno = SUserInfo . UserNo ;
document . uip = GetUserIP ( ) ;
return JsonOK ( Dao . Save ( "cr.documnetspast.up" , document ) ) ;
}
2021-06-25 13:40:31 +09:00
[HttpPost]
public JsonResult Completion ( Int64 lectno )
{
var comCodes = GetComCodes ( "typeman,typeedu,typegrade,typejob,studyplace" ) ;
var completion = Dao . Get < Completion > ( "cr.completions" , new Hashtable ( ) { { "lectno" , lectno } } ) . First ( ) ;
completion . typeeduName = comCodes . Where ( w = > w . ccode = = completion . typeedu ) . FirstOrDefault ( ) ? . cname ;
completion . typegradeName = comCodes . Where ( w = > w . ccode = = completion . typegrade ) . FirstOrDefault ( ) ? . cname ;
completion . typejobName = comCodes . Where ( w = > w . ccode = = completion . typejob ) . FirstOrDefault ( ) ? . cname ;
completion . typemanName = comCodes . Where ( w = > w . ccode = = completion . typeman ) . FirstOrDefault ( ) ? . cname ;
completion . studyplaceName = comCodes . Where ( w = > w . ccode = = completion . studyplace ) . FirstOrDefault ( ) ? . cname ;
return JsonBack ( completion ) ;
}
[HttpPost]
public JsonResult CompletionUpdate ( Completion completion )
{
completion . uno = SUserInfo . UserNo ;
completion . uip = GetUserIP ( ) ;
completion . userpno = completion . userpno . Replace ( "-" , "" ) ;
if ( completion . userpno ! = null & & completion . userpno . Length = = 13 )
{
switch ( completion . userpno . Substring ( 6 , 1 ) )
{
case "1" :
completion . birthday = "19" ;
break ;
case "2" :
completion . birthday = "19" ;
break ;
case "3" :
completion . birthday = "20" ;
break ;
case "4" :
completion . birthday = "20" ;
break ;
case "5" :
completion . birthday = "19" ;
break ;
case "6" :
completion . birthday = "19" ;
break ;
case "7" :
completion . birthday = "20" ;
break ;
case "8" :
completion . birthday = "20" ;
break ;
default :
break ;
}
completion . birthday + = completion . userpno . Substring ( 0 , 2 ) + "-" + completion . userpno . Substring ( 2 , 2 ) + "-" + completion . userpno . Substring ( 4 , 2 ) ;
}
if ( completion . sdate ! = null )
{
completion . sdate = new DateTime ( completion . sdate . Value . Year , completion . sdate . Value . Month , completion . sdate . Value . Day , 0 , 0 , 0 ) ;
}
if ( completion . edate ! = null )
{
completion . edate = new DateTime ( completion . edate . Value . Year , completion . edate . Value . Month , completion . edate . Value . Day , 23 , 59 , 59 ) ;
}
2021-06-25 14:25:43 +09:00
var check = Dao . Get < int > ( "users.checkuser" , new Hashtable ( ) { { "usernonot" , completion . userno } , { "mobile" , completion . mobile } } ) . First ( ) ;
2021-06-25 13:40:31 +09:00
if ( check = = 3 )
{
return JsonError ( JSONCode . Error , "이미 해당 휴대폰번호로 등록된 회원이 존재합니다." , false ) ;
2021-06-25 14:25:43 +09:00
}
2021-06-25 13:40:31 +09:00
return JsonOK ( Dao . Save ( "cr.completion.up" , completion ) ) ;
}
2020-10-12 14:39:23 +09:00
}
}