@@ -0,0 +1,34 @@ | |||
| |||
Microsoft Visual Studio Solution File, Format Version 12.00 | |||
# Visual Studio 15 | |||
VisualStudioVersion = 15.0.28307.106 | |||
MinimumVisualStudioVersion = 10.0.40219.1 | |||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DigitalSchoolApi", "DigitalSchoolApi\DigitalSchoolApi.csproj", "{5E17B74E-86A0-4F62-82C1-75F8792761DC}" | |||
EndProject | |||
Global | |||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | |||
Debug|Any CPU = Debug|Any CPU | |||
Debug|x64 = Debug|x64 | |||
Release|Any CPU = Release|Any CPU | |||
Release|x64 = Release|x64 | |||
EndGlobalSection | |||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | |||
{5E17B74E-86A0-4F62-82C1-75F8792761DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | |||
{5E17B74E-86A0-4F62-82C1-75F8792761DC}.Debug|Any CPU.Build.0 = Debug|Any CPU | |||
{5E17B74E-86A0-4F62-82C1-75F8792761DC}.Debug|x64.ActiveCfg = Debug|x64 | |||
{5E17B74E-86A0-4F62-82C1-75F8792761DC}.Debug|x64.Build.0 = Debug|x64 | |||
{5E17B74E-86A0-4F62-82C1-75F8792761DC}.Release|Any CPU.ActiveCfg = Release|Any CPU | |||
{5E17B74E-86A0-4F62-82C1-75F8792761DC}.Release|Any CPU.Build.0 = Release|Any CPU | |||
{5E17B74E-86A0-4F62-82C1-75F8792761DC}.Release|x64.ActiveCfg = Release|x64 | |||
{5E17B74E-86A0-4F62-82C1-75F8792761DC}.Release|x64.Build.0 = Release|x64 | |||
EndGlobalSection | |||
GlobalSection(SolutionProperties) = preSolution | |||
HideSolutionNode = FALSE | |||
EndGlobalSection | |||
GlobalSection(ExtensibilityGlobals) = postSolution | |||
SolutionGuid = {6AE6DE61-A9D5-4934-9357-B890087190BB} | |||
EndGlobalSection | |||
GlobalSection(ExtensibilityGlobals) = postSolution | |||
SolutionGuid = {6AE6DE61-A9D5-4934-9357-B890087190BB} | |||
EndGlobalSection | |||
EndGlobal |
@@ -0,0 +1,186 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Configuration; | |||
using System.IO; | |||
using System.Linq; | |||
using System.Net; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using Learun.Util; | |||
using Newtonsoft.Json; | |||
namespace DigitalSchoolApi.App_Data | |||
{ | |||
public class LicenseStatus | |||
{ | |||
public bool Result { get; set; } | |||
public string Message { get; set; } | |||
public string ExpirationDate { get; set; } | |||
} | |||
public class LicenseChecker | |||
{ | |||
/// <summary> | |||
/// license.bjqj文件地址 | |||
/// </summary> | |||
private static string licensePath = ConfigurationManager.AppSettings["licensePath"]; | |||
public static string GenerateMachineId() | |||
{ | |||
string cpuid = ""; LicenseManager.GetCPUSerialNumber(); | |||
string hd = LicenseManager.GetHardDriverNumber().TrimEnd(); | |||
string bios = ""; LicenseManager.GetBoisNumber(); | |||
string uid = LicenseManager.GetMachineName().TrimEnd(); | |||
return DESEncrypt.Encrypt(cpuid + hd + bios + uid, "bjquanjiang@2020!"); | |||
} | |||
public static void WriteLicense(string licensecode) | |||
{ | |||
try | |||
{ | |||
string binpath = AppDomain.CurrentDomain.BaseDirectory; | |||
string fullpath = binpath + "\\bin\\license.bjqj"; | |||
System.IO.File.WriteAllText(fullpath, licensecode); | |||
} | |||
catch (Exception e) | |||
{ | |||
throw e; | |||
} | |||
} | |||
public static LicenseStatus CheckLicense() | |||
{ | |||
StreamReader sr = null; | |||
string machineid = string.Empty; | |||
LicenseStatus ls = new LicenseStatus(); | |||
try | |||
{ | |||
TimeOutCheckTool tool = new TimeOutCheckTool(); | |||
var checkResult = tool.TimeoutCheckTwo(4000, () => GetMAManagementInfo()); | |||
if (!checkResult) | |||
{ | |||
ls.Message = "未授权"; | |||
return ls; | |||
} | |||
machineid = GenerateMachineId(); | |||
//判断有无授权 | |||
string binpath = licensePath;//AppDomain.CurrentDomain.BaseDirectory; | |||
string fullpath = binpath + "\\license.bjqj"; | |||
if (System.IO.File.Exists(fullpath)) | |||
{ | |||
sr = new StreamReader(fullpath, Encoding.UTF8); | |||
string u7str = sr.ReadToEnd(); | |||
if (!string.IsNullOrEmpty(u7str)) | |||
{ | |||
string desstr = DESEncrypt.Decrypt(u7str, "bjquanjiang@2020!@lckey" + Md5Helper.Encrypt(machineid, 32)); | |||
if (!string.IsNullOrEmpty(desstr)) | |||
{ | |||
string[] codeanddate = desstr.Split('&'); | |||
if (codeanddate[0] == Md5Helper.Encrypt(machineid, 16)) | |||
{ | |||
ls.ExpirationDate = codeanddate[1]; | |||
if (!string.IsNullOrEmpty(codeanddate[1])) | |||
{ | |||
ls.Result = LicenseManager.GetNowTime(codeanddate[1]); | |||
} | |||
else | |||
{ | |||
ls.Result = true; | |||
ls.ExpirationDate = "永久有效"; | |||
} | |||
ls.Message = ls.Result ? "已授权" : "授权期已过"; | |||
} | |||
else | |||
{ | |||
ls.Message = "未授权"; | |||
} | |||
} | |||
else | |||
{ | |||
ls.Message = "未授权"; | |||
} | |||
} | |||
else | |||
{ | |||
ls.Message = "未授权"; | |||
} | |||
} | |||
else | |||
{ | |||
ls.Message = "未找到授权文件"; | |||
} | |||
return ls; | |||
} | |||
catch (Exception e) | |||
{ | |||
ls.Result = false; | |||
ls.Message = "未授权,不正确的授权文件"; | |||
return ls; | |||
} | |||
finally | |||
{ | |||
if (sr != null) | |||
{ | |||
sr.Dispose(); | |||
sr.Close(); | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 网络授权判断 | |||
/// </summary> | |||
/// <returns></returns> | |||
public static bool GetMAManagementInfo() | |||
{ | |||
try | |||
{ | |||
//查找授权管理信息 | |||
var url = "http://123.57.209.16:8062/management/data"; | |||
var MachineId = LicenseChecker.GenerateMachineId(); | |||
var body = "{\"data\":'{\"code\":\"" + MachineId + "\",\"guid\":\"123\"}'}"; | |||
Encoding encoding = Encoding.UTF8; | |||
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); | |||
request.Method = "POST"; | |||
request.Accept = "text/html, application/xhtml+xml, */*"; | |||
request.ContentType = "application/json"; | |||
byte[] buffer = encoding.GetBytes(body); | |||
request.ContentLength = buffer.Length; | |||
request.GetRequestStream().Write(buffer, 0, buffer.Length); | |||
HttpWebResponse response = (HttpWebResponse)request.GetResponse(); | |||
using (StreamReader reader = new StreamReader(response.GetResponseStream(), Encoding.UTF8)) | |||
{ | |||
dynamic res = JsonConvert.DeserializeObject(reader.ReadToEnd()); | |||
if (res.data == null) | |||
{ | |||
return false; | |||
} | |||
else | |||
{ | |||
bool Result = res.data; | |||
if (Result) | |||
{ | |||
return true; | |||
} | |||
else | |||
{ | |||
return false; | |||
} | |||
} | |||
} | |||
} | |||
catch (Exception e) | |||
{ | |||
return true; | |||
} | |||
} | |||
} | |||
} |
@@ -0,0 +1,116 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Management; | |||
using System.Net.Http; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace DigitalSchoolApi.App_Data | |||
{ | |||
public class LicenseManager | |||
{ | |||
public static bool GetNowTime(string lcdate) | |||
{ | |||
bool islc = false; | |||
try | |||
{ | |||
HttpClient client = new HttpClient(); | |||
var data = client.GetStringAsync("http://cgi.im.qq.com/cgi-bin/cgi_svrtime").Result; | |||
if (!string.IsNullOrEmpty(data)) | |||
{ | |||
var dt = DateTime.Parse(data); | |||
islc = dt < DateTime.Parse(lcdate); | |||
} | |||
return islc; | |||
} | |||
catch | |||
{ | |||
if (DateTime.Now >= DateTime.Parse(lcdate)) | |||
{ | |||
return false; | |||
} | |||
return true; | |||
} | |||
} | |||
public static string GetCPUSerialNumber() | |||
{ | |||
try | |||
{ | |||
string cpuSerialNumber = string.Empty; | |||
ManagementClass mc = new ManagementClass("Win32_Processor"); | |||
ManagementObjectCollection moc = mc.GetInstances(); | |||
foreach (ManagementObject mo in moc) | |||
{ | |||
cpuSerialNumber = mo["ProcessorId"].ToString(); | |||
break; | |||
} | |||
mc.Dispose(); | |||
moc.Dispose(); | |||
return cpuSerialNumber; | |||
} | |||
catch (Exception e) | |||
{ | |||
return "bjqjcpuid"; | |||
} | |||
} | |||
public static string GetHardDriverNumber() | |||
{ | |||
try | |||
{ | |||
ManagementClass mc = new ManagementClass("Win32_PhysicalMedia"); | |||
ManagementObjectCollection moc = mc.GetInstances(); | |||
string strID = string.Empty; | |||
foreach (ManagementObject mo in moc) | |||
{ | |||
strID = mo.Properties["SerialNumber"].Value.ToString(); | |||
break; | |||
} | |||
mc.Dispose(); | |||
moc.Dispose(); | |||
return strID; | |||
} | |||
catch (Exception e) | |||
{ | |||
return "bjqjharddriverid"; | |||
} | |||
} | |||
public static string GetBoisNumber() | |||
{ | |||
try | |||
{ | |||
ManagementClass mc = new ManagementClass("Win32_BIOS"); | |||
ManagementObjectCollection moc = mc.GetInstances(); | |||
string strID = string.Empty; | |||
foreach (ManagementObject mo in moc) | |||
{ | |||
strID = mo.Properties["SerialNumber"].Value.ToString(); | |||
break; | |||
} | |||
mc.Dispose(); | |||
moc.Dispose(); | |||
return strID; | |||
} | |||
catch (Exception e) | |||
{ | |||
return "bjqjbiosid"; | |||
} | |||
} | |||
public static string GetMachineName() | |||
{ | |||
try | |||
{ | |||
return System.Environment.MachineName; | |||
} | |||
catch (Exception e) | |||
{ | |||
return "unknowmachine"; | |||
} | |||
} | |||
} | |||
} |
@@ -0,0 +1,278 @@ | |||
#pragma warning disable 0618 | |||
using LumiSoft.Net.Mail; | |||
using LumiSoft.Net.MIME; | |||
using LumiSoft.Net.POP3.Client; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Configuration; | |||
using System.Net; | |||
using System.Net.Mail; | |||
using System.Text; | |||
using System.Threading; | |||
namespace DigitalSchoolApi.App_Data | |||
{ | |||
/// <summary> | |||
/// 邮件收发组件 | |||
/// </summary> | |||
public class MailHelper | |||
{ | |||
/// <summary> | |||
/// 邮件服务器地址 | |||
/// </summary> | |||
private static string MailServer = ConfigurationManager.AppSettings["MailHost"]; | |||
/// <summary> | |||
/// 用户名 | |||
/// </summary> | |||
private static string MailUserName = ConfigurationManager.AppSettings["MailUserName"]; | |||
/// <summary> | |||
/// 密码 | |||
/// </summary> | |||
private static string MailPassword = ConfigurationManager.AppSettings["MailPassword"]; | |||
/// <summary> | |||
/// 名称 | |||
/// </summary> | |||
private static string MailName = ConfigurationManager.AppSettings["MailName"]; | |||
/// <summary> | |||
/// 同步发送邮件 | |||
/// </summary> | |||
/// <param name="to">收件人邮箱地址</param> | |||
/// <param name="subject">主题</param> | |||
/// <param name="body">内容</param> | |||
/// <param name="encoding">编码</param> | |||
/// <param name="isBodyHtml">是否Html</param> | |||
/// <param name="enableSsl">是否SSL加密连接</param> | |||
/// <returns>是否成功</returns> | |||
public static bool Send(string to, string subject, string body, string encoding = "UTF-8", bool isBodyHtml = true, bool enableSsl = false) | |||
{ | |||
try | |||
{ | |||
MailMessage message = new MailMessage(); | |||
// 接收人邮箱地址 | |||
message.To.Add(new MailAddress(to)); | |||
message.From = new MailAddress(MailUserName, MailName); | |||
message.BodyEncoding = Encoding.GetEncoding(encoding); | |||
message.Body = body; | |||
//GB2312 | |||
message.SubjectEncoding = Encoding.GetEncoding(encoding); | |||
message.Subject = subject; | |||
message.IsBodyHtml = isBodyHtml; | |||
SmtpClient smtpclient = new SmtpClient(MailServer, 25); | |||
smtpclient.Credentials = new System.Net.NetworkCredential(MailUserName, MailPassword); | |||
//SSL连接 | |||
smtpclient.EnableSsl = enableSsl; | |||
smtpclient.Send(message); | |||
return true; | |||
} | |||
catch (Exception ex) | |||
{ | |||
Console.WriteLine(ex.ToString()); | |||
return false; | |||
} | |||
} | |||
/// <summary> | |||
/// 异步发送邮件 独立线程 | |||
/// </summary> | |||
/// <param name="to">邮件接收人</param> | |||
/// <param name="title">邮件标题</param> | |||
/// <param name="body">邮件内容</param> | |||
/// <param name="port">端口号</param> | |||
/// <returns></returns> | |||
public static void SendByThread(string to, string title, string body, int port = 25) | |||
{ | |||
new Thread(new ThreadStart(delegate () | |||
{ | |||
try | |||
{ | |||
SmtpClient smtp = new SmtpClient(); | |||
//邮箱的smtp地址 | |||
smtp.Host = MailServer; | |||
//端口号 | |||
smtp.Port = port; | |||
//构建发件人的身份凭据类 | |||
smtp.Credentials = new NetworkCredential(MailUserName, MailPassword); | |||
//构建消息类 | |||
MailMessage objMailMessage = new MailMessage(); | |||
//设置优先级 | |||
objMailMessage.Priority = MailPriority.High; | |||
//消息发送人 | |||
objMailMessage.From = new MailAddress(MailUserName, "提醒", System.Text.Encoding.UTF8); | |||
//收件人 | |||
objMailMessage.To.Add(to); | |||
//标题 | |||
objMailMessage.Subject = title.Trim(); | |||
//标题字符编码 | |||
objMailMessage.SubjectEncoding = System.Text.Encoding.UTF8; | |||
//正文 | |||
objMailMessage.Body = body.Trim(); | |||
objMailMessage.IsBodyHtml = true; | |||
//内容字符编码 | |||
objMailMessage.BodyEncoding = System.Text.Encoding.UTF8; | |||
//发送 | |||
smtp.Send(objMailMessage); | |||
} | |||
catch (Exception ex) | |||
{ | |||
Console.WriteLine(ex.ToString()); | |||
} | |||
})).Start(); | |||
} | |||
/// <summary> | |||
/// 发送 | |||
/// </summary> | |||
/// <param name="account">配置</param> | |||
/// <param name="mailModel">信息</param> | |||
public static void Send(MailAccount account, MailModel mailModel) | |||
{ | |||
try | |||
{ | |||
MailMessage mailMessage = new MailMessage(); | |||
mailMessage.From = new MailAddress(account.Account, account.AccountName); | |||
//发件人 | |||
if (!string.IsNullOrEmpty(mailModel.To)) | |||
{ | |||
var ToArray = mailModel.To.Split(','); | |||
foreach (var item in ToArray) | |||
{ | |||
mailMessage.To.Add(new MailAddress(item)); | |||
} | |||
} | |||
//抄送人 | |||
if (!string.IsNullOrEmpty(mailModel.CC)) | |||
{ | |||
var CCArray = mailModel.CC.Split(','); | |||
foreach (var item in CCArray) | |||
{ | |||
mailMessage.CC.Add(new MailAddress(item)); | |||
} | |||
} | |||
//密送人 | |||
if (!string.IsNullOrEmpty(mailModel.Bcc)) | |||
{ | |||
var BccArray = mailModel.Bcc.Split(','); | |||
foreach (var item in BccArray) | |||
{ | |||
mailMessage.Bcc.Add(new MailAddress(item)); | |||
} | |||
} | |||
//附件 | |||
//var filePath = DirFileHelper.GetAbsolutePath("~/Resource/EmailFile/"); | |||
//foreach (MailFile item in mailModel.Attachment) | |||
//{ | |||
// var attachment = new Attachment(filePath + item.FileId); | |||
// attachment.Name = item.FileName; | |||
// mailMessage.Attachments.Add(attachment); | |||
//} | |||
mailMessage.Subject = mailModel.Subject; | |||
mailMessage.Body = mailModel.BodyText; | |||
mailMessage.IsBodyHtml = true; | |||
mailMessage.Priority = MailPriority.Normal; | |||
mailMessage.SubjectEncoding = Encoding.UTF8; | |||
mailMessage.BodyEncoding = Encoding.UTF8; | |||
//不被当作垃圾邮件的关键代码--Begin | |||
mailMessage.Headers.Add("X-Priority", "3"); | |||
mailMessage.Headers.Add("X-MSMail-Priority", "Normal"); | |||
mailMessage.Headers.Add("X-Mailer", "Microsoft Outlook Express 6.00.2900.2869"); | |||
mailMessage.Headers.Add("X-MimeOLE", "Produced By Microsoft MimeOLE V6.00.2900.2869"); | |||
mailMessage.Headers.Add("ReturnReceipt", "1"); | |||
//不被当作垃圾邮件的关键代码--End | |||
using (SmtpClient smtpClient = new SmtpClient(account.SMTPHost, account.SMTPPort)) | |||
{ | |||
smtpClient.UseDefaultCredentials = false; | |||
smtpClient.Credentials = new NetworkCredential(account.Account, account.Password); | |||
smtpClient.DeliveryMethod = SmtpDeliveryMethod.Network; | |||
smtpClient.Send(mailMessage); | |||
} | |||
} | |||
catch (Exception ex) | |||
{ | |||
throw ex; | |||
} | |||
} | |||
/// <summary> | |||
/// 删除 | |||
/// </summary> | |||
/// <param name="account">配置</param> | |||
/// <param name="UID">UID</param> | |||
public static void Delete(MailAccount account, string UID) | |||
{ | |||
try | |||
{ | |||
using (POP3_Client pop3Client = new POP3_Client()) | |||
{ | |||
pop3Client.Connect(account.POP3Host, account.POP3Port, false); | |||
pop3Client.Login(account.Account, account.Password); | |||
if (pop3Client.Messages.Count > 0) | |||
{ | |||
foreach (POP3_ClientMessage messages in pop3Client.Messages) | |||
{ | |||
if (messages.UID == UID) | |||
{ | |||
messages.MarkForDeletion(); | |||
} | |||
} | |||
} | |||
} | |||
} | |||
catch (Exception ex) | |||
{ | |||
throw ex; | |||
} | |||
} | |||
/// <summary> | |||
/// 同步发送邮件 | |||
/// </summary> | |||
/// <param name="fromUserName">发件人邮箱地址:用户名</param> | |||
/// <param name="fromPassword">发件人邮箱地址:密码</param> | |||
/// <param name="fromName">发件人邮箱地址:名称</param> | |||
/// <param name="smtpServer">SMTP服务器</param> | |||
/// <param name="smtpPort">SMTP服务器端口</param> | |||
/// <param name="to">收件人邮箱地址</param> | |||
/// <param name="subject">主题</param> | |||
/// <param name="body">内容</param> | |||
/// <param name="encoding">编码</param> | |||
/// <param name="isBodyHtml">是否Html</param> | |||
/// <param name="enableSsl">是否SSL加密连接</param> | |||
/// <returns>是否成功</returns> | |||
public static bool Send2(string fromUserName, string fromPassword, string fromName, string smtpServer, int smtpPort, string to, string subject, string body, string encoding = "UTF-8", bool isBodyHtml = true, bool enableSsl = false) | |||
{ | |||
try | |||
{ | |||
MailMessage message = new MailMessage(); | |||
// 接收人邮箱地址 | |||
message.To.Add(new MailAddress(to)); | |||
message.From = new MailAddress(fromUserName, fromName); | |||
message.BodyEncoding = Encoding.GetEncoding(encoding); | |||
message.Body = body; | |||
//message.Body = @"尊敬的用户:<br/> | |||
// 您好。通知公告未完成5个。<br/> | |||
// 谢谢。<br/>"; | |||
//GB2312 | |||
message.SubjectEncoding = Encoding.GetEncoding(encoding); | |||
message.Subject = subject; | |||
//message.Subject = "提醒"; | |||
//message.IsBodyHtml = false; | |||
message.IsBodyHtml = isBodyHtml; | |||
SmtpClient smtpclient = new SmtpClient(smtpServer, smtpPort); | |||
smtpclient.Credentials = new System.Net.NetworkCredential(fromUserName, fromPassword); | |||
//SSL连接 | |||
smtpclient.EnableSsl = enableSsl; | |||
smtpclient.Send(message); | |||
return true; | |||
} | |||
catch (Exception ex) | |||
{ | |||
Console.WriteLine(ex.ToString()); | |||
return false; | |||
} | |||
} | |||
} | |||
} |
@@ -0,0 +1,40 @@ | |||
using System; | |||
namespace DigitalSchoolApi.App_Data | |||
{ | |||
public class MailAccount | |||
{ | |||
/// <summary> | |||
/// POP3服务 | |||
/// </summary> | |||
public string POP3Host { get; set; } | |||
/// <summary> | |||
/// POP3端口 | |||
/// </summary> | |||
public int POP3Port { get; set; } | |||
/// <summary> | |||
/// SMTP服务 | |||
/// </summary> | |||
public string SMTPHost { get; set; } | |||
/// <summary> | |||
/// SMTP端口 | |||
/// </summary> | |||
public int SMTPPort { get; set; } | |||
/// <summary> | |||
/// 账户 | |||
/// </summary> | |||
public string Account { get; set; } | |||
/// <summary> | |||
/// 账户名称 | |||
/// </summary> | |||
public string AccountName { get; set; } | |||
/// <summary> | |||
/// 密码 | |||
/// </summary> | |||
public string Password { get; set; } | |||
/// <summary> | |||
/// SSL | |||
/// </summary> | |||
public bool Ssl { get; set; } | |||
} | |||
} |
@@ -0,0 +1,13 @@ | |||
using System; | |||
namespace DigitalSchoolApi.App_Data | |||
{ | |||
public class MailFile | |||
{ | |||
public string FileId { get; set; } | |||
public string FileName { get; set; } | |||
public string FileSize { get; set; } | |||
public DateTime FileTime { get; set; } | |||
public string FileState { get; set; } | |||
} | |||
} |
@@ -0,0 +1,20 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
namespace DigitalSchoolApi.App_Data | |||
{ | |||
public class MailModel | |||
{ | |||
public string UID { get; set; } | |||
public string To { get; set; } | |||
public string ToName { get; set; } | |||
public string CC { get; set; } | |||
public string CCName { get; set; } | |||
public string Bcc { get; set; } | |||
public string BccName { get; set; } | |||
public string Subject { get; set; } | |||
public string BodyText { get; set; } | |||
public List<MailFile> Attachment { get; set; } | |||
public DateTime Date { get; set; } | |||
} | |||
} |
@@ -0,0 +1,106 @@ | |||
using System; | |||
using System.Security.Cryptography; | |||
using System.Text; | |||
namespace DigitalSchoolApi.App_Data | |||
{ | |||
/// <summary> | |||
/// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园 | |||
/// Copyright (c) 2013-2018 北京泉江科技有限公司 | |||
/// 创建人:陈彬彬 | |||
/// 日 期:2017.03.04 | |||
/// 描 述:加密、解密帮助类 | |||
/// </summary> | |||
public class DESEncrypt | |||
{ | |||
private static string key = "Learun###***"; | |||
#region ========加密======== | |||
/// <summary> | |||
/// 加密 | |||
/// </summary> | |||
/// <param name="Text">需要加密的内容</param> | |||
/// <returns></returns> | |||
public static string Encrypt(string Text) | |||
{ | |||
return Encrypt(Text, key); | |||
} | |||
/// <summary> | |||
/// 加密数据 | |||
/// </summary> | |||
/// <param name="Text">需要加密的内容</param> | |||
/// <param name="sKey">秘钥</param> | |||
/// <returns></returns> | |||
public static string Encrypt(string Text, string sKey) | |||
{ | |||
DESCryptoServiceProvider des = new DESCryptoServiceProvider(); | |||
byte[] inputByteArray; | |||
inputByteArray = Encoding.Default.GetBytes(Text); | |||
des.Key = ASCIIEncoding.ASCII.GetBytes(Md5Helper.Hash(sKey).ToUpper().Substring(0, 8)); | |||
des.IV = ASCIIEncoding.ASCII.GetBytes(Md5Helper.Hash(sKey).ToUpper().Substring(0, 8)); | |||
System.IO.MemoryStream ms = new System.IO.MemoryStream(); | |||
CryptoStream cs = new CryptoStream(ms, des.CreateEncryptor(), CryptoStreamMode.Write); | |||
cs.Write(inputByteArray, 0, inputByteArray.Length); | |||
cs.FlushFinalBlock(); | |||
StringBuilder ret = new StringBuilder(); | |||
foreach (byte b in ms.ToArray()) | |||
{ | |||
ret.AppendFormat("{0:X2}", b); | |||
} | |||
return ret.ToString(); | |||
} | |||
#endregion | |||
#region ========解密======== | |||
/// <summary> | |||
/// 解密 | |||
/// </summary> | |||
/// <param name="Text">需要解密的内容</param> | |||
/// <returns></returns> | |||
public static string Decrypt(string Text) | |||
{ | |||
if (!string.IsNullOrEmpty(Text)) | |||
{ | |||
return Decrypt(Text, key); | |||
} | |||
else | |||
{ | |||
return ""; | |||
} | |||
} | |||
/// <summary> | |||
/// 解密数据 | |||
/// </summary> | |||
/// <param name="Text">需要解密的内容</param> | |||
/// <param name="sKey">秘钥</param> | |||
/// <returns></returns> | |||
public static string Decrypt(string Text, string sKey) | |||
{ | |||
DESCryptoServiceProvider des = new DESCryptoServiceProvider(); | |||
int len; | |||
len = Text.Length / 2; | |||
byte[] inputByteArray = new byte[len]; | |||
int x, i; | |||
for (x = 0; x < len; x++) | |||
{ | |||
i = Convert.ToInt32(Text.Substring(x * 2, 2), 16); | |||
inputByteArray[x] = (byte)i; | |||
} | |||
des.Key = ASCIIEncoding.ASCII.GetBytes(Md5Helper.Hash(sKey).ToUpper().Substring(0, 8)); | |||
des.IV = ASCIIEncoding.ASCII.GetBytes(Md5Helper.Hash(sKey).ToUpper().Substring(0, 8)); | |||
System.IO.MemoryStream ms = new System.IO.MemoryStream(); | |||
CryptoStream cs = new CryptoStream(ms, des.CreateDecryptor(), CryptoStreamMode.Write); | |||
cs.Write(inputByteArray, 0, inputByteArray.Length); | |||
cs.FlushFinalBlock(); | |||
return Encoding.Default.GetString(ms.ToArray()); | |||
} | |||
public static string Decrypt(string uPPass, object p, object sSOPublicSecret) | |||
{ | |||
throw new NotImplementedException(); | |||
} | |||
#endregion | |||
} | |||
} |
@@ -0,0 +1,54 @@ | |||
using System.Security.Cryptography; | |||
using System.Text; | |||
namespace DigitalSchoolApi.App_Data | |||
{ | |||
/// <summary> | |||
/// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园 | |||
/// Copyright (c) 2013-2018 北京泉江科技有限公司 | |||
/// 创建人:陈彬彬 | |||
/// 日 期:2017.03.04 | |||
/// 描 述:数据访问(SqlServer) 上下文 | |||
/// </summary> | |||
public class Md5Helper | |||
{ | |||
#region "MD5加密" | |||
/// <summary> | |||
/// MD5加密 | |||
/// </summary> | |||
/// <param name="str">加密字符</param> | |||
/// <param name="code">加密位数16/32</param> | |||
/// <returns></returns> | |||
public static string Encrypt(string str, int code) | |||
{ | |||
string strEncrypt = string.Empty; | |||
if (code == 16) | |||
{ | |||
strEncrypt = Hash(str).Substring(8, 16); | |||
} | |||
if (code == 32) | |||
{ | |||
strEncrypt = Hash(str); | |||
} | |||
return strEncrypt; | |||
} | |||
/// <summary> | |||
/// 32位MD5加密(小写) | |||
/// </summary> | |||
/// <param name="input">输入字段</param> | |||
/// <returns></returns> | |||
public static string Hash(string input) | |||
{ | |||
MD5CryptoServiceProvider md5Hasher = new MD5CryptoServiceProvider(); | |||
byte[] data = md5Hasher.ComputeHash(Encoding.Default.GetBytes(input)); | |||
StringBuilder sBuilder = new StringBuilder(); | |||
for (int i = 0; i < data.Length; i++) | |||
{ | |||
sBuilder.Append(data[i].ToString("x2")); | |||
} | |||
return sBuilder.ToString(); | |||
} | |||
#endregion | |||
} | |||
} |
@@ -0,0 +1,375 @@ | |||
using Microsoft.VisualBasic; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Text.RegularExpressions; | |||
using System.Web; | |||
using System.Web.WebPages; | |||
namespace Learun.Util | |||
{ | |||
/// <summary> | |||
/// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园 | |||
/// Copyright (c) 2013-2018 北京泉江科技有限公司 | |||
/// 创建人:陈彬彬 | |||
/// 日 期:2017.03.04 | |||
/// 描 述:字符串工具方法 | |||
/// </summary> | |||
public sealed partial class Str | |||
{ | |||
#region Empty(空字符串) | |||
/// <summary> | |||
/// 空字符串 | |||
/// </summary> | |||
public static string Empty | |||
{ | |||
get { return string.Empty; } | |||
} | |||
#endregion | |||
/// <summary> | |||
/// 对html字符串进行编码 | |||
/// </summary> | |||
/// <param name="html">html字符串</param> | |||
public static string HtmlEncode(string html) | |||
{ | |||
return HttpUtility.HtmlEncode(html); | |||
} | |||
/// <summary> | |||
/// 格式化文本(防止SQL注入) | |||
/// </summary> | |||
/// <param name="html">html页面数据</param> | |||
/// <returns></returns> | |||
public static string Formatstr(string html) | |||
{ | |||
System.Text.RegularExpressions.Regex regex1 = new System.Text.RegularExpressions.Regex(@"<script[\s\S]+</script *>", System.Text.RegularExpressions.RegexOptions.IgnoreCase); | |||
System.Text.RegularExpressions.Regex regex2 = new System.Text.RegularExpressions.Regex(@" href *= *[\s\S]*script *:", System.Text.RegularExpressions.RegexOptions.IgnoreCase); | |||
System.Text.RegularExpressions.Regex regex3 = new System.Text.RegularExpressions.Regex(@" on[\s\S]*=", System.Text.RegularExpressions.RegexOptions.IgnoreCase); | |||
System.Text.RegularExpressions.Regex regex4 = new System.Text.RegularExpressions.Regex(@"<iframe[\s\S]+</iframe *>", System.Text.RegularExpressions.RegexOptions.IgnoreCase); | |||
System.Text.RegularExpressions.Regex regex5 = new System.Text.RegularExpressions.Regex(@"<frameset[\s\S]+</frameset *>", System.Text.RegularExpressions.RegexOptions.IgnoreCase); | |||
System.Text.RegularExpressions.Regex regex10 = new System.Text.RegularExpressions.Regex(@"select", System.Text.RegularExpressions.RegexOptions.IgnoreCase); | |||
System.Text.RegularExpressions.Regex regex11 = new System.Text.RegularExpressions.Regex(@"update", System.Text.RegularExpressions.RegexOptions.IgnoreCase); | |||
System.Text.RegularExpressions.Regex regex12 = new System.Text.RegularExpressions.Regex(@"delete", System.Text.RegularExpressions.RegexOptions.IgnoreCase); | |||
html = regex1.Replace(html, ""); //过滤<script></script>标记 | |||
html = regex2.Replace(html, ""); //过滤href=javascript: (<A>) 属性 | |||
html = regex3.Replace(html, " _disibledevent="); //过滤其它控件的on...事件 | |||
html = regex4.Replace(html, ""); //过滤iframe | |||
html = regex10.Replace(html, "s_elect"); | |||
html = regex11.Replace(html, "u_pudate"); | |||
html = regex12.Replace(html, "d_elete"); | |||
html = html.Replace("'", "’"); | |||
html = html.Replace(" ", " "); | |||
return html; | |||
} | |||
#region 获取全拼 | |||
/// <summary> | |||
/// 把汉字转换成拼音(全拼) | |||
/// </summary> | |||
/// <param name="hzString">汉字字符串</param> | |||
/// <returns>转换后的拼音(全拼)字符串</returns> | |||
public static string ConvertPinYin(string text) | |||
{ | |||
// 匹配中文字符 | |||
Regex regex = new Regex("^[\u4e00-\u9fa5]$"); | |||
byte[] array = new byte[2]; | |||
string pyString = ""; | |||
int chrAsc = 0; | |||
int i1 = 0; | |||
int i2 = 0; | |||
char[] noWChar = text.ToCharArray(); | |||
for (int j = 0; j < noWChar.Length; j++) | |||
{ | |||
// 中文字符 | |||
if (regex.IsMatch(noWChar[j].ToString())) | |||
{ | |||
array = System.Text.Encoding.Default.GetBytes(noWChar[j].ToString()); | |||
i1 = (short)(array[0]); | |||
i2 = (short)(array[1]); | |||
chrAsc = i1 * 256 + i2 - 65536; | |||
if (chrAsc > 0 && chrAsc < 160) | |||
{ | |||
pyString += noWChar[j]; | |||
} | |||
else | |||
{ | |||
// 修正部分文字 | |||
if (chrAsc == -9254) // 修正“圳”字 | |||
pyString += "Zhen"; | |||
else | |||
{ | |||
for (int i = (ChinesePinYinValue.Length - 1); i >= 0; i--) | |||
{ | |||
if (ChinesePinYinValue[i] <= chrAsc) | |||
{ | |||
pyString += ChinesePinYinName[i]; | |||
break; | |||
} | |||
} | |||
} | |||
} | |||
} | |||
// 非中文字符 | |||
else | |||
{ | |||
pyString += noWChar[j].ToString(); | |||
} | |||
} | |||
return pyString; | |||
} | |||
/// <summary> | |||
/// 拼音码 | |||
/// </summary> | |||
private static int[] ChinesePinYinValue = new int[] | |||
{ | |||
-20319,-20317,-20304,-20295,-20292,-20283,-20265,-20257,-20242,-20230,-20051,-20036, | |||
-20032,-20026,-20002,-19990,-19986,-19982,-19976,-19805,-19784,-19775,-19774,-19763, | |||
-19756,-19751,-19746,-19741,-19739,-19728,-19725,-19715,-19540,-19531,-19525,-19515, | |||
-19500,-19484,-19479,-19467,-19289,-19288,-19281,-19275,-19270,-19263,-19261,-19249, | |||
-19243,-19242,-19238,-19235,-19227,-19224,-19218,-19212,-19038,-19023,-19018,-19006, | |||
-19003,-18996,-18977,-18961,-18952,-18783,-18774,-18773,-18763,-18756,-18741,-18735, | |||
-18731,-18722,-18710,-18697,-18696,-18526,-18518,-18501,-18490,-18478,-18463,-18448, | |||
-18447,-18446,-18239,-18237,-18231,-18220,-18211,-18201,-18184,-18183, -18181,-18012, | |||
-17997,-17988,-17970,-17964,-17961,-17950,-17947,-17931,-17928,-17922,-17759,-17752, | |||
-17733,-17730,-17721,-17703,-17701,-17697,-17692,-17683,-17676,-17496,-17487,-17482, | |||
-17468,-17454,-17433,-17427,-17417,-17202,-17185,-16983,-16970,-16942,-16915,-16733, | |||
-16708,-16706,-16689,-16664,-16657,-16647,-16474,-16470,-16465,-16459,-16452,-16448, | |||
-16433,-16429,-16427,-16423,-16419,-16412,-16407,-16403,-16401,-16393,-16220,-16216, | |||
-16212,-16205,-16202,-16187,-16180,-16171,-16169,-16158,-16155,-15959,-15958,-15944, | |||
-15933,-15920,-15915,-15903,-15889,-15878,-15707,-15701,-15681,-15667,-15661,-15659, | |||
-15652,-15640,-15631,-15625,-15454,-15448,-15436,-15435,-15419,-15416,-15408,-15394, | |||
-15385,-15377,-15375,-15369,-15363,-15362,-15183,-15180,-15165,-15158,-15153,-15150, | |||
-15149,-15144,-15143,-15141,-15140,-15139,-15128,-15121,-15119,-15117,-15110,-15109, | |||
-14941,-14937,-14933,-14930,-14929,-14928,-14926,-14922,-14921,-14914,-14908,-14902, | |||
-14894,-14889,-14882,-14873,-14871,-14857,-14678,-14674,-14670,-14668,-14663,-14654, | |||
-14645,-14630,-14594,-14429,-14407,-14399,-14384,-14379,-14368,-14355,-14353,-14345, | |||
-14170,-14159,-14151,-14149,-14145,-14140,-14137,-14135,-14125,-14123,-14122,-14112, | |||
-14109,-14099,-14097,-14094,-14092,-14090,-14087,-14083,-13917,-13914,-13910,-13907, | |||
-13906,-13905,-13896,-13894,-13878,-13870,-13859,-13847,-13831,-13658,-13611,-13601, | |||
-13406,-13404,-13400,-13398,-13395,-13391,-13387,-13383,-13367,-13359,-13356,-13343, | |||
-13340,-13329,-13326,-13318,-13147,-13138,-13120,-13107,-13096,-13095,-13091,-13076, | |||
-13068,-13063,-13060,-12888,-12875,-12871,-12860,-12858,-12852,-12849,-12838,-12831, | |||
-12829,-12812,-12802,-12607,-12597,-12594,-12585,-12556,-12359,-12346,-12320,-12300, | |||
-12120,-12099,-12089,-12074,-12067,-12058,-12039,-11867,-11861,-11847,-11831,-11798, | |||
-11781,-11604,-11589,-11536,-11358,-11340,-11339,-11324,-11303,-11097,-11077,-11067, | |||
-11055,-11052,-11045,-11041,-11038,-11024,-11020,-11019,-11018,-11014,-10838,-10832, | |||
-10815,-10800,-10790,-10780,-10764,-10587,-10544,-10533,-10519,-10331,-10329,-10328, | |||
-10322,-10315,-10309,-10307,-10296,-10281,-10274,-10270,-10262,-10260,-10256,-10254 | |||
}; | |||
/// <summary> | |||
/// 拼音码 | |||
/// </summary> | |||
private static string[] ChinesePinYinName = new string[] | |||
{ | |||
"A","Ai","An","Ang","Ao","Ba","Bai","Ban","Bang","Bao","Bei","Ben", | |||
"Beng","Bi","Bian","Biao","Bie","Bin","Bing","Bo","Bu","Ba","Cai","Can", | |||
"Cang","Cao","Ce","Ceng","Cha","Chai","Chan","Chang","Chao","Che","Chen","Cheng", | |||
"Chi","Chong","Chou","Chu","Chuai","Chuan","Chuang","Chui","Chun","Chuo","Ci","Cong", | |||
"Cou","Cu","Cuan","Cui","Cun","Cuo","Da","Dai","Dan","Dang","Dao","De", | |||
"Deng","Di","Dian","Diao","Die","Ding","Diu","Dong","Dou","Du","Duan","Dui", | |||
"Dun","Duo","E","En","Er","Fa","Fan","Fang","Fei","Fen","Feng","Fo", | |||
"Fou","Fu","Ga","Gai","Gan","Gang","Gao","Ge","Gei","Gen","Geng","Gong", | |||
"Gou","Gu","Gua","Guai","Guan","Guang","Gui","Gun","Guo","Ha","Hai","Han", | |||
"Hang","Hao","He","Hei","Hen","Heng","Hong","Hou","Hu","Hua","Huai","Huan", | |||
"Huang","Hui","Hun","Huo","Ji","Jia","Jian","Jiang","Jiao","Jie","Jin","Jing", | |||
"Jiong","Jiu","Ju","Juan","Jue","Jun","Ka","Kai","Kan","Kang","Kao","Ke", | |||
"Ken","Keng","Kong","Kou","Ku","Kua","Kuai","Kuan","Kuang","Kui","Kun","Kuo", | |||
"La","Lai","Lan","Lang","Lao","Le","Lei","Leng","Li","Lia","Lian","Liang", | |||
"Liao","Lie","Lin","Ling","Liu","Long","Lou","Lu","Lv","Luan","Lue","Lun", | |||
"Luo","Ma","Mai","Man","Mang","Mao","Me","Mei","Men","Meng","Mi","Mian", | |||
"Miao","Mie","Min","Ming","Miu","Mo","Mou","Mu","Na","Nai","Nan","Nang", | |||
"Nao","Ne","Nei","Nen","Neng","Ni","Nian","Niang","Niao","Nie","Nin","Ning", | |||
"Niu","Nong","Nu","Nv","Nuan","Nue","Nuo","O","Ou","Pa","Pai","Pan", | |||
"Pang","Pao","Pei","Pen","Peng","Pi","Pian","Piao","Pie","Pin","Ping","Po", | |||
"Pu","Qi","Qia","Qian","Qiang","Qiao","Qie","Qin","Qing","Qiong","Qiu","Qu", | |||
"Quan","Que","Qun","Ran","Rang","Rao","Re","Ren","Reng","Ri","Rong","Rou", | |||
"Ru","Ruan","Rui","Run","Ruo","Sa","Sai","San","Sang","Sao","Se","Sen", | |||
"Seng","Sha","Shai","Shan","Shang","Shao","She","Shen","Sheng","Shi","Shou","Shu", | |||
"Shua","Shuai","Shuan","Shuang","Shui","Shun","Shuo","Si","Song","Sou","Su","Suan", | |||
"Sui","Sun","Suo","Ta","Tai","Tan","Tang","Tao","Te","Teng","Ti","Tian", | |||
"Tiao","Tie","Ting","Tong","Tou","Tu","Tuan","Tui","Tun","Tuo","Wa","Wai", | |||
"Wan","Wang","Wei","Wen","Weng","Wo","Wu","Xi","Xia","Xian","Xiang","Xiao", | |||
"Xie","Xin","Xing","Xiong","Xiu","Xu","Xuan","Xue","Xun","Ya","Yan","Yang", | |||
"Yao","Ye","Yi","Yin","Ying","Yo","Yong","You","Yu","Yuan","Yue","Yun", | |||
"Za", "Zai","Zan","Zang","Zao","Ze","Zei","Zen","Zeng","Zha","Zhai","Zhan", | |||
"Zhang","Zhao","Zhe","Zhen","Zheng","Zhi","Zhong","Zhou","Zhu","Zhua","Zhuai","Zhuan", | |||
"Zhuang","Zhui","Zhun","Zhuo","Zi","Zong","Zou","Zu","Zuan","Zui","Zun","Zuo" | |||
}; | |||
#endregion | |||
#region Splice(拼接集合元素) | |||
/// <summary> | |||
/// 拼接集合元素 | |||
/// </summary> | |||
/// <typeparam name="T">集合元素类型</typeparam> | |||
/// <param name="list">集合</param> | |||
/// <param name="quotes">引号,默认不带引号,范例:单引号 "'"</param> | |||
/// <param name="separator">分隔符,默认使用逗号分隔</param> | |||
public static string Splice<T>(IEnumerable<T> list, string quotes = "", string separator = ",") | |||
{ | |||
if (list == null) | |||
return string.Empty; | |||
var result = new StringBuilder(); | |||
foreach (var each in list) | |||
result.AppendFormat("{0}{1}{0}{2}", quotes, each, separator); | |||
return result.ToString().TrimEnd(separator.ToCharArray()); | |||
} | |||
#endregion | |||
#region FirstUpper(将值的首字母大(小)写) | |||
/// <summary> | |||
/// 将值的首字母大写 | |||
/// </summary> | |||
/// <param name="value">值</param> | |||
public static string FirstUpper(string value) | |||
{ | |||
string firstChar = value.Substring(0, 1).ToUpper(); | |||
return firstChar + value.Substring(1, value.Length - 1); | |||
} | |||
/// <summary> | |||
/// 将值的首字母小写 | |||
/// </summary> | |||
/// <param name="value">值</param> | |||
/// <returns></returns> | |||
public static string FirstLower(string value) | |||
{ | |||
string firstChar = value.Substring(0, 1).ToLower(); | |||
return firstChar + value.Substring(1, value.Length - 1); | |||
} | |||
#endregion | |||
#region ToCamel(将字符串转成驼峰形式) | |||
/// <summary> | |||
/// 将字符串转成驼峰形式 | |||
/// </summary> | |||
/// <param name="value">原始字符串</param> | |||
public static string ToCamel(string value) | |||
{ | |||
return FirstUpper(value.ToLower()); | |||
} | |||
#endregion | |||
#region ContainsChinese(是否包含中文) | |||
/// <summary> | |||
/// 是否包含中文 | |||
/// </summary> | |||
/// <param name="text">文本</param> | |||
public static bool ContainsChinese(string text) | |||
{ | |||
const string pattern = "[\u4e00-\u9fa5]+"; | |||
return Regex.IsMatch(text, pattern); | |||
} | |||
#endregion | |||
#region ContainsNumber(是否包含数字) | |||
/// <summary> | |||
/// 是否包含数字 | |||
/// </summary> | |||
/// <param name="text">文本</param> | |||
public static bool ContainsNumber(string text) | |||
{ | |||
const string pattern = "[0-9]+"; | |||
return Regex.IsMatch(text, pattern); | |||
} | |||
#endregion | |||
#region Distinct(去除重复) | |||
/// <summary> | |||
/// 去除重复 | |||
/// </summary> | |||
/// <param name="value">值,范例1:"5555",返回"5",范例2:"4545",返回"45"</param> | |||
public static string Distinct(string value) | |||
{ | |||
var array = value.ToCharArray(); | |||
return new string(array.Distinct().ToArray()); | |||
} | |||
#endregion | |||
#region Truncate(截断字符串) | |||
/// <summary> | |||
/// 截断字符串 | |||
/// </summary> | |||
/// <param name="text">文本</param> | |||
/// <param name="length">返回长度</param> | |||
/// <param name="endCharCount">添加结束符号的个数,默认0,不添加</param> | |||
/// <param name="endChar">结束符号,默认为省略号</param> | |||
public static string Truncate(string text, int length, int endCharCount = 0, string endChar = ".") | |||
{ | |||
if (string.IsNullOrWhiteSpace(text)) | |||
return string.Empty; | |||
if (text.Length < length) | |||
return text; | |||
return text.Substring(0, length) + GetEndString(endCharCount, endChar); | |||
} | |||
/// <summary> | |||
/// 获取结束字符串 | |||
/// </summary> | |||
private static string GetEndString(int endCharCount, string endChar) | |||
{ | |||
StringBuilder result = new StringBuilder(); | |||
for (int i = 0; i < endCharCount; i++) | |||
result.Append(endChar); | |||
return result.ToString(); | |||
} | |||
#endregion | |||
#region Unique(获取全局唯一值) | |||
/// <summary> | |||
/// 获取全局唯一值 | |||
/// </summary> | |||
public static string Unique() | |||
{ | |||
return Guid.NewGuid().ToString().Replace("-", ""); | |||
} | |||
#endregion | |||
#region GetLastProperty(获取最后一个属性) | |||
/// <summary> | |||
/// 获取最后一个属性 | |||
/// </summary> | |||
/// <param name="propertyName">属性名,范例,A.B.C,返回"C"</param> | |||
public static string GetLastProperty(string propertyName) | |||
{ | |||
if (propertyName.IsEmpty()) | |||
return string.Empty; | |||
var lastIndex = propertyName.LastIndexOf(".", StringComparison.Ordinal) + 1; | |||
return propertyName.Substring(lastIndex); | |||
} | |||
#endregion | |||
public static string ReplaceHtml(string html) | |||
{ | |||
if (!string.IsNullOrEmpty(html)) | |||
{ | |||
string result = Regex.Replace(html, @"<[^>]*>", "").Replace(" ", ""); | |||
return result; | |||
} | |||
else | |||
{ | |||
return html; | |||
} | |||
} | |||
} | |||
} |
@@ -0,0 +1,56 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading; | |||
using System.Threading.Tasks; | |||
namespace DigitalSchoolApi.App_Data | |||
{ | |||
public class TimeOutCheckTool | |||
{ | |||
public T TimeoutCheck<T>(int ms, Func<T> func) | |||
{ | |||
var wait = new ManualResetEvent(false); | |||
bool RunOK = false; | |||
var task = Task.Run<T>(() => | |||
{ | |||
var result = func.Invoke(); | |||
RunOK = true; | |||
wait.Set(); | |||
return result; | |||
}); | |||
wait.WaitOne(ms); | |||
if (RunOK) | |||
{ | |||
return task.Result; | |||
} | |||
else | |||
{ | |||
return default(T); | |||
} | |||
} | |||
public bool TimeoutCheckTwo<Boolean>(int ms, Func<Boolean> func) | |||
{ | |||
var wait = new ManualResetEvent(false); | |||
bool RunOK = false; | |||
var task = Task.Run<Boolean>(() => | |||
{ | |||
var result = func.Invoke(); | |||
RunOK = true; | |||
wait.Set(); | |||
return result; | |||
}); | |||
wait.WaitOne(ms); | |||
if (RunOK) | |||
{ | |||
return Convert.ToBoolean(task.Result); | |||
} | |||
else | |||
{ | |||
return true; | |||
} | |||
} | |||
} | |||
} |
@@ -0,0 +1,30 @@ | |||
using System.Web; | |||
using System.Web.Optimization; | |||
namespace DigitalSchoolApi | |||
{ | |||
public class BundleConfig | |||
{ | |||
// For more information on bundling, visit https://go.microsoft.com/fwlink/?LinkId=301862 | |||
public static void RegisterBundles(BundleCollection bundles) | |||
{ | |||
bundles.Add(new ScriptBundle("~/bundles/jquery").Include( | |||
"~/Scripts/jquery-{version}.js")); | |||
bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include( | |||
"~/Scripts/jquery.validate*")); | |||
// Use the development version of Modernizr to develop with and learn from. Then, when you're | |||
// ready for production, use the build tool at https://modernizr.com to pick only the tests you need. | |||
bundles.Add(new ScriptBundle("~/bundles/modernizr").Include( | |||
"~/Scripts/modernizr-*")); | |||
bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include( | |||
"~/Scripts/bootstrap.js")); | |||
bundles.Add(new StyleBundle("~/Content/css").Include( | |||
"~/Content/bootstrap.css", | |||
"~/Content/site.css")); | |||
} | |||
} | |||
} |
@@ -0,0 +1,13 @@ | |||
using System.Web; | |||
using System.Web.Mvc; | |||
namespace DigitalSchoolApi | |||
{ | |||
public class FilterConfig | |||
{ | |||
public static void RegisterGlobalFilters(GlobalFilterCollection filters) | |||
{ | |||
filters.Add(new HandleErrorAttribute()); | |||
} | |||
} | |||
} |
@@ -0,0 +1,24 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Web; | |||
using System.Web.Mvc; | |||
using System.Web.Routing; | |||
namespace DigitalSchoolApi | |||
{ | |||
public class RouteConfig | |||
{ | |||
public static void RegisterRoutes(RouteCollection routes) | |||
{ | |||
routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); | |||
routes.MapRoute( | |||
name: "Default", | |||
url: "{controller}/{action}/{id}", | |||
defaults: new { action = "Index", id = UrlParameter.Optional } | |||
); | |||
} | |||
} | |||
} | |||
@@ -0,0 +1,31 @@ | |||
using System; | |||
using System.Threading.Tasks; | |||
using Hangfire; | |||
using Hangfire.Dashboard; | |||
using Microsoft.Owin; | |||
using Owin; | |||
[assembly: OwinStartup(typeof(DigitalSchoolApi.App_Start.Startup))] | |||
namespace DigitalSchoolApi.App_Start | |||
{ | |||
public class Startup | |||
{ | |||
public void Configuration(IAppBuilder app) | |||
{ | |||
app.UseHangfireDashboard("/hangfire", new DashboardOptions | |||
{ | |||
AppPath = "/", | |||
Authorization = new[] { new HangfireAuthorizationFilter() } | |||
}); | |||
} | |||
} | |||
public class HangfireAuthorizationFilter : IDashboardAuthorizationFilter | |||
{ | |||
public bool Authorize(DashboardContext context) | |||
{ | |||
return true; | |||
} | |||
} | |||
} |
@@ -0,0 +1,377 @@ | |||
using System; | |||
using System.Linq; | |||
using System.Web; | |||
using System.Web.Http; | |||
using System.Web.Http.Description; | |||
using System.Web.Http.Routing.Constraints; | |||
using System.Collections.Generic; | |||
using System.Diagnostics; | |||
using System.IO; | |||
using DigitalSchoolApi; | |||
using Swagger.Net.Application; | |||
using Swagger.Net; | |||
[assembly: PreApplicationStartMethod(typeof(SwaggerConfig), "Register")] | |||
namespace DigitalSchoolApi | |||
{ | |||
public class SwaggerConfig | |||
{ | |||
public static void Register() | |||
{ | |||
var thisAssembly = typeof(SwaggerConfig).Assembly; | |||
GlobalConfiguration.Configuration | |||
.EnableSwagger(c => | |||
{ | |||
// By default, the service root url is inferred from the request used to access the docs. | |||
// However, there may be situations (e.g. proxy and load-balanced environments) where this does not | |||
// resolve correctly. You can workaround this by providing your own code to determine the root URL. | |||
// | |||
//c.RootUrl(req => GetRootUrlFromAppConfig()); | |||
// If schemes are not explicitly provided in a Swagger 2.0 document, then the scheme used to access | |||
// the docs is taken as the default. If your API supports multiple schemes and you want to be explicit | |||
// about them, you can use the "Schemes" option as shown below. | |||
// | |||
//c.Schemes(new[] { "http", "https" }); | |||
// Use "SingleApiVersion" to describe a single version API. Swagger 2.0 includes an "Info" object to | |||
// hold additional metadata for an API. Version and title are required but you can also provide | |||
// additional fields by chaining methods off SingleApiVersion. | |||
// | |||
c.SingleApiVersion("v1", "DigitalSchoolApi") | |||
.Description("数字化校园API在线文档"); | |||
// Taking to long to load the swagger docs? Enable this option to start caching it | |||
// | |||
//c.AllowCachingSwaggerDoc(); | |||
// If you want the output Swagger docs to be indented properly, enable the "PrettyPrint" option. | |||
// | |||
c.PrettyPrint(); | |||
// If your API has multiple versions, use "MultipleApiVersions" instead of "SingleApiVersion". | |||
// In this case, you must provide a lambda that tells Swagger-Net which actions should be | |||
// included in the docs for a given API version. Like "SingleApiVersion", each call to "Version" | |||
// returns an "Info" builder so you can provide additional metadata per API version. | |||
// | |||
//c.MultipleApiVersions( | |||
// (apiDesc, targetApiVersion) => ResolveVersionSupportByRouteConstraint(apiDesc, targetApiVersion), | |||
// (vc) => | |||
// { | |||
// vc.Version("v2", "Swagger-Net Dummy API V2"); | |||
// vc.Version("v1", "Swagger-Net Dummy API V1"); | |||
// }); | |||
// You can use "BasicAuth", "ApiKey" or "OAuth2" options to describe security schemes for the API. | |||
// See https://github.com/swagger-api/swagger-spec/blob/master/versions/2.0.md for more details. | |||
// NOTE: These only define the schemes and need to be coupled with a corresponding "security" property | |||
// at the document or operation level to indicate which schemes are required for an operation. To do this, | |||
// you'll need to implement a custom IDocumentFilter and/or IOperationFilter to set these properties | |||
// according to your specific authorization implementation | |||
// | |||
//c.BasicAuth("basic").Description("Basic HTTP Authentication"); | |||
// | |||
//c.ApiKey("apiKey", "header", "API Key Authentication"); | |||
// | |||
//c.OAuth2("oauth2") | |||
// .Description("OAuth2 Implicit Grant") | |||
// .Flow("implicit") | |||
// .AuthorizationUrl("http://petstore.swagger.wordnik.com/api/oauth/dialog") | |||
// //.TokenUrl("https://tempuri.org/token") | |||
// .Scopes(scopes => | |||
// { | |||
// scopes.Add("read", "Read access to protected resources"); | |||
// scopes.Add("write", "Write access to protected resources"); | |||
// }); | |||
// Set this flag to omit descriptions for any actions decorated with the Obsolete attribute | |||
//c.IgnoreObsoleteActions(); | |||
// Comment this setting to disable Access-Control-Allow-Origin | |||
c.AccessControlAllowOrigin("*"); | |||
// Each operation be assigned one or more tags which are then used by consumers for various reasons. | |||
// For example, the swagger-ui groups operations according to the first tag of each operation. | |||
// By default, this will be controller name but you can use the "GroupActionsBy" option to | |||
// override with any value. | |||
// | |||
//c.GroupActionsBy(apiDesc => apiDesc.HttpMethod.ToString()); | |||
// You can also specify a custom sort order for groups (as defined by "GroupActionsBy") to dictate | |||
// the order in which operations are listed. For example, if the default grouping is in place | |||
// (controller name) and you specify a descending alphabetic sort order, then actions from a | |||
// ProductsController will be listed before those from a CustomersController. This is typically | |||
// used to customize the order of groupings in the swagger-ui. | |||
// | |||
//c.OrderActionGroupsBy(new DescendingAlphabeticComparer()); | |||
// If you annotate Controllers and API Types with Xml comments: | |||
// http://msdn.microsoft.com/en-us/library/b2s063f7(v=vs.110).aspx | |||
// those comments will be incorporated into the generated docs and UI. | |||
// Just make sure your comment file(s) have extension .XML | |||
// You can add individual files by providing the path to one or | |||
// more Xml comment files. | |||
// | |||
//c.IncludeXmlComments(AppDomain.CurrentDomain.BaseDirectory + "file.ext"); | |||
c.IncludeAllXmlComments(thisAssembly, AppDomain.CurrentDomain.BaseDirectory+"bin\\"); | |||
// Swagger-Net makes a best attempt at generating Swagger compliant JSON schemas for the various types | |||
// exposed in your API. However, there may be occasions when more control of the output is needed. | |||
// This is supported through the "MapType" and "SchemaFilter" options: | |||
// | |||
// Use the "MapType" option to override the Schema generation for a specific type. | |||
// It should be noted that the resulting Schema will be placed "inline" for any applicable Operations. | |||
// While Swagger 2.0 supports inline definitions for "all" Schema types, the swagger-ui tool does not. | |||
// It expects "complex" Schemas to be defined separately and referenced. For this reason, you should only | |||
// use the "MapType" option when the resulting Schema is a primitive or array type. If you need to alter a | |||
// complex Schema, use a Schema filter. | |||
// | |||
//c.MapType<ProductType>(() => new Schema { type = "integer", format = "int32" }); | |||
// If you want to post-modify "complex" Schemas once they've been generated, across the board or for a | |||
// specific type, you can wire up one or more Schema filters. | |||
// | |||
//c.SchemaFilter<ApplySchemaVendorExtensions>(); | |||
// In a Swagger 2.0 document, complex types are typically declared globally and referenced by unique | |||
// Schema Id. By default, Swagger-Net does NOT use the full type name in Schema Ids. In most cases, this | |||
// works well because it prevents the "implementation detail" of type namespaces from leaking into your | |||
// Swagger docs and UI. However, if you have multiple types in your API with the same class name, you'll | |||
// need to opt out of this behavior to avoid Schema Id conflicts. | |||
// | |||
//c.UseFullTypeNameInSchemaIds(); | |||
// Alternatively, you can provide your own custom strategy for inferring SchemaId's for | |||
// describing "complex" types in your API. | |||
// | |||
//c.SchemaId(t => t.FullName.Contains('`') ? t.FullName.Substring(0, t.FullName.IndexOf('`')) : t.FullName); | |||
// Set this flag to omit schema property descriptions for any type properties decorated with the | |||
// Obsolete attribute | |||
//c.IgnoreObsoleteProperties(); | |||
// Set this flag to ignore IsSpecified members when serializing and deserializing types. | |||
// | |||
c.IgnoreIsSpecifiedMembers(); | |||
// In accordance with the built in JsonSerializer, if disabled Swagger-Net will describe enums as integers. | |||
// You can change the serializer behavior by configuring the StringToEnumConverter globally or for a given | |||
// enum type. Swagger-Net will honor this change out-of-the-box. However, if you use a different | |||
// approach to serialize enums as strings, you can also force Swagger-Net to describe them as strings. | |||
// | |||
c.DescribeAllEnumsAsStrings(camelCase: false); | |||
// Similar to Schema filters, Swagger-Net also supports Operation and Document filters: | |||
// | |||
// Post-modify Operation descriptions once they've been generated by wiring up one or more | |||
// Operation filters. | |||
// | |||
//c.OperationFilter<AddDefaultResponse>(); | |||
// | |||
// If you've defined an OAuth2 flow as described above, you could use a custom filter | |||
// to inspect some attribute on each action and infer which (if any) OAuth2 scopes are required | |||
// to execute the operation | |||
// | |||
//c.OperationFilter<AssignOAuth2SecurityRequirements>(); | |||
// Post-modify the entire Swagger document by wiring up one or more Document filters. | |||
// This gives full control to modify the final SwaggerDocument. You should have a good understanding of | |||
// the Swagger 2.0 spec. - https://github.com/swagger-api/swagger-spec/blob/master/versions/2.0.md | |||
// before using this option. | |||
// | |||
//c.DocumentFilter<ApplyDocumentVendorExtensions>(); | |||
// In contrast to WebApi, Swagger 2.0 does not include the query string component when mapping a URL | |||
// to an action. As a result, Swagger-Net will raise an exception if it encounters multiple actions | |||
// with the same path (sans query string) and HTTP method. You can workaround this by providing a | |||
// custom strategy to pick a winner or merge the descriptions for the purposes of the Swagger docs | |||
// | |||
//c.ResolveConflictingActions(apiDescriptions => apiDescriptions.First()); | |||
// Wrap the default SwaggerGenerator with additional behavior (e.g. caching) or provide an | |||
// alternative implementation for ISwaggerProvider with the CustomProvider option. | |||
// | |||
//c.CustomProvider((defaultProvider) => new CachingSwaggerProvider(defaultProvider)); | |||
}) | |||
.EnableSwaggerUi(c => | |||
{ | |||
// Use the "DocumentTitle" option to change the Document title. | |||
// Very helpful when you have multiple Swagger pages open, to tell them apart. | |||
// | |||
c.DocumentTitle("数字化校园API在线文档"); | |||
// Use the "CssTheme" to add a theme to your UI. | |||
// Options are: | |||
// theme-feeling-blue-css | |||
// theme-flattop-css | |||
// theme-material-css | |||
// theme-monokai-css | |||
// theme-muted-css | |||
// theme-newspaper-css | |||
// theme-outline-css | |||
// | |||
//c.CssTheme("theme-material-css"); | |||
// Use the "InjectStylesheet" option to enrich the UI with one or more additional CSS stylesheets. | |||
// The file must be included in your project as an "Embedded Resource", and then the resource's | |||
// "Logical Name" is passed to the method as shown below. | |||
// | |||
c.InjectStylesheet(thisAssembly, "DigitalSchoolApi.Content.custom.css"); | |||
//c.InjectStylesheet(thisAssembly, "Swagger.Net.Dummy.SwaggerExtensions.testStyles1.css"); | |||
// Use the "InjectJavaScript" option to invoke one or more custom JavaScripts after the swagger-ui | |||
// has loaded. The file must be included in your project as an "Embedded Resource", and then the resource's | |||
// "Logical Name" is passed to the method as shown above. | |||
// | |||
//c.InjectJavaScript(thisAssembly, "Swagger.Net.Dummy.SwaggerExtensions.testScript1.js"); | |||
// The swagger-ui renders boolean data types as a dropdown. By default, it provides "true" and "false" | |||
// strings as the possible choices. You can use this option to change these to something else, | |||
// for example 0 and 1. | |||
// | |||
//c.BooleanValues(new[] { "0", "1" }); | |||
// Controls the display of vendor extension (x-) fields and values for Operations, Parameters, and Schema. | |||
// The default is true. | |||
// | |||
c.ShowExtensions(true); | |||
// Show pattern, minLength, maxLength, minimum, and maximum fields | |||
// | |||
//c.ShowCommonExtensions(true); | |||
// By default, swagger-ui will validate specs against swagger.io's online validator and display the result | |||
// in a badge at the bottom of the page. Use these options to set a different validator URL or to disable the | |||
// feature entirely. | |||
c.SetValidatorUrl("https://online.swagger.io/validator"); | |||
//c.DisableValidator(); | |||
// Use this option to control how the Operation listing is displayed. | |||
// It can be set to "None" (default), "List" (shows operations for each resource), | |||
// or "Full" (fully expanded: shows operations and their details). | |||
// | |||
//c.DocExpansion(DocExpansion.List); | |||
// Controls how models are shown when the API is first rendered. (The user can always switch | |||
// the rendering for a given model by clicking the 'Model' and 'Example Value' links.) It can be | |||
// set to 'model' or 'example', and the default is 'example'. | |||
// | |||
//c.DefaultModelRendering(DefaultModelRender.Model); | |||
// Use this option to control the expansion depth for the model on the model-example section. | |||
// | |||
//c.DefaultModelExpandDepth(0); | |||
// The default expansion depth for models (set to -1 completely hide the models). | |||
// | |||
//c.DefaultModelsExpandDepth(0); | |||
// Limit the number of operations shown to a smaller value | |||
// | |||
c.UImaxDisplayedTags(100); | |||
// Filter the operations works as a search, to disable set to "null" | |||
// | |||
c.UIfilter("''"); | |||
// Specify which HTTP operations will have the 'Try it out!' option. An empty parameter list disables | |||
// it for all operations. | |||
// | |||
//c.SupportedSubmitMethods("GET", "HEAD"); | |||
// Use the CustomAsset option to provide your own version of assets used in the swagger-ui. | |||
// It's typically used to instruct Swagger-Net to return your version instead of the default | |||
// when a request is made for "index.html". As with all custom content, the file must be included | |||
// in your project as an "Embedded Resource", and then the resource's "Logical Name" is passed to | |||
// the method as shown below. | |||
// | |||
//c.CustomAsset("index", thisAssembly, "YourWebApiProject.SwaggerExtensions.index.html"); | |||
c.CustomAsset("logoImage", thisAssembly, "DigitalSchoolApi.Content.logo.png"); | |||
// If your API has multiple versions and you've applied the MultipleApiVersions setting | |||
// as described above, you can also enable a select box in the swagger-ui, that displays | |||
// a discovery URL for each version. This provides a convenient way for users to browse documentation | |||
// for different API versions. | |||
// | |||
//c.EnableDiscoveryUrlSelector(); | |||
// If your API supports the OAuth2 Implicit flow, and you've described it correctly, according to | |||
// the Swagger 2.0 specification, you can enable UI support as shown below. | |||
// | |||
//c.EnableOAuth2Support( | |||
// clientId: "test-client-id", | |||
// clientSecret: null, | |||
// realm: "test-realm", | |||
// appName: "Swagger UI" | |||
// //additionalQueryStringParams: new Dictionary<string, string>() { { "foo", "bar" } } | |||
//); | |||
}); | |||
} | |||
public static bool ResolveVersionSupportByRouteConstraint(ApiDescription apiDesc, string targetApiVersion) | |||
{ | |||
return (apiDesc.Route.RouteTemplate.ToLower().Contains(targetApiVersion.ToLower())); | |||
} | |||
private class ApplyDocumentVendorExtensions : IDocumentFilter | |||
{ | |||
public void Apply(SwaggerDocument swaggerDoc, SchemaRegistry schemaRegistry, IApiExplorer apiExplorer) | |||
{ | |||
// Include the given data type in the final SwaggerDocument | |||
// | |||
//schemaRegistry.GetOrRegister(typeof(ExtraType)); | |||
} | |||
} | |||
public class AssignOAuth2SecurityRequirements : IOperationFilter | |||
{ | |||
public void Apply(Operation operation, SchemaRegistry schemaRegistry, ApiDescription apiDescription) | |||
{ | |||
// Correspond each "Authorize" role to an oauth2 scope | |||
var scopes = apiDescription.ActionDescriptor.GetFilterPipeline() | |||
.Select(filterInfo => filterInfo.Instance) | |||
.OfType<AuthorizeAttribute>() | |||
.SelectMany(attr => attr.Roles.Split(',')) | |||
.Distinct(); | |||
if (scopes.Any()) | |||
{ | |||
if (operation.security == null) | |||
operation.security = new List<IDictionary<string, IEnumerable<string>>>(); | |||
var oAuthRequirements = new Dictionary<string, IEnumerable<string>> | |||
{ | |||
{ "oauth2", scopes } | |||
}; | |||
operation.security.Add(oAuthRequirements); | |||
} | |||
} | |||
} | |||
private class ApplySchemaVendorExtensions : ISchemaFilter | |||
{ | |||
public void Apply(Schema schema, SchemaRegistry schemaRegistry, Type type) | |||
{ | |||
// Modify the example values in the final SwaggerDocument | |||
// | |||
if (schema.properties != null) | |||
{ | |||
foreach (var p in schema.properties) | |||
{ | |||
switch (p.Value.format) | |||
{ | |||
case "int32": | |||
p.Value.example = 123; | |||
break; | |||
case "double": | |||
p.Value.example = 9858.216; | |||
break; | |||
} | |||
} | |||
} | |||
} | |||
} | |||
} | |||
} |
@@ -0,0 +1,25 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Web.Http; | |||
using Newtonsoft.Json; | |||
namespace DigitalSchoolApi | |||
{ | |||
public static class WebApiConfig | |||
{ | |||
public static void Register(HttpConfiguration config) | |||
{ | |||
// Web API configuration and services | |||
config.Formatters.Remove(config.Formatters.XmlFormatter); | |||
// Web API routes | |||
config.MapHttpAttributeRoutes(); | |||
config.Routes.MapHttpRoute( | |||
name: "DefaultApi", | |||
routeTemplate: "api/{controller}/{action}/{id}", | |||
defaults: new { id = RouteParameter.Optional } | |||
); | |||
} | |||
} | |||
} |
@@ -0,0 +1,377 @@ | |||
using System; | |||
using System.Linq; | |||
using System.Web; | |||
using System.Web.Http; | |||
using System.Web.Http.Description; | |||
using System.Web.Http.Routing.Constraints; | |||
using System.Collections.Generic; | |||
using System.Diagnostics; | |||
using System.IO; | |||
using DigitalSchoolApi; | |||
using Swagger.Net.Application; | |||
using Swagger.Net; | |||
[assembly: PreApplicationStartMethod(typeof(SwaggerConfig), "Register")] | |||
namespace DigitalSchoolApi | |||
{ | |||
public class SwaggerConfig | |||
{ | |||
public static void Register() | |||
{ | |||
var thisAssembly = typeof(SwaggerConfig).Assembly; | |||
GlobalConfiguration.Configuration | |||
.EnableSwagger(c => | |||
{ | |||
// By default, the service root url is inferred from the request used to access the docs. | |||
// However, there may be situations (e.g. proxy and load-balanced environments) where this does not | |||
// resolve correctly. You can workaround this by providing your own code to determine the root URL. | |||
// | |||
//c.RootUrl(req => GetRootUrlFromAppConfig()); | |||
// If schemes are not explicitly provided in a Swagger 2.0 document, then the scheme used to access | |||
// the docs is taken as the default. If your API supports multiple schemes and you want to be explicit | |||
// about them, you can use the "Schemes" option as shown below. | |||
// | |||
//c.Schemes(new[] { "http", "https" }); | |||
// Use "SingleApiVersion" to describe a single version API. Swagger 2.0 includes an "Info" object to | |||
// hold additional metadata for an API. Version and title are required but you can also provide | |||
// additional fields by chaining methods off SingleApiVersion. | |||
// | |||
c.SingleApiVersion("v1", "DigitalSchoolApi") | |||
.Description("数字化校园API在线文档"); | |||
// Taking to long to load the swagger docs? Enable this option to start caching it | |||
// | |||
//c.AllowCachingSwaggerDoc(); | |||
// If you want the output Swagger docs to be indented properly, enable the "PrettyPrint" option. | |||
// | |||
c.PrettyPrint(); | |||
// If your API has multiple versions, use "MultipleApiVersions" instead of "SingleApiVersion". | |||
// In this case, you must provide a lambda that tells Swagger-Net which actions should be | |||
// included in the docs for a given API version. Like "SingleApiVersion", each call to "Version" | |||
// returns an "Info" builder so you can provide additional metadata per API version. | |||
// | |||
//c.MultipleApiVersions( | |||
// (apiDesc, targetApiVersion) => ResolveVersionSupportByRouteConstraint(apiDesc, targetApiVersion), | |||
// (vc) => | |||
// { | |||
// vc.Version("v2", "Swagger-Net Dummy API V2"); | |||
// vc.Version("v1", "Swagger-Net Dummy API V1"); | |||
// }); | |||
// You can use "BasicAuth", "ApiKey" or "OAuth2" options to describe security schemes for the API. | |||
// See https://github.com/swagger-api/swagger-spec/blob/master/versions/2.0.md for more details. | |||
// NOTE: These only define the schemes and need to be coupled with a corresponding "security" property | |||
// at the document or operation level to indicate which schemes are required for an operation. To do this, | |||
// you'll need to implement a custom IDocumentFilter and/or IOperationFilter to set these properties | |||
// according to your specific authorization implementation | |||
// | |||
//c.BasicAuth("basic").Description("Basic HTTP Authentication"); | |||
// | |||
//c.ApiKey("apiKey", "header", "API Key Authentication"); | |||
// | |||
//c.OAuth2("oauth2") | |||
// .Description("OAuth2 Implicit Grant") | |||
// .Flow("implicit") | |||
// .AuthorizationUrl("http://petstore.swagger.wordnik.com/api/oauth/dialog") | |||
// //.TokenUrl("https://tempuri.org/token") | |||
// .Scopes(scopes => | |||
// { | |||
// scopes.Add("read", "Read access to protected resources"); | |||
// scopes.Add("write", "Write access to protected resources"); | |||
// }); | |||
// Set this flag to omit descriptions for any actions decorated with the Obsolete attribute | |||
//c.IgnoreObsoleteActions(); | |||
// Comment this setting to disable Access-Control-Allow-Origin | |||
c.AccessControlAllowOrigin("*"); | |||
// Each operation be assigned one or more tags which are then used by consumers for various reasons. | |||
// For example, the swagger-ui groups operations according to the first tag of each operation. | |||
// By default, this will be controller name but you can use the "GroupActionsBy" option to | |||
// override with any value. | |||
// | |||
//c.GroupActionsBy(apiDesc => apiDesc.HttpMethod.ToString()); | |||
// You can also specify a custom sort order for groups (as defined by "GroupActionsBy") to dictate | |||
// the order in which operations are listed. For example, if the default grouping is in place | |||
// (controller name) and you specify a descending alphabetic sort order, then actions from a | |||
// ProductsController will be listed before those from a CustomersController. This is typically | |||
// used to customize the order of groupings in the swagger-ui. | |||
// | |||
//c.OrderActionGroupsBy(new DescendingAlphabeticComparer()); | |||
// If you annotate Controllers and API Types with Xml comments: | |||
// http://msdn.microsoft.com/en-us/library/b2s063f7(v=vs.110).aspx | |||
// those comments will be incorporated into the generated docs and UI. | |||
// Just make sure your comment file(s) have extension .XML | |||
// You can add individual files by providing the path to one or | |||
// more Xml comment files. | |||
// | |||
//c.IncludeXmlComments(AppDomain.CurrentDomain.BaseDirectory + "file.ext"); | |||
c.IncludeAllXmlComments(thisAssembly, AppDomain.CurrentDomain.BaseDirectory+"bin\\"); | |||
// Swagger-Net makes a best attempt at generating Swagger compliant JSON schemas for the various types | |||
// exposed in your API. However, there may be occasions when more control of the output is needed. | |||
// This is supported through the "MapType" and "SchemaFilter" options: | |||
// | |||
// Use the "MapType" option to override the Schema generation for a specific type. | |||
// It should be noted that the resulting Schema will be placed "inline" for any applicable Operations. | |||
// While Swagger 2.0 supports inline definitions for "all" Schema types, the swagger-ui tool does not. | |||
// It expects "complex" Schemas to be defined separately and referenced. For this reason, you should only | |||
// use the "MapType" option when the resulting Schema is a primitive or array type. If you need to alter a | |||
// complex Schema, use a Schema filter. | |||
// | |||
//c.MapType<ProductType>(() => new Schema { type = "integer", format = "int32" }); | |||
// If you want to post-modify "complex" Schemas once they've been generated, across the board or for a | |||
// specific type, you can wire up one or more Schema filters. | |||
// | |||
//c.SchemaFilter<ApplySchemaVendorExtensions>(); | |||
// In a Swagger 2.0 document, complex types are typically declared globally and referenced by unique | |||
// Schema Id. By default, Swagger-Net does NOT use the full type name in Schema Ids. In most cases, this | |||
// works well because it prevents the "implementation detail" of type namespaces from leaking into your | |||
// Swagger docs and UI. However, if you have multiple types in your API with the same class name, you'll | |||
// need to opt out of this behavior to avoid Schema Id conflicts. | |||
// | |||
//c.UseFullTypeNameInSchemaIds(); | |||
// Alternatively, you can provide your own custom strategy for inferring SchemaId's for | |||
// describing "complex" types in your API. | |||
// | |||
//c.SchemaId(t => t.FullName.Contains('`') ? t.FullName.Substring(0, t.FullName.IndexOf('`')) : t.FullName); | |||
// Set this flag to omit schema property descriptions for any type properties decorated with the | |||
// Obsolete attribute | |||
//c.IgnoreObsoleteProperties(); | |||
// Set this flag to ignore IsSpecified members when serializing and deserializing types. | |||
// | |||
c.IgnoreIsSpecifiedMembers(); | |||
// In accordance with the built in JsonSerializer, if disabled Swagger-Net will describe enums as integers. | |||
// You can change the serializer behavior by configuring the StringToEnumConverter globally or for a given | |||
// enum type. Swagger-Net will honor this change out-of-the-box. However, if you use a different | |||
// approach to serialize enums as strings, you can also force Swagger-Net to describe them as strings. | |||
// | |||
c.DescribeAllEnumsAsStrings(camelCase: false); | |||
// Similar to Schema filters, Swagger-Net also supports Operation and Document filters: | |||
// | |||
// Post-modify Operation descriptions once they've been generated by wiring up one or more | |||
// Operation filters. | |||
// | |||
//c.OperationFilter<AddDefaultResponse>(); | |||
// | |||
// If you've defined an OAuth2 flow as described above, you could use a custom filter | |||
// to inspect some attribute on each action and infer which (if any) OAuth2 scopes are required | |||
// to execute the operation | |||
// | |||
//c.OperationFilter<AssignOAuth2SecurityRequirements>(); | |||
// Post-modify the entire Swagger document by wiring up one or more Document filters. | |||
// This gives full control to modify the final SwaggerDocument. You should have a good understanding of | |||
// the Swagger 2.0 spec. - https://github.com/swagger-api/swagger-spec/blob/master/versions/2.0.md | |||
// before using this option. | |||
// | |||
//c.DocumentFilter<ApplyDocumentVendorExtensions>(); | |||
// In contrast to WebApi, Swagger 2.0 does not include the query string component when mapping a URL | |||
// to an action. As a result, Swagger-Net will raise an exception if it encounters multiple actions | |||
// with the same path (sans query string) and HTTP method. You can workaround this by providing a | |||
// custom strategy to pick a winner or merge the descriptions for the purposes of the Swagger docs | |||
// | |||
//c.ResolveConflictingActions(apiDescriptions => apiDescriptions.First()); | |||
// Wrap the default SwaggerGenerator with additional behavior (e.g. caching) or provide an | |||
// alternative implementation for ISwaggerProvider with the CustomProvider option. | |||
// | |||
//c.CustomProvider((defaultProvider) => new CachingSwaggerProvider(defaultProvider)); | |||
}) | |||
.EnableSwaggerUi(c => | |||
{ | |||
// Use the "DocumentTitle" option to change the Document title. | |||
// Very helpful when you have multiple Swagger pages open, to tell them apart. | |||
// | |||
c.DocumentTitle("数字化校园API在线文档"); | |||
// Use the "CssTheme" to add a theme to your UI. | |||
// Options are: | |||
// theme-feeling-blue-css | |||
// theme-flattop-css | |||
// theme-material-css | |||
// theme-monokai-css | |||
// theme-muted-css | |||
// theme-newspaper-css | |||
// theme-outline-css | |||
// | |||
//c.CssTheme("theme-material-css"); | |||
// Use the "InjectStylesheet" option to enrich the UI with one or more additional CSS stylesheets. | |||
// The file must be included in your project as an "Embedded Resource", and then the resource's | |||
// "Logical Name" is passed to the method as shown below. | |||
// | |||
c.InjectStylesheet(thisAssembly, "DigitalSchoolApi.Content.custom.css"); | |||
//c.InjectStylesheet(thisAssembly, "Swagger.Net.Dummy.SwaggerExtensions.testStyles1.css"); | |||
// Use the "InjectJavaScript" option to invoke one or more custom JavaScripts after the swagger-ui | |||
// has loaded. The file must be included in your project as an "Embedded Resource", and then the resource's | |||
// "Logical Name" is passed to the method as shown above. | |||
// | |||
//c.InjectJavaScript(thisAssembly, "Swagger.Net.Dummy.SwaggerExtensions.testScript1.js"); | |||
// The swagger-ui renders boolean data types as a dropdown. By default, it provides "true" and "false" | |||
// strings as the possible choices. You can use this option to change these to something else, | |||
// for example 0 and 1. | |||
// | |||
//c.BooleanValues(new[] { "0", "1" }); | |||
// Controls the display of vendor extension (x-) fields and values for Operations, Parameters, and Schema. | |||
// The default is true. | |||
// | |||
c.ShowExtensions(true); | |||
// Show pattern, minLength, maxLength, minimum, and maximum fields | |||
// | |||
//c.ShowCommonExtensions(true); | |||
// By default, swagger-ui will validate specs against swagger.io's online validator and display the result | |||
// in a badge at the bottom of the page. Use these options to set a different validator URL or to disable the | |||
// feature entirely. | |||
c.SetValidatorUrl("https://online.swagger.io/validator"); | |||
//c.DisableValidator(); | |||
// Use this option to control how the Operation listing is displayed. | |||
// It can be set to "None" (default), "List" (shows operations for each resource), | |||
// or "Full" (fully expanded: shows operations and their details). | |||
// | |||
//c.DocExpansion(DocExpansion.List); | |||
// Controls how models are shown when the API is first rendered. (The user can always switch | |||
// the rendering for a given model by clicking the 'Model' and 'Example Value' links.) It can be | |||
// set to 'model' or 'example', and the default is 'example'. | |||
// | |||
//c.DefaultModelRendering(DefaultModelRender.Model); | |||
// Use this option to control the expansion depth for the model on the model-example section. | |||
// | |||
//c.DefaultModelExpandDepth(0); | |||
// The default expansion depth for models (set to -1 completely hide the models). | |||
// | |||
//c.DefaultModelsExpandDepth(0); | |||
// Limit the number of operations shown to a smaller value | |||
// | |||
c.UImaxDisplayedTags(100); | |||
// Filter the operations works as a search, to disable set to "null" | |||
// | |||
c.UIfilter("''"); | |||
// Specify which HTTP operations will have the 'Try it out!' option. An empty parameter list disables | |||
// it for all operations. | |||
// | |||
//c.SupportedSubmitMethods("GET", "HEAD"); | |||
// Use the CustomAsset option to provide your own version of assets used in the swagger-ui. | |||
// It's typically used to instruct Swagger-Net to return your version instead of the default | |||
// when a request is made for "index.html". As with all custom content, the file must be included | |||
// in your project as an "Embedded Resource", and then the resource's "Logical Name" is passed to | |||
// the method as shown below. | |||
// | |||
//c.CustomAsset("index", thisAssembly, "YourWebApiProject.SwaggerExtensions.index.html"); | |||
c.CustomAsset("logoImage", thisAssembly, "DigitalSchoolApi.Content.logo.png"); | |||
// If your API has multiple versions and you've applied the MultipleApiVersions setting | |||
// as described above, you can also enable a select box in the swagger-ui, that displays | |||
// a discovery URL for each version. This provides a convenient way for users to browse documentation | |||
// for different API versions. | |||
// | |||
//c.EnableDiscoveryUrlSelector(); | |||
// If your API supports the OAuth2 Implicit flow, and you've described it correctly, according to | |||
// the Swagger 2.0 specification, you can enable UI support as shown below. | |||
// | |||
//c.EnableOAuth2Support( | |||
// clientId: "test-client-id", | |||
// clientSecret: null, | |||
// realm: "test-realm", | |||
// appName: "Swagger UI" | |||
// //additionalQueryStringParams: new Dictionary<string, string>() { { "foo", "bar" } } | |||
//); | |||
}); | |||
} | |||
public static bool ResolveVersionSupportByRouteConstraint(ApiDescription apiDesc, string targetApiVersion) | |||
{ | |||
return (apiDesc.Route.RouteTemplate.ToLower().Contains(targetApiVersion.ToLower())); | |||
} | |||
private class ApplyDocumentVendorExtensions : IDocumentFilter | |||
{ | |||
public void Apply(SwaggerDocument swaggerDoc, SchemaRegistry schemaRegistry, IApiExplorer apiExplorer) | |||
{ | |||
// Include the given data type in the final SwaggerDocument | |||
// | |||
//schemaRegistry.GetOrRegister(typeof(ExtraType)); | |||
} | |||
} | |||
public class AssignOAuth2SecurityRequirements : IOperationFilter | |||
{ | |||
public void Apply(Operation operation, SchemaRegistry schemaRegistry, ApiDescription apiDescription) | |||
{ | |||
// Correspond each "Authorize" role to an oauth2 scope | |||
var scopes = apiDescription.ActionDescriptor.GetFilterPipeline() | |||
.Select(filterInfo => filterInfo.Instance) | |||
.OfType<AuthorizeAttribute>() | |||
.SelectMany(attr => attr.Roles.Split(',')) | |||
.Distinct(); | |||
if (scopes.Any()) | |||
{ | |||
if (operation.security == null) | |||
operation.security = new List<IDictionary<string, IEnumerable<string>>>(); | |||
var oAuthRequirements = new Dictionary<string, IEnumerable<string>> | |||
{ | |||
{ "oauth2", scopes } | |||
}; | |||
operation.security.Add(oAuthRequirements); | |||
} | |||
} | |||
} | |||
private class ApplySchemaVendorExtensions : ISchemaFilter | |||
{ | |||
public void Apply(Schema schema, SchemaRegistry schemaRegistry, Type type) | |||
{ | |||
// Modify the example values in the final SwaggerDocument | |||
// | |||
if (schema.properties != null) | |||
{ | |||
foreach (var p in schema.properties) | |||
{ | |||
switch (p.Value.format) | |||
{ | |||
case "int32": | |||
p.Value.example = 123; | |||
break; | |||
case "double": | |||
p.Value.example = 9858.216; | |||
break; | |||
} | |||
} | |||
} | |||
} | |||
} | |||
} | |||
} |
@@ -0,0 +1,10 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<!-- | |||
This file is automatically generated by Visual Studio .Net. It is | |||
used to store generic object data source configuration information. | |||
Renaming the file extension or editing the content of this file may | |||
cause the file to be unrecognizable by the program. | |||
--> | |||
<GenericObjectDataSource DisplayName="GetCustFareInfoByOutIDResponse" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource"> | |||
<TypeInfo>DigitalSchoolApi.SynServiceReference.GetCustFareInfoByOutIDResponse, Connected Services.SynServiceReference.Reference.cs.dll, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo> | |||
</GenericObjectDataSource> |
@@ -0,0 +1,10 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<!-- | |||
This file is automatically generated by Visual Studio .Net. It is | |||
used to store generic object data source configuration information. | |||
Renaming the file extension or editing the content of this file may | |||
cause the file to be unrecognizable by the program. | |||
--> | |||
<GenericObjectDataSource DisplayName="GetEcardConsumeRecordResponse" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource"> | |||
<TypeInfo>DigitalSchoolApi.SynServiceReference.GetEcardConsumeRecordResponse, Connected Services.SynServiceReference.Reference.cs.dll, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo> | |||
</GenericObjectDataSource> |
@@ -0,0 +1,10 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<!-- | |||
This file is automatically generated by Visual Studio .Net. It is | |||
used to store generic object data source configuration information. | |||
Renaming the file extension or editing the content of this file may | |||
cause the file to be unrecognizable by the program. | |||
--> | |||
<GenericObjectDataSource DisplayName="GetEcardCustInfoByOutIDResponse" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource"> | |||
<TypeInfo>DigitalSchoolApi.SynServiceReference.GetEcardCustInfoByOutIDResponse, Connected Services.SynServiceReference.Reference.cs.dll, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo> | |||
</GenericObjectDataSource> |
@@ -0,0 +1,10 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<!-- | |||
This file is automatically generated by Visual Studio .Net. It is | |||
used to store generic object data source configuration information. | |||
Renaming the file extension or editing the content of this file may | |||
cause the file to be unrecognizable by the program. | |||
--> | |||
<GenericObjectDataSource DisplayName="GetEcardDeptInfoResponse" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource"> | |||
<TypeInfo>DigitalSchoolApi.SynServiceReference.GetEcardDeptInfoResponse, Connected Services.SynServiceReference.Reference.cs.dll, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo> | |||
</GenericObjectDataSource> |
@@ -0,0 +1,10 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<!-- | |||
This file is automatically generated by Visual Studio .Net. It is | |||
used to store generic object data source configuration information. | |||
Renaming the file extension or editing the content of this file may | |||
cause the file to be unrecognizable by the program. | |||
--> | |||
<GenericObjectDataSource DisplayName="GetEcardSaveRecordResponse" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource"> | |||
<TypeInfo>DigitalSchoolApi.SynServiceReference.GetEcardSaveRecordResponse, Connected Services.SynServiceReference.Reference.cs.dll, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo> | |||
</GenericObjectDataSource> |
@@ -0,0 +1,10 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<!-- | |||
This file is automatically generated by Visual Studio .Net. It is | |||
used to store generic object data source configuration information. | |||
Renaming the file extension or editing the content of this file may | |||
cause the file to be unrecognizable by the program. | |||
--> | |||
<GenericObjectDataSource DisplayName="GetEcardTermInfoResponse" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource"> | |||
<TypeInfo>DigitalSchoolApi.SynServiceReference.GetEcardTermInfoResponse, Connected Services.SynServiceReference.Reference.cs.dll, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo> | |||
</GenericObjectDataSource> |
@@ -0,0 +1,10 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<!-- | |||
This file is automatically generated by Visual Studio .Net. It is | |||
used to store generic object data source configuration information. | |||
Renaming the file extension or editing the content of this file may | |||
cause the file to be unrecognizable by the program. | |||
--> | |||
<GenericObjectDataSource DisplayName="GetTokenResponse" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource"> | |||
<TypeInfo>DigitalSchoolApi.SynServiceReference.GetTokenResponse, Connected Services.SynServiceReference.Reference.cs.dll, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo> | |||
</GenericObjectDataSource> |
@@ -0,0 +1,10 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<!-- | |||
This file is automatically generated by Visual Studio .Net. It is | |||
used to store generic object data source configuration information. | |||
Renaming the file extension or editing the content of this file may | |||
cause the file to be unrecognizable by the program. | |||
--> | |||
<GenericObjectDataSource DisplayName="LogonResponse" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource"> | |||
<TypeInfo>DigitalSchoolApi.SynServiceReference.LogonResponse, Connected Services.SynServiceReference.Reference.cs.dll, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo> | |||
</GenericObjectDataSource> |
@@ -0,0 +1,10 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<!-- | |||
This file is automatically generated by Visual Studio .Net. It is | |||
used to store generic object data source configuration information. | |||
Renaming the file extension or editing the content of this file may | |||
cause the file to be unrecognizable by the program. | |||
--> | |||
<GenericObjectDataSource DisplayName="ResultDTO" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource"> | |||
<TypeInfo>DigitalSchoolApi.SynServiceReference.ResultDTO, Connected Services.SynServiceReference.Reference.cs.dll, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo> | |||
</GenericObjectDataSource> |
@@ -0,0 +1,10 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<!-- | |||
This file is automatically generated by Visual Studio .Net. It is | |||
used to store generic object data source configuration information. | |||
Renaming the file extension or editing the content of this file may | |||
cause the file to be unrecognizable by the program. | |||
--> | |||
<GenericObjectDataSource DisplayName="ResultDTOOfEcardConsumeRecordDTO" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource"> | |||
<TypeInfo>DigitalSchoolApi.SynServiceReference.ResultDTOOfEcardConsumeRecordDTO, Connected Services.SynServiceReference.Reference.cs.dll, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo> | |||
</GenericObjectDataSource> |
@@ -0,0 +1,10 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<!-- | |||
This file is automatically generated by Visual Studio .Net. It is | |||
used to store generic object data source configuration information. | |||
Renaming the file extension or editing the content of this file may | |||
cause the file to be unrecognizable by the program. | |||
--> | |||
<GenericObjectDataSource DisplayName="ResultDTOOfEcardCustAllInfoDTO" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource"> | |||
<TypeInfo>DigitalSchoolApi.SynServiceReference.ResultDTOOfEcardCustAllInfoDTO, Connected Services.SynServiceReference.Reference.cs.dll, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo> | |||
</GenericObjectDataSource> |
@@ -0,0 +1,10 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<!-- | |||
This file is automatically generated by Visual Studio .Net. It is | |||
used to store generic object data source configuration information. | |||
Renaming the file extension or editing the content of this file may | |||
cause the file to be unrecognizable by the program. | |||
--> | |||
<GenericObjectDataSource DisplayName="ResultDTOOfEcardCustomerFareInfo" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource"> | |||
<TypeInfo>DigitalSchoolApi.SynServiceReference.ResultDTOOfEcardCustomerFareInfo, Connected Services.SynServiceReference.Reference.cs.dll, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo> | |||
</GenericObjectDataSource> |
@@ -0,0 +1,10 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<!-- | |||
This file is automatically generated by Visual Studio .Net. It is | |||
used to store generic object data source configuration information. | |||
Renaming the file extension or editing the content of this file may | |||
cause the file to be unrecognizable by the program. | |||
--> | |||
<GenericObjectDataSource DisplayName="ResultDTOOfEcardDeptDTO" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource"> | |||
<TypeInfo>DigitalSchoolApi.SynServiceReference.ResultDTOOfEcardDeptDTO, Connected Services.SynServiceReference.Reference.cs.dll, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo> | |||
</GenericObjectDataSource> |
@@ -0,0 +1,10 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<!-- | |||
This file is automatically generated by Visual Studio .Net. It is | |||
used to store generic object data source configuration information. | |||
Renaming the file extension or editing the content of this file may | |||
cause the file to be unrecognizable by the program. | |||
--> | |||
<GenericObjectDataSource DisplayName="ResultDTOOfEcardSaveRecordDTO" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource"> | |||
<TypeInfo>DigitalSchoolApi.SynServiceReference.ResultDTOOfEcardSaveRecordDTO, Connected Services.SynServiceReference.Reference.cs.dll, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo> | |||
</GenericObjectDataSource> |
@@ -0,0 +1,10 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<!-- | |||
This file is automatically generated by Visual Studio .Net. It is | |||
used to store generic object data source configuration information. | |||
Renaming the file extension or editing the content of this file may | |||
cause the file to be unrecognizable by the program. | |||
--> | |||
<GenericObjectDataSource DisplayName="ResultDTOOfEcardTermDTO" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource"> | |||
<TypeInfo>DigitalSchoolApi.SynServiceReference.ResultDTOOfEcardTermDTO, Connected Services.SynServiceReference.Reference.cs.dll, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo> | |||
</GenericObjectDataSource> |
@@ -0,0 +1,32 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<ReferenceGroup xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" ID="ddac5b2c-34d5-447a-8226-2553f672a5c8" xmlns="urn:schemas-microsoft-com:xml-wcfservicemap"> | |||
<ClientOptions> | |||
<GenerateAsynchronousMethods>false</GenerateAsynchronousMethods> | |||
<GenerateTaskBasedAsynchronousMethod>true</GenerateTaskBasedAsynchronousMethod> | |||
<EnableDataBinding>true</EnableDataBinding> | |||
<ExcludedTypes /> | |||
<ImportXmlTypes>false</ImportXmlTypes> | |||
<GenerateInternalTypes>false</GenerateInternalTypes> | |||
<GenerateMessageContracts>false</GenerateMessageContracts> | |||
<NamespaceMappings /> | |||
<CollectionMappings /> | |||
<GenerateSerializableTypes>true</GenerateSerializableTypes> | |||
<Serializer>Auto</Serializer> | |||
<UseSerializerForFaults>true</UseSerializerForFaults> | |||
<ReferenceAllAssemblies>true</ReferenceAllAssemblies> | |||
<ReferencedAssemblies /> | |||
<ReferencedDataContractTypes /> | |||
<ServiceContractMappings /> | |||
</ClientOptions> | |||
<MetadataSources> | |||
<MetadataSource Address="http://218.28.133.181:13282/SYN/SynService.asmx" Protocol="http" SourceId="1" /> | |||
</MetadataSources> | |||
<Metadata> | |||
<MetadataFile FileName="SynService.disco" MetadataType="Disco" ID="fc339790-77f6-4747-922d-b598c9914065" SourceId="1" SourceUrl="http://218.28.133.181:13282/SYN/SynService.asmx?disco" /> | |||
<MetadataFile FileName="SynService.wsdl" MetadataType="Wsdl" ID="f4ea950e-4aff-4971-8db0-4cd75d6727b6" SourceId="1" SourceUrl="http://218.28.133.181:13282/SYN/SynService.asmx?wsdl" /> | |||
</Metadata> | |||
<Extensions> | |||
<ExtensionFile FileName="configuration91.svcinfo" Name="configuration91.svcinfo" /> | |||
<ExtensionFile FileName="configuration.svcinfo" Name="configuration.svcinfo" /> | |||
</Extensions> | |||
</ReferenceGroup> |
@@ -0,0 +1,6 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<discovery xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/disco/"> | |||
<contractRef ref="http://218.28.133.181:13282/SYN/SynService.asmx?wsdl" docRef="http://218.28.133.181:13282/SYN/SynService.asmx" xmlns="http://schemas.xmlsoap.org/disco/scl/" /> | |||
<soap address="http://218.28.133.181:13282/SYN/SynService.asmx" xmlns:q1="http://www.newcapec.com.cn/" binding="q1:SynServiceSoap" xmlns="http://schemas.xmlsoap.org/disco/soap/" /> | |||
<soap address="http://218.28.133.181:13282/SYN/SynService.asmx" xmlns:q2="http://www.newcapec.com.cn/" binding="q2:SynServiceSoap12" xmlns="http://schemas.xmlsoap.org/disco/soap/" /> | |||
</discovery> |
@@ -0,0 +1,607 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<wsdl:definitions xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://www.newcapec.com.cn/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" targetNamespace="http://www.newcapec.com.cn/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"> | |||
<wsdl:types> | |||
<s:schema elementFormDefault="qualified" targetNamespace="http://www.newcapec.com.cn/"> | |||
<s:element name="GetToken"> | |||
<s:complexType> | |||
<s:sequence> | |||
<s:element minOccurs="0" maxOccurs="1" name="appId" type="s:string" /> | |||
</s:sequence> | |||
</s:complexType> | |||
</s:element> | |||
<s:element name="GetTokenResponse"> | |||
<s:complexType> | |||
<s:sequence> | |||
<s:element minOccurs="0" maxOccurs="1" name="GetTokenResult" type="tns:ResultDTO" /> | |||
</s:sequence> | |||
</s:complexType> | |||
</s:element> | |||
<s:complexType name="ResultDTO"> | |||
<s:sequence> | |||
<s:element minOccurs="0" maxOccurs="1" name="msg" type="s:string" /> | |||
<s:element minOccurs="1" maxOccurs="1" name="code" type="s:int" /> | |||
</s:sequence> | |||
</s:complexType> | |||
<s:element name="Logon"> | |||
<s:complexType> | |||
<s:sequence> | |||
<s:element minOccurs="0" maxOccurs="1" name="appId" type="s:string" /> | |||
<s:element minOccurs="0" maxOccurs="1" name="encryptedPwd" type="s:string" /> | |||
</s:sequence> | |||
</s:complexType> | |||
</s:element> | |||
<s:element name="LogonResponse"> | |||
<s:complexType> | |||
<s:sequence> | |||
<s:element minOccurs="0" maxOccurs="1" name="LogonResult" type="tns:ResultDTO" /> | |||
</s:sequence> | |||
</s:complexType> | |||
</s:element> | |||
<s:element name="GetEcardCustInfoByOutID"> | |||
<s:complexType> | |||
<s:sequence> | |||
<s:element minOccurs="0" maxOccurs="1" name="ecode" type="s:string" /> | |||
<s:element minOccurs="0" maxOccurs="1" name="outid" type="s:string" /> | |||
</s:sequence> | |||
</s:complexType> | |||
</s:element> | |||
<s:element name="GetEcardCustInfoByOutIDResponse"> | |||
<s:complexType> | |||
<s:sequence> | |||
<s:element minOccurs="0" maxOccurs="1" name="GetEcardCustInfoByOutIDResult" type="tns:ResultDTOOfEcardCustAllInfoDTO" /> | |||
</s:sequence> | |||
</s:complexType> | |||
</s:element> | |||
<s:complexType name="ResultDTOOfEcardCustAllInfoDTO"> | |||
<s:complexContent mixed="false"> | |||
<s:extension base="tns:ResultDTO"> | |||
<s:sequence> | |||
<s:element minOccurs="0" maxOccurs="1" name="Record" type="tns:ArrayOfEcardCustAllInfoDTO" /> | |||
</s:sequence> | |||
</s:extension> | |||
</s:complexContent> | |||
</s:complexType> | |||
<s:complexType name="ArrayOfEcardCustAllInfoDTO"> | |||
<s:sequence> | |||
<s:element minOccurs="0" maxOccurs="unbounded" name="EcardCustAllInfoDTO" nillable="true" type="tns:EcardCustAllInfoDTO" /> | |||
</s:sequence> | |||
</s:complexType> | |||
<s:complexType name="EcardCustAllInfoDTO"> | |||
<s:complexContent mixed="false"> | |||
<s:extension base="tns:EcardCustInfoDTO"> | |||
<s:sequence> | |||
<s:element minOccurs="0" maxOccurs="1" name="Photo" type="s:base64Binary" /> | |||
</s:sequence> | |||
</s:extension> | |||
</s:complexContent> | |||
</s:complexType> | |||
<s:complexType name="EcardCustInfoDTO"> | |||
<s:complexContent mixed="false"> | |||
<s:extension base="tns:CustInfoDTO"> | |||
<s:sequence> | |||
<s:element minOccurs="1" maxOccurs="1" name="Customerid" type="s:int" /> | |||
<s:element minOccurs="1" maxOccurs="1" name="CardNO" type="s:int" /> | |||
<s:element minOccurs="1" maxOccurs="1" name="Status" type="s:int" /> | |||
<s:element minOccurs="1" maxOccurs="1" name="CardSN" type="s:int" /> | |||
<s:element minOccurs="0" maxOccurs="1" name="SCardSNR" type="s:string" /> | |||
<s:element minOccurs="1" maxOccurs="1" name="Ver" type="s:long" /> | |||
</s:sequence> | |||
</s:extension> | |||
</s:complexContent> | |||
</s:complexType> | |||
<s:complexType name="CustInfoDTO"> | |||
<s:sequence> | |||
<s:element minOccurs="0" maxOccurs="1" name="Jpdm" type="s:string" /> | |||
<s:element minOccurs="0" maxOccurs="1" name="ECode" type="s:string" /> | |||
<s:element minOccurs="0" maxOccurs="1" name="OutID" type="s:string" /> | |||
<s:element minOccurs="0" maxOccurs="1" name="Name" type="s:string" /> | |||
<s:element minOccurs="0" maxOccurs="1" name="Sex" type="s:string" /> | |||
<s:element minOccurs="0" maxOccurs="1" name="DpCode" type="s:string" /> | |||
<s:element minOccurs="0" maxOccurs="1" name="CertificateID" type="s:string" /> | |||
<s:element minOccurs="0" maxOccurs="1" name="IdCardNO" type="s:string" /> | |||
<s:element minOccurs="0" maxOccurs="1" name="Nation" type="s:string" /> | |||
<s:element minOccurs="0" maxOccurs="1" name="RegStartYear" type="s:string" /> | |||
<s:element minOccurs="0" maxOccurs="1" name="CustSF" type="s:string" /> | |||
<s:element minOccurs="0" maxOccurs="1" name="CardType" type="s:string" /> | |||
<s:element minOccurs="0" maxOccurs="1" name="TelePhone" type="s:string" /> | |||
<s:element minOccurs="0" maxOccurs="1" name="NoUseDate" type="s:string" /> | |||
<s:element minOccurs="0" maxOccurs="1" name="Country" type="s:string" /> | |||
<s:element minOccurs="0" maxOccurs="1" name="Address" type="s:string" /> | |||
<s:element minOccurs="0" maxOccurs="1" name="Email" type="s:string" /> | |||
<s:element minOccurs="0" maxOccurs="1" name="Birthday" type="s:string" /> | |||
<s:element minOccurs="0" maxOccurs="1" name="BarCode" type="s:string" /> | |||
<s:element minOccurs="0" maxOccurs="1" name="MedicalType" type="s:string" /> | |||
</s:sequence> | |||
</s:complexType> | |||
<s:element name="GetCustFareInfoByOutID"> | |||
<s:complexType> | |||
<s:sequence> | |||
<s:element minOccurs="0" maxOccurs="1" name="ecode" type="s:string" /> | |||
<s:element minOccurs="0" maxOccurs="1" name="outid" type="s:string" /> | |||
</s:sequence> | |||
</s:complexType> | |||
</s:element> | |||
<s:element name="GetCustFareInfoByOutIDResponse"> | |||
<s:complexType> | |||
<s:sequence> | |||
<s:element minOccurs="0" maxOccurs="1" name="GetCustFareInfoByOutIDResult" type="tns:ResultDTOOfEcardCustomerFareInfo" /> | |||
</s:sequence> | |||
</s:complexType> | |||
</s:element> | |||
<s:complexType name="ResultDTOOfEcardCustomerFareInfo"> | |||
<s:complexContent mixed="false"> | |||
<s:extension base="tns:ResultDTO"> | |||
<s:sequence> | |||
<s:element minOccurs="0" maxOccurs="1" name="Record" type="tns:ArrayOfEcardCustomerFareInfo" /> | |||
</s:sequence> | |||
</s:extension> | |||
</s:complexContent> | |||
</s:complexType> | |||
<s:complexType name="ArrayOfEcardCustomerFareInfo"> | |||
<s:sequence> | |||
<s:element minOccurs="0" maxOccurs="unbounded" name="EcardCustomerFareInfo" nillable="true" type="tns:EcardCustomerFareInfo" /> | |||
</s:sequence> | |||
</s:complexType> | |||
<s:complexType name="EcardCustomerFareInfo"> | |||
<s:sequence> | |||
<s:element minOccurs="0" maxOccurs="1" name="ECode" type="s:string" /> | |||
<s:element minOccurs="0" maxOccurs="1" name="OutID" type="s:string" /> | |||
<s:element minOccurs="1" maxOccurs="1" name="Customerid" type="s:int" /> | |||
<s:element minOccurs="1" maxOccurs="1" name="Oddfare" type="s:int" /> | |||
<s:element minOccurs="1" maxOccurs="1" name="SubOddfare" type="s:int" /> | |||
<s:element minOccurs="1" maxOccurs="1" name="Opcount" type="s:int" /> | |||
<s:element minOccurs="1" maxOccurs="1" name="SaveOpcount" type="s:int" /> | |||
<s:element minOccurs="1" maxOccurs="1" name="SubOpcount" type="s:int" /> | |||
<s:element minOccurs="1" maxOccurs="1" name="SubSaveOpcount" type="s:int" /> | |||
<s:element minOccurs="1" maxOccurs="1" name="OnlineOddfare" type="s:int" /> | |||
<s:element minOccurs="1" maxOccurs="1" name="SumOddfare" type="s:long" /> | |||
</s:sequence> | |||
</s:complexType> | |||
<s:element name="GetEcardConsumeRecord"> | |||
<s:complexType> | |||
<s:sequence> | |||
<s:element minOccurs="0" maxOccurs="1" name="ecode" type="s:string" /> | |||
<s:element minOccurs="1" maxOccurs="1" name="sourceTable" type="s:int" /> | |||
<s:element minOccurs="1" maxOccurs="1" name="maxCstaccfc" type="s:long" /> | |||
<s:element minOccurs="1" maxOccurs="1" name="RowCount" type="s:int" /> | |||
</s:sequence> | |||
</s:complexType> | |||
</s:element> | |||
<s:element name="GetEcardConsumeRecordResponse"> | |||
<s:complexType> | |||
<s:sequence> | |||
<s:element minOccurs="0" maxOccurs="1" name="GetEcardConsumeRecordResult" type="tns:ResultDTOOfEcardConsumeRecordDTO" /> | |||
</s:sequence> | |||
</s:complexType> | |||
</s:element> | |||
<s:complexType name="ResultDTOOfEcardConsumeRecordDTO"> | |||
<s:complexContent mixed="false"> | |||
<s:extension base="tns:ResultDTO"> | |||
<s:sequence> | |||
<s:element minOccurs="0" maxOccurs="1" name="Record" type="tns:ArrayOfEcardConsumeRecordDTO" /> | |||
</s:sequence> | |||
</s:extension> | |||
</s:complexContent> | |||
</s:complexType> | |||
<s:complexType name="ArrayOfEcardConsumeRecordDTO"> | |||
<s:sequence> | |||
<s:element minOccurs="0" maxOccurs="unbounded" name="EcardConsumeRecordDTO" nillable="true" type="tns:EcardConsumeRecordDTO" /> | |||
</s:sequence> | |||
</s:complexType> | |||
<s:complexType name="EcardConsumeRecordDTO"> | |||
<s:sequence> | |||
<s:element minOccurs="1" maxOccurs="1" name="SOURCETABLE" type="s:int" /> | |||
<s:element minOccurs="1" maxOccurs="1" name="ID" type="s:long" /> | |||
<s:element minOccurs="1" maxOccurs="1" name="NOTECASE" type="s:long" /> | |||
<s:element minOccurs="1" maxOccurs="1" name="CUSTOMERID" type="s:int" /> | |||
<s:element minOccurs="0" maxOccurs="1" name="OUTID" type="s:string" /> | |||
<s:element minOccurs="1" maxOccurs="1" name="CARDSN" type="s:int" /> | |||
<s:element minOccurs="1" maxOccurs="1" name="OPCOUNT" type="s:int" /> | |||
<s:element minOccurs="1" maxOccurs="1" name="OPDT" type="s:dateTime" /> | |||
<s:element minOccurs="1" maxOccurs="1" name="ODDFARE" type="s:decimal" /> | |||
<s:element minOccurs="1" maxOccurs="1" name="OPFARE" type="s:decimal" /> | |||
<s:element minOccurs="1" maxOccurs="1" name="MNGFARE" type="s:decimal" /> | |||
<s:element minOccurs="1" maxOccurs="1" name="ACCCODE" type="s:int" /> | |||
<s:element minOccurs="0" maxOccurs="1" name="DSCRP" type="s:string" /> | |||
<s:element minOccurs="1" maxOccurs="1" name="TERMID" type="s:int" /> | |||
<s:element minOccurs="1" maxOccurs="1" name="RECNO" type="s:int" /> | |||
<s:element minOccurs="1" maxOccurs="1" name="UPLOADDATE" type="s:dateTime" /> | |||
<s:element minOccurs="1" maxOccurs="1" name="SAMCARDNO" type="s:long" /> | |||
<s:element minOccurs="1" maxOccurs="1" name="SAMTRADENO" type="s:long" /> | |||
<s:element minOccurs="1" maxOccurs="1" name="TRADECARDTYPE" type="s:int" /> | |||
<s:element minOccurs="1" maxOccurs="1" name="TAC" type="s:long" /> | |||
<s:element minOccurs="0" maxOccurs="1" name="ASN" type="s:string" /> | |||
<s:element minOccurs="0" maxOccurs="1" name="ECODE" type="s:string" /> | |||
</s:sequence> | |||
</s:complexType> | |||
<s:element name="GetEcardSaveRecord"> | |||
<s:complexType> | |||
<s:sequence> | |||
<s:element minOccurs="0" maxOccurs="1" name="ecode" type="s:string" /> | |||
<s:element minOccurs="1" maxOccurs="1" name="sourceTable" type="s:int" /> | |||
<s:element minOccurs="1" maxOccurs="1" name="maxCstaccfc" type="s:long" /> | |||
<s:element minOccurs="1" maxOccurs="1" name="RowCount" type="s:int" /> | |||
</s:sequence> | |||
</s:complexType> | |||
</s:element> | |||
<s:element name="GetEcardSaveRecordResponse"> | |||
<s:complexType> | |||
<s:sequence> | |||
<s:element minOccurs="0" maxOccurs="1" name="GetEcardSaveRecordResult" type="tns:ResultDTOOfEcardSaveRecordDTO" /> | |||
</s:sequence> | |||
</s:complexType> | |||
</s:element> | |||
<s:complexType name="ResultDTOOfEcardSaveRecordDTO"> | |||
<s:complexContent mixed="false"> | |||
<s:extension base="tns:ResultDTO"> | |||
<s:sequence> | |||
<s:element minOccurs="0" maxOccurs="1" name="Record" type="tns:ArrayOfEcardSaveRecordDTO" /> | |||
</s:sequence> | |||
</s:extension> | |||
</s:complexContent> | |||
</s:complexType> | |||
<s:complexType name="ArrayOfEcardSaveRecordDTO"> | |||
<s:sequence> | |||
<s:element minOccurs="0" maxOccurs="unbounded" name="EcardSaveRecordDTO" nillable="true" type="tns:EcardSaveRecordDTO" /> | |||
</s:sequence> | |||
</s:complexType> | |||
<s:complexType name="EcardSaveRecordDTO"> | |||
<s:sequence> | |||
<s:element minOccurs="1" maxOccurs="1" name="SOURCETABLE" type="s:int" /> | |||
<s:element minOccurs="1" maxOccurs="1" name="ID" type="s:long" /> | |||
<s:element minOccurs="1" maxOccurs="1" name="NOTECASE" type="s:int" /> | |||
<s:element minOccurs="1" maxOccurs="1" name="CUSTOMERID" type="s:int" /> | |||
<s:element minOccurs="0" maxOccurs="1" name="OUTID" type="s:string" /> | |||
<s:element minOccurs="1" maxOccurs="1" name="CARDSN" type="s:int" /> | |||
<s:element minOccurs="1" maxOccurs="1" name="SAVEOPCOUNT" type="s:int" /> | |||
<s:element minOccurs="1" maxOccurs="1" name="OPCOUNT" type="s:int" /> | |||
<s:element minOccurs="1" maxOccurs="1" name="OPDT" type="s:dateTime" /> | |||
<s:element minOccurs="1" maxOccurs="1" name="ODDFARE" type="s:decimal" /> | |||
<s:element minOccurs="1" maxOccurs="1" name="OPFARE" type="s:decimal" /> | |||
<s:element minOccurs="1" maxOccurs="1" name="MNGFARE" type="s:decimal" /> | |||
<s:element minOccurs="1" maxOccurs="1" name="ACCCODE" type="s:int" /> | |||
<s:element minOccurs="0" maxOccurs="1" name="DSCRP" type="s:string" /> | |||
<s:element minOccurs="1" maxOccurs="1" name="TERMID" type="s:int" /> | |||
<s:element minOccurs="1" maxOccurs="1" name="RECNO" type="s:int" /> | |||
<s:element minOccurs="1" maxOccurs="1" name="UPLOADDATE" type="s:dateTime" /> | |||
<s:element minOccurs="1" maxOccurs="1" name="SAMCARDNO" type="s:long" /> | |||
<s:element minOccurs="1" maxOccurs="1" name="SAMTRADENO" type="s:long" /> | |||
<s:element minOccurs="1" maxOccurs="1" name="TRADECARDTYPE" type="s:long" /> | |||
<s:element minOccurs="1" maxOccurs="1" name="TAC" type="s:long" /> | |||
<s:element minOccurs="0" maxOccurs="1" name="ASN" type="s:string" /> | |||
<s:element minOccurs="0" maxOccurs="1" name="ECODE" type="s:string" /> | |||
</s:sequence> | |||
</s:complexType> | |||
<s:element name="GetEcardDeptInfo"> | |||
<s:complexType> | |||
<s:sequence> | |||
<s:element minOccurs="0" maxOccurs="1" name="ecode" type="s:string" /> | |||
<s:element minOccurs="1" maxOccurs="1" name="maxCstaccfc" type="s:long" /> | |||
<s:element minOccurs="1" maxOccurs="1" name="RowCount" type="s:int" /> | |||
</s:sequence> | |||
</s:complexType> | |||
</s:element> | |||
<s:element name="GetEcardDeptInfoResponse"> | |||
<s:complexType> | |||
<s:sequence> | |||
<s:element minOccurs="0" maxOccurs="1" name="GetEcardDeptInfoResult" type="tns:ResultDTOOfEcardDeptDTO" /> | |||
</s:sequence> | |||
</s:complexType> | |||
</s:element> | |||
<s:complexType name="ResultDTOOfEcardDeptDTO"> | |||
<s:complexContent mixed="false"> | |||
<s:extension base="tns:ResultDTO"> | |||
<s:sequence> | |||
<s:element minOccurs="0" maxOccurs="1" name="Record" type="tns:ArrayOfEcardDeptDTO" /> | |||
</s:sequence> | |||
</s:extension> | |||
</s:complexContent> | |||
</s:complexType> | |||
<s:complexType name="ArrayOfEcardDeptDTO"> | |||
<s:sequence> | |||
<s:element minOccurs="0" maxOccurs="unbounded" name="EcardDeptDTO" nillable="true" type="tns:EcardDeptDTO" /> | |||
</s:sequence> | |||
</s:complexType> | |||
<s:complexType name="EcardDeptDTO"> | |||
<s:sequence> | |||
<s:element minOccurs="0" maxOccurs="1" name="DPTCODE" type="s:string" /> | |||
<s:element minOccurs="0" maxOccurs="1" name="DPTNAME" type="s:string" /> | |||
<s:element minOccurs="0" maxOccurs="1" name="DPTCODE_P" type="s:string" /> | |||
<s:element minOccurs="1" maxOccurs="1" name="VER" type="s:long" /> | |||
<s:element minOccurs="0" maxOccurs="1" name="ECODE" type="s:string" /> | |||
<s:element minOccurs="1" maxOccurs="1" name="UPDATEFLAG" type="s:int" /> | |||
<s:element minOccurs="1" maxOccurs="1" name="UPDATEDT" type="s:dateTime" /> | |||
</s:sequence> | |||
</s:complexType> | |||
<s:element name="GetEcardTermInfo"> | |||
<s:complexType> | |||
<s:sequence> | |||
<s:element minOccurs="0" maxOccurs="1" name="ecode" type="s:string" /> | |||
<s:element minOccurs="1" maxOccurs="1" name="maxCstaccfc" type="s:long" /> | |||
<s:element minOccurs="1" maxOccurs="1" name="RowCount" type="s:int" /> | |||
</s:sequence> | |||
</s:complexType> | |||
</s:element> | |||
<s:element name="GetEcardTermInfoResponse"> | |||
<s:complexType> | |||
<s:sequence> | |||
<s:element minOccurs="0" maxOccurs="1" name="GetEcardTermInfoResult" type="tns:ResultDTOOfEcardTermDTO" /> | |||
</s:sequence> | |||
</s:complexType> | |||
</s:element> | |||
<s:complexType name="ResultDTOOfEcardTermDTO"> | |||
<s:complexContent mixed="false"> | |||
<s:extension base="tns:ResultDTO"> | |||
<s:sequence> | |||
<s:element minOccurs="0" maxOccurs="1" name="Record" type="tns:ArrayOfEcardTermDTO" /> | |||
</s:sequence> | |||
</s:extension> | |||
</s:complexContent> | |||
</s:complexType> | |||
<s:complexType name="ArrayOfEcardTermDTO"> | |||
<s:sequence> | |||
<s:element minOccurs="0" maxOccurs="unbounded" name="EcardTermDTO" nillable="true" type="tns:EcardTermDTO" /> | |||
</s:sequence> | |||
</s:complexType> | |||
<s:complexType name="EcardTermDTO"> | |||
<s:sequence> | |||
<s:element minOccurs="1" maxOccurs="1" name="TERMID" type="s:int" /> | |||
<s:element minOccurs="0" maxOccurs="1" name="TERMNAME" type="s:string" /> | |||
<s:element minOccurs="0" maxOccurs="1" name="TERMADDR" type="s:string" /> | |||
<s:element minOccurs="0" maxOccurs="1" name="DPTCODE" type="s:string" /> | |||
<s:element minOccurs="1" maxOccurs="1" name="ACCCODE" type="s:int" /> | |||
<s:element minOccurs="0" maxOccurs="1" name="DSCRP" type="s:string" /> | |||
<s:element minOccurs="1" maxOccurs="1" name="ISUSE" type="s:int" /> | |||
<s:element minOccurs="1" maxOccurs="1" name="EXTENDEDTERMADDR" type="s:int" /> | |||
<s:element minOccurs="1" maxOccurs="1" name="POSCODE" type="s:long" /> | |||
<s:element minOccurs="1" maxOccurs="1" name="TYPEID" type="s:int" /> | |||
<s:element minOccurs="1" maxOccurs="1" name="SAMCARDNO" type="s:long" /> | |||
<s:element minOccurs="1" maxOccurs="1" name="COMMODE" type="s:long" /> | |||
<s:element minOccurs="0" maxOccurs="1" name="ALLDPTCODE" type="s:string" /> | |||
<s:element minOccurs="1" maxOccurs="1" name="VER" type="s:long" /> | |||
<s:element minOccurs="0" maxOccurs="1" name="ECODE" type="s:string" /> | |||
</s:sequence> | |||
</s:complexType> | |||
</s:schema> | |||
</wsdl:types> | |||
<wsdl:message name="GetTokenSoapIn"> | |||
<wsdl:part name="parameters" element="tns:GetToken" /> | |||
</wsdl:message> | |||
<wsdl:message name="GetTokenSoapOut"> | |||
<wsdl:part name="parameters" element="tns:GetTokenResponse" /> | |||
</wsdl:message> | |||
<wsdl:message name="LogonSoapIn"> | |||
<wsdl:part name="parameters" element="tns:Logon" /> | |||
</wsdl:message> | |||
<wsdl:message name="LogonSoapOut"> | |||
<wsdl:part name="parameters" element="tns:LogonResponse" /> | |||
</wsdl:message> | |||
<wsdl:message name="GetEcardCustInfoByOutIDSoapIn"> | |||
<wsdl:part name="parameters" element="tns:GetEcardCustInfoByOutID" /> | |||
</wsdl:message> | |||
<wsdl:message name="GetEcardCustInfoByOutIDSoapOut"> | |||
<wsdl:part name="parameters" element="tns:GetEcardCustInfoByOutIDResponse" /> | |||
</wsdl:message> | |||
<wsdl:message name="GetCustFareInfoByOutIDSoapIn"> | |||
<wsdl:part name="parameters" element="tns:GetCustFareInfoByOutID" /> | |||
</wsdl:message> | |||
<wsdl:message name="GetCustFareInfoByOutIDSoapOut"> | |||
<wsdl:part name="parameters" element="tns:GetCustFareInfoByOutIDResponse" /> | |||
</wsdl:message> | |||
<wsdl:message name="GetEcardConsumeRecordSoapIn"> | |||
<wsdl:part name="parameters" element="tns:GetEcardConsumeRecord" /> | |||
</wsdl:message> | |||
<wsdl:message name="GetEcardConsumeRecordSoapOut"> | |||
<wsdl:part name="parameters" element="tns:GetEcardConsumeRecordResponse" /> | |||
</wsdl:message> | |||
<wsdl:message name="GetEcardSaveRecordSoapIn"> | |||
<wsdl:part name="parameters" element="tns:GetEcardSaveRecord" /> | |||
</wsdl:message> | |||
<wsdl:message name="GetEcardSaveRecordSoapOut"> | |||
<wsdl:part name="parameters" element="tns:GetEcardSaveRecordResponse" /> | |||
</wsdl:message> | |||
<wsdl:message name="GetEcardDeptInfoSoapIn"> | |||
<wsdl:part name="parameters" element="tns:GetEcardDeptInfo" /> | |||
</wsdl:message> | |||
<wsdl:message name="GetEcardDeptInfoSoapOut"> | |||
<wsdl:part name="parameters" element="tns:GetEcardDeptInfoResponse" /> | |||
</wsdl:message> | |||
<wsdl:message name="GetEcardTermInfoSoapIn"> | |||
<wsdl:part name="parameters" element="tns:GetEcardTermInfo" /> | |||
</wsdl:message> | |||
<wsdl:message name="GetEcardTermInfoSoapOut"> | |||
<wsdl:part name="parameters" element="tns:GetEcardTermInfoResponse" /> | |||
</wsdl:message> | |||
<wsdl:portType name="SynServiceSoap"> | |||
<wsdl:operation name="GetToken"> | |||
<wsdl:input message="tns:GetTokenSoapIn" /> | |||
<wsdl:output message="tns:GetTokenSoapOut" /> | |||
</wsdl:operation> | |||
<wsdl:operation name="Logon"> | |||
<wsdl:input message="tns:LogonSoapIn" /> | |||
<wsdl:output message="tns:LogonSoapOut" /> | |||
</wsdl:operation> | |||
<wsdl:operation name="GetEcardCustInfoByOutID"> | |||
<wsdl:input message="tns:GetEcardCustInfoByOutIDSoapIn" /> | |||
<wsdl:output message="tns:GetEcardCustInfoByOutIDSoapOut" /> | |||
</wsdl:operation> | |||
<wsdl:operation name="GetCustFareInfoByOutID"> | |||
<wsdl:input message="tns:GetCustFareInfoByOutIDSoapIn" /> | |||
<wsdl:output message="tns:GetCustFareInfoByOutIDSoapOut" /> | |||
</wsdl:operation> | |||
<wsdl:operation name="GetEcardConsumeRecord"> | |||
<wsdl:input message="tns:GetEcardConsumeRecordSoapIn" /> | |||
<wsdl:output message="tns:GetEcardConsumeRecordSoapOut" /> | |||
</wsdl:operation> | |||
<wsdl:operation name="GetEcardSaveRecord"> | |||
<wsdl:input message="tns:GetEcardSaveRecordSoapIn" /> | |||
<wsdl:output message="tns:GetEcardSaveRecordSoapOut" /> | |||
</wsdl:operation> | |||
<wsdl:operation name="GetEcardDeptInfo"> | |||
<wsdl:input message="tns:GetEcardDeptInfoSoapIn" /> | |||
<wsdl:output message="tns:GetEcardDeptInfoSoapOut" /> | |||
</wsdl:operation> | |||
<wsdl:operation name="GetEcardTermInfo"> | |||
<wsdl:input message="tns:GetEcardTermInfoSoapIn" /> | |||
<wsdl:output message="tns:GetEcardTermInfoSoapOut" /> | |||
</wsdl:operation> | |||
</wsdl:portType> | |||
<wsdl:binding name="SynServiceSoap" type="tns:SynServiceSoap"> | |||
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" /> | |||
<wsdl:operation name="GetToken"> | |||
<soap:operation soapAction="http://www.newcapec.com.cn/GetToken" style="document" /> | |||
<wsdl:input> | |||
<soap:body use="literal" /> | |||
</wsdl:input> | |||
<wsdl:output> | |||
<soap:body use="literal" /> | |||
</wsdl:output> | |||
</wsdl:operation> | |||
<wsdl:operation name="Logon"> | |||
<soap:operation soapAction="http://www.newcapec.com.cn/Logon" style="document" /> | |||
<wsdl:input> | |||
<soap:body use="literal" /> | |||
</wsdl:input> | |||
<wsdl:output> | |||
<soap:body use="literal" /> | |||
</wsdl:output> | |||
</wsdl:operation> | |||
<wsdl:operation name="GetEcardCustInfoByOutID"> | |||
<soap:operation soapAction="http://www.newcapec.com.cn/GetEcardCustInfoByOutID" style="document" /> | |||
<wsdl:input> | |||
<soap:body use="literal" /> | |||
</wsdl:input> | |||
<wsdl:output> | |||
<soap:body use="literal" /> | |||
</wsdl:output> | |||
</wsdl:operation> | |||
<wsdl:operation name="GetCustFareInfoByOutID"> | |||
<soap:operation soapAction="http://www.newcapec.com.cn/GetCustFareInfoByOutID" style="document" /> | |||
<wsdl:input> | |||
<soap:body use="literal" /> | |||
</wsdl:input> | |||
<wsdl:output> | |||
<soap:body use="literal" /> | |||
</wsdl:output> | |||
</wsdl:operation> | |||
<wsdl:operation name="GetEcardConsumeRecord"> | |||
<soap:operation soapAction="http://www.newcapec.com.cn/GetEcardConsumeRecord" style="document" /> | |||
<wsdl:input> | |||
<soap:body use="literal" /> | |||
</wsdl:input> | |||
<wsdl:output> | |||
<soap:body use="literal" /> | |||
</wsdl:output> | |||
</wsdl:operation> | |||
<wsdl:operation name="GetEcardSaveRecord"> | |||
<soap:operation soapAction="http://www.newcapec.com.cn/GetEcardSaveRecord" style="document" /> | |||
<wsdl:input> | |||
<soap:body use="literal" /> | |||
</wsdl:input> | |||
<wsdl:output> | |||
<soap:body use="literal" /> | |||
</wsdl:output> | |||
</wsdl:operation> | |||
<wsdl:operation name="GetEcardDeptInfo"> | |||
<soap:operation soapAction="http://www.newcapec.com.cn/GetEcardDeptInfo" style="document" /> | |||
<wsdl:input> | |||
<soap:body use="literal" /> | |||
</wsdl:input> | |||
<wsdl:output> | |||
<soap:body use="literal" /> | |||
</wsdl:output> | |||
</wsdl:operation> | |||
<wsdl:operation name="GetEcardTermInfo"> | |||
<soap:operation soapAction="http://www.newcapec.com.cn/GetEcardTermInfo" style="document" /> | |||
<wsdl:input> | |||
<soap:body use="literal" /> | |||
</wsdl:input> | |||
<wsdl:output> | |||
<soap:body use="literal" /> | |||
</wsdl:output> | |||
</wsdl:operation> | |||
</wsdl:binding> | |||
<wsdl:binding name="SynServiceSoap12" type="tns:SynServiceSoap"> | |||
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http" /> | |||
<wsdl:operation name="GetToken"> | |||
<soap12:operation soapAction="http://www.newcapec.com.cn/GetToken" style="document" /> | |||
<wsdl:input> | |||
<soap12:body use="literal" /> | |||
</wsdl:input> | |||
<wsdl:output> | |||
<soap12:body use="literal" /> | |||
</wsdl:output> | |||
</wsdl:operation> | |||
<wsdl:operation name="Logon"> | |||
<soap12:operation soapAction="http://www.newcapec.com.cn/Logon" style="document" /> | |||
<wsdl:input> | |||
<soap12:body use="literal" /> | |||
</wsdl:input> | |||
<wsdl:output> | |||
<soap12:body use="literal" /> | |||
</wsdl:output> | |||
</wsdl:operation> | |||
<wsdl:operation name="GetEcardCustInfoByOutID"> | |||
<soap12:operation soapAction="http://www.newcapec.com.cn/GetEcardCustInfoByOutID" style="document" /> | |||
<wsdl:input> | |||
<soap12:body use="literal" /> | |||
</wsdl:input> | |||
<wsdl:output> | |||
<soap12:body use="literal" /> | |||
</wsdl:output> | |||
</wsdl:operation> | |||
<wsdl:operation name="GetCustFareInfoByOutID"> | |||
<soap12:operation soapAction="http://www.newcapec.com.cn/GetCustFareInfoByOutID" style="document" /> | |||
<wsdl:input> | |||
<soap12:body use="literal" /> | |||
</wsdl:input> | |||
<wsdl:output> | |||
<soap12:body use="literal" /> | |||
</wsdl:output> | |||
</wsdl:operation> | |||
<wsdl:operation name="GetEcardConsumeRecord"> | |||
<soap12:operation soapAction="http://www.newcapec.com.cn/GetEcardConsumeRecord" style="document" /> | |||
<wsdl:input> | |||
<soap12:body use="literal" /> | |||
</wsdl:input> | |||
<wsdl:output> | |||
<soap12:body use="literal" /> | |||
</wsdl:output> | |||
</wsdl:operation> | |||
<wsdl:operation name="GetEcardSaveRecord"> | |||
<soap12:operation soapAction="http://www.newcapec.com.cn/GetEcardSaveRecord" style="document" /> | |||
<wsdl:input> | |||
<soap12:body use="literal" /> | |||
</wsdl:input> | |||
<wsdl:output> | |||
<soap12:body use="literal" /> | |||
</wsdl:output> | |||
</wsdl:operation> | |||
<wsdl:operation name="GetEcardDeptInfo"> | |||
<soap12:operation soapAction="http://www.newcapec.com.cn/GetEcardDeptInfo" style="document" /> | |||
<wsdl:input> | |||
<soap12:body use="literal" /> | |||
</wsdl:input> | |||
<wsdl:output> | |||
<soap12:body use="literal" /> | |||
</wsdl:output> | |||
</wsdl:operation> | |||
<wsdl:operation name="GetEcardTermInfo"> | |||
<soap12:operation soapAction="http://www.newcapec.com.cn/GetEcardTermInfo" style="document" /> | |||
<wsdl:input> | |||
<soap12:body use="literal" /> | |||
</wsdl:input> | |||
<wsdl:output> | |||
<soap12:body use="literal" /> | |||
</wsdl:output> | |||
</wsdl:operation> | |||
</wsdl:binding> | |||
<wsdl:service name="SynService"> | |||
<wsdl:port name="SynServiceSoap" binding="tns:SynServiceSoap"> | |||
<soap:address location="http://218.28.133.181:13282/SYN/SynService.asmx" /> | |||
</wsdl:port> | |||
<wsdl:port name="SynServiceSoap12" binding="tns:SynServiceSoap12"> | |||
<soap12:address location="http://218.28.133.181:13282/SYN/SynService.asmx" /> | |||
</wsdl:port> | |||
</wsdl:service> | |||
</wsdl:definitions> |
@@ -0,0 +1,10 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<!-- | |||
This file is automatically generated by Visual Studio .Net. It is | |||
used to store generic object data source configuration information. | |||
Renaming the file extension or editing the content of this file may | |||
cause the file to be unrecognizable by the program. | |||
--> | |||
<GenericObjectDataSource DisplayName="GetCustFareInfoByOutIDResponse" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource"> | |||
<TypeInfo>DigitalSchoolApi.SynServiceReference.GetCustFareInfoByOutIDResponse, Connected Services.SynServiceReference.Reference.cs.dll, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo> | |||
</GenericObjectDataSource> |
@@ -0,0 +1,10 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<!-- | |||
This file is automatically generated by Visual Studio .Net. It is | |||
used to store generic object data source configuration information. | |||
Renaming the file extension or editing the content of this file may | |||
cause the file to be unrecognizable by the program. | |||
--> | |||
<GenericObjectDataSource DisplayName="GetEcardConsumeRecordResponse" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource"> | |||
<TypeInfo>DigitalSchoolApi.SynServiceReference.GetEcardConsumeRecordResponse, Connected Services.SynServiceReference.Reference.cs.dll, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo> | |||
</GenericObjectDataSource> |
@@ -0,0 +1,10 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<!-- | |||
This file is automatically generated by Visual Studio .Net. It is | |||
used to store generic object data source configuration information. | |||
Renaming the file extension or editing the content of this file may | |||
cause the file to be unrecognizable by the program. | |||
--> | |||
<GenericObjectDataSource DisplayName="GetEcardCustInfoByOutIDResponse" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource"> | |||
<TypeInfo>DigitalSchoolApi.SynServiceReference.GetEcardCustInfoByOutIDResponse, Connected Services.SynServiceReference.Reference.cs.dll, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo> | |||
</GenericObjectDataSource> |
@@ -0,0 +1,10 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<!-- | |||
This file is automatically generated by Visual Studio .Net. It is | |||
used to store generic object data source configuration information. | |||
Renaming the file extension or editing the content of this file may | |||
cause the file to be unrecognizable by the program. | |||
--> | |||
<GenericObjectDataSource DisplayName="GetEcardDeptInfoResponse" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource"> | |||
<TypeInfo>DigitalSchoolApi.SynServiceReference.GetEcardDeptInfoResponse, Connected Services.SynServiceReference.Reference.cs.dll, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo> | |||
</GenericObjectDataSource> |
@@ -0,0 +1,10 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<!-- | |||
This file is automatically generated by Visual Studio .Net. It is | |||
used to store generic object data source configuration information. | |||
Renaming the file extension or editing the content of this file may | |||
cause the file to be unrecognizable by the program. | |||
--> | |||
<GenericObjectDataSource DisplayName="GetEcardSaveRecordResponse" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource"> | |||
<TypeInfo>DigitalSchoolApi.SynServiceReference.GetEcardSaveRecordResponse, Connected Services.SynServiceReference.Reference.cs.dll, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo> | |||
</GenericObjectDataSource> |
@@ -0,0 +1,10 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<!-- | |||
This file is automatically generated by Visual Studio .Net. It is | |||
used to store generic object data source configuration information. | |||
Renaming the file extension or editing the content of this file may | |||
cause the file to be unrecognizable by the program. | |||
--> | |||
<GenericObjectDataSource DisplayName="GetEcardTermInfoResponse" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource"> | |||
<TypeInfo>DigitalSchoolApi.SynServiceReference.GetEcardTermInfoResponse, Connected Services.SynServiceReference.Reference.cs.dll, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo> | |||
</GenericObjectDataSource> |
@@ -0,0 +1,10 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<!-- | |||
This file is automatically generated by Visual Studio .Net. It is | |||
used to store generic object data source configuration information. | |||
Renaming the file extension or editing the content of this file may | |||
cause the file to be unrecognizable by the program. | |||
--> | |||
<GenericObjectDataSource DisplayName="GetTokenResponse" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource"> | |||
<TypeInfo>DigitalSchoolApi.SynServiceReference.GetTokenResponse, Connected Services.SynServiceReference.Reference.cs.dll, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo> | |||
</GenericObjectDataSource> |
@@ -0,0 +1,10 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<!-- | |||
This file is automatically generated by Visual Studio .Net. It is | |||
used to store generic object data source configuration information. | |||
Renaming the file extension or editing the content of this file may | |||
cause the file to be unrecognizable by the program. | |||
--> | |||
<GenericObjectDataSource DisplayName="LogonResponse" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource"> | |||
<TypeInfo>DigitalSchoolApi.SynServiceReference.LogonResponse, Connected Services.SynServiceReference.Reference.cs.dll, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo> | |||
</GenericObjectDataSource> |
@@ -0,0 +1,10 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<!-- | |||
This file is automatically generated by Visual Studio .Net. It is | |||
used to store generic object data source configuration information. | |||
Renaming the file extension or editing the content of this file may | |||
cause the file to be unrecognizable by the program. | |||
--> | |||
<GenericObjectDataSource DisplayName="ResultDTO" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource"> | |||
<TypeInfo>DigitalSchoolApi.SynServiceReference.ResultDTO, Connected Services.SynServiceReference.Reference.cs.dll, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo> | |||
</GenericObjectDataSource> |
@@ -0,0 +1,10 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<!-- | |||
This file is automatically generated by Visual Studio .Net. It is | |||
used to store generic object data source configuration information. | |||
Renaming the file extension or editing the content of this file may | |||
cause the file to be unrecognizable by the program. | |||
--> | |||
<GenericObjectDataSource DisplayName="ResultDTOOfEcardConsumeRecordDTO" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource"> | |||
<TypeInfo>DigitalSchoolApi.SynServiceReference.ResultDTOOfEcardConsumeRecordDTO, Connected Services.SynServiceReference.Reference.cs.dll, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo> | |||
</GenericObjectDataSource> |
@@ -0,0 +1,10 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<!-- | |||
This file is automatically generated by Visual Studio .Net. It is | |||
used to store generic object data source configuration information. | |||
Renaming the file extension or editing the content of this file may | |||
cause the file to be unrecognizable by the program. | |||
--> | |||
<GenericObjectDataSource DisplayName="ResultDTOOfEcardCustAllInfoDTO" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource"> | |||
<TypeInfo>DigitalSchoolApi.SynServiceReference.ResultDTOOfEcardCustAllInfoDTO, Connected Services.SynServiceReference.Reference.cs.dll, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo> | |||
</GenericObjectDataSource> |
@@ -0,0 +1,10 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<!-- | |||
This file is automatically generated by Visual Studio .Net. It is | |||
used to store generic object data source configuration information. | |||
Renaming the file extension or editing the content of this file may | |||
cause the file to be unrecognizable by the program. | |||
--> | |||
<GenericObjectDataSource DisplayName="ResultDTOOfEcardCustomerFareInfo" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource"> | |||
<TypeInfo>DigitalSchoolApi.SynServiceReference.ResultDTOOfEcardCustomerFareInfo, Connected Services.SynServiceReference.Reference.cs.dll, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo> | |||
</GenericObjectDataSource> |
@@ -0,0 +1,10 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<!-- | |||
This file is automatically generated by Visual Studio .Net. It is | |||
used to store generic object data source configuration information. | |||
Renaming the file extension or editing the content of this file may | |||
cause the file to be unrecognizable by the program. | |||
--> | |||
<GenericObjectDataSource DisplayName="ResultDTOOfEcardDeptDTO" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource"> | |||
<TypeInfo>DigitalSchoolApi.SynServiceReference.ResultDTOOfEcardDeptDTO, Connected Services.SynServiceReference.Reference.cs.dll, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo> | |||
</GenericObjectDataSource> |
@@ -0,0 +1,10 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<!-- | |||
This file is automatically generated by Visual Studio .Net. It is | |||
used to store generic object data source configuration information. | |||
Renaming the file extension or editing the content of this file may | |||
cause the file to be unrecognizable by the program. | |||
--> | |||
<GenericObjectDataSource DisplayName="ResultDTOOfEcardSaveRecordDTO" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource"> | |||
<TypeInfo>DigitalSchoolApi.SynServiceReference.ResultDTOOfEcardSaveRecordDTO, Connected Services.SynServiceReference.Reference.cs.dll, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo> | |||
</GenericObjectDataSource> |
@@ -0,0 +1,10 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<!-- | |||
This file is automatically generated by Visual Studio .Net. It is | |||
used to store generic object data source configuration information. | |||
Renaming the file extension or editing the content of this file may | |||
cause the file to be unrecognizable by the program. | |||
--> | |||
<GenericObjectDataSource DisplayName="ResultDTOOfEcardTermDTO" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource"> | |||
<TypeInfo>DigitalSchoolApi.SynServiceReference.ResultDTOOfEcardTermDTO, Connected Services.SynServiceReference.Reference.cs.dll, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo> | |||
</GenericObjectDataSource> |
@@ -0,0 +1,10 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<configurationSnapshot xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:schemas-microsoft-com:xml-wcfconfigurationsnapshot"> | |||
<behaviors /> | |||
<bindings> | |||
<binding digest="System.ServiceModel.Configuration.BasicHttpBindingElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089:<?xml version="1.0" encoding="utf-16"?><Data name="SynServiceSoap" />" bindingType="basicHttpBinding" name="SynServiceSoap" /> | |||
</bindings> | |||
<endpoints> | |||
<endpoint normalizedDigest="<?xml version="1.0" encoding="utf-16"?><Data address="http://218.28.133.181:13282/SYN/SynService.asmx" binding="basicHttpBinding" bindingConfiguration="SynServiceSoap" contract="SynServiceReference.SynServiceSoap" name="SynServiceSoap" />" digest="<?xml version="1.0" encoding="utf-16"?><Data address="http://218.28.133.181:13282/SYN/SynService.asmx" binding="basicHttpBinding" bindingConfiguration="SynServiceSoap" contract="SynServiceReference.SynServiceSoap" name="SynServiceSoap" />" contractName="SynServiceReference.SynServiceSoap" name="SynServiceSoap" /> | |||
</endpoints> | |||
</configurationSnapshot> |
@@ -0,0 +1,201 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<SavedWcfConfigurationInformation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Version="9.1" CheckSum="eOs8jkUSLjXDsFbbIwSx45r+IBM="> | |||
<bindingConfigurations> | |||
<bindingConfiguration bindingType="basicHttpBinding" name="SynServiceSoap"> | |||
<properties> | |||
<property path="/name" isComplexType="false" isExplicitlyDefined="true" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||
<serializedValue>SynServiceSoap</serializedValue> | |||
</property> | |||
<property path="/closeTimeout" isComplexType="false" isExplicitlyDefined="true" clrType="System.TimeSpan, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||
<serializedValue /> | |||
</property> | |||
<property path="/openTimeout" isComplexType="false" isExplicitlyDefined="true" clrType="System.TimeSpan, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||
<serializedValue /> | |||
</property> | |||
<property path="/receiveTimeout" isComplexType="false" isExplicitlyDefined="true" clrType="System.TimeSpan, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||
<serializedValue /> | |||
</property> | |||
<property path="/sendTimeout" isComplexType="false" isExplicitlyDefined="true" clrType="System.TimeSpan, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||
<serializedValue /> | |||
</property> | |||
<property path="/allowCookies" isComplexType="false" isExplicitlyDefined="true" clrType="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||
<serializedValue /> | |||
</property> | |||
<property path="/bypassProxyOnLocal" isComplexType="false" isExplicitlyDefined="true" clrType="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||
<serializedValue /> | |||
</property> | |||
<property path="/hostNameComparisonMode" isComplexType="false" isExplicitlyDefined="false" clrType="System.ServiceModel.HostNameComparisonMode, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||
<serializedValue>StrongWildcard</serializedValue> | |||
</property> | |||
<property path="/maxBufferPoolSize" isComplexType="false" isExplicitlyDefined="true" clrType="System.Int64, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||
<serializedValue /> | |||
</property> | |||
<property path="/maxBufferSize" isComplexType="false" isExplicitlyDefined="false" clrType="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||
<serializedValue>65536</serializedValue> | |||
</property> | |||
<property path="/maxReceivedMessageSize" isComplexType="false" isExplicitlyDefined="true" clrType="System.Int64, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||
<serializedValue /> | |||
</property> | |||
<property path="/proxyAddress" isComplexType="false" isExplicitlyDefined="false" clrType="System.Uri, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||
<serializedValue /> | |||
</property> | |||
<property path="/readerQuotas" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.XmlDictionaryReaderQuotasElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||
<serializedValue>System.ServiceModel.Configuration.XmlDictionaryReaderQuotasElement</serializedValue> | |||
</property> | |||
<property path="/readerQuotas/maxDepth" isComplexType="false" isExplicitlyDefined="false" clrType="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||
<serializedValue>0</serializedValue> | |||
</property> | |||
<property path="/readerQuotas/maxStringContentLength" isComplexType="false" isExplicitlyDefined="false" clrType="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||
<serializedValue>0</serializedValue> | |||
</property> | |||
<property path="/readerQuotas/maxArrayLength" isComplexType="false" isExplicitlyDefined="false" clrType="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||
<serializedValue>0</serializedValue> | |||
</property> | |||
<property path="/readerQuotas/maxBytesPerRead" isComplexType="false" isExplicitlyDefined="false" clrType="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||
<serializedValue>0</serializedValue> | |||
</property> | |||
<property path="/readerQuotas/maxNameTableCharCount" isComplexType="false" isExplicitlyDefined="false" clrType="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||
<serializedValue>0</serializedValue> | |||
</property> | |||
<property path="/textEncoding" isComplexType="false" isExplicitlyDefined="false" clrType="System.Text.Encoding, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||
<serializedValue>System.Text.UTF8Encoding</serializedValue> | |||
</property> | |||
<property path="/transferMode" isComplexType="false" isExplicitlyDefined="false" clrType="System.ServiceModel.TransferMode, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||
<serializedValue>Buffered</serializedValue> | |||
</property> | |||
<property path="/useDefaultWebProxy" isComplexType="false" isExplicitlyDefined="true" clrType="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||
<serializedValue /> | |||
</property> | |||
<property path="/messageEncoding" isComplexType="false" isExplicitlyDefined="false" clrType="System.ServiceModel.WSMessageEncoding, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||
<serializedValue>Text</serializedValue> | |||
</property> | |||
<property path="/security" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.BasicHttpSecurityElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||
<serializedValue>System.ServiceModel.Configuration.BasicHttpSecurityElement</serializedValue> | |||
</property> | |||
<property path="/security/mode" isComplexType="false" isExplicitlyDefined="false" clrType="System.ServiceModel.BasicHttpSecurityMode, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||
<serializedValue>None</serializedValue> | |||
</property> | |||
<property path="/security/transport" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.HttpTransportSecurityElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||
<serializedValue>System.ServiceModel.Configuration.HttpTransportSecurityElement</serializedValue> | |||
</property> | |||
<property path="/security/transport/clientCredentialType" isComplexType="false" isExplicitlyDefined="false" clrType="System.ServiceModel.HttpClientCredentialType, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||
<serializedValue>None</serializedValue> | |||
</property> | |||
<property path="/security/transport/proxyCredentialType" isComplexType="false" isExplicitlyDefined="false" clrType="System.ServiceModel.HttpProxyCredentialType, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||
<serializedValue>None</serializedValue> | |||
</property> | |||
<property path="/security/transport/extendedProtectionPolicy" isComplexType="true" isExplicitlyDefined="false" clrType="System.Security.Authentication.ExtendedProtection.Configuration.ExtendedProtectionPolicyElement, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||
<serializedValue>System.Security.Authentication.ExtendedProtection.Configuration.ExtendedProtectionPolicyElement</serializedValue> | |||
</property> | |||
<property path="/security/transport/extendedProtectionPolicy/policyEnforcement" isComplexType="false" isExplicitlyDefined="false" clrType="System.Security.Authentication.ExtendedProtection.PolicyEnforcement, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||
<serializedValue>Never</serializedValue> | |||
</property> | |||
<property path="/security/transport/extendedProtectionPolicy/protectionScenario" isComplexType="false" isExplicitlyDefined="false" clrType="System.Security.Authentication.ExtendedProtection.ProtectionScenario, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||
<serializedValue>TransportSelected</serializedValue> | |||
</property> | |||
<property path="/security/transport/extendedProtectionPolicy/customServiceNames" isComplexType="true" isExplicitlyDefined="false" clrType="System.Security.Authentication.ExtendedProtection.Configuration.ServiceNameElementCollection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||
<serializedValue>(集合)</serializedValue> | |||
</property> | |||
<property path="/security/transport/realm" isComplexType="false" isExplicitlyDefined="false" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||
<serializedValue /> | |||
</property> | |||
<property path="/security/message" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.BasicHttpMessageSecurityElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||
<serializedValue>System.ServiceModel.Configuration.BasicHttpMessageSecurityElement</serializedValue> | |||
</property> | |||
<property path="/security/message/clientCredentialType" isComplexType="false" isExplicitlyDefined="false" clrType="System.ServiceModel.BasicHttpMessageCredentialType, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||
<serializedValue>UserName</serializedValue> | |||
</property> | |||
<property path="/security/message/algorithmSuite" isComplexType="false" isExplicitlyDefined="false" clrType="System.ServiceModel.Security.SecurityAlgorithmSuite, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||
<serializedValue>Default</serializedValue> | |||
</property> | |||
</properties> | |||
</bindingConfiguration> | |||
</bindingConfigurations> | |||
<endpoints> | |||
<endpoint name="SynServiceSoap" contract="SynServiceReference.SynServiceSoap" bindingType="basicHttpBinding" address="http://218.28.133.181:13282/SYN/SynService.asmx" bindingConfiguration="SynServiceSoap"> | |||
<properties> | |||
<property path="/address" isComplexType="false" isExplicitlyDefined="true" clrType="System.Uri, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||
<serializedValue>http://218.28.133.181:13282/SYN/SynService.asmx</serializedValue> | |||
</property> | |||
<property path="/behaviorConfiguration" isComplexType="false" isExplicitlyDefined="false" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||
<serializedValue /> | |||
</property> | |||
<property path="/binding" isComplexType="false" isExplicitlyDefined="true" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||
<serializedValue>basicHttpBinding</serializedValue> | |||
</property> | |||
<property path="/bindingConfiguration" isComplexType="false" isExplicitlyDefined="true" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||
<serializedValue>SynServiceSoap</serializedValue> | |||
</property> | |||
<property path="/contract" isComplexType="false" isExplicitlyDefined="true" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||
<serializedValue>SynServiceReference.SynServiceSoap</serializedValue> | |||
</property> | |||
<property path="/headers" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.AddressHeaderCollectionElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||
<serializedValue>System.ServiceModel.Configuration.AddressHeaderCollectionElement</serializedValue> | |||
</property> | |||
<property path="/headers/headers" isComplexType="false" isExplicitlyDefined="true" clrType="System.ServiceModel.Channels.AddressHeaderCollection, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||
<serializedValue><Header /></serializedValue> | |||
</property> | |||
<property path="/identity" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.IdentityElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||
<serializedValue>System.ServiceModel.Configuration.IdentityElement</serializedValue> | |||
</property> | |||
<property path="/identity/userPrincipalName" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.UserPrincipalNameElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||
<serializedValue>System.ServiceModel.Configuration.UserPrincipalNameElement</serializedValue> | |||
</property> | |||
<property path="/identity/userPrincipalName/value" isComplexType="false" isExplicitlyDefined="false" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||
<serializedValue /> | |||
</property> | |||
<property path="/identity/servicePrincipalName" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.ServicePrincipalNameElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||
<serializedValue>System.ServiceModel.Configuration.ServicePrincipalNameElement</serializedValue> | |||
</property> | |||
<property path="/identity/servicePrincipalName/value" isComplexType="false" isExplicitlyDefined="false" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||
<serializedValue /> | |||
</property> | |||
<property path="/identity/dns" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.DnsElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||
<serializedValue>System.ServiceModel.Configuration.DnsElement</serializedValue> | |||
</property> | |||
<property path="/identity/dns/value" isComplexType="false" isExplicitlyDefined="false" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||
<serializedValue /> | |||
</property> | |||
<property path="/identity/rsa" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.RsaElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||
<serializedValue>System.ServiceModel.Configuration.RsaElement</serializedValue> | |||
</property> | |||
<property path="/identity/rsa/value" isComplexType="false" isExplicitlyDefined="false" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||
<serializedValue /> | |||
</property> | |||
<property path="/identity/certificate" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.CertificateElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||
<serializedValue>System.ServiceModel.Configuration.CertificateElement</serializedValue> | |||
</property> | |||
<property path="/identity/certificate/encodedValue" isComplexType="false" isExplicitlyDefined="false" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||
<serializedValue /> | |||
</property> | |||
<property path="/identity/certificateReference" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.CertificateReferenceElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||
<serializedValue>System.ServiceModel.Configuration.CertificateReferenceElement</serializedValue> | |||
</property> | |||
<property path="/identity/certificateReference/storeName" isComplexType="false" isExplicitlyDefined="false" clrType="System.Security.Cryptography.X509Certificates.StoreName, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||
<serializedValue>My</serializedValue> | |||
</property> | |||
<property path="/identity/certificateReference/storeLocation" isComplexType="false" isExplicitlyDefined="false" clrType="System.Security.Cryptography.X509Certificates.StoreLocation, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||
<serializedValue>LocalMachine</serializedValue> | |||
</property> | |||
<property path="/identity/certificateReference/x509FindType" isComplexType="false" isExplicitlyDefined="false" clrType="System.Security.Cryptography.X509Certificates.X509FindType, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||
<serializedValue>FindBySubjectDistinguishedName</serializedValue> | |||
</property> | |||
<property path="/identity/certificateReference/findValue" isComplexType="false" isExplicitlyDefined="false" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||
<serializedValue /> | |||
</property> | |||
<property path="/identity/certificateReference/isChainIncluded" isComplexType="false" isExplicitlyDefined="false" clrType="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||
<serializedValue>False</serializedValue> | |||
</property> | |||
<property path="/name" isComplexType="false" isExplicitlyDefined="true" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||
<serializedValue>SynServiceSoap</serializedValue> | |||
</property> | |||
<property path="/kind" isComplexType="false" isExplicitlyDefined="false" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||
<serializedValue /> | |||
</property> | |||
<property path="/endpointConfiguration" isComplexType="false" isExplicitlyDefined="false" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||
<serializedValue /> | |||
</property> | |||
</properties> | |||
</endpoint> | |||
</endpoints> | |||
</SavedWcfConfigurationInformation> |
@@ -0,0 +1,18 @@ | |||
body { | |||
padding-top: 50px; | |||
padding-bottom: 20px; | |||
} | |||
/* Set padding to keep content from hitting the edges */ | |||
.body-content { | |||
padding-left: 15px; | |||
padding-right: 15px; | |||
} | |||
/* Set width on the form input elements since they're 100% wide by default */ | |||
input, | |||
select, | |||
textarea { | |||
max-width: 280px; | |||
} | |||
@@ -0,0 +1,384 @@ | |||
.btn-default, | |||
.btn-primary, | |||
.btn-success, | |||
.btn-info, | |||
.btn-warning, | |||
.btn-danger { | |||
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.2); | |||
-webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 1px 1px rgba(0, 0, 0, 0.075); | |||
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 1px 1px rgba(0, 0, 0, 0.075); | |||
} | |||
.btn-default:active, | |||
.btn-primary:active, | |||
.btn-success:active, | |||
.btn-info:active, | |||
.btn-warning:active, | |||
.btn-danger:active, | |||
.btn-default.active, | |||
.btn-primary.active, | |||
.btn-success.active, | |||
.btn-info.active, | |||
.btn-warning.active, | |||
.btn-danger.active { | |||
-webkit-box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125); | |||
box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125); | |||
} | |||
.btn:active, | |||
.btn.active { | |||
background-image: none; | |||
} | |||
.btn-default { | |||
text-shadow: 0 1px 0 #fff; | |||
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#ffffff), to(#e6e6e6)); | |||
background-image: -webkit-linear-gradient(top, #ffffff, 0%, #e6e6e6, 100%); | |||
background-image: -moz-linear-gradient(top, #ffffff 0%, #e6e6e6 100%); | |||
background-image: linear-gradient(to bottom, #ffffff 0%, #e6e6e6 100%); | |||
background-repeat: repeat-x; | |||
border-color: #e0e0e0; | |||
border-color: #ccc; | |||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffe6e6e6', GradientType=0); | |||
} | |||
.btn-default:active, | |||
.btn-default.active { | |||
background-color: #e6e6e6; | |||
border-color: #e0e0e0; | |||
} | |||
.btn-primary { | |||
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#428bca), to(#3071a9)); | |||
background-image: -webkit-linear-gradient(top, #428bca, 0%, #3071a9, 100%); | |||
background-image: -moz-linear-gradient(top, #428bca 0%, #3071a9 100%); | |||
background-image: linear-gradient(to bottom, #428bca 0%, #3071a9 100%); | |||
background-repeat: repeat-x; | |||
border-color: #2d6ca2; | |||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca', endColorstr='#ff3071a9', GradientType=0); | |||
} | |||
.btn-primary:active, | |||
.btn-primary.active { | |||
background-color: #3071a9; | |||
border-color: #2d6ca2; | |||
} | |||
.btn-success { | |||
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#5cb85c), to(#449d44)); | |||
background-image: -webkit-linear-gradient(top, #5cb85c, 0%, #449d44, 100%); | |||
background-image: -moz-linear-gradient(top, #5cb85c 0%, #449d44 100%); | |||
background-image: linear-gradient(to bottom, #5cb85c 0%, #449d44 100%); | |||
background-repeat: repeat-x; | |||
border-color: #419641; | |||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5cb85c', endColorstr='#ff449d44', GradientType=0); | |||
} | |||
.btn-success:active, | |||
.btn-success.active { | |||
background-color: #449d44; | |||
border-color: #419641; | |||
} | |||
.btn-warning { | |||
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#f0ad4e), to(#ec971f)); | |||
background-image: -webkit-linear-gradient(top, #f0ad4e, 0%, #ec971f, 100%); | |||
background-image: -moz-linear-gradient(top, #f0ad4e 0%, #ec971f 100%); | |||
background-image: linear-gradient(to bottom, #f0ad4e 0%, #ec971f 100%); | |||
background-repeat: repeat-x; | |||
border-color: #eb9316; | |||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff0ad4e', endColorstr='#ffec971f', GradientType=0); | |||
} | |||
.btn-warning:active, | |||
.btn-warning.active { | |||
background-color: #ec971f; | |||
border-color: #eb9316; | |||
} | |||
.btn-danger { | |||
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#d9534f), to(#c9302c)); | |||
background-image: -webkit-linear-gradient(top, #d9534f, 0%, #c9302c, 100%); | |||
background-image: -moz-linear-gradient(top, #d9534f 0%, #c9302c 100%); | |||
background-image: linear-gradient(to bottom, #d9534f 0%, #c9302c 100%); | |||
background-repeat: repeat-x; | |||
border-color: #c12e2a; | |||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9534f', endColorstr='#ffc9302c', GradientType=0); | |||
} | |||
.btn-danger:active, | |||
.btn-danger.active { | |||
background-color: #c9302c; | |||
border-color: #c12e2a; | |||
} | |||
.btn-info { | |||
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#5bc0de), to(#31b0d5)); | |||
background-image: -webkit-linear-gradient(top, #5bc0de, 0%, #31b0d5, 100%); | |||
background-image: -moz-linear-gradient(top, #5bc0de 0%, #31b0d5 100%); | |||
background-image: linear-gradient(to bottom, #5bc0de 0%, #31b0d5 100%); | |||
background-repeat: repeat-x; | |||
border-color: #2aabd2; | |||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de', endColorstr='#ff31b0d5', GradientType=0); | |||
} | |||
.btn-info:active, | |||
.btn-info.active { | |||
background-color: #31b0d5; | |||
border-color: #2aabd2; | |||
} | |||
.thumbnail, | |||
.img-thumbnail { | |||
-webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.075); | |||
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.075); | |||
} | |||
.dropdown-menu > li > a:hover, | |||
.dropdown-menu > li > a:focus, | |||
.dropdown-menu > .active > a, | |||
.dropdown-menu > .active > a:hover, | |||
.dropdown-menu > .active > a:focus { | |||
background-color: #357ebd; | |||
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#428bca), to(#357ebd)); | |||
background-image: -webkit-linear-gradient(top, #428bca, 0%, #357ebd, 100%); | |||
background-image: -moz-linear-gradient(top, #428bca 0%, #357ebd 100%); | |||
background-image: linear-gradient(to bottom, #428bca 0%, #357ebd 100%); | |||
background-repeat: repeat-x; | |||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca', endColorstr='#ff357ebd', GradientType=0); | |||
} | |||
.navbar { | |||
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#ffffff), to(#f8f8f8)); | |||
background-image: -webkit-linear-gradient(top, #ffffff, 0%, #f8f8f8, 100%); | |||
background-image: -moz-linear-gradient(top, #ffffff 0%, #f8f8f8 100%); | |||
background-image: linear-gradient(to bottom, #ffffff 0%, #f8f8f8 100%); | |||
background-repeat: repeat-x; | |||
border-radius: 4px; | |||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#fff8f8f8', GradientType=0); | |||
-webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 1px 5px rgba(0, 0, 0, 0.075); | |||
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 1px 5px rgba(0, 0, 0, 0.075); | |||
} | |||
.navbar .navbar-nav > .active > a { | |||
background-color: #f8f8f8; | |||
} | |||
.navbar-brand, | |||
.navbar-nav > li > a { | |||
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.25); | |||
} | |||
.navbar-inverse { | |||
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#3c3c3c), to(#222222)); | |||
background-image: -webkit-linear-gradient(top, #3c3c3c, 0%, #222222, 100%); | |||
background-image: -moz-linear-gradient(top, #3c3c3c 0%, #222222 100%); | |||
background-image: linear-gradient(to bottom, #3c3c3c 0%, #222222 100%); | |||
background-repeat: repeat-x; | |||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff3c3c3c', endColorstr='#ff222222', GradientType=0); | |||
} | |||
.navbar-inverse .navbar-nav > .active > a { | |||
background-color: #222222; | |||
} | |||
.navbar-inverse .navbar-brand, | |||
.navbar-inverse .navbar-nav > li > a { | |||
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); | |||
} | |||
.navbar-static-top, | |||
.navbar-fixed-top, | |||
.navbar-fixed-bottom { | |||
border-radius: 0; | |||
} | |||
.alert { | |||
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.2); | |||
-webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 1px 2px rgba(0, 0, 0, 0.05); | |||
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 1px 2px rgba(0, 0, 0, 0.05); | |||
} | |||
.alert-success { | |||
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#dff0d8), to(#c8e5bc)); | |||
background-image: -webkit-linear-gradient(top, #dff0d8, 0%, #c8e5bc, 100%); | |||
background-image: -moz-linear-gradient(top, #dff0d8 0%, #c8e5bc 100%); | |||
background-image: linear-gradient(to bottom, #dff0d8 0%, #c8e5bc 100%); | |||
background-repeat: repeat-x; | |||
border-color: #b2dba1; | |||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdff0d8', endColorstr='#ffc8e5bc', GradientType=0); | |||
} | |||
.alert-info { | |||
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#d9edf7), to(#b9def0)); | |||
background-image: -webkit-linear-gradient(top, #d9edf7, 0%, #b9def0, 100%); | |||
background-image: -moz-linear-gradient(top, #d9edf7 0%, #b9def0 100%); | |||
background-image: linear-gradient(to bottom, #d9edf7 0%, #b9def0 100%); | |||
background-repeat: repeat-x; | |||
border-color: #9acfea; | |||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9edf7', endColorstr='#ffb9def0', GradientType=0); | |||
} | |||
.alert-warning { | |||
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#fcf8e3), to(#f8efc0)); | |||
background-image: -webkit-linear-gradient(top, #fcf8e3, 0%, #f8efc0, 100%); | |||
background-image: -moz-linear-gradient(top, #fcf8e3 0%, #f8efc0 100%); | |||
background-image: linear-gradient(to bottom, #fcf8e3 0%, #f8efc0 100%); | |||
background-repeat: repeat-x; | |||
border-color: #f5e79e; | |||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffcf8e3', endColorstr='#fff8efc0', GradientType=0); | |||
} | |||
.alert-danger { | |||
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#f2dede), to(#e7c3c3)); | |||
background-image: -webkit-linear-gradient(top, #f2dede, 0%, #e7c3c3, 100%); | |||
background-image: -moz-linear-gradient(top, #f2dede 0%, #e7c3c3 100%); | |||
background-image: linear-gradient(to bottom, #f2dede 0%, #e7c3c3 100%); | |||
background-repeat: repeat-x; | |||
border-color: #dca7a7; | |||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2dede', endColorstr='#ffe7c3c3', GradientType=0); | |||
} | |||
.progress { | |||
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#ebebeb), to(#f5f5f5)); | |||
background-image: -webkit-linear-gradient(top, #ebebeb, 0%, #f5f5f5, 100%); | |||
background-image: -moz-linear-gradient(top, #ebebeb 0%, #f5f5f5 100%); | |||
background-image: linear-gradient(to bottom, #ebebeb 0%, #f5f5f5 100%); | |||
background-repeat: repeat-x; | |||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffebebeb', endColorstr='#fff5f5f5', GradientType=0); | |||
} | |||
.progress-bar { | |||
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#428bca), to(#3071a9)); | |||
background-image: -webkit-linear-gradient(top, #428bca, 0%, #3071a9, 100%); | |||
background-image: -moz-linear-gradient(top, #428bca 0%, #3071a9 100%); | |||
background-image: linear-gradient(to bottom, #428bca 0%, #3071a9 100%); | |||
background-repeat: repeat-x; | |||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca', endColorstr='#ff3071a9', GradientType=0); | |||
} | |||
.progress-bar-success { | |||
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#5cb85c), to(#449d44)); | |||
background-image: -webkit-linear-gradient(top, #5cb85c, 0%, #449d44, 100%); | |||
background-image: -moz-linear-gradient(top, #5cb85c 0%, #449d44 100%); | |||
background-image: linear-gradient(to bottom, #5cb85c 0%, #449d44 100%); | |||
background-repeat: repeat-x; | |||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5cb85c', endColorstr='#ff449d44', GradientType=0); | |||
} | |||
.progress-bar-info { | |||
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#5bc0de), to(#31b0d5)); | |||
background-image: -webkit-linear-gradient(top, #5bc0de, 0%, #31b0d5, 100%); | |||
background-image: -moz-linear-gradient(top, #5bc0de 0%, #31b0d5 100%); | |||
background-image: linear-gradient(to bottom, #5bc0de 0%, #31b0d5 100%); | |||
background-repeat: repeat-x; | |||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de', endColorstr='#ff31b0d5', GradientType=0); | |||
} | |||
.progress-bar-warning { | |||
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#f0ad4e), to(#ec971f)); | |||
background-image: -webkit-linear-gradient(top, #f0ad4e, 0%, #ec971f, 100%); | |||
background-image: -moz-linear-gradient(top, #f0ad4e 0%, #ec971f 100%); | |||
background-image: linear-gradient(to bottom, #f0ad4e 0%, #ec971f 100%); | |||
background-repeat: repeat-x; | |||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff0ad4e', endColorstr='#ffec971f', GradientType=0); | |||
} | |||
.progress-bar-danger { | |||
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#d9534f), to(#c9302c)); | |||
background-image: -webkit-linear-gradient(top, #d9534f, 0%, #c9302c, 100%); | |||
background-image: -moz-linear-gradient(top, #d9534f 0%, #c9302c 100%); | |||
background-image: linear-gradient(to bottom, #d9534f 0%, #c9302c 100%); | |||
background-repeat: repeat-x; | |||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9534f', endColorstr='#ffc9302c', GradientType=0); | |||
} | |||
.list-group { | |||
border-radius: 4px; | |||
-webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.075); | |||
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.075); | |||
} | |||
.list-group-item.active, | |||
.list-group-item.active:hover, | |||
.list-group-item.active:focus { | |||
text-shadow: 0 -1px 0 #3071a9; | |||
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#428bca), to(#3278b3)); | |||
background-image: -webkit-linear-gradient(top, #428bca, 0%, #3278b3, 100%); | |||
background-image: -moz-linear-gradient(top, #428bca 0%, #3278b3 100%); | |||
background-image: linear-gradient(to bottom, #428bca 0%, #3278b3 100%); | |||
background-repeat: repeat-x; | |||
border-color: #3278b3; | |||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca', endColorstr='#ff3278b3', GradientType=0); | |||
} | |||
.panel { | |||
-webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05); | |||
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05); | |||
} | |||
.panel-default > .panel-heading { | |||
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#f5f5f5), to(#e8e8e8)); | |||
background-image: -webkit-linear-gradient(top, #f5f5f5, 0%, #e8e8e8, 100%); | |||
background-image: -moz-linear-gradient(top, #f5f5f5 0%, #e8e8e8 100%); | |||
background-image: linear-gradient(to bottom, #f5f5f5 0%, #e8e8e8 100%); | |||
background-repeat: repeat-x; | |||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5', endColorstr='#ffe8e8e8', GradientType=0); | |||
} | |||
.panel-primary > .panel-heading { | |||
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#428bca), to(#357ebd)); | |||
background-image: -webkit-linear-gradient(top, #428bca, 0%, #357ebd, 100%); | |||
background-image: -moz-linear-gradient(top, #428bca 0%, #357ebd 100%); | |||
background-image: linear-gradient(to bottom, #428bca 0%, #357ebd 100%); | |||
background-repeat: repeat-x; | |||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca', endColorstr='#ff357ebd', GradientType=0); | |||
} | |||
.panel-success > .panel-heading { | |||
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#dff0d8), to(#d0e9c6)); | |||
background-image: -webkit-linear-gradient(top, #dff0d8, 0%, #d0e9c6, 100%); | |||
background-image: -moz-linear-gradient(top, #dff0d8 0%, #d0e9c6 100%); | |||
background-image: linear-gradient(to bottom, #dff0d8 0%, #d0e9c6 100%); | |||
background-repeat: repeat-x; | |||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdff0d8', endColorstr='#ffd0e9c6', GradientType=0); | |||
} | |||
.panel-info > .panel-heading { | |||
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#d9edf7), to(#c4e3f3)); | |||
background-image: -webkit-linear-gradient(top, #d9edf7, 0%, #c4e3f3, 100%); | |||
background-image: -moz-linear-gradient(top, #d9edf7 0%, #c4e3f3 100%); | |||
background-image: linear-gradient(to bottom, #d9edf7 0%, #c4e3f3 100%); | |||
background-repeat: repeat-x; | |||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9edf7', endColorstr='#ffc4e3f3', GradientType=0); | |||
} | |||
.panel-warning > .panel-heading { | |||
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#fcf8e3), to(#faf2cc)); | |||
background-image: -webkit-linear-gradient(top, #fcf8e3, 0%, #faf2cc, 100%); | |||
background-image: -moz-linear-gradient(top, #fcf8e3 0%, #faf2cc 100%); | |||
background-image: linear-gradient(to bottom, #fcf8e3 0%, #faf2cc 100%); | |||
background-repeat: repeat-x; | |||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffcf8e3', endColorstr='#fffaf2cc', GradientType=0); | |||
} | |||
.panel-danger > .panel-heading { | |||
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#f2dede), to(#ebcccc)); | |||
background-image: -webkit-linear-gradient(top, #f2dede, 0%, #ebcccc, 100%); | |||
background-image: -moz-linear-gradient(top, #f2dede 0%, #ebcccc 100%); | |||
background-image: linear-gradient(to bottom, #f2dede 0%, #ebcccc 100%); | |||
background-repeat: repeat-x; | |||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2dede', endColorstr='#ffebcccc', GradientType=0); | |||
} | |||
.well { | |||
background-image: -webkit-gradient(linear, left 0%, left 100%, from(#e8e8e8), to(#f5f5f5)); | |||
background-image: -webkit-linear-gradient(top, #e8e8e8, 0%, #f5f5f5, 100%); | |||
background-image: -moz-linear-gradient(top, #e8e8e8 0%, #f5f5f5 100%); | |||
background-image: linear-gradient(to bottom, #e8e8e8 0%, #f5f5f5 100%); | |||
background-repeat: repeat-x; | |||
border-color: #dcdcdc; | |||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffe8e8e8', endColorstr='#fff5f5f5', GradientType=0); | |||
-webkit-box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 0 rgba(255, 255, 255, 0.1); | |||
box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 0 rgba(255, 255, 255, 0.1); | |||
} |
@@ -0,0 +1,34 @@ | |||
/*.topbar-wrapper img[alt="Swagger UI"], .topbar-wrapper span { | |||
visibility: hidden; | |||
} | |||
.topbar-wrapper span:after { | |||
content: url('logo.png'); | |||
color: #fff; | |||
visibility: visible; | |||
display: block; | |||
position: absolute; | |||
padding: 5px; | |||
top: 2px; | |||
}*/ | |||
/*.swagger-section #header .logo__img { | |||
content: url(logoImage); | |||
width: 50%; | |||
height: 50%; | |||
}*/ | |||
/*.topbar-wrapper img[alt="Swagger UI"]{ | |||
visibility: hidden; | |||
} | |||
#swagger-ui > section > div.topbar > div > div > a > img { | |||
content: url(../logoImage); | |||
}*/ | |||
.topbar-wrapper img[alt="Swagger UI"], .topbar-wrapper span { | |||
visibility: collapse; | |||
} | |||
.topbar-wrapper .link:after { | |||
content: url(../logoImage); | |||
display: block; | |||
position: absolute; | |||
top: 10px; | |||
} |
@@ -0,0 +1,18 @@ | |||
<?xml version="1.0" encoding="gb2312" standalone="yes" ?> | |||
<TX> | |||
<REQUEST_SN>2020111112121212</REQUEST_SN> | |||
<CUST_ID>105000082201406</CUST_ID> | |||
<USER_ID>002</USER_ID> | |||
<PASSWORD>xcyz123456</PASSWORD> | |||
<TX_CODE>5W1002</TX_CODE> | |||
<LANGUAGE>CN</LANGUAGE> | |||
<TX_INFO> | |||
<KIND>0</KIND> | |||
<ORDER>¶©µ¥ºÅ</ORDER> | |||
<DEXCEL>1</DEXCEL> | |||
<NORDERBY>1</NORDERBY> | |||
<PAGE>0</PAGE> | |||
<POS_CODE>043724806</POS_CODE> | |||
<STATUS>3</STATUS> | |||
</TX_INFO> | |||
</TX> |
@@ -0,0 +1,46 @@ | |||
using System.Net; | |||
using System.Web.Http; | |||
using DigitalSchoolApi.Models; | |||
using Newtonsoft.Json; | |||
namespace DigitalSchoolApi.Controllers | |||
{ | |||
/// <summary> | |||
/// 基础API | |||
/// </summary> | |||
public class BaseController : ApiController | |||
{ | |||
/// <summary> | |||
/// 请求成功 | |||
/// </summary> | |||
/// <param name="result">操作结果</param> | |||
/// <param name="info">自定义消息</param> | |||
/// <param name="code">http状态码</param> | |||
/// <param name="data">返回数据</param> | |||
/// <returns></returns> | |||
protected IHttpActionResult ResultInfo(object data = null, HttpStatusCode code = HttpStatusCode.OK, Result result = Result.Success, string info = "") | |||
{ | |||
if (string.IsNullOrEmpty(info)) | |||
{ | |||
switch (result) | |||
{ | |||
case Result.Fail: | |||
info = "操作失败"; | |||
break; | |||
case Result.NotFound: | |||
info = "未找到相关数据"; | |||
break; | |||
default: | |||
info = "请求成功"; | |||
break; | |||
} | |||
} | |||
return Json(new OperateResult<object> { StatusCode = code, Result = result, Message = info, Data = data }, | |||
new JsonSerializerSettings() | |||
{ | |||
NullValueHandling = NullValueHandling.Ignore,DateFormatString = "yyyy-MM-dd HH:mm:ss" | |||
}); | |||
} | |||
} | |||
} |
@@ -0,0 +1,842 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Configuration; | |||
using System.Data; | |||
using System.Data.OracleClient; | |||
using System.Data.SqlClient; | |||
using System.Linq; | |||
using System.Net; | |||
using System.Net.Http; | |||
using System.Text; | |||
using System.Text.RegularExpressions; | |||
using System.Threading.Tasks; | |||
using System.Web; | |||
using Dapper; | |||
using DigitalSchoolApi.Models; | |||
using Learun.Application.Organization; | |||
using Learun.Util; | |||
using Microsoft.AspNet.SignalR.Client; | |||
using Newtonsoft.Json; | |||
using Convert = System.Convert; | |||
namespace DigitalSchoolApi.Controllers | |||
{ | |||
/// <summary> | |||
/// 长阳宿舍管理--晚归预警 | |||
/// </summary> | |||
public class CYDormitoryReturnController | |||
{ | |||
private readonly static string _admsConnection = ConfigurationManager.ConnectionStrings["CoreDBString"].ConnectionString; | |||
private readonly static string _misConnection = ConfigurationManager.ConnectionStrings["ConnectionPfcMisDBString"].ConnectionString; | |||
private static string _cyzjMiddleConnection = ConfigurationManager.ConnectionStrings["CYZJMiddleDBString"].ConnectionString; | |||
public static string TestOracle() | |||
{ | |||
try | |||
{ | |||
using (IDbConnection conn = new OracleConnection(_cyzjMiddleConnection)) | |||
{ | |||
try | |||
{ | |||
string result = ""; | |||
List<string> testtable = "ODS_DZZQKJCSJ,ODS_DYFZQKJCSJ,ODS_DJHDDYGBXXSJ,ODS_DJHDSHYKSJ,ODS_DJHDDYDHSJ,ODS_DJHDDYRCSJ,ODS_DJHDDYZTDRSJ,ODS_CJSXHDSJ,ODS_ZZCJSTHDSJ,ODS_DYHDSJ".Split(',').ToList(); | |||
foreach (var sqlitem in testtable) | |||
{ | |||
string _sql = $"SELECT COUNT(*) FROM {sqlitem.ToUpper()} WHERE IsPush = '0' "; | |||
result+=conn.ExecuteScalar<string>(_sql); | |||
} | |||
return result; | |||
} | |||
catch (Exception e) | |||
{ | |||
using (IDbConnection conncore = new SqlConnection(_admsConnection)) | |||
{ | |||
conncore.Execute( | |||
"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),998,'中间库读取异常','" + | |||
e.Message + "',getdate())"); | |||
} | |||
return ""; | |||
} | |||
} | |||
} | |||
catch (Exception e) | |||
{ | |||
Console.WriteLine(e); | |||
return ""; | |||
} | |||
} | |||
/// <summary> | |||
/// 超过设置的晚归时间后,推送到负责人 | |||
/// </summary> | |||
/// <returns></returns> | |||
public static void LateReturnPush() | |||
{ | |||
try | |||
{ | |||
using (IDbConnection admscon = new SqlConnection(_admsConnection)) | |||
{ | |||
admscon.Execute( | |||
"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),998,'寝室晚归预警','开始推送',getdate())"); | |||
//读取信息推送管理-晚归预警推送(10)的配置 | |||
var informationPushEntity = admscon.QueryFirstOrDefault<Sys_InformationPushEntity>("select top 1 * from Sys_InformationPush where PushItem='10'"); | |||
if (informationPushEntity != null && informationPushEntity.Status == true) | |||
{ | |||
using (IDbConnection conn = new SqlConnection(_misConnection)) | |||
{ | |||
//晚归规则 | |||
var ruleEntity = conn | |||
.QueryFirstOrDefault<Acc_DormitoryRuleEntity>("select top 1 * from Acc_DormitoryRule where IsEnable=1"); | |||
if (ruleEntity != null) | |||
{ | |||
//晚归时间 | |||
var LateReturnTime = ruleEntity.LateReturnTime; | |||
//判断当前时间是否超过晚归时间 | |||
var datenow = DateTime.Now.ToString("yyyy-MM-dd"); | |||
//晚归时间 | |||
DateTime lateReturnTime = Convert.ToDateTime(datenow + " " + LateReturnTime); | |||
//大于晚归时间 | |||
if (DateTime.Now > lateReturnTime) | |||
{ | |||
//获取晚归学生 | |||
string sql = | |||
$@"select distinct d.StudentId,s.StuName,p.Class from [dbo].[Acc_DormitoryReturn] t join [dbo].[Acc_DormitoryBuild] d on t.DormitoryBuildId=d.Id | |||
left join [dbo].[Acc_DormitoryBuild] p on d.ParentId=p.id | |||
left join [dbo].[StuInfoBasic] s on d.StudentId=s.StuNo | |||
where DateDiff(dd,t.CheckDate,getdate())=0 and t.OutTime<'{lateReturnTime}' and (t.ReturnTime is null or len(t.ReturnTime)=0) | |||
"; | |||
var returnList = conn.Query<DormitoryReturn>(sql); | |||
if (returnList.Count() > 0) | |||
{ | |||
//推送人 | |||
var pushUser = ruleEntity.PushUser.Split(',').ToList(); | |||
var title = "寝室晚归预警"; | |||
var contents = ""; | |||
if (ruleEntity.ClassDiredctor == 1) | |||
{ | |||
//推送班主任 | |||
//根据班级分组 | |||
var groupList = returnList.GroupBy(x => x.Class); | |||
foreach (var group in groupList) | |||
{ | |||
var stunames = string.Join(",", group.Select(x => x.StuName + "(" + x.StudentId + ")").ToList()); | |||
//获取班主任 | |||
var ClassDiredctorNo = | |||
conn.QueryFirstOrDefault<ClassInfoEntity>( | |||
$"select * from ClassInfo where ClassNo='{group.Key}'") | |||
?.ClassDiredctorNo; | |||
var teacher = admscon.Query<UserEntity>($"select top 1 * from lr_base_user where f_encode='{ClassDiredctorNo}' and F_EnabledMark=1 and F_Description='教师'"); | |||
if (teacher != null) | |||
{ | |||
contents = "班级:" + ClassDiredctorNo + ",学生:" + stunames; | |||
//微信推送 | |||
try | |||
{ | |||
PushWeixin(teacher.ToList(), title); | |||
} | |||
catch (Exception e) | |||
{ | |||
} | |||
PushFeixing(teacher.ToList(), title, contents); | |||
//消息提醒 | |||
PushMessage(teacher.ToList(), title, contents); | |||
} | |||
} | |||
} | |||
//推送人 | |||
var uids = string.Join("','", pushUser); | |||
var userList = admscon.Query<UserEntity>($"select * from lr_base_user where F_EnabledMark=1 and F_DeleteMark<>1 and f_userid in ('{uids}')"); | |||
contents = "学生:"; | |||
foreach (var stu in returnList) | |||
{ | |||
contents += stu.StuName + "(" + "班级:" + stu.Class + ")" + "、"; | |||
} | |||
if (contents.Contains("、")) | |||
{ | |||
contents = contents.Substring(0, contents.Length - 1); | |||
} | |||
//微信推送 | |||
try | |||
{ | |||
PushWeixin(userList.ToList(), title); | |||
} | |||
catch (Exception e) | |||
{ | |||
} | |||
//飞星推送 | |||
PushFeixing(userList.ToList(), title, contents); | |||
//消息提醒 | |||
PushMessage(userList.ToList(), title, contents); | |||
} | |||
} | |||
} | |||
} | |||
} | |||
} | |||
} | |||
catch (Exception ex) | |||
{ | |||
using (IDbConnection conn = new SqlConnection(_admsConnection)) | |||
{ | |||
conn.Execute( | |||
$"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),998,'寝室晚归预警推送发生异常','{ex.Message}',getdate())"); | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 推送微信 | |||
/// </summary> | |||
/// <param name="needpostuserlist"></param> | |||
/// <param name="title"></param> | |||
public static void PushWeixin(List<UserEntity> needpostuserlist, string title) | |||
{ | |||
using (IDbConnection admscon = new SqlConnection(_admsConnection)) | |||
{ | |||
var WeChatConfigentity = admscon.QueryFirstOrDefault<WeChatConfigEntity>("select top 1 * from WeChatConfig where IsEnable=1"); | |||
if (WeChatConfigentity != null) | |||
{ | |||
var wechatemplete = admscon.QueryFirstOrDefault<WeChatTemplateEntity>($"select top 1 * from WeChatTemplate where WeID='{WeChatConfigentity.ID}' and TCode='task'"); | |||
if (wechatemplete != null) | |||
{ | |||
string appid = WeChatConfigentity.APPId; | |||
string secret = WeChatConfigentity.secret; | |||
string weixintaskurl = wechatemplete.TUrl; | |||
string weixintasktempid = wechatemplete.TempId; | |||
var responsejson = HttpMethods.HttpGet("https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" + appid + "&secret=" + secret); | |||
foreach (UserEntity userinfo in needpostuserlist) | |||
{ | |||
if (userinfo != null && !string.IsNullOrEmpty(userinfo.OpenIdForWeixin)) | |||
{ | |||
//执行推送任务 | |||
if (!string.IsNullOrEmpty(appid) && !string.IsNullOrEmpty(secret) && !string.IsNullOrEmpty(weixintaskurl) && !string.IsNullOrEmpty(weixintasktempid)) | |||
{ | |||
if (!string.IsNullOrEmpty(responsejson)) | |||
{ | |||
var weixintokenobj = JsonConvert.DeserializeObject<dynamic>(responsejson); | |||
if (string.IsNullOrEmpty(weixintokenobj.errcode)) | |||
{ | |||
string access_token = weixintokenobj.access_token; | |||
string jsondata = "{\"touser\":\"" + userinfo.OpenIdForWeixin + "\"," + | |||
"\"template_id\":\"" + weixintasktempid + "\"," + | |||
"\"url\":\"" + weixintaskurl + "\"," + | |||
"\"data\":{" + | |||
"\"first\": {\"value\":\"您有新的寝室晚归预警\",\"color\":\"#173177\"}," + | |||
"\"keyword1\":{\"value\":\"寝室晚归预警\",\"color\":\"#173177\"}," + | |||
"\"keyword2\": {\"value\":\"" + title + "\",\"color\":\"#173177\"}," + | |||
"\"keyword3\": {\"value\":\"待查看\",\"color\":\"#173177\"}," + | |||
"\"keyword4\": {\"value\":\"您有新的寝室晚归预警需要查看【" + title + "】\",\"color\":\"#173177\"}" + | |||
"}" + | |||
"}"; | |||
string pushresult = HttpMethods.HttpPost("https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=" + access_token, jsondata); | |||
} | |||
} | |||
} | |||
} | |||
} | |||
} | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 飞星推送 | |||
/// </summary> | |||
/// <param name="needpostuserlist"></param> | |||
/// <param name="title"></param> | |||
/// <param name="contents"></param> | |||
public static void PushFeixing(List<UserEntity> needpostuserlist, string title, string contents) | |||
{ | |||
Task.Run(async () => | |||
{ | |||
using (var hubConnection = new HubConnection( | |||
ConfigurationManager.AppSettings["CommunicationServeraddress"])) | |||
{ | |||
var hubProxy = hubConnection.CreateHubProxy("SignalRHub"); | |||
await hubConnection.Start(); | |||
await hubProxy.Invoke("PushAnnouncement", "System", title, | |||
ReplaceHtml(HttpUtility.HtmlDecode(contents)).Length < 20 ? ReplaceHtml(HttpUtility.HtmlDecode(contents)) : ReplaceHtml(HttpUtility.HtmlDecode(contents)).Substring(0, 20), "latereturnpush", | |||
string.Join(",", needpostuserlist.Select(m => m.F_UserId)), ""); | |||
} | |||
}); | |||
} | |||
/// <summary> | |||
/// 推送消息提醒 | |||
/// </summary> | |||
/// <param name="needpostuserlist"></param> | |||
/// <param name="title"></param> | |||
/// <param name="contents"></param> | |||
public static void PushMessage(List<UserEntity> needpostuserlist, string title, string contents) | |||
{ | |||
using (IDbConnection admscon = new SqlConnection(_admsConnection)) | |||
{ | |||
foreach (UserEntity userinfo in needpostuserlist) | |||
{ | |||
string sql = | |||
$"insert into MessageRemind(MessageId,ReceiptId,ReceiptName,SenderId,SenderName,TheTitle,TheContent,ConnectionUrl,SendTime,ReadSigns) values(newid(),'{userinfo.F_UserId}','{userinfo.F_RealName}','Syatem','管理员','晚归预警','{contents}','/LogisticsManagement/DormitoryReturn/Index',getdate(),0)"; | |||
admscon.Execute(sql); | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 往oracle中间库中同步数校部门信息 | |||
/// </summary> | |||
public static void SyncDepartment() | |||
{ | |||
try | |||
{ | |||
IEnumerable<DepartmentEntity> departmentList = null; | |||
using (IDbConnection conn = new SqlConnection(_admsConnection)) | |||
{ | |||
departmentList = conn.Query<DepartmentEntity>("select t.F_DepartmentId,t.F_ParentId,t.F_EnCode,t.F_FullName,t.F_Manager,t.F_SchoolMasterId,t.F_Order from LR_Base_Department t where t.F_DeleteMark=0 and t.F_EnabledMark=1 "); | |||
} | |||
using (IDbConnection conn = new OracleConnection(_cyzjMiddleConnection)) | |||
{ | |||
try | |||
{ | |||
conn.Execute($"truncate table DS_Department");//success | |||
foreach (var item in departmentList) | |||
{ | |||
var sql2 = new StringBuilder(); | |||
sql2.Append("insert into DS_Department(Id,ParentId,Code,Name,ManagerId,SMId,\"ORDER\") "); | |||
sql2.Append(" VALUES('" + item.F_DepartmentId + "','" + (item.F_ParentId == null ? "0" : item.F_ParentId) + "','" + item.F_EnCode + "','" + item.F_FullName + "','" + (item.F_Manager == null ? "" : item.F_Manager) + "','" + (item.F_SchoolMasterId == null ? "" : item.F_SchoolMasterId) + "'," + (item.F_Order == null ? 0 : item.F_Order) + ")"); | |||
conn.Execute(sql2.ToString()); | |||
} | |||
using (IDbConnection conncore = new SqlConnection(_admsConnection)) | |||
{ | |||
conncore.Execute( | |||
"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),999,'往长阳中间库同步部门信息完成','部门同步数量:" + | |||
departmentList.Count() + "条',getdate())"); | |||
} | |||
} | |||
catch (Exception e) | |||
{ | |||
using (IDbConnection conncore = new SqlConnection(_admsConnection)) | |||
{ | |||
conncore.Execute( | |||
"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),999,'往长阳中间库同步部门信息异常','" + | |||
e.Message + "',getdate())"); | |||
} | |||
} | |||
} | |||
} | |||
catch (Exception e) | |||
{ | |||
using (IDbConnection conn = new SqlConnection(_admsConnection)) | |||
{ | |||
conn.Execute( | |||
"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),999,'往长阳中间库同步部门信息异常','错误信息:" + | |||
e.Message + "',getdate())"); | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 系部 | |||
/// </summary> | |||
public static void SyncDept() | |||
{ | |||
try | |||
{ | |||
IEnumerable<CdDeptEntity> entityList = null; | |||
using (IDbConnection conn = new SqlConnection(_misConnection)) | |||
{ | |||
entityList = conn.Query<CdDeptEntity>("select t.* from CdDept t where 1=1 "); | |||
} | |||
using (IDbConnection conn = new OracleConnection(_cyzjMiddleConnection)) | |||
{ | |||
try | |||
{ | |||
conn.Execute($"truncate table DS_Dept");//success | |||
foreach (var item in entityList) | |||
{ | |||
var sql2 = $"insert into DS_Dept(Id,DeptNo,DeptName,DMId) VALUES('" + item.DeptId + "','" + item.DeptNo + "','" + item.DeptName + "','" + (item.DeptDirector == null ? "" : item.DeptDirector) + "')"; | |||
conn.Execute(sql2); | |||
} | |||
using (IDbConnection conncore = new SqlConnection(_admsConnection)) | |||
{ | |||
conncore.Execute( | |||
"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),999,'往长阳中间库同步系部信息完成','系部同步数量:" + | |||
entityList.Count() + "条',getdate())"); | |||
} | |||
} | |||
catch (Exception e) | |||
{ | |||
using (IDbConnection conncore = new SqlConnection(_admsConnection)) | |||
{ | |||
conncore.Execute( | |||
"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),999,'往长阳中间库同步系部信息异常','" + | |||
e.Message + "',getdate())"); | |||
} | |||
} | |||
} | |||
} | |||
catch (Exception e) | |||
{ | |||
using (IDbConnection conn = new SqlConnection(_admsConnection)) | |||
{ | |||
conn.Execute( | |||
"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),999,'往长阳中间库同步系部信息异常','错误信息:" + | |||
e.Message + "',getdate())"); | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 专业 | |||
/// </summary> | |||
public static void SyncMajor() | |||
{ | |||
try | |||
{ | |||
IEnumerable<CdMajorEntity> entityList = null; | |||
using (IDbConnection conn = new SqlConnection(_misConnection)) | |||
{ | |||
entityList = conn.Query<CdMajorEntity>("select t.ID,t.MajorNo,t.MajorName,t.LengthOfSchooling,t.DeptNo from CdMajor t where t.CheckMark=1 "); | |||
} | |||
using (IDbConnection conn = new OracleConnection(_cyzjMiddleConnection)) | |||
{ | |||
try | |||
{ | |||
conn.Execute($"truncate table DS_Major");//success | |||
foreach (var item in entityList) | |||
{ | |||
var sql2 = $"insert into DS_Major(Id,DeptNo,MajorNo,zymc,A0425) VALUES('" + item.ID + "','" + (item.DeptNo == null ? "" : item.DeptNo) + "','" + item.MajorNo + "','" + item.MajorName + "'," + item.LengthOfSchooling + ")"; | |||
conn.Execute(sql2); | |||
} | |||
using (IDbConnection conncore = new SqlConnection(_admsConnection)) | |||
{ | |||
conncore.Execute( | |||
"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),999,'往长阳中间库同步专业信息完成','专业同步数量:" + | |||
entityList.Count() + "条',getdate())"); | |||
} | |||
} | |||
catch (Exception e) | |||
{ | |||
using (IDbConnection conncore = new SqlConnection(_admsConnection)) | |||
{ | |||
conncore.Execute( | |||
"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),999,'往长阳中间库同步专业信息异常','" + | |||
e.Message + "',getdate())"); | |||
} | |||
} | |||
} | |||
} | |||
catch (Exception e) | |||
{ | |||
using (IDbConnection conn = new SqlConnection(_admsConnection)) | |||
{ | |||
conn.Execute( | |||
"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),999,'往长阳中间库同步专业信息异常','错误信息:" + | |||
e.Message + "',getdate())"); | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 班级 | |||
/// </summary> | |||
public static void SyncClassInfo() | |||
{ | |||
try | |||
{ | |||
IEnumerable<ClassInfoEntity> entityList = null; | |||
using (IDbConnection conn = new SqlConnection(_misConnection)) | |||
{ | |||
entityList = conn.Query<ClassInfoEntity>("select t.* from ClassInfo t where t.CheckMark=1 "); | |||
} | |||
using (IDbConnection conn = new OracleConnection(_cyzjMiddleConnection)) | |||
{ | |||
try | |||
{ | |||
conn.Execute($"truncate table DS_ClassInfo");//success | |||
foreach (var item in entityList) | |||
{ | |||
var sql2 = $"insert into DS_ClassInfo(Id,DeptNo,MajorNo,bjmc,bj,nj,ClassDiredctorNo,ClassTutorNo) VALUES('" + item.ClassId + "','" + (item.DeptNo == null ? "" : item.DeptNo) + "','" + item.MajorNo + "','" + item.ClassName + "','" + item.ClassNo + "','" + item.Grade + "','" + item.ClassDiredctorNo + "','" + (item.ClassTutorNo == null ? "" : item.ClassTutorNo) + "')"; | |||
conn.Execute(sql2); | |||
} | |||
using (IDbConnection conncore = new SqlConnection(_admsConnection)) | |||
{ | |||
conncore.Execute( | |||
"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),999,'往长阳中间库同步班级信息完成','班级同步数量:" + | |||
entityList.Count() + "条',getdate())"); | |||
} | |||
} | |||
catch (Exception e) | |||
{ | |||
using (IDbConnection conncore = new SqlConnection(_admsConnection)) | |||
{ | |||
conncore.Execute( | |||
"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),999,'往长阳中间库同步班级信息异常','" + | |||
e.Message + "',getdate())"); | |||
} | |||
} | |||
} | |||
} | |||
catch (Exception e) | |||
{ | |||
using (IDbConnection conn = new SqlConnection(_admsConnection)) | |||
{ | |||
conn.Execute( | |||
"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),999,'往长阳中间库同步班级信息异常','错误信息:" + | |||
e.Message + "',getdate())"); | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 教室 | |||
/// </summary> | |||
public static void SyncClassRoom() | |||
{ | |||
try | |||
{ | |||
IEnumerable<ClassroomInfoEntity> entityList = null; | |||
using (IDbConnection conn = new SqlConnection(_misConnection)) | |||
{ | |||
entityList = conn.Query<ClassroomInfoEntity>("select t.* from ClassroomInfo t where t.CheckMark=1 "); | |||
} | |||
using (IDbConnection conn = new OracleConnection(_cyzjMiddleConnection)) | |||
{ | |||
try | |||
{ | |||
conn.Execute($"truncate table DS_ClassRoom");//success | |||
foreach (var item in entityList) | |||
{ | |||
var sql2 = $"insert into DS_ClassRoom(Id,ClassroomNo,ClassroomName,ContainStuNum) VALUES('" + item.ClassroomId + "','" + item.ClassroomNo + "','" + item.ClassroomName + "'," + item.ContainStuNum + ")"; | |||
conn.Execute(sql2); | |||
} | |||
using (IDbConnection conncore = new SqlConnection(_admsConnection)) | |||
{ | |||
conncore.Execute( | |||
"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),999,'往长阳中间库同步教室信息完成','教室同步数量:" + | |||
entityList.Count() + "条',getdate())"); | |||
} | |||
} | |||
catch (Exception e) | |||
{ | |||
using (IDbConnection conncore = new SqlConnection(_admsConnection)) | |||
{ | |||
conncore.Execute( | |||
"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),999,'往长阳中间库同步教室信息异常','" + | |||
e.Message + "',getdate())"); | |||
} | |||
} | |||
} | |||
} | |||
catch (Exception e) | |||
{ | |||
using (IDbConnection conn = new SqlConnection(_admsConnection)) | |||
{ | |||
conn.Execute( | |||
"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),999,'往长阳中间库同步教室信息异常','错误信息:" + | |||
e.Message + "',getdate())"); | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 学生 | |||
/// </summary> | |||
public static void SyncStuInfo() | |||
{ | |||
try | |||
{ | |||
IEnumerable<StuInfoBasicEntity> entityList = null; | |||
using (IDbConnection conn = new SqlConnection(_misConnection)) | |||
{ | |||
var basedbname = string.Empty; | |||
if (_admsConnection.IndexOf("database=") > 0) | |||
{ | |||
var aa = _admsConnection.Split(';').First(x => x.Contains("database=")); | |||
basedbname = aa.Substring(aa.IndexOf("=") + 1); | |||
} | |||
else if (_admsConnection.IndexOf("Initial Catalog=") > 0) | |||
{ | |||
var aa = _admsConnection.Split(';').First(x => x.Contains("Initial Catalog=")); | |||
basedbname = aa.Substring(aa.IndexOf("=") + 1); | |||
} | |||
var sqlstring = new StringBuilder(); | |||
sqlstring.Append("select t.StuId,t.StuNo,t.DeptNo,t.MajorNo,t.Grade,t.ClassNo,t.StuName,t.GenderNo,t.Birthday,t.IdentityCardNo,t.mobile,u.F_UserId from StuInfoBasic t "); | |||
sqlstring.Append(" left join " + basedbname + ".dbo.LR_Base_User u on t.StuNo=u.F_Account and t.StuName=u.F_RealName and t.IdentityCardNo=u.F_IdentityCardNo "); | |||
sqlstring.Append(" where t.CheckMark=1 and u.F_UserId is not null and u.F_DeleteMark = 0 and u.F_EnabledMark=1 "); | |||
entityList = conn.Query<StuInfoBasicEntity>(sqlstring.ToString()); | |||
} | |||
using (IDbConnection conn = new OracleConnection(_cyzjMiddleConnection)) | |||
{ | |||
try | |||
{ | |||
conn.Execute($"truncate table DS_StuInfo");//success | |||
foreach (var item in entityList) | |||
{ | |||
var sql2 = $"insert into DS_StuInfo(Id,xsxh,xsxm,DeptNo,MajorNo,bj,nj,A0111,A0107,sfzh,phone) VALUES('" + item.F_UserId + "','" + item.StuNo + "','" + item.StuName + "','" + item.DeptNo + "','" + item.MajorNo + "','" + item.ClassNo + "','" + item.Grade + "',to_date('" + item.Birthday + "', 'yyyy-mm-dd hh24:mi:ss'),'" + (item.GenderNo == true ? 1 : 0) + "','" + item.IdentityCardNo + "','" + (item.mobile == null ? "" : item.mobile) + "')"; | |||
conn.Execute(sql2); | |||
} | |||
using (IDbConnection conncore = new SqlConnection(_admsConnection)) | |||
{ | |||
conncore.Execute( | |||
"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),999,'往长阳中间库同步学生信息完成','学生同步数量:" + | |||
entityList.Count() + "条',getdate())"); | |||
} | |||
} | |||
catch (Exception e) | |||
{ | |||
using (IDbConnection conncore = new SqlConnection(_admsConnection)) | |||
{ | |||
conncore.Execute( | |||
"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),999,'往长阳中间库同步学生信息异常','" + | |||
e.Message + "',getdate())"); | |||
} | |||
} | |||
} | |||
} | |||
catch (Exception e) | |||
{ | |||
using (IDbConnection conn = new SqlConnection(_admsConnection)) | |||
{ | |||
conn.Execute( | |||
"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),999,'往长阳中间库同步学生信息异常','错误信息:" + | |||
e.Message + "',getdate())"); | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 教师 | |||
/// </summary> | |||
public static void SyncEmpInfo() | |||
{ | |||
try | |||
{ | |||
IEnumerable<EmpInfoEntity> entityList = null; | |||
using (IDbConnection conn = new SqlConnection(_misConnection)) | |||
{ | |||
var basedbname = string.Empty; | |||
if (_admsConnection.IndexOf("database=") > 0) | |||
{ | |||
var aa = _admsConnection.Split(';').First(x => x.Contains("database=")); | |||
basedbname = aa.Substring(aa.IndexOf("=") + 1); | |||
} | |||
else if (_admsConnection.IndexOf("Initial Catalog=") > 0) | |||
{ | |||
var aa = _admsConnection.Split(';').First(x => x.Contains("Initial Catalog=")); | |||
basedbname = aa.Substring(aa.IndexOf("=") + 1); | |||
} | |||
var sqlstring = new StringBuilder(); | |||
sqlstring.Append("select t.EmpId,t.EmpNo,t.EmpName,t.GenderNo,t.Birthday,t.DeptNo,t.IdentityCardNo,t.mobile,t.F_DepartmentId,u.F_UserId from EmpInfo t "); | |||
sqlstring.Append(" left join " + basedbname + ".dbo.LR_Base_User u on t.EmpNo=u.F_Account "); | |||
sqlstring.Append(" where t.CheckMark=1 and u.F_UserId is not null and u.F_DeleteMark = 0 and u.F_EnabledMark=1 "); | |||
entityList = conn.Query<EmpInfoEntity>(sqlstring.ToString()); | |||
} | |||
using (IDbConnection conn = new OracleConnection(_cyzjMiddleConnection)) | |||
{ | |||
try | |||
{ | |||
conn.Execute($"truncate table DS_EmpInfo");//success | |||
foreach (var item in entityList) | |||
{ | |||
var sql2 = $"insert into DS_EmpInfo(Id,jgh,xm,DepartmentId,DeptNo,A0111,A0107,sfzh,phone) VALUES('" + item.F_UserId + "','" + item.EmpNo + "','" + item.EmpName + "','" + item.F_DepartmentId + "','" + (item.DeptNo == null ? "" : item.DeptNo) + "',to_date('" + item.Birthday + "', 'yyyy-mm-dd hh24:mi:ss'),'" + (item.GenderNo == true ? 1 : 0) + "','" + item.IdentityCardNo + "','" + item.mobile + "')"; | |||
conn.Execute(sql2); | |||
} | |||
using (IDbConnection conncore = new SqlConnection(_admsConnection)) | |||
{ | |||
conncore.Execute( | |||
"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),999,'往长阳中间库同步教师信息完成','教师同步数量:" + | |||
entityList.Count() + "条',getdate())"); | |||
} | |||
} | |||
catch (Exception e) | |||
{ | |||
using (IDbConnection conncore = new SqlConnection(_admsConnection)) | |||
{ | |||
conncore.Execute( | |||
"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),999,'往长阳中间库同步教师信息异常','" + | |||
e.Message + "',getdate())"); | |||
} | |||
} | |||
} | |||
} | |||
catch (Exception e) | |||
{ | |||
using (IDbConnection conn = new SqlConnection(_admsConnection)) | |||
{ | |||
conn.Execute( | |||
"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),999,'往长阳中间库同步教师信息异常','错误信息:" + | |||
e.Message + "',getdate())"); | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 宿舍 | |||
/// </summary> | |||
public static void SyncDormitoryBuild() | |||
{ | |||
try | |||
{ | |||
IEnumerable<Acc_DormitoryBuildEntity> entityList = null; | |||
using (IDbConnection conn = new SqlConnection(_misConnection)) | |||
{ | |||
var basedbname = string.Empty; | |||
if (_admsConnection.IndexOf("database=") > 0) | |||
{ | |||
var aa = _admsConnection.Split(';').First(x => x.Contains("database=")); | |||
basedbname = aa.Substring(aa.IndexOf("=") + 1); | |||
} | |||
else if (_admsConnection.IndexOf("Initial Catalog=") > 0) | |||
{ | |||
var aa = _admsConnection.Split(';').First(x => x.Contains("Initial Catalog=")); | |||
basedbname = aa.Substring(aa.IndexOf("=") + 1); | |||
} | |||
var sqlstring = new StringBuilder(); | |||
sqlstring.Append("select t.* from Acc_DormitoryBuild t "); | |||
sqlstring.Append(" where 1=1 and t.DNo is not null "); | |||
entityList = conn.Query<Acc_DormitoryBuildEntity>(sqlstring.ToString()); | |||
} | |||
using (IDbConnection conn = new OracleConnection(_cyzjMiddleConnection)) | |||
{ | |||
try | |||
{ | |||
conn.Execute($"truncate table DS_DormitoryBuild");//success | |||
foreach (var item in entityList) | |||
{ | |||
var sql2 = $"insert into DS_DormitoryBuild(ID,DNo,Name,ApartmentId,UnitId,FloorId,Functionary,Leader,BuildType,jg,phone,Address,Campus,A0107,ParentID,HasToilet,Starred,sort,RoomType,CheckInStu,xsxh,Dept,Major,Class,bj) VALUES('" + item.ID + "','" + item.DNo + "','" + item.Name + "','" + item.ApartmentId + "','" + item.UnitId + "','" + item.FloorId + "','" + item.Functionary + "','" + item.Leader + "','" + item.BuildType + "'," + (item.Price == null ? 0 : item.Price) + ",'" + item.Phone + "','" + item.Address + "','" + item.Campus + "','" + item.Sex + "','" + item.ParentID + "','" + item.HasToilet + "','" + item.Starred + "'," + (item.sort == null ? 0 : item.sort) + "," + (item.RoomType == null ? 0 : item.RoomType) + "," + (item.CheckInStu == null ? 0 : item.CheckInStu) + ",'" + item.StudentID + "','" + item.Dept + "','" + item.Major + "','" + item.Class + "','" + item.MainClass + "')"; | |||
conn.Execute(sql2); | |||
} | |||
using (IDbConnection conncore = new SqlConnection(_admsConnection)) | |||
{ | |||
conncore.Execute( | |||
"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),999,'往长阳中间库同步宿舍信息完成','宿舍同步数量:" + | |||
entityList.Count() + "条',getdate())"); | |||
} | |||
} | |||
catch (Exception e) | |||
{ | |||
using (IDbConnection conncore = new SqlConnection(_admsConnection)) | |||
{ | |||
conncore.Execute( | |||
"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),999,'往长阳中间库同步宿舍信息异常','" + | |||
e.Message + "',getdate())"); | |||
} | |||
} | |||
} | |||
} | |||
catch (Exception e) | |||
{ | |||
using (IDbConnection conn = new SqlConnection(_admsConnection)) | |||
{ | |||
conn.Execute( | |||
"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),999,'往长阳中间库同步宿舍信息异常','错误信息:" + | |||
e.Message + "',getdate())"); | |||
} | |||
} | |||
} | |||
#region 实体 | |||
//信息推送管理 | |||
public class Sys_InformationPushEntity | |||
{ | |||
public string Id { get; set; } | |||
/// <summary> | |||
/// 开关状态 | |||
/// </summary> | |||
public bool? Status { get; set; } | |||
} | |||
//晚归规则 | |||
public class Acc_DormitoryRuleEntity | |||
{ | |||
public string LateReturnTime { get; set; } | |||
public string PushUser { get; set; } | |||
public int? ClassDiredctor { get; set; } | |||
} | |||
public class DormitoryReturn | |||
{ | |||
public string StudentId { get; set; } | |||
public string StuName { get; set; } | |||
public string Class { get; set; } | |||
} | |||
#endregion | |||
#region 公共方法 | |||
public static string ReplaceHtml(string html) | |||
{ | |||
if (!string.IsNullOrEmpty(html)) | |||
{ | |||
string result = Regex.Replace(html, @"<[^>]*>", "").Replace(" ", ""); | |||
return result; | |||
} | |||
else | |||
{ | |||
return html; | |||
} | |||
} | |||
#endregion | |||
} | |||
} |
@@ -0,0 +1,65 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Configuration; | |||
using System.Data; | |||
using System.Data.SqlClient; | |||
using System.Globalization; | |||
using System.Linq; | |||
using System.Net; | |||
using System.Net.Http; | |||
using System.Threading.Tasks; | |||
using System.Web.Http; | |||
using Dapper; | |||
using DigitalSchoolApi.Models; | |||
using Learun.Application.Organization; | |||
using Learun.Util; | |||
using Swagger.Net; | |||
using Swagger.Net.Annotations; | |||
namespace DigitalSchoolApi.Controllers | |||
{ | |||
/// <summary> | |||
/// 长阳报名 | |||
/// </summary> | |||
public class CYStuVolunteerController | |||
{ | |||
private readonly static string _logConnection = ConfigurationManager.ConnectionStrings["CoreDBString"].ConnectionString; | |||
private readonly static string _sqlConnection = ConfigurationManager.ConnectionStrings["ConnectionPfcMisDBString"].ConnectionString; | |||
/// <summary> | |||
/// 报名信息保存草稿24小时后,自动提交 | |||
/// </summary> | |||
/// <returns></returns> | |||
public static void StuVolunteer() | |||
{ | |||
var sql = @"update StuVolunteer set EnrollStatus=1 where ID in ( | |||
select ID from StuVolunteer where EnrollStatus='0' and DATEDIFF(MINUTE,EnrollTime,getdate())>=24*60 | |||
)"; | |||
try | |||
{ | |||
using (IDbConnection conn = new SqlConnection(_logConnection)) | |||
{ | |||
conn.Execute( | |||
"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),999,'长阳报名信息自动提交','开始同步',getdate())"); | |||
} | |||
using (IDbConnection conn = new SqlConnection(_sqlConnection)) | |||
{ | |||
conn.Execute(sql); | |||
} | |||
} | |||
catch (Exception ex) | |||
{ | |||
using (IDbConnection conn = new SqlConnection(_logConnection)) | |||
{ | |||
conn.Execute( | |||
$"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),999,'长阳报名信息自动提交发生异常','{ex.Message}',getdate())"); | |||
} | |||
} | |||
} | |||
} | |||
} |
@@ -0,0 +1,118 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Configuration; | |||
using System.Data; | |||
using System.Data.SqlClient; | |||
using System.Linq; | |||
using System.Net; | |||
using System.Net.Http; | |||
using System.Text.RegularExpressions; | |||
using System.Threading.Tasks; | |||
using System.Web; | |||
using Dapper; | |||
using DigitalSchoolApi.App_Data; | |||
using DigitalSchoolApi.Models; | |||
using Learun.Application.Organization; | |||
using Learun.Util; | |||
using Microsoft.AspNet.SignalR.Client; | |||
using Newtonsoft.Json; | |||
using Convert = System.Convert; | |||
namespace DigitalSchoolApi.Controllers | |||
{ | |||
/// <summary> | |||
/// 授权到期提醒 | |||
/// </summary> | |||
public class EmailSendController | |||
{ | |||
private readonly static string _admsConnection = ConfigurationManager.ConnectionStrings["CoreDBString"].ConnectionString; | |||
private readonly static string _misConnection = ConfigurationManager.ConnectionStrings["ConnectionPfcMisDBString"].ConnectionString; | |||
public static void Send() | |||
{ | |||
try | |||
{ | |||
//获取授权到期时间 | |||
var lc = LicenseChecker.CheckLicense(); | |||
//授权到期前发送邮件提醒 | |||
if (!string.IsNullOrEmpty(lc.ExpirationDate) && !lc.ExpirationDate.Contains("永久有效")) | |||
{ | |||
using (IDbConnection admscon = new SqlConnection(_admsConnection)) | |||
{ | |||
admscon.Execute( | |||
"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),997,'授权到期提醒','开始推送',getdate())"); | |||
//获取授权查看规则 | |||
var showAuthorize = admscon.QueryFirstOrDefault<ShowAuthorizeEntity>("select top 1 * from ShowAuthorize "); | |||
if (showAuthorize != null && showAuthorize.IsRemind == 1 && !string.IsNullOrEmpty(showAuthorize.EmailAddr)) | |||
{ | |||
//授权到期时间 | |||
DateTime expirationDate = Convert.ToDateTime(lc.ExpirationDate); | |||
DateTime now = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd")); | |||
//计算授权到期时间与当前时间相差的天数 | |||
var ts = (expirationDate - now).Days; | |||
//到期前{ExpirationTime}天,每天发送一封邮件 | |||
if (ts >= 0 && ts <= showAuthorize.ExpirationTime) | |||
{ | |||
admscon.Execute( | |||
"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),997,'授权到期提醒','即将到期,发送提醒',getdate())"); | |||
//发送邮件 | |||
if (MailHelper.Send(showAuthorize.EmailAddr, showAuthorize.EmailTitle, | |||
showAuthorize.EmailContent)) | |||
{ | |||
//发送邮件成功,记录数据 | |||
var F_Sender = ConfigurationManager.AppSettings["MailUserName"]; | |||
string addSendSql = $@"INSERT INTO [dbo].[LR_EmailSend] | |||
([F_Id] | |||
,[F_Sender] | |||
,[F_SenderName] | |||
,[F_To] | |||
,[F_Subject] | |||
,[F_BodyText] | |||
,[F_Description] | |||
,[F_EnabledMark] | |||
,[F_DeleteMark] | |||
,F_CreatorTime | |||
,[F_Date]) | |||
VALUES | |||
(NEWID() | |||
,'{F_Sender}' | |||
,null | |||
,'{showAuthorize.EmailAddr}' | |||
,'{showAuthorize.EmailTitle}' | |||
,'{showAuthorize.EmailContent}' | |||
,'授权到期提醒' | |||
,0 | |||
,0 | |||
,getdate() | |||
,getdate()) "; | |||
admscon.Execute(addSendSql); | |||
} | |||
admscon.Execute( | |||
"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),997,'授权到期提醒','发送成功',getdate())"); | |||
} | |||
else | |||
{ | |||
admscon.Execute( | |||
"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),997,'授权到期提醒','暂未到期',getdate())"); | |||
} | |||
} | |||
} | |||
} | |||
} | |||
catch (Exception ex) | |||
{ | |||
using (IDbConnection conn = new SqlConnection(_admsConnection)) | |||
{ | |||
conn.Execute( | |||
$"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),997,'授权到期提醒异常','{ex.Message}',getdate())"); | |||
} | |||
} | |||
} | |||
} | |||
} |
@@ -0,0 +1,521 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Configuration; | |||
using System.Data; | |||
using System.Data.OracleClient; | |||
using System.Data.SqlClient; | |||
using System.Linq; | |||
using System.Net; | |||
using System.Net.Http; | |||
using System.Text; | |||
using System.Text.RegularExpressions; | |||
using System.Threading.Tasks; | |||
using System.Web; | |||
using Dapper; | |||
using DigitalSchoolApi.Models; | |||
using Learun.Application.Organization; | |||
using Learun.Util; | |||
using Microsoft.AspNet.SignalR.Client; | |||
using Newtonsoft.Json; | |||
using Convert = System.Convert; | |||
namespace DigitalSchoolApi.Controllers | |||
{ | |||
/// <summary> | |||
/// 怀来职教 | |||
/// </summary> | |||
public class HLSchoolController | |||
{ | |||
private readonly static string _admsConnection = ConfigurationManager.ConnectionStrings["CoreDBString"].ConnectionString; | |||
private readonly static string _misConnection = ConfigurationManager.ConnectionStrings["ConnectionPfcMisDBString"].ConnectionString; | |||
//中间库 | |||
private static string _hlzjMiddleConnection = ConfigurationManager.ConnectionStrings["HLZJMiddleDBString"].ConnectionString; | |||
/// <summary> | |||
/// 往oracle中间库中同步数校部门信息 | |||
/// </summary> | |||
/// <param name="_hlzjMiddleConnection">中间库连接地址</param> | |||
public static void SyncDepartment() | |||
{ | |||
try | |||
{ | |||
IEnumerable<DepartmentEntity> departmentList = null; | |||
using (IDbConnection conn = new SqlConnection(_admsConnection)) | |||
{ | |||
departmentList = conn.Query<DepartmentEntity>("select t.F_DepartmentId,t.F_ParentId,t.F_EnCode,t.F_FullName,t.F_Manager,t.F_SchoolMasterId,t.F_Order from LR_Base_Department t where t.F_DeleteMark=0 and t.F_EnabledMark=1 "); | |||
} | |||
using (IDbConnection conn = new OracleConnection(_hlzjMiddleConnection)) | |||
{ | |||
try | |||
{ | |||
conn.Execute($"truncate table DS_Department");//success | |||
foreach (var item in departmentList) | |||
{ | |||
var sql2 = new StringBuilder(); | |||
sql2.Append("insert into DS_Department(Id,ParentId,Code,Name,ManagerId,SMId,\"ORDER\") "); | |||
sql2.Append(" VALUES('" + item.F_DepartmentId + "','" + (item.F_ParentId == null ? "0" : item.F_ParentId) + "','" + item.F_EnCode + "','" + item.F_FullName + "','" + (item.F_Manager == null ? "" : item.F_Manager) + "','" + (item.F_SchoolMasterId == null ? "" : item.F_SchoolMasterId) + "'," + (item.F_Order == null ? 0 : item.F_Order) + ")"); | |||
conn.Execute(sql2.ToString()); | |||
} | |||
using (IDbConnection conncore = new SqlConnection(_admsConnection)) | |||
{ | |||
conncore.Execute( | |||
"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),999,'往中间库同步部门信息完成','部门同步数量:" + | |||
departmentList.Count() + "条',getdate())"); | |||
} | |||
} | |||
catch (Exception e) | |||
{ | |||
using (IDbConnection conncore = new SqlConnection(_admsConnection)) | |||
{ | |||
conncore.Execute( | |||
"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),999,'往中间库同步部门信息异常','" + | |||
e.Message + "',getdate())"); | |||
} | |||
} | |||
} | |||
} | |||
catch (Exception e) | |||
{ | |||
using (IDbConnection conn = new SqlConnection(_admsConnection)) | |||
{ | |||
conn.Execute( | |||
"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),999,'往长阳中间库同步部门信息异常','错误信息:" + | |||
e.Message + "',getdate())"); | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 系部 | |||
/// </summary> | |||
public static void SyncDept() | |||
{ | |||
try | |||
{ | |||
IEnumerable<CdDeptEntity> entityList = null; | |||
using (IDbConnection conn = new SqlConnection(_misConnection)) | |||
{ | |||
entityList = conn.Query<CdDeptEntity>("select t.* from CdDept t where 1=1 "); | |||
} | |||
using (IDbConnection conn = new OracleConnection(_hlzjMiddleConnection)) | |||
{ | |||
try | |||
{ | |||
conn.Execute($"truncate table DS_Dept");//success | |||
foreach (var item in entityList) | |||
{ | |||
var sql2 = $"insert into DS_Dept(Id,DeptNo,DeptName,DMId) VALUES('" + item.DeptId + "','" + item.DeptNo + "','" + item.DeptName + "','" + (item.DeptDirector == null ? "" : item.DeptDirector) + "')"; | |||
conn.Execute(sql2); | |||
} | |||
using (IDbConnection conncore = new SqlConnection(_admsConnection)) | |||
{ | |||
conncore.Execute( | |||
"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),999,'往中间库同步系部信息完成','系部同步数量:" + | |||
entityList.Count() + "条',getdate())"); | |||
} | |||
} | |||
catch (Exception e) | |||
{ | |||
using (IDbConnection conncore = new SqlConnection(_admsConnection)) | |||
{ | |||
conncore.Execute( | |||
"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),999,'往中间库同步系部信息异常','" + | |||
e.Message + "',getdate())"); | |||
} | |||
} | |||
} | |||
} | |||
catch (Exception e) | |||
{ | |||
using (IDbConnection conn = new SqlConnection(_admsConnection)) | |||
{ | |||
conn.Execute( | |||
"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),999,'往中间库同步系部信息异常','错误信息:" + | |||
e.Message + "',getdate())"); | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 专业 | |||
/// </summary> | |||
public static void SyncMajor() | |||
{ | |||
try | |||
{ | |||
IEnumerable<CdMajorEntity> entityList = null; | |||
using (IDbConnection conn = new SqlConnection(_misConnection)) | |||
{ | |||
entityList = conn.Query<CdMajorEntity>("select t.ID,t.MajorNo,t.MajorName,t.LengthOfSchooling,t.DeptNo from CdMajor t where t.CheckMark=1 "); | |||
} | |||
using (IDbConnection conn = new OracleConnection(_hlzjMiddleConnection)) | |||
{ | |||
try | |||
{ | |||
conn.Execute($"truncate table DS_Major");//success | |||
foreach (var item in entityList) | |||
{ | |||
var sql2 = $"insert into DS_Major(Id,DeptNo,MajorNo,MajorName,EduSystem) VALUES('" + item.ID + "','" + (item.DeptNo == null ? "" : item.DeptNo) + "','" + item.MajorNo + "','" + item.MajorName + "'," + item.LengthOfSchooling + ")"; | |||
conn.Execute(sql2); | |||
} | |||
using (IDbConnection conncore = new SqlConnection(_admsConnection)) | |||
{ | |||
conncore.Execute( | |||
"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),999,'往中间库同步专业信息完成','专业同步数量:" + | |||
entityList.Count() + "条',getdate())"); | |||
} | |||
} | |||
catch (Exception e) | |||
{ | |||
using (IDbConnection conncore = new SqlConnection(_admsConnection)) | |||
{ | |||
conncore.Execute( | |||
"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),999,'往中间库同步专业信息异常','" + | |||
e.Message + "',getdate())"); | |||
} | |||
} | |||
} | |||
} | |||
catch (Exception e) | |||
{ | |||
using (IDbConnection conn = new SqlConnection(_admsConnection)) | |||
{ | |||
conn.Execute( | |||
"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),999,'往中间库同步专业信息异常','错误信息:" + | |||
e.Message + "',getdate())"); | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 班级 | |||
/// </summary> | |||
public static void SyncClassInfo() | |||
{ | |||
try | |||
{ | |||
IEnumerable<ClassInfoEntity> entityList = null; | |||
using (IDbConnection conn = new SqlConnection(_misConnection)) | |||
{ | |||
entityList = conn.Query<ClassInfoEntity>("select t.* from ClassInfo t where t.CheckMark=1 "); | |||
} | |||
using (IDbConnection conn = new OracleConnection(_hlzjMiddleConnection)) | |||
{ | |||
try | |||
{ | |||
conn.Execute($"truncate table DS_ClassInfo");//success | |||
foreach (var item in entityList) | |||
{ | |||
var sql2 = $"insert into DS_ClassInfo(Id,DeptNo,MajorNo,ClassName,ClassNo,Grade,ClassDiredctorNo,ClassTutorNo) VALUES('" + item.ClassId + "','" + (item.DeptNo == null ? "" : item.DeptNo) + "','" + item.MajorNo + "','" + item.ClassName + "','" + item.ClassNo + "','" + item.Grade + "','" + item.ClassDiredctorNo + "','" + (item.ClassTutorNo == null ? "" : item.ClassTutorNo) + "')"; | |||
conn.Execute(sql2); | |||
} | |||
using (IDbConnection conncore = new SqlConnection(_admsConnection)) | |||
{ | |||
conncore.Execute( | |||
"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),999,'往中间库同步班级信息完成','班级同步数量:" + | |||
entityList.Count() + "条',getdate())"); | |||
} | |||
} | |||
catch (Exception e) | |||
{ | |||
using (IDbConnection conncore = new SqlConnection(_admsConnection)) | |||
{ | |||
conncore.Execute( | |||
"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),999,'往中间库同步班级信息异常','" + | |||
e.Message + "',getdate())"); | |||
} | |||
} | |||
} | |||
} | |||
catch (Exception e) | |||
{ | |||
using (IDbConnection conn = new SqlConnection(_admsConnection)) | |||
{ | |||
conn.Execute( | |||
"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),999,'往中间库同步班级信息异常','错误信息:" + | |||
e.Message + "',getdate())"); | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 教室 | |||
/// </summary> | |||
public static void SyncClassRoom() | |||
{ | |||
try | |||
{ | |||
IEnumerable<ClassroomInfoEntity> entityList = null; | |||
using (IDbConnection conn = new SqlConnection(_misConnection)) | |||
{ | |||
entityList = conn.Query<ClassroomInfoEntity>("select t.* from ClassroomInfo t where t.CheckMark=1 "); | |||
} | |||
using (IDbConnection conn = new OracleConnection(_hlzjMiddleConnection)) | |||
{ | |||
try | |||
{ | |||
conn.Execute($"truncate table DS_ClassRoom");//success | |||
foreach (var item in entityList) | |||
{ | |||
var sql2 = $"insert into DS_ClassRoom(Id,ClassroomNo,ClassroomName,ContainStuNum) VALUES('" + item.ClassroomId + "','" + item.ClassroomNo + "','" + item.ClassroomName + "'," + item.ContainStuNum + ")"; | |||
conn.Execute(sql2); | |||
} | |||
using (IDbConnection conncore = new SqlConnection(_admsConnection)) | |||
{ | |||
conncore.Execute( | |||
"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),999,'往中间库同步教室信息完成','教室同步数量:" + | |||
entityList.Count() + "条',getdate())"); | |||
} | |||
} | |||
catch (Exception e) | |||
{ | |||
using (IDbConnection conncore = new SqlConnection(_admsConnection)) | |||
{ | |||
conncore.Execute( | |||
"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),999,'往中间库同步教室信息异常','" + | |||
e.Message + "',getdate())"); | |||
} | |||
} | |||
} | |||
} | |||
catch (Exception e) | |||
{ | |||
using (IDbConnection conn = new SqlConnection(_admsConnection)) | |||
{ | |||
conn.Execute( | |||
"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),999,'往中间库同步教室信息异常','错误信息:" + | |||
e.Message + "',getdate())"); | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 学生 | |||
/// </summary> | |||
public static void SyncStuInfo() | |||
{ | |||
try | |||
{ | |||
IEnumerable<StuInfoBasicEntity> entityList = null; | |||
using (IDbConnection conn = new SqlConnection(_misConnection)) | |||
{ | |||
var basedbname = string.Empty; | |||
if (_admsConnection.IndexOf("database=") > 0) | |||
{ | |||
var aa = _admsConnection.Split(';').First(x => x.Contains("database=")); | |||
basedbname = aa.Substring(aa.IndexOf("=") + 1); | |||
} | |||
else if (_admsConnection.IndexOf("Initial Catalog=") > 0) | |||
{ | |||
var aa = _admsConnection.Split(';').First(x => x.Contains("Initial Catalog=")); | |||
basedbname = aa.Substring(aa.IndexOf("=") + 1); | |||
} | |||
var sqlstring = new StringBuilder(); | |||
sqlstring.Append("select t.StuId,t.StuNo,t.DeptNo,t.MajorNo,t.Grade,t.ClassNo,t.StuName,t.GenderNo,t.Birthday,t.IdentityCardNo,t.mobile,u.F_UserId from StuInfoBasic t "); | |||
sqlstring.Append(" left join " + basedbname + ".dbo.LR_Base_User u on t.StuNo=u.F_Account and t.StuName=u.F_RealName and t.IdentityCardNo=u.F_IdentityCardNo "); | |||
sqlstring.Append(" where t.CheckMark=1 and u.F_UserId is not null and u.F_DeleteMark = 0 and u.F_EnabledMark=1 "); | |||
entityList = conn.Query<StuInfoBasicEntity>(sqlstring.ToString()); | |||
} | |||
using (IDbConnection conn = new OracleConnection(_hlzjMiddleConnection)) | |||
{ | |||
try | |||
{ | |||
conn.Execute($"truncate table DS_StuInfo");//success | |||
foreach (var item in entityList) | |||
{ | |||
var sql2 = $"insert into DS_StuInfo(Id,StuNo,StuName,DeptNo,MajorNo,ClassNo,Grade,Birth,GenderNo,IdentityNo,Mobile) VALUES('" + item.F_UserId + "','" + item.StuNo + "','" + item.StuName + "','" + item.DeptNo + "','" + item.MajorNo + "','" + item.ClassNo + "','" + item.Grade + "',to_date('" + item.Birthday + "', 'yyyy-mm-dd hh24:mi:ss'),'" + (item.GenderNo == true ? 1 : 0) + "','" + item.IdentityCardNo + "','" + (item.mobile == null ? "" : item.mobile) + "')"; | |||
conn.Execute(sql2); | |||
} | |||
using (IDbConnection conncore = new SqlConnection(_admsConnection)) | |||
{ | |||
conncore.Execute( | |||
"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),999,'往中间库同步学生信息完成','学生同步数量:" + | |||
entityList.Count() + "条',getdate())"); | |||
} | |||
} | |||
catch (Exception e) | |||
{ | |||
using (IDbConnection conncore = new SqlConnection(_admsConnection)) | |||
{ | |||
conncore.Execute( | |||
"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),999,'往中间库同步学生信息异常','" + | |||
e.Message + "',getdate())"); | |||
} | |||
} | |||
} | |||
} | |||
catch (Exception e) | |||
{ | |||
using (IDbConnection conn = new SqlConnection(_admsConnection)) | |||
{ | |||
conn.Execute( | |||
"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),999,'往中间库同步学生信息异常','错误信息:" + | |||
e.Message + "',getdate())"); | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 教师 | |||
/// </summary> | |||
public static void SyncEmpInfo() | |||
{ | |||
try | |||
{ | |||
IEnumerable<EmpInfoEntity> entityList = null; | |||
using (IDbConnection conn = new SqlConnection(_misConnection)) | |||
{ | |||
var basedbname = string.Empty; | |||
if (_admsConnection.IndexOf("database=") > 0) | |||
{ | |||
var aa = _admsConnection.Split(';').First(x => x.Contains("database=")); | |||
basedbname = aa.Substring(aa.IndexOf("=") + 1); | |||
} | |||
else if (_admsConnection.IndexOf("Initial Catalog=") > 0) | |||
{ | |||
var aa = _admsConnection.Split(';').First(x => x.Contains("Initial Catalog=")); | |||
basedbname = aa.Substring(aa.IndexOf("=") + 1); | |||
} | |||
var sqlstring = new StringBuilder(); | |||
sqlstring.Append("select t.EmpId,t.EmpNo,t.EmpName,t.GenderNo,t.Birthday,t.DeptNo,t.IdentityCardNo,t.mobile,t.F_DepartmentId,u.F_UserId from EmpInfo t "); | |||
sqlstring.Append(" left join " + basedbname + ".dbo.LR_Base_User u on t.EmpNo=u.F_Account "); | |||
sqlstring.Append(" where t.CheckMark=1 and u.F_UserId is not null and u.F_DeleteMark = 0 and u.F_EnabledMark=1 "); | |||
entityList = conn.Query<EmpInfoEntity>(sqlstring.ToString()); | |||
} | |||
using (IDbConnection conn = new OracleConnection(_hlzjMiddleConnection)) | |||
{ | |||
try | |||
{ | |||
conn.Execute($"truncate table DS_EmpInfo");//success | |||
foreach (var item in entityList) | |||
{ | |||
var sql2 = $"insert into DS_EmpInfo(Id,EmpNo,EmpName,DepartmentId,DeptNo,Birth,GenderNo,IdentityNo,Mobile) VALUES('" + item.F_UserId + "','" + item.EmpNo + "','" + item.EmpName + "','" + item.F_DepartmentId + "','" + (item.DeptNo == null ? "" : item.DeptNo) + "',to_date('" + item.Birthday + "', 'yyyy-mm-dd hh24:mi:ss'),'" + (item.GenderNo == true ? 1 : 0) + "','" + item.IdentityCardNo + "','" + item.mobile + "')"; | |||
conn.Execute(sql2); | |||
} | |||
using (IDbConnection conncore = new SqlConnection(_admsConnection)) | |||
{ | |||
conncore.Execute( | |||
"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),999,'往中间库同步教师信息完成','教师同步数量:" + | |||
entityList.Count() + "条',getdate())"); | |||
} | |||
} | |||
catch (Exception e) | |||
{ | |||
using (IDbConnection conncore = new SqlConnection(_admsConnection)) | |||
{ | |||
conncore.Execute( | |||
"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),999,'往中间库同步教师信息异常','" + | |||
e.Message + "',getdate())"); | |||
} | |||
} | |||
} | |||
} | |||
catch (Exception e) | |||
{ | |||
using (IDbConnection conn = new SqlConnection(_admsConnection)) | |||
{ | |||
conn.Execute( | |||
"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),999,'往中间库同步教师信息异常','错误信息:" + | |||
e.Message + "',getdate())"); | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 宿舍 | |||
/// </summary> | |||
public static void SyncDormitoryBuild() | |||
{ | |||
try | |||
{ | |||
IEnumerable<Acc_DormitoryBuildEntity> entityList = null; | |||
using (IDbConnection conn = new SqlConnection(_misConnection)) | |||
{ | |||
entityList = conn.Query<Acc_DormitoryBuildEntity>("select t.* from Acc_DormitoryBuild t where 1=1 "); | |||
} | |||
using (IDbConnection conn = new OracleConnection(_hlzjMiddleConnection)) | |||
{ | |||
try | |||
{ | |||
conn.Execute($"truncate table DS_DORMITORY");//success | |||
foreach (var item in entityList) | |||
{ | |||
var sql2 = $"insert into DS_DORMITORY(id, dparentid, stuno, dno, dname, dtype) VALUES('" + item.ID + "','" + item.ParentID + "','" + item.StudentID + "','" + item.DNo + "','" + item.Name + "','" + item.BuildType + "')"; | |||
conn.Execute(sql2); | |||
} | |||
using (IDbConnection conncore = new SqlConnection(_admsConnection)) | |||
{ | |||
conncore.Execute( | |||
"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),999,'往中间库同步宿舍信息完成','宿舍同步数量:" + | |||
entityList.Count() + "条',getdate())"); | |||
} | |||
} | |||
catch (Exception e) | |||
{ | |||
using (IDbConnection conncore = new SqlConnection(_admsConnection)) | |||
{ | |||
conncore.Execute( | |||
"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),999,'往中间库同步宿舍信息异常','" + | |||
e.Message + "',getdate())"); | |||
} | |||
} | |||
} | |||
} | |||
catch (Exception e) | |||
{ | |||
using (IDbConnection conn = new SqlConnection(_admsConnection)) | |||
{ | |||
conn.Execute( | |||
"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),999,'往中间库同步宿舍信息异常','错误信息:" + | |||
e.Message + "',getdate())"); | |||
} | |||
} | |||
} | |||
#region 实体 | |||
#endregion | |||
#region 公共方法 | |||
#endregion | |||
} | |||
} |
@@ -0,0 +1,455 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Configuration; | |||
using System.Data; | |||
using System.Data.SqlClient; | |||
using System.IO; | |||
using System.Linq; | |||
using System.Net.Http; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using System.Web; | |||
using System.Web.Http; | |||
using System.Xml; | |||
using Dapper; | |||
using Hangfire; | |||
using Learun.Application.TwoDevelopment.EducationalAdministration; | |||
namespace DigitalSchoolApi.Controllers | |||
{ | |||
public class PayFeeResultController : BaseController | |||
{ | |||
private static string _coresqlConnection = | |||
ConfigurationManager.ConnectionStrings["CoreDBString"].ConnectionString; | |||
private static string _sqlConnection = | |||
ConfigurationManager.ConnectionStrings["ConnectionPfcMisDBString"].ConnectionString; | |||
private static string __yongyouConnection = | |||
ConfigurationManager.ConnectionStrings["YongyouDb"].ConnectionString; | |||
private static string payresulturl = | |||
ConfigurationManager.AppSettings["payresulturl"]; | |||
/// <summary> | |||
/// 每分钟执行缴费后处理 | |||
/// </summary> | |||
/// <returns></returns> | |||
public IHttpActionResult GetLastTenMinutes() | |||
{ | |||
RecurringJob.AddOrUpdate("PayFeeResultMinutes", | |||
() => GetResult(true), | |||
Cron.Minutely, TimeZoneInfo.Local); | |||
return Ok(); | |||
} | |||
/// <summary> | |||
/// 每天执行缴费后处理 | |||
/// </summary> | |||
/// <returns></returns> | |||
public IHttpActionResult GetLastDay() | |||
{ | |||
RecurringJob.AddOrUpdate("PayFeeResultDay", | |||
() => GetResult(false), | |||
Cron.Daily(0), TimeZoneInfo.Local); | |||
return Ok(); | |||
} | |||
/// <summary> | |||
/// excel开发票任务 | |||
/// </summary> | |||
/// <returns></returns> | |||
public IHttpActionResult SetUnInvoiceHandle() | |||
{ | |||
BackgroundJob.Enqueue(() => UnInvoiceHandle(true)); | |||
return Ok(); | |||
} | |||
/// <summary> | |||
/// 补开发票 | |||
/// </summary> | |||
/// <param name="isexcel">是否excel导入</param> | |||
/// <returns></returns> | |||
public IHttpActionResult DoUnInvoiceHandle(bool isexcel) | |||
{ | |||
UnInvoiceHandle(false); | |||
return Ok(); | |||
} | |||
public void UnInvoiceHandle(bool isexcel) | |||
{ | |||
try | |||
{ | |||
using (IDbConnection conn = new SqlConnection(_sqlConnection)) | |||
{ | |||
List<StuEnrollFeeOrderEntity> stuorderlist = null; | |||
if (isexcel) | |||
{ | |||
stuorderlist = conn.Query<StuEnrollFeeOrderEntity>("select stuno,yearno,orderid from StuEnrollFeeOrder where Status=999").ToList(); | |||
} | |||
else | |||
{ | |||
stuorderlist = conn.Query<StuEnrollFeeOrderEntity>("select stuno,yearno,orderid from StuEnrollFeeOrder where Status=1").ToList(); | |||
} | |||
foreach (var stuorderEntity in stuorderlist) | |||
{ | |||
//新老生判断 | |||
if (Convert.ToInt32(conn.ExecuteScalar( | |||
"select count(1) from StuInfoFresh where StuNo='" + stuorderEntity.StuNo + "' and grade='" + stuorderEntity.YearNo.ToString().Substring(2) + "'")) > 0) | |||
{ | |||
conn.Execute("update StuInfoFresh set PayFeeStatus='1' where StuNo='" + stuorderEntity.StuNo + "'"); | |||
if (Convert.ToInt32(conn.ExecuteScalar( | |||
"select count(1) from StuInfoFresh where StuNo='" + stuorderEntity.StuNo +"' and grade='" + stuorderEntity.YearNo.ToString().Substring(2) + "' and IsInvoice=0 and PayFeeStatus='1' ")) > 0) | |||
{ | |||
//开票 | |||
Task.Run(() => YKTTrabs.InvoiceEBillMethod(stuorderEntity.orderid, true)); | |||
} | |||
} | |||
else | |||
{ | |||
conn.Execute("update StuInfoBasic_PayFee set PayStatus='1' where StuNo='" + stuorderEntity.StuNo + "' and PayYear='" + stuorderEntity.YearNo.ToString().Substring(2) + "'"); | |||
if (Convert.ToInt32(conn.ExecuteScalar("select count(1) from StuInfoBasic_PayFee where StuNo='" +stuorderEntity.StuNo + "' and PayYear='" +stuorderEntity.YearNo + "' and InvoiceStatus=0 and PayStatus='1'")) > 0) | |||
{ | |||
//开票 | |||
Task.Run(() => YKTTrabs.InvoiceEBillMethod(stuorderEntity.orderid, false)); | |||
} | |||
} | |||
} | |||
} | |||
} | |||
catch (Exception e) | |||
{ | |||
using (IDbConnection conncore = new SqlConnection(_coresqlConnection)) | |||
{ | |||
conncore.Execute( | |||
"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),121,'piaoju','" + e.Message + "',getdate())"); | |||
} | |||
} | |||
} | |||
public void GetResult(bool iflasttenminutes) | |||
{ | |||
try | |||
{ | |||
using (IDbConnection conn = new SqlConnection(_sqlConnection)) | |||
{ | |||
//获取最近1小时未支付的订单/1天订单 | |||
string lastdate = iflasttenminutes | |||
? DateTime.Now.AddMinutes(-30).ToString("yyyy-MM-dd HH:mm:ss") | |||
: DateTime.Now.AddDays(-20).ToString("yyyy-MM-dd HH:mm:ss"); | |||
List<StuEnrollFeeOrderEntity> list = conn.Query<StuEnrollFeeOrderEntity>("select * from StuEnrollFeeOrder where PlaceOrderTime>='" + lastdate + "' and Status<>1 and Status<>999").ToList(); | |||
foreach (var item in list) | |||
{ | |||
//轮询建行商户平台 | |||
XmlDocument xml = new XmlDocument(); | |||
xml.Load(AppContext.BaseDirectory + "\\Content\\payxml\\PayResultXMLFile.xml"); | |||
((XmlElement)xml.SelectSingleNode("TX/REQUEST_SN")).InnerText = DateTime.Now.ToString("yyyyMMddHHmmssfff"); | |||
((XmlElement)xml.SelectSingleNode("TX/TX_INFO/ORDER")).InnerText = item.orderid; | |||
((XmlElement)xml.SelectSingleNode("TX/USER_ID")).InnerText = "002"; | |||
((XmlElement)xml.SelectSingleNode("TX/PASSWORD")).InnerText = "xcyz123456"; | |||
string par = "requestXml=" + xml.InnerXml; | |||
//最后将字符串参数进行Url编码 | |||
Encoding encoding = Encoding.GetEncoding("gb2312"); | |||
byte[] payload = encoding.GetBytes(par); | |||
HttpClient httpClient = new HttpClient(); | |||
HttpContent content = new ByteArrayContent(payload); | |||
string reStr = httpClient.PostAsync(payresulturl, content).Result.Content.ReadAsStringAsync().Result; | |||
xml.LoadXml(reStr); | |||
string s = ((XmlElement)xml.SelectSingleNode("TX/RETURN_CODE")).InnerText; | |||
//string s = "000000"; | |||
if (s.Equals("000000")) | |||
{ | |||
using (IDbConnection conncore = new SqlConnection(_coresqlConnection)) | |||
{ | |||
conncore.Execute( | |||
"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),121,'ccb','" + Learun.Util.Str.ReplaceHtml(reStr) + "',getdate())"); | |||
} | |||
string Orderid = ((XmlElement)xml.SelectSingleNode("TX/TX_INFO/LIST/ORDER")).InnerText; | |||
string PAYMENT_MONEY = ((XmlElement)xml.SelectSingleNode("TX/TX_INFO/LIST/PAYMENT_MONEY")).InnerText; | |||
string ORDER_STATUS = ((XmlElement)xml.SelectSingleNode("TX/TX_INFO/LIST/ORDER_STATUS")).InnerText; | |||
string PAY_MODE = ((XmlElement)xml.SelectSingleNode("TX/TX_INFO/LIST/PAY_MODE")).InnerText; | |||
string OriOvrlsttnEV_Trck_No = ((XmlElement)xml.SelectSingleNode("TX/TX_INFO/LIST/OriOvrlsttnEV_Trck_No")).InnerText; | |||
string TRAN_DATE = ((XmlElement)xml.SelectSingleNode("TX/TX_INFO/LIST/TRAN_DATE")).InnerText; | |||
DateTime paytimedatetime = DateTime.Now; | |||
DateTime.TryParse(TRAN_DATE, out paytimedatetime); | |||
//remark1 为学号 | |||
string REM1 = ((XmlElement)xml.SelectSingleNode("TX/TX_INFO/LIST/REM1")).InnerText; | |||
//remark2 为缴费年度 | |||
string REM2 = ((XmlElement)xml.SelectSingleNode("TX/TX_INFO/LIST/REM2")).InnerText; | |||
//string PAYMENT_MONEY =item.SJAmount.ToString(); | |||
//string ORDER_STATUS = "1"; | |||
//string TRAN_DATE = DateTime.Now.ToString(); | |||
//string PAY_MODE = "alipay"; | |||
//string OriOvrlsttnEV_Trck_No = "test001"; | |||
//string Orderid = item.orderid; | |||
//string REM1 = item.StuNo; | |||
//string REM2 = item.YearNo.ToString(); | |||
conn.Execute("update StuEnrollFeeOrder set SJAmount='" + PAYMENT_MONEY + "',Status='" + ORDER_STATUS + "',PayTime='" + TRAN_DATE + "',PayMode='" + PAY_MODE + "',BankOrder='" + OriOvrlsttnEV_Trck_No + "' where orderid='" + Orderid + "'"); | |||
//判断实缴金额是否缴清费用 | |||
decimal sjcount = Convert.ToDecimal(conn.ExecuteScalar("select isnull(sum(SJAmount),0) from StuEnrollFeeOrder where StuNo='" + REM1 + "' and Status=1 and YearNo='" + REM2 + "'")); | |||
decimal yjcount = Convert.ToDecimal(conn.ExecuteScalar("select isnull(YJAmount,0) from StuEnrollFeeOrder where orderid='" + Orderid + "'")); | |||
if (sjcount == yjcount) | |||
{ | |||
//新老生判断 | |||
if (Convert.ToInt32(conn.ExecuteScalar( | |||
"select count(1) from StuInfoFresh where StuNo='" + REM1 + "' and grade='" + REM2.Substring(2) + "'")) > 0) | |||
{ | |||
conn.Execute("update StuInfoFresh set PayFeeStatus='1' where StuNo='" + REM1 + "'"); | |||
//开票 | |||
Task.Run(() => YKTTrabs.InvoiceEBillMethod(Orderid, true)); | |||
} | |||
else | |||
{ | |||
conn.Execute("update StuInfoBasic_PayFee set PayStatus='1' where StuNo='" + REM1 + "' and PayYear='" + REM2 + "'"); | |||
//开票 | |||
Task.Run(() => YKTTrabs.InvoiceEBillMethod(Orderid, false)); | |||
} | |||
} | |||
else//更新部分缴费状态 | |||
{ | |||
//新老生判断 | |||
if (Convert.ToInt32(conn.ExecuteScalar( | |||
"select count(1) from StuInfoFresh where StuNo='" + REM1 + "' and grade='" + REM2.Substring(2) + "'")) > 0) | |||
{ | |||
conn.Execute("update StuInfoFresh set PayFeeStatus='4' where StuNo='" + REM1 + "'"); | |||
//开票 | |||
Task.Run(() => YKTTrabs.InvoiceEBillMethod(Orderid, true)); | |||
} | |||
else | |||
{ | |||
conn.Execute("update StuInfoBasic_PayFee set PayStatus='4' where StuNo='" + REM1 + "' and PayYear='" + REM2 + "'"); | |||
//开票 | |||
Task.Run(() => YKTTrabs.InvoiceEBillMethod(Orderid, false)); | |||
} | |||
} | |||
//用友系统回写 | |||
using (IDbConnection yongyouconn = new SqlConnection(__yongyouConnection)) | |||
{ | |||
try | |||
{ | |||
using (IDbConnection conncore = new SqlConnection(_coresqlConnection)) | |||
{ | |||
conncore.Execute( | |||
"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),122,'yongyou','准备开始用友回写',getdate())"); | |||
} | |||
dynamic stuinfo = yongyouconn.QuerySingle("select * from SCS_XSXX where XH='" + REM1 + "'"); | |||
string XSID = stuinfo.XSID.ToString(); | |||
string XM = stuinfo.XM.ToString(); | |||
string SFZ = stuinfo.SFZ.ToString(); | |||
string strSql = "insert into SCS_ORDER(GSDM,KJND,OR_ID,OR_NO,XSID,ZDRDM,ZDRMC,ZDRQ,ZDSJ,ZFZT,CHANNELTYPE,AMOUNT,PAYTYPE,IDCARD,realamount,moneytype,BZ,pstring) " + | |||
" values('001','" + REM2 + "','" + Orderid + "-" + REM2 + "','" + Orderid + "','" + XSID + "','" + REM1 + "','" + XM + "','" + paytimedatetime.ToString("yyyyMMdd") + "','" + paytimedatetime.ToString("HHmmss") + "','20','4','" + PAYMENT_MONEY + "','ccb','" + SFZ + "','" + PAYMENT_MONEY + "','1','','支付成功')"; | |||
yongyouconn.Execute(strSql); | |||
using (IDbConnection conncore = new SqlConnection(_coresqlConnection)) | |||
{ | |||
conncore.Execute( | |||
"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),122,'yongyou','用友回写SCS_ORDER完成',getdate())"); | |||
} | |||
//用友明细 | |||
List<StuEnrollFeeOrderDetailEntity> orderdetaillist = conn.Query<StuEnrollFeeOrderDetailEntity>("select * from StuEnrollFeeOrderDetail where OrderId='" + item.Id + "'").ToList(); | |||
for (int i = 0; i < orderdetaillist.Count; i++) | |||
{ | |||
string sqldetail = "insert into SCS_ORDEL(GSDM,KJND,OR_ID,XH,SFND,SFXMDM,SFXMMC,JE,SFQJNM) " + | |||
"values('001','" + REM2 + "','" + Orderid + "-" + REM2 + "','" + (i + 1) + "','" + item.YearNo + "','" + orderdetaillist[i].ChargeItemID + "','" + orderdetaillist[i].ChargeItemName + "','" + orderdetaillist[i].SJAmount + "','" + item.YearNo + "')"; | |||
yongyouconn.Execute(sqldetail); | |||
} | |||
using (IDbConnection conncore = new SqlConnection(_coresqlConnection)) | |||
{ | |||
conncore.Execute( | |||
"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),122,'yongyou','用友回写SCS_ORDEL完成',getdate())"); | |||
} | |||
} | |||
catch (Exception e) | |||
{ | |||
using (IDbConnection conncore = new SqlConnection(_coresqlConnection)) | |||
{ | |||
conncore.Execute( | |||
"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),122,'yongyou','" + e.Message + "',getdate())"); | |||
} | |||
} | |||
} | |||
using (IDbConnection conncore = new SqlConnection(_coresqlConnection)) | |||
{ | |||
conncore.Execute( | |||
"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),121,'ccb','orderid:" + Orderid + " StuNo:" + REM1 + "',getdate())"); | |||
conncore.Execute( | |||
"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),121,'ccb','缴费状态更新成功',getdate())"); | |||
} | |||
} | |||
else | |||
{ | |||
using (IDbConnection conncore = new SqlConnection(_coresqlConnection)) | |||
{ | |||
conncore.Execute( | |||
"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),121,'ccb','error:code="+ s+"xml=" + Learun.Util.Str.ReplaceHtml(reStr) + "',getdate())"); | |||
} | |||
} | |||
} | |||
} | |||
} | |||
catch (Exception e) | |||
{ | |||
using (IDbConnection conncore = new SqlConnection(_coresqlConnection)) | |||
{ | |||
conncore.Execute( | |||
"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),121,'ccb','" + e.Message + "',getdate())"); | |||
} | |||
} | |||
} | |||
public void GetOrderResult(string orderid) | |||
{ | |||
try | |||
{ | |||
using (IDbConnection conn = new SqlConnection(_sqlConnection)) | |||
{ | |||
List<StuEnrollFeeOrderEntity> list = conn.Query<StuEnrollFeeOrderEntity>("select * from StuEnrollFeeOrder where orderid='" + orderid + "' and Status<>1").ToList(); | |||
foreach (var item in list) | |||
{ | |||
//轮询建行商户平台 | |||
XmlDocument xml = new XmlDocument(); | |||
xml.Load(AppContext.BaseDirectory + "\\Content\\payxml\\PayResultXMLFile.xml"); | |||
((XmlElement)xml.SelectSingleNode("TX/REQUEST_SN")).InnerText = DateTime.Now.ToString("yyyyMMddHHmmssfff"); | |||
((XmlElement)xml.SelectSingleNode("TX/TX_INFO/ORDER")).InnerText = item.orderid; | |||
((XmlElement)xml.SelectSingleNode("TX/USER_ID")).InnerText = "002"; | |||
((XmlElement)xml.SelectSingleNode("TX/PASSWORD")).InnerText = "xcyz123456"; | |||
string par = "requestXml=" + xml.InnerXml; | |||
//最后将字符串参数进行Url编码 | |||
Encoding encoding = Encoding.GetEncoding("gb2312"); | |||
byte[] payload = encoding.GetBytes(par); | |||
HttpClient httpClient = new HttpClient(); | |||
HttpContent content = new ByteArrayContent(payload); | |||
string reStr = httpClient.PostAsync(payresulturl, content).Result.Content.ReadAsStringAsync().Result; | |||
xml.LoadXml(reStr); | |||
string s = ((XmlElement)xml.SelectSingleNode("TX/RETURN_CODE")).InnerText; | |||
//string s = "000000"; | |||
if (s.Equals("000000")) | |||
{ | |||
using (IDbConnection conncore = new SqlConnection(_coresqlConnection)) | |||
{ | |||
conncore.Execute( | |||
"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),121,'ccb','" + Learun.Util.Str.ReplaceHtml(reStr) + "',getdate())"); | |||
} | |||
string Orderid = ((XmlElement)xml.SelectSingleNode("TX/TX_INFO/LIST/ORDER")).InnerText; | |||
string PAYMENT_MONEY = ((XmlElement)xml.SelectSingleNode("TX/TX_INFO/LIST/PAYMENT_MONEY")).InnerText; | |||
string ORDER_STATUS = ((XmlElement)xml.SelectSingleNode("TX/TX_INFO/LIST/ORDER_STATUS")).InnerText; | |||
string PAY_MODE = ((XmlElement)xml.SelectSingleNode("TX/TX_INFO/LIST/PAY_MODE")).InnerText; | |||
string OriOvrlsttnEV_Trck_No = ((XmlElement)xml.SelectSingleNode("TX/TX_INFO/LIST/OriOvrlsttnEV_Trck_No")).InnerText; | |||
string TRAN_DATE = ((XmlElement)xml.SelectSingleNode("TX/TX_INFO/LIST/TRAN_DATE")).InnerText; | |||
//remark1 为学号 | |||
string REM1 = ((XmlElement)xml.SelectSingleNode("TX/TX_INFO/LIST/REM1")).InnerText; | |||
//remark2 为缴费年度 | |||
string REM2 = ((XmlElement)xml.SelectSingleNode("TX/TX_INFO/LIST/REM2")).InnerText; | |||
//string PAYMENT_MONEY =item.SJAmount.ToString(); | |||
//string ORDER_STATUS = "1"; | |||
//string TRAN_DATE = DateTime.Now.ToString(); | |||
//string PAY_MODE = "alipay"; | |||
//string OriOvrlsttnEV_Trck_No = "test001"; | |||
//string Orderid = item.orderid; | |||
//string REM1 = item.StuNo; | |||
//string REM2 = item.YearNo.ToString(); | |||
conn.Execute("update StuEnrollFeeOrder set SJAmount='" + PAYMENT_MONEY + "',Status='" + ORDER_STATUS + "',PayTime='" + TRAN_DATE + "',PayMode='" + PAY_MODE + "',BankOrder='" + OriOvrlsttnEV_Trck_No + "' where orderid='" + Orderid + "'"); | |||
//判断实缴金额是否缴清费用 | |||
decimal sjcount = Convert.ToDecimal(conn.ExecuteScalar("select isnull(sum(SJAmount),0) from StuEnrollFeeOrder where StuNo='" + REM1 + "' and Status=1 and YearNo='" + REM2 + "'")); | |||
decimal yjcount = Convert.ToDecimal(conn.ExecuteScalar("select isnull(YJAmount,0) from StuEnrollFeeOrder where orderid='" + Orderid + "'")); | |||
if (sjcount == yjcount) | |||
{ | |||
//新老生判断 | |||
if (Convert.ToInt32(conn.ExecuteScalar( | |||
"select count(1) from StuInfoFresh where StuNo='" + REM1 + "' and grade='" + REM2.Substring(2) + "'")) > 0) | |||
{ | |||
conn.Execute("update StuInfoFresh set PayFeeStatus='1' where StuNo='" + REM1 + "'"); | |||
//开票 | |||
Task.Run(() => YKTTrabs.InvoiceEBillMethod(Orderid, true)); | |||
} | |||
else | |||
{ | |||
conn.Execute("update StuInfoBasic_PayFee set PayStatus='1' where StuNo='" + REM1 + "' and PayYear='" + REM2 + "'"); | |||
//开票 | |||
Task.Run(() => YKTTrabs.InvoiceEBillMethod(Orderid, false)); | |||
} | |||
} | |||
else//更新部分缴费状态 | |||
{ | |||
//新老生判断 | |||
if (Convert.ToInt32(conn.ExecuteScalar( | |||
"select count(1) from StuInfoFresh where StuNo='" + REM1 + "' and grade='" + REM2.Substring(2) + "'")) > 0) | |||
{ | |||
conn.Execute("update StuInfoFresh set PayFeeStatus='4' where StuNo='" + REM1 + "'"); | |||
} | |||
else | |||
{ | |||
conn.Execute("update StuInfoBasic_PayFee set PayStatus='4' where StuNo='" + REM1 + "' and PayYear='" + REM2 + "'"); | |||
} | |||
} | |||
//用友系统回写 | |||
using (IDbConnection yongyouconn = new SqlConnection(__yongyouConnection)) | |||
{ | |||
try | |||
{ | |||
using (IDbConnection conncore = new SqlConnection(_coresqlConnection)) | |||
{ | |||
conncore.Execute( | |||
"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),122,'yongyou','准备开始用友回写',getdate())"); | |||
} | |||
dynamic stuinfo = yongyouconn.QuerySingle("select * from SCS_XSXX where XH='" + REM1 + "'"); | |||
string XSID = stuinfo.XSID.ToString(); | |||
string XM = stuinfo.XM.ToString(); | |||
string SFZ = stuinfo.SFZ.ToString(); | |||
string strSql = "insert into SCS_ORDER(GSDM,KJND,OR_ID,OR_NO,XSID,ZDRDM,ZDRMC,ZDRQ,ZDSJ,ZFZT,CHANNELTYPE,AMOUNT,PAYTYPE,IDCARD,realamount,moneytype,BZ,pstring) " + | |||
" values('001','" + REM2 + "','" + Orderid + "-" + REM2 + "','" + Orderid + "','" + XSID + "','" + REM1 + "','" + XM + "','" + DateTime.Now.ToString("yyyyMMdd") + "','" + DateTime.Now.ToString("hhmmss") + "','20','4','" + PAYMENT_MONEY + "','ccb','" + SFZ + "','" + PAYMENT_MONEY + "','1','','支付成功')"; | |||
yongyouconn.Execute(strSql); | |||
using (IDbConnection conncore = new SqlConnection(_coresqlConnection)) | |||
{ | |||
conncore.Execute( | |||
"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),122,'yongyou','用友回写SCS_ORDER完成',getdate())"); | |||
} | |||
//用友明细 | |||
List<StuEnrollFeeOrderDetailEntity> orderdetaillist = conn.Query<StuEnrollFeeOrderDetailEntity>("select * from StuEnrollFeeOrderDetail where OrderId='" + item.Id + "'").ToList(); | |||
for (int i = 0; i < orderdetaillist.Count; i++) | |||
{ | |||
string sqldetail = "insert into SCS_ORDEL(GSDM,KJND,OR_ID,XH,SFND,SFXMDM,SFXMMC,JE,SFQJNM) " + | |||
"values('001','" + REM2 + "','" + Orderid + "-" + REM2 + "','" + (i + 1) + "','" + item.YearNo + "','" + orderdetaillist[i].ChargeItemID + "','" + orderdetaillist[i].ChargeItemName + "','" + orderdetaillist[i].SJAmount + "','" + item.YearNo + "')"; | |||
yongyouconn.Execute(sqldetail); | |||
} | |||
using (IDbConnection conncore = new SqlConnection(_coresqlConnection)) | |||
{ | |||
conncore.Execute( | |||
"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),122,'yongyou','用友回写SCS_ORDEL完成',getdate())"); | |||
} | |||
} | |||
catch (Exception e) | |||
{ | |||
using (IDbConnection conncore = new SqlConnection(_coresqlConnection)) | |||
{ | |||
conncore.Execute( | |||
"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),122,'yongyou','" + e.Message + "',getdate())"); | |||
} | |||
} | |||
} | |||
using (IDbConnection conncore = new SqlConnection(_coresqlConnection)) | |||
{ | |||
conncore.Execute( | |||
"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),121,'ccb','orderid:" + Orderid + " StuNo:" + REM1 + "',getdate())"); | |||
conncore.Execute( | |||
"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),121,'ccb','缴费状态更新成功',getdate())"); | |||
} | |||
} | |||
} | |||
} | |||
} | |||
catch (Exception e) | |||
{ | |||
using (IDbConnection conncore = new SqlConnection(_coresqlConnection)) | |||
{ | |||
conncore.Execute( | |||
"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),121,'ccb','" + e.Message + "',getdate())"); | |||
} | |||
} | |||
} | |||
public IHttpActionResult TestOracle() | |||
{ | |||
return Json(CYDormitoryReturnController.TestOracle()); | |||
} | |||
} | |||
} |
@@ -0,0 +1,388 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Configuration; | |||
using System.Data; | |||
using System.Data.SqlClient; | |||
using System.IO; | |||
using System.Linq; | |||
using System.Net.Http; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using System.Web; | |||
using System.Web.Http; | |||
using System.Xml; | |||
using Dapper; | |||
using Hangfire; | |||
using Learun.Application.TwoDevelopment.ReceiveSendFeeManagement; | |||
namespace DigitalSchoolApi.Controllers | |||
{ | |||
public class PayFeeResultTwoController : BaseController | |||
{ | |||
private static string _coresqlConnection = | |||
ConfigurationManager.ConnectionStrings["CoreDBString"].ConnectionString; | |||
private static string _sqlConnection = | |||
ConfigurationManager.ConnectionStrings["ConnectionPfcMisDBString"].ConnectionString; | |||
private static string payresulturl = | |||
ConfigurationManager.AppSettings["payresulturl"]; | |||
/// <summary> | |||
/// 每分钟执行缴费后处理 | |||
/// </summary> | |||
/// <returns></returns> | |||
public IHttpActionResult GetLastTenMinutes() | |||
{ | |||
RecurringJob.AddOrUpdate("PayFeeResultMinutes", | |||
() => GetResult(true), | |||
Cron.Minutely, TimeZoneInfo.Local); | |||
return Ok(); | |||
} | |||
/// <summary> | |||
/// 每天执行缴费后处理 | |||
/// </summary> | |||
/// <returns></returns> | |||
public IHttpActionResult GetLastDay() | |||
{ | |||
RecurringJob.AddOrUpdate("PayFeeResultDay", | |||
() => GetResult(false), | |||
Cron.Daily(0), TimeZoneInfo.Local); | |||
return Ok(); | |||
} | |||
/// <summary> | |||
/// excel开发票任务 | |||
/// </summary> | |||
/// <returns></returns> | |||
public IHttpActionResult SetUnInvoiceHandle() | |||
{ | |||
BackgroundJob.Enqueue(() => UnInvoiceHandle(true)); | |||
return Ok(); | |||
} | |||
/// <summary> | |||
/// 补开发票 | |||
/// </summary> | |||
/// <param name="isexcel">是否excel导入</param> | |||
/// <returns></returns> | |||
public IHttpActionResult DoUnInvoiceHandle(bool isexcel) | |||
{ | |||
UnInvoiceHandle(false); | |||
return Ok(); | |||
} | |||
public void UnInvoiceHandle(bool isexcel) | |||
{ | |||
try | |||
{ | |||
using (IDbConnection conn = new SqlConnection(_sqlConnection)) | |||
{ | |||
List<FinaChargeStuOrderEntity> stuorderlist = null; | |||
if (isexcel) | |||
{ | |||
stuorderlist = conn.Query<FinaChargeStuOrderEntity>("select stuno,yearno,orderid from FinaChargeStuOrder where Status=1 OrderType=2").ToList(); | |||
} | |||
else | |||
{ | |||
stuorderlist = conn.Query<FinaChargeStuOrderEntity>("select stuno,yearno,orderid from FinaChargeStuOrder where Status=1 OrderType=1").ToList(); | |||
} | |||
foreach (var stuorderEntity in stuorderlist) | |||
{ | |||
//新老生判断 | |||
if (Convert.ToInt32(conn.ExecuteScalar( | |||
"select count(1) from StuInfoFresh where StuNo='" + stuorderEntity.StuNo + "' and grade='" + stuorderEntity.YearNo.ToString().Substring(2) + "'")) > 0) | |||
{ | |||
conn.Execute("update StuInfoFresh set PayFeeStatus='1' where StuNo='" + stuorderEntity.StuNo + "'"); | |||
if (Convert.ToInt32(conn.ExecuteScalar( | |||
"select count(1) from StuInfoFresh where StuNo='" + stuorderEntity.StuNo + "' and grade='" + stuorderEntity.YearNo.ToString().Substring(2) + "' and IsInvoice=0 and PayFeeStatus='1' ")) > 0) | |||
{ | |||
//开票 | |||
Task.Run(() => YKTTrabs.InvoiceEBillMethod(stuorderEntity.orderid, true)); | |||
} | |||
} | |||
else | |||
{ | |||
conn.Execute("update StuInfoBasic_PayFee set PayStatus='1' where StuNo='" + stuorderEntity.StuNo + "' and PayYear='" + stuorderEntity.YearNo.ToString().Substring(2) + "'"); | |||
if (Convert.ToInt32(conn.ExecuteScalar("select count(1) from StuInfoBasic_PayFee where StuNo='" + stuorderEntity.StuNo + "' and PayYear='" + stuorderEntity.YearNo + "' and InvoiceStatus=0 and PayStatus='1'")) > 0) | |||
{ | |||
//开票 | |||
Task.Run(() => YKTTrabs.InvoiceEBillMethod(stuorderEntity.orderid, false)); | |||
} | |||
} | |||
} | |||
} | |||
} | |||
catch (Exception e) | |||
{ | |||
using (IDbConnection conncore = new SqlConnection(_coresqlConnection)) | |||
{ | |||
conncore.Execute( | |||
"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),121,'piaoju','" + e.Message + "',getdate())"); | |||
} | |||
} | |||
} | |||
public void GetResult(bool iflasttenminutes) | |||
{ | |||
try | |||
{ | |||
using (IDbConnection conn = new SqlConnection(_sqlConnection)) | |||
{ | |||
//获取最近1小时未支付的订单/1天订单 | |||
string lastdate = iflasttenminutes | |||
? DateTime.Now.AddMinutes(-30).ToString("yyyy-MM-dd HH:mm:ss") | |||
: DateTime.Now.AddDays(-20).ToString("yyyy-MM-dd HH:mm:ss"); | |||
List<FinaChargeStuOrderEntity> list = conn.Query<FinaChargeStuOrderEntity>("select * from FinaChargeStuOrder where PlaceOrderTime>='" + lastdate + "' and Status=0 and OrderType=1 ").ToList(); | |||
foreach (var item in list) | |||
{ | |||
//轮询建行商户平台 | |||
//XmlDocument xml = new XmlDocument(); | |||
//xml.Load(AppContext.BaseDirectory + "\\Content\\payxml\\PayResultXMLFile.xml"); | |||
//((XmlElement)xml.SelectSingleNode("TX/REQUEST_SN")).InnerText = DateTime.Now.ToString("yyyyMMddHHmmssfff"); | |||
//((XmlElement)xml.SelectSingleNode("TX/TX_INFO/ORDER")).InnerText = item.orderid; | |||
//((XmlElement)xml.SelectSingleNode("TX/USER_ID")).InnerText = "002"; | |||
//((XmlElement)xml.SelectSingleNode("TX/PASSWORD")).InnerText = "xcyz123456"; | |||
//string par = "requestXml=" + xml.InnerXml; | |||
////最后将字符串参数进行Url编码 | |||
//Encoding encoding = Encoding.GetEncoding("gb2312"); | |||
//byte[] payload = encoding.GetBytes(par); | |||
//HttpClient httpClient = new HttpClient(); | |||
//HttpContent content = new ByteArrayContent(payload); | |||
//string reStr = httpClient.PostAsync(payresulturl, content).Result.Content.ReadAsStringAsync().Result; | |||
//xml.LoadXml(reStr); | |||
//string s = ((XmlElement)xml.SelectSingleNode("TX/RETURN_CODE")).InnerText; | |||
string s = "000000"; | |||
if (s.Equals("000000")) | |||
{ | |||
//using (IDbConnection conncore = new SqlConnection(_coresqlConnection)) | |||
//{ | |||
// conncore.Execute( | |||
// "insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),121,'ccb','" + Learun.Util.Str.ReplaceHtml(reStr) + "',getdate())"); | |||
//} | |||
//string Orderid = ((XmlElement)xml.SelectSingleNode("TX/TX_INFO/LIST/ORDER")).InnerText; | |||
//string PAYMENT_MONEY = ((XmlElement)xml.SelectSingleNode("TX/TX_INFO/LIST/PAYMENT_MONEY")).InnerText; | |||
//string ORDER_STATUS = ((XmlElement)xml.SelectSingleNode("TX/TX_INFO/LIST/ORDER_STATUS")).InnerText; | |||
//string PAY_MODE = ((XmlElement)xml.SelectSingleNode("TX/TX_INFO/LIST/PAY_MODE")).InnerText; | |||
//string OriOvrlsttnEV_Trck_No = ((XmlElement)xml.SelectSingleNode("TX/TX_INFO/LIST/OriOvrlsttnEV_Trck_No")).InnerText; | |||
//string TRAN_DATE = ((XmlElement)xml.SelectSingleNode("TX/TX_INFO/LIST/TRAN_DATE")).InnerText; | |||
//DateTime paytimedatetime = DateTime.Now; | |||
//DateTime.TryParse(TRAN_DATE, out paytimedatetime); | |||
////remark1 为学号 | |||
//string REM1 = ((XmlElement)xml.SelectSingleNode("TX/TX_INFO/LIST/REM1")).InnerText; | |||
////remark2 为缴费年度 | |||
//string REM2 = ((XmlElement)xml.SelectSingleNode("TX/TX_INFO/LIST/REM2")).InnerText; | |||
string PAYMENT_MONEY = item.SJAmount.ToString(); | |||
string ORDER_STATUS = "1"; | |||
string TRAN_DATE = DateTime.Now.ToString(); | |||
string PAY_MODE = "alipay"; | |||
string OriOvrlsttnEV_Trck_No = "test001"; | |||
string Orderid = item.orderid; | |||
string REM1 = item.StuNo; | |||
string REM2 = item.YearNo.ToString(); | |||
if (ORDER_STATUS=="1") | |||
{ | |||
conn.Execute("update FinaChargeStuOrder set SJAmount='" + PAYMENT_MONEY + "',Status='" + ORDER_STATUS + "',PayTime='" + TRAN_DATE + "',PayMode='" + PAY_MODE + "',BankOrder='" + OriOvrlsttnEV_Trck_No + "' where orderid='" + Orderid + "'"); | |||
////判断实缴金额是否缴清费用 | |||
//decimal sjcount = Convert.ToDecimal(conn.ExecuteScalar("select isnull(sum(SJAmount),0) from FinaChargeStuOrder where StuNo='" + REM1 + "' and Status=1 and YearNo='" + REM2 + "' ")); | |||
//decimal yjcount = Convert.ToDecimal(conn.ExecuteScalar("select isnull(YJAmount,0) from FinaChargeStuOrder where orderid='" + Orderid + "'")); | |||
//if (sjcount >= yjcount) | |||
//{ | |||
// //更新缴费状态 | |||
// conn.Execute("update FinaChargeStuYear set PayFeeStatus='1' where StuNo='" + REM1 + "' and FSYear='" + REM2 + "'"); | |||
//} | |||
//else//更新部分缴费状态 | |||
//{ | |||
// //更新缴费状态 | |||
// conn.Execute("update FinaChargeStuYear set PayFeeStatus='4' where StuNo='" + REM1 + "' and FSYear='" + REM2 + "'"); | |||
//} | |||
//记录缴费前余额、待缴金额 | |||
var oldFinaChargeStuYearItem = conn.Query<FinaChargeStuYearItemEntity>(@"select b.* from [dbo].[FinaChargeStuOrderDetail] a left join [dbo].[FinaChargeStuYearItem] b on a.ChargeItemCode=b.ChargeItemCode | |||
where a.[FCSOId] = '"+item.Id+"' and b.FSYId = '"+ item.FSYId + "'"); | |||
//实缴、缴费余额更新 | |||
//FinaChargeStuYearItem表 | |||
conn.Execute(@"update [dbo].[FinaChargeStuYearItem] set SJAmount=b.SJAmount+a.SJAmount,FSBlance=FSBlance+a.SJAmount,PayFeeStatus=(case when(FSBlance+a.SJAmount>=0) then 1 when(abs(FSBlance+a.SJAmount)=Standard) then 0 else 4 end) | |||
from [dbo].[FinaChargeStuOrderDetail] a left join [dbo].[FinaChargeStuYearItem] b on a.ChargeItemCode=b.ChargeItemCode | |||
where a.[FCSOId]='" + item.Id + "' and b.FSYId='"+item.FSYId+"'"); | |||
//FinaChargeStuYear表 | |||
conn.Execute(@" update FinaChargeStuYear set SJAmount=aa.SJAmount,FSBlance=aa.FSBlance,PayFeeStatus=(case when(aa.[FSBlance]>=0) then 1 else 4 end) | |||
from (select isnull(sum(a.[FSBlance]),0) as [FSBlance],isnull(sum(a.SJAmount),0) as SJAmount,a.FSYear,b.StuNo from FinaChargeStuYearItem a left join FinaChargeStuYear b on a.FSYId=b.FSYId | |||
group by a.FSYear,b.StuNo ) aa left join | |||
FinaChargeStuYear b on aa.stuno=b.stuno and aa.FSYear=b.FSYear | |||
where aa.StuNo='"+item.StuNo+"' and aa.FSYear='"+item.YearNo+"'"); | |||
//FinaChargeStudent表 | |||
conn.Execute(@"update FinaChargeStudent set FSBlance=a.[FSBlance] | |||
from (select isnull(sum([FSBlance]),0) as [FSBlance],StuNo from [FinaChargeStuYear] group by StuNo) a left join | |||
FinaChargeStudent b on a.stuno=b.stuno where a.stuno='"+item.StuNo+"'"); | |||
//FinaChargeStuBalance流水表 | |||
//记录缴费后余额、待缴金额 | |||
var newFinaChargeStuYearItem = conn.Query<FinaChargeStuYearItemEntity>(@"select b.* from [dbo].[FinaChargeStuOrderDetail] a left join [dbo].[FinaChargeStuYearItem] b on a.ChargeItemCode=b.ChargeItemCode | |||
where a.[FCSOId] = '" + item.Id + "' and b.FSYId = '" + item.FSYId + "'"); | |||
IEnumerable<FinaChargeStuOrderDetailEntity> detaillist =conn.Query<FinaChargeStuOrderDetailEntity>("select * from FinaChargeStuOrderDetail where FCSOId='"+item.Id+"'"); | |||
foreach (var finaChargeStuOrderDetailEntity in detaillist) | |||
{ | |||
if (finaChargeStuOrderDetailEntity.SJAmount>0) | |||
{ | |||
//计算学生缴费项目当前欠缴金额 | |||
var olditem = oldFinaChargeStuYearItem.FirstOrDefault(m => m.ChargeItemCode == finaChargeStuOrderDetailEntity.ChargeItemCode); | |||
var newitem = newFinaChargeStuYearItem.FirstOrDefault(m => m.ChargeItemCode == finaChargeStuOrderDetailEntity.ChargeItemCode); | |||
conn.Execute(@"insert into FinaChargeStuBalance(Id, StuNo, FSYear, FCSOId, ChargeItemCode, ChargeItemName, Standard, DJAmount, PaymentAmount, QJAmount, OldBalance, ChangeAmount, NowBalance, ChangeDate, ChangeType) values( | |||
newid(),'" + item.StuNo + "','" + item.YearNo + "','" + item.Id + "','" + finaChargeStuOrderDetailEntity.ChargeItemCode + "','" + finaChargeStuOrderDetailEntity.ChargeItemName + "','" + finaChargeStuOrderDetailEntity.YJAmount + "'," + | |||
"'" + (olditem.FSBlance < 0 ? Math.Abs(olditem.FSBlance.Value) : 0) + "','" + finaChargeStuOrderDetailEntity.SJAmount + "','" + (newitem.FSBlance < 0 ? Math.Abs(newitem.FSBlance.Value) : 0) + "','" + (olditem.FSBlance <= 0 ? 0 : olditem.FSBlance) + "'," + | |||
"'" + finaChargeStuOrderDetailEntity.SJAmount + "','" + (newitem.FSBlance <= 0 ? 0 : newitem.FSBlance) + "',getdate(),'1')"); | |||
} | |||
} | |||
//开票 | |||
Task.Run(() => YKTTrabs.InvoiceEBillMethodTwo(Orderid)); | |||
using (IDbConnection conncore = new SqlConnection(_coresqlConnection)) | |||
{ | |||
conncore.Execute( | |||
"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),121,'ccb','orderid:" + Orderid + " StuNo:" + REM1 + "',getdate())"); | |||
conncore.Execute( | |||
"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),121,'ccb','缴费状态更新成功',getdate())"); | |||
} | |||
} | |||
} | |||
else | |||
{ | |||
//using (IDbConnection conncore = new SqlConnection(_coresqlConnection)) | |||
//{ | |||
// conncore.Execute( | |||
// "insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),121,'ccb','error:code=" + s + "xml=" + Learun.Util.Str.ReplaceHtml(reStr) + "',getdate())"); | |||
//} | |||
} | |||
} | |||
} | |||
} | |||
catch (Exception e) | |||
{ | |||
using (IDbConnection conncore = new SqlConnection(_coresqlConnection)) | |||
{ | |||
conncore.Execute( | |||
"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),121,'ccb','" + e.Message + "',getdate())"); | |||
} | |||
} | |||
} | |||
public void GetOrderResult(string orderid) | |||
{ | |||
try | |||
{ | |||
using (IDbConnection conn = new SqlConnection(_sqlConnection)) | |||
{ | |||
List<FinaChargeStuOrderEntity> list = conn.Query<FinaChargeStuOrderEntity>("select * from FinaChargeStuOrder where orderid='" + orderid + "' and Status=0 and OrderType=1 ").ToList(); | |||
foreach (var item in list) | |||
{ | |||
//轮询建行商户平台 | |||
XmlDocument xml = new XmlDocument(); | |||
xml.Load(AppContext.BaseDirectory + "\\Content\\payxml\\PayResultXMLFile.xml"); | |||
((XmlElement)xml.SelectSingleNode("TX/REQUEST_SN")).InnerText = DateTime.Now.ToString("yyyyMMddHHmmssfff"); | |||
((XmlElement)xml.SelectSingleNode("TX/TX_INFO/ORDER")).InnerText = item.orderid; | |||
((XmlElement)xml.SelectSingleNode("TX/USER_ID")).InnerText = "002"; | |||
((XmlElement)xml.SelectSingleNode("TX/PASSWORD")).InnerText = "xcyz123456"; | |||
string par = "requestXml=" + xml.InnerXml; | |||
//最后将字符串参数进行Url编码 | |||
Encoding encoding = Encoding.GetEncoding("gb2312"); | |||
byte[] payload = encoding.GetBytes(par); | |||
HttpClient httpClient = new HttpClient(); | |||
HttpContent content = new ByteArrayContent(payload); | |||
string reStr = httpClient.PostAsync(payresulturl, content).Result.Content.ReadAsStringAsync().Result; | |||
xml.LoadXml(reStr); | |||
string s = ((XmlElement)xml.SelectSingleNode("TX/RETURN_CODE")).InnerText; | |||
//string s = "000000"; | |||
if (s.Equals("000000")) | |||
{ | |||
using (IDbConnection conncore = new SqlConnection(_coresqlConnection)) | |||
{ | |||
conncore.Execute( | |||
"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),121,'ccb','" + Learun.Util.Str.ReplaceHtml(reStr) + "',getdate())"); | |||
} | |||
string Orderid = ((XmlElement)xml.SelectSingleNode("TX/TX_INFO/LIST/ORDER")).InnerText; | |||
string PAYMENT_MONEY = ((XmlElement)xml.SelectSingleNode("TX/TX_INFO/LIST/PAYMENT_MONEY")).InnerText; | |||
string ORDER_STATUS = ((XmlElement)xml.SelectSingleNode("TX/TX_INFO/LIST/ORDER_STATUS")).InnerText; | |||
string PAY_MODE = ((XmlElement)xml.SelectSingleNode("TX/TX_INFO/LIST/PAY_MODE")).InnerText; | |||
string OriOvrlsttnEV_Trck_No = ((XmlElement)xml.SelectSingleNode("TX/TX_INFO/LIST/OriOvrlsttnEV_Trck_No")).InnerText; | |||
string TRAN_DATE = ((XmlElement)xml.SelectSingleNode("TX/TX_INFO/LIST/TRAN_DATE")).InnerText; | |||
DateTime paytimedatetime = DateTime.Now; | |||
DateTime.TryParse(TRAN_DATE, out paytimedatetime); | |||
//remark1 为学号 | |||
string REM1 = ((XmlElement)xml.SelectSingleNode("TX/TX_INFO/LIST/REM1")).InnerText; | |||
//remark2 为缴费年度 | |||
string REM2 = ((XmlElement)xml.SelectSingleNode("TX/TX_INFO/LIST/REM2")).InnerText; | |||
//string PAYMENT_MONEY =item.SJAmount.ToString(); | |||
//string ORDER_STATUS = "1"; | |||
//string TRAN_DATE = DateTime.Now.ToString(); | |||
//string PAY_MODE = "alipay"; | |||
//string OriOvrlsttnEV_Trck_No = "test001"; | |||
//string Orderid = item.orderid; | |||
//string REM1 = item.StuNo; | |||
//string REM2 = item.YearNo.ToString(); | |||
if (ORDER_STATUS == "1") | |||
{ | |||
conn.Execute("update FinaChargeStuOrder set SJAmount='" + PAYMENT_MONEY + "',Status='" + ORDER_STATUS + "',PayTime='" + TRAN_DATE + "',PayMode='" + PAY_MODE + "',BankOrder='" + OriOvrlsttnEV_Trck_No + "' where orderid='" + Orderid + "'"); | |||
//判断实缴金额是否缴清费用 | |||
decimal sjcount = Convert.ToDecimal(conn.ExecuteScalar("select isnull(sum(SJAmount),0) from FinaChargeStuOrder where StuNo='" + REM1 + "' and Status=1 and YearNo='" + REM2 + "' and OrderType=1 ")); | |||
decimal yjcount = Convert.ToDecimal(conn.ExecuteScalar("select isnull(YJAmount,0) from FinaChargeStuOrder where orderid='" + Orderid + "'")); | |||
if (sjcount == yjcount) | |||
{ | |||
//更新缴费状态 | |||
conn.Execute("update FinaChargeStuYear set PayFeeStatus='1' where StuNo='" + REM1 + "' and FSYear='" + REM2 + "'"); | |||
} | |||
else//更新部分缴费状态 | |||
{ | |||
//更新缴费状态 | |||
conn.Execute("update FinaChargeStuYear set PayFeeStatus='4' where StuNo='" + REM1 + "' and FSYear='" + REM2 + "'"); | |||
} | |||
//实缴、缴费余额更新 | |||
//FinaChargeStuYearItem表 | |||
conn.Execute(@"update [dbo].[FinaChargeStuYearItem] set SJAmount=a.SJAmount,FSBlance=FSBlance+a.SJAmount,PayFeeStatus=(case when(FSBlance+a.SJAmount>=0) then 1 else 4 end) | |||
from [dbo].[FinaChargeStuOrderDetail] a left join [dbo].[FinaChargeStuYearItem] b on a.ChargeItemCode=b.ChargeItemCode | |||
where a.[FCSOId]='" + item.orderid + "' and b.FSYId='" + item.FSYId + "'"); | |||
//FinaChargeStuYear表 | |||
conn.Execute(@" update FinaChargeStuYear set SJAmount=aa.SJAmount,FSBlance=aa.FSBlance,PayFeeStatus=(case when(aa.[FSBlance]>=0) then 1 else 4 end) | |||
from (select isnull(sum(a.[FSBlance]),0) as [FSBlance],isnull(sum(a.SJAmount),0) as SJAmount,a.FSYear,b.StuNo from FinaChargeStuYearItem a left join FinaChargeStuYear b on a.FSYId=b.FSYId | |||
group by a.FSYear,b.StuNo ) aa left join | |||
FinaChargeStuYear b on aa.stuno=b.stuno and aa.FSYear=b.FSYear | |||
where aa.StuNo='" + item.StuNo + "' and aa.FSYear='" + item.YearNo + "'"); | |||
//FinaChargeStudent表 | |||
conn.Execute(@"update FinaChargeStudent set FSBlance=a.[FSBlance] | |||
from (select isnull(sum([FSBlance]),0) as [FSBlance],StuNo from [FinaChargeStuYear] group by StuNo) a left join | |||
FinaChargeStudent b on a.stuno=b.stuno where a.stuno='" + item.StuNo + "'"); | |||
//开票 | |||
Task.Run(() => YKTTrabs.InvoiceEBillMethodTwo(Orderid)); | |||
using (IDbConnection conncore = new SqlConnection(_coresqlConnection)) | |||
{ | |||
conncore.Execute( | |||
"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),121,'ccb','orderid:" + Orderid + " StuNo:" + REM1 + "',getdate())"); | |||
conncore.Execute( | |||
"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),121,'ccb','缴费状态更新成功',getdate())"); | |||
} | |||
} | |||
} | |||
else | |||
{ | |||
using (IDbConnection conncore = new SqlConnection(_coresqlConnection)) | |||
{ | |||
conncore.Execute( | |||
"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),121,'ccb','error:code=" + s + "xml=" + Learun.Util.Str.ReplaceHtml(reStr) + "',getdate())"); | |||
} | |||
} | |||
} | |||
} | |||
} | |||
catch (Exception e) | |||
{ | |||
using (IDbConnection conncore = new SqlConnection(_coresqlConnection)) | |||
{ | |||
conncore.Execute( | |||
"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),121,'ccb','" + e.Message + "',getdate())"); | |||
} | |||
} | |||
} | |||
public IHttpActionResult TestOracle() | |||
{ | |||
return Json(CYDormitoryReturnController.TestOracle()); | |||
} | |||
} | |||
} |
@@ -0,0 +1,517 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Configuration; | |||
using System.Data; | |||
using System.Data.SqlClient; | |||
using System.Globalization; | |||
using System.Linq; | |||
using System.Net; | |||
using System.Net.Http; | |||
using System.Threading.Tasks; | |||
using System.Web.Http; | |||
using Dapper; | |||
using DigitalSchoolApi.Models; | |||
using Hangfire; | |||
using Learun.Application.Organization; | |||
using Learun.Util; | |||
using Newtonsoft.Json; | |||
using Swagger.Net; | |||
using Swagger.Net.Annotations; | |||
namespace DigitalSchoolApi.Controllers | |||
{ | |||
/// <summary> | |||
/// 基础接口 | |||
/// </summary> | |||
public class SchoolController : BaseController | |||
{ | |||
private readonly string _sqlConnection = ConfigurationManager.ConnectionStrings["ConnectionPfcMisDBString"].ConnectionString; | |||
private readonly string _coresqlConnection = ConfigurationManager.ConnectionStrings["CoreDBString"].ConnectionString; | |||
/// <summary> | |||
/// 登录接口 | |||
/// </summary> | |||
/// <param name="uid">帐户</param> | |||
/// <param name="pwd">帐户密码,32位MD5加密(小写)</param> | |||
/// <returns></returns> | |||
[HttpGet] | |||
[SwaggerResponse(HttpStatusCode.OK, Type = typeof(OperateResult<object>))] | |||
[SwaggerResponse(HttpStatusCode.InternalServerError)] | |||
public async Task<IHttpActionResult> CheckLogin(string uid, string pwd) | |||
{ | |||
try | |||
{ | |||
if (string.IsNullOrEmpty(uid)||string.IsNullOrEmpty(pwd)) | |||
{ | |||
return ResultInfo(HttpStatusCode.InternalServerError, info: "参数错误"); | |||
} | |||
var sql = "select * from LR_Base_User where F_Account='" + uid + "' and F_DeleteMark = 0"; | |||
using (IDbConnection conn = new SqlConnection(_coresqlConnection)) | |||
{ | |||
UserEntity userinfo = await conn.QueryFirstOrDefaultAsync<UserEntity>(sql); | |||
if (userinfo != null) | |||
{ | |||
if (userinfo.F_EnabledMark==1) | |||
{ | |||
string dbPassword = Md5Helper.Encrypt(DESEncrypt.Encrypt(pwd.ToLower(), userinfo.F_Secretkey).ToLower(), 32).ToLower(); | |||
if (dbPassword == userinfo.F_Password) | |||
{ | |||
return ResultInfo(HttpStatusCode.OK, info: "登录成功"); | |||
} | |||
else | |||
{ | |||
return ResultInfo(HttpStatusCode.NotFound, info: "密码和账户名不匹配!"); | |||
} | |||
} | |||
else | |||
{ | |||
return ResultInfo(HttpStatusCode.NotFound, info: "账户被系统锁定,请联系管理员!"); | |||
} | |||
} | |||
else | |||
{ | |||
return ResultInfo(HttpStatusCode.NotFound,info: "账户不存在"); | |||
} | |||
} | |||
} | |||
catch (Exception e) | |||
{ | |||
return ResultInfo(HttpStatusCode.InternalServerError, result: Result.Fail); | |||
} | |||
} | |||
/// <summary> | |||
/// 空闲教室 | |||
/// </summary> | |||
/// <param name="lessonDate">上课日期,格式为yyyy-MM-dd</param> | |||
/// <param name="pageIndex">分页页码,默认第一页</param> | |||
/// <param name="pageNum">分页每页记录条数,默认每页10条</param> | |||
/// <param name="lessonTime">上课时间(如 11 代表星期一第一节课),第几节课支持多选</param> | |||
/// <param name="buildingNo">教学楼号,如09</param> | |||
/// <param name="classRoomName">教室名称</param> | |||
/// <returns></returns> | |||
[HttpGet] | |||
[SwaggerResponse(HttpStatusCode.OK, Type = typeof(OperateResult<FreeClassroom>))] | |||
[SwaggerResponse(HttpStatusCode.InternalServerError)] | |||
public async Task<IHttpActionResult> FreeClassRooms(string lessonDate, int pageIndex = 1, int pageNum = 10, [FromUri]IEnumerable<string> lessonTime = null, string buildingNo = "", string classRoomName = "") | |||
{ | |||
var queryParam = ""; | |||
var countSql = ""; | |||
if (lessonTime != null && lessonTime.Any()) | |||
{ | |||
queryParam += "and a.LessonTime in @LessonTime"; | |||
} | |||
var infoSql = @"select e.ClassroomBuildingNo,rtrim(f.ClassroomBuildingName) ClassroomBuildingName,e.ClassroomNo,e.ClassroomName,e.ClassroomFloor,e.ContainStuNum from ( | |||
select rtrim(ClassroomBuildingNo) ClassroomBuildingNo,rtrim(ClassroomNo) ClassroomNo,rtrim(ClassroomName) ClassroomName,ClassroomFloor,ContainStuNum from ClassroomInfo | |||
except (SELECT c.ClassroomBuildingNo,a.ClassroomNo,c.ClassroomName,c.ClassroomFloor,c.ContainStuNum FROM ArrangeLessonTerm a | |||
left join ClassroomInfo c on c.ClassroomNo = a.ClassroomNo | |||
where a.LessonDate=@LessonDate " + queryParam + ")) e left join ClassroomBuilding f on f.ClassroomBuildingNo=e.ClassroomBuildingNo where 1=1"; | |||
countSql = @"select count(1) from ( | |||
select rtrim(ClassroomBuildingNo) ClassroomBuildingNo,rtrim(ClassroomNo) ClassroomNo,rtrim(ClassroomName) ClassroomName,ClassroomFloor,ContainStuNum from ClassroomInfo | |||
except (SELECT c.ClassroomBuildingNo,a.ClassroomNo,c.ClassroomName,c.ClassroomFloor,c.ContainStuNum FROM ArrangeLessonTerm a | |||
left join ClassroomInfo c on c.ClassroomNo = a.ClassroomNo | |||
where a.LessonDate=@LessonDate " + queryParam + ")) e left join ClassroomBuilding f on f.ClassroomBuildingNo=e.ClassroomBuildingNo where 1=1"; | |||
if (!string.IsNullOrEmpty(buildingNo.Trim())) | |||
{ | |||
infoSql += " and e.ClassroomBuildingNo=@ClassroomBuildingNo "; | |||
countSql += " and e.ClassroomBuildingNo=@ClassroomBuildingNo "; | |||
} | |||
if (!string.IsNullOrEmpty(classRoomName.Trim())) | |||
{ | |||
infoSql += " and e.ClassroomName like @ClassroomName "; | |||
countSql += " and e.ClassroomName like @ClassroomName "; | |||
} | |||
infoSql += " order by e.ClassroomNo OFFSET (@PageIndex-1)*@Pagenum ROWS FETCH next @Pagenum rows only"; | |||
try | |||
{ | |||
using (IDbConnection conn = new SqlConnection(_sqlConnection)) | |||
{ | |||
var info = await conn.QueryAsync<FreeClassroom>(infoSql, new { LessonDate = DateTime.ParseExact(lessonDate.Trim(), "yyyy-MM-dd", CultureInfo.CurrentCulture), LessonTime = lessonTime, ClassroomBuildingNo = buildingNo.Trim(), ClassroomName = $"%{classRoomName.Trim()}%", PageIndex = pageIndex, Pagenum = pageNum }); | |||
if (info == null) | |||
{ | |||
return ResultInfo(HttpStatusCode.NotFound, result: Result.NotFound); | |||
} | |||
var totalRowCount = conn.QueryFirstOrDefault<int>(countSql, new { LessonDate = DateTime.ParseExact(lessonDate.Trim(), "yyyy-MM-dd", CultureInfo.CurrentCulture), LessonTime = lessonTime, ClassroomBuildingNo = buildingNo.Trim(), ClassroomName = $"%{classRoomName.Trim()}%" }); | |||
var totalPage = Convert.ToInt32(Math.Ceiling((double)totalRowCount / pageNum)); | |||
return ResultInfo(new { pagination = new { total = totalRowCount, totalPages = totalPage, perPage = pageNum, currentPage = pageIndex }, info }); | |||
} | |||
} | |||
catch (Exception e) | |||
{ | |||
return ResultInfo(HttpStatusCode.InternalServerError, result: Result.Fail); | |||
} | |||
} | |||
/// <summary> | |||
/// 教学楼信息查询 | |||
/// </summary> | |||
/// <returns></returns> | |||
[HttpGet] | |||
[SwaggerResponse(HttpStatusCode.OK, Type = typeof(OperateResult<object>))] | |||
[SwaggerResponse(HttpStatusCode.InternalServerError)] | |||
public async Task<IHttpActionResult> TeachingBuildings() | |||
{ | |||
var infoSql = @"select ClassroomBuildingNo BuildingNo,rtrim(ClassroomBuildingName) BuildingName from ClassroomBuilding"; | |||
try | |||
{ | |||
using (IDbConnection conn = new SqlConnection(_sqlConnection)) | |||
{ | |||
var info = await conn.QueryAsync(infoSql); | |||
if (info == null) | |||
{ | |||
return ResultInfo(HttpStatusCode.NotFound, result: Result.NotFound); | |||
} | |||
return ResultInfo(new { totalCount = info.Count(), buildings = info }); | |||
} | |||
} | |||
catch | |||
{ | |||
return ResultInfo(HttpStatusCode.InternalServerError, result: Result.Fail); | |||
} | |||
} | |||
/// <summary> | |||
/// 学生课程表 | |||
/// </summary> | |||
/// <param name="stuNum">学号</param> | |||
/// <param name="academicYear">学年,格式如:18-19,默认为当前学年</param> | |||
/// <param name="term">学期,如1,默认为当前学期</param> | |||
/// <param name="lessonStartDate">上课开始日期,格式为yyyy-MM-dd</param> | |||
/// <param name="lessonEndDate">上课截止日期,格式为yyyy-MM-dd</param> | |||
/// <returns></returns> | |||
[HttpGet] | |||
[SwaggerResponse(HttpStatusCode.OK, Type = typeof(OperateResult<IEnumerable<TimeTable>>))] | |||
[SwaggerResponse(HttpStatusCode.InternalServerError)] | |||
public async Task<IHttpActionResult> Timetable(string stuNum, string academicYear = "", string term = "", string lessonStartDate = "", string lessonEndDate = "") | |||
{ | |||
var semesterAndYear = Common.GetSemesterAndYear(); | |||
var strAcademicYear = semesterAndYear.AcademicYearShort; | |||
var strSemester = semesterAndYear.Semester; | |||
//var startDate = Common.CalculateFirstDateOfWeek(DateTime.Today); | |||
//var endDate = Common.CalculateLastDateOfWeek(DateTime.Today); | |||
if (!string.IsNullOrEmpty(academicYear)) | |||
{ | |||
strAcademicYear = academicYear; | |||
} | |||
if (!string.IsNullOrEmpty(term)) | |||
{ | |||
strSemester = term; | |||
} | |||
var strWhere = $"a.StuNo=@stuNum and a.AcademicYearNo='{strAcademicYear}' and a.Semester='{strSemester}' "; | |||
var sql = "SELECT " + | |||
"b.LessonName,CONVERT(varchar(100), b.LessonDate, 23) LessonDate,b.LessonTime,b.Empname,c.ClassroomName,b.Semester from StuSelectLessonList a " + | |||
"left join ArrangeLessonTerm b on b.TeachClassNo=RTRIM(a.LessonName) + RTRIM(a.PartCode) + RTRIM(a.TeachClassNo) " + | |||
"left join ClassroomInfo c on c.ClassroomNo=b.classroomNo " + | |||
$"where {strWhere} " + | |||
$"and b.AcademicYearNo='{strAcademicYear}' and b.Semester='{strSemester}' and b.CheckMark=1 "; | |||
//$"and b.LessonDate>='{startDate}' and b.LessonDate<='{endDate}' and b.CheckMark=1"; | |||
if (!string.IsNullOrEmpty(lessonStartDate)) | |||
{ | |||
sql += $" and b.LessonDate>='{lessonStartDate}' "; | |||
} | |||
if (!string.IsNullOrEmpty(lessonEndDate)) | |||
{ | |||
sql += $" and b.LessonDate<='{lessonEndDate}' "; | |||
} | |||
try | |||
{ | |||
using (IDbConnection conn = new SqlConnection(_sqlConnection)) | |||
{ | |||
var getStudentTClass = await conn.QueryAsync(sql, new { stuNum = stuNum.Trim() }); | |||
if (getStudentTClass == null) | |||
{ | |||
return ResultInfo(HttpStatusCode.NotFound, result: Result.NotFound); | |||
} | |||
return ResultInfo(getStudentTClass); | |||
} | |||
} | |||
catch | |||
{ | |||
return ResultInfo(HttpStatusCode.InternalServerError, result: Result.Fail); | |||
} | |||
} | |||
/// <summary> | |||
/// 学生成绩 | |||
/// </summary> | |||
/// <param name="stuNum">学号</param> | |||
/// <param name="academicYear">学年,格式如:18-19</param> | |||
/// <param name="term">学期,数字整数,如1</param> | |||
/// <returns></returns> | |||
[HttpGet] | |||
[SwaggerResponse(HttpStatusCode.OK, Type = typeof(OperateResult<object>))] | |||
[SwaggerResponse(HttpStatusCode.InternalServerError)] | |||
public async Task<IHttpActionResult> StudentScore(string stuNum, string academicYear = "", string term = "") | |||
{ | |||
dynamic info; | |||
dynamic score; | |||
var infoSql = @"select distinct a.StuName,d.MajorName,c.ClassName from StuScore a | |||
left join Empinfo b on b.empno = a.empno | |||
left join ClassInfo c on c.ClassNo = a.ClassNo | |||
left join CdMajor d on d.MajorNo = a.MajorNo | |||
where StuNo =@StuNo"; | |||
var scoreSql = @"select a.LessonNo,a.LessonName,b.EmpName,a.StudyScore,a.Score from StuScore a | |||
left join Empinfo b on b.empno=a.empno | |||
where StuNo=@StuNo "; | |||
if (!string.IsNullOrEmpty(academicYear)) | |||
{ | |||
scoreSql += "and AcademicYearNo=@AcademicYearNo "; | |||
} | |||
if (!string.IsNullOrEmpty(term)) | |||
{ | |||
scoreSql += "and semester=@semester "; | |||
} | |||
try | |||
{ | |||
using (IDbConnection conn = new SqlConnection(_sqlConnection)) | |||
{ | |||
info = await conn.QueryAsync(infoSql, new { StuNo = stuNum.Trim() }); | |||
score = await conn.QueryAsync(scoreSql, new { StuNo = stuNum.Trim(), AcademicYearNo = academicYear.Trim(), semester = term.Trim() }); | |||
if (score == null) | |||
{ | |||
return ResultInfo(HttpStatusCode.NotFound, result: Result.NotFound); | |||
} | |||
return ResultInfo(new { info[0].StuName, info[0].MajorName, info[0].ClassName, Scores = score }); | |||
} | |||
} | |||
catch | |||
{ | |||
return ResultInfo(HttpStatusCode.InternalServerError, result: Result.Fail); | |||
} | |||
} | |||
/// <summary> | |||
/// 教职工和学生基本信息 | |||
/// </summary> | |||
/// <param name="category">人员类型 0学生 1教职工</param> | |||
/// <param name="pageIndex">分页页码,默认第一页</param> | |||
/// <param name="pageNum">分页每页记录条数,默认每页10条</param> | |||
/// <returns></returns> | |||
[HttpGet] | |||
[SwaggerResponse(HttpStatusCode.OK, Type = typeof(OperateResult<object>))] | |||
[SwaggerResponse(HttpStatusCode.InternalServerError)] | |||
public async Task<IHttpActionResult> BasicInfo(int category, int pageIndex = 1, int pageNum = 10) | |||
{ | |||
dynamic info; | |||
int rowCount; | |||
string infoSql = ""; | |||
string rowCountSql = ""; | |||
if (category == 0) | |||
{ | |||
rowCountSql = @"SELECT rows FROM sysindexes | |||
WHERE id = OBJECT_ID('[StuInfoBasic]') AND indid< 2"; | |||
infoSql = @"SELECT [StuNo] | |||
,[StuName] | |||
,[NoticeNo] | |||
,[DeptName] | |||
,[MajorName] | |||
,[Grade] | |||
,[ClassNo] | |||
,[SpellFull] | |||
,[SpellBrief] | |||
,[Birthday] | |||
,[PartyFace] | |||
,[Nationality] | |||
,[FamilyOrigin] | |||
,[HealthStatus] | |||
,[WillNo] | |||
,[TestStuSubject] | |||
,[PlanForm] | |||
,[IsThreeGood] | |||
,[IsExcellent] | |||
,[IsNormalCadre] | |||
,[MatriculateSort] | |||
,[HighSchoolNo] | |||
,[HighSchoolName] | |||
,[EntranceDate] | |||
,[Religion] | |||
,[GoodAt] | |||
,[IdentityCardNo] | |||
,[JoinPartyDate] | |||
,[JoinLeagueDate] | |||
,[InSchoolAddress] | |||
,[InSchoolTelephone] | |||
,[AbmormityMoveMark] | |||
,[AwardMark] | |||
,[PunishMark] | |||
,[LinkmanMark] | |||
,[StuNoChangeMark] | |||
,[FinishSchoolMark] | |||
,[CurrentRegisterMark] | |||
,[FinishSchoolDate] | |||
,[DiplomaNo] | |||
,[DiplomaRemark] | |||
,[Remark] | |||
,[RegisterDate] | |||
,[Photo] | |||
,[TeachPlanNo] | |||
,[mobile] | |||
,[EMail] | |||
,[QQ] | |||
,[FatherName] | |||
,[FatherUnit] | |||
,[FatherPhone] | |||
,[MatherName] | |||
,[MatherUnit] | |||
,[MatherPhone] | |||
,[Gender] | |||
,[Residence] | |||
,[CheckMark] | |||
,[DeptNo] | |||
,[MajorNo] | |||
,[ClassName] | |||
,[IsProvinceFirstThree] | |||
,[OverseasChineseName] | |||
,[ComeProvince] | |||
,[MailAddress] | |||
,[LengthOfSchooling] | |||
,[DormBuildingNo] | |||
,[UnitNo] | |||
,[DormNo] | |||
,[StuDorm] | |||
,[DeptShortName] | |||
,[ksh] | |||
,[GovMajorNo] | |||
,[GovMajorName] | |||
,[PartyFaceNo] | |||
,[NationalityNo] | |||
,[MajorDetailNo] | |||
,[MajorDetailName] | |||
,[ClassTutorNo] | |||
,[ClassDiredctorNo] | |||
,[InSchoolStatus] | |||
,[AbmormityMove] | |||
,[ResumeCheck] | |||
FROM [vwStuInfoBasicInCollege] order by StuNo OFFSET (@PageIndex-1)*@Pagenum ROWS FETCH next @Pagenum rows only"; | |||
} | |||
else if (category == 1) | |||
{ | |||
rowCountSql = @"SELECT rows FROM sysindexes | |||
WHERE id = OBJECT_ID('[EmpInfo]') AND indid< 2"; | |||
infoSql = @"SELECT [EmpNo] | |||
,[EmpName] | |||
,[Age] | |||
,[Birthday] | |||
,[TitleOfTechPost] | |||
,RTRIM([DegreeName]) DegreeName | |||
,[PartyFace] | |||
,[ProvinceName] | |||
,RTRIM([SubjectSpecies]) SubjectSpecies | |||
,[OverseasChineseName] | |||
,[FamilyOrigin] | |||
,RTRIM([Nationality]) Nationality | |||
,[DeptName] | |||
,[ForeignLanguageName] | |||
,[HealthStatus] | |||
,[CultureDegree] | |||
,[GraduateSchoolName] | |||
,[SpellBrief] | |||
,[InSchoolDate] | |||
,[mobile] | |||
,[EMail] | |||
,[resume] | |||
,[LocusOfArchives] | |||
,[LocusOfResidence] | |||
,[Linkman] | |||
,[RelationOfLinkman] | |||
,[PhoneOfLinkman] | |||
,[IdentityCardNo] | |||
,[Photo] | |||
,[Gender] | |||
,[EmpFullTime] | |||
,[EmpSort] | |||
,[CheckMark] | |||
,[IsInActiveStatus] | |||
,[StaffRoomName] | |||
,[DeptShortName] | |||
,[DeptNo] | |||
,[Birthplace] | |||
,[Homeaddress] | |||
,[Postcode] | |||
,[HandMobile] | |||
,[PartyFaceNo] | |||
,[NationalityNo] | |||
,[position] | |||
,[ResumeCheck] | |||
,[ResumeCheckNo] | |||
,[Marry] | |||
,[isTeacher] | |||
,[DegreeNo] | |||
,[ProvinceNo] | |||
,[WorkDate] | |||
,[CultureDegree2] | |||
,[Degree2] | |||
,[GraduateSchoolName2] | |||
,[GraduateDate1] | |||
,[GraduateDate2] | |||
,[Major1] | |||
,[Major2] | |||
FROM [vwEmpInfoAll] order by EmpNo OFFSET (@PageIndex-1)*@Pagenum ROWS FETCH next @Pagenum rows only"; | |||
} | |||
else | |||
{ | |||
return ResultInfo(HttpStatusCode.NotFound, result: Result.NotFound); | |||
} | |||
using (IDbConnection conn = new SqlConnection(_sqlConnection)) | |||
{ | |||
info = await conn.QueryAsync(infoSql, new { PageIndex = pageIndex, Pagenum = pageNum }); | |||
rowCount = await conn.QueryFirstOrDefaultAsync<int>(rowCountSql); | |||
if (info == null) | |||
{ | |||
return ResultInfo(HttpStatusCode.NotFound, result: Result.NotFound); | |||
} | |||
var totalPage = Convert.ToInt32(Math.Ceiling((double)rowCount / pageNum)); | |||
return ResultInfo(new { pagination = new { total = rowCount, totalPages = totalPage, perPage = pageNum, currentPage = pageIndex }, info }); | |||
} | |||
} | |||
//todo:测试 | |||
/// <summary> | |||
/// 测试 | |||
/// </summary> | |||
/// <returns></returns> | |||
[HttpGet] | |||
public IHttpActionResult BeginCeshi() | |||
{ | |||
//RecurringJob.AddOrUpdate("CHANGYANGYKT1", | |||
// () => YKTTrabs.GetChangeYangYKT(), | |||
// Cron.Daily(9), TimeZoneInfo.Local); | |||
try | |||
{ | |||
using (IDbConnection conn = new SqlConnection(_coresqlConnection)) | |||
{ | |||
conn.Execute("insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),999,'测试','进入测试方法',getdate())"); | |||
//调接口 | |||
var responsejson = HttpMethods.HttpGet("http://localhost:8088//TransferApi/BasicInfo/sendStudentInfo"); | |||
if (!string.IsNullOrEmpty(responsejson)) | |||
{ | |||
conn.Execute("insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),999,'测试','调接口结果为:"+ responsejson + "',getdate())"); | |||
} | |||
} | |||
} | |||
catch (Exception ex) | |||
{ | |||
using (IDbConnection conn = new SqlConnection(_coresqlConnection)) | |||
{ | |||
conn.Execute( | |||
$"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),999,'测试','{ex.Message}',getdate())"); | |||
} | |||
} | |||
return Ok(); | |||
} | |||
} | |||
} |
@@ -0,0 +1,603 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Configuration; | |||
using System.Data; | |||
using System.Data.SqlClient; | |||
using System.Linq; | |||
using System.Net; | |||
using System.Net.Http; | |||
using System.Web.Http; | |||
using Dapper; | |||
using DigitalSchoolApi.Models; | |||
using Hangfire; | |||
using Learun.Application.Organization; | |||
namespace DigitalSchoolApi.Controllers | |||
{ | |||
public class YKTController : BaseController | |||
{ | |||
private readonly static string _admsConnection = ConfigurationManager.ConnectionStrings["CoreDBString"].ConnectionString; | |||
private readonly static string _misConnection = ConfigurationManager.ConnectionStrings["ConnectionPfcMisDBString"].ConnectionString; | |||
/// <summary> | |||
/// 西昌一卡通推送 | |||
/// </summary> | |||
/// <returns></returns> | |||
public IHttpActionResult Begin() | |||
{ | |||
//西昌 | |||
//YKTTrabs.BeginTrans(); | |||
RecurringJob.AddOrUpdate("YKT", | |||
() => YKTTrabs.BeginTrans(), | |||
Cron.Daily(13), TimeZoneInfo.Local); | |||
RecurringJob.AddOrUpdate("YKT2", | |||
() => YKTTrabs.BeginTrans(), | |||
Cron.Daily(22), TimeZoneInfo.Local); | |||
//金隅 | |||
//RecurringJob.AddOrUpdate("JINYUYKT", | |||
// () => YKTTrabs.GetConsumeInfo(), | |||
// Cron.Daily(0), TimeZoneInfo.Local); | |||
//RecurringJob.AddOrUpdate("JINYUYKT2", | |||
// () => YKTTrabs.GetConsumeInfo(), | |||
// Cron.Daily(14), TimeZoneInfo.Local); | |||
//RecurringJob.AddOrUpdate("JINYUYKTSAVER", | |||
// () => YKTTrabs.GetSaveRecordInfo(), | |||
// Cron.Daily(14), TimeZoneInfo.Local); | |||
//RecurringJob.AddOrUpdate("PUSHWEIXIN", | |||
// () => YKTTrabs.PushWeixin(), | |||
// Cron.Daily(0), TimeZoneInfo.Local); | |||
return Ok(); | |||
} | |||
/// <summary> | |||
/// 开启金隅一卡通推送 | |||
/// </summary> | |||
/// <returns></returns> | |||
public IHttpActionResult BeginJinyu() | |||
{ | |||
//金隅 | |||
RecurringJob.AddOrUpdate("JINYUYKT", | |||
() => YKTTrabs.GetConsumeInfo(), | |||
Cron.Daily(0), TimeZoneInfo.Local); | |||
RecurringJob.AddOrUpdate("JINYUYKT2", | |||
() => YKTTrabs.GetConsumeInfo(), | |||
Cron.Daily(14), TimeZoneInfo.Local); | |||
RecurringJob.AddOrUpdate("JINYUYKTSAVER", | |||
() => YKTTrabs.GetSaveRecordInfo(), | |||
Cron.Daily(14), TimeZoneInfo.Local); | |||
//YKTTrabs.GetConsumeInfo(); | |||
//RecurringJob.AddOrUpdate("PUSHWEIXIN", | |||
// () => YKTTrabs.PushWeixin(), | |||
// Cron.Daily(0), TimeZoneInfo.Local); | |||
return Ok(); | |||
} | |||
/// <summary> | |||
/// 西昌在线缴费状态 | |||
/// </summary> | |||
/// <returns></returns> | |||
public IHttpActionResult QueryPayData() | |||
{ | |||
//YKTTrabs.GetEBillPicUrl(); | |||
//YKTTrabs.InvoiceEBillMethod(); | |||
RecurringJob.AddOrUpdate("QueryPayData", | |||
() => YKTTrabs.QueryPayData(), | |||
Cron.MinuteInterval(5), TimeZoneInfo.Local); | |||
return Ok(); | |||
} | |||
/// <summary> | |||
/// 西昌中间库学生表更新 | |||
/// </summary> | |||
/// <returns></returns> | |||
public IHttpActionResult MiddleDBUpdStuData() | |||
{ | |||
//YKTTrabs.MiddleDBUpdStuData(); | |||
RecurringJob.AddOrUpdate("MiddleDBUpdStuData", | |||
() => YKTTrabs.MiddleDBUpdStuData(), | |||
Cron.Daily(2), TimeZoneInfo.Local); | |||
return Ok(); | |||
} | |||
/// <summary> | |||
/// 长阳获取饭卡流水 | |||
/// </summary> | |||
/// <returns></returns> | |||
public IHttpActionResult BeginChangYang() | |||
{ | |||
//YKTTrabs.GetChangeYangYKT(); | |||
RecurringJob.AddOrUpdate("CHANGYANGYKT1", | |||
() => YKTTrabs.GetChangeYangYKT(), | |||
Cron.Daily(9), TimeZoneInfo.Local); | |||
RecurringJob.AddOrUpdate("CHANGYANGYKT2", | |||
() => YKTTrabs.GetChangeYangYKT(), | |||
Cron.Daily(14), TimeZoneInfo.Local); | |||
RecurringJob.AddOrUpdate("CHANGYANGYKT3", | |||
() => YKTTrabs.GetChangeYangYKT(), | |||
Cron.Daily(21), TimeZoneInfo.Local); | |||
return Ok(); | |||
} | |||
/// <summary> | |||
/// 河南新安定时获取部门用户信息 | |||
/// </summary> | |||
/// <returns></returns> | |||
[HttpGet] | |||
public IHttpActionResult HeNanXinAnBegin() | |||
{ | |||
//YKTTrabs.BgeinHeNanXinAn(); | |||
RecurringJob.AddOrUpdate("HNXA", | |||
() => YKTTrabs.BgeinHeNanXinAn(), | |||
Cron.Daily(13), TimeZoneInfo.Local); | |||
return Ok(); | |||
} | |||
/// <summary> | |||
/// 金隅消费信息 | |||
/// </summary> | |||
/// <returns></returns> | |||
[HttpGet] | |||
public IHttpActionResult Balance() | |||
{ | |||
RecurringJob.Trigger("JINYUYKT"); | |||
//YKTTrabs.GetConsumeInfo(); | |||
return Ok(); | |||
} | |||
/// <summary> | |||
/// 测试PUSHWEIXIN | |||
/// </summary> | |||
/// <returns></returns> | |||
[HttpGet] | |||
public IHttpActionResult PushWeixinTest() | |||
{ | |||
RecurringJob.Trigger("PUSHWEIXIN"); | |||
return Ok(); | |||
} | |||
/// <summary> | |||
/// 金隅充值记录 | |||
/// </summary> | |||
/// <returns></returns> | |||
[HttpGet] | |||
public IHttpActionResult GetSaveRecord() | |||
{ | |||
RecurringJob.Trigger("JINYUYKTSAVER"); | |||
//YKTTrabs.GetSaveRecordInfo(); | |||
return Ok(); | |||
} | |||
/// <summary> | |||
/// 停止西昌一卡通推送 | |||
/// </summary> | |||
/// <returns></returns> | |||
public IHttpActionResult Terminate() | |||
{ | |||
RecurringJob.RemoveIfExists("YKT"); | |||
RecurringJob.RemoveIfExists("YKT2"); | |||
//RecurringJob.RemoveIfExists("JINYUYKT"); | |||
//RecurringJob.RemoveIfExists("JINYUYKT2"); | |||
return Ok(); | |||
} | |||
/// <summary> | |||
/// 新疆巴楚教育局与java项目帐号同步 | |||
/// </summary> | |||
/// <returns></returns> | |||
public IHttpActionResult StartBachuAccount() | |||
{ | |||
RecurringJob.AddOrUpdate("BachuAccount", | |||
() => YKTTrabs.BeginBachuAccount(), | |||
Cron.Daily(22), TimeZoneInfo.Local); | |||
return Ok(); | |||
} | |||
/// <summary> | |||
/// 开始连接并监听考勤事件 | |||
/// </summary> | |||
/// <returns></returns> | |||
public IHttpActionResult StartConnectHK() | |||
{ | |||
BackgroundJob.Enqueue(() => HKAttendanceController.StartConnect()); | |||
RecurringJob.AddOrUpdate("HKAttendance", | |||
() => HKAttendanceController.StartConnect(), | |||
Cron.Yearly, TimeZoneInfo.Local); | |||
return Ok(); | |||
} | |||
/// <summary> | |||
/// 考勤机撤防 | |||
/// </summary> | |||
/// <returns></returns> | |||
public IHttpActionResult EndConnectHK() | |||
{ | |||
BackgroundJob.Enqueue(() => HKAttendanceController.EndConnect()); | |||
return Ok(); | |||
} | |||
/// <summary> | |||
/// 开始领导自动考勤 | |||
/// </summary> | |||
/// <returns></returns> | |||
public IHttpActionResult BeginLeaderAttendance() | |||
{ | |||
RecurringJob.AddOrUpdate("LeaderAttendance", | |||
() => HKAttendanceController.BeginLeaderAttendance(), | |||
Cron.Daily(19), TimeZoneInfo.Local); | |||
return Ok(); | |||
} | |||
/// <summary> | |||
/// 结束领导自动考勤 | |||
/// </summary> | |||
/// <returns></returns> | |||
public IHttpActionResult EndLeaderAttendance() | |||
{ | |||
RecurringJob.RemoveIfExists("LeaderAttendance"); | |||
return Ok(); | |||
} | |||
#region 长阳报名\晚归预警 | |||
/// <summary> | |||
/// 长阳报名 保存后24小时自动提交 | |||
/// </summary> | |||
/// <returns></returns> | |||
public IHttpActionResult CYStuVolunteer() | |||
{ | |||
RecurringJob.AddOrUpdate("CY", | |||
() => CYStuVolunteerController.StuVolunteer(), | |||
Cron.Minutely(), TimeZoneInfo.Local); | |||
return Ok(); | |||
} | |||
/// <summary> | |||
/// 长阳晚归预警 | |||
/// </summary> | |||
/// <returns></returns> | |||
public IHttpActionResult CYDormitoryReturn() | |||
{ | |||
int hour = 99; | |||
try | |||
{ | |||
using (IDbConnection conn = new SqlConnection(_misConnection)) | |||
{ | |||
Acc_DormitoryRuleEntity entity = conn.QueryFirstOrDefault<Acc_DormitoryRuleEntity>("select top 1 PushHour from Acc_DormitoryRule where IsEnable=1"); | |||
if (entity != null && entity.PushHour >= 0) | |||
{ | |||
hour = Convert.ToInt32(entity.PushHour); | |||
} | |||
} | |||
} | |||
catch (Exception ex) | |||
{ | |||
using (IDbConnection conn = new SqlConnection(_admsConnection)) | |||
{ | |||
conn.Execute( | |||
$"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),998,'寝室晚归预警获取推送时间点发生异常','{ex.Message}',getdate())"); | |||
} | |||
} | |||
if (hour != 99) | |||
{ | |||
RecurringJob.AddOrUpdate("CYLRP", | |||
() => CYDormitoryReturnController.LateReturnPush(), | |||
Cron.Daily(hour), TimeZoneInfo.Local); | |||
} | |||
return Ok(); | |||
} | |||
private class Acc_DormitoryRuleEntity | |||
{ | |||
public int? PushHour { get; set; } | |||
} | |||
#endregion | |||
#region 长阳中间库 | |||
/// <summary> | |||
/// 往长阳oracle中间库中同步数校基础信息 | |||
/// </summary> | |||
/// <returns></returns> | |||
public IHttpActionResult SyncBasicInfoToCYZJMiddle() | |||
{ | |||
//部门 | |||
//CYDormitoryReturnController.SyncDepartment(); | |||
RecurringJob.AddOrUpdate("SyncDepartmentToCYZJMiddle", | |||
() => CYDormitoryReturnController.SyncDepartment(), | |||
Cron.Daily(1), TimeZoneInfo.Local); | |||
//系部 | |||
//CYDormitoryReturnController.SyncDept(); | |||
RecurringJob.AddOrUpdate("SyncDeptToCYZJMiddle", | |||
() => CYDormitoryReturnController.SyncDept(), | |||
Cron.Daily(1), TimeZoneInfo.Local); | |||
//专业 | |||
//CYDormitoryReturnController.SyncMajor(); | |||
RecurringJob.AddOrUpdate("SyncMajorToCYZJMiddle", | |||
() => CYDormitoryReturnController.SyncMajor(), | |||
Cron.Daily(1), TimeZoneInfo.Local); | |||
//班级 | |||
//CYDormitoryReturnController.SyncClassInfo(); | |||
RecurringJob.AddOrUpdate("SyncClassInfoToCYZJMiddle", | |||
() => CYDormitoryReturnController.SyncClassInfo(), | |||
Cron.Daily(1), TimeZoneInfo.Local); | |||
//教室 | |||
//CYDormitoryReturnController.SyncClassRoom(); | |||
RecurringJob.AddOrUpdate("SyncClassRoomToCYZJMiddle", | |||
() => CYDormitoryReturnController.SyncClassRoom(), | |||
Cron.Daily(1), TimeZoneInfo.Local); | |||
//学生 | |||
//CYDormitoryReturnController.SyncStuInfo(); | |||
RecurringJob.AddOrUpdate("SyncStuInfoToCYZJMiddle", | |||
() => CYDormitoryReturnController.SyncStuInfo(), | |||
Cron.Daily(1), TimeZoneInfo.Local); | |||
//教师 | |||
//CYDormitoryReturnController.SyncEmpInfo(); | |||
RecurringJob.AddOrUpdate("SyncEmpInfoToCYZJMiddle", | |||
() => CYDormitoryReturnController.SyncEmpInfo(), | |||
Cron.Daily(1), TimeZoneInfo.Local); | |||
//宿舍 | |||
//CYDormitoryReturnController.SyncDormitoryBuild(); | |||
RecurringJob.AddOrUpdate("SyncDormitoryBuildToCYZJMiddle", | |||
() => CYDormitoryReturnController.SyncDormitoryBuild(), | |||
Cron.Daily(1), TimeZoneInfo.Local); | |||
return Ok(); | |||
} | |||
#endregion | |||
#region 怀来职教中间库 | |||
/// <summary> | |||
/// 往怀来职教oracle中间库中同步数校基础信息 | |||
/// </summary> | |||
/// <returns></returns> | |||
public IHttpActionResult SyncBasicInfoToHLZJMiddle() | |||
{ | |||
//部门 | |||
//HLSchoolController.SyncDepartment(); | |||
RecurringJob.AddOrUpdate("SyncDepartmentToHLZJMiddle", | |||
() => HLSchoolController.SyncDepartment(), | |||
Cron.Daily(1), TimeZoneInfo.Local); | |||
//系部 | |||
//HLSchoolController.SyncDept(); | |||
RecurringJob.AddOrUpdate("SyncDeptToHLZJMiddle", | |||
() => HLSchoolController.SyncDept(), | |||
Cron.Daily(1), TimeZoneInfo.Local); | |||
//专业 | |||
//HLSchoolController.SyncMajor(); | |||
RecurringJob.AddOrUpdate("SyncMajorToHLZJMiddle", | |||
() => HLSchoolController.SyncMajor(), | |||
Cron.Daily(1), TimeZoneInfo.Local); | |||
//班级 | |||
//HLSchoolController.SyncClassInfo(); | |||
RecurringJob.AddOrUpdate("SyncClassInfoToHLZJMiddle", | |||
() => HLSchoolController.SyncClassInfo(), | |||
Cron.Daily(1), TimeZoneInfo.Local); | |||
//教室 | |||
//HLSchoolController.SyncClassRoom(); | |||
RecurringJob.AddOrUpdate("SyncClassRoomToHLZJMiddle", | |||
() => HLSchoolController.SyncClassRoom(), | |||
Cron.Daily(1), TimeZoneInfo.Local); | |||
//学生 | |||
//HLSchoolController.SyncStuInfo(); | |||
RecurringJob.AddOrUpdate("SyncStuInfoToHLZJMiddle", | |||
() => HLSchoolController.SyncStuInfo(), | |||
Cron.Daily(1), TimeZoneInfo.Local); | |||
//教师 | |||
//HLSchoolController.SyncEmpInfo(); | |||
RecurringJob.AddOrUpdate("SyncEmpInfoToHLZJMiddle", | |||
() => HLSchoolController.SyncEmpInfo(), | |||
Cron.Daily(1), TimeZoneInfo.Local); | |||
//宿舍 | |||
//HLSchoolController.SyncDormitoryBuild(); | |||
RecurringJob.AddOrUpdate("SyncDormitoryBuildToHLZJMiddle", | |||
() => HLSchoolController.SyncDormitoryBuild(), | |||
Cron.Daily(1), TimeZoneInfo.Local); | |||
return Ok(); | |||
} | |||
#endregion | |||
#region 塔里木 | |||
/// <summary> | |||
/// 晚归预警 | |||
/// </summary> | |||
/// <returns></returns> | |||
public IHttpActionResult DormitoryIn() | |||
{ | |||
int hour = 99; | |||
try | |||
{ | |||
using (IDbConnection conn = new SqlConnection(_admsConnection)) | |||
{ | |||
Acc_DormitoryRuleEntity entity = conn.QueryFirstOrDefault<Acc_DormitoryRuleEntity>("select top 1 PushHour from Acc_DormitoryRule where IsEnable=1"); | |||
if (entity != null && entity.PushHour >= 0) | |||
{ | |||
hour = Convert.ToInt32(entity.PushHour); | |||
} | |||
} | |||
} | |||
catch (Exception ex) | |||
{ | |||
using (IDbConnection conn = new SqlConnection(_admsConnection)) | |||
{ | |||
conn.Execute( | |||
$"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),998,'寝室晚归预警获取推送时间点发生异常','{ex.Message}',getdate())"); | |||
} | |||
} | |||
if (hour != 99) | |||
{ | |||
RecurringJob.AddOrUpdate("TLMpush", | |||
() => TLMSchoolController.LateReturnPush(), | |||
Cron.Daily(hour), TimeZoneInfo.Local); | |||
} | |||
//TLMSchoolController.LateReturnPush(); | |||
return Ok(); | |||
} | |||
/// <summary> | |||
/// 锁定超过60天未登录的教师用户 | |||
/// </summary> | |||
/// <returns></returns> | |||
public IHttpActionResult CloseUser() | |||
{ | |||
RecurringJob.AddOrUpdate("TLMClose", | |||
() => TLMSchoolController.CloseAccount(), | |||
Cron.Daily(0), TimeZoneInfo.Local); | |||
//TLMSchoolController.CloseAccount(); | |||
return Ok(); | |||
} | |||
/// <summary> | |||
/// 往塔里木oracle中间库中同步数校基础信息 | |||
/// </summary> | |||
/// <returns></returns> | |||
public IHttpActionResult SyncBasicInfoToTLMZYMiddle() | |||
{ | |||
//部门 | |||
//TLMSchoolController.SyncDepartment(); | |||
RecurringJob.AddOrUpdate("SyncDepartmentToTLMZYMiddle", | |||
() => TLMSchoolController.SyncDepartment(), | |||
Cron.Daily(1), TimeZoneInfo.Local); | |||
//系部 | |||
//TLMSchoolController.SyncDept(); | |||
RecurringJob.AddOrUpdate("SyncDeptToTLMZYMiddle", | |||
() => TLMSchoolController.SyncDept(), | |||
Cron.Daily(1), TimeZoneInfo.Local); | |||
//专业 | |||
//TLMSchoolController.SyncMajor(); | |||
RecurringJob.AddOrUpdate("SyncMajorToTLMZYMiddle", | |||
() => TLMSchoolController.SyncMajor(), | |||
Cron.Daily(1), TimeZoneInfo.Local); | |||
//班级 | |||
//TLMSchoolController.SyncClassInfo(); | |||
RecurringJob.AddOrUpdate("SyncClassInfoToTLMZYMiddle", | |||
() => TLMSchoolController.SyncClassInfo(), | |||
Cron.Daily(1), TimeZoneInfo.Local); | |||
//教室 | |||
//TLMSchoolController.SyncClassRoom(); | |||
RecurringJob.AddOrUpdate("SyncClassRoomToTLMZYMiddle", | |||
() => TLMSchoolController.SyncClassRoom(), | |||
Cron.Daily(1), TimeZoneInfo.Local); | |||
//学生 | |||
//TLMSchoolController.SyncStuInfo(); | |||
RecurringJob.AddOrUpdate("SyncStuInfoToTLMZYMiddle", | |||
() => TLMSchoolController.SyncStuInfo(), | |||
Cron.Daily(1), TimeZoneInfo.Local); | |||
//教师 | |||
//TLMSchoolController.SyncEmpInfo(); | |||
RecurringJob.AddOrUpdate("SyncEmpInfoToTLMZYMiddle", | |||
() => TLMSchoolController.SyncEmpInfo(), | |||
Cron.Daily(1), TimeZoneInfo.Local); | |||
//宿舍 | |||
//TLMSchoolController.SyncDorm(); | |||
RecurringJob.AddOrUpdate("SyncDormToTLMZYMiddle", | |||
() => TLMSchoolController.SyncDorm(), | |||
Cron.Daily(1), TimeZoneInfo.Local); | |||
return Ok(); | |||
} | |||
/// <summary> | |||
/// 塔里木,给教职工发送邮件提醒 | |||
/// </summary> | |||
/// <returns></returns> | |||
public IHttpActionResult SendEmailToTeacher() | |||
{ | |||
try | |||
{ | |||
using (IDbConnection conn = new SqlConnection(_admsConnection)) | |||
{ | |||
//获取“学校邮箱管理”已启用的项 | |||
List<EmailManagementEntity> entityList = conn.Query<EmailManagementEntity>("select * from EmailManagement where F_EnabledMark=1 ").ToList(); | |||
if (entityList.Any()) | |||
{ | |||
if (entityList[0].F_Minute.HasValue)//时、分 | |||
{ | |||
//TLMSchoolController.AssignSendEmail(entityList); | |||
RecurringJob.AddOrUpdate("SendEmailToTeacher", | |||
() => TLMSchoolController.AssignSendEmail(entityList), | |||
Cron.Daily(entityList[0].F_Hour.Value, entityList[0].F_Minute.Value), TimeZoneInfo.Local); | |||
} | |||
else//时 | |||
{ | |||
//TLMSchoolController.AssignSendEmail(entityList); | |||
RecurringJob.AddOrUpdate("SendEmailToTeacher", | |||
() => TLMSchoolController.AssignSendEmail(entityList), | |||
Cron.Daily(entityList[0].F_Hour.Value), TimeZoneInfo.Local); | |||
} | |||
} | |||
} | |||
} | |||
catch (Exception ex) | |||
{ | |||
using (IDbConnection conn = new SqlConnection(_admsConnection)) | |||
{ | |||
conn.Execute( | |||
$"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),997,'发送邮件提醒','异常:{ex.Message}',getdate())"); | |||
} | |||
} | |||
return Ok(); | |||
} | |||
/// <summary> | |||
/// 塔里木固定资产,自动更新已提折旧月数 | |||
/// </summary> | |||
/// <returns></returns> | |||
public IHttpActionResult UpdateMonthsInFixAssets() | |||
{ | |||
try | |||
{ | |||
RecurringJob.AddOrUpdate("UpdateMonthsInFixAssets", | |||
() => TLMSchoolController.UpdateHaveDepreciationMonths(), | |||
Cron.Daily(0), TimeZoneInfo.Local); | |||
//TLMSchoolController.UpdateHaveDepreciationMonths(); | |||
} | |||
catch (Exception ex) | |||
{ | |||
using (IDbConnection conn = new SqlConnection(_admsConnection)) | |||
{ | |||
conn.Execute( | |||
$"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),996,'固定资产:自动更新已提折旧月数','异常:{ex.Message}',getdate())"); | |||
} | |||
} | |||
return Ok(); | |||
} | |||
#endregion | |||
#region 系统授权到期提醒(发送邮件) | |||
/// <summary> | |||
/// 授权到期提醒 上午九点 | |||
/// </summary> | |||
/// <returns></returns> | |||
public IHttpActionResult EmailSendAM() | |||
{ | |||
RecurringJob.AddOrUpdate("EmailSendAM", | |||
() => EmailSendController.Send(), | |||
Cron.Daily(9), TimeZoneInfo.Local); | |||
return Ok(); | |||
} | |||
/// <summary> | |||
/// 授权到期提醒 下午4点 | |||
/// </summary> | |||
/// <returns></returns> | |||
public IHttpActionResult EmailSendPM() | |||
{ | |||
RecurringJob.AddOrUpdate("EmailSendPM", | |||
() => EmailSendController.Send(), | |||
Cron.Daily(16), TimeZoneInfo.Local); | |||
return Ok(); | |||
} | |||
#endregion | |||
} | |||
} |
@@ -0,0 +1,117 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Configuration; | |||
using System.Data; | |||
using System.Data.SqlClient; | |||
using System.Linq; | |||
using System.Net; | |||
using System.Net.Http; | |||
using System.Text.RegularExpressions; | |||
using System.Threading.Tasks; | |||
using System.Web; | |||
using Dapper; | |||
using DigitalSchoolApi.App_Data; | |||
using DigitalSchoolApi.Models; | |||
using Learun.Application.Organization; | |||
using Learun.Util; | |||
using Newtonsoft.Json; | |||
using Convert = System.Convert; | |||
namespace DigitalSchoolApi.Controllers | |||
{ | |||
/// <summary> | |||
/// 授权到期提醒 | |||
/// </summary> | |||
public class EmailSendController | |||
{ | |||
private readonly static string _admsConnection = ConfigurationManager.ConnectionStrings["CoreDBString"].ConnectionString; | |||
private readonly static string _misConnection = ConfigurationManager.ConnectionStrings["ConnectionPfcMisDBString"].ConnectionString; | |||
public static void Send() | |||
{ | |||
try | |||
{ | |||
//获取授权到期时间 | |||
var lc = LicenseChecker.CheckLicense(); | |||
//授权到期前发送邮件提醒 | |||
if (!string.IsNullOrEmpty(lc.ExpirationDate) && !lc.ExpirationDate.Contains("永久有效")) | |||
{ | |||
using (IDbConnection admscon = new SqlConnection(_admsConnection)) | |||
{ | |||
admscon.Execute( | |||
"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),997,'授权到期提醒','开始推送',getdate())"); | |||
//获取授权查看规则 | |||
var showAuthorize = admscon.QueryFirstOrDefault<ShowAuthorizeEntity>("select top 1 * from ShowAuthorize "); | |||
if (showAuthorize != null && showAuthorize.IsRemind == 1 && !string.IsNullOrEmpty(showAuthorize.EmailAddr)) | |||
{ | |||
//授权到期时间 | |||
DateTime expirationDate = Convert.ToDateTime(lc.ExpirationDate); | |||
DateTime now = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd")); | |||
//计算授权到期时间与当前时间相差的天数 | |||
var ts = (expirationDate - now).Days; | |||
//到期前{ExpirationTime}天,每天发送一封邮件 | |||
if (ts >= 0 && ts <= showAuthorize.ExpirationTime) | |||
{ | |||
admscon.Execute( | |||
"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),997,'授权到期提醒','即将到期,发送提醒',getdate())"); | |||
//发送邮件 | |||
if (MailHelper.Send(showAuthorize.EmailAddr, showAuthorize.EmailTitle, | |||
showAuthorize.EmailContent)) | |||
{ | |||
//发送邮件成功,记录数据 | |||
var F_Sender = ConfigurationManager.AppSettings["MailUserName"]; | |||
string addSendSql = $@"INSERT INTO [dbo].[LR_EmailSend] | |||
([F_Id] | |||
,[F_Sender] | |||
,[F_SenderName] | |||
,[F_To] | |||
,[F_Subject] | |||
,[F_BodyText] | |||
,[F_Description] | |||
,[F_EnabledMark] | |||
,[F_DeleteMark] | |||
,F_CreatorTime | |||
,[F_Date]) | |||
VALUES | |||
(NEWID() | |||
,'{F_Sender}' | |||
,null | |||
,'{showAuthorize.EmailAddr}' | |||
,'{showAuthorize.EmailTitle}' | |||
,'{showAuthorize.EmailContent}' | |||
,'授权到期提醒' | |||
,0 | |||
,0 | |||
,getdate() | |||
,getdate()) "; | |||
admscon.Execute(addSendSql); | |||
} | |||
admscon.Execute( | |||
"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),997,'授权到期提醒','发送成功',getdate())"); | |||
} | |||
else | |||
{ | |||
admscon.Execute( | |||
"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),997,'授权到期提醒','暂未到期',getdate())"); | |||
} | |||
} | |||
} | |||
} | |||
} | |||
catch (Exception ex) | |||
{ | |||
using (IDbConnection conn = new SqlConnection(_admsConnection)) | |||
{ | |||
conn.Execute( | |||
$"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),997,'授权到期提醒异常','{ex.Message}',getdate())"); | |||
} | |||
} | |||
} | |||
} | |||
} |
@@ -0,0 +1,830 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Configuration; | |||
using System.Data; | |||
using System.Data.SqlClient; | |||
using System.IO; | |||
using System.Linq; | |||
using System.Runtime.InteropServices; | |||
using System.Web; | |||
using AlarmCSharpDemo; | |||
using Dapper; | |||
namespace DigitalSchoolApi.Controllers | |||
{ | |||
public static class HKAttendanceController | |||
{ | |||
private static string _misConnection = | |||
ConfigurationManager.ConnectionStrings["ConnectionPfcMisDBString"].ConnectionString; | |||
private static string _coreConnection = | |||
ConfigurationManager.ConnectionStrings["CoreDBString"].ConnectionString; | |||
//海康考勤机回调 | |||
public static CHCNetSDK.LoginResultCallBack LoginCallBack = null; | |||
private static CHCNetSDK.EXCEPYIONCALLBACK m_fExceptionCB = null; | |||
private static CHCNetSDK.MSGCallBack_V31 m_falarmData_V31 = null; | |||
public static void StartConnect() | |||
{ | |||
#region 海康考勤机对接 | |||
//初始化SDK | |||
bool m_bInitSDK = CHCNetSDK.NET_DVR_Init(); | |||
if (m_bInitSDK) | |||
{ | |||
//保存SDK日志 To save the SDK log | |||
CHCNetSDK.NET_DVR_SetLogToFile(3, "C:\\HKSdkLog\\", true); | |||
//设置透传报警信息类型 | |||
CHCNetSDK.NET_DVR_LOCAL_GENERAL_CFG struLocalCfg = new CHCNetSDK.NET_DVR_LOCAL_GENERAL_CFG(); | |||
struLocalCfg.byAlarmJsonPictureSeparate = 1;//控制JSON透传报警数据和图片是否分离,0-不分离(COMM_VCA_ALARM返回),1-分离(分离后走COMM_ISAPI_ALARM回调返回) | |||
Int32 nSize = Marshal.SizeOf(struLocalCfg); | |||
IntPtr ptrLocalCfg = Marshal.AllocHGlobal(nSize); | |||
Marshal.StructureToPtr(struLocalCfg, ptrLocalCfg, false); | |||
if (!CHCNetSDK.NET_DVR_SetSDKLocalCfg(17, ptrLocalCfg)) //NET_DVR_LOCAL_CFG_TYPE_GENERAL | |||
{ | |||
string strErr = "海康NET_DVR_SetSDKLocalCfg 失败, error code= " + CHCNetSDK.NET_DVR_GetLastError(); | |||
ADR_DeviceLogEntity adrDeviceLogEntity = new ADR_DeviceLogEntity(); | |||
adrDeviceLogEntity.Create(); | |||
adrDeviceLogEntity.LogData = strErr; | |||
adrDeviceLogEntity.LogType = "2"; | |||
//写入数据库 | |||
using (IDbConnection connmis = new SqlConnection(_misConnection)) | |||
{ | |||
connmis.Execute("insert into ADR_DeviceLog(LogId, LogType, LogData, F_CreateDate, F_CreateUserId, F_CreateUserName) values(" + | |||
"'" + adrDeviceLogEntity.LogId + "','" + adrDeviceLogEntity.LogType + "'," + | |||
"'" + adrDeviceLogEntity.LogData + "','" + adrDeviceLogEntity.F_CreateDate + "','system','自动化服务')"); | |||
} | |||
} | |||
Marshal.FreeHGlobal(ptrLocalCfg); | |||
//设置异常消息回调函数 | |||
if (m_fExceptionCB == null) | |||
{ | |||
m_fExceptionCB = new CHCNetSDK.EXCEPYIONCALLBACK(cbExceptionCB); | |||
} | |||
CHCNetSDK.NET_DVR_SetExceptionCallBack_V30(0, IntPtr.Zero, m_fExceptionCB, IntPtr.Zero); | |||
//设置报警回调函数 | |||
if (m_falarmData_V31 == null) | |||
{ | |||
m_falarmData_V31 = new CHCNetSDK.MSGCallBack_V31(MsgCallback_V31); | |||
} | |||
CHCNetSDK.NET_DVR_SetDVRMessageCallBack_V31(m_falarmData_V31, IntPtr.Zero); | |||
using (IDbConnection connmis = new SqlConnection(_misConnection)) | |||
{ | |||
//获取设备 | |||
var devicelist = connmis.Query<ADR_DeviceEntity>("select * from ADR_Device where F_EnabledMark=1"); | |||
//登录设备 | |||
foreach (var deviceEntity in devicelist) | |||
{ | |||
CHCNetSDK.NET_DVR_USER_LOGIN_INFO struLogInfo = new CHCNetSDK.NET_DVR_USER_LOGIN_INFO(); | |||
//设备IP地址或者域名 | |||
byte[] byIP = System.Text.Encoding.Default.GetBytes(deviceEntity.IpAddress); | |||
struLogInfo.sDeviceAddress = new byte[129]; | |||
byIP.CopyTo(struLogInfo.sDeviceAddress, 0); | |||
//设备用户名 | |||
byte[] byUserName = System.Text.Encoding.Default.GetBytes(deviceEntity.AdminAccount); | |||
struLogInfo.sUserName = new byte[64]; | |||
byUserName.CopyTo(struLogInfo.sUserName, 0); | |||
//设备密码 | |||
byte[] byPassword = System.Text.Encoding.Default.GetBytes(deviceEntity.AdminPwd); | |||
struLogInfo.sPassword = new byte[64]; | |||
byPassword.CopyTo(struLogInfo.sPassword, 0); | |||
struLogInfo.wPort = ushort.Parse(deviceEntity.PortNumber.ToString());//设备服务端口号 | |||
//用户数据,回调时可用 | |||
//获取大小 | |||
//uint dwSize = (uint)Marshal.SizeOf(deviceEntity); | |||
////分配内存 | |||
//IntPtr ptrCond = Marshal.AllocHGlobal((int)dwSize); | |||
////写入内存 | |||
//Marshal.StructureToPtr(deviceEntity, ptrCond, false); | |||
////用户数据,回调时可用 | |||
//struLogInfo.pUser = ptrCond; | |||
//struLogInfo.bUseAsynLogin = false; //是否异步登录:0- 否,1- 是 | |||
//struLogInfo.cbLoginResult = new CHCNetSDK.LoginResultCallBack(AsynLoginMsgCallback);//注册回调函数; | |||
struLogInfo.byLoginMode = 0; //0-Private, 1-ISAPI, 2-自适应 | |||
struLogInfo.byHttps = 0; //0-不适用tls,1-使用tls 2-自适应 | |||
CHCNetSDK.NET_DVR_DEVICEINFO_V40 DeviceInfo = new CHCNetSDK.NET_DVR_DEVICEINFO_V40(); | |||
DeviceInfo.struDeviceV30.sSerialNumber = new byte[CHCNetSDK.SERIALNO_LEN]; | |||
//登录设备 Login the device | |||
var lUserID = CHCNetSDK.NET_DVR_Login_V40(ref struLogInfo, ref DeviceInfo); | |||
//释放内存 | |||
//Marshal.FreeHGlobal(ptrCond); | |||
//同步登录方法 | |||
string strLoginCallBack = ""; | |||
if (lUserID < 0) | |||
{ | |||
uint iErrCode = CHCNetSDK.NET_DVR_GetLastError(); | |||
strLoginCallBack = "登录设备失败,lUserID:" + lUserID + ",错误号:" + iErrCode; | |||
ADR_DeviceLogEntity adrDeviceLogEntity = new ADR_DeviceLogEntity(); | |||
adrDeviceLogEntity.Create(); | |||
if (!string.IsNullOrEmpty(deviceEntity.Id)) | |||
{ | |||
adrDeviceLogEntity.DeviceId = deviceEntity.Id; | |||
strLoginCallBack += ",设备IP:" + deviceEntity.IpAddress; | |||
} | |||
adrDeviceLogEntity.LogData = strLoginCallBack; | |||
adrDeviceLogEntity.LogType = "2"; | |||
connmis.Execute("insert into ADR_DeviceLog(LogId,DeviceId, LogType, LogData, F_CreateDate, F_CreateUserId, F_CreateUserName) values(" + | |||
"'" + adrDeviceLogEntity.LogId + "','" + adrDeviceLogEntity.DeviceId + "','" + adrDeviceLogEntity.LogType + "'," + | |||
"'" + adrDeviceLogEntity.LogData + "','" + adrDeviceLogEntity.F_CreateDate + "','system','自动化服务')"); | |||
} | |||
else | |||
{ | |||
//登录成功 | |||
strLoginCallBack = "登录设备成功,lUserID:" + lUserID; | |||
ADR_DeviceLogEntity adrDeviceLogEntity = new ADR_DeviceLogEntity(); | |||
adrDeviceLogEntity.Create(); | |||
if (!string.IsNullOrEmpty(deviceEntity.Id)) | |||
{ | |||
adrDeviceLogEntity.DeviceId = deviceEntity.Id; | |||
strLoginCallBack += ",设备IP:" + deviceEntity.IpAddress; | |||
} | |||
adrDeviceLogEntity.LogData = strLoginCallBack; | |||
adrDeviceLogEntity.LogType = "0"; | |||
connmis.Execute("insert into ADR_DeviceLog(LogId,DeviceId, LogType, LogData, F_CreateDate, F_CreateUserId, F_CreateUserName) values(" + | |||
"'" + adrDeviceLogEntity.LogId + "','" + adrDeviceLogEntity.DeviceId + "','" + adrDeviceLogEntity.LogType + "'," + | |||
"'" + adrDeviceLogEntity.LogData + "','" + adrDeviceLogEntity.F_CreateDate + "','system','自动化服务')"); | |||
//设备布防 | |||
CHCNetSDK.NET_DVR_SETUPALARM_PARAM struAlarmParam = new CHCNetSDK.NET_DVR_SETUPALARM_PARAM(); | |||
struAlarmParam.dwSize = (uint)Marshal.SizeOf(struAlarmParam); | |||
struAlarmParam.byLevel = 1; //0- 一级布防,1- 二级布防 | |||
struAlarmParam.byAlarmInfoType = 1;//智能交通设备有效,新报警信息类型 | |||
struAlarmParam.byDeployType = 0; | |||
struAlarmParam.byFaceAlarmDetection = 1;//1-人脸侦测 | |||
var m_lUserID = CHCNetSDK.NET_DVR_SetupAlarmChan_V41(lUserID, ref struAlarmParam); | |||
if (m_lUserID < 0) | |||
{ | |||
string strErr = "布防失败,错误号:" + CHCNetSDK.NET_DVR_GetLastError(); //布防失败,输出错误号 | |||
adrDeviceLogEntity = new ADR_DeviceLogEntity(); | |||
adrDeviceLogEntity.Create(); | |||
if (deviceEntity != null && !string.IsNullOrEmpty(deviceEntity.Id)) | |||
{ | |||
adrDeviceLogEntity.DeviceId = deviceEntity.Id; | |||
strErr += ",设备IP:" + deviceEntity.IpAddress; | |||
} | |||
adrDeviceLogEntity.LogData = strErr; | |||
adrDeviceLogEntity.LogType = "2"; | |||
connmis.Execute("insert into ADR_DeviceLog(LogId,DeviceId, LogType, LogData, F_CreateDate, F_CreateUserId, F_CreateUserName) values(" + | |||
"'" + adrDeviceLogEntity.LogId + "','" + adrDeviceLogEntity.DeviceId + "','" + adrDeviceLogEntity.LogType + "'," + | |||
"'" + adrDeviceLogEntity.LogData + "','" + adrDeviceLogEntity.F_CreateDate + "','system','自动化服务')"); | |||
//更新设备状态 | |||
deviceEntity.DOnlineStatus = false; | |||
} | |||
else | |||
{ | |||
adrDeviceLogEntity = new ADR_DeviceLogEntity(); | |||
adrDeviceLogEntity.Create(); | |||
string strNotice = "布防成功"; | |||
if (!string.IsNullOrEmpty(deviceEntity.Id)) | |||
{ | |||
adrDeviceLogEntity.DeviceId = deviceEntity.Id; | |||
strNotice += ",设备IP:" + deviceEntity.IpAddress; | |||
} | |||
adrDeviceLogEntity.LogData = strNotice; | |||
adrDeviceLogEntity.LogType = "0"; | |||
connmis.Execute("insert into ADR_DeviceLog(LogId,DeviceId, LogType, LogData, F_CreateDate, F_CreateUserId, F_CreateUserName) values(" + | |||
"'" + adrDeviceLogEntity.LogId + "','" + adrDeviceLogEntity.DeviceId + "','" + adrDeviceLogEntity.LogType + "'," + | |||
"'" + adrDeviceLogEntity.LogData + "','" + adrDeviceLogEntity.F_CreateDate + "','system','自动化服务')"); | |||
//更新设备状态 | |||
deviceEntity.DOnlineStatus = true; | |||
} | |||
//更新设备状态 | |||
connmis.Execute("update ADR_Device set DOnlineStatus=" + Convert.ToInt32(deviceEntity.DOnlineStatus) + ",DConnectDate=getdate(),DlUserID='" + lUserID + "' where Id='" + deviceEntity.Id + "'"); | |||
} | |||
} | |||
} | |||
} | |||
else//初始化失败 | |||
{ | |||
ADR_DeviceLogEntity adrDeviceLogEntity = new ADR_DeviceLogEntity(); | |||
adrDeviceLogEntity.Create(); | |||
adrDeviceLogEntity.LogData = "海康SDK初始化失败"; | |||
adrDeviceLogEntity.LogType = "2"; | |||
using (IDbConnection connmis = new SqlConnection(_misConnection)) | |||
{ | |||
connmis.Execute("insert into ADR_DeviceLog(LogId,DeviceId, LogType, LogData, F_CreateDate, F_CreateUserId, F_CreateUserName) values(" + | |||
"'" + adrDeviceLogEntity.LogId + "','" + adrDeviceLogEntity.DeviceId + "','" + adrDeviceLogEntity.LogType + "'," + | |||
"'" + adrDeviceLogEntity.LogData + "','" + adrDeviceLogEntity.F_CreateDate + "','system','自动化服务')"); | |||
} | |||
} | |||
#endregion | |||
} | |||
/// <summary> | |||
/// 海康异常回调 | |||
/// </summary> | |||
/// <param name = "dwType" ></ param > | |||
/// < param name="lUserID"></param> | |||
/// <param name = "lHandle" ></ param > | |||
/// < param name="pUser"></param> | |||
public static void cbExceptionCB(uint dwType, int lUserID, int lHandle, IntPtr pUser) | |||
{ | |||
//异常消息信息类型 | |||
string stringAlarm = "海康异常消息回调,信息类型:0x" + Convert.ToString(dwType, 16) + ", lUserID:" + lUserID + ", lHandle:" + lHandle; | |||
using (IDbConnection connmis = new SqlConnection(_misConnection)) | |||
{ | |||
var deviceEntity = connmis.QuerySingleOrDefault<ADR_DeviceEntity>("select * from ADR_Device where DlUserID='" + lUserID + "'"); | |||
ADR_DeviceLogEntity adrDeviceLogEntity = new ADR_DeviceLogEntity(); | |||
adrDeviceLogEntity.Create(); | |||
if (deviceEntity != null && !string.IsNullOrEmpty(deviceEntity.Id)) | |||
{ | |||
adrDeviceLogEntity.DeviceId = deviceEntity.Id; | |||
stringAlarm += ",设备IP:" + deviceEntity.IpAddress; | |||
} | |||
adrDeviceLogEntity.LogData = stringAlarm; | |||
adrDeviceLogEntity.LogType = "2"; | |||
connmis.Execute("insert into ADR_DeviceLog(LogId,DeviceId, LogType, LogData, F_CreateDate, F_CreateUserId, F_CreateUserName) values(" + | |||
"'" + adrDeviceLogEntity.LogId + "','" + adrDeviceLogEntity.DeviceId + "','" + adrDeviceLogEntity.LogType + "'," + | |||
"'" + adrDeviceLogEntity.LogData + "','" + adrDeviceLogEntity.F_CreateDate + "','system','自动化服务')"); | |||
} | |||
} | |||
/// <summary> | |||
/// 海康报警事件回调 | |||
/// </summary> | |||
/// <param name = "lCommand" ></ param > | |||
/// < param name="pAlarmer"></param> | |||
/// <param name = "pAlarmInfo" ></ param > | |||
/// < param name="dwBufLen"></param> | |||
/// <param name = "pUser" ></ param > | |||
/// < returns ></ returns > | |||
public static bool MsgCallback_V31(int lCommand, ref CHCNetSDK.NET_DVR_ALARMER pAlarmer, IntPtr pAlarmInfo, uint dwBufLen, IntPtr pUser) | |||
{ | |||
try | |||
{ | |||
if (lCommand == 0x5002) //门禁主机报警上传 | |||
{ | |||
using (IDbConnection connmis = new SqlConnection(_misConnection)) | |||
{ | |||
var deviceEntity = connmis.QuerySingleOrDefault<ADR_DeviceEntity>("select * from ADR_Device where DlUserID='" + pAlarmer.lUserID + "'"); | |||
var datetimenow = DateTime.Now; | |||
if (deviceEntity != null) | |||
{ | |||
//更新设备状态 | |||
deviceEntity.DConnectDate = datetimenow; | |||
connmis.Execute("update ADR_Device set DOnlineStatus=1,DConnectDate=getdate() where Id='" + deviceEntity.Id + "'"); | |||
} | |||
//通过lCommand来判断接收到的报警信息类型,不同的lCommand对应不同的pAlarmInfo内容 | |||
CHCNetSDK.NET_DVR_ACS_ALARM_INFO struAcsAlarm = new CHCNetSDK.NET_DVR_ACS_ALARM_INFO(); | |||
uint dwSize = (uint)Marshal.SizeOf(struAcsAlarm); | |||
struAcsAlarm = (CHCNetSDK.NET_DVR_ACS_ALARM_INFO)Marshal.PtrToStructure(pAlarmInfo, typeof(CHCNetSDK.NET_DVR_ACS_ALARM_INFO)); | |||
//报警时间:年月日时分秒 | |||
string strTimeYear = (struAcsAlarm.struTime.dwYear).ToString(); | |||
string strTimeMonth = (struAcsAlarm.struTime.dwMonth).ToString("d2"); | |||
string strTimeDay = (struAcsAlarm.struTime.dwDay).ToString("d2"); | |||
string strTimeHour = (struAcsAlarm.struTime.dwHour).ToString("d2"); | |||
string strTimeMinute = (struAcsAlarm.struTime.dwMinute).ToString("d2"); | |||
string strTimeSecond = (struAcsAlarm.struTime.dwSecond).ToString("d2"); | |||
string strTime = strTimeYear + "-" + strTimeMonth + "-" + strTimeDay + " " + strTimeHour + ":" + | |||
strTimeMinute + ":" + strTimeSecond; | |||
string stringAlarm = "门禁主机报警信息,dwMajor:0x" + Convert.ToString(struAcsAlarm.dwMajor, 16) + | |||
",dwMinor:0x" + | |||
Convert.ToString(struAcsAlarm.dwMinor, 16) + ",卡号:" + System.Text.Encoding.UTF8 | |||
.GetString(struAcsAlarm.struAcsEventInfo.byCardNo).TrimEnd('\0') | |||
+ ",读卡器编号:" + struAcsAlarm.struAcsEventInfo.dwCardReaderNo + ",报警触发时间:" + | |||
strTime + | |||
",事件流水号:" + struAcsAlarm.struAcsEventInfo.dwSerialNo; | |||
//这里判断是为了只获取刷脸的信息 | |||
if (struAcsAlarm.dwMajor == 0x5 && struAcsAlarm.dwMinor == 0x4b)//主事件0x5 代表EVENT,次事件0x4b 代表MINOR_FACE_VERIFY_PASS人脸认证通过 | |||
{ | |||
//报警设备IP地址 | |||
string strIP = System.Text.Encoding.UTF8.GetString(pAlarmer.sDeviceIP).TrimEnd('\0'); | |||
//抓拍图片路径 | |||
string str = ""; | |||
//保存抓拍图片 | |||
if ((struAcsAlarm.dwPicDataLen != 0) && (struAcsAlarm.pPicData != IntPtr.Zero)) | |||
{ | |||
string path = ConfigurationManager.AppSettings["AttendancePhotoPath"]; | |||
string datepath = DateTime.Now.ToString("yyyy-MM-dd"); | |||
if (!Directory.Exists(path + "\\" + datepath)) | |||
{ | |||
Directory.CreateDirectory(path + "\\" + datepath); | |||
} | |||
str = path + "\\Device_Acs_CapturePic_[" + strIP + "]_lUerID_[" + pAlarmer.lUserID + "]_" + | |||
CreateNo() + ".jpg"; | |||
FileStream fs = new FileStream(str, FileMode.Create); | |||
int iLen = (int)struAcsAlarm.dwPicDataLen; | |||
byte[] by = new byte[iLen]; | |||
Marshal.Copy(struAcsAlarm.pPicData, by, 0, iLen); | |||
fs.Write(by, 0, iLen); | |||
fs.Close(); | |||
} | |||
//如果能取到详细信息 | |||
if (struAcsAlarm.byAcsEventInfoExtend == 1) | |||
{ | |||
CHCNetSDK.NET_DVR_ACS_EVENT_INFO_EXTEND struInfoExtend = new CHCNetSDK.NET_DVR_ACS_EVENT_INFO_EXTEND(); | |||
uint dwSizeEx = (uint)Marshal.SizeOf(struInfoExtend); | |||
struInfoExtend = (CHCNetSDK.NET_DVR_ACS_EVENT_INFO_EXTEND)Marshal.PtrToStructure(struAcsAlarm.pAcsEventInfoExtend, typeof(CHCNetSDK.NET_DVR_ACS_EVENT_INFO_EXTEND)); | |||
stringAlarm += ", 人员类型:" + struInfoExtend.byUserType; | |||
} | |||
//考勤记录 | |||
//首先获取考勤规则 | |||
var attendancerulEntity = connmis.QuerySingleOrDefault<ADR_RestrictionEntity>("select * from ADR_Restriction where REnable=1"); | |||
if (attendancerulEntity != null) | |||
{ | |||
//员工卡号 | |||
string EmpNo = System.Text.Encoding.UTF8.GetString(struAcsAlarm.struAcsEventInfo.byCardNo).TrimEnd('\0'); | |||
//考勤状态 | |||
string ADType = "0"; | |||
//考勤结果 | |||
string ClockStatus = "1"; | |||
//当前服务器日期 | |||
var datenow = DateTime.Now.ToString("yyyy-MM-dd"); | |||
//设备事件时间 | |||
DateTime devicetime = Convert.ToDateTime(strTime); | |||
//上班时间 | |||
DateTime workDateTime = Convert.ToDateTime(datenow + " " + attendancerulEntity.WorkTime); | |||
//下班时间 | |||
DateTime offworkDateTime = Convert.ToDateTime(datenow + " " + attendancerulEntity.CloseTime); | |||
//迟到判断 | |||
if (devicetime <= workDateTime)//正常 | |||
{ | |||
ADType = "1";//上班 | |||
ClockStatus = "1";//正常 | |||
} | |||
else//迟到 | |||
{ | |||
//签到与签退判断 | |||
if (devicetime >= offworkDateTime)//如果签到时间大于下班时间则为签退状态 | |||
{ | |||
ADType = "2";//下班 | |||
ClockStatus = "1";//正常 | |||
} | |||
else//小于下班时间 | |||
{ | |||
//首先判断是上班还是下班 | |||
//该用户当日有签到记录视为下班签退 | |||
var attendancerecord = connmis.Query<ADR_RecordEntity>("select * from ADR_Record where ADYear='" + strTimeYear + "' and ADMonth='" + strTimeMonth + "' and ADDay='" + strTimeDay + "' and UserNo='" + EmpNo + "' and ADType='1'"); | |||
if (attendancerecord.Count() > 0)//如果存在上班考勤记录 | |||
{ | |||
//判断为下班早退 | |||
if (attendancerulEntity.LeaveOverTime.HasValue && attendancerulEntity.LeaveOverTime != 0)//如果允许早退,获取范围 | |||
{ | |||
//最早签退时间 | |||
DateTime offworkDateTimeFree = offworkDateTime.AddMinutes(-Convert.ToDouble(attendancerulEntity.LeaveOverTime)); | |||
if (devicetime >= offworkDateTimeFree)//在允许早退范围内记为正常 | |||
{ | |||
ADType = "2";//下班 | |||
ClockStatus = "1";//正常 | |||
} | |||
else//超出早退范围视为早退 | |||
{ | |||
ADType = "2";//下班 | |||
ClockStatus = "3";//早退 | |||
} | |||
} | |||
else//不允许早退直接视为早退 | |||
{ | |||
ADType = "2";//下班 | |||
ClockStatus = "3";//早退 | |||
} | |||
} | |||
else//判断为上班迟到 | |||
{ | |||
if (attendancerulEntity.LateOvertime.HasValue && attendancerulEntity.LateOvertime != 0)//如果允许迟到,获取范围 | |||
{ | |||
//最晚签到时间 | |||
DateTime workDateTimeFree = workDateTime.AddMinutes(Convert.ToDouble(attendancerulEntity.LateOvertime)); | |||
if (devicetime <= workDateTimeFree)//在允许迟到范围内记为正常 | |||
{ | |||
ADType = "1";//上班 | |||
ClockStatus = "1";//正常 | |||
} | |||
else | |||
{ | |||
ADType = "1";//上班 | |||
ClockStatus = "2";//迟到 | |||
} | |||
} | |||
else | |||
{ | |||
ADType = "1";//上班 | |||
ClockStatus = "2";//迟到 | |||
} | |||
} | |||
} | |||
} | |||
ADR_RecordEntity adrRecordEntity = new ADR_RecordEntity(); | |||
adrRecordEntity.Create(); | |||
adrRecordEntity.UserNo = EmpNo; | |||
adrRecordEntity.ADType = ADType; | |||
adrRecordEntity.ADTime = datetimenow; | |||
adrRecordEntity.ClockTime = devicetime; | |||
adrRecordEntity.ClockStatus = ClockStatus; | |||
if (deviceEntity != null && !string.IsNullOrEmpty(deviceEntity.DName)) | |||
{ | |||
adrRecordEntity.ClockPlace = deviceEntity.DName; | |||
} | |||
else | |||
{ | |||
adrRecordEntity.ClockPlace = "未知"; | |||
} | |||
adrRecordEntity.ADYear = strTimeYear; | |||
adrRecordEntity.ADMonth = strTimeMonth; | |||
adrRecordEntity.ADDay = strTimeDay; | |||
adrRecordEntity.ADPhoto = str; | |||
//记录日志 | |||
ADR_DeviceLogEntity adrDeviceLogEntity = new ADR_DeviceLogEntity(); | |||
adrDeviceLogEntity.Create(); | |||
if (deviceEntity != null && !string.IsNullOrEmpty(deviceEntity.Id)) | |||
{ | |||
adrDeviceLogEntity.DeviceId = deviceEntity.Id; | |||
stringAlarm += ",设备IP:" + deviceEntity.IpAddress; | |||
} | |||
adrDeviceLogEntity.LogData = stringAlarm; | |||
adrDeviceLogEntity.LogType = "0"; | |||
connmis.Execute("insert into ADR_DeviceLog(LogId,DeviceId, LogType, LogData, F_CreateDate, F_CreateUserId, F_CreateUserName) values(" + | |||
"'" + adrDeviceLogEntity.LogId + "','" + adrDeviceLogEntity.DeviceId + "','" + adrDeviceLogEntity.LogType + "'," + | |||
"'" + adrDeviceLogEntity.LogData + "','" + adrDeviceLogEntity.F_CreateDate + "','system','自动化服务')"); | |||
//去重 | |||
//获取当日考勤记录 | |||
var attendancerecordlist = connmis.Query<ADR_RecordEntity>("select * from ADR_Record where ADYear='" + strTimeYear + "' and ADMonth='" + strTimeMonth + "' and ADDay='" + strTimeDay + "' and UserNo='" + EmpNo + "'"); | |||
//签到去重 | |||
if (adrRecordEntity.ADType == "1" && attendancerecordlist.Count(m => m.ADType == "1") > 0)//签过到了 | |||
{ | |||
//每日保留第一次签到记录 | |||
return true; | |||
} | |||
//签退去重 | |||
if (adrRecordEntity.ADType == "2" && attendancerecordlist.Count(m => m.ADType == "2") > 0)//签过退了 | |||
{ | |||
//更新签退时间,签退状态 | |||
var firstoffworkentity = attendancerecordlist.FirstOrDefault(m => m.ADType == "2"); | |||
firstoffworkentity.ADTime = datetimenow; | |||
firstoffworkentity.ClockTime = devicetime; | |||
firstoffworkentity.ClockStatus = ClockStatus; | |||
firstoffworkentity.ADPhoto = str; | |||
connmis.Execute("update ADR_Record set ADTime='" + firstoffworkentity.ADTime + "',ClockTime='" + firstoffworkentity.ClockTime + "',ClockStatus='" + firstoffworkentity.ClockStatus + "',ADPhoto='" + firstoffworkentity.ADPhoto + "' where ID='" + firstoffworkentity.ID + "'"); | |||
return true; | |||
} | |||
//考勤记录 | |||
connmis.Execute("insert into ADR_Record(ID, UserNo, ADType, ADTime, ClockTime, ClockStatus, ClockPlace, ADYear, ADMonth, ADDay, ADPhoto) values(" + | |||
"'" + adrRecordEntity.ID + "','" + adrRecordEntity.UserNo + "','" + adrRecordEntity.ADType + "','" + adrRecordEntity.ADTime + "'," + | |||
"'" + adrRecordEntity.ClockTime + "','" + adrRecordEntity.ClockStatus + "','" + adrRecordEntity.ClockPlace + "','" + adrRecordEntity.ADYear + "'," + | |||
"'" + adrRecordEntity.ADMonth + "','" + adrRecordEntity.ADDay + "','" + adrRecordEntity.ADPhoto + "')"); | |||
return true; | |||
} | |||
} | |||
else | |||
{ | |||
//记录日志 | |||
ADR_DeviceLogEntity adrDeviceLogEntity = new ADR_DeviceLogEntity(); | |||
adrDeviceLogEntity.Create(); | |||
if (deviceEntity != null && !string.IsNullOrEmpty(deviceEntity.Id)) | |||
{ | |||
adrDeviceLogEntity.DeviceId = deviceEntity.Id; | |||
stringAlarm += ",设备IP:" + deviceEntity.IpAddress; | |||
} | |||
adrDeviceLogEntity.LogData = stringAlarm; | |||
adrDeviceLogEntity.LogType = "0"; | |||
connmis.Execute("insert into ADR_DeviceLog(LogId,DeviceId, LogType, LogData, F_CreateDate, F_CreateUserId, F_CreateUserName) values(" + | |||
"'" + adrDeviceLogEntity.LogId + "','" + adrDeviceLogEntity.DeviceId + "','" + adrDeviceLogEntity.LogType + "'," + | |||
"'" + adrDeviceLogEntity.LogData + "','" + adrDeviceLogEntity.F_CreateDate + "','system','自动化服务')"); | |||
return true; | |||
} | |||
} | |||
} | |||
return true; //回调函数需要有返回,表示正常接收到数据 | |||
} | |||
catch (Exception e) | |||
{ | |||
using (IDbConnection conncore = new SqlConnection(_coreConnection)) | |||
{ | |||
conncore.Execute( | |||
"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),4,'海康考勤机','海康考勤机报警事件回调异常" + e.Message + ",详细" + e.StackTrace + "',getdate())"); | |||
} | |||
return true; | |||
} | |||
} | |||
#region 考勤结构体 | |||
/// <summary> | |||
/// 考勤设备日志 | |||
/// </summary> | |||
public class ADR_DeviceLogEntity | |||
{ | |||
#region 实体成员 | |||
public string LogId { get; set; } | |||
public string DeviceId { get; set; } | |||
public string LogType { get; set; } | |||
public string LogData { get; set; } | |||
public DateTime? F_CreateDate { get; set; } | |||
public string F_CreateUserId { get; set; } | |||
public string F_CreateUserName { get; set; } | |||
public DateTime? F_ModifyDate { get; set; } | |||
public string F_ModifyUserId { get; set; } | |||
public string F_ModifyUserName { get; set; } | |||
#endregion | |||
#region 扩展操作 | |||
/// <summary> | |||
/// 新增调用 | |||
/// </summary> | |||
public void Create() | |||
{ | |||
this.LogId = Guid.NewGuid().ToString(); | |||
this.F_CreateDate = DateTime.Now; | |||
} | |||
/// <summary> | |||
/// 编辑调用 | |||
/// </summary> | |||
/// <param name="keyValue"></param> | |||
public void Modify(string keyValue) | |||
{ | |||
this.LogId = keyValue; | |||
this.F_ModifyDate = DateTime.Now; | |||
} | |||
#endregion | |||
} | |||
/// <summary> | |||
/// 考勤设备管理 | |||
/// </summary> | |||
public class ADR_DeviceEntity | |||
{ | |||
#region 实体成员 | |||
/// <summary> | |||
/// Id | |||
/// </summary> | |||
public string Id { get; set; } | |||
/// <summary> | |||
/// DName | |||
/// </summary> | |||
public string DName { get; set; } | |||
/// <summary> | |||
/// DCode | |||
/// </summary> | |||
public string DCode { get; set; } | |||
/// <summary> | |||
/// IpAddress | |||
/// </summary> | |||
public string IpAddress { get; set; } | |||
/// <summary> | |||
/// PortNumber | |||
/// </summary> | |||
public int? PortNumber { get; set; } | |||
/// <summary> | |||
/// AdminAccount | |||
/// </summary> | |||
public string AdminAccount { get; set; } | |||
/// <summary> | |||
/// AdminPwd | |||
/// </summary> | |||
public string AdminPwd { get; set; } | |||
/// <summary> | |||
/// F_EnabledMark | |||
/// </summary> | |||
public int? F_EnabledMark { get; set; } | |||
/// <summary> | |||
/// 布防状态 | |||
/// </summary> | |||
public bool? DOnlineStatus { get; set; } | |||
/// <summary> | |||
/// 设备最后通讯时间 | |||
/// </summary> | |||
public DateTime? DConnectDate { get; set; } | |||
/// <summary> | |||
/// 设备lUserID | |||
/// </summary> | |||
public string DlUserID { get; set; } | |||
/// <summary> | |||
/// F_CreateDate | |||
/// </summary> | |||
public DateTime? F_CreateDate { get; set; } | |||
/// <summary> | |||
/// F_CreateUserId | |||
/// </summary> | |||
public string F_CreateUserId { get; set; } | |||
/// <summary> | |||
/// F_CreateUserName | |||
/// </summary> | |||
public string F_CreateUserName { get; set; } | |||
/// <summary> | |||
/// F_ModifyDate | |||
/// </summary> | |||
public DateTime? F_ModifyDate { get; set; } | |||
/// <summary> | |||
/// F_ModifyUserId | |||
/// </summary> | |||
public string F_ModifyUserId { get; set; } | |||
/// <summary> | |||
/// F_ModifyUserName | |||
/// </summary> | |||
public string F_ModifyUserName { get; set; } | |||
#endregion | |||
#region 扩展操作 | |||
/// <summary> | |||
/// 新增调用 | |||
/// </summary> | |||
public void Create() | |||
{ | |||
this.Id = Guid.NewGuid().ToString(); | |||
this.F_CreateDate = DateTime.Now; | |||
} | |||
/// <summary> | |||
/// 编辑调用 | |||
/// </summary> | |||
/// <param name="keyValue"></param> | |||
public void Modify(string keyValue) | |||
{ | |||
this.Id = keyValue; | |||
this.F_ModifyDate = DateTime.Now; | |||
} | |||
#endregion | |||
} | |||
/// <summary> | |||
/// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 | |||
/// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 | |||
/// 创 建:超级管理员 | |||
/// 日 期:2020-09-03 14:57 | |||
/// 描 述:考勤限制 | |||
/// </summary> | |||
public class ADR_RestrictionEntity | |||
{ | |||
#region 实体成员 | |||
/// <summary> | |||
/// 编号 | |||
/// </summary> | |||
public string ID { get; set; } | |||
/// <summary> | |||
/// 上班时间 | |||
/// </summary> | |||
public string WorkTime { get; set; } | |||
/// <summary> | |||
/// 下班时间 | |||
/// </summary> | |||
public string CloseTime { get; set; } | |||
/// <summary> | |||
/// 签到时间开始 | |||
/// </summary> | |||
public string SignInStartTime { get; set; } | |||
/// <summary> | |||
/// 签到时间结束 | |||
/// </summary> | |||
public string SignInEndTime { get; set; } | |||
/// <summary> | |||
/// 签退时间开始 | |||
/// </summary> | |||
public string SignOutStartTime { get; set; } | |||
/// <summary> | |||
/// 签退时间结束 | |||
/// </summary> | |||
public string SignOutEndTime { get; set; } | |||
/// <summary> | |||
/// 迟到超时 | |||
/// </summary> | |||
public int? LateOvertime { get; set; } | |||
/// <summary> | |||
/// 早退超时 | |||
/// </summary> | |||
public int? LeaveOverTime { get; set; } | |||
/// <summary> | |||
/// 未签到,记为 | |||
/// </summary> | |||
public int? NoSignIn { get; set; } | |||
/// <summary> | |||
/// 未签退,记为 | |||
/// </summary> | |||
public int? NoSignOut { get; set; } | |||
/// <summary> | |||
/// 是否启用 | |||
/// </summary> | |||
public bool? REnable { get; set; } | |||
#endregion | |||
#region 扩展操作 | |||
/// <summary> | |||
/// 新增调用 | |||
/// </summary> | |||
public void Create() | |||
{ | |||
this.ID = Guid.NewGuid().ToString(); | |||
} | |||
/// <summary> | |||
/// 编辑调用 | |||
/// </summary> | |||
/// <param name="keyValue"></param> | |||
public void Modify(string keyValue) | |||
{ | |||
this.ID = keyValue; | |||
} | |||
#endregion | |||
} | |||
/// <summary> | |||
/// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 | |||
/// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 | |||
/// 创 建:超级管理员 | |||
/// 日 期:2020-08-28 18:09 | |||
/// 描 述:考勤记录 | |||
/// </summary> | |||
public class ADR_RecordEntity | |||
{ | |||
#region 实体成员 | |||
/// <summary> | |||
/// 编号 | |||
/// </summary> | |||
public string ID { get; set; } | |||
/// <summary> | |||
/// 员工名字 | |||
/// </summary> | |||
public string UserName { get; set; } | |||
/// <summary> | |||
/// 员工编号 | |||
/// </summary> | |||
public string UserNo { get; set; } | |||
/// <summary> | |||
/// 部门 | |||
/// </summary> | |||
public string Department { get; set; } | |||
/// <summary> | |||
/// 考勤类型 0-未定义,1-上班,2-下班,3-开始休息,4-结束休息,5-开始加班,6-结束加班 | |||
/// </summary> | |||
public string ADType { get; set; } | |||
/// <summary> | |||
/// 考勤时间(服务器时间) | |||
/// </summary> | |||
public DateTime? ADTime { get; set; } | |||
/// <summary> | |||
/// 打卡时间(考勤机时间) | |||
/// </summary> | |||
public DateTime? ClockTime { get; set; } | |||
/// <summary> | |||
/// 打卡结果 1正常,2迟到,3早退,4上班补签,5下班补签 | |||
/// </summary> | |||
public string ClockStatus { get; set; } | |||
/// <summary> | |||
/// 打卡地点 | |||
/// </summary> | |||
public string ClockPlace { get; set; } | |||
/// <summary> | |||
/// 考勤年 | |||
/// </summary> | |||
public string ADYear { get; set; } | |||
/// <summary> | |||
/// 考勤月 | |||
/// </summary> | |||
public string ADMonth { get; set; } | |||
/// <summary> | |||
/// 考勤日 | |||
/// </summary> | |||
public string ADDay { get; set; } | |||
/// <summary> | |||
/// 考勤照片 | |||
/// </summary> | |||
public string ADPhoto { get; set; } | |||
#endregion | |||
#region 扩展操作 | |||
/// <summary> | |||
/// 新增调用 | |||
/// </summary> | |||
public void Create() | |||
{ | |||
this.ID = Guid.NewGuid().ToString(); | |||
} | |||
/// <summary> | |||
/// 编辑调用 | |||
/// </summary> | |||
/// <param name="keyValue"></param> | |||
public void Modify(string keyValue) | |||
{ | |||
this.ID = keyValue; | |||
} | |||
#endregion | |||
} | |||
#endregion | |||
public static string CreateNo() | |||
{ | |||
Random random = new Random(); | |||
string strRandom = random.Next(1000, 10000).ToString(); //生成编号 | |||
string code = DateTime.Now.ToString("yyyyMMddHHmmss") + strRandom;//形如 | |||
return code; | |||
} | |||
} | |||
} |
@@ -0,0 +1,97 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Configuration; | |||
using System.Linq; | |||
using System.Net; | |||
using System.Net.Http; | |||
using System.Web.Http; | |||
using Hangfire; | |||
namespace DigitalSchoolApi.Controllers | |||
{ | |||
public class YKTController : BaseController | |||
{ | |||
/// <summary> | |||
/// 开始推送 | |||
/// </summary> | |||
/// <returns></returns> | |||
public IHttpActionResult Begin() | |||
{ | |||
//YKTTrabs.BeginTrans(); | |||
//RecurringJob.AddOrUpdate("YKT", | |||
// () => YKTTrabs.BeginTrans(), | |||
// Cron.Daily(13), TimeZoneInfo.Local); | |||
//RecurringJob.AddOrUpdate("YKT2", | |||
// () => YKTTrabs.BeginTrans(), | |||
// Cron.Daily(22), TimeZoneInfo.Local); | |||
RecurringJob.AddOrUpdate("JINYUYKT", | |||
() => YKTTrabs.GetConsumeInfo(), | |||
Cron.Daily(0), TimeZoneInfo.Local); | |||
RecurringJob.AddOrUpdate("JINYUYKT2", | |||
() => YKTTrabs.GetConsumeInfo(), | |||
Cron.Daily(14), TimeZoneInfo.Local); | |||
RecurringJob.AddOrUpdate("JINYUYKTSAVER", | |||
() => YKTTrabs.GetSaveRecordInfo(), | |||
Cron.Daily(14), TimeZoneInfo.Local); | |||
RecurringJob.AddOrUpdate("PUSHWEIXIN", | |||
() => YKTTrabs.PushWeixin(), | |||
Cron.Daily(0), TimeZoneInfo.Local); | |||
return Ok(); | |||
} | |||
/// <summary> | |||
/// 河南新安定时获取部门用户信息 | |||
/// </summary> | |||
/// <returns></returns> | |||
[HttpGet] | |||
public IHttpActionResult HeNanXinAnBegin() | |||
{ | |||
//YKTTrabs.BgeinHeNanXinAn(); | |||
RecurringJob.AddOrUpdate("HNXA", | |||
() => YKTTrabs.BgeinHeNanXinAn(), | |||
Cron.Daily(13), TimeZoneInfo.Local); | |||
return Ok(); | |||
} | |||
/// <summary> | |||
/// 消费信息 | |||
/// </summary> | |||
/// <returns></returns> | |||
[HttpGet] | |||
public IHttpActionResult Balance() | |||
{ | |||
RecurringJob.Trigger("JINYUYKT"); | |||
//YKTTrabs.GetConsumeInfo(); | |||
return Ok(); | |||
} | |||
[HttpGet] | |||
public IHttpActionResult PushWeixinTest() | |||
{ | |||
RecurringJob.Trigger("PUSHWEIXIN"); | |||
//YKTTrabs.PushWeixin(); | |||
return Ok(); | |||
} | |||
[HttpGet] | |||
public IHttpActionResult GetSaveRecord() | |||
{ | |||
RecurringJob.Trigger("PUSHWEIXIN"); | |||
//YKTTrabs.PushWeixin(); | |||
return Ok(); | |||
} | |||
/// <summary> | |||
/// 停止推送 | |||
/// </summary> | |||
/// <returns></returns> | |||
public IHttpActionResult Terminate() | |||
{ | |||
//RecurringJob.RemoveIfExists("YKT"); | |||
//RecurringJob.RemoveIfExists("YKT2"); | |||
RecurringJob.RemoveIfExists("JINYUYKT"); | |||
RecurringJob.RemoveIfExists("JINYUYKT2"); | |||
return Ok(); | |||
} | |||
} | |||
} |
@@ -0,0 +1,359 @@ | |||
using System; | |||
using System.Runtime.InteropServices; | |||
namespace AlarmCSharpDemo | |||
{ | |||
/// <summary> | |||
/// CHCNetSDK 的摘要说明。 | |||
/// </summary> | |||
public class CHCNetSDK | |||
{ | |||
public CHCNetSDK() | |||
{ | |||
// | |||
// TODO: 在此处添加构造函数逻辑 | |||
// | |||
} | |||
//常量 | |||
public const int SERIALNO_LEN = 48;//序列号长度 | |||
public const int NAME_LEN = 32;//用户名长度 | |||
public const int PASSWD_LEN = 16;//密码长度 | |||
public const int MACADDR_LEN = 6;//mac地址长度 | |||
public const int MAX_NAMELEN = 16;//DVR本地登陆名 | |||
public const int ACS_CARD_NO_LEN = 32; //门禁卡号长度 | |||
public delegate void LoginResultCallBack(int lUserID, uint dwResult, ref NET_DVR_DEVICEINFO_V30 lpDeviceInfo, IntPtr pUser); | |||
/********************************************************* | |||
Function: EXCEPYIONCALLBACK | |||
Desc: (回调函数) | |||
Input: | |||
Output: | |||
Return: | |||
**********************************************************/ | |||
public delegate void EXCEPYIONCALLBACK(uint dwType, int lUserID, int lHandle, IntPtr pUser); | |||
public delegate bool MSGCallBack_V31(int lCommand, ref NET_DVR_ALARMER pAlarmer, IntPtr pAlarmInfo, uint dwBufLen, IntPtr pUser); | |||
//报警设备信息 | |||
[StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] | |||
public struct NET_DVR_ALARMER | |||
{ | |||
public byte byUserIDValid;/* userid是否有效 0-无效,1-有效 */ | |||
public byte bySerialValid;/* 序列号是否有效 0-无效,1-有效 */ | |||
public byte byVersionValid;/* 版本号是否有效 0-无效,1-有效 */ | |||
public byte byDeviceNameValid;/* 设备名字是否有效 0-无效,1-有效 */ | |||
public byte byMacAddrValid; /* MAC地址是否有效 0-无效,1-有效 */ | |||
public byte byLinkPortValid;/* login端口是否有效 0-无效,1-有效 */ | |||
public byte byDeviceIPValid;/* 设备IP是否有效 0-无效,1-有效 */ | |||
public byte bySocketIPValid;/* socket ip是否有效 0-无效,1-有效 */ | |||
public int lUserID; /* NET_DVR_Login()返回值, 布防时有效 */ | |||
[MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = SERIALNO_LEN, ArraySubType = UnmanagedType.I1)] | |||
public byte[] sSerialNumber;/* 序列号 */ | |||
public uint dwDeviceVersion;/* 版本信息 高16位表示主版本,低16位表示次版本*/ | |||
[MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] | |||
public byte[] sDeviceName;/* 设备名字 */ | |||
[MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MACADDR_LEN, ArraySubType = UnmanagedType.I1)] | |||
public byte[] byMacAddr;/* MAC地址 */ | |||
public ushort wLinkPort; /* link port */ | |||
[MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 128, ArraySubType = UnmanagedType.I1)] | |||
public byte[] sDeviceIP;/* IP地址 */ | |||
[MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 128, ArraySubType = UnmanagedType.I1)] | |||
public byte[] sSocketIP;/* 报警主动上传时的socket IP地址 */ | |||
public byte byIpProtocol; /* Ip协议 0-IPV4, 1-IPV6 */ | |||
[MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 11, ArraySubType = UnmanagedType.I1)] | |||
public byte[] byRes2; | |||
} | |||
[StructLayoutAttribute(LayoutKind.Sequential)] | |||
public struct NET_DVR_LOCAL_GENERAL_CFG | |||
{ | |||
public byte byExceptionCbDirectly; //0-通过线程池异常回调,1-直接异常回调给上层 | |||
public byte byNotSplitRecordFile; //回放和预览中保存到本地录像文件不切片 0-默认切片,1-不切片 | |||
public byte byResumeUpgradeEnable; //断网续传升级使能,0-关闭(默认),1-开启 | |||
public byte byAlarmJsonPictureSeparate; //控制JSON透传报警数据和图片是否分离,0-不分离,1-分离(分离后走COMM_ISAPI_ALARM回调返回) | |||
[MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 4, ArraySubType = UnmanagedType.I1)] | |||
public byte[] byRes; //保留 | |||
public Int64 i64FileSize; //单位:Byte | |||
public uint dwResumeUpgradeTimeout; //断网续传重连超时时间,单位毫秒 | |||
[MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 236, ArraySubType = UnmanagedType.I1)] | |||
public byte[] byRes1; //预留 | |||
} | |||
public const int NET_DVR_DEV_ADDRESS_MAX_LEN = 129; | |||
public const int NET_DVR_LOGIN_USERNAME_MAX_LEN = 64; | |||
public const int NET_DVR_LOGIN_PASSWD_MAX_LEN = 64; | |||
[StructLayout(LayoutKind.Sequential)] | |||
public struct NET_DVR_USER_LOGIN_INFO | |||
{ | |||
[MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NET_DVR_DEV_ADDRESS_MAX_LEN, ArraySubType = UnmanagedType.I1)] | |||
public byte[] sDeviceAddress; | |||
public byte byUseTransport; | |||
public ushort wPort; | |||
[MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NET_DVR_LOGIN_USERNAME_MAX_LEN, ArraySubType = UnmanagedType.I1)] | |||
public byte[] sUserName; | |||
[MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NET_DVR_LOGIN_PASSWD_MAX_LEN, ArraySubType = UnmanagedType.I1)] | |||
public byte[] sPassword; | |||
public LoginResultCallBack cbLoginResult; | |||
public IntPtr pUser; | |||
public bool bUseAsynLogin; | |||
public byte byProxyType; //0:不使用代理,1:使用标准代理,2:使用EHome代理 | |||
public byte byUseUTCTime; //0-不进行转换,默认,1-接口上输入输出全部使用UTC时间,SDK完成UTC时间与设备时区的转换,2-接口上输入输出全部使用平台本地时间,SDK完成平台本地时间与设备时区的转换 | |||
public byte byLoginMode; //0-Private, 1-ISAPI, 2-自适应 | |||
public byte byHttps; //0-不适用tls,1-使用tls 2-自适应 | |||
public int iProxyID; //代理服务器序号,添加代理服务器信息时,相对应的服务器数组下表值 | |||
public byte byVerifyMode; //认证方式,0-不认证,1-双向认证,2-单向认证;认证仅在使用TLS的时候生效; | |||
[MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 119, ArraySubType = UnmanagedType.I1)] | |||
public byte[] byRes3; | |||
} | |||
//NET_DVR_Login_V30()参数结构 | |||
[StructLayoutAttribute(LayoutKind.Sequential)] | |||
public struct NET_DVR_DEVICEINFO_V30 | |||
{ | |||
[MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = SERIALNO_LEN, ArraySubType = UnmanagedType.I1)] | |||
public byte[] sSerialNumber; //序列号 | |||
public byte byAlarmInPortNum; //报警输入个数 | |||
public byte byAlarmOutPortNum; //报警输出个数 | |||
public byte byDiskNum; //硬盘个数 | |||
public byte byDVRType; //设备类型, 1:DVR 2:ATM DVR 3:DVS ...... | |||
public byte byChanNum; //模拟通道个数 | |||
public byte byStartChan; //起始通道号,例如DVS-1,DVR - 1 | |||
public byte byAudioChanNum; //语音通道数 | |||
public byte byIPChanNum; //最大数字通道个数,低位 | |||
public byte byZeroChanNum; //零通道编码个数 //2010-01-16 | |||
public byte byMainProto; //主码流传输协议类型 0-private, 1-rtsp,2-同时支持private和rtsp | |||
public byte bySubProto; //子码流传输协议类型0-private, 1-rtsp,2-同时支持private和rtsp | |||
public byte bySupport; //能力,位与结果为0表示不支持,1表示支持, | |||
//bySupport & 0x1, 表示是否支持智能搜索 | |||
//bySupport & 0x2, 表示是否支持备份 | |||
//bySupport & 0x4, 表示是否支持压缩参数能力获取 | |||
//bySupport & 0x8, 表示是否支持多网卡 | |||
//bySupport & 0x10, 表示支持远程SADP | |||
//bySupport & 0x20, 表示支持Raid卡功能 | |||
//bySupport & 0x40, 表示支持IPSAN 目录查找 | |||
//bySupport & 0x80, 表示支持rtp over rtsp | |||
public byte bySupport1; // 能力集扩充,位与结果为0表示不支持,1表示支持 | |||
//bySupport1 & 0x1, 表示是否支持snmp v30 | |||
//bySupport1 & 0x2, 支持区分回放和下载 | |||
//bySupport1 & 0x4, 是否支持布防优先级 | |||
//bySupport1 & 0x8, 智能设备是否支持布防时间段扩展 | |||
//bySupport1 & 0x10, 表示是否支持多磁盘数(超过33个) | |||
//bySupport1 & 0x20, 表示是否支持rtsp over http | |||
//bySupport1 & 0x80, 表示是否支持车牌新报警信息2012-9-28, 且还表示是否支持NET_DVR_IPPARACFG_V40结构体 | |||
public byte bySupport2; /*能力,位与结果为0表示不支持,非0表示支持 | |||
bySupport2 & 0x1, 表示解码器是否支持通过URL取流解码 | |||
bySupport2 & 0x2, 表示支持FTPV40 | |||
bySupport2 & 0x4, 表示支持ANR | |||
bySupport2 & 0x8, 表示支持CCD的通道参数配置 | |||
bySupport2 & 0x10, 表示支持布防报警回传信息(仅支持抓拍机报警 新老报警结构) | |||
bySupport2 & 0x20, 表示是否支持单独获取设备状态子项 | |||
bySupport2 & 0x40, 表示是否是码流加密设备*/ | |||
public ushort wDevType; //设备型号 | |||
public byte bySupport3; //能力集扩展,位与结果为0表示不支持,1表示支持 | |||
//bySupport3 & 0x1, 表示是否多码流 | |||
// bySupport3 & 0x4 表示支持按组配置, 具体包含 通道图像参数、报警输入参数、IP报警输入、输出接入参数、 | |||
// 用户参数、设备工作状态、JPEG抓图、定时和时间抓图、硬盘盘组管理 | |||
//bySupport3 & 0x8为1 表示支持使用TCP预览、UDP预览、多播预览中的"延时预览"字段来请求延时预览(后续都将使用这种方式请求延时预览)。而当bySupport3 & 0x8为0时,将使用 "私有延时预览"协议。 | |||
//bySupport3 & 0x10 表示支持"获取报警主机主要状态(V40)"。 | |||
//bySupport3 & 0x20 表示是否支持通过DDNS域名解析取流 | |||
public byte byMultiStreamProto;//是否支持多码流,按位表示,0-不支持,1-支持,bit1-码流3,bit2-码流4,bit7-主码流,bit-8子码流 | |||
public byte byStartDChan; //起始数字通道号,0表示无效 | |||
public byte byStartDTalkChan; //起始数字对讲通道号,区别于模拟对讲通道号,0表示无效 | |||
public byte byHighDChanNum; //数字通道个数,高位 | |||
public byte bySupport4; | |||
public byte byLanguageType;// 支持语种能力,按位表示,每一位0-不支持,1-支持 | |||
// byLanguageType 等于0 表示 老设备 | |||
// byLanguageType & 0x1表示支持中文 | |||
// byLanguageType & 0x2表示支持英文 | |||
[MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 9, ArraySubType = UnmanagedType.I1)] | |||
public byte[] byRes2; //保留 | |||
} | |||
[StructLayout(LayoutKind.Sequential)] | |||
public struct NET_DVR_DEVICEINFO_V40 | |||
{ | |||
public NET_DVR_DEVICEINFO_V30 struDeviceV30; | |||
public byte bySupportLock; //设备支持锁定功能,该字段由SDK根据设备返回值来赋值的。bySupportLock为1时,dwSurplusLockTime和byRetryLoginTime有效 | |||
public byte byRetryLoginTime; //剩余可尝试登陆的次数,用户名,密码错误时,此参数有效 | |||
public byte byPasswordLevel; //admin密码安全等级0-无效,1-默认密码,2-有效密码,3-风险较高的密码。当用户的密码为出厂默认密码(12345)或者风险较高的密码时,上层客户端需要提示用户更改密码。 | |||
public byte byProxyType;//代理类型,0-不使用代理, 1-使用socks5代理, 2-使用EHome代理 | |||
public uint dwSurplusLockTime; //剩余时间,单位秒,用户锁定时,此参数有效 | |||
public byte byCharEncodeType; //字符编码类型 | |||
public byte bySupportDev5;//支持v50版本的设备参数获取,设备名称和设备类型名称长度扩展为64字节 | |||
public byte bySupport; //能力集扩展,位与结果:0- 不支持,1- 支持 | |||
// bySupport & 0x1: 保留 | |||
// bySupport & 0x2: 0-不支持变化上报 1-支持变化上报 | |||
public byte byLoginMode; //登录模式 0-Private登录 1-ISAPI登录 | |||
public int dwOEMCode; | |||
public int iResidualValidity; //该用户密码剩余有效天数,单位:天,返回负值,表示密码已经超期使用,例如“-3表示密码已经超期使用3天” | |||
public byte byResidualValidity; // iResidualValidity字段是否有效,0-无效,1-有效 | |||
[MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 243, ArraySubType = UnmanagedType.I1)] | |||
public byte[] byRes2; | |||
} | |||
//报警布防参数结构体 | |||
[StructLayoutAttribute(LayoutKind.Sequential)] | |||
public struct NET_DVR_SETUPALARM_PARAM | |||
{ | |||
public uint dwSize; | |||
public byte byLevel;//布防优先级:0- 一等级(高),1- 二等级(中),2- 三等级(低,保留) | |||
public byte byAlarmInfoType;//上传报警信息类型(智能交通摄像机支持):0- 老报警信息(NET_DVR_PLATE_RESULT),1- 新报警信息(NET_ITS_PLATE_RESULT) | |||
public byte byRetAlarmTypeV40; | |||
public byte byRetDevInfoVersion; | |||
public byte byRetVQDAlarmType; | |||
public byte byFaceAlarmDetection; | |||
public byte bySupport; | |||
public byte byBrokenNetHttp; | |||
public ushort wTaskNo; | |||
public byte byDeployType; //布防类型:0-客户端布防,1-实时布防 | |||
public byte bySubScription; //订阅,按位表示,未开启订阅不上报 //占位 //Bit7-移动侦测人车分类是否传图;0-不传图(V30上报),1-传图(V40上报) | |||
[MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] | |||
public byte[] byRes1; | |||
public byte byAlarmTypeURL; | |||
//bit0-表示人脸抓拍报警上传(INTER_FACESNAP_RESULT);0-表示二进制传输,1-表示URL传输(设备支持的情况下,设备支持能力根据具体报警能力集判断,同时设备需要支持URL的相关服务,当前是”云存储“) | |||
//bit1-表示EVENT_JSON中图片数据长传类型;0-表示二进制传输,1-表示URL传输(设备支持的情况下,设备支持能力根据具体报警能力集判断) | |||
//bit2 - 人脸比对(报警类型为COMM_SNAP_MATCH_ALARM)中图片数据上传类型:0 - 二进制传输,1 - URL传输 | |||
//bit3 - 行为分析(报警类型为COMM_ALARM_RULE)中图片数据上传类型:0 - 二进制传输,1 - URL传输,本字段设备是否支持,对应软硬件能力集中<isSupportBehaviorUploadByCloudStorageURL>节点是否返回且为true | |||
public byte byCustomCtrl;//Bit0- 表示支持副驾驶人脸子图上传: 0-不上传,1-上传 | |||
} | |||
//校时结构参数 | |||
[StructLayoutAttribute(LayoutKind.Sequential)] | |||
public struct NET_DVR_TIME | |||
{ | |||
public uint dwYear; | |||
public uint dwMonth; | |||
public uint dwDay; | |||
public uint dwHour; | |||
public uint dwMinute; | |||
public uint dwSecond; | |||
} | |||
/*IP地址*/ | |||
[StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] | |||
public struct NET_DVR_IPADDR | |||
{ | |||
/// char[16] | |||
[MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 16, ArraySubType = UnmanagedType.I1)] | |||
public byte[] sIpV4; | |||
/// BYTE[128] | |||
[MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 128, ArraySubType = UnmanagedType.I1)] | |||
public byte[] byRes; | |||
public void Init() | |||
{ | |||
byRes = new byte[128]; | |||
} | |||
} | |||
[StructLayoutAttribute(LayoutKind.Sequential)] | |||
public struct NET_DVR_ACS_EVENT_INFO | |||
{ | |||
public uint dwSize; | |||
[MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = ACS_CARD_NO_LEN, ArraySubType = UnmanagedType.I1)] | |||
public byte[] byCardNo; //卡号,为0无效 | |||
public byte byCardType; //卡类型,1-普通卡,2-残疾人卡,3-黑名单卡,4-巡更卡,5-胁迫卡,6-超级卡,7-来宾卡,为0无效 | |||
public byte byWhiteListNo; //白名单单号,1-8,为0无效 | |||
public byte byReportChannel; //报告上传通道,1-布防上传,2-中心组1上传,3-中心组2上传,为0无效 | |||
public byte byCardReaderKind; //读卡器属于哪一类,0-无效,1-IC读卡器,2-身份证读卡器,3-二维码读卡器,4-指纹头 | |||
public uint dwCardReaderNo; //读卡器编号,为0无效 | |||
public uint dwDoorNo; //门编号(楼层编号),为0无效 | |||
public uint dwVerifyNo; //多重卡认证序号,为0无效 | |||
public uint dwAlarmInNo; //报警输入号,为0无效 | |||
public uint dwAlarmOutNo; //报警输出号,为0无效 | |||
public uint dwCaseSensorNo; //事件触发器编号 | |||
public uint dwRs485No; //RS485通道号,为0无效 | |||
public uint dwMultiCardGroupNo; //群组编号 | |||
public ushort wAccessChannel; //人员通道号 | |||
public byte byDeviceNo; //设备编号,为0无效 | |||
public byte byDistractControlNo;//分控器编号,为0无效 | |||
public uint dwEmployeeNo; //工号,为0无效 | |||
public ushort wLocalControllerID; //就地控制器编号,0-门禁主机,1-64代表就地控制器 | |||
public byte byInternetAccess; //网口ID:(1-上行网口1,2-上行网口2,3-下行网口1) | |||
public byte byType; //防区类型,0:即时防区,1-24小时防区,2-延时防区 ,3-内部防区,4-钥匙防区 5-火警防区 6-周界防区 7-24小时无声防区 8-24小时辅助防区,9-24小时震动防区,10-门禁紧急开门防区,11-门禁紧急关门防区 0xff-无 | |||
[MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MACADDR_LEN, ArraySubType = UnmanagedType.I1)] | |||
public byte[] byMACAddr; //物理地址,为0无效 | |||
public byte bySwipeCardType;//刷卡类型,0-无效,1-二维码 | |||
public byte byMask;//是否带口罩:0-保留,1-未知,2-不戴口罩,3-戴口罩 | |||
public uint dwSerialNo; //事件流水号,为0无效 | |||
public byte byChannelControllerID; //通道控制器ID,为0无效,1-主通道控制器,2-从通道控制器 | |||
public byte byChannelControllerLampID; //通道控制器灯板ID,为0无效(有效范围1-255) | |||
public byte byChannelControllerIRAdaptorID; //通道控制器红外转接板ID,为0无效(有效范围1-255) | |||
public byte byChannelControllerIREmitterID; //通道控制器红外对射ID,为0无效(有效范围1-255) | |||
[MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 4, ArraySubType = UnmanagedType.I1)] | |||
public byte[] byRes; | |||
} | |||
[StructLayoutAttribute(LayoutKind.Sequential)] | |||
public struct NET_DVR_ACS_ALARM_INFO | |||
{ | |||
public uint dwSize; | |||
public uint dwMajor; //报警主类型,参考宏定义 | |||
public uint dwMinor; //报警次类型,参考宏定义 | |||
public NET_DVR_TIME struTime; //时间 | |||
[MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_NAMELEN, ArraySubType = UnmanagedType.I1)] | |||
public byte[] sNetUser;//网络操作的用户名 | |||
public NET_DVR_IPADDR struRemoteHostAddr;//远程主机地址 | |||
public NET_DVR_ACS_EVENT_INFO struAcsEventInfo; //详细参数 | |||
public uint dwPicDataLen; //图片数据大小,不为0是表示后面带数据 | |||
public IntPtr pPicData; | |||
public ushort wInductiveEventType; //归纳事件类型,0-无效,客户端判断该值为非0值后,报警类型通过归纳事件类型区分,否则通过原有报警主次类型(dwMajor、dwMinor)区分 | |||
public byte byPicTransType; //图片数据传输方式: 0-二进制;1-url | |||
public byte byRes1; //保留字节 | |||
public uint dwIOTChannelNo; //IOT通道号 | |||
public IntPtr pAcsEventInfoExtend; //byAcsEventInfoExtend为1时,表示指向一个NET_DVR_ACS_EVENT_INFO_EXTEND结构体 | |||
public byte byAcsEventInfoExtend; //pAcsEventInfoExtend是否有效:0-无效,1-有效 | |||
public byte byTimeType; //时间类型:0-设备本地时间,1-UTC时间(struTime的时间) | |||
public byte byRes2; //保留字节 | |||
public byte byAcsEventInfoExtendV20; //pAcsEventInfoExtendV20是否有效:0-无效,1-有效 | |||
public IntPtr pAcsEventInfoExtendV20; //byAcsEventInfoExtendV20为1时,表示指向一个NET_DVR_ACS_EVENT_INFO_EXTEND_V20结构体 | |||
[MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 4, ArraySubType = UnmanagedType.I1)] | |||
public byte[] byRes; | |||
} | |||
public const int NET_SDK_EMPLOYEE_NO_LEN = 32; //工号长度 | |||
public const int NET_SDK_UUID_LEN = 36; //UUID长度 | |||
public const int NET_DEV_NAME_LEN = 64; //设备名称长度 | |||
[StructLayoutAttribute(LayoutKind.Sequential)] | |||
public struct NET_DVR_ACS_EVENT_INFO_EXTEND | |||
{ | |||
public int dwFrontSerialNo; //事件流水号,为0无效(若该字段为0,平台根据dwSerialNo判断是否丢失事件;若该字段不为0,平台根据该字段和dwSerialNo字段共同判断是否丢失事件)(主要用于解决报警订阅后导致dwSerialNo不连续的情况) | |||
public byte byUserType; //人员类型:0-无效,1-普通人(主人),2-来宾(访客),3-黑名单人,4-管理员 | |||
public byte byCurrentVerifyMode; //读卡器当前验证方式:0-无效,1-休眠,2-刷卡+密码,3-刷卡,4-刷卡或密码,5-指纹,6-指纹+密码,7-指纹或刷卡,8-指纹+刷卡,9-指纹+刷卡+密码,10-人脸或指纹或刷卡或密码,11-人脸+指纹,12-人脸+密码,13-人脸+刷卡,14-人脸,15-工号+密码,16-指纹或密码,17-工号+指纹,18-工号+指纹+密码,19-人脸+指纹+刷卡,20-人脸+密码+指纹,21-工号+人脸,22-人脸或人脸+刷卡,23-指纹或人脸,24-刷卡或人脸或密码,25-刷卡或人脸,26-刷卡或人脸或指纹,27-刷卡或指纹或密码 | |||
public byte byCurrentEvent; //是否为实时事件:0-无效,1-是(实时事件),2-否(离线事件) | |||
public byte byPurePwdVerifyEnable; //设备是否支持纯密码认证, 0-不支持,1-支持 | |||
[MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NET_SDK_EMPLOYEE_NO_LEN, ArraySubType = UnmanagedType.I1)] | |||
public byte[] byEmployeeNo; //工号(人员ID)(对于设备来说,如果使用了工号(人员ID)字段,byEmployeeNo一定要传递,如果byEmployeeNo可转换为dwEmployeeNo,那么该字段也要传递;对于上层平台或客户端来说,优先解析byEmployeeNo字段,如该字段为空,再考虑解析dwEmployeeNo字段) | |||
public byte byAttendanceStatus; //考勤状态:0-未定义,1-上班,2-下班,3-开始休息,4-结束休息,5-开始加班,6-结束加班 | |||
public byte byStatusValue; //考勤状态值 | |||
[MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] | |||
public byte[] byRes2; | |||
[MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NET_SDK_UUID_LEN, ArraySubType = UnmanagedType.I1)] | |||
public byte[] byUUID; //UUID(该字段仅在对接萤石平台过程中才会使用) | |||
[MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NET_DEV_NAME_LEN, ArraySubType = UnmanagedType.I1)] | |||
public byte[] byDeviceName; //设备序列号 | |||
[MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 24, ArraySubType = UnmanagedType.I1)] | |||
public byte[] byRes; | |||
} | |||
/********************************************************* | |||
Function: NET_DVR_Init | |||
Desc: 初始化SDK,调用其他SDK函数的前提。 | |||
Input: | |||
Output: | |||
Return: TRUE表示成功,FALSE表示失败。 | |||
**********************************************************/ | |||
[DllImport(@"HCNetSDK.dll")] | |||
public static extern bool NET_DVR_Init(); | |||
//启用日志文件写入接口 | |||
[DllImport(@"HCNetSDK.dll")] | |||
public static extern bool NET_DVR_SetLogToFile(int bLogEnable, string strLogDir, bool bAutoDel); | |||
[DllImport(@"HCNetSDK.dll")] | |||
public static extern bool NET_DVR_SetSDKLocalCfg(int enumType, IntPtr lpInBuff); | |||
[DllImport(@"HCNetSDK.dll")] | |||
public static extern uint NET_DVR_GetLastError(); | |||
[DllImport(@"HCNetSDK.dll")] | |||
public static extern bool NET_DVR_SetExceptionCallBack_V30(uint nMessage, IntPtr hWnd, EXCEPYIONCALLBACK fExceptionCallBack, IntPtr pUser); | |||
[DllImport(@"HCNetSDK.dll")] | |||
public static extern bool NET_DVR_SetDVRMessageCallBack_V31(MSGCallBack_V31 fMessageCallBack, IntPtr pUser); | |||
[DllImport(@"HCNetSDK.dll")] | |||
public static extern int NET_DVR_Login_V40(ref NET_DVR_USER_LOGIN_INFO pLoginInfo, ref NET_DVR_DEVICEINFO_V40 lpDeviceInfo); | |||
[DllImport(@"HCNetSDK.dll")] | |||
public static extern int NET_DVR_SetupAlarmChan_V41(int lUserID, ref NET_DVR_SETUPALARM_PARAM lpSetupParam); | |||
[DllImport(@"HCNetSDK.dll")] | |||
public static extern bool NET_DVR_CloseAlarmChan_V30(int lAlarmHandle); | |||
} | |||
} |