对sap接收客户信息接口基本完成;对外逻辑在publicInterfaceController当中

master
ddlucky 2 years ago
parent effefb6bb5
commit 8aa1099201

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework"
type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
requirePermission="false"/>
</configSections>
<entityFramework>
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer"/>
</providers>
</entityFramework>
</configuration>

File diff suppressed because it is too large Load Diff

@ -0,0 +1,95 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity;
using System.Linq;
using System.Web;
namespace DSWeb.Common.DB
{
public class CommonDataContext : DbContext
{
public CommonDataContext() : base("DongShengDB")
{
}
public CommonDataContext(string conn) : base(conn)
{
}
public DbSet<MailSend> MailSend { get; set; }
public DbSet<MailSendSmtp> MailSendSmtp { get; set; }
public DbSet<MpConfigInfo> MpConfigs { get; set; }
public DbSet<code_FtpSet_md> code_FtpSet { get; set; }
public DbSet<OP_LOGICINFO_md> OP_LOGICINFO { get; set; }
public DbSet<sys_param_set_md> sys_param_set { get; set; }
public DbSet<op_ctn_md> OP_CTN { get; set; }
public DbSet<Op_INTERNALTRADEmd> Op_INTERNALTRADE { get; set; }
public DbSet<info_client_md> info_client { get; set; }
public DbSet<info_client_bank_mb> info_client_bank { get; set; }
public DbSet<Info_Client_ACCDATE_mb> Info_Client_ACCDATE { get; set; }
public DbSet<code_fee_md> code_fee { get; set; }
public DbSet<CODE_CTN_md> CODE_CTN { get; set; }
public DbSet<op_other_md> op_other { get; set; }
public DbSet<ch_fee_md> ch_fee { get; set; }
public DbSet<ch_fee_invoice_md> ch_fee_invoice { get; set; }
public DbSet<ch_fee_invoicedetail_md> ch_fee_invoicedetail { get; set; }
public DbSet<code_goods_inv_md> code_goods_inv { get; set; }
public DbSet<ch_fee_do_md> ch_fee_do { get; set; }
public DbSet<ch_fee_payapplication_md> ch_fee_payapplication { get; set; }
public DbSet<company_md> company { get; set; }
public DbSet<v_op_bs_mb> v_op_bs { get; set; }
public DbSet<v_op_bill_mb> v_op_bill { get; set; }
public DbSet<v_fee_do_settlement_md> v_fee_do_settlement{ get; set; }
public DbSet<v_ch_fee_settlementinfo_md> v_ch_fee_settlementinfo { get; set; }
public DbSet<VW_user_md> VW_user { get; set; }
public DbSet<Receipt_Doc_md> Receipt_Doc { get; set; }
public DbSet<wms_settlement_detail_md> wms_settlement_detail { get; set; }
public DbSet<wms_settlement_list_md> wms_settlement_list { get; set; }
public DbSet<op_status_md> op_status { get; set; }
public DbSet<code_cust_edi_md> code_cust_edi { get; set; }
public DbSet<code_issutype_edi_md> code_issutype_edi { get; set; }
public DbSet<code_country_md> code_country { get; set; }
public DbSet<wms_md> wms { get; set; }
public DbSet<wms_in_md> wms_in { get; set; }
public DbSet<wms_out_md> wms_out { get; set; }
public DbSet<wms_out_detail_md> wms_out_detail { get; set; }
public DbSet<VW_WMS_OUT_DETAIL_md> VW_WMS_OUT_DETAIL { get; set; }
public DbSet<workflow_type_md> workflow_type { get; set; }
public DbSet<workflow_md> workflow { get; set; }
public DbSet<workflow_step_md> workflow_step { get; set; }
public DbSet<workflow_UserPath_md> workflow_UserPath { get; set; }
public DbSet<BillCheckOut_md> BillCheckOut { get; set; }
public DbSet<BillCheckOut_Detail_md> BillCheckOut_Detail { get; set; }
public DbSet<VW_BillCheckOut_Detail_md> VW_BillCheckOut_Detail { get; set; }
public DbSet<VW_BILL_BLISSUE_WORKLOG_md> VW_BILL_BLISSUE_WORKLOG { get; set; }
public DbSet<WorkLog_md> WorkLog { get; set; }
}
}

@ -0,0 +1,816 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text.RegularExpressions;
using System.Web;
namespace DSWeb.Common.DB
{
[Table("t_PublicInterface_Log")]
public partial class t_PublicInterface_Log_md
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public long ID { get; set; }
public string GID { get; set; }
public string PORTNAME { get; set; }
public DateTime? CreateTime { get; set; }
public string Param { get; set; }
}
[Table("t_crm_client")]
public partial class t_crm_client_md
{
[Key]
public string { get; set; }
public string { get; set; }
public string { get; set; }
public string { get; set; }
public int? { get; set; }
public string { get; set; }
public string EDI { get; set; }
public string { get; set; }
public string { get; set; }
public string { get; set; }
public string { get; set; }
public string { get; set; }
public string { get; set; }
public string { get; set; }
public string { get; set; }
public string { get; set; }
public string { get; set; }
public string { get; set; }
public string USD { get; set; }
public string USD { get; set; }
public string RMB { get; set; }
public string RMB { get; set; }
public string { get; set; }
public string { get; set; }
public string { get; set; }
public string { get; set; }
public string { get; set; }
public string { get; set; }
public string { get; set; }
public string { get; set; }
public string { get; set; }
public string { get; set; }
public bool? { get; set; }
public bool? { get; set; }
public bool? { get; set; }
public string { get; set; }
public string { get; set; }
public string { get; set; }
public string { get; set; }
public string { get; set; }
public string { get; set; }
public string { get; set; }
public string { get; set; }
public string { get; set; }
public string { get; set; }
public string { get; set; }
public string { get; set; }
public string { get; set; }
public string { get; set; }
public DateTime? { get; set; }
public string { get; set; }
public string { get; set; }
public bool? { get; set; }
public bool? { get; set; }
public bool? { get; set; }
public bool? { get; set; }
public bool? { get; set; }
public bool? { get; set; }
public bool? { get; set; }
public bool? { get; set; }
public bool? { get; set; }
public bool? { get; set; }
public bool? { get; set; }
public bool? { get; set; }
public string { get; set; }
public bool? { get; set; }
public string { get; set; }
public DateTime? { get; set; }
public string { get; set; }
public string { get; set; }
public string { get; set; }
public string { get; set; }
public string { get; set; }
public decimal? { get; set; }
public int? { get; set; }
public int? { get; set; }
public int? { get; set; }
public int? 2 { get; set; }
public int? 2 { get; set; }
public int? 2 { get; set; }
public DateTime? { get; set; }
public decimal? 退 { get; set; }
public decimal? { get; set; }
public string { get; set; }
public string { get; set; }
public string { get; set; }
public string IGZ { get; set; }
public bool? { get; set; }
public int? { get; set; }
public string { get; set; }
public string { get; set; }
public bool? { get; set; }
public string { get; set; }
public string { get; set; }
public string { get; set; }
public string { get; set; }
public string VGM { get; set; }
public string { get; set; }
public string { get; set; }
public string { get; set; }
public string { get; set; }
public string bizCsCustId { get; set; }
}
public class csCust
{
/// <summary>
/// 来源业务系统ID
/// </summary>
public string bizCsCustId { get; set; }
/// <summary>
/// 业务系统OTWotw/报关系统bg/船货代系统(FR)
/// </summary>
public string bizSystemType { get; set; }
/// <summary>
/// 客商编码(需校验唯一性)
/// </summary>
public string custCode { get; set; }
/// <summary>
/// 中文简称
/// </summary>
public string custAlias { get; set; }
/// <summary>
/// 英文全称
/// </summary>
public string custNameEn { get; set; }
/// <summary>
/// VARCHAR(200) 中文全称
/// </summary>
public string custNameCn { get; set; }
/// <summary>
/// VARCHAR(50) 国家
/// </summary>
public string countryCode { get; set; }
/// <summary>
/// VARCHAR(50) 国家名称(中文)
/// </summary>
public string countryNameCn { get; set; }
/// <summary>
/// VARCHAR(50) 省份/州
/// </summary>
public string stateCode { get; set; }
/// <summary>
/// VARCHAR(50) 省份/州
/// </summary>
public string stateName { get; set; }
/// <summary>
/// VARCHAR(50) 城市
/// </summary>
public string cityCode { get; set; }
/// <summary>
/// VARCHAR(50) 城市名
/// </summary>
public string cityName { get; set; }
/// <summary>
/// VARCHAR(20) 邮政编码
/// </summary>
public string zip { get; set; }
/// <summary>
/// VARCHAR(200) 中文地址
/// </summary>
public string addrCn { get; set; }
/// <summary>
/// VARCHAR(200) 英文地址
/// </summary>
public string addrEn { get; set; }
/// <summary>
/// CHAR(1) 有效标志
/// </summary>
public string active { get; set; }
/// <summary>
/// CHAR(1) 一次性客商Y:是N:否
/// </summary>
public string isOneTimeCustomers { get; set; }
/// <summary>
/// VARCHAR(20) 失效人
/// </summary>
public string invalidName { get; set; }
/// <summary>
/// VARCHAR(50) 失效时间
/// </summary>
public string invalidTime { get; set; }
/// <summary>
/// 规模(单个公司、员工型、一次性、全国、区域)
/// </summary>
public string scale { get; set; }
/// <summary>
/// VARCHAR(200) 所有制信息(国有企业、民营企业、三资企业、非营业组织机构、自然人)
/// </summary>
public string ownership { get; set; }
/// <summary>
/// VARCHAR(50) 销售渠道
/// </summary>
public string salesChannelS { get; set; }
/// <summary>
/// CHAR(1) 是否结算对象Y:是N:否
/// </summary>
public string isSettlement { get; set; }
/// <summary>
/// VARCHAR(50) 结算对象业务系统ID
/// </summary>
public string settleCustID { get; set; }
/// <summary>
/// VARCHAR(50) 结算对象
/// </summary>
public string settleCustCode { get; set; }
/// <summary>
/// VARCHAR(50) 结算对象名称
/// </summary>
public string settleCustName { get; set; }
/// <summary>
/// CHAR(1) 是否客户 Y:是 N:不是
/// </summary>
public string csFlag { get; set; }
/// <summary>
/// CHAR(1) 是否供应商 Y:是 N:不是
/// </summary>
public string supplierFlag { get; set; }
/// <summary>
/// VARCHAR(50) 注册资本
/// </summary>
public string registeredCapitqal { get; set; }
/// <summary>
/// VARCHAR(50) 注册时间
/// </summary>
public string registeredTime { get; set; }
/// <summary>
/// VARCHAR(50) 统一信用代码(对应主数据的企业注册码)
/// </summary>
public string unifiedCreditNo { get; set; }
/// <summary>
/// VARCHAR(50) 组织机构代码(对应主数据组织机构证代码)
/// </summary>
public string clientNo { get; set; }
/// <summary>
/// VARCHAR(50) 纳税人识别号(对应主数据税务登记证代码)
/// </summary>
public string taxpayerIdentificatioNo { get; set; }
/// <summary>
/// VARCHAR(50) 工商注册号
///(对应主数据营业执照注册码)
///administration for industry and commerce 工商局
/// </summary>
public string aicRegisteredNo { get; set; }
/// <summary>
/// VARCHAR(50) 商检注册代码
/// </summary>
public string iqbRegisteredNo { get; set; }
/// <summary>
/// VARCHAR(100) 海关注册代码
/// </summary>
public string customesRegisteredNo { get; set; }
/// <summary>
/// VARCHAR(20) 法人代表
/// </summary>
public string fictitiousPerson { get; set; }
/// <summary>
/// VARCHAR(100) 电话
/// </summary>
public string tel { get; set; }
/// <summary>
/// VARCHAR(50) 手机
/// </summary>
public string mobileNo { get; set; }
/// <summary>
/// VARCHAR(100) 邮箱
/// </summary>
public string email { get; set; }
/// <summary>
/// VARCHAR(50) 传真
/// </summary>
public string fax { get; set; }
/// <summary>
/// CHAR(1) 客户状态1、临时客户2、正式客户
/// </summary>
public string custStatus { get; set; }
/// <summary>
/// VARCHAR(50) 客户主数据代码 CDH(common data HUB)
/// </summary>
public string cdhCode { get; set; }
/// <summary>
/// VARCHAR(50) 供应商主数据代码
/// </summary>
public string vCdhCode { get; set; }
/// <summary>
/// VARCHAR(1) 客户类型(内部组织I、外部组织O
/// </summary>
public string custType { get; set; }
/// <summary>
/// VARCHAR(50) 创建人
/// </summary>
public string creator { get; set; }
/// <summary>
/// VARCHAR(50) 创建时间
/// </summary>
public string createTime { get; set; }
/// <summary>
/// VARCHAR(30) 行业类别
/// </summary>
public string lndustryType { get; set; }
/// <summary>
/// VARCHAR(50) 行业子类(取自数据字典)(暂不使用)
/// </summary>
public string subLndustryType { get; set; }
/// <summary>
/// VARCHAR(50) 开票限额
/// </summary>
public string invoiceMaximum { get; set; }
/// <summary>
/// VARCHAR(20) 默认付款条件(暂不使用)
/// </summary>
public string defaultPaymentTerm { get; set; }
/// <summary>
/// VARCHAR(20) 默认收款条件(暂不使用)
/// </summary>
public string defaultCollectionTerm { get; set; }
/// <summary>
/// VARCHAR(500) 备注
/// </summary>
public string remark { get; set; }
/// <summary>
/// VARCHAR(20) 课税性质(一般纳税人、小规模纳税人)
/// </summary>
public string taxNature { get; set; }
/// <summary>
/// VARCHAR(50) 最后修改人
/// </summary>
public string lastModifor { get; set; }
/// <summary>
/// VARCHAR(50) 最后修改时间
/// </summary>
public string lastModifyTime { get; set; }
/// <summary>
/// VARCHAR(50) 内部组织代码
/// </summary>
public string custOfficeCode { get; set; }
public csCustOfficeInfo CustOfficeInfo { get; set; }
public csCustInvoice CustInvoice { get; set; }
public List<csCustType> CustType { get; set; }
public List<csCustContact> CustContact { get; set; }
public List<csCustSales> CustSales { get; set; }
public List<csCustAccount> CustAccount { get; set; }
public t_crm_client_md GetCrmClient() {
var result = new t_crm_client_md();
result.bizCsCustId = bizCsCustId;
result. = custCode;
result. = custAlias;
result. = custNameEn;
result. = custNameCn;
result. = countryCode;
result. = countryNameCn;
result. = stateName;
result. = cityName;
result. = addrCn;
result. = aicRegisteredNo;
result. = taxpayerIdentificatioNo;
result. = customesRegisteredNo;
result. = fictitiousPerson;
result. = tel;
//result.手机 = mobileNo;
result. = email;
result. = fax;
result. = creator;
result. = createTime == null ? DateTime.Now : Convert.ToDateTime(createTime);
result. = remark;
result.= CustOfficeInfo.memoryCode==null?"": (CustOfficeInfo.memoryCode.Length>10
?CustOfficeInfo.memoryCode.Substring(0,10)
:CustOfficeInfo.memoryCode);
return result;
}
}
public class csCustOfficeInfo {
/// <summary>
/// VARCHAR(50) 业务系统OTWotw/报关系统(bg) /船货代系统(FR)
/// </summary>
public string bizSystemType { get; set; }
/// <summary>
/// VARCHAR(50) 来源业务系统CS_CUST ID
/// </summary>
public string bizCsCustId { get; set; }
/// <summary>
/// VARCHAR(50) 业务系统客户资料ID
/// </summary>
public string bizCsCustOfficeInfoId { get; set; }
/// <summary>
/// VARCHAR(50) 助记码
/// </summary>
public string memoryCode { get; set; }
/// <summary>
/// VARCHAR(100) 结算公司
/// </summary>
public string settleOffice { get; set; }
/// <summary>
/// VARCHAR(200) 结算公司名称
/// </summary>
public string settleOfficeName { get; set; }
/// <summary>
/// VARCHAR(200) 创建人
/// </summary>
public string creator { get; set; }
/// <summary>
/// VARCHAR(50) 创建时间
/// </summary>
public string createTime { get; set; }
/// <summary>
/// VARCHAR(200) 审批状态1、未提交 2、提交未审批 3、已审批
/// </summary>
public string approvalStatus { get; set; }
/// <summary>
/// VARCHAR(50) 客户财务编码
/// </summary>
public string fsAccountCode { get; set; }
/// <summary>
/// VARCHAR(10) 供应商财务编码
/// </summary>
public string vFsAccountCode { get; set; }
/// <summary>
/// VARCHAR(200) NVOCC证书号
/// </summary>
public string nvoccNo { get; set; }
/// <summary>
/// VARCHAR(50) 有效标志
/// </summary>
public string active { get; set; }
/// <summary>
/// VARCHAR(50) 最后修改人
/// </summary>
public string lastModifor { get; set; }
/// <summary>
/// VARCHAR(50) 最后修改时间
/// </summary>
public string lastModifyTime { get; set; }
}
public class csCustType {
/// <summary>
/// VARCHAR(50) 业务系统CS_CUST ID
/// </summary>
public string bizCsCustId { get; set; }
/// <summary>
/// VARCHAR(50) 业务系统物流角色ID
/// </summary>
public string bizCsCustTypeId { get; set; }
/// <summary>
/// VARCHAR(10) 客户类型
/// </summary>
public string custType { get; set; }
/// <summary>
/// VARCHAR(50) 创建人
/// </summary>
public string creator { get; set; }
/// <summary>
/// VARCHAR(50) 创建时间
/// </summary>
public string createTime { get; set; }
/// <summary>
/// VARCHAR(50) 最后修改人
/// </summary>
public string lastModifor { get; set; }
/// <summary>
/// VARCHAR(50) 最后修改时间
/// </summary>
public string lastModifyTime { get; set; }
}
public class csCustContact {
/// <summary>
/// VARCHAR(50) 来源业务系统OTWotw/报关(bg) /船货代系统(FR)
/// </summary>
public string bizSystemType { get; set; }
/// <summary>
/// VARCHAR(50) 来源业务系统CS_CUST ID
/// </summary>
public string bizCsCustId { get; set; }
/// <summary>
/// VARCHAR(50) 联系人业务系统ID
/// </summary>
public string bizCsCustContactId { get; set; }
/// <summary>
/// VARCHAR(100) 中文姓名
/// </summary>
public string contactCn { get; set; }
/// <summary>
/// VARCHAR(100) 英文姓名
/// </summary>
public string contactEn { get; set; }
/// <summary>
/// VARCHAR(50) 国家代码
/// </summary>
public string countryCode { get; set; }
/// <summary>
/// VARCHAR(50) 国家
/// </summary>
public string countryNameCn { get; set; }
/// <summary>
/// VARCHAR(20) 所属部门代码
/// </summary>
public string departmentCode { get; set; }
/// <summary>
/// VARCHAR(50) 所属部门
/// </summary>
public string departmentName { get; set; }
/// <summary>
/// CHAR(1) 是否默认
/// </summary>
public string isDefault { get; set; }
/// <summary>
/// VARCHAR(50) 职位
/// </summary>
public string position { get; set; }
/// <summary>
/// VARCHAR(100) 办公电话
/// </summary>
public string tel { get; set; }
/// <summary>
/// VARCHAR(50) 手机
/// </summary>
public string mobileNo { get; set; }
/// <summary>
/// VARCHAR(100) 邮箱
/// </summary>
public string email { get; set; }
/// <summary>
/// VARCHAR(100) QQ
/// </summary>
public string qq { get; set; }
/// <summary>
/// VARCHAR(10) 地址
/// </summary>
public string address { get; set; }
/// <summary>
/// VARCHAR(500) 备注
/// </summary>
public string remark { get; set; }
/// <summary>
/// VARCHAR(50) 传真
/// </summary>
public string fax { get; set; }
/// <summary>
/// VARCHAR(50) 创建人
/// </summary>
public string creator { get; set; }
/// <summary>
/// VARCHAR(50) 创建时间
/// </summary>
public string createTime { get; set; }
/// <summary>
/// VARCHAR(50) 微信
/// </summary>
public string wechat { get; set; }
/// <summary>
/// VARCHAR(50) 结算公司
/// </summary>
public string settleOffice { get; set; }
/// <summary>
/// VARCHAR(100) 结算公司
/// </summary>
public string settleOfficeName { get; set; }
/// <summary>
/// CHAR(1) 生效状态
/// </summary>
public string active { get; set; }
/// <summary>
/// VARCHAR(3) 联系人类型业务联系人BIZ、财务联系人FIN
/// </summary>
public string contactType { get; set; }
/// <summary>
/// VARCHAR(50) 最后修改人
/// </summary>
public string lastModifor { get; set; }
/// <summary>
/// VARCHAR(50) 最后修改时间
/// </summary>
public string lastModifyTime { get; set; }
}
public class csCustSales {
/// <summary>
/// VARCHAR(50) 来源业务系统OTWotw/报关(bg) /船货代系统(FR)
/// </summary>
public string bizSystemType { get; set; }
/// <summary>
/// VARCHAR(50) 业务系统CS_CUST ID
/// </summary>
public string bizCsCustId { get; set; }
/// <summary>
/// VARCHAR(50) 业务系统销售ID
/// </summary>
public string bizCsCustSalesId { get; set; }
/// <summary>
/// VARCHAR(20) 销售代码
/// </summary>
public string salesCode { get; set; }
/// <summary>
/// VARCHAR(20) 中文姓名
/// </summary>
public string salesNameCn { get; set; }
/// <summary>
/// VARCHAR(20) 英文姓名
/// </summary>
public string salesNameEn { get; set; }
/// <summary>
/// VARCHAR(50) 结算公司
/// </summary>
public string settleOffice { get; set; }
/// <summary>
/// VARCHAR(100) 结算公司
/// </summary>
public string settleOfficeName { get; set; }
/// <summary>
/// VARCHAR(50) 创建人
/// </summary>
public string creator { get; set; }
/// <summary>
/// VARCHAR(50) 创建时间
/// </summary>
public string createTime { get; set; }
/// <summary>
/// CHAR(1) 生效状态
/// </summary>
public string active { get; set; }
/// <summary>
/// CHAR(1) 默认
/// </summary>
public string isDefault { get; set; }
/// <summary>
/// VARCHAR(20) 角色C:客服S:销售)
/// </summary>
public string roles { get; set; }
/// <summary>
/// VARCHAR(20) 业务类型CODE
/// </summary>
public string businessType { get; set; }
/// <summary>
/// VARCHAR(20) 业务类型名
/// </summary>
public string businessTypeName { get; set; }
/// <summary>
/// VARCHAR(50) 最后修改人
/// </summary>
public string lastModifor { get; set; }
/// <summary>
/// VARCHAR(50) 最后修改时间
/// </summary>
public string lastModifyTime { get; set; }
}
public class csCustAccount {
/// <summary>
/// VARCHAR(50) 来源业务系统OTWotw/报关(bg) /船货代系统(FR)
/// </summary>
public string bizSystemType { get; set; }
/// <summary>
/// VARCHAR(50) 业务系统CS_CUST ID
/// </summary>
public string bizCsCustId { get; set; }
/// <summary>
/// VARCHAR(50) 业务系统客商账号ID
/// </summary>
public string bizCsCustAccountId { get; set; }
/// <summary>
/// VARCHAR(50) 银行账号
/// </summary>
public string accounts { get; set; }
/// <summary>
/// VARCHAR(200) 账号名称
/// </summary>
public string bacntName { get; set; }
/// <summary>
/// VARCHAR(100) 开户银行
/// </summary>
public string custBankName { get; set; }
/// <summary>
/// VARCHAR(20) 银行行号
/// </summary>
public string bankNumber { get; set; }
/// <summary>
/// VARCHAR(3) 默认币别
/// </summary>
public string currency { get; set; }
/// <summary>
/// CHAR(1) 是否默认帐户 Y:是 N:否
/// </summary>
public string isDefault { get; set; }
/// <summary>
/// VARCHAR(20) 托收协议号
/// </summary>
public string collectiongAgreementNo { get; set; }
/// <summary>
/// VARCHAR(50) 结算公司
/// </summary>
public string settleOffice { get; set; }
/// <summary>
/// VARCHAR(100) 结算公司
/// </summary>
public string settleOfficeName { get; set; }
/// <summary>
/// VARCHAR(100) 备案状态Y :有 N: 无
/// </summary>
public string recordStatus { get; set; }
/// <summary>
/// VARCHAR(100) 备案备注
/// </summary>
public string recodeRemark { get; set; }
/// <summary>
/// VARCHAR(50) 创建人
/// </summary>
public string creator { get; set; }
/// <summary>
/// VARCHAR(50) 创建时间
/// </summary>
public string createTime { get; set; }
/// <summary>
/// VARCHAR(50) 最后修改人
/// </summary>
public string lastModifor { get; set; }
/// <summary>
/// VARCHAR(50) 最后修改时间
/// </summary>
public string lastModifyTime { get; set; }
}
public class csCustInvoice {
/// <summary>
/// VARCHAR(50) 来源业务系统OTWotw/报关(bg) /船货代系统(FR)
/// </summary>
public string bizSystemType { get; set; }
/// <summary>
/// VARCHAR(50) 业务系统CS_CUST ID
/// </summary>
public string bizCsCustId { get; set; }
/// <summary>
/// VARCHAR(50) 业务系统客商账号ID
/// </summary>
public string bizCsCustInvoiceId { get; set; }
/// <summary>
/// VARCHAR(200) 默认缺省抬头
/// </summary>
public string defaultInvoiceTitle { get; set; }
/// <summary>
/// VARCHAR(200) 地址
/// </summary>
public string invoiceAddress { get; set; }
/// <summary>
/// VARCHAR(100) 电话
/// </summary>
public string tel { get; set; }
/// <summary>
/// VARCHAR(50) 纳税人识别号
/// </summary>
public string taxpayerIdentificatioNo { get; set; }
/// <summary>
/// VARCHAR(50) 结算公司
/// </summary>
public string settleOffice { get; set; }
/// <summary>
/// VARCHAR(100) 结算公司
/// </summary>
public string settleOfficeName { get; set; }
/// <summary>
/// VARCHAR(50) 创建人
/// </summary>
public string creator { get; set; }
/// <summary>
/// VARCHAR(50) 创建时间
/// </summary>
public string createTime { get; set; }
/// <summary>
/// VARCHAR(50) 最后修改人
/// </summary>
public string lastModifor { get; set; }
/// <summary>
/// VARCHAR(50) 最后修改时间
/// </summary>
public string lastModifyTime { get; set; }
}
}

@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity;
using System.Linq;
using System.Web;
namespace DSWeb.Common.DB
{
public class DS6DataContext : DbContext
{
public DS6DataContext() : base("DS6DB")
{
}
public DS6DataContext(string conn) : base(conn)
{
}
public DbSet<t_PublicInterface_Log_md> t_PublicInterface_Log { get; set; }
}
}

@ -0,0 +1,121 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Web;
namespace DSWeb.Common.DB
{
[Table("code_FtpSet")]
public class code_FtpSet_md
{
[Key]
public string GID { get; set; }
public string EDINAME { get; set; }
public string SERVERIP { get; set; }
public string FOLDERNAME { get; set; }
public string USERNAME { get; set; }
public string PASSWORD { get; set; }
public string CORPID { get; set; }
public string SENDCODE { get; set; }
public string RECEIVECODE { get; set; }
public string SENDNAME { get; set; }
public string SENDATTN { get; set; }
public string SENDTEL { get; set; }
public string SENDEMAIL { get; set; }
public string RECEIVEOP { get; set; }
public string RECEIVESALE { get; set; }
public string RECEIVEDEPT { get; set; }
public string SENDCOMPANYCODE { get; set; }
public string SENDSUBCOMPANYCODE { get; set; }
public string CARRIERID { get; set; }
public string RECEIVEEMAIL { get; set; }
public string RECEIVESIEMAIL { get; set; }
public string SHIPPERTEL { get; set; }
public string CONSIGNEETEL { get; set; }
public string NOTIFYPARTYTEL { get; set; }
public string ISUSETEL { get; set; }
public string SERVERIP2 { get; set; }
public string FOLDERNAME2 { get; set; }
public string USERNAME2 { get; set; }
public string PASSWORD2 { get; set; }
public string ALIASSENDCODE { get; set; }
public string SFTPPORT { get; set; }
public bool? ISSSL { get; set; }
public string TMPFOLDERNAME { get; set; }
public string SFTPCERFILENAME { get; set; }
}
[Table("OP_LOGICINFO")]
public class OP_LOGICINFO_md
{
[Key]
public Guid GID { get; set; }
public string BSNO { get; set; }
public string PROPNAME { get; set; }
public string PROPVALUE { get; set; }
}
[Table("op_ctn")]
public class op_ctn_md
{
[Key]
public string CTN_ID { get; set; }
public string BSNO { get; set; }
public string CTNCODE { get; set; }
public string SIZE { get; set; }
public string CTN { get; set; }
public int? CTNNUM { get; set; }
public int? TEU { get; set; }
public string CTNALL { get; set; }
public string CNTRNO { get; set; }
public string SEALNO { get; set; }
public int PKGS { get; set; }
public decimal? KGS { get; set; }
public decimal? CBM { get; set; }
public string REMARK { get; set; }
public string KINDPKGS { get; set; }
public decimal? TAREWEIGHT { get; set; }
public string GOODSNAME { get; set; }
public string CTNSTATUS { get; set; }
public string WEIGHTYPE { get; set; }
public decimal? WEIGHKGS { get; set; }
public string WEIGHATTN { get; set; }
public string WEIGHTEL { get; set; }
public string WEIGHSIGN { get; set; }
public string WEIGHDATE { get; set; }
public string MASTERNO { get; set; }
public string TRUCKER { get; set; }
public decimal? TRUCKFEE { get; set; }
public int? FREESTORAGEDAY { get; set; }
public int? STORAGEDAY { get; set; }
public decimal? STORAGEPRICE { get; set; }
public decimal? STORAGEFEE { get; set; }
public int? FREECTNDAY { get; set; }
public int? CTNDAY { get; set; }
public decimal? CTNPRICE { get; set; }
public decimal? CTNFEE { get; set; }
public string TRUCKNO { get; set; }
public string vgmconncom { get; set; }
public string VGMADDR { get; set; }
public string VGMEMAIL { get; set; }
public string MTMC { get; set; }
public DateTime? SJRGSJ { get; set; }
public DateTime? SJCGSJ { get; set; }
public bool ISWMS { get; set; }
public DateTime? WMSDATE { get; set; }
public string TiXiangShiJian { get; set; }
public string FanChangShiJian { get; set; }
public string JiGangShiJian { get; set; }
public string AREANAME { get; set; }
public string DaoGangShiJian { get; set; }
public string TiHuoShiJian { get; set; }
public string FanKongShiJian { get; set; }
public string PCTN_ID { get; set; }
public string ISTEMP { get; set; }
}
}

@ -0,0 +1,41 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Web;
namespace DSWeb.Common.DB
{
[Table("Mail_Send")]
public class MailSend
{
public const string MailSendStatusCreate = "Create";
public const string MailSendStatusSending = "Sending";
public const string MailSendStatusSuccess = "Success";
public const string MailSendStatusFail = "Fail";
public MailSend()
{
this.GID = Guid.NewGuid().ToString().Replace("-", "");
SendStatus = MailSendStatusCreate;
CreateTime = DateTime.Now;
}
[Key]
public string GID { get; set; }
public string SendTo { get; set; }
public string CCTo { get; set; }
public string Title { get; set; }
public string Body { get; set; }
public string SendStatus { get; set; }
public DateTime? SendTime { get; set; }
public int TryCount { get; set; }
public DateTime CreateTime { get; set; }
public string RelativeId { get; set; }
public string SmtpConfig { get; set; }
public string ShowName { get; set; }
public string Sender { get; set; }
}
}

@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Web;
namespace DSWeb.Common.DB
{
[Table("Mail_Send_Smtp")]
public class MailSendSmtp
{
[Key]
public string GID { get; set; }
public string Account { get; set; }
public string Password { get; set; }
public string Server { get; set; }
public int Port { get; set; }
public bool UseSSL { get; set; }
public string Remark { get; set; }
}
}

@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Web;
namespace DSWeb.Common.DB
{
[Table("sys_MpConfig")]
public class MpConfigInfo
{
public MpConfigInfo()
{
this.AppId = string.Empty;
this.AppSecret = string.Empty;
this.LastUpdate = DateTime.Now;
this.Token = string.Empty;
}
[Key]
public string AppId { get; set; }
public string AppSecret { get; set; }
public DateTime? LastUpdate { get; set; }
public DateTime? ExpireTime { get; set; }
public string Token { get; set; }
}
}

@ -0,0 +1,97 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Web;
namespace DSWeb.Common.DB
{
[Table("Op_INTERNALTRADE")]
public class Op_INTERNALTRADEmd
{
[Key]
public string BSNO { get; set; }
public string MASTERNO { get; set; }
public bool BSSTATUS { get; set; }
public bool FEESTATUS { get; set; }
public string CUSTOMERNAME { get; set; }
public decimal? CONTAINERDAYS { get; set; }
public DateTime BSDATE { get; set; }
public string ACCDATE { get; set; }
public string MBLNO { get; set; }
public string HBLNO { get; set; }
public string CUSTNO { get; set; }
public string STLNAME { get; set; }
public DateTime? STLDATE { get; set; }
public string BSSOURCE { get; set; }
public string BSSOURCEDETAIL { get; set; }
public string TRANSNO { get; set; }
public string OP { get; set; }
public string CUSTSERVICE { get; set; }
public string SALE { get; set; }
public string OPERATOR { get; set; }
public string CORPID { get; set; }
public string SALEDEPT { get; set; }
public string CARRIER { get; set; }
public string VESSEL { get; set; }
public string VOYNO { get; set; }
public string PORTLOADID { get; set; }
public string PORTLOAD { get; set; }
public DateTime? ETD { get; set; }
public string YARD { get; set; }
public DateTime? LOADEDCTNRETURNDATE { get; set; }
public DateTime? EMPTYCTNTOSHIPPERDATE { get; set; }
public string TRUCKER { get; set; }
public string TRUCKNO { get; set; }
public string CNTRNO { get; set; }
public string SEALNO { get; set; }
public decimal PORTLOADSTORAGEPERIOD { get; set; }
public decimal FBPPORTLOAD { get; set; }
public string PORTLOADREMARK { get; set; }
public string VIAID { get; set; }
public string VIA { get; set; }
public DateTime? VIA_ETA { get; set; }
public string VIA_VESSEL { get; set; }
public string VIA_VOYNO { get; set; }
public DateTime? VIA_ETD { get; set; }
public decimal? VIA_STORAGEPERIOD { get; set; }
public string VIA2ID { get; set; }
public string VIA2 { get; set; }
public DateTime? VIA2_ETA { get; set; }
public string VIA2_VESSEL { get; set; }
public string VIA2_VOYNO { get; set; }
public DateTime? VIA2_ETD { get; set; }
public decimal? VIA2_STORAGEPERIOD { get; set; }
public string VIA3ID { get; set; }
public string VIA3 { get; set; }
public DateTime? VIA3_ETA { get; set; }
public string VIA3_VESSEL { get; set; }
public string VIA3_VOYNO { get; set; }
public DateTime? VIA3_ETD { get; set; }
public decimal? VIA3_STORAGEPERIOD { get; set; }
public string VIA_MARK { get; set; }
public string PORTDISCHARGEID { get; set; }
public string PORTDISCHARGE { get; set; }
public string PlACERECEIPT { get; set; }
public string TRUCKER2 { get; set; }
public string TRUCKNO2 { get; set; }
public string CONSIGNEE { get; set; }
public string CONSIGNEECONTACT { get; set; }
public string CONSIGNEETEL { get; set; }
public DateTime? DISPATCHDATE { get; set; }
public DateTime? DELIVERYDATE { get; set; }
public DateTime? RECEIVEDATE { get; set; }
public DateTime? ETA { get; set; }
[Timestamp]
public byte[] TIMEMARK { get; set; }
public string DISCHARGEREMARK { get; set; }
public string CREATOR { get; set; }
public DateTime? BILLFEESTATUSTIME { get; set; }
public int? BillFeeStatus { get; set; }
}
}

@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity;
using System.Linq;
using System.Web;
namespace DSWeb.Common.DB
{
public class OtherDB : DbContext
{
public OtherDB() : base("DongShengDB")
{
}
public OtherDB(string conn) : base(conn)
{
}
public DbSet<view_hrmresource_md> view_hrmresource { get; set; }
public DbSet<view_pjrequestbas_md> view_pjrequestbas { get; set; }
public DbSet<view_xdf_md> view_xdf { get; set; }
}
}

@ -0,0 +1,67 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Web;
namespace DSWeb.Common.DB
{
/// <summary>
/// 泛微OA 用用户名查找ID
/// </summary>
[Table("view_hrmresource")]
public class view_hrmresource_md
{
[Key]
public int id { get; set; }
public string loginid { get; set; }
public string lastname { get; set; }
public int departmentid { get; set; }
public int subcompanyid1 { get; set; }
}
/// <summary>
/// 泛微OA 审核结果
/// </summary>
[Table("view_pjrequestbas")]
public class view_pjrequestbas_md
{
[Key]
public int requestid { get; set; }
public int workflowid { get; set; }
public string requestname { get; set; }
public int? creater { get; set; }
public int? lastoperator { get; set; }
public string lastoperatedate { get; set; }
public string lastoperatetime { get; set; }
public string currentnodetype { get; set; }
}
[Table("view_xdf")]
public class view_xdf_md
{
[Key]
public int id { get; set; }
public int? requestId { get; set; }
public string yxzhmc { get; set; }
public string khx { get; set; }
public string yxzh { get; set; }
public string gyskhmc { get; set; }
public int? formmodeid { get; set; }
public int? modedatacreater { get; set; }
public int? modedatacreatertype { get; set; }
public string modedatacreatedate { get; set; }
public string modedatacreatetime { get; set; }
public int? modedatamodifier { get; set; }
public string modedatamodifydatetime { get; set; }
public string form_biz_id { get; set; }
public string MODEUUID { get; set; }
public string kjry { get; set; }
}
}

@ -0,0 +1,102 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\EntityFramework.6.4.4\build\EntityFramework.props" Condition="Exists('..\packages\EntityFramework.6.4.4\build\EntityFramework.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{A0AB3D23-0DAD-49BA-9D23-107FAA1C369E}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>DSWeb.Common</RootNamespace>
<AssemblyName>DSWeb.Common</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<HintPath>..\packages\EntityFramework.6.4.4\lib\net45\EntityFramework.dll</HintPath>
</Reference>
<Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<HintPath>..\packages\EntityFramework.6.4.4\lib\net45\EntityFramework.SqlServer.dll</HintPath>
</Reference>
<Reference Include="log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821, processorArchitecture=MSIL">
<HintPath>..\packages\log4net.1.2.10\lib\2.0\log4net.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="NuonuoSDK">
<HintPath>..\Lib\NuonuoSDK.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Core" />
<Reference Include="System.Messaging" />
<Reference Include="System.Web" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="DB\DS6Comm.cs" />
<Compile Include="DB\DS6DataContext.cs" />
<Compile Include="DB\OtherDB.cs" />
<Compile Include="DB\CommonDataContext.cs" />
<Compile Include="DB\Comm.cs" />
<Compile Include="DB\Op_INTERNALTRADE.cs" />
<Compile Include="DB\OtherDBModel.cs" />
<Compile Include="DB\MailSend.cs" />
<Compile Include="DB\EDIFTPInfo.cs" />
<Compile Include="DB\MailSendSmtp.cs" />
<Compile Include="DB\MpConfigInfo.cs" />
<Compile Include="Helper\EnumHelper.cs" />
<Compile Include="Helper\FTPHelper.cs" />
<Compile Include="Helper\IdHelper.cs" />
<Compile Include="Helper\MailHelper.cs" />
<Compile Include="Helper\WebRequestHelper.cs" />
<Compile Include="Model\DateTimeExtension.cs" />
<Compile Include="Model\Int32Extensions.cs" />
<Compile Include="Model\JsonExtension.cs" />
<Compile Include="Model\LongExtension.cs" />
<Compile Include="Model\RespModel.cs" />
<Compile Include="Model\StringExtension.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。使用“NuGet 程序包还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\EntityFramework.6.4.4\build\EntityFramework.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\EntityFramework.6.4.4\build\EntityFramework.props'))" />
<Error Condition="!Exists('..\packages\EntityFramework.6.4.4\build\EntityFramework.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\EntityFramework.6.4.4\build\EntityFramework.targets'))" />
</Target>
<Import Project="..\packages\EntityFramework.6.4.4\build\EntityFramework.targets" Condition="Exists('..\packages\EntityFramework.6.4.4\build\EntityFramework.targets')" />
</Project>

@ -0,0 +1,86 @@
using DSWeb.Common.DB;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DSWeb.Common.Helper
{
public static class EnumHelper
{
/// <summary>
/// 获取枚举值的description文本
/// </summary>
/// <param name="type"></param>
/// <param name="strVal"></param>
/// <returns></returns>
public static string GetDescription(Type type, string strVal)
{
System.Reflection.FieldInfo field = type.GetField(strVal);
if (field != null)
{
var attribute = Attribute.GetCustomAttribute(field, typeof(DescriptionAttribute)) as DescriptionAttribute;
if (attribute != null)
{
return attribute.Description;
}
}
return string.Empty;
}
/// <summary>
/// 获取枚举所有项的名称name和显示文本description
/// </summary>
/// <param name="type"></param>
/// <returns></returns>
public static Dictionary<string, string> GetEnumList(Type type)
{
Dictionary<string, string> dic = new Dictionary<string, string>();
foreach (int val in Enum.GetValues(type))
{
string strName = Enum.GetName(type, val);//获取名称
string desp = GetDescription(type, strName);
dic.Add(strName, desp);
}
return dic;
}
}
public static class ModelHelper
{
public static ch_fee_md getchfeeHelper() {
var feeShou = new ch_fee_md();
//2021-12-31要求下列字段不能为空填写0或false
feeShou.COMMISSIONRATE = 0;
feeShou.AUDITSTATUS = 0;
feeShou.LINENUM = 0;
feeShou.ISDEBIT = false;
feeShou.ISOPEN = false;
feeShou.ACCTAXRATE = 0;
feeShou.ISVOU = false;
feeShou.TAX = 0;
feeShou.PREAMOUNT = 0;
feeShou.ISACC = false;
feeShou.CUSTDUI = false;
feeShou.SETTLEMENT = 0;
feeShou.ORDERAMOUNT = 0;
feeShou.ORDERINVOICE = 0;
feeShou.ORDERINVSETTLEMENT = 0;
feeShou.ORDERSETTLEMENT = 0;
feeShou.INVOICE = 0;
feeShou.TAXRATE = 0;
feeShou.ISADVANCEDPAY = false;
feeShou.ISINVOICE = false;
feeShou.ISCRMORDERFEE = false;
feeShou.TAXUNITPRICE = 0;//2021-12-29于菲同样赋值单价和金额
feeShou.NOTAXAMOUNT = 0;//2021-12-29于菲同样赋值单价和金额
return feeShou;
}
}
}

@ -0,0 +1,591 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using log4net;
using System.IO;
using System.Net;
using System.Text;
namespace DSWeb.Common.Helper
{
public class FtpHelper
{
private static ILog logger = LogManager.GetLogger("FtpHelper");
string ftpServerIP;
public string ftpRemotePath;
string ftpUserID;
string ftpPassword;
string ftpURI;
/// <summary>
/// 连接FTP
/// </summary>
/// <param name="FtpServerIP">FTP连接地址</param>
/// <param name="FtpRemotePath">指定FTP连接成功后的当前目录, 如果不指定即默认为根目录</param>
/// <param name="FtpUserID">用户名</param>
/// <param name="FtpPassword">密码</param>
public FtpHelper(string FtpServerIP, string FtpRemotePath, string FtpUserID, string FtpPassword)
{
ftpServerIP = FtpServerIP;
ftpRemotePath = FtpRemotePath;
ftpUserID = FtpUserID;
ftpPassword = FtpPassword;
ftpURI = "ftp://" + ftpServerIP + "/";
if (!string.IsNullOrWhiteSpace(FtpRemotePath))
{
ftpURI = ftpURI + ftpRemotePath + "/";
}
}
/// <summary>
/// 上传
/// </summary>
/// <param name="filename"></param>
public void Upload(string filename)
{
FileInfo fileInf = new FileInfo(filename);
string uri = ftpURI + fileInf.Name;
FtpWebRequest reqFTP;
reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri(uri));
reqFTP.Credentials = new NetworkCredential(ftpUserID, ftpPassword);
reqFTP.KeepAlive = false;
reqFTP.Method = WebRequestMethods.Ftp.UploadFile;
reqFTP.UseBinary = true;
reqFTP.ContentLength = fileInf.Length;
int buffLength = 2048;
byte[] buff = new byte[buffLength];
int contentLen;
FileStream fs = fileInf.OpenRead();
try
{
Stream strm = reqFTP.GetRequestStream();
contentLen = fs.Read(buff, 0, buffLength);
while (contentLen != 0)
{
strm.Write(buff, 0, contentLen);
contentLen = fs.Read(buff, 0, buffLength);
}
strm.Close();
fs.Close();
}
catch (Exception ex)
{
logger.Error("FtpWeb_1" , ex);
}
}
/// <summary>
/// 下载
/// </summary>
/// <param name="filePath"></param>
/// <param name="fileName"></param>
public void Download(string filePath, string fileName)
{
FtpWebRequest reqFTP;
FileStream outputStream = new FileStream(filePath + "\\" + fileName, FileMode.Create);
reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri(ftpURI + fileName));
try
{
reqFTP.Method = WebRequestMethods.Ftp.DownloadFile;
reqFTP.UseBinary = true;
reqFTP.Credentials = new NetworkCredential(ftpUserID, ftpPassword);
FtpWebResponse response = (FtpWebResponse)reqFTP.GetResponse();
Stream ftpStream = response.GetResponseStream();
long cl = response.ContentLength;
int bufferSize = 1024;
int readCount;
byte[] buffer = new byte[bufferSize];
readCount = ftpStream.Read(buffer, 0, bufferSize);
while (readCount > 0)
{
outputStream.Write(buffer, 0, readCount);
readCount = ftpStream.Read(buffer, 0, bufferSize);
}
ftpStream.Close();
outputStream.Close();
response.Close();
reqFTP.Abort();
}
catch (Exception ex)
{
reqFTP.Abort();
logger.Error("FtpWeb_2", ex);
}
}
public string getFileStr(string fileName)
{
FtpWebRequest reqFTP;
var result = "";
reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri(ftpURI + fileName));
try
{
reqFTP.Method = WebRequestMethods.Ftp.DownloadFile;
reqFTP.UseBinary = true;
reqFTP.Credentials = new NetworkCredential(ftpUserID, ftpPassword);
FtpWebResponse response = (FtpWebResponse)reqFTP.GetResponse();
Stream ftpStream = response.GetResponseStream();
long cl = response.ContentLength;
//int bufferSize = 1024;
//int readCount;
//byte[] buffer = new byte[bufferSize];
//readCount = ftpStream.Read(buffer, 0, bufferSize);
//while (readCount > 0)
//{
// for (var _i = 0; _i < readCount; _i++) {
// result += buffer[_i];
// }
// readCount = ftpStream.Read(buffer, 0, bufferSize);
//}
StreamReader reader = new StreamReader(ftpStream);
result = reader.ReadToEnd();
ftpStream.Close();
response.Close();
reqFTP.Abort();
return result;
}
catch (Exception ex)
{
reqFTP.Abort();
logger.Error("FtpWeb_3", ex);
}
reqFTP.Abort();
return "";
}
/// <summary>
/// 删除文件
/// </summary>
/// <param name="fileName"></param>
public void Delete(string fileName)
{
string uri = ftpURI + fileName;
FtpWebRequest reqFTP;
reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri(uri));
try
{
reqFTP.Credentials = new NetworkCredential(ftpUserID, ftpPassword);
reqFTP.KeepAlive = false;
reqFTP.Method = WebRequestMethods.Ftp.DeleteFile;
string result = String.Empty;
FtpWebResponse response = (FtpWebResponse)reqFTP.GetResponse();
long size = response.ContentLength;
Stream datastream = response.GetResponseStream();
StreamReader sr = new StreamReader(datastream);
result = sr.ReadToEnd();
sr.Close();
datastream.Close();
response.Close();
reqFTP.Abort();
}
catch (Exception ex)
{
reqFTP.Abort();
logger.Error("FtpWeb Delete Error --> " +fileName,ex);
}
}
/// <summary>
/// 删除文件夹
/// </summary>
/// <param name="folderName"></param>
public void RemoveDirectory(string folderName)
{
try
{
string uri = ftpURI + folderName;
FtpWebRequest reqFTP;
reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri(uri));
reqFTP.Credentials = new NetworkCredential(ftpUserID, ftpPassword);
reqFTP.KeepAlive = false;
reqFTP.Method = WebRequestMethods.Ftp.RemoveDirectory;
string result = String.Empty;
FtpWebResponse response = (FtpWebResponse)reqFTP.GetResponse();
long size = response.ContentLength;
Stream datastream = response.GetResponseStream();
StreamReader sr = new StreamReader(datastream);
result = sr.ReadToEnd();
sr.Close();
datastream.Close();
response.Close();
}
catch (Exception ex)
{
logger.Error("FtpWeb Delete folder Error --> " + folderName, ex);
//Insert_Standard_ErrorLog.Insert("FtpWeb", "Delete Error --> " + ex.Message + " 文件名:" + folderName);
}
}
/// <summary>
/// 获取当前目录下明细(包含文件和文件夹)
/// </summary>
/// <returns></returns>
public string[] GetFilesDetailList(string _path = "")
{
string[] downloadFiles;
StringBuilder result = new StringBuilder();
FtpWebRequest ftp;
ftp = (FtpWebRequest)FtpWebRequest.Create(new Uri(ftpURI + _path));
ftp.Credentials = new NetworkCredential(ftpUserID, ftpPassword);
ftp.Method = WebRequestMethods.Ftp.ListDirectoryDetails;
WebResponse response = ftp.GetResponse();
StreamReader reader = new StreamReader(response.GetResponseStream(), Encoding.Default);
try
{
//while (reader.Read() > 0)
//{
//}
string line = reader.ReadLine();
//line = reader.ReadLine();
//line = reader.ReadLine();
while (line != null)
{
result.Append(line);
result.Append("\n");
line = reader.ReadLine();
}
result.Remove(result.ToString().LastIndexOf("\n"), 1);
reader.Close();
response.Close();
ftp.Abort();
return result.ToString().Split('\n');
}
catch (Exception ex)
{
ftp.Abort();
downloadFiles = null;
logger.Error("FtpWeb GetFilesDetailList Error -->" + ex.Message, ex);
//Insert_Standard_ErrorLog.Insert("FtpWeb", "GetFilesDetailList Error --> " + ex.Message);
return downloadFiles;
}
}
/// <summary>
/// 获取当前目录下文件列表(仅文件)
/// 文件名包含【mask】内容的
/// </summary>
/// <returns></returns>
public string[] GetFileList(string mask, out string msg)
{
string[] downloadFiles;
StringBuilder result = new StringBuilder();
FtpWebRequest reqFTP;
reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri(ftpURI));
try
{
reqFTP.UseBinary = true;
reqFTP.Credentials = new NetworkCredential(ftpUserID, ftpPassword);
reqFTP.Method = WebRequestMethods.Ftp.ListDirectory;
WebResponse response = reqFTP.GetResponse();
StreamReader reader = new StreamReader(response.GetResponseStream(), Encoding.Default);
string line = reader.ReadLine();
while (line != null)
{
if (mask.Trim() != string.Empty && mask.Trim() != "*.*")
{
string mask_ = mask.Substring(0, mask.IndexOf("*"));
if (line.Substring(0, mask_.Length) == mask_)
{
result.Append(line);
result.Append("\n");
}
}
else
{
result.Append(line);
result.Append("\n");
}
line = reader.ReadLine();
}
result.Remove(result.ToString().LastIndexOf('\n'), 1);
reader.Close();
response.Close();
msg = "";
reqFTP.Abort();
return result.ToString().Split('\n');
}
catch (Exception ex)
{
downloadFiles = null;
if (ex.Message.Trim() != "远程服务器返回错误: (550) 文件不可用(例如,未找到文件,无法访问文件)。")
{
logger.Error("FtpWeb GetFileList Error -->" + ex.Message, ex);
//Insert_Standard_ErrorLog.Insert("FtpWeb", "GetFileList Error --> " + ex.Message.ToString());
}
msg = ex.Message;
reqFTP.Abort();
return downloadFiles;
}
}
/// <summary>
/// 获取当前目录下所有的文件夹列表(仅文件夹)
/// </summary>
/// <returns></returns>
public string[] GetDirectoryList()
{
string[] drectory = GetFilesDetailList();
string m = string.Empty;
foreach (string str in drectory)
{
int dirPos = str.IndexOf("<DIR>");
if (dirPos > 0)
{
/*判断 Windows 风格*/
m += str.Substring(dirPos + 5).Trim() + "\n";
}
else if (str.Trim().Substring(0, 1).ToUpper() == "D")
{
/*判断 Unix 风格*/
string dir = str.Substring(54).Trim();
if (dir != "." && dir != "..")
{
m += dir + "\n";
}
}
}
char[] n = new char[] { '\n' };
return m.Split(n);
}
/// <summary>
/// 判断当前目录下指定的子目录是否存在
/// </summary>
/// <param name="RemoteDirectoryName">指定的目录名</param>
public bool DirectoryExist(string RemoteDirectoryName)
{
string[] dirList = GetDirectoryList();
foreach (string str in dirList)
{
if (str.Trim() == RemoteDirectoryName.Trim())
{
return true;
}
}
return false;
}
/// <summary>
/// 判断当前目录下指定的文件是否存在
/// </summary>
/// <param name="RemoteFileName">远程文件名</param>
public bool FileExist(string RemoteFileName)
{
string msg = "";
string[] fileList = GetFileList("*.*", out msg);
foreach (string str in fileList)
{
if (str.Trim() == RemoteFileName.Trim())
{
return true;
}
}
return false;
}
/// <summary>
/// 创建文件夹
/// </summary>
/// <param name="dirName"></param>
public Boolean MakeDir(string localFile)//想要创bai建的文du件夹
        {
//  _Uri是Uri类的zhi路径
FtpWebRequest req = (FtpWebRequest)WebRequest.Create(ftpURI + localFile);
req.Credentials = new NetworkCredential(ftpUserID, ftpPassword);
req.Method = WebRequestMethods.Ftp.MakeDirectory;
try
{
FtpWebResponse response = (FtpWebResponse)req.GetResponse();
response.Close();
}
catch (Exception)
{
req.Abort();
return false;
}
req.Abort();
return true;
}
/// <summary>
/// 获取指定文件大小
/// </summary>
/// <param name="filename"></param>
/// <returns></returns>
public long GetFileSize(string filename)
{
FtpWebRequest reqFTP;
long fileSize = 0;
try
{
reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri(ftpURI + filename));
reqFTP.Method = WebRequestMethods.Ftp.GetFileSize;
reqFTP.UseBinary = true;
reqFTP.Credentials = new NetworkCredential(ftpUserID, ftpPassword);
FtpWebResponse response = (FtpWebResponse)reqFTP.GetResponse();
Stream ftpStream = response.GetResponseStream();
fileSize = response.ContentLength;
ftpStream.Close();
response.Close();
}
catch (Exception ex)
{
logger.Error("FtpWeb GetFileSize Error -->" + ex.Message, ex);
//Insert_Standard_ErrorLog.Insert("FtpWeb", "GetFileSize Error --> " + ex.Message);
}
return fileSize;
}
/// <summary>
/// 改名
/// </summary>
/// <param name="currentFilename"></param>
/// <param name="newFilename"></param>
public void ReName(string currentFilename, string newFilename)
{
FtpWebRequest reqFTP;
reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri(ftpURI + currentFilename));
try
{
reqFTP.Method = WebRequestMethods.Ftp.Rename;
reqFTP.RenameTo = newFilename;
reqFTP.UseBinary = true;
reqFTP.Credentials = new NetworkCredential(ftpUserID, ftpPassword);
FtpWebResponse response = (FtpWebResponse)reqFTP.GetResponse();
Stream ftpStream = response.GetResponseStream();
ftpStream.Close();
response.Close();
reqFTP.Abort();
}
catch (Exception ex)
{
reqFTP.Abort();
logger.Error("FtpWeb ReName Error -->" + ex.Message, ex);
//Insert_Standard_ErrorLog.Insert("FtpWeb", "ReName Error --> " + ex.Message);
}
}
/// <summary>
/// 移动文件
/// </summary>
/// <param name="currentFilename"></param>
/// <param name="newFilename"></param>
public void MoveFile(string currentFilename, string newDirectory)
{
ReName(currentFilename, newDirectory);
}
/// <summary>
/// 切换当前目录
/// </summary>
/// <param name="DirectoryName"></param>
/// <param name="IsRoot">true 绝对路径 false 相对路径</param>
public void GotoDirectory(string DirectoryName, bool IsRoot)
{
if (IsRoot)
{
ftpRemotePath = DirectoryName;
}
else
{
ftpRemotePath += DirectoryName + "/";
}
ftpURI = "ftp://" + ftpServerIP + "/" + ftpRemotePath + "/";
}
/// <summary>
/// 删除订单目录
/// </summary>
/// <param name="ftpServerIP">FTP 主机地址</param>
/// <param name="folderToDelete">FTP 用户名</param>
/// <param name="ftpUserID">FTP 用户名</param>
/// <param name="ftpPassword">FTP 密码</param>
public static void DeleteOrderDirectory(string ftpServerIP, string folderToDelete, string ftpUserID, string ftpPassword)
{
try
{
if (!string.IsNullOrEmpty(ftpServerIP) && !string.IsNullOrEmpty(folderToDelete) && !string.IsNullOrEmpty(ftpUserID) && !string.IsNullOrEmpty(ftpPassword))
{
FtpHelper fw = new FtpHelper(ftpServerIP, folderToDelete, ftpUserID, ftpPassword);
//进入订单目录
fw.GotoDirectory(folderToDelete, true);
//获取规格目录
string[] folders = fw.GetDirectoryList();
foreach (string folder in folders)
{
if (!string.IsNullOrEmpty(folder) || folder != "")
{
//进入订单目录
string subFolder = folderToDelete + "/" + folder;
fw.GotoDirectory(subFolder, true);
//获取文件列表
string msg = "";
string[] files = fw.GetFileList("*.*", out msg);
if (files != null)
{
//删除文件
foreach (string file in files)
{
fw.Delete(file);
}
}
//删除冲印规格文件夹
fw.GotoDirectory(folderToDelete, true);
fw.RemoveDirectory(folder);
}
}
//删除订单文件夹
string parentFolder = folderToDelete.Remove(folderToDelete.LastIndexOf('/'));
string orderFolder = folderToDelete.Substring(folderToDelete.LastIndexOf('/') + 1);
fw.GotoDirectory(parentFolder, true);
fw.RemoveDirectory(orderFolder);
}
else
{
throw new Exception("FTP 及路径不能为空!");
}
}
catch (Exception ex)
{
throw new Exception("删除订单时发生错误,错误信息为:" + ex.Message);
}
}
}
}

@ -0,0 +1,80 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace DSWeb.Common.Helper
{
public class IdHelper
{
//机器ID
private static long workerId=1;
private static long twepoch = 1565667764198;//2019-08-13为基准
private static long sequence = 0L;
private static int workerIdBits = 1; //机器码字节数
public static long maxWorkerId = -1L ^ -1L << workerIdBits; //最大机器ID
private static int sequenceBits = 4; //计数器字节数
private static int workerIdShift = sequenceBits; //机器码数据左移位数,就是后面计数器占用的位数
private static int timestampLeftShift = sequenceBits + workerIdBits; //时间戳左移动位数就是机器码和计数器总字节数
public static long sequenceMask = -1L ^ -1L << sequenceBits; //一微秒内可以产生计数,如果达到该值则等到下一微妙在进行生成
private long lastTimestamp = -1L;
public IdHelper()
{
}
public long nextId()
{
lock (this)
{
long timestamp = timeGen();
if (this.lastTimestamp == timestamp)
{ //同一微妙中生成ID
IdHelper.sequence = (IdHelper.sequence + 1) & IdHelper.sequenceMask; //用&运算计算该微秒内产生的计数是否已经到达上限
if (IdHelper.sequence == 0)
{
//一微妙内产生的ID计数已达上限等待下一微妙
timestamp = tillNextMillis(this.lastTimestamp);
}
}
else
{ //不同微秒生成ID
IdHelper.sequence = 0; //计数清0
}
if (timestamp < lastTimestamp)
{ //如果当前时间戳比上一次生成ID时时间戳还小抛出异常因为不能保证现在生成的ID之前没有生成过
throw new Exception(string.Format("Clock moved backwards. Refusing to generate id for {0} milliseconds",
this.lastTimestamp - timestamp));
}
this.lastTimestamp = timestamp; //把当前时间戳保存为最后生成ID的时间戳
long nextId = (timestamp - twepoch << timestampLeftShift) | IdHelper.workerId << IdHelper.workerIdShift | IdHelper.sequence;
return nextId;
}
}
/// <summary>
/// 获取下一微秒时间戳
/// </summary>
/// <param name="lastTimestamp"></param>
/// <returns></returns>
private long tillNextMillis(long lastTimestamp)
{
long timestamp = timeGen();
while (timestamp <= lastTimestamp)
{
timestamp = timeGen();
}
return timestamp;
}
/// <summary>
/// 生成当前时间戳
/// </summary>
/// <returns></returns>
private long timeGen()
{
return (long)(DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)).TotalMilliseconds;
}
}
}

@ -0,0 +1,283 @@
using DSWeb.Common.DB;
using log4net;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Web;
namespace DSWeb.Common.Helper
{
/// <summary>
/// 发送邮件辅助类
/// </summary>
public static class MailHelper
{
private static ILog logger = LogManager.GetLogger("MailHelper");
/// <summary>
/// 使用随机邮箱发送邮件
/// </summary>
/// <param name="title">邮件标题</param>
/// <param name="body">邮件内容</param>
/// <param name="sendTo">接收人(多个接收人用英文逗号或分号隔开)</param>
public static bool SendMail(string title, string body, string sendTo)
{
bool succ = false;
CommonDataContext commonDataContext = new CommonDataContext();
var smtpList = commonDataContext.MailSendSmtp.AsNoTracking().ToList();
MailSendSmtp smtp = null;
if (smtpList.Count > 0)
{
Random rnd = new Random();
int idx = rnd.Next(smtpList.Count);
smtp = smtpList[idx];
}
MailSend mailSend = new MailSend();
mailSend.SendTo = sendTo;
mailSend.Title = title;
mailSend.Body = body;
if (smtp != null)
{
mailSend.SendStatus = MailSend.MailSendStatusCreate;
mailSend.SmtpConfig = smtp.GID;
succ = true;
}
else
{
mailSend.SendStatus = MailSend.MailSendStatusFail;
logger.Error("没有配置发送邮箱,邮件将不会发送");
}
commonDataContext.MailSend.Add(mailSend);
commonDataContext.SaveChanges();
return succ;
}
/// <summary>
/// 使用指定的邮箱发送邮件
/// </summary>
/// <param name="configId">指定smtp配置的id</param>
/// <param name="title">邮件标题</param>
/// <param name="body">邮件内容</param>
/// <param name="sendTo">接收人(多个接收人用英文逗号或分号隔开)</param>
/// <param name="showName">显示名称</param>
/// <param name="sender">自定义发件人(只有小部分邮箱支持)</param>
public static bool SendMail(string configId, string title, string body, string sendTo, string showName = null, string sender = null)
{
bool succ = false;
CommonDataContext commonDataContext = new CommonDataContext();
var smtp = commonDataContext.MailSendSmtp.AsNoTracking().FirstOrDefault(c => c.GID == configId);
MailSend mailSend = new MailSend();
mailSend.SendTo = sendTo;
mailSend.Title = title;
mailSend.Body = body;
mailSend.ShowName = showName;
mailSend.Sender = sender;
if (smtp != null)
{
mailSend.SendStatus = MailSend.MailSendStatusCreate;
mailSend.SmtpConfig = smtp.GID;
succ = true;
}
else
{
mailSend.SendStatus = MailSend.MailSendStatusFail;
logger.Error("没有配置发送邮箱,邮件将不会发送");
}
commonDataContext.MailSend.Add(mailSend);
commonDataContext.SaveChanges();
return succ;
}
/// <summary>
/// 使用默认发件地址发送邮件
/// </summary>
/// <param name="title">邮件标题</param>
/// <param name="body">邮件内容</param>
/// <param name="sendTo">接收人(多个接收人用英文逗号或分号隔开)</param>
/// <returns></returns>
public static bool SendMailCommon(string title, string body, string sendTo)
{
return SendMail("4AB9E4EE-7E62-4E95-9168-F7CF0605E088", title, body, sendTo);
}
/// <summary>
/// 使用马士基发件地址发送邮件
/// </summary>
/// <param name="title">邮件标题</param>
/// <param name="body">邮件内容</param>
/// <param name="sendTo">接收人(多个接收人用英文逗号或分号隔开)</param>
/// <returns></returns>
public static bool SendMailMaersk(string title, string body, string sendTo)
{
return SendMail("37F7BF61-41F1-4B77-A1B8-41BAFEDF5AF1", title, body, sendTo);
}
/// <summary>
/// 使用发票转发发件地址发送邮件
/// </summary>
/// <param name="title">邮件标题</param>
/// <param name="body">邮件内容</param>
/// <param name="sendTo">接收人(多个接收人用英文逗号或分号隔开)</param>
/// <returns></returns>
public static bool SendMailInvoice(string title, string body, string sendTo)
{
return SendMail("4E07BC66-0E0A-4A97-A3B5-EC6516FAE24A", title, body, sendTo, "大简云发票平台");
}
/// <summary>
/// 发送发票邮件
/// </summary>
/// <param name="invId">发票记录Id</param>
/// <returns></returns>
//public static bool SendMailInvoiceRecord(string invId)
//{
// return SendMailInvoiceRecordOther(invId, null);
//}
/// <summary>
/// 发送发票邮件
/// </summary>
/// <param name="invId">发票记录Id</param>
/// <param name="email">优先使用参数的邮箱若参数未null时使用发票记录的邮箱</param>
/// <returns></returns>
//public static bool SendMailInvoiceRecordOther(string invId, string email)
//{
// InvoiceDbContext invDB = new InvoiceDbContext();
// CommonDataContext comDB = new CommonDataContext();
// var inv = invDB.Invoices.AsNoTracking().FirstOrDefault(i => i.GID == invId);
// if (inv != null && inv.Status == InvoiceRecord.StatusIssued && (!string.IsNullOrEmpty(email) || !string.IsNullOrEmpty(inv.Email)))
// {
// var cfg = comDB.ConfigDatas.AsNoTracking().FirstOrDefault(cd => cd.Module == ConfigData.ModuleInvoice && cd.Category == ConfigData.CateMailSubject && cd.UserId == inv.UserId);
// var title = "";
// if (cfg != null)
// {
// var subjectArr = JsonConvert.DeserializeObject<string[]>(cfg.JsonData);
// #region 标题拼接
// string mailTitle = string.Empty;
// if (subjectArr.Contains("SalerName"))
// {
// mailTitle += "销售方:" + inv.SalerName;
// }
// if (subjectArr.Contains("Total"))
// {
// if (mailTitle.Length > 0)
// {
// mailTitle += "---";
// }
// mailTitle += "金额:" + inv.Total;
// }
// if (subjectArr.Contains("InvoiceDate"))
// {
// if (mailTitle.Length > 0)
// {
// mailTitle += "---";
// }
// mailTitle += "开票日期:" + inv.InvoiceDate.Value.ToString("yyyy年MM月dd日");
// }
// if (subjectArr.Contains("InvNum"))
// {
// if (mailTitle.Length > 0)
// {
// mailTitle += "---";
// }
// mailTitle += "发票号码:" + inv.InvNum;
// }
// if (subjectArr.Contains("InvoiceLine"))
// {
// if (mailTitle.Length > 0)
// {
// mailTitle += "---";
// }
// switch (inv.InvoiceLine)
// {
// case "p":
// mailTitle += "发票种类:普通发票(电票)";
// break;
// case "c":
// mailTitle += "发票种类:普通发票(纸票)";
// break;
// case "s":
// mailTitle += "发票种类:专用发票";
// break;
// case "e":
// mailTitle += "发票种类:收购发票(电票)";
// break;
// case "f":
// mailTitle += "发票种类:收购发票(纸质)";
// break;
// }
// }
// if (subjectArr.Contains("Clerk"))
// {
// if (mailTitle.Length > 0)
// {
// mailTitle += "---";
// }
// mailTitle += "开票人:" + inv.Clerk;
// }
// if (subjectArr.Contains("BuyerName"))
// {
// if (mailTitle.Length > 0)
// {
// mailTitle += "---";
// }
// mailTitle += "购货方名称:" + inv.BuyerName;
// }
// #endregion
// title = $"您收到一张电子发票:{mailTitle}";
// }
// else
// {
// title = $"您收到一张电子发票:销售方:{inv.SalerName}---金额:{inv.Total}---开票日期:{inv.InvoiceDate.Value.ToString("yyyy年MM月dd日")}";
// }
// //读取html模板填充数据
// var htmlFile = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Areas/Invoice/Content/InvoiceMailTemplate.html");
// var content = File.ReadAllText(htmlFile);
// content = content.Replace("$VIEW_URL$", inv.PictureUrl);
// content = content.Replace("$CUST_NAME$", inv.BuyerName);
// content = content.Replace("$INV_DATA$", inv.InvoiceDate.Value.ToString("yyyy年MM月dd日"));
// content = content.Replace("$TOTAL$", inv.Total.ToString());
// content = content.Replace("$INV_NUM$", inv.InvNum);
// content = content.Replace("$INV_CODE$", inv.InvCode);
// content = content.Replace("$PDF_URL$", inv.PdfUrl);
// SendMailInvoice(title, content, string.IsNullOrEmpty(email) ? inv.Email : email);
// return true;
// }
// return false;
//}
/// <summary>
/// 发送邮件-运踪
/// </summary>
/// <param name="title">邮件标题</param>
/// <param name="body">邮件内容</param>
/// <param name="sendTo">接收人(多个接收人用英文逗号或分号隔开)</param>
/// <param name="showName">发件人显示名称</param>
/// <param name="sender">发件人显示邮箱地址(部分邮箱支持)</param>
/// <returns></returns>
public static bool SendMailBillTrace(string title, string body, string sendTo, string showName = null, string sender = null)
{
return SendMail("F48AA7593827456BB0DC12D4D8D13976", title, body, sendTo, showName, sender);
}
}
}

@ -0,0 +1,144 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Net;
using System.Text;
using System.Web;
namespace DSWeb.Common.Helper
{
public static class WebRequestHelper
{
public static string DoGet(string url)
{
string responseString = "";//post返回的结果
ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, err) => { return true; };
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls;
HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(url);
req.Method = "GET";
req.ContentLength = 0;
req.Timeout = 3000;
req.KeepAlive = false;
var response = req.GetResponse();
Stream streamResponse = response.GetResponseStream();
StreamReader streamRead = new StreamReader(streamResponse);
responseString = streamRead.ReadToEnd();
response.Close();
streamRead.Close();
return responseString;
}
public static string DoPost(string url, string json)
{
string responseString = "";//post返回的结果
ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, err) => { return true; };
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls;
HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(url);
req.Method = "POST";
if (!string.IsNullOrWhiteSpace(json))
{
byte[] postBytes = Encoding.UTF8.GetBytes(json);
req.ContentType = "application/json; charset=utf-8";
req.ContentLength = Encoding.UTF8.GetByteCount(json);
Stream stream = req.GetRequestStream();
stream.Write(postBytes, 0, postBytes.Length);
req.Timeout = 10000;
stream.Close();
}
else
{
req.ContentLength = 0;
}
var response = req.GetResponse();
Stream streamResponse = response.GetResponseStream();
StreamReader streamRead = new StreamReader(streamResponse);
responseString = streamRead.ReadToEnd();
response.Close();
streamRead.Close();
return responseString;
}
public static string DoPost(string url, Dictionary<string, string> dic, int timeout = 10000)
{
string responseString = "";//post返回的结果
ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, err) => { return true; };
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls;
HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(url);
req.Method = "POST";
req.Timeout = timeout;
req.Headers.Add("Accept-Encoding", "gzip, deflate");
if (dic.Count > 0)
{
string strContent = string.Empty;
foreach (var item in dic)
{
if (strContent.Length > 0)
{
strContent += "&";
}
strContent += $"{item.Key}={item.Value}";
}
byte[] postBytes = Encoding.UTF8.GetBytes(strContent);
req.ContentType = "application/x-www-form-urlencoded";
req.ContentLength = postBytes.Length;
Stream stream = req.GetRequestStream();
stream.Write(postBytes, 0, postBytes.Length);
stream.Close();
}
else
{
req.ContentLength = 0;
}
var response = req.GetResponse();
responseString = GetResponseBody((HttpWebResponse)response);
return responseString;
}
private static string GetResponseBody(HttpWebResponse response)
{
string responseBody = string.Empty;
if (response.ContentEncoding.ToLower().Contains("gzip"))
{
using (GZipStream stream = new GZipStream(response.GetResponseStream(), CompressionMode.Decompress))
{
using (StreamReader reader = new StreamReader(stream))
{
responseBody = reader.ReadToEnd();
}
}
}
else if (response.ContentEncoding.ToLower().Contains("deflate"))
{
using (DeflateStream stream = new DeflateStream(
response.GetResponseStream(), CompressionMode.Decompress))
{
using (StreamReader reader =
new StreamReader(stream, Encoding.UTF8))
{
responseBody = reader.ReadToEnd();
}
}
}
else
{
using (Stream stream = response.GetResponseStream())
{
using (StreamReader reader = new StreamReader(stream, Encoding.UTF8))
{
responseBody = reader.ReadToEnd();
}
}
}
return responseBody;
}
}
}

@ -0,0 +1,141 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DSWeb.Common
{
/// <summary>
/// datetime数据类型拓展
/// </summary>
public static class DateTimeExtension
{
/// <summary>
///将一个时间转换为秒级时间戳
/// </summary>
/// <param name="datetime">时间</param>
/// <returns></returns>
public static long ToTimeStampSeconds(this DateTime datetime)
{
return (long)Math.Round((datetime.ToUniversalTime() - new DateTimeOffset(1970, 1, 1, 0, 0, 0, TimeSpan.Zero)).TotalSeconds);
}
/// <summary>
///将一个时间转换为毫秒级时间戳
/// </summary>
/// <param name="datetime"></param>
/// <returns></returns>
public static long ToTimeStampMilliSeconds(this DateTime datetime)
{
return (long)Math.Round((datetime.ToUniversalTime() - new DateTimeOffset(1970, 1, 1, 0, 0, 0, TimeSpan.Zero)).TotalMilliseconds);
}
/// <summary>
/// 获取标准时间戳 秒级
/// </summary>
/// <param name="datetime"></param>
/// <returns></returns>
public static long ToTimeStamp(this DateTime datetime)
{ return ToTimeStampSeconds(datetime); }
/// <summary>
/// 将时间转换为时间字符串编码 yyyyMMddHHmmssffff
/// </summary>
/// <param name="datetime"></param>
/// <returns></returns>
public static string ToTimeStr(this DateTime datetime)
{
return datetime.ToString("yyyyMMddHHmmssffff");
}
/// <summary>
/// 判断时间是否大于1970年的有效时间
/// </summary>
/// <param name="dateTime"></param>
/// <returns></returns>
public static bool IsValidTime(this DateTime dateTime)
{
if (dateTime.Date >= DateTime.Parse("1970-1-1"))
return true;
else return false;
}
/// <summary>
/// 获时间一天中的开始时间
/// </summary>
/// <param name="dateTime"></param>
public static DateTime GetDayStartTime(this DateTime dateTime)
{
return dateTime.Date;
}
/// <summary>
/// 获取时间一天的结束时间
/// </summary>
/// <param name="dateTime"></param>
/// <returns></returns>
public static DateTime GetDateEndTime(this DateTime dateTime)
{
return dateTime.Date.AddDays(1).AddSeconds(-1);
}
/// <summary>
/// 获取时间周的星期一的时间
/// </summary>
/// <param name="dateTime"></param>
/// <returns></returns>
public static DateTime GetWeekStartTime(this DateTime dateTime)
{
return dateTime.GetWeekOfDayTime(1);
}
/// <summary>
/// 获取时间周的周日
/// </summary>
/// <param name="dateTime"></param>
/// <returns></returns>
public static DateTime GetWeekEndTime(this DateTime dateTime)
{
return dateTime.GetWeekOfDayTime(7);
}
/// <summary>
/// 获取时间周的指定周几时间
/// </summary>
/// <param name="dateTime"></param>
/// <param name="Day">周几 1 2 3 4 5 6 7</param>
/// <returns></returns>
public static DateTime GetWeekOfDayTime(this DateTime dateTime, int Day)
{
if (Day < 1)
Day = 1;
if (Day > 7)
Day = (int)dateTime.DayOfWeek;
return dateTime.Subtract(new TimeSpan(dateTime.DayOfWeek - (DayOfWeek)Day, 0, 0, 0)).Date;
}
/// <summary>
/// 获取时间月开始时间
/// </summary>
/// <param name="dateTime"></param>
/// <returns></returns>
public static DateTime GetMonthStartTime(this DateTime dateTime)
{
return new DateTime(dateTime.Year, dateTime.Month, 1).Date;
}
/// <summary>
/// 获取一个月的结束时间
/// </summary>
/// <param name="dateTime"></param>
/// <returns></returns>
public static DateTime GetMonthEndTime(this DateTime dateTime)
{
return dateTime.GetMonthStartTime().AddMonths(1).AddDays(-1);
}
}
}

@ -0,0 +1,90 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DSWeb.Common
{
/// <summary>
/// 扩展Int32功能
/// </summary>
public static class Int32Extensions
{
/// <summary>
/// 向上整除
/// 1.当num能被divideBy整除时,结果即为num/divideBy;
/// 2.当num不能被divideBy整除时,结果为num/divideBy + 1;
/// </summary>
/// <param name="num">被除数,大于或者等于0</param>
/// <param name="divideBy">除数,大于0</param>
/// <returns>向上整除结果</returns>
public static int CeilingDivide(this int num, int divideBy)
{
if (num < 0 || divideBy <= 0)
{
return 0;
}
return (num + divideBy - 1) / divideBy;
}
/// <summary>
/// 向上整除
/// 1.当num能被divideBy整除时,结果即为num/divideBy;
/// 2.当num不能被divideBy整除时,结果为num/divideBy + 1;
/// </summary>
/// <param name="num">被除数,大于或者等于0</param>
/// <param name="divideBy">除数,大于0</param>
/// <returns>向上整除结果</returns>
public static long CeilingDivide(this long num, long divideBy)
{
if (num < 0 || divideBy <= 0)
{
return 0;
}
return (num + divideBy - 1) / divideBy;
}
/// <summary>
/// 将List<int> 转为间隔字符串
/// </summary>
/// <param name="strlist"></param>
public static string ListToString(this List<int> strlist, char Split = ',')
{
StringBuilder str = new StringBuilder();
foreach (var item in strlist)
{
str.Append(item.ToString() + Split);
}
return str.ToString();
}
/// <summary>
/// 拓展 将字符串抓换为int
/// </summary>
/// <param name="str"></param>
/// <returns></returns>
public static int StrToInt(this string str)
{
if (str.Isint())
{ return Convert.ToInt32(str); }
else
{
return 0;
}
}
/// <summary>
/// 拓展 将字符串数组转换成int 数组
/// </summary>
/// <param name="str"></param>
/// <returns></returns>
public static int[] strToIntArray(this string[] str)
{
return Array.ConvertAll(str, new Converter<string, int>(StrToInt));
}
}
}

@ -0,0 +1,134 @@
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DSWeb.Common.Extentions
{
public static class JsonExtension
{
/// <summary>
/// 获取JObject
/// </summary>
/// <param name="jobj"></param>
/// <param name="prop"></param>
/// <returns></returns>
public static JObject GetJObjectValue(this JObject jobj, string prop)
{
var jt = jobj[prop];
if (jt == null)
{
return null;
}
return jt as JObject;
}
/// <summary>
/// 获取字符串值
/// </summary>
/// <param name="jobj"></param>
/// <param name="prop"></param>
/// <returns></returns>
public static string GetStringValue(this JObject jobj, string prop)
{
var jt = jobj[prop];
if (jt == null)
{
return string.Empty;
}
return jt.ToString();
}
/// <summary>
/// 获取int值
/// </summary>
/// <param name="jobj"></param>
/// <param name="prop"></param>
/// <returns></returns>
public static int GetIntValue(this JObject jobj, string prop)
{
var jt = jobj[prop];
if (jt == null)
{
return 0;
}
var strVal = jt.ToString();
int rtnVal = 0;
int.TryParse(strVal, out rtnVal);
return rtnVal;
}
/// <summary>
/// 获取decimal值
/// </summary>
/// <param name="jobj"></param>
/// <param name="prop"></param>
/// <returns></returns>
public static decimal GetDecimalValue(this JObject jobj, string prop)
{
var jt = jobj[prop];
if (jt == null)
{
return 0;
}
var strVal = jt.ToString();
decimal rtnVal = 0;
decimal.TryParse(strVal, out rtnVal);
return rtnVal;
}
/// <summary>
/// 获取datetime值
/// </summary>
/// <param name="jobj"></param>
/// <param name="prop"></param>
/// <returns></returns>
public static DateTime? GetDateTimeValue(this JObject jobj, string prop)
{
var jt = jobj[prop];
if (jt == null)
{
return null;
}
var strVal = jt.ToString();
DateTime rtnVal = DateTime.MinValue;
if (DateTime.TryParse(strVal, out rtnVal))
{
return rtnVal;
}
return null;
}
/// <summary>
/// 获取datetime值不带秒yyyy-MM-dd HH:mm
/// </summary>
/// <param name="jobj"></param>
/// <param name="prop"></param>
/// <returns></returns>
public static DateTime? GetDateTimeMinuteValue(this JObject jobj, string prop)
{
var jt = jobj[prop];
if (jt == null)
{
return null;
}
var strVal = jt.ToString() + ":00";
DateTime rtnVal = DateTime.MinValue;
if (DateTime.TryParse(strVal, out rtnVal))
{
return rtnVal;
}
return null;
}
}
}

@ -0,0 +1,51 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DSWeb.Common
{
/// <summary>
/// long数据拓展
/// </summary>
public static class LongExtension
{
/// <summary>
/// 将毫秒时间戳转换为普通时间
/// </summary>
/// <param name="timestamp">毫秒级别的时间戳</param>
/// <returns></returns>
public static DateTime ToDateTimeMilliseconds(this long timestamp)
{
System.DateTime time = System.DateTime.MinValue;
DateTime startTime = new DateTime(1970, 1, 1, 0, 0, 0);
time = startTime.AddMilliseconds(timestamp).Add(TimeZoneInfo.Local.BaseUtcOffset);
return time;
}
/// <summary>
/// 将秒级别时间戳转换为普通时间
/// </summary>
/// <param name="timestamp">秒级别的时间戳</param>
/// <returns></returns>
public static DateTime ToDateTimeSecoders(this long timestamp)
{
DateTime time = System.DateTime.MinValue;
DateTime startTime = new DateTime(1970, 1, 1, 0, 0, 0);
time = startTime.AddSeconds(timestamp).Add(TimeZoneInfo.Local.BaseUtcOffset);
return time;
}
/// <summary>
/// 讲标准时间戳(秒级)转换为时间格式
/// </summary>
/// <param name="timestamp"></param>
/// <returns></returns>
public static DateTime ToDataTime(this long timestamp)
{
return ToDateTimeSecoders(timestamp);
}
}
}

@ -0,0 +1,47 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Web;
namespace DSWeb.Common.Model
{
public class RespCommon
{
public bool Success { get; set; }
public string Message { get; set; }
public int Code { get; set; }
}
public class RespPage : RespCommon
{
public int Offset { get; set; }
public int Limit { get; set; }
public int Total { get; set; }
}
public class RespCommonData : RespCommon
{
public object Data { get; set; }
}
public class RespPageData : RespPage
{
public object DataList { get; set; }
}
public class RespBsSuggest
{
public int code { get; set; }
public string message { get; set; }
public object value { get; set; }
}
public class RespCodeName
{
public string code { get; set; }
public string name { get; set; }
}
}

@ -0,0 +1,479 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using Newtonsoft.Json;
namespace DSWeb.Common
{
/// <summary>
/// string 拓展
/// </summary>
public static class StringExtension
{
/// <summary>
/// 隐藏中间字符串
/// </summary>
/// <param name="str"></param>
/// <returns></returns>
public static string GetHideCentre(this string str)
{
if (str.Length > 8)
{
return string.Format("{0}***{1}", str.Substring(0, 4), str.Substring(str.Length - 4, 4));
}
else if (str.Length > 5)
{
return string.Format("{0}***{1}", str.Substring(0, 2), str.Substring(str.Length - 2, 2));
}
else if (str.Length > 4)
{
return string.Format("{0}***{1}", str.Substring(0, 1), str.Substring(str.Length - 1, 1));
}
else
{
return GetHideHead(str);
}
}
/// <summary>
/// 隐藏头部
/// </summary>
/// <param name="str"></param>
/// <returns></returns>
public static string GetHideHead(this string str)
{
var length = 1;
length = length > str.Length ? str.Length : length;
if (str.Length < 4)
{
length = 1;
if (str.Length == 1)
{
return str;
}
return "**" + str.Substring(str.Length - length, length);
}
length = 4;
return "****" + str.Substring(str.Length - length, length);
}
/// <summary>
/// 用于判断是否为空字符
/// </summary>
/// <param name="s"></param>
/// <returns></returns>
public static bool IsNull(this string s)
{
return s == null || (s.Trim().Length == 0);
}
/// <summary>
/// 用于判断是否为非空字符
/// </summary>
/// <param name="s"></param>
/// <returns></returns>
public static bool IsNotNull(this string s)
{
return !s.IsNull();
}
#region 加密算法
/// <summary>
/// DES对称加密字符串
/// </summary>
/// <param name="encryptString">待加密的字符串</param>
/// <param name="key">加密密钥,要求为16位</param>
/// <returns>加密成功返回加密后的字符串,失败返回源串</returns>
public static string DESEncrypt(this string encryptString, string key)
{
try
{
byte[] rgbKey = Encoding.UTF8.GetBytes(key);
//用于对称算法的初始化向量(默认值)。
byte[] rgbIV = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F };
byte[] inputByteArray = Encoding.UTF8.GetBytes(encryptString);
Aes dCSP = Aes.Create();
MemoryStream mStream = new MemoryStream();
CryptoStream cStream = new CryptoStream(mStream, dCSP.CreateEncryptor(rgbKey, rgbIV), CryptoStreamMode.Write);
cStream.Write(inputByteArray, 0, inputByteArray.Length);
cStream.FlushFinalBlock();
return Convert.ToBase64String(mStream.ToArray());
}
catch (Exception ex)
{
throw ex;
}
}
/// <summary>
/// DES对称解密字符串
/// </summary>
/// <param name="decryptString">待解密的字符串</param>
/// <param name="key">解密密钥要求16位</param>
/// <returns></returns>
public static string DESDecrypt(this string decryptString, string key)
{
try
{
//用于对称算法的初始化向量(默认值)
byte[] Keys = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F };
byte[] rgbKey = Encoding.UTF8.GetBytes(key);
byte[] rgbIV = Keys;
byte[] inputByteArray = Convert.FromBase64String(decryptString);
Aes DCSP = Aes.Create();
MemoryStream mStream = new MemoryStream();
CryptoStream cStream = new CryptoStream(mStream, DCSP.CreateDecryptor(rgbKey, rgbIV), CryptoStreamMode.Write);
cStream.Write(inputByteArray, 0, inputByteArray.Length);
cStream.FlushFinalBlock();
return Encoding.UTF8.GetString(mStream.ToArray());
}
catch
{
return decryptString;
}
}
/// <summary>
/// 将字符串转换成MD5加密字符串
/// </summary>
/// <param name="orgStr"></param>
/// <returns></returns>
public static string ToMd5(this string orgStr)
{
using (var md5 = MD5.Create())
{
var encoding = Encoding.UTF8;
var encryptedBytes = md5.ComputeHash(encoding.GetBytes(orgStr));
var sb = new StringBuilder(32);
foreach (var bt in encryptedBytes)
{
sb.Append(bt.ToString("x").PadLeft(2, '0'));
}
return sb.ToString().ToLower();
}
}
#endregion
/// <summary>
/// 获取扩展名
/// </summary>
/// <param name="s"></param>
/// <returns></returns>
public static string GetExt(this string s)
{
var ret = string.Empty;
if (!s.Contains('.')) return ret;
var temp = s.Split('.');
ret = temp[temp.Length - 1];
return ret;
}
/// <summary>
/// 验证QQ格式
/// </summary>
/// <param name="s"></param>
/// <returns></returns>
public static bool IsQq(this string s)
{
return s.IsNull() || Regex.IsMatch(s, @"^[1-9]\d{4,15}$");
}
/// <summary>
/// 将字符串根据分隔符转换我List<string>
/// </summary>
/// <param name="str"></param>
/// <param name="split">分隔符</param>
/// <returns></returns>
public static List<string> ToListString(this string str, char split)
{
return new List<string>(str.Split(split));
}
/// <summary>
/// 判断是否为有效的Email地址
/// </summary>
/// <param name="s"></param>
/// <returns></returns>
public static bool IsEmail(this string s)
{
if (!s.IsNull())
{
//return Regex.IsMatch(s,
// @"^(?("")("".+?""@)|(([0-9a-zA-Z]((\.(?!\.))|[-!#\$%&'\*\+/=\?\^`\{\}\|~\w])*)(?<=[0-9a-zA-Z])@))" +
// @"(?(\[)(\[(\d{1,3}\.){3}\d{1,3}\])|(([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,6}))$");
const string pattern = @"^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$";
return Regex.IsMatch(s, pattern);
}
return false;
}
/// <summary>
/// 判断是否是url
/// </summary>
/// <param name="s"></param>
/// <returns></returns>
public static bool IsUrl(this string s)
{
if (!s.IsNull())
{
const string pattern = @"^(http://|https://)?((?:[A-Za-z0-9]+-[A-Za-z0-9]+|[A-Za-z0-9]+)\.)+([A-Za-z]+)[/\?\:]?.*$";
return Regex.IsMatch(s, pattern);
}
return false;
}
/// <summary>
/// 验证是否是合法的电话号码
/// </summary>
/// <param name="s"></param>
/// <returns></returns>
public static bool IsPhone(this string s)
{
if (!s.IsNull())
{
return Regex.IsMatch(s, @"^\+?((\d{2,4}(-)?)|(\(\d{2,4}\)))*(\d{0,16})*$");
}
return true;
}
/// <summary>
/// 验证是否是合法的手机号码
/// </summary>
/// <param name="s"></param>
/// <returns></returns>
public static bool IsMobile(this string s)
{
if (!s.IsNull())
{
return Regex.IsMatch(s, @"^\+?\d{0,4}?[1][3-8]\d{9}$");
}
return false;
}
/// <summary>
/// 验证是否是合法的邮编
/// </summary>
/// <param name="s"></param>
/// <returns></returns>
public static bool IsZipCode(this string s)
{
if (!s.IsNull())
{
return Regex.IsMatch(s, @"[1-9]\d{5}(?!\d)");
}
return true;
}
/// <summary>
/// 验证是否是合法的传真
/// </summary>
/// <param name="s"></param>
/// <returns></returns>
public static bool IsFax(this string s)
{
if (!s.IsNull())
{
return Regex.IsMatch(s, @"(^[0-9]{3,4}\-[0-9]{7,8}$)|(^[0-9]{7,8}$)|(^\([0-9]{3,4}\)[0-9]{3,8}$)|(^0{0,1}13[0-9]{9}$)");
}
return true;
}
/// <summary>
/// 检查字符串是否为有效的int数字
/// </summary>
/// <param name="val"></param>
/// <returns></returns>
public static bool Isint(this string val)
{
if (IsNull(val))
return false;
int k;
return int.TryParse(val, out k);
}
/// <summary>
/// 字符串转数字未转换成功返回0
/// </summary>
/// <param name="val"></param>
/// <returns></returns>
public static int ToInt(this string val)
{
if (IsNull(val))
return 0;
int k;
return int.TryParse(val, out k) ? k : 0;
}
/// <summary>
/// 将int间隔字符串抓换为list<int>
/// </summary>
/// <param name="str"></param>
/// <param name="Split"></param>
/// <returns></returns>
public static List<int> ToIntList(this string str, char Split = ',')
{
return str.Split(Split).strToIntArray().ToList();
}
/// <summary>
/// 判断是否是json字符串
/// </summary>
/// <param name="str"></param>
/// <returns></returns>
public static bool IsJson(this string str)
{
try
{
if (str.IsNull())
return false;
JsonConvert.DeserializeObject(str);
return true;
}
catch
{
return false;
}
}
/// <summary>
/// 检查字符串是否为有效的INT64数字
/// </summary>
/// <param name="val"></param>
/// <returns></returns>
public static bool IsInt64(this string val)
{
if (IsNull(val))
return false;
long k;
return long.TryParse(val, out k);
}
/// <summary>
/// 验证是否是身份证
/// </summary>
/// <param name="ID"></param>
/// <returns></returns>
public static bool IsCardId(this string ID)
{
var r = false;
if (IsNull(ID))
r = false;
if (ID.Length == 15)
{
var date = $"19{ID.Substring(6, 2)}-{ID.Substring(8, 2)}-{ID.Substring(10, 2)}";
DateTime dt;
return DateTime.TryParse(date, out dt);
}
else if (ID.Length == 18)
{
var date = $"{ID.Substring(6, 4)}-{ID.Substring(10, 2)}-{ID.Substring(12, 2)}";
DateTime dt;
return DateTime.TryParse(date, out dt);
}
else { r = false; }
return r;
}
/// <summary>
/// 检查字符串是否为有效的double
/// </summary>
/// <param name="val"></param>
/// <returns></returns>
public static bool IsDecimal(this string val)
{
if (IsNull(val))
return false;
double d;
return double.TryParse(val, out d);
}
/// <summary>
///检测字符串是否是时间类型
/// </summary>
/// <param name="val"></param>
/// <returns></returns>
public static bool IsDateTime(this string val)
{
if (IsNull(val))
return false;
DateTime d;
return DateTime.TryParse(val, out d);
}
/// <summary>
/// 字符串转时间 非时间返回空
/// </summary>
/// <param name="val"></param>
/// <returns></returns>
public static DateTime? ToDateTime(this string val)
{
if (val.IsDateTime())
{
return DateTime.Parse(val);
}
else
{
return null;
}
}
/// <summary>
/// 将时间类型字符转时间戳
/// </summary>
/// <param name="Val"></param>
/// <returns></returns>
public static long ToTimestamp(this string Val)
{
var time = Val.ToDateTime();
return time != null ? ((DateTime)time).ToTimeStamp() : 0;
}
/// <summary>
/// 从左边截取N个字符
/// </summary>
/// <param name="val"></param>
/// <returns></returns>
public static string GetLeftStr(this string val, int count = 0)
{
if (count > val.Length)
return null;
return val.Substring(0, count);
}
/// <summary>
///从右边截取N个字符
/// </summary>
/// <param name="val"></param>
/// <param name="count"></param>
/// <returns></returns>
public static string GetRightStr(this string val, int count = 0)
{
if (count > val.Length)
return null;
return val.Substring(val.Length - count, count);
}
}
}

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("DSWeb.Common")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("DSWeb.Common")]
[assembly: AssemblyCopyright("Copyright © Microsoft 2020")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("a0ab3d23-0dad-49ba-9d23-107faa1c369e")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
// 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="EntityFramework" version="6.4.4" targetFramework="net45" />
<package id="log4net" version="1.2.10" targetFramework="net45" />
<package id="Newtonsoft.Json" version="13.0.2" targetFramework="net45" />
</packages>

@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28307.539
# Visual Studio Version 17
VisualStudioVersion = 17.4.33205.214
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DSWeb", "DSWeb\DSWeb.csproj", "{A91BE74B-0E69-433D-8622-A5D9CCA76E93}"
ProjectSection(ProjectDependencies) = postProject
@ -16,6 +16,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OfficeHelper", "OfficeHelpe
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HcDBUtility", "HcDBUtility\HcDBUtility.csproj", "{3251626D-7409-42C5-9BB6-2BF6BD6C285B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DSWeb.Common", "DSWeb.Common\DSWeb.Common.csproj", "{A0AB3D23-0DAD-49BA-9D23-107FAA1C369E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -76,6 +78,18 @@ Global
{3251626D-7409-42C5-9BB6-2BF6BD6C285B}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{3251626D-7409-42C5-9BB6-2BF6BD6C285B}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{3251626D-7409-42C5-9BB6-2BF6BD6C285B}.Release|x86.ActiveCfg = Release|Any CPU
{A0AB3D23-0DAD-49BA-9D23-107FAA1C369E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A0AB3D23-0DAD-49BA-9D23-107FAA1C369E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A0AB3D23-0DAD-49BA-9D23-107FAA1C369E}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{A0AB3D23-0DAD-49BA-9D23-107FAA1C369E}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{A0AB3D23-0DAD-49BA-9D23-107FAA1C369E}.Debug|x86.ActiveCfg = Debug|Any CPU
{A0AB3D23-0DAD-49BA-9D23-107FAA1C369E}.Debug|x86.Build.0 = Debug|Any CPU
{A0AB3D23-0DAD-49BA-9D23-107FAA1C369E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A0AB3D23-0DAD-49BA-9D23-107FAA1C369E}.Release|Any CPU.Build.0 = Release|Any CPU
{A0AB3D23-0DAD-49BA-9D23-107FAA1C369E}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{A0AB3D23-0DAD-49BA-9D23-107FAA1C369E}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{A0AB3D23-0DAD-49BA-9D23-107FAA1C369E}.Release|x86.ActiveCfg = Release|Any CPU
{A0AB3D23-0DAD-49BA-9D23-107FAA1C369E}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

@ -0,0 +1,125 @@
using Aspose.Words.Saving;
using DSWeb.Areas.CommMng.DAL;
using DSWeb.Common.DB;
using DSWeb.MvcShipping.Helper;
using HcUtility.Comm;
using System;
using System.Collections.Generic;
using System.Data.Entity.Core.Metadata.Edm;
using System.Data.Entity.Migrations;
using System.Diagnostics.Contracts;
using System.Linq;
using System.Reflection;
using System.Web;
using System.Web.Mvc;
namespace DSWeb.Areas.CommMng.Controllers
{
public class PublicInterfaceController
{
[HttpPost]
public InterfaceResult PostInterface(InterfaceParam param) {
try {
param.Save();
Assembly assembly = Assembly.Load("DSWeb.Areas.CommMng.Controllers");
var type = assembly.GetType("DSWeb.Areas.CommMng.Controllers.InterfaceBase." + param.PORTNAME);
Object obj = type.Assembly.CreateInstance(type.ToString());
var doset = type.GetMethod("DoSet");
var _param = new object[]{ param};
InterfaceResult result = (InterfaceResult)doset.Invoke(obj,BindingFlags.Instance|BindingFlags.NonPublic,null, _param, null);
return result;
} catch (Exception e) {
var _r = new InterfaceResult();
_r.errCode = "1";
var msg = e.Message;
if (e.InnerException != null && e.InnerException.Message != null) {
msg += "//InnerException.Message:" + e.InnerException.Message;
}
var _rs= BasicDataRefDAL.SaveLog(msg, "", param.PORTNAME, "公开接口");
var _rr = JsonConvert.Deserialize<DBResult>(_rs.Content);
_r.errMsg = "未知错误,请联系相关人员,错误日志号【" + _rr.Data.ToString() + "】";
return _r;
}
}
}
public class InterfaceResult {
public string errCode { get; set; }
public string errMsg { get; set; }
public InterfaceResult() { }
public InterfaceResult(DBResult dbresult) {
if (dbresult.Success)
{
errCode = "0";
}
else
{
errCode = "1";
}
errMsg = dbresult.Message + ";Data:" + JsonConvert.Serialize(dbresult.Data);
}
}
public class InterfaceParam {
public string PORTNAME { get; set; }
public string GID { get; set; }
public string Param { get; set; }
public t_PublicInterface_Log_md getsaverec() {
var result = new t_PublicInterface_Log_md();
result.GID= GID;
result.Param= Param;
result.PORTNAME = PORTNAME;
return result;
}
public void Save() {
var saverec = getsaverec();
if (string.IsNullOrWhiteSpace( saverec.Param) && string.IsNullOrWhiteSpace(saverec.PORTNAME))
{
var cdc = new CommonDataContext();
cdc.t_PublicInterface_Log.Add(saverec);
}
}
}
public class InterfaceBase
{
public InterfaceBase() { }
public InterfaceResult DoSet(InterfaceParam param) {
return new InterfaceResult();
}
//public static void SaveParam(InterfaceParam param) {
// param.Save();
//}
public class csCustInfo: InterfaceBase
{
public InterfaceResult DoSet(InterfaceParam param)
{
var result = new DBResult();
//解析param.Param
var _str = param.Param;
//向数据库保存
return new InterfaceResult(result);
}
}
}
}

@ -288,6 +288,7 @@
<Content Include="Webservice\DsWebService.asmx" />
</ItemGroup>
<ItemGroup>
<Compile Include="Areas\CommMng\Controllers\PublicInterfaceController.cs" />
<Compile Include="Areas\CommMng\DAL\PageHelperEIP.cs" />
<Compile Include="Areas\CommMng\DAL\PagerHelper.cs" />
<Compile Include="Areas\CommMng\Models\BasicDataModel.cs" />
@ -1281,6 +1282,10 @@
</Compile>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\DSWeb.Common\DSWeb.Common.csproj">
<Project>{a0ab3d23-0dad-49ba-9d23-107faa1c369e}</Project>
<Name>DSWeb.Common</Name>
</ProjectReference>
<ProjectReference Include="..\HcDBUtility\HcDBUtility.csproj">
<Project>{3251626D-7409-42C5-9BB6-2BF6BD6C285B}</Project>
<Name>HcDBUtility</Name>

@ -64,9 +64,16 @@
<!--是否陆运-->
</appSettings>
<connectionStrings>
<!--
<add name="DongShengDB" connectionString="Server=ds-hxt;Database=dongshengdata_jf;User ID=sa;Password=ds20040201;Connect Timeout=18000;" providerName="System.Data.SqlClient" />
-->
<add name="sydevzsh" connectionString="Server=ds-hxt;Database=dongshengdata_jf;User ID=sa;Password=ds20040201;Connect Timeout=18000;" providerName="System.Data.SqlClient" />
</connectionStrings>
<add name="DongShengDB" connectionString="Server=60.209.125.238,52314;Database=shippingwebTEST;User ID=sa;Password=Ds20040201;Connect Timeout=18000;" providerName="System.Data.SqlClient" />
<add name="DS6DB" connectionString="Server=60.209.125.238,52314;Database=HECHUAN;User ID=sa;Password=Ds20040201;Connect Timeout=18000;" providerName="System.Data.SqlClient" />
</connectionStrings>
<!--
有关 web.config 更改的说明,请参见 http://go.microsoft.com/fwlink/?LinkId=235367。

Loading…
Cancel
Save