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 ;
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]
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]
public JsonResult LECTReg ( int? pcno , bool isnewmember , int userno , String username , String email , String mobile , int ptype , String pis )
{
if ( isnewmember )
{
//회원정보생성
//아이디, 이메일 중복확인
var checkuser = Dao . Get < int > ( "users.checkuser" , new Hashtable ( ) { { "userid" , email } , { "email" , email } } ) . First ( ) ;
if ( checkuser < 9 )
{
return JsonOK ( checkuser * - 1 ) ;
}
var User = new Users ( ) { } ;
User . uno = SUserInfo . UserNo ; User . uip = GetUserIP ( ) ;
User . mobile = string . IsNullOrEmpty ( mobile ) | | mobile . Replace ( "-" , "" ) . Length < 10 ? ( mobile ? ? "" ) : mobile . Replace ( "-" , "" ) . Length = = 10 ? string . Format ( "{0}-{1}-{2}" , mobile . Replace ( "-" , "" ) . Substring ( 0 , 3 ) , mobile . Replace ( "-" , "" ) . Substring ( 3 , 3 ) , mobile . Replace ( "-" , "" ) . Substring ( 6 ) ) : string . Format ( "{0}-{1}-{2}" , mobile . Replace ( "-" , "" ) . Substring ( 0 , 3 ) , mobile . Replace ( "-" , "" ) . Substring ( 3 , 4 ) , mobile . Replace ( "-" , "" ) . Substring ( 7 ) ) ;
User . username = username ;
User . userpass = NP . Base . Lib . KISA_SHA256 . SHA256Hash ( mobile . Replace ( "-" , "" ) ) ;
User . userid = User . email = email . Trim ( ) ;
User . usertype = 1 ;
User . asno = SUserInfo . IsSiteAdmin ? SUserInfo . ASNo : ( int? ) null ;
User . status = 1 ;
Dao . Insert ( "users.in" , User ) ;
if ( User . userno < 1 )
{
return JsonOK ( - 3 ) ;
}
userno = User . userno ;
}
var payitems = new List < PayItem > ( ) { } ;
var uip = GetUserIP ( ) ;
foreach ( var v in pis . Split ( ';' ) )
{
var vs = v . Split ( ':' ) ;
payitems . Add ( new PayItem ( )
{
ptype = pcno = = null ? 0 : 1 ,
pcno = pcno ,
itemno = GetInt ( vs [ 0 ] ) ,
userno = userno ,
status = 1 ,
ispc = pcno = = null ? 0 : 1 ,
pstatus = 1 ,
pcnt = 1 ,
payamt = GetInt ( vs [ 1 ] ) ,
payamtcash = ptype = = 5 ? GetInt ( vs [ 2 ] ) : 0 ,
payamtcard = ptype = = 5 ? GetInt ( vs [ 3 ] ) : 0 ,
uno = SUserInfo . UserNo ,
uip = uip
} ) ;
}
//정가확인
var cms = Dao . Get < CM > ( "cm.cms.forpay" + ( pcno = = null ? "" : "pc" ) , new Hashtable ( ) { { "userno" , userno } , { pcno = = null ? "cmno" : "pcno" , pcno = = null ? payitems . First ( ) . itemno : pcno . Value } } ) ;
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 ,
userno = userno ,
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 ) ) ,
uno = SUserInfo . UserNo ,
uip = GetUserIP ( )
} ;
//등록된 교육생인가 확인
var checklectuser = Dao . Get < Lect > ( "lect.checkuser" , new Hashtable ( ) { { "userno" , userno } , { "cmnos" , pay . cmnos } } ) . Count ( ) ;
if ( checklectuser > 0 )
{
return JsonOK ( - 4 ) ;
}
return JsonOK ( Dao . SavePay ( pay , true ) ) ;
}
[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 ) ) ;
}
var Lects2 = Dao . Get < Lect > ( "grade.nocompletelect" , lectnos ) . Where ( w = > w . iscomplete ! = 1 & & lectnos . Contains ( w . lectno . ToString ( ) ) ) . ToList ( ) ;
if ( Lects2 . Count ( ) > 0 )
{
lectnos = string . Join ( "," , Lects2 . Select ( s = > s . lectno ) ) ;
var data2 = new Lect ( ) { uno = SUserInfo . UserNo , uip = GetUserIP ( ) , cmno = Convert . ToInt32 ( cmno ) , cmnos = cmnos , lectnos = lectnos } ;
return JsonOK ( Dao . Save ( "grade.lectcomplete2" , new Hashtable ( ) { { "cmno" , cmno } , { "cmnos" , cmnos } , { "lectnos" , lectnos } , { "uno" , SUserInfo . UserNo } , { "uip" , GetUserIP ( ) } } ) ) ;
}
else
{
return JsonBack ( new JsonRtn ( ) { code = 1 , msg = "이미 수료된 데이터는 다시 수료할 수 없습니다." } ) ;
2020-10-12 14:39:23 +09:00
}
2020-11-12 13:12:08 +09:00
//return JsonOK(Dao.Save("grade.lectcomplete", new Hashtable() { { "cmno", cmno }, { "cmnos", cmnos }, { "lectnos", lectnos }, { "uno", SUserInfo.UserNo }, { "uip", GetUserIP() } }));
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 )
{
newfile . Add ( new File ( ) { orgname = string . Format ( "{0}_{1}.{2}" , f . userid , f . username , f . fileurl . Split ( '.' ) . Last ( ) ) , fileurl = Server . MapPath ( vm . Files + f . fileurl ) } ) ;
}
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 요청 실패 화면처리
/ *
Response . Write ( "결제 부분취소요청이 실패하였습니다. <br>" ) ;
Response . Write ( "TX Response_code = " + xpay . m_szResCode + "<br>" ) ;
Response . Write ( "TX Response_msg = " + xpay . m_szResMsg + "<p>" ) ;
* /
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 ) ;
}
[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 ) ) ;
}
[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-10-12 14:39:23 +09:00
( scdno < 3 ? "학습을 진행" : scdno = = 3 ? "진행평가에" : scdno = = 4 ? "최종평가에" : scdno = = 5 ? "과제을 제출" : scdno = = 6 ? "토론에 참여" : scdno = = 7 ? "강의평가에 참여" : "-" ) + "해주세요.\n\n☞사이트 : https://edu.kfcf.or.kr" ,
"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 ( ) ;
}
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-10-12 14:39:23 +09:00
( scdno < 3 ? "학습을 진행" : scdno = = 3 ? "진행평가에" : scdno = = 4 ? "최종평가에" : scdno = = 5 ? "과제을 제출" : scdno = = 6 ? "토론에 참여" : scdno = = 7 ? "강의평가에 참여" : "-" ) + " 진행해주세요.<br><br>☞사이트 : https://edu.kfcf.or.kr" ,
"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-10-12 15:32:10 +09:00
mcontents = string . Format ( "영남건설기술교육원입니다.\n\n{0}님이 신청중인 [{1}] 강좌의 교육이 [{2}]에 {3}에서 시작됩니다.\n\n☞사이트 : https://edu.kfcf.or.kr" ,
"test" , "테스트" , DateTime . Now . ToString ( "yyyy-MM-dd" ) , "영남건설기술교육원 대회의실" ) } ) ;
2020-12-10 13:20:35 +09:00
SaveTalk ( m . Users . Where ( w = > w . isok = = 1 ) . ToList ( ) , "encourage7" ) ;
2020-10-12 14:39:23 +09:00
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 , "[영남건설기술교육원]" , "[영남건설기술교육원] 진행평가 참여 알림" ,
string . Format ( "영남건설기술교육원입니다.<br><br>{0}님이 신청중인 [{1}] 강좌의 교육이 [{2}]에 {3}에서 시작됩니다.<br><br>☞사이트 : https://edu.kfcf.or.kr" ,
"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-10-12 15:32:10 +09:00
mcontents = string . Format ( "영남건설기술교육원입니다.\n\n{0}님이 수강중인 [{1}] 자격검정이 [{2}]에 영남건설기술교육원 대회의실에서 이뤄질 예정입니다.\n\n☞사이트: https://edu.kfcf.or.kr" ,
2020-10-12 14:39:23 +09:00
"test" , "테스트" , DateTime . Now . ToString ( "yyyy-MM-dd HH:mm" ) )
} ) ;
2020-12-10 13:20:35 +09:00
SaveTalk ( m . Users . Where ( w = > w . isok = = 1 ) . ToList ( ) , "encourage8" ) ;
2020-10-12 14:39:23 +09:00
m . Users . Clear ( ) ;
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 , "[영남건설기술교육원]" , "[영남건설기술교육원] 진행평가 참여 알림" ,
string . Format ( "영남건설기술교육원입니다.<br><br>{0}님이 수강중인 [{1}] 자격검정이 [{2}]에 영남건설기술교육원 대회의실에서 이뤄질 예정입니다.<br><br>☞사이트: https://edu.kfcf.or.kr" ,
2020-10-12 14:39:23 +09:00
"test" , "테스트" , DateTime . Now . ToString ( "yyyy-MM-dd HH:mm" ) ) ) ;
}
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]
public JsonResult GetScdForMixEdu ( int cmno )
{
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 ;
}
return JsonBack ( result ) ;
}
[HttpPost]
public JsonResult LectScdChange ( Int64 lectno , Int64 cmisno )
{
return JsonOK ( Dao . Save ( "lect.cmisno.up" , new Hashtable ( ) { { "lectno" , lectno } , { "cmisno" , cmisno } } ) ) ;
}
2020-10-12 14:39:23 +09:00
}
}