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; using XPayClientNet; using NP.Base.Popbill; using IBatisNet.DataMapper.Configuration.ResultMapping; 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 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] 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] 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] public JsonResult CMForChange(int cmno) { return JsonBack(Dao.Get("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 ptype, int payamt, PPLog pplog) { #region PPLog #region CM var cm = Dao.Get("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; pplog.cgcode = cm.pcgcode == "1" ? "0" : "1"; if (pplog.cgcode == "1") { pplog.cgno = cm.cgno; } pplog.cshape = cm.cshape; #endregion #region User var user = Dao.Get("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) { var assign = Dao.Get("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; } else { pplog.asname = string.Empty; } #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 var payitems = new List() { }; var uip = GetUserIP(); payitems.Add(new PayItem() { ptype = 0, pcno = null, itemno = pplog.cmno, userno = pplog.userno, status = 1, ispc = 0, pstatus = 1, pcnt = 1, payamt = payamt, payamtcash = 0, payamtcard = 0, cmisno = pplog.cmisno, isrebate = pplog.isrebate ?? 0, rbank = pplog.rbankname, rbankaccnum = pplog.rbankacc, tbankuser = pplog.rbankowner, uno = SUserInfo.UserNo, uip = uip }); //정가확인 var cms = Dao.Get("cm.cms.forpay", new Hashtable() { { "userno", pplog.userno }, { "cmno", payitems.First().itemno } }); 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 = pplog.userno, username = user.username, pstatus = 1, rstatus = 0, refunding = 0, orgamt = cms.Sum(s => s.fee), isinmoney = 1, payamt = payitems.Sum(s => s.payamt), PIs = payitems, cmno = Convert.ToInt32(payitems.First().itemno), cmnos = string.Join(",", payitems.Select(s => s.itemno)), iscashrct = 0, pplno = pplog.pplno, cmisno = pplog.cmisno, uno = SUserInfo.UserNo, uip = GetUserIP() }; #endregion var result = Dao.Get("cm.lectcheckuser", new System.Collections.Hashtable() { { "userno", pplog.userno }, { "cmnos", pay.cmnos } }).First(); if(result > 0) { return JsonOK(-5); } //등록된 교육생인가 확인 var checklectuser = Dao.Get("lect.checkuser", new Hashtable() { {"userno", pplog.userno }, { "cmnos", pay.cmnos } }).Count(); if(checklectuser > 0) { return JsonOK(-4); } if(pay.ptype == 0) { Dao.Insert("pay.standbypay.admin", pay); int bcnt = 0; if (pay.payno > 0) { foreach (var d in pay.PIs) { bcnt++; d.payno = pay.payno; } } if (Dao.Save("pay.standbypayitem.admin", pay) == bcnt + 1) { return JsonOK(pay.payno); } } return JsonOK(Dao.SavePay(pay, true, 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.cmpcsbycmnos", new Hashtable() { { "pcnos", v[0] } }); for(var i=0;i /// 학습독려설정 /// /// /// [HttpPost] public JsonResult SCDLectSave(String sd) { var scd = new SCDLect() { uno = SUserInfo.UserNo, uip = GetUserIP(), Ds = new List() { } }; foreach (var s in sd.Split(';')) { var v = s.Split(':'); 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]) }); } return JsonOK(Dao.Save("lect.scdlect.save", scd)); } /// /// 자격검정 정보 추가 /// [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.in", vm.Exam); } else { vm.Exam.exno = vm.intval; Dao.Save("exam.exam.up", vm.Exam); } return JsonOK(vm.Exam.exno); } /// /// 자격검정 정보 삭제 /// [HttpPost] public JsonResult ExamDel(int exno) { return JsonOK(Dao.Save("exam.del", new Hashtable() { { "exno", exno }, { "uno", SUserInfo.UserNo }, { "uip", GetUserIP() } })); } /// /// 자격검정 응시대상자 추가 /// /// /// [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("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("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 } })); } /// /// KFCF잔재 /// /// /// /// [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() { } }; var dvrs = Dao.Get("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("-", ""), mcontents = string.Format("영남건설기술교육원입니다.\n\n{0}님, [{1}] 교재가 배송시작되었습니다.\n\n☞배송확인: https://www.ilogen.com/web/personal/trace/{2}\n☞사이트: https://edu.kfcf.or.kr", 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); } /// /// KFCF잔재 /// /// /// /// [HttpPost] public JsonResult EUserGet(int pstatus = 0, int exno = 0) { if (pstatus > 0 && exno > 0) { return JsonBack(Dao.Get("exam.examusers", new System.Collections.Hashtable() { { "exno", exno }, { "pstatus", pstatus } })); } return JsonNoData(); } /// /// 수료처리 /// /// /// /// abs: 강제수료처리, calc: 계산수료처리, batch: 일괄계산수료처리(기수료처리자 존재 시 불가) /// [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") { // 강제 수료처리 var Lects1 = Dao.Get("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.abs", new Hashtable() { { "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() } })); } else if (type == "batch") { //강좌별 기 수료처리 체크 후 처리 //cmnos 에서 기 수료처리 강좌 빼기 cmnos = string.Join(",", Dao.Get("grade.nocompletecm", cmnos).Select(s => s.cmno)); if (string.IsNullOrEmpty(cmnos)) { return JsonOK(0); } lectnos = string.Join(",", Dao.Get("grade.nocompletelectcm", cmnos).Select(s => s.lectno)); } var lects = Dao.Get("grade.nocompletelect", lectnos).Where(w => (","+lectnos+",").Contains( ","+w.lectno.ToString()+",")); var completecount = 0; var cancelcount = 0; foreach (var lect in lects) { try { var ispass = Dao.Get("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() } }); } } } catch { } } return JsonBack(new JsonRtn() { code = 1000, msg = "OK", obj = new { completecount , cancelcount } }); } /// /// 수료취소 /// /// /// [HttpPost] public JsonResult LectCompleteCancel(String type, String lectnos) { var cancelcount = 0; var lects = Dao.Get("grade.nocompletelect", lectnos).Where(w => lectnos.Contains(w.lectno.ToString())); foreach (var lect in lects) { if (lect.iscomplete == 1) { cancelcount += Dao.Save("grade.lectcomplete.cancel2", new Hashtable() { { "lectno", lect.lectno }, { "uno", SUserInfo.UserNo }, { "uip", GetUserIP() } }); } } return JsonBack(new JsonRtn() { code = 1000, msg = "OK", obj = new { cancelcount } }); } /// /// 교육일정목록 /// /// /// /// /// [HttpPost] public JsonResult CMInningGetForOff(Int64? cmino,Int64? cmisno,Int64? lectno) { var rtn = new Hashtable() { }; rtn.Add("ci", Dao.Get("cm.cminnings", new Hashtable() { { "cmino", cmino },{"cmisno",cmisno } }).First()); rtn.Add("li", Dao.Get("lect.lectinnings.bycmino", new Hashtable() { { "cmino", cmino }, { "cmisno", cmisno },{"lectno",lectno } })); return JsonBack(rtn); } /// /// 오프라인강좌 출결현황 저장 /// /// /// /// /// /// [HttpPost] public JsonResult OffAttSave(Int64 cmino, String lis, Int64? fgno,Int64? fgnooff) { var cmi = new CMInning() { cmino = cmino, fgno = fgno,fgnooff=fgnooff, Ds = new List() { }, 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"); } if (Request.Files.GetMultiple("file2").Where(w => !string.IsNullOrEmpty(w.FileName)).Count() > 0) { cmi.fgnooff = SetFile(Request.Files.GetMultiple("file2").Where(w => !string.IsNullOrEmpty(w.FileName)).ToList(), cmi.fgnooff ?? 0, "cminning", "fgnooff"); } 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); } if(cmi.fgnooff != null) { Dao.Save("cm.cminning.fgnooff", cmi); } return JsonOK(Dao.Save("att.off.save", cmi)); } /// /// 교육일정 오프라인 출결현황 저장 /// /// /// /// [HttpPost] public JsonResult offattscdsave(int istatus,String userinfos, int attr = -999) { bool attrUpdateCheck = false; // 데이터 처리여부 var lectnos = ""; var cmi = new CMInning() { Ds = new List() { }, uno = SUserInfo.UserNo, uip = GetUserIP() }; if (string.IsNullOrEmpty(userinfos)) { return JsonOK(-1); } else { foreach(var s in userinfos.Split(',')) { lectnos += "," + s.Split(':')[1]; cmi.Ds.Add(new CMInning() { cmino = GetInt64(s.Split(':')[0]), lectno = GetInt64(s.Split(':')[1]), istatus = istatus < 0 ? (Int32?)null : istatus }); } cmi.lectnos = lectnos.Substring(1); } if(attr > -999) { //var kk = new Hashtable() { { "attrdate", attrdate } }; //return JsonOK(0); //string cminos = ""; //foreach (var item in cmi.Ds) //{ // cminos += (cminos == "" ? "" : ",") + item.cmino; //} //cmi.lectnos = lectnos; cmi.uno = SUserInfo.UserNo; cmi.uip = GetUserIP(); cmi.zstring0 = attr.ToString(); switch(attr) { case 0: // 결석처리 cmi.istatus = attr; attrUpdateCheck = true; break; case 1: // 미입력처리 cmi.istatus = null; attrUpdateCheck = true; break; case 2: // 출석처리 cmi.istatus = attr; attrUpdateCheck = true; break; default: // 결석처리 attrUpdateCheck = false; break; } if (attrUpdateCheck) { if(attr == 2) { return JsonOK(Dao.Save("att.scd.setattr", cmi)); } else { return JsonOK(Dao.Save("att.scd.setattrnull", cmi)); } } else { return JsonOK(0); } } else { return JsonOK(Dao.Save("att.scd.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("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("lect.lectexes", new System.Collections.Hashtable() { { "cmno", cmno }, { "exno", exno }, { "isrebate", isrebate }, { "estate", estate } })); } /// /// 시험응시목록(전체) /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// public JsonResult LectAllEXes(int pagenum, int pagerowcount,int extype, String edate, String cname, String cnamestr, String searchtype, String searchtext,String sdateall,String edateall,String asname, int? studyplace = null, int? iscomplete = null, int? cshape = null, int? sdstate = null) { pagenum = pagenum < 1 ? 1 : pagenum; pagerowcount = pagerowcount < 1 ? PageRowCount : pagerowcount; return JsonBack(Dao.Get("lect.lectexes.all", new System.Collections.Hashtable() { {"extype",extype },{ "estate", sdstate }, { "pagenum", pagenum }, { "pagerowsize", pagerowcount }, { "edate", edate },{"sdateall",sdateall },{"edateall",edateall }, { "cshape", cshape }, { "cname", cname }, { "cnamestr", cnamestr }, { "iscomplete", iscomplete }, { "studyplace", studyplace }, { "searchtype", searchtype }, { "searchtext", searchtext },{"asname",asname } })); } /// /// 재응시처리 /// /// /// /// [HttpPost] public JsonResult ReExam(int exno, Int64 lectno, int extype) //재응시 관련 수정완료 #xodus 수정완료 reexam에 extype 추가 { return JsonOK(Dao.Save("lect.reexam", new Hashtable() { { "exno", exno }, { "lectno", lectno }, { "extype", extype }, { "uno", SUserInfo.UserNo }, { "uip", GetUserIP() } }) > 1 ? 1 : 0); } /// /// 재응시처리로그 /// /// /// /// [HttpPost] public JsonResult ReExamLog(int exno, Int64 lectno) { return JsonBack(Dao.Get("lect.reexam.log", new System.Collections.Hashtable() { { "exno", exno }, { "lectno", lectno } })); } /// /// 시험응시 정보 목록 /// /// /// /// [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("lect.lectex", ht).First()); var lectexq = Dao.Get("lect.lectexq", ht); rtn.Add("lectexq", lectexq); ht.Add("eqnos", string.Join(",", lectexq.Select(s => s.eqno))); rtn.Add("lectexqs", Dao.Get("lect.lectexqs", ht)); rtn.Add("qis", Dao.Get("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, int extype = 1) { IList qis = Dao.Get("lect.eqno.listforcheck", new Hashtable() { { "lectno", lectno }, { "eqno", eqno }, { "exno", exno } }); int? iscorrect = null; if(qis.Count() > 0) { var qi = qis.FirstOrDefault(); if(qi.atype == 0) { iscorrect = string.Join(",", qis.Where(w => w.eqno == eqno).ToList().Select(s => s.qino)) == qi.atext ? 1 : 0; } else if (qi.isignorecase == 0) { iscorrect = qis.Where(w => w.eqno == eqno).Where(w => (w.qitext ?? "").Replace(qi.ispassspace == 1 ? " " : "박건박건박효동", "") == (qi.atext.Replace("$$$PHDPHD$$$", ";").Replace("$$$PHD$$$", ":") ?? "").Replace(qi.ispassspace == 1 ? " " : "박건박건박효동", "")).Count() > 0 ? 1 : 0; } else { iscorrect = qis.Where(w => w.eqno == eqno).Where(w => (w.qitext ?? "").Replace(qi.ispassspace == 1 ? " " : "박건박건박효동", "").ToLower() == (qi.atext.Replace("$$$PHDPHD$$$", ";").Replace("$$$PHD$$$", ":") ?? "").Replace(qi.ispassspace == 1 ? " " : "박건박건박효동", "").ToLower()).Count() > 0 ? 1 : 0; } } return JsonOK(Dao.Save("lect.lectexq.point", new Hashtable() { { "lectno", lectno }, { "exno", exno }, { "eqno", eqno }, { "extype", extype }, {"iscorrect"+(iscorrect == null ? "x" : ""),iscorrect }, { "cpoint", cpoint }, { "uno", SUserInfo.UserNo }, { "uip", GetUserIP() } })); } /// /// KFCF잔재 /// /// /// /// public JsonResult ExamUserBatch(int intval, String datas) { var eu = new ExamUser() { exno = intval, Ds = new List() { }, 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("lect.lectsds", new System.Collections.Hashtable() { { "cmno", cmno }, { "sdno", sdno }, { "isrebate", isrebate }, { "estate", sdstate },{"isproduct"+ (GetConfig("isstaging") == "1" ? "x" : ""), 1 } })); } /// /// 과제제출이력(전체) /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// [HttpPost] public JsonResult LectAllSDs(int pagenum,int pagerowcount,String edate,String cname,String cnamestr,String searchtype,String searchtext,String sdateall,String edateall,String asname, int? studyplace = null, int? iscomplete = null, int? cshape = null, int? sdstate = null,int? sdtype = 0) { pagenum = pagenum < 1 ? 1 : pagenum; pagerowcount = pagerowcount < 1 ? PageRowCount : pagerowcount; var result = Dao.Get("lect.lectsds.all", new System.Collections.Hashtable() { { "estate", sdstate }, { "pagenum", pagenum }, { "pagerowsize", pagerowcount }, { "edate", edate }, { "sdateall", sdateall }, { "edateall", edateall }, { "cshape", cshape }, { "cname", cname }, { "cnamestr", cnamestr }, { "iscomplete", iscomplete }, { "studyplace", studyplace }, { "searchtype", searchtype }, { "searchtext", searchtext }, { "sdtype", sdtype }, { "asname", asname }, { "isproduct" + (GetConfig("isstaging") == "1" ? "x" : ""), 1 }, }); return JsonBack(result); } /// /// 과제제출상세정보 /// /// /// /// [HttpPost] public JsonResult LectSD(Int64 lectno, int sdno) { return JsonBack(Dao.Get("lect.lectsd", new Hashtable() { { "lectno", lectno }, { "sdno", sdno }, { "isproduct" + (GetConfig("isstaging") == "1" ? "x" : ""), 1 } }).First()); } /// /// 과제제출평가 /// /// /// [HttpPost] public JsonResult LectSDSave(LectSD d) { d.uno = SUserInfo.UserNo; d.uip = GetUserIP(); d.isproduct = GetConfig("isstaging") == "1" ? (int?)null : 1; if (Request.Files.GetMultiple("fgno").Where(w => !string.IsNullOrEmpty(w.FileName)).Count() > 0) { //d.fgno = SetFile(Request.Files.GetMultiple("fgno").Where(w => !string.IsNullOrEmpty(w.FileName)).ToList(), d.fgno ?? 0, "lectsd", "fgno"); d.fgno = SetFile(Request.Files.GetMultiple("fgno").Where(w => !string.IsNullOrEmpty(w.FileName)).ToList(), d.fgno ?? 0, "lectsd", "fgno", 1, "XX", false, true, d.cmno, d.userno); } return JsonOK(Dao.Save("lect.lectsd"+(d.ccount == 1 ? "2" : "")+".save" + (string.IsNullOrEmpty(d.lectnos) ? "" : "batch"), d)); } /// /// 과제제출평가(관리자등록) /// /// /// [HttpPost] public JsonResult LectSDSaveToAdmin(LectSD d) { d.uno = SUserInfo.UserNo; d.uip = GetUserIP(); d.isproduct = GetConfig("isstaging") == "1" ? (int?)null : 1; if (Request.Files.GetMultiple("fgno").Where(w => !string.IsNullOrEmpty(w.FileName)).Count() > 0) { //d.fgno = SetFile(Request.Files.GetMultiple("fgno").Where(w => !string.IsNullOrEmpty(w.FileName)).ToList(), d.fgno ?? 0, "lectsd", "fgno"); d.fgno = SetFile(Request.Files.GetMultiple("fgno").Where(w => !string.IsNullOrEmpty(w.FileName)).ToList(), d.fgno ?? 0, "lectsd", "fgno", 1, "XX", false, true, d.cmno, d.userno); d.zstring0 = "T"; } else { d.zstring0 = ""; } return JsonOK(Dao.Save("lect.lectsd" + (d.ccount == 1 ? "2" : "") + ".save2" + (string.IsNullOrEmpty(d.lectnos) ? "" : "batch"), d)); } /// /// 과제이력 일괄다운로드 /// /// /// /// /// /// [HttpGet] public JsonResult LectSDZip(VMLect vm, int cmno, int classno, int sdno) { var sds = Dao.Get("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 newfile = new List(); 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.Subjects + 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("lect.lectdiscusses", _ht)); } /// /// 토론상세 /// /// /// /// [HttpPost] public JsonResult LectDiscuss(Int64 lectno, int sdno) { var rtn = new Hashtable() { }; var sd = Dao.Get("lect.lectdiscuss", new Hashtable() { { "lectno", lectno }, { "sdno", sdno } }).First(); rtn.Add("sd", sd); rtn["ds"] =Dao.Get("lect.lectsdboards", new Hashtable() { { "lectno", lectno }, { "sdno", sdno } }); return JsonBack(rtn); } /// /// KFCF잔재 /// /// /// /// /// /// /// [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("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 PayRfdCancel(PayRfd d) { d.uno = SUserInfo.UserNo; d.uip = GetUserIP(); d.rstatus = 4; return JsonOK(Dao.Save("pay.payrfdcancel.up", d)); } /// /// 결제환불 /// /// /// /// /// /// [HttpPost] public JsonResult PayRefund(Int64 payno, String sd, int isrefunddvr,bool iscancel) { var p = Dao.Get("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() { }; 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() { }; var pis3 = new List() { }; if (pis.Where(w => w.rstatus == 0).Count() > 0) { pis2 = Dao.Get("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("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 { //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); //} //p.cancelcnt= GetInt(INIpay.GetResult(ref intPInst, "PRTC_Cnt"));//부분취소 요청횟수 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("취소요청이 실패하였습니다.
"); return JsonOK(0); } } else { //2)API 요청 실패 화면처리 //Response.Write("결제 부분취소요청이 실패하였습니다.
"); //Response.Write("TX Response_code = " + xpay.m_szResCode + "
"); //Response.Write("TX Response_msg = " + xpay.m_szResMsg + "

"); return JsonOK(0); } } catch (Exception ex) { 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 PayRefundInfoSave(PayItem d) { d.uno = SUserInfo.UserNo; d.uip = GetUserIP(); return JsonOK(Dao.Save("cr.payrefundinfo.up", d)); } /// /// 세금계산서 저장 /// /// /// [HttpPost] public JsonResult PayTaxSave(PayTax d) { d.uno = SUserInfo.UserNo; d.uip = GetUserIP(); if(d.iscancel != 1 && Dao.Get("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)); } #region 세금계산서 임시저장(팝빌 임시저장 및 paytax.mgtkey 업데이트) /// /// 세금계산서 임시저장(팝빌 임시저장 및 paytax.mgtkey 업데이트) /// /// payTax /// [HttpPost] public JsonResult PayTaxTempSave(PayTax payTax) { payTax.uno = SUserInfo.UserNo; payTax.uip = GetUserIP(); if (payTax.iscancel != 1 && payTax.taxdate != null && Dao.Get("cr.paytaxes", new Hashtable() { { "payno", payTax.payno }, { "cno", payTax.cno }, { "iscancel", 0 }, { "nottaxno", payTax.taxno } }).Count() > 0) { return JsonBack(new JsonRtn() { code = -1 }); } if (string.IsNullOrEmpty(payTax.mgtkey)) { payTax.mgtkey = Popbill.PopbillService.MakeMgtKey(Dao, payTax.taxno, payTax.taxdate.Value); } if (Dao.Save("cr.paytax.save", payTax) > 0) { var payItems = Dao.Get("cr.paytaxitem2", new System.Collections.Hashtable() { { "taxno", payTax.taxno } }); var result = Popbill.PopbillService.TempSave(Dao, payTax, payItems); if (result.IsSuccess) { #region 세금계산서 상태코드 업데이트 var taxinvoiceInfo = PopbillService.GetTaxinvoiceInfo(payTax).Data; payTax.statecode = taxinvoiceInfo.stateCode; Dao.Save("cr.paytax.save", payTax); #endregion return JsonOK(result.Code); } else { #region 임시저장 실패시 mgtkey 미사용이면 저장값 초기화 var checkResult = Popbill.PopbillService.CheckMgtKeyInUse(payTax.mgtkey); if (checkResult.IsSuccess) { if (!checkResult.IsUse) { payTax.mgtkey = string.Empty; Dao.Save("cr.paytax.save", payTax); } } #endregion return JsonError(JSONCode.Error, result.Message, result); } } return JsonOK(0); } #endregion #region 세금계산서 발행(팝빌 발행) /// /// 세금계산서 발행(팝빌 발행) /// /// /// [HttpPost] public JsonResult PayTaxIssue(PayTax payTax) { payTax.uno = SUserInfo.UserNo; payTax.uip = GetUserIP(); if (payTax.iscancel != 1 && payTax.taxdate != null && Dao.Get("cr.paytaxes", new Hashtable() { { "payno", payTax.payno }, { "cno", payTax.cno }, { "iscancel", 0 }, { "nottaxno", payTax.taxno } }).Count() > 0) { return JsonBack(new JsonRtn() { code = -1 }); } if (Dao.Save("cr.paytax.save", payTax) > 0) { var result = Popbill.PopbillService.Issue(payTax.mgtkey); if (result.IsSuccess) { #region 세금계산서 상태코드 업데이트 var taxinvoiceInfo = PopbillService.GetTaxinvoiceInfo(payTax).Data; payTax.statecode = taxinvoiceInfo.stateCode; Dao.Save("cr.paytax.save", payTax); #endregion return JsonOK(result.Code); } else { return JsonError(JSONCode.Error, result.Message, result); } } return JsonOK(0); } #endregion #region 세금계산서 즉시발행(팝빌 발행 및 paytax.mgtkey 업데이트) /// /// 세금계산서 즉시발행(팝빌 발행 및 paytax.mgtkey 업데이트) /// /// payTax /// [HttpPost] public JsonResult PayTaxRegistIssue(PayTax payTax) { payTax.uno = SUserInfo.UserNo; payTax.uip = GetUserIP(); if (payTax.iscancel != 1 && payTax.taxdate != null && Dao.Get("cr.paytaxes", new Hashtable() { { "payno", payTax.payno }, { "cno", payTax.cno }, { "iscancel", 0 }, { "nottaxno", payTax.taxno } }).Count() > 0) { return JsonBack(new JsonRtn() { code = -1 }); } if (string.IsNullOrEmpty(payTax.mgtkey)) { payTax.mgtkey = Popbill.PopbillService.MakeMgtKey(Dao,payTax.taxno, payTax.taxdate.Value); } if (Dao.Save("cr.paytax.save", payTax) > 0) { var payItems = Dao.Get("cr.paytaxitem2", new System.Collections.Hashtable() { { "taxno", payTax.taxno } }); string[] popbillManager = GetConfig("popbillManager").Split(';'); var result = Popbill.PopbillService.RegistIssue(Dao, payTax, payItems, popbillManager[0], popbillManager[1]); if (result.IsSuccess) { #region 세금계산서 상태코드 업데이트 var taxinvoiceInfo = PopbillService.GetTaxinvoiceInfo(payTax).Data; payTax.statecode = taxinvoiceInfo.stateCode; Dao.Save("cr.paytax.save", payTax); #endregion return JsonOK(result.Code); } else { #region 즉시발행 실패시 mgtkey 미사용이면 저장값 초기화 var checkResult = Popbill.PopbillService.CheckMgtKeyInUse(payTax.mgtkey); if (checkResult.IsSuccess) { if (!checkResult.IsUse) { payTax.mgtkey = string.Empty; Dao.Save("cr.paytax.save", payTax); } } #endregion return JsonError(JSONCode.Error, result.Message, result); } } return JsonOK(0); } #endregion #region 세금계산서 발행취소(발행전: paytax.iscancel 상태값 변경, 발행완료: 팝빌 발행취소 및 paytax.iscancel 상태값 변경) /// /// 세금계산서 발행취소(발행전: paytax.iscancel 상태값 변경, 발행완료: 팝빌 발행취소 및 paytax.iscancel 상태값 변경) /// /// /// [HttpPost] public JsonResult PayTaxCancelIssue(PayTax payTax) { payTax.uno = SUserInfo.UserNo; payTax.uip = GetUserIP(); payTax.iscancel = 1; //mgtkey 발급여부 체크 var nowPayTax = Dao.Get("cr.paytaxes", new Hashtable() { { "taxno", payTax.taxno } }).FirstOrDefault(); if (nowPayTax != null && !string.IsNullOrEmpty(nowPayTax.mgtkey)) { payTax.mgtkey = nowPayTax.mgtkey; } if (!string.IsNullOrEmpty(payTax.mgtkey)) { var taxinvoice = Popbill.PopbillService.GetTaxinvoice(payTax).Data; if (!string.IsNullOrEmpty(taxinvoice.ntsconfirmNum)) { var result = Popbill.PopbillService.CancelIssue(payTax.mgtkey); if (result.IsSuccess) { #region 세금계산서 상태코드 업데이트 var taxinvoiceInfo = PopbillService.GetTaxinvoiceInfo(payTax).Data; payTax.statecode = taxinvoiceInfo.stateCode; #endregion return JsonOK(Dao.Save("cr.paytax.save", payTax)); } else { #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); } } else { return JsonOK(Dao.Save("cr.paytax.save", payTax)); } } else { return JsonOK(Dao.Save("cr.paytax.save", payTax)); } } #endregion #region 세금계산서 조회(팝빌 세금계산서 인쇄 url 리턴) /// /// 세금계산서 조회(팝빌 세금계산서 인쇄 url 리턴) /// /// /// [HttpPost] public JsonResult PayTaxView(PayTax payTax) { var result = Popbill.PopbillService.GetPrintURL(payTax.mgtkey); if (result.IsSuccess) { return JsonObj(result.Data); } else { return JsonError(JSONCode.Error, result.Message, result); } } #endregion [HttpPost] public JsonResult SmartTaxView(String csid) { var Datas = new List() { }; 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().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() { } }; //1~7. 온라인/혼합 출석 80% 미만, 진행평가, 최종평가, 과제, 토론, 강의평가 미참여 if (scdno < 8) { m.Users.Add(new MemoUser() { smstype = "A", 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) { SaveTalk(m.Users.Where(w => w.isok == 1).ToList(), "encourage1"); m.Users.Clear(); } 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(); } if (IsEmail(email)) { SendEmail(masteremail.Split(';')[1], GetInt(masteremail.Split(';')[2]), masteremail.Split(';')[3], masteremail.Split(';')[4], 999, email, senderemail, "[영남건설기술교육원]", "[영남건설기술교육원] 진행평가 참여 알림", string.Format("영남건설기술교육원입니다.

[{0}]님이 수강중인 [{1}] 강좌의 교육 종료일이 {2}일 남았습니다. 종료되기전에 서둘러 " + (scdno < 3 ? "학습을 진행" : scdno == 3 ? "진행평가에" : scdno == 4 ? "최종평가에" : scdno == 5 ? "과제을 제출" : scdno == 6 ? "토론에 참여" : scdno == 7 ? "강의평가에 참여" : "-") + " 진행해주세요.

☞사이트 : https://ynicte.nptc.kr/", "test", "테스트", 1)); } } else if (scdno == 8)//8. 오프라인 출석 { m.Users.Add(new MemoUser() { smstype = "A", 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) { 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(); } if (IsEmail(email)) { SendEmail(masteremail.Split(';')[1], GetInt(masteremail.Split(';')[2]), masteremail.Split(';')[3], masteremail.Split(';')[4], 999, email, senderemail, "[영남건설기술교육원]", "[영남건설기술교육원] 진행평가 참여 알림", string.Format("영남건설기술교육원입니다.

{0}님이 신청중인 [{1}] 강좌의 교육이 [{2}]에 {3}에서 시작됩니다.

☞사이트 : https://ynicte.nptc.kr/", "test", "테스트", DateTime.Now.ToString("yyyy-MM-dd"),"영남건설기술교육원 대회의실")); } } else if (scdno == 9)//9. 자격검정 시험 { m.Users.Add(new MemoUser() { smstype = "A", 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) { 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)) { SendEmail(masteremail.Split(';')[1], GetInt(masteremail.Split(';')[2]), masteremail.Split(';')[3], masteremail.Split(';')[4], 999, email, senderemail, "[영남건설기술교육원]", "[영남건설기술교육원] 진행평가 참여 알림", string.Format("영남건설기술교육원입니다.

{0}님이 수강중인 [{1}] 자격검정이 [{2}]에 영남건설기술교육원 대회의실에서 이뤄질 예정입니다.

☞사이트: https://ynicte.nptc.kr/", "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 PayCancelPay(Int64 payno, int userno) { return JsonOK(Dao.Save("pay.paycancel", new Hashtable() { { "payno", payno }, { "userno", userno }, { "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() } })); } /// /// 수료일자 변경 /// /// /// /// /// [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() } })); } /// /// 교육일정목록 /// /// /// /// [HttpPost] public JsonResult GetScdForMixEdu(int cmno, int iscmlects = 0, int scdallCheck = 0) { var result = Dao.Get("cm.cminningscds.applyedu.admin" + (scdallCheck > 0 ? "2" : ""), new System.Collections.Hashtable() { { "cmno", cmno } }); //var result = Dao.Get("cm.cminningscds.applyedu.admin", new System.Collections.Hashtable() { { "cmno", cmno } }); IList result2 = new List(); if (result.Count() > 0) { long cmino = result.First().cmino; result2 = Dao.Get("cm.cminningscds.attr2Check", new System.Collections.Hashtable() { { "cmno", cmno }, { "cmino", cmino } }); } 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; if(result2.Count() > 0) { item.intv1 = result2.Where(c => c.cmino == item.cmino && c.cmisno == item.cmisno && c.intv1 == 2).Count(); item.remainPeople += item.intv1; } } if (iscmlects == 1) return JsonBack(result.OrderByDescending(o => o.estart)); return JsonBack(result.OrderByDescending(o => o.estart)); } /// /// 교육일정회차목록 /// /// /// [HttpPost] public JsonResult GetCmiForMixEdu(int cmno) { var rtn = new Hashtable(); rtn.Add("cmi", Dao.Get("cm.cminnings", new System.Collections.Hashtable() { { "cmno", cmno }, { "isonline", 0 }, { "isscd", 1 } })); rtn.Add("cmis", Dao.Get("cm.cminningscds", new System.Collections.Hashtable() { { "cmno", cmno } })); return JsonBack(rtn); } /// /// 수강정보 교육일정 변경 /// /// /// /// [HttpPost] public JsonResult LectScdChange(Int64 lectno, Int64 cmisno) { return JsonOK(Dao.Save("lect.cmisno.up", new Hashtable() { { "lectno", lectno }, { "cmisno" , cmisno} })); } /// /// 결제신청정보변경 /// /// /// /// /// /// /// [HttpPost] public JsonResult PPlogTypeChange(Int64 pplno, string typeman, string typejob, string typeedu, string typegrade, string typejobitem) { typejobitem = string.IsNullOrWhiteSpace(typejobitem) ? "0" : typejobitem; return JsonOK(Dao.Save("pay.pplogtype.up", new Hashtable() { { "pplno", pplno }, { "typeman", typeman }, { "typejob", typejob }, { "typeedu", typeedu }, { "typegrade", typegrade }, { "typejobitem", typejobitem } })); } /// /// 과거신청이력 /// /// /// [HttpPost] public JsonResult DocumnetsPast(Int64 no) { return JsonBack(Dao.Get("cr.documnetspast", new Hashtable() { { "no", no } }).First()); } /// /// 과거신청이력 수정 /// /// /// [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)); } /// /// 수료현황 /// /// /// [HttpPost] public JsonResult Completion(Int64 lectno) { string jobTypeItems = "typejob40,typejob41,typejob42,typejob43,typejob44,typejob45,typejob46,typejob47,typejob48,typejob49,typejob57"; var comCodes = GetComCodes("typeman,typeedu,typegrade,typejob,studyplace," + jobTypeItems); var completion = Dao.Get("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); } var check = Dao.Get("users.checkuser", new Hashtable() { { "usernonot", completion.userno }, { "mobile", completion.mobile }}).First(); if (check == 3) { return JsonError(JSONCode.Error, "이미 해당 휴대폰번호로 등록된 회원이 존재합니다.", false); } return JsonOK(Dao.Save("cr.completion.up", completion)); } /// /// 현금영수증 취소 /// /// /// [HttpPost] public JsonResult UnTax(Int64 payno) { return JsonOK(Dao.Save("pay.untax", new Hashtable() { { "payno", payno }, { "uno", SUserInfo.UserNo }, { "uip", GetUserIP() } })); } /// /// 세금계산서 확인 여부 변경 /// /// /// /// /// [HttpPost] public JsonResult taxcheck(String taxnos,int ischeck,int? taxno) { if (string.IsNullOrEmpty(taxnos) && taxno == null) { return JsonBack(new JsonRtn() { code = 1000, obj = -1 }); } if(Dao.Get("cr.paytax.byischeck", new Hashtable() { { "taxnos", taxnos },{"taxno",taxno }, { "ischeck",ischeck } }).FirstOrDefault() > 0) { return JsonBack(new JsonRtn() {code = 1000, obj = -2 }); } return JsonOK(Dao.Save("pay.taxcheck", new Hashtable() { { "taxnos", taxnos }, { "taxno", taxno }, {"ischeck",ischeck }, { "uno", SUserInfo.UserNo }, { "uip", GetUserIP() } })); } /// /// 세금계산서 발행 취소 /// /// /// /// [HttpPost] public JsonResult taxcancel(String taxnos, int? taxno) { if (string.IsNullOrEmpty(taxnos) && taxno == null) { return JsonBack(new JsonRtn() { code = 1000, obj = -1 }); } if (Dao.Get("cr.paytax.byisstate", new Hashtable() { { "taxnos", taxnos }, { "taxno", taxno }, { "state", 0 } }).FirstOrDefault() > 0) { return JsonBack(new JsonRtn() { code = 1000, obj = -2 }); } return JsonOK(Dao.Save("pay.taxcancel", new Hashtable() { { "taxnos", taxnos }, { "taxno", taxno }, { "uno", SUserInfo.UserNo }, { "uip", GetUserIP() } })); } /// /// 성적업로드 /// /// 수강 /// [HttpPost] public JsonResult GradeUploadBatch(IList lectexs) { var result = 0; foreach (var lectex in lectexs) { var lectexsNow = Dao.Get("lect.lectex.forgradeupload", new Hashtable() { { "userno", lectex.userno }, { "lectno", lectex.lectno } }); if (lectexsNow.Count == 1 && lectexsNow.First().tpoint >= lectex.tpoint) { lectex.uno = SUserInfo.UserNo; lectex.uip = GetUserIP(); result += Dao.Save("lect.lectex.point.byadmin", lectex) > 0 ? 1 : 0; } } return JsonOK(result, true); } } }