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 NP.Base.Auth ;
2020-11-24 17:34:18 +09:00
using XPayClientNet ;
using System.Security.Cryptography ;
using System.Text ;
2021-04-28 15:36:20 +09:00
using System.Collections ;
2020-10-12 14:39:23 +09:00
namespace NP.FO.Controllers
{
public class FOBaseController : NP . Base . BaseController
{
2020-12-16 14:57:02 +09:00
//전역변수 SNS 로그인 ClientID (네이버,카카오,구글)
2020-12-16 14:55:51 +09:00
public string naverClientID = "CEaGg2S0nrdOgmafAKgF" ;
public string kakaoClientID = "e85ec9c124e5dc6441f58254ddceb454" ;
public string googleClientID = "382613036220-4dbillsob2mf81g70t5b9b1hchukqtn4.apps.googleusercontent.com" ;
2020-11-30 14:44:19 +09:00
2020-10-12 14:39:23 +09:00
protected override void OnActionExecuting ( ActionExecutingContext filterContext )
{
2021-06-30 15:31:47 +09:00
if ( Request . AcceptTypes = = null & & ! Request . Url . AbsolutePath . ToUpper ( ) . StartsWith ( "/OPEN/" ) & & ! Request . Url . AbsolutePath . ToUpper ( ) . StartsWith ( "/ACCOUNT/XPAYVBANKMONEY" ) & & ! Request . Url . AbsolutePath . ToUpper ( ) . StartsWith ( "/ACCOUNT/PAYVBANKMONEY" ) )
2020-10-12 14:39:23 +09:00
{
if ( "Y" . Equals ( GetConfig ( "isdebug" ) ) )
{
var rtn = System . Threading . Tasks . Task . Run ( async ( ) = > Console . WriteLine ( await Dao . Log (
new NP . Model . PageLog ( ) { uno = SUserInfo . UserNo , uip = GetUserIP ( ) , logsite = 1 , loginfo = "fobaseempry: " + Request . Url . ToString ( ) + Request . Params . ToString ( ) } ) ) ) ;
}
filterContext . Result = new EmptyResult ( ) ;
}
else
{
2024-05-02 12:42:16 +09:00
//if (Request.IsSecureConnection &&
// (Request.Url.AbsolutePath.ToUpper().StartsWith("/CROOM/") ||
// Request.Url.AbsolutePath.ToUpper() == "/CROOM" ||
// Request.Url.AbsolutePath.ToUpper().StartsWith("/CDMS/")) &&
// Request.Url.AbsolutePath.ToUpper() != "/CDMS/HTTPS")
if (
Request . IsSecureConnection & &
Request . Url . AbsolutePath . ToUpper ( ) . StartsWith ( "/CDMS/" ) & &
Request . Url . AbsolutePath . ToUpper ( ) ! = "/CDMS/HTTPS"
)
2020-10-12 14:39:23 +09:00
{
//Response.Redirect("http://" + Request.Url.Host + Request.Url.PathAndQuery, true);
filterContext . Result = new RedirectResult ( "http://" + Request . Url . Host + Request . Url . PathAndQuery ) ;
}
else if ( "Y" . Equals ( GetConfig ( "usessl" ) ) & &
! Request . IsSecureConnection & &
! Request . Url . AbsolutePath . StartsWith ( "/Open/" ) & &
2024-05-20 13:06:04 +09:00
//!(Request.Url.AbsolutePath.ToUpper().StartsWith("/CROOM/") || Request.Url.AbsolutePath.ToUpper() == "/CROOM") &&
2020-10-12 14:39:23 +09:00
! ( Request . Url . AbsolutePath . ToUpper ( ) . StartsWith ( "/CDMS/" ) | | Request . Url . AbsolutePath . ToUpper ( ) = = "/CDMS" ) & &
! Request . Url . AbsolutePath . ToUpper ( ) . StartsWith ( "/ACCOUNT/ERROR" ) )
{
filterContext . Result = new RedirectResult ( "https://" + Request . Url . Host + Request . Url . PathAndQuery ) ;
}
//여기서 로그 남겨?
base . OnActionExecuting ( filterContext ) ;
2020-11-24 17:34:18 +09:00
if ( Request . Cookies [ "yicte" ] ! = null & & ! string . IsNullOrEmpty ( Request . Cookies [ "yicte" ] . Value ) )
{
Response . Cookies [ "yicte" ] . Value = Request . Cookies [ "yicte" ] . Value + ";SameSite=None; Secure" ;
}
2020-10-12 14:39:23 +09:00
var cm = new Model . MenuPage ( ) { } ;
//if (Request.Url.AbsolutePath.ToUpper().StartsWith("/DIVISION/A"))
//{
// cm = GetMENUPAGES.Where(w => (w.usertype == 0 || w.usertype == SUserInfo.UserType) && w.pageurl.Equals(Request.Url.PathAndQuery)).OrderByDescending(od => od.pdepth).FirstOrDefault();
//}
//else
//{
cm = GetMENUPAGES . Where ( w = > ( w . usertype = = 0 | | w . usertype = = SUserInfo . UserType ) & & ( w . pageurl ? ? "" ) . ToUpper ( ) . Equals ( Request . Url . AbsolutePath . ToUpper ( ) ) ) . OrderByDescending ( od = > od . pdepth ) . FirstOrDefault ( ) ;
//}
if ( cm ! = null | | Request . Url . AbsolutePath . ToUpper ( ) . Equals ( "/HOME/HTML" )
| | Request . Url . AbsolutePath . ToUpper ( ) . StartsWith ( "/ACCOUNT/BANEMAIL" )
| | Request . Url . AbsolutePath . ToUpper ( ) . StartsWith ( "/ACCOUNT/LOGOUT" )
| | Request . Url . AbsolutePath . ToUpper ( ) . StartsWith ( "/BOARD/" ) )
{
ViewBag . Title = ( cm ? ? new Model . MenuPage ( ) ) . pagename ;
ViewBag . MenuPage = ( cm ? ? new Model . MenuPage ( ) ) ;
ViewBag . MenuPageNo = ( cm ? ? new Model . MenuPage ( ) ) . pno ;
ViewBag . Menus = GetMENUPAGES . Where ( w = > w . usertype = = 0 | | w . usertype = = base . SUserInfo . UserType ) . ToList ( ) ;
if ( ! Request . IsAjaxRequest ( ) )
{
ViewBag . TopMenu = GetGnbTop ( SUserInfo . UserNo ) ;
ViewBag . TopMenu2 = SUserInfo . UserNo < 1 ? GNBTOP2 : GNBTOP2AUTH ;
ViewBag . TopMenu3 = SUserInfo . UserNo < 1 ? GNBTOP3 : GNBTOP3AUTH ;
ViewBag . TopMenuM = SUserInfo . UserNo < 1 ? GNBTOPM : GNBTOPMAUTH ;
var pno = GetInt ( Request [ "menupageno" ] ) ;
if ( pno > 0 )
{
ViewBag . MenuPage = GetMENUPAGES . Where ( w = > w . pno = = pno ) . FirstOrDefault ( ) ;
ViewBag . MenuPageNo = ViewBag . MenuPage . pno ;
ViewBag . Title = ViewBag . MenuPage . pagename ;
}
}
//접속로그
if ( Request . Url . AbsolutePath . ToUpper ( ) ! = "/ACCOUNT/INDEX" )
{
var rtn = System . Threading . Tasks . Task . Run ( async ( ) = > Console . WriteLine ( await Dao . Log (
new NP . Model . PageLog ( ) { uno = SUserInfo . UserNo , uip = GetUserIP ( ) , logsite = 1 , pno = cm . pno < 1 ? ( int? ) null : cm . pno , loginfo = ( cm . ppagename ? ? "" ) + " > " + cm . pagename } ) ) ) ;
}
}
else if ( GetMENUPAGES . Where ( w = > ( w . pageurl ? ? "" ) . ToUpper ( ) . Equals ( Request . Url . AbsolutePath . ToUpper ( ) ) ) . OrderByDescending ( od = > od . pdepth ) . FirstOrDefault ( ) ! = null
//&& !Request.Url.AbsolutePath.ToUpper().StartsWith("/CDMS/PLAY")
//&& !Request.Url.AbsolutePath.ToUpper().StartsWith("/CONTENTS")
)
{
filterContext . Result = new RedirectResult ( "/Account/Index?fobase=xx&ru=" + Request . Url . AbsolutePath , true ) ;
//학습창 등이 안뜨고 로그인창으로 갈 경우 여기에 urlreferrer suserinfo, viewbag.ssuser~, GetMENUPAGES 등의 값들을 로깅해본다.
//~~
//Response.Redirect("/Account/Index?ru=" + Request.Url.AbsolutePath, true);
}
else if ( ! Request . Url . AbsolutePath . ToUpper ( ) . StartsWith ( "/OPEN/" ) & &
! Request . Url . AbsolutePath . ToUpper ( ) . StartsWith ( "/HOME/POPUP" ) & &
! Request . Url . AbsolutePath . ToUpper ( ) . StartsWith ( "/ACCOUNT/ERROR" ) & &
Request . Url . AbsolutePath . ToUpper ( ) ! = "/ACCOUNT/ADMINEE" )
{
filterContext . Result = new RedirectResult ( "/Account/Error" ) ;
}
//if (Request.IsSecureConnection &&
//!Request.Url.AbsolutePath.ToUpper().StartsWith("/ACCOUNT/") &&
//!Request.Url.AbsolutePath.ToUpper().StartsWith("/OPEN/"))
//{
// //Redirect("http://" + Request.Url.Host + Request.Url.PathAndQuery);
// filterContext.Result = new RedirectResult("http://" + Request.Url.Host + Request.Url.PathAndQuery);
//}
else if ( GetMENUPAGES . Where ( w = > ( w . pageurl ? ? "" ) . ToUpper ( ) . Equals ( Request . Url . AbsolutePath . ToUpper ( ) ) ) . OrderByDescending ( od = > od . pdepth ) . FirstOrDefault ( ) ! = null
//&& !Request.Url.AbsolutePath.ToUpper().StartsWith("/CDMS/PLAY")
//&& !Request.Url.AbsolutePath.ToUpper().StartsWith("/CONTENTS")
)
{
filterContext . Result = new RedirectResult ( "/Account/Index?fobase=1&ru=" + Request . Url . AbsolutePath , true ) ;
SetError ( "fobaseerror:path=" + Request . Url . AbsolutePath + "&urlrefer=" + Request . UrlReferrer + "&userinfo=" + SUserInfo . UserNo + "&ssuer=" + ViewBag . SSUserNo ) ;
//학습창 등이 안뜨고 로그인창으로 갈 경우 여기에 urlreferrer suserinfo, viewbag.ssuser~, GetMENUPAGES 등의 값들을 로깅해본다.
//~~
//Response.Redirect("/Account/Index?ru=" + Request.Url.AbsolutePath, true);
}
else if ( ! Request . Url . AbsolutePath . ToUpper ( ) . StartsWith ( "/OPEN/" ) & &
! Request . Url . AbsolutePath . ToUpper ( ) . StartsWith ( "/HOME/POPUP" ) & &
! Request . Url . AbsolutePath . ToUpper ( ) . StartsWith ( "/ACCOUNT/ERROR" ) & &
2020-10-28 10:06:43 +09:00
! Request . Url . AbsolutePath . ToUpper ( ) . StartsWith ( "/ACCOUNT/CERTOK3" ) & &
2020-10-12 14:39:23 +09:00
Request . Url . AbsolutePath . ToUpper ( ) ! = "/ACCOUNT/ADMINEE" )
{
filterContext . Result = new RedirectResult ( "/Account/Error" ) ;
}
//if (Request.IsSecureConnection &&
//!Request.Url.AbsolutePath.ToUpper().StartsWith("/ACCOUNT/") &&
//!Request.Url.AbsolutePath.ToUpper().StartsWith("/OPEN/"))
//{
// //Redirect("http://" + Request.Url.Host + Request.Url.PathAndQuery);
// filterContext.Result = new RedirectResult("http://" + Request.Url.Host + Request.Url.PathAndQuery);
//}
}
}
private static IList < NP . Model . Popup > POPUPS { get ; set ; }
public IList < NP . Model . Popup > GetPOPUPS
{
get
{
if ( POPUPS = = null )
{
POPUPS = Dao . Get < Popup > ( "mm.popups" , new System . Collections . Hashtable ( ) { { "isopen" , 1 } } ) ;
POPUP = null ;
}
return POPUPS ;
}
set
{
POPUPS = value ;
}
}
private static String POPUP { get ; set ; }
public String GetPOPUP
{
get
{
if ( POPUP = = null )
{
var popups = GetPOPUPS ;
POPUP = "" ;
if ( GetPOPUPS . Count ( ) > 0 )
{
POPUP = string . Join ( "nptechpopuplistseparator" , GetPOPUPS . Select ( s = > string . Format ( "{0}nptechpopupseparator{1}nptechpopupseparator{2}nptechpopupseparator{3}nptechpopupseparator{4}nptechpopupseparator{5}nptechpopupseparator{6}nptechpopupseparator{7}nptechpopupseparator{8}"
2021-11-03 15:19:08 +09:00
, s . pno , s . ptitle , "" , s . toppx , s . leftpx , s . pwidth , s . pheight + 4 , s . purl , s . zindex + 100 ) ) ) ;
2020-10-12 14:39:23 +09:00
}
}
return POPUP ;
}
set
{
POPUP = value ;
}
}
private static IList < NP . Model . Banner > BANNERS { get ; set ; }
public IList < NP . Model . Banner > GetBANNERS
{
get
{
if ( BANNERS = = null )
{
BANNERS = Dao . Get < Banner > ( "mm.banners" , new System . Collections . Hashtable ( ) { { "isopen" , 1 } } ) ;
BANNER = null ;
BANNERCROOM = null ;
}
return BANNERS ;
}
set
{
BANNERS = value ;
}
}
private static String BANNER { get ; set ; }
public String GetBANNER
{
get
{
if ( BANNER = = null )
{
//var banners = GetBANNERS;
BANNER = "" ;
if ( GetBANNERS . Where ( w = > w . ismain = = 0 ) . Count ( ) > 0 )
{
BANNER = string . Join ( "" , GetBANNERS . Where ( w = > w . ismain = = 0 ) . Select ( s = >
string . Format ( "<div {2} class=\"mpgsdCont\" style=\"{3}background:url({0})no-repeat left center;\"><img src=\"{1}\" alt=\"\" /></div>" ,
( new BaseModel ( ) ) . rootfolder + s . fileurl ,
( new BaseModel ( ) ) . rootfolder + s . fileurl2 ,
string . IsNullOrEmpty ( s . burl ) ? "" : s . burl . ToLower ( ) . StartsWith ( "http" ) ? ( "onclick=\"window.open('" + s . burl + "')\"" ) : ( "onclick=\"location.href='" + s . burl + "'\"" ) ,
string . IsNullOrEmpty ( s . burl ) ? "" : "cursor:pointer;"
) ) ) ;
}
}
return BANNER ;
}
set
{
BANNER = value ;
}
}
private static String BANNERCROOM { get ; set ; }
public String GetBANNERCROOM
{
get
{
if ( BANNERCROOM = = null )
{
//var banners = GetBANNERS;
BANNERCROOM = "" ;
if ( GetBANNERS . Where ( w = > w . ismain = = 1 ) . Count ( ) > 0 )
{
//BANNERCROOM = string.Join("", GetBANNERS.Where(w => w.ismain == 1).Select(s =>
// string.Format("<div class=\"mpgsdCont\" style=\"background:url({0})no-repeat left center;\"><img src=\"{1}\" alt=\"\" /></div>"
// , (new BaseModel()).rootfolder + s.fileurl, (new BaseModel()).rootfolder + s.fileurl2)));
}
}
return BANNERCROOM ;
}
set
{
BANNERCROOM = value ;
}
}
private static IList < NP . Model . MenuPage > MENUPAGES { get ; set ; }
public IList < NP . Model . MenuPage > GetMENUPAGES
{
get
{
if ( MENUPAGES = = null )
{
MENUPAGES = Dao . Get < NP . Model . MenuPage > ( "mm.pages" , new System . Collections . Hashtable ( ) { { "isopen" , 9 } } ) ;
GNBTOP = null ;
}
return MENUPAGES . ToList ( ) ;
}
set
{
MENUPAGES = value ;
}
}
private static String GNBTOP { get ; set ; }
private static String GNBTOPAUTH { get ; set ; }
private static String GNBTOP2 { get ; set ; }
private static String GNBTOP2AUTH { get ; set ; }
private static String GNBTOP3 { get ; set ; }
private static String GNBTOP3AUTH { get ; set ; }
private static String GNBTOPM { get ; set ; }
private static String GNBTOPMAUTH { get ; set ; }
public String GetGnbTop ( int usertype )
{
if ( GNBTOP = = null )
{
System . Text . StringBuilder sb = new System . Text . StringBuilder ( "" ) ;
System . Text . StringBuilder sbauth = new System . Text . StringBuilder ( "" ) ;
System . Text . StringBuilder sb2 = new System . Text . StringBuilder ( "" ) ;
System . Text . StringBuilder sb2auth = new System . Text . StringBuilder ( "" ) ;
System . Text . StringBuilder sbm = new System . Text . StringBuilder ( "" ) ;
System . Text . StringBuilder sbmauth = new System . Text . StringBuilder ( "" ) ;
var tops = "" ;
var topsauth = "" ;
foreach ( var m in GetMENUPAGES . Where ( w = > w . pdepth = = 0 & & w . isopen = = 1 ) )
{
var mp = m . pagetype = = 0 ? GetMENUPAGES . Where ( w = > w . pagetype > 0 & & ( w . m0 = = m . pno | | w . m1 = = m . pno | | w . m2 = = m . pno | | w . m3 = = m . pno | | w . m4 = = m . pno ) ) . FirstOrDefault ( ) ? ? new Model . MenuPage ( ) { } : m ;
sbauth . Append ( string . Format ( "<li class=\"topmenu{5}\"><a href=\"#\" onclick=\"gomenu({0},{1}, '{2}', this)\" data-refcode=\"{3}\">{4}</a>" , mp . pno , mp . pagetype , mp . pageurl ? ? "" , m . refcode ? ? "" , m . pagename , m . pno ) ) ;
topsauth + = string . Format ( "<li class=\"topmenu{1}\"><h5>{0}</h5></li>" , m . pagename , m . pno ) ;
if ( m . usertype = = 0 )
{
sb . Append ( string . Format ( "<li><a href=\"#\" onclick=\"gomenu({0},{1}, '{2}', this)\" data-refcode=\"{3}\">{4}</a>" , mp . pno , mp . pagetype , mp . pageurl ? ? "" , m . refcode ? ? "" , m . pagename ) ) ;
tops + = string . Format ( "<li><h5>{0}</h5></li>" , m . pagename ) ;
}
sb2 . Append ( "<li><ul>" ) ;
sb2auth . Append ( "<li><ul>" ) ;
foreach ( var m2 in GetMENUPAGES . Where ( w = > w . pdepth = = 1 & & w . isopen = = 1 & & w . ppno = = m . pno & & w . pagetype ! = 4 ) )
{
sb2auth . Append ( string . Format ( "<li class=\"topsubmenu{4}\"><a href=\"#\" onclick=\"gomenu({0}, {1}, '{2}', this)\">{3}</a></li>" , m2 . pno , m2 . pagetype , m2 . pageurl ? ? "" , m2 . pagename , m2 . pno ) ) ;
if ( m . usertype = = 0 & & m2 . usertype = = 0 )
{
sb2 . Append ( string . Format ( "<li class=\"topsubmenu{4}\"><a href=\"#\" onclick=\"gomenu({0}, {1}, '{2}', this)\">{3}</a></li>" , m2 . pno , m2 . pagetype , m2 . pageurl ? ? "" , m2 . pagename , m2 . pno ) ) ;
}
}
sb2 . Append ( "</ul></li>" ) ;
sb2auth . Append ( "</ul></li>" ) ;
2020-12-28 13:12:08 +09:00
//영남요청건으로 하위메뉴 보임인건 하나도 없어도 메뉴출력하도록 수정
var menu = GetMENUPAGES . Where ( w = > w . pdepth = = 1 & & ( w . isopen = = 1 | | w . isopen = = 2 ) & & w . ppno = = m . pno & & w . pagetype ! = 4 ) . FirstOrDefault ( ) ;
2022-04-28 14:05:09 +09:00
if ( menu = = null )
{
menu = new MenuPage ( ) ;
}
2023-02-23 14:33:05 +09:00
if ( m . pno = = 16 & & false )
2021-06-03 10:43:16 +09:00
{
sbmauth . Append ( string . Format ( "<li class=\"topmenu{1}\"><a href=\"#\" onclick=\"gomenu({2}, {3}, '{4}', this)\">{0}</a><ul>" , m . pagename , m . pno , menu . pno , menu . pagetype , menu . pageurl ) ) ;
}
else
{
2021-08-23 15:10:15 +09:00
//sbmauth.Append(string.Format("<li class=\"topmenu{1}\"><a href=\"#\" onclick=\"gomenu({2}, {3}, '{4}', this)\">{0}</a><span></span><ul>", m.pagename, m.pno,menu.pno,menu.pagetype,menu.pageurl));
sbmauth . Append ( string . Format ( "<li class=\"topmenu{1}\"><a href=\"#\" style=\"cursor:default;\">{0}</a><span></span><ul>" , m . pagename , m . pno , menu . pno , menu . pagetype , menu . pageurl ) ) ;
2021-06-03 10:43:16 +09:00
}
2020-10-12 14:39:23 +09:00
if ( m . usertype = = 0 )
{
2023-02-23 14:33:05 +09:00
if ( m . pno = = 16 & & false )
2021-04-30 13:18:03 +09:00
{
2021-06-03 10:43:16 +09:00
sbm . Append ( string . Format ( "<li class=\"topmenu{1}\"><a href=\"#\" onclick=\"msg('로그인 후 진행 할 수 있습니다.', null, null, null, 'location.href=\\'/Account/Index?ru={4}\\'')\">{0}</a><ul>" , m . pagename , m . pno , menu . pno , menu . pagetype , menu . pageurl ) ) ;
2021-04-30 13:18:03 +09:00
}
else
{
2021-08-23 15:10:15 +09:00
//sbm.Append(string.Format("<li class=\"topmenu{1}\"><a href=\"#\" onclick=\"gomenu({2}, {3}, '{4}', this)\">{0}</a><span></span><ul>", m.pagename, m.pno, menu.pno, menu.pagetype, menu.pageurl));
sbm . Append ( string . Format ( "<li class=\"topmenu{1}\"><a href=\"#\" style=\"cursor:default;\">{0}</a><span></span><ul>" , m . pagename , m . pno , menu . pno , menu . pagetype , menu . pageurl ) ) ;
2021-04-30 13:18:03 +09:00
}
2020-10-12 14:39:23 +09:00
}
foreach ( var m2 in GetMENUPAGES . Where ( w = > w . pdepth = = 1 & & w . isopen = = 1 & & w . ppno = = m . pno & & w . pagetype ! = 4 ) )
{
sbmauth . Append ( string . Format ( "<li class=\"topsubmenu{4}\"><a href=\"#\" onclick=\"gomenu({0}, {1}, '{2}', this)\">{3}</a></li>" , m2 . pno , m2 . pagetype , m2 . pageurl ? ? "" , m2 . pagename , m2 . pno ) ) ;
if ( m . usertype = = 0 )
{
sbm . Append ( string . Format ( "<li class=\"topsubmenu{4}\"><a href=\"#\" onclick=\"gomenu({0}, {1}, '{2}', this)\">{3}</a></li>" , m2 . pno , m2 . pagetype , m2 . pageurl ? ? "" , m2 . pagename , m2 . pno ) ) ;
}
}
sbmauth . Append ( "</ul></li>" ) ;
if ( m . usertype = = 0 )
{
sbm . Append ( "</ul></li>" ) ;
}
}
GNBTOP = sb . ToString ( ) ;
GNBTOPAUTH = sbauth . ToString ( ) ;
GNBTOP2 = tops ;
GNBTOP2AUTH = topsauth ;
GNBTOP3 = sb2 . ToString ( ) ;
GNBTOP3AUTH = sb2auth . ToString ( ) ;
GNBTOPM = sbm . ToString ( ) ;
GNBTOPMAUTH = sbmauth . ToString ( ) ;
}
return usertype < 1 ? GNBTOP : GNBTOPAUTH ;
}
protected void ResetMenu ( )
{
MENUPAGES = null ;
}
protected void ResetPopup ( )
{
POPUPS = null ;
}
protected void ResetBanner ( )
{
BANNERS = null ;
}
private System . Security . Authentication . SslProtocols ExtractSslProtocol ( System . IO . Stream stream )
{
if ( stream is null ) return System . Security . Authentication . SslProtocols . None ;
System . Reflection . BindingFlags bindingFlags = System . Reflection . BindingFlags . Instance | System . Reflection . BindingFlags . NonPublic ;
System . IO . Stream metaStream = stream ;
if ( stream . GetType ( ) . BaseType = = typeof ( System . IO . Compression . GZipStream ) )
{
metaStream = ( stream as System . IO . Compression . GZipStream ) . BaseStream ;
}
else if ( stream . GetType ( ) . BaseType = = typeof ( System . IO . Compression . DeflateStream ) )
{
metaStream = ( stream as System . IO . Compression . DeflateStream ) . BaseStream ;
}
var connection = metaStream . GetType ( ) . GetProperty ( "Connection" , bindingFlags ) . GetValue ( metaStream ) ;
if ( ! ( bool ) connection . GetType ( ) . GetProperty ( "UsingSecureStream" , bindingFlags ) . GetValue ( connection ) )
{
// Not a Https connection
return System . Security . Authentication . SslProtocols . None ;
}
var tlsStream = connection . GetType ( ) . GetProperty ( "NetworkStream" , bindingFlags ) . GetValue ( connection ) ;
var tlsState = tlsStream . GetType ( ) . GetField ( "m_Worker" , bindingFlags ) . GetValue ( tlsStream ) ;
return ( System . Security . Authentication . SslProtocols ) tlsState . GetType ( ) . GetProperty ( "SslProtocol" , bindingFlags ) . GetValue ( tlsState ) ;
}
protected void PayAll ( VMPay vm )
{
//ViewBag.IsOldTLS = false;
//try
//{
// if (Request.IsSecureConnection)
// {
// System.Net.Security.SslStream sss = new System.Net.Security.SslStream(Request.UrlReferrer.);
// Console.WriteLine(sss.SslProtocol);
// //if (ssp.SslProtocol != System.Security.Authentication.SslProtocols.Tls12)
// //{
// // ViewBag.IsOldTLS = true;
// //}
// }
//}
//catch (Exception ex)
//{
// Console.WriteLine(ex.Message);
//}
vm . PayItems = new List < PayItem > ( ) { } ;
if ( vm . ispaycart )
{
//장바구니에서 결제 진입
vm . PayItems = Dao . Get < PayItem > ( "pay.payitems.forcartpay" , new System . Collections . Hashtable ( ) { { "userno" , SUserInfo . UserNo } } ) ;
vm . User = Dao . Get < Users > ( "users.users" , new System . Collections . Hashtable ( ) { { "userno" , SUserInfo . UserNo } } ) . First ( ) ;
}
else if ( vm . ispaycert & & vm . payno > 0 )
{
//자격증강좌는 신청 시점에는 금액이 0이므로 결제시점에 현재가격으로 갱신해준다.
vm . PayItems = Dao . Get < PayItem > ( "pay.payitems.forcertpay" , new System . Collections . Hashtable ( ) { { "payno" , vm . payno } , { "userno" , SUserInfo . UserNo } } ) ;
vm . User = Dao . Get < Users > ( "users.users" , new System . Collections . Hashtable ( ) { { "userno" , SUserInfo . UserNo } } ) . First ( ) ;
}
else if ( vm . ispayexam )
{
vm . PayItems = Dao . Get < PayItem > ( "pay.payitems.forexampay" , new System . Collections . Hashtable ( ) { { "exno" , vm . exno } , { "userno" , SUserInfo . UserNo } } ) ;
vm . User = Dao . Get < Users > ( "users.users" , new System . Collections . Hashtable ( ) { { "userno" , SUserInfo . UserNo } } ) . First ( ) ;
}
else
{
//구매상품데이터를 추출한다.
foreach ( var d in vm . items . Split ( ';' ) )
{
var dd = d . Split ( ':' ) ;
vm . PayItems . Add ( new PayItem ( ) { ptype = GetInt ( dd [ 0 ] ) , itemno = GetLong ( dd [ 1 ] ) , pcnt = GetInt ( dd [ 2 ] ) , userno = vm . isgroup = = 0 ? SUserInfo . UserNo : GetInt ( dd [ 3 ] ) , isrebate = GetInt ( dd [ 4 ] ) , fgno = dd [ 5 ] = = "0" ? ( Int64 ? ) null : GetLong ( dd [ 5 ] ) } ) ;
}
var pis = Dao . Get < PayItem > ( "pay.payitems.forpay" , new System . Collections . Hashtable ( ) {
{ "userno" , SUserInfo . UserNo } ,
{ "cmnos0" , string . Join ( "," , vm . PayItems . Where ( w = > w . ptype = = 0 ) . Select ( s = > s . itemno ) . Distinct ( ) ) } ,
{ "bknos" , string . Join ( "," , vm . PayItems . Where ( w = > w . ptype = = 2 ) . Select ( s = > s . itemno ) ) }
} ) ;
vm . User = Dao . Get < Users > ( "users.users" , new System . Collections . Hashtable ( ) { { "userno" , SUserInfo . UserNo } } ) . First ( ) ;
foreach ( var pi in vm . PayItems )
{
var item = pis . Where ( w = > w . ptype = = pi . ptype & & w . itemno = = pi . itemno ) . First ( ) ;
pi . days = item . days ;
pi . itemname = item . itemname ;
pi . orgamt = item . orgamt ;
pi . discamt = item . discamt ;
pi . payamt = item . payamt ;
pi . cshape = item . cshape ;
}
}
vm . pginfo = GetConfig ( "pginfo" ) ;
vm . pginfomobile = GetConfig ( "pginfomobile" ) ;
vm . signkey = ComputeHash ( vm . pginfo . Split ( '|' ) [ 2 ] ) ;
//vm.payitemname = Utf8ToEuckr();
2021-06-22 09:21:42 +09:00
vm . viewname5 = "https://" + Request . Url . Host + "/Course/PayClose" ;
//vm.viewname5 = GetConfig("fronturl") + "/Course/PayClose";
2020-10-12 14:39:23 +09:00
vm . previewname = vm . previewname ? ? "/My/Cart" ;
vm . deliveramt = GetInt ( GetConfig ( "deliveramt" ) ) ;
}
//private String Utf8ToEuckr(String s)
//{
// byte[] pbSource = System.Text.Encoding.UTF8.GetBytes(s);
// byte[] pbDest = System.Text.Encoding.Convert(
// System.Text.Encoding.UTF8, System.Text.Encoding.GetEncoding("euc-kr"), pbSource);
// pbSource = System.Text.Encoding.Convert(System.Text.Encoding.GetEncoding("euc-kr"), System.Text.Encoding.UTF8, pbDest);
// char[] psUnicode = System.Text.UTF8Encoding.UTF8.GetChars(pbSource);
// return new string(psUnicode);
//}
protected ActionResult PayReturn ( VMPay vm )
{
2022-08-10 13:09:18 +09:00
//20220802 추가
long? [ ] lngTmp = new long? [ 2 ] ;
2022-10-18 18:22:01 +09:00
if ( vm . CM ! = null )
{
vm . CM . cmino = vm . CM . cmino = = null ? 0 : vm . CM . cmino ;
vm . CM . cmisno = vm . CM . cmisno = = null ? 0 : vm . CM . cmisno ;
}
else
{
vm . CM = new CM ( ) ;
vm . CM . cmino = 0 ;
vm . CM . cmisno = 0 ;
}
lngTmp [ 0 ] = vm . CM . cmino = = 0 ? vm . cmino : vm . CM . cmino ;
lngTmp [ 1 ] = vm . CM . cmisno = = 0 ? vm . cmisno : vm . CM . cmisno ;
2022-08-10 13:09:18 +09:00
2020-11-24 17:34:18 +09:00
if ( vm . payno > 0 & & ( vm . absptype = = 6 | | vm . absptype = = 7 ) )
2020-10-12 14:39:23 +09:00
{
//0원강좌 결제
2020-12-01 15:50:16 +09:00
vm . Pay = new Pay ( ) { payno = vm . payno , pstatus = 1 , ptype = vm . absptype , oid2 = ( vm . absptype = = 6 ? "free" : string . Empty ) + vm . payno } ;
vm . Pay . payresult = "1:무료결제완료" ;
2020-10-12 14:39:23 +09:00
vm . PayItemResults = Dao . Get < PayItemResult > ( "pay.payitems" , vm . Pay . payno ) ;
2020-12-01 15:50:16 +09:00
vm . CM = Dao . Get < CM > ( "cm.cms" , new System . Collections . Hashtable ( ) { { "cmno" , vm . PayItemResults . First ( ) . itemno } } ) . FirstOrDefault ( ) ;
2022-08-10 13:09:18 +09:00
//20220802 추가
vm . CM . cmino = lngTmp [ 0 ] ;
vm . CM . cmisno = lngTmp [ 1 ] ;
2020-10-12 14:39:23 +09:00
}
else
{
2020-11-24 17:34:18 +09:00
vm . Pay = new Pay ( ) ;
/ * ※ 중 요
* 환 경 설 정 파 일 의 경 우 반 드 시 외 부 에 서 접 근 이 가 능 한 경 로 에 두 시 면 안 됩 니 다 .
* 해 당 환 경 파 일 이 외 부 에 노 출 이 되 는 경 우 해 킹 의 위 험 이 존 재 하 므 로 반 드 시 외 부 에 서 접 근 이 불 가 능 한 경 로 에 두 시 기 바 랍 니 다 .
* 예 ) [ Window 계 열 ] C : \ inetpub \ wwwroot \ lgdacom = = > 절 대 불 가 ( 웹 디 렉 토 리 )
* /
String configPath = GetConfig ( "lgdacomConfigPath" ) ; //토스페이먼츠에서 제공한 환경파일 위치를 지정해 주세요.
/ *
* [ 최 종 결 제 요 청 페 이 지 ( STEP2 - 2 ) ]
*
* 매 뉴 얼 "5.1. XPay 결제 요청 페이지 개발" 의 "단계 5. 최종 결제 요청 및 요청 결과 처리" 참 조
*
* 토 스 페 이 먼 츠 으 로 부 터 내 려 받 은 LGD_PAYKEY ( 인 증 Key ) 를 가 지 고 최 종 결 제 요 청 . ( 파 라 미 터 전 달 시 POST를 사 용 하 세 요 )
* /
/ *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* 1. 최 종 결 제 요 청 ( 수 정 하 지 마 세 요 ) - BEGIN
* ( 단 , 최 종 금 액 체 크 를 원 하 시 는 경 우 금 액 체 크 부 분 주 석 을 제 거 하 시 면 됩 니 다 . )
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* /
String CST_PLATFORM = Request . Params . Get ( "CST_PLATFORM" ) ;
String CST_MID = Request . Params . Get ( "CST_MID" ) ;
String LGD_MID = ( ( "test" . Equals ( CST_PLATFORM . Trim ( ) ) ) ? "t" : "" ) + CST_MID ;
String LGD_PAYKEY = Request . Params . Get ( "LGD_PAYKEY" ) ;
String LGD_CLOSEDATE = Request . Params . Get ( "LGD_CLOSEDATE" ) ;
//String DB_AMOUNT = ""; //반드시 위변조가 불가능한 곳(DB나 세션)에서 금액을 가져오십시요.
// (1) XpayClient의 사용을 위한 xpay 객체 생성
XPayClient xpay = new XPayClient ( ) ;
// (2) Init: XPayClient 초기화(환경설정 파일 로드)
// configPath: 설정파일
// CST_PLATFORM: - test, service 값에 따라 lgdacom.conf의 test_url(test) 또는 url(srvice) 사용
// - test, service 값에 따라 테스트용 또는 서비스용 아이디 생성
xpay . Init ( configPath , CST_PLATFORM ) ;
try
2020-10-12 14:39:23 +09:00
{
2020-11-24 17:34:18 +09:00
// (3) Init_TX: 메모리에 mall.conf, lgdacom.conf 할당 및 트랜잭션의 고유한 키 TXID 생성
xpay . Init_TX ( LGD_MID ) ;
xpay . Set ( "LGD_TXNAME" , "PaymentByKey" ) ;
xpay . Set ( "LGD_PAYKEY" , LGD_PAYKEY ) ;
//금액을 체크하시기 원하는 경우 아래 주석을 풀어서 이용하십시요.
//xpay.Set("LGD_AMOUNTCHECKYN", "Y");
//xpay.Set("LGD_AMOUNT", DB_AMOUNT);
}
catch ( Exception err )
{
SetError ( "환경파일의 경로가 잘못 되었습니다. configPath의 경로를 확인해 주시기 바랍니다." + "|" + err . StackTrace ) ;
vm . Pay . payresult = "0:호출실패" ;
vm . Pay . cancelresult = "환경파일의 경로가 잘못 되었습니다. configPath의 경로를 확인해 주시기 바랍니다." ;
}
/ *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* 1. 최 종 결 제 요 청 ( 수 정 하 지 마 세 요 ) - END
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* /
/ *
* 2. 최 종 결 제 요 청 결 과 처 리
*
* 최 종 결 제 요 청 결 과 리 턴 파 라 미 터 는 연 동 메 뉴 얼 을 참 고 하 시 기 바 랍 니 다 .
* /
// (4) TX: lgdacom.conf에 설정된 URL로 소켓 통신하여 최종 인증요청, 결과값으로 true, false 리턴
if ( xpay . TX ( ) )
{
Int64 payno = GetLong ( xpay . Response ( "LGD_OID" , 0 ) . Substring ( 2 ) ) ;
//1)결제결과 화면처리(성공,실패 결과 처리를 하시기 바랍니다.
vm . Pay = new Pay ( ) { payno = payno , uno = SUserInfo . UserNo , uip = GetUserIP ( ) } ;
String cancelMsg = "결제오류|" + payno ;
// (5) DB에 인증요청 결과 처리
if ( "0000" . Equals ( xpay . m_szResCode ) )
2020-10-12 14:39:23 +09:00
{
try
{
2020-11-24 17:34:18 +09:00
//통신상의 문제가 없을시
//최종결제요청 결과 성공 DB처리(LGD_RESPCODE 값에 따라 결제가 성공인지, 실패인지 DB처리)
vm . Pay = Dao . Get < Pay > ( "pay.pay" , new System . Collections . Hashtable ( ) { { "payno" , payno } , { "userno" , SUserInfo . UserNo } , { "pstatus21" , 0 } } ) . FirstOrDefault ( ) ;
if ( vm . Pay = = null )
2020-10-12 14:39:23 +09:00
{
2020-11-24 17:34:18 +09:00
vm . Pay = new Pay ( ) { payno = payno , uno = SUserInfo . UserNo , uip = GetUserIP ( ) } ;
vm . Pay . payresult = "0:결제상품 오류(E1)" ;
cancelMsg + = "|결제상품 오류(E1)" ;
vm . Pay = new Pay ( ) { payno = payno , uno = SUserInfo . UserNo , uip = GetUserIP ( ) } ;
throw new Exception ( "결제상품 오류(E1)" ) ;
2020-10-12 14:39:23 +09:00
}
2020-11-24 17:34:18 +09:00
else
2020-10-12 14:39:23 +09:00
{
2020-11-24 17:34:18 +09:00
vm . Pay . uno = SUserInfo . UserNo ;
vm . Pay . uip = GetUserIP ( ) ;
if ( vm . Pay . payamt ! = GetInt ( ( xpay . Response ( "LGD_AMOUNT" , 0 ) ? ? "" ) . Replace ( "," , "" ) ) )
2020-10-12 14:39:23 +09:00
{
2020-11-24 17:34:18 +09:00
vm . Pay . payresult = "0:결제금액 오류(E3)" ;
cancelMsg + = "|결제금액 오류(E3)" ;
throw new Exception ( "결제금액 오류(E3)" ) ;
2020-10-12 14:39:23 +09:00
}
else
{
2020-11-24 17:34:18 +09:00
if ( vm . Pay . ptype = = 3 )
{ //가상계좌
vm . Pay . vactnum = xpay . Response ( "LGD_ACCOUNTNUM" , 0 ) ;
vm . Pay . vactbankcode = xpay . Response ( "LGD_FINANCECODE" , 0 ) ;
vm . Pay . vactbankname = xpay . Response ( "LGD_FINANCENAME" , 0 ) ;
vm . Pay . vactname = xpay . Response ( "LGD_SAOWNER" , 0 ) ;
vm . Pay . vactinname = xpay . Response ( "LGD_PAYER" , 0 ) ;
//vm.Pay.paylimit = Convert.ToDateTime(xpay.Response("LGD_CLOSEDATE", 0));
}
else if ( vm . Pay . ptype = = 2 )
{ //실시간계좌이체
vm . Pay . vactbankcode = xpay . Response ( "LGD_FINANCECODE" , 0 ) ;
vm . Pay . cshrtype = xpay . Response ( "LGD_CASHRECEIPTKIND" , 0 ) ;
vm . Pay . cshrauthno = xpay . Response ( "LGD_CASHRECEIPTNUM" , 0 ) ;
2020-10-12 14:39:23 +09:00
}
else
2020-11-24 17:34:18 +09:00
{ //카드
vm . Pay . cardquota = xpay . Response ( "LGD_CARDINSTALLMONTH" , 0 ) ;
if ( ! "00" . Equals ( xpay . Response ( "LGD_CARDINSTALLMONTH" , 0 ) ) & & "1" . Equals ( xpay . Response ( "LGD_CARDNOINTYN" , 0 ) ) )
2020-10-12 14:39:23 +09:00
{
2020-11-24 17:34:18 +09:00
vm . Pay . cardquotatype = 1 ;
2020-10-12 14:39:23 +09:00
}
2020-11-24 17:34:18 +09:00
vm . Pay . cardnum = xpay . Response ( "LGD_CARDNUM" , 0 ) ;
vm . Pay . iscardpoint = vm . Pay . cardquota . Count ( ) = = 4 ? 1 : 0 ; // 포인트 사용 시 할부개월 + 포인트별로 숫자 두개가 붙음, 즉 4개면 포인트 사용했다는 뜻
vm . Pay . cardcode = xpay . Response ( "LGD_FINANCECODE" , 0 ) ;
vm . Pay . cardbankcode = xpay . Response ( "LGD_CARDACQUIRER" , 0 ) ;
vm . Pay . cardprtccode = xpay . Response ( "LGD_PCANCELFLAG" , 0 ) ;
vm . Pay . checkflag = xpay . Response ( "LGD_CARDGUBUN2" , 0 ) ;
2020-10-12 14:39:23 +09:00
}
2022-08-10 09:34:44 +09:00
2020-11-24 17:34:18 +09:00
vm . Pay . payresult = xpay . Response ( "LGD_RESPCODE" , 0 ) ;
vm . Pay . payresultmsg = xpay . Response ( "LGD_RESPMSG" , 0 ) ;
vm . Pay . pgkey = xpay . Response ( "LGD_TID" , 0 ) ;
vm . Pay . mid = LGD_MID ;
vm . Pay . uno = SUserInfo . UserNo ;
vm . Pay . uip = GetUserIP ( ) ;
//상품구매완료 처리 (최소 3건 업데이트 (pay, paydata, payitem)
if ( Dao . Save ( "pay.paylect" , vm . Pay ) < 3 )
2020-10-12 14:39:23 +09:00
{
2020-11-24 17:34:18 +09:00
vm . Pay . payresult = "0:구매완료 실패(E4)" ;
cancelMsg + = "|구매완료 실패(E4)" ;
throw new Exception ( "구매완료 실패(E4)" ) ;
2020-10-12 14:39:23 +09:00
}
2020-11-24 17:34:18 +09:00
vm . Pay . payresult = "1:결제완료" ;
try
2020-10-12 14:39:23 +09:00
{
2020-11-24 17:34:18 +09:00
vm . Pay . oid2 = GetConfig ( "PAYMENT_CLASSIFICATION" ) + vm . Pay . payno ;
vm . PayItemResults = Dao . Get < PayItemResult > ( "pay.payitems" , vm . Pay . payno ) ;
2021-04-28 15:36:20 +09:00
vm . PayItems = Dao . Get < PayItem > ( "pay.payresult" , new System . Collections . Hashtable ( ) { { "payno" , vm . Pay . payno } , { "userno" , SUserInfo . UserNo } } ) ;
vm . PayItem = vm . PayItems . First ( ) ;
2020-11-24 17:34:18 +09:00
vm . Pay . pstatus = vm . Pay . ptype = = 1 ? 1 : 22 ;
vm . CM = Dao . Get < CM > ( "cm.cms" , new System . Collections . Hashtable ( ) { { "cmno" , vm . PayItemResults . First ( ) . itemno } } ) . FirstOrDefault ( ) ;
2020-10-12 14:39:23 +09:00
}
2020-11-24 17:34:18 +09:00
catch ( Exception exresult )
2020-10-12 14:39:23 +09:00
{
2021-07-09 13:35:05 +09:00
SetError ( cancelMsg + = "|결제결과조회|" + exresult . StackTrace ) ;
2020-10-12 14:39:23 +09:00
}
2021-04-28 15:36:20 +09:00
#region 세 금 계 산 서 신 청 처 리
if ( vm . Pay . ptype = = 3 ) {
try
{
2021-08-23 15:10:15 +09:00
vm . PPLog = Dao . Get < PPLog > ( "pay.pplogs" , new Hashtable ( ) { { "pplno" , vm . pplno } , { "userno" , SUserInfo . UserNo } } ) . OrderByDescending ( w = > w . cdt ) . FirstOrDefault ( ) ;
2021-04-28 15:36:20 +09:00
if ( payno > 0 & & vm . PPLog ! = null & & vm . PPLog . pstatus = = 22 & & vm . PPLog . isbill = = 1 )
{
PayTax payTax = new PayTax ( ) ;
payTax . uno = SUserInfo . UserNo ;
payTax . uip = GetUserIP ( ) ;
if ( Dao . Get < PayTax > ( "cr.paytaxes" , new Hashtable ( ) { { "payno" , payTax . payno } , { "cno" , SUserInfo . UserNo } , { "iscancel" , 0 } } ) . Count ( ) = = 0 )
{
2021-08-23 15:10:15 +09:00
var afgnobno = Dao . Get < Data > ( "assign.assings3" , new Hashtable ( ) { { "userno" , SUserInfo . UserNo } } ) . FirstOrDefault ( ) ;
if ( afgnobno ! = null )
2021-04-28 15:36:20 +09:00
{
2021-08-23 15:10:15 +09:00
if ( afgnobno . longval > 0 )
{
payTax . fgno = afgnobno . longval ;
}
2021-04-28 15:36:20 +09:00
}
payTax . payno = payno ;
payTax . pinos = string . Join ( "," , vm . PayItems . Select ( s = > s . pino ) ) ;
payTax . asname = vm . PPLog . asname ;
payTax . ceoname = vm . PPLog . ceoname ;
payTax . asaddr = vm . PPLog . address1 + " " + vm . PPLog . address2 ;
payTax . brno = vm . PPLog . brno ;
payTax . btype = vm . PPLog . btype ;
payTax . bkind = vm . PPLog . bkind ;
payTax . manname = vm . PPLog . mname ;
payTax . telno = vm . PPLog . mphone ;
2021-07-09 09:53:57 +09:00
payTax . email = vm . PPLog . taxemail ;
2021-07-12 18:23:19 +09:00
payTax . isreceipt = vm . PPLog . isreceipt . Value ; //0:청구, 1:영수
2021-07-09 09:53:57 +09:00
payTax . taxdatereq = vm . PPLog . taxdatereq ;
2021-04-28 15:36:20 +09:00
payTax . brno = ( payTax . brno ? ? "" ) . Replace ( "-" , "" ) ;
payTax . grno = ( payTax . grno ? ? "" ) . Replace ( "-" , "" ) ;
Dao . Insert < PayTax > ( "pay.paytax.in" , payTax ) ;
if ( payTax . taxno > 0 )
{
Dao . Save ( "pay.paytaxitem.in" , payTax ) ;
}
}
}
}
catch ( Exception exresult )
2021-07-09 13:35:05 +09:00
{
2021-08-23 15:10:15 +09:00
SetError ( cancelMsg + = "|세금계산서신청처리|" + exresult . Message + "|" + exresult . StackTrace ) ;
2021-04-28 15:36:20 +09:00
}
}
#endregion
2020-10-12 14:39:23 +09:00
}
}
}
catch ( Exception ex )
{
2020-11-24 17:34:18 +09:00
//망취소
xpay . Rollback ( "상점 DB처리 실패로 인하여 Rollback 처리 [TID:" + xpay . Response ( "LGD_TID" , 0 ) + ",MID:" + xpay . Response ( "LGD_MID" , 0 ) + ",OID:" + xpay . Response ( "LGD_OID" , 0 ) + "]" ) ;
2020-10-12 14:39:23 +09:00
2020-11-24 17:34:18 +09:00
if ( "0000" . Equals ( xpay . m_szResCode ) )
2020-10-12 14:39:23 +09:00
{
try
{
2020-11-24 17:34:18 +09:00
// 자동취소가 정상적으로 완료 되었을때
vm . Pay . cancelresult = ( vm . Pay . cancelresult ? ? "" ) + "|" + xpay . Response ( "LGD_RESPMSG" , 0 ) ;
vm . Pay . pstatus = 66 ;
Dao . Save ( "pay.pay.fail" , vm . Pay ) ;
SetError ( cancelMsg + = "|" + xpay . Response ( "LGD_RESPMSG" , 0 ) + "|" + ex . StackTrace ) ;
2020-10-12 14:39:23 +09:00
}
catch ( Exception ex2 )
{
2020-11-24 17:34:18 +09:00
SetError ( cancelMsg + = "|" + xpay . Response ( "LGD_RESPMSG" , 0 ) + "|" + ex2 . StackTrace ) ;
2020-10-12 14:39:23 +09:00
}
}
else
{
2020-11-24 17:34:18 +09:00
// 자동취소가 정상적으로 처리되지 않았을때
vm . Pay . cancelresult = ( vm . Pay . cancelresult ? ? "" ) + "|" + xpay . Response ( "LGD_RESPMSG" , 0 ) ;
vm . Pay . pstatus = 66 ;
Dao . Save ( "pay.pay.fail" , vm . Pay ) ;
SetError ( cancelMsg + = "|" + xpay . Response ( "LGD_RESPCODE" , 0 ) + "|" + xpay . Response ( "LGD_RESPMSG" , 0 ) ) ;
2020-10-12 14:39:23 +09:00
}
2020-11-24 17:34:18 +09:00
vm . Pay . payresult = "0:결제중 오류(E101)" ;
2020-10-12 14:39:23 +09:00
}
}
else
{
2020-11-24 17:34:18 +09:00
//통신상의 문제 발생(최종결제요청 결과 실패 DB처리)
vm . Pay . payresult = "0:통신상의 문제 발생(" + xpay . Response ( "LGD_RESPCODE" , 0 ) + ")" ;
vm . Pay . cancelresult = xpay . Response ( "LGD_RESPMSG" , 0 ) ;
if ( "S007" . Equals ( xpay . m_szResCode ) )
{
vm . Pay . cancelresult = "이미 거래시도된 내역입니다." ;
}
else
{
try
{
Dao . Save ( "pay.pay.fail" , new System . Collections . Hashtable ( ) { { "payno" , payno } , { "pstatus" , 66 } ,
{ "payresult" , xpay . Response ( "LGD_RESPCODE" , 0 ) } ,
{ "payresultmsg" , xpay . Response ( "LGD_RESPMSG" , 0 ) } ,
{ "uno" , SUserInfo . UserNo } , { "uip" , GetUserIP ( ) } } ) ;
}
catch ( Exception ex2 )
{
SetError ( cancelMsg + = "|" + ( cancelMsg ? ? "" ) + "|" + ex2 . StackTrace ) ;
}
}
2020-10-12 14:39:23 +09:00
}
}
2020-11-24 17:34:18 +09:00
else
{
//2)API 요청실패 화면처리
vm . Pay . payresult = "0:결제요청실패(" + xpay . m_szResCode + ")" ;
vm . Pay . cancelresult = xpay . m_szResMsg ;
}
2020-10-12 14:39:23 +09:00
}
2022-08-10 13:09:18 +09:00
//20220802 추가
vm . CM . cmino = lngTmp [ 0 ] ;
vm . CM . cmisno = lngTmp [ 1 ] ;
#region 20220801 선 택 한 교 육 장 정 보
Hashtable hsData = new Hashtable ( ) ;
hsData . Add ( "cmno" , vm . cmno ) ;
var cmInningscdTmp = Dao . Get < CMinningscd > ( "cm.cminningscds.applyedu" , hsData ) . Where ( w = > w . cmino = = lngTmp [ 0 ] & & w . cmisno = = lngTmp [ 1 ] ) ;
foreach ( var item in cmInningscdTmp )
{
vm . SelectCMInningscd = item ;
2022-08-23 12:38:22 +09:00
if ( vm . CM . cshape = = 1 )
2022-08-10 13:09:18 +09:00
{
item . scdInfoSummary = string . Format ( "{0} ~ {1}" , item . estart . ToString ( "yyyy년 MM월 dd일" ) , item . eend . ToString ( "MM월 dd일" ) ) ;
}
else
{
item . scdInfoSummary = string . Format ( "{0} ~ {1}" , DateTime . Now . ToString ( "yyyy년 MM월 dd일" ) , item . eend . ToString ( "MM월 dd일" ) ) ;
}
if ( item . eend ! = null )
{
item . eend2 = item . eend . ToString ( "yyyy년 MM월 dd일" ) ;
}
//vm.SelectCMInningscd.scdInfoSummary = string.Format("{0}", vm.SelectCMInningscd.estart.ToString("yyyy년 MM월 dd일까지"));
if ( vm . SelectCMInningscd . estart < Convert . ToDateTime ( DateTime . Now . ToString ( "yyyy-MM-dd 00:00:00" ) ) )
{
vm . SelectCMInningscd . isEnd = true ;
}
}
#endregion
2020-11-24 17:34:18 +09:00
return View ( "ApplyComplete" , vm ) ;
2020-10-12 14:39:23 +09:00
}
}
}