├── .gitattributes
├── .gitignore
├── CRL2.sln
├── CRL2
├── Attribute
│ ├── AopProxy.cs
│ ├── FieldAttribute.cs
│ ├── FieldIndexType.cs
│ ├── FieldType.cs
│ ├── ModelProxyAttribute.cs
│ └── TableAttribute.cs
├── Base.cs
├── BaseAction.cs
├── BaseProvider.cs
├── Business
│ ├── Account
│ │ ├── AccountAction.cs
│ │ ├── AccountBusiness.cs
│ │ ├── Model
│ │ │ ├── AccountDetail.cs
│ │ │ ├── LockRecord.cs
│ │ │ ├── OperateType.cs
│ │ │ └── Transaction.cs
│ │ ├── TransactionAction.cs
│ │ ├── TransactionBusiness.cs
│ │ └── TransactionType.cs
│ ├── Advert
│ │ ├── Advert.cs
│ │ ├── AdvertAction.cs
│ │ └── AdvertBusiness.cs
│ ├── Area
│ │ ├── Area.cs
│ │ └── AreaAction.cs
│ ├── Article
│ │ ├── Article.cs
│ │ ├── ArticleAction.cs
│ │ └── ArticleBusiness.cs
│ ├── Category
│ │ ├── Category.cs
│ │ ├── CategoryAction.cs
│ │ └── CategoryBusiness.cs
│ ├── Comment
│ │ ├── Comment.cs
│ │ ├── CommentAction.cs
│ │ └── CommentBusiness.cs
│ ├── DicConfig
│ │ ├── DicConfig.cs
│ │ ├── DicConfigAction.cs
│ │ └── DicConfigBusiness.cs
│ ├── FavoriteProduct
│ │ ├── FavoriteAction.cs
│ │ ├── FavoriteBusiness.cs
│ │ └── FavoriteProduct.cs
│ ├── Freight
│ │ ├── DeliverType.cs
│ │ ├── Freight.cs
│ │ ├── FreightAction.cs
│ │ └── FreightBusiness.cs
│ ├── OnlinePay
│ │ ├── ChargeConfig.cs
│ │ ├── ChargeService.cs
│ │ ├── Company
│ │ │ ├── Alipay
│ │ │ │ ├── AliPay.cs
│ │ │ │ ├── AlipayCompany.cs
│ │ │ │ ├── AlipayCore.cs
│ │ │ │ ├── AlipayMD5.cs
│ │ │ │ ├── AlipayNotify.cs
│ │ │ │ ├── AlipaySubmit.cs
│ │ │ │ └── Config.cs
│ │ │ ├── Bill99
│ │ │ │ ├── Banks.cs
│ │ │ │ ├── Bill99Company.cs
│ │ │ │ ├── Bill99Util.cs
│ │ │ │ ├── ChargeNotify.cs
│ │ │ │ ├── ChargeRequest.cs
│ │ │ │ ├── GetDynNumContent
│ │ │ │ │ ├── Request.cs
│ │ │ │ │ └── Response.cs
│ │ │ │ ├── MessageBase.cs
│ │ │ │ ├── PCIBase.cs
│ │ │ │ ├── PciDataContent
│ │ │ │ │ ├── Request.cs
│ │ │ │ │ └── Response.cs
│ │ │ │ ├── PciQueryContent
│ │ │ │ │ ├── Request.cs
│ │ │ │ │ └── Response.cs
│ │ │ │ └── TxnMsgContent
│ │ │ │ │ ├── Request.cs
│ │ │ │ │ └── Response.cs
│ │ │ ├── ChinaPay
│ │ │ │ ├── CancelTender
│ │ │ │ │ ├── Request.cs
│ │ │ │ │ └── Response.cs
│ │ │ │ ├── Charge
│ │ │ │ │ ├── Request.cs
│ │ │ │ │ └── Response.cs
│ │ │ │ ├── ChinaPayCompany.cs
│ │ │ │ ├── ChinaPayUtil.cs
│ │ │ │ ├── CreateAccount
│ │ │ │ │ ├── Request.cs
│ │ │ │ │ └── Response.cs
│ │ │ │ ├── CreateCompanyAccount
│ │ │ │ │ ├── Request.cs
│ │ │ │ │ └── Response.cs
│ │ │ │ ├── Loan
│ │ │ │ │ ├── Request.cs
│ │ │ │ │ └── Response.cs
│ │ │ │ ├── RSA.cs
│ │ │ │ ├── Repay
│ │ │ │ │ ├── Request.cs
│ │ │ │ │ └── Response.cs
│ │ │ │ ├── RequestBase.cs
│ │ │ │ ├── ResponseBase.cs
│ │ │ │ ├── Tender
│ │ │ │ │ ├── Request.cs
│ │ │ │ │ └── Response.cs
│ │ │ │ ├── TradeQuery
│ │ │ │ │ ├── Request.cs
│ │ │ │ │ └── Response.cs
│ │ │ │ └── UserBalanceQuery
│ │ │ │ │ ├── Request.cs
│ │ │ │ │ ├── Response.cs
│ │ │ │ │ └── UserBalanceQuery.cs
│ │ │ ├── Chinapnr
│ │ │ │ ├── ChargeResponse.cs
│ │ │ │ ├── ChargeSubmit.cs
│ │ │ │ ├── ChinapnrCompany.cs
│ │ │ │ └── MessageBase.cs
│ │ │ ├── CompanyBase.cs
│ │ │ ├── FieldIndexAttribute.cs
│ │ │ ├── Lianlian
│ │ │ │ ├── LianlianCompany.cs
│ │ │ │ ├── LianlianService.cs
│ │ │ │ ├── Md5Algorithm.cs
│ │ │ │ ├── Message
│ │ │ │ │ ├── BankCardQuery.cs
│ │ │ │ │ ├── BankCardQueryResponse.cs
│ │ │ │ │ ├── BindCardQuery.cs
│ │ │ │ │ ├── BindCardQueryResponse.cs
│ │ │ │ │ ├── MessageBase.cs
│ │ │ │ │ ├── OrderQuery.cs
│ │ │ │ │ ├── OrderQueryResponse.cs
│ │ │ │ │ ├── WapAuth
│ │ │ │ │ │ ├── PayNotify.cs
│ │ │ │ │ │ ├── PayRequest.cs
│ │ │ │ │ │ └── PayReturn.cs
│ │ │ │ │ └── Web
│ │ │ │ │ │ ├── PayNotify.cs
│ │ │ │ │ │ ├── PayRequest.cs
│ │ │ │ │ │ └── PayReturn.cs
│ │ │ │ ├── PartnerConfig.cs
│ │ │ │ ├── RSA.cs
│ │ │ │ ├── ResourceConfig.cs
│ │ │ │ ├── ServerURLConfig.cs
│ │ │ │ ├── SignTypeEnum.cs
│ │ │ │ └── YinTongUtil.cs
│ │ │ └── Tenpay
│ │ │ │ ├── TenpayCompany.cs
│ │ │ │ └── tenpay
│ │ │ │ ├── CheckRequestHandler.cs
│ │ │ │ ├── ClientResponseHandler.cs
│ │ │ │ ├── MD5Util.cs
│ │ │ │ ├── RequestHandler.cs
│ │ │ │ ├── ResponseHandler.cs
│ │ │ │ ├── TenpayHttpClient.cs
│ │ │ │ └── TenpayUtil.cs
│ │ ├── CompanyType.cs
│ │ ├── OnlinePayBusiness.cs
│ │ ├── OrderState.cs
│ │ ├── OrderType.cs
│ │ └── PayHistory.cs
│ ├── Order
│ │ ├── Order.cs
│ │ ├── OrderAction.cs
│ │ ├── OrderBusiness.cs
│ │ ├── OrderStatus.cs
│ │ └── ProductOrder
│ │ │ ├── OrderDetail.cs
│ │ │ ├── ProductOrder.cs
│ │ │ ├── ProductOrderAction.cs
│ │ │ ├── ProductOrderBusiness.cs
│ │ │ └── ProductOrderStatus.cs
│ ├── Person
│ │ ├── IMember.cs
│ │ ├── LoginLog.cs
│ │ ├── MobileVerifyData.cs
│ │ ├── Person.cs
│ │ ├── PersonAction.cs
│ │ ├── PersonBusiness.cs
│ │ ├── ShopSupplier.cs
│ │ ├── SmsSendRecord.cs
│ │ └── UserMobileVerify.cs
│ ├── Product
│ │ ├── Product.cs
│ │ ├── ProductAction.cs
│ │ ├── ProductBase.cs
│ │ ├── ProductBusiness.cs
│ │ └── ProductStatus.cs
│ ├── Property
│ │ ├── PropertyBusiness.cs
│ │ ├── PropertyName.cs
│ │ ├── PropertyType.cs
│ │ └── PropertyValue.cs
│ ├── ReceiveAddress
│ │ ├── Address.cs
│ │ ├── AddressAction.cs
│ │ └── AddressBusiness.cs
│ ├── RoleAuthorize
│ │ ├── AccessControl.cs
│ │ ├── AccessControlBusiness.cs
│ │ ├── Department.cs
│ │ ├── DepartmentBusiness.cs
│ │ ├── Employee.cs
│ │ ├── EmployeeBusiness.cs
│ │ ├── Menu.cs
│ │ ├── MenuBusiness.cs
│ │ ├── MenuOperation.cs
│ │ ├── Role.cs
│ │ ├── RoleBusiness.cs
│ │ ├── RoleType.cs
│ │ ├── SystemType.cs
│ │ └── SystemTypeBusiness.cs
│ ├── ShoppingCart
│ │ ├── CartAction.cs
│ │ ├── CartBusiness.cs
│ │ └── CartItem.cs
│ ├── Stock
│ │ ├── StockRecord.cs
│ │ ├── StockRecordBusiness.cs
│ │ └── Style.cs
│ └── TradeType
│ │ ├── TradeDirection.cs
│ │ ├── TradeType.cs
│ │ └── TradeTypeManage.cs
├── CRL2.csproj
├── CacheServer
│ ├── CacheClientProxy.cs
│ ├── CacheServer.cs
│ ├── CacheService.cs
│ ├── Command.cs
│ ├── ResultData.cs
│ ├── TcpPoolClient.cs
│ └── TcpServer.cs
├── CacheServerSetting.cs
├── CallBackDataReader.cs
├── DBAdapter
│ ├── DBAdapterBase.cs
│ ├── MSSQLDBAdapter.cs
│ ├── MySQLDBAdapter.cs
│ └── ORACLEDBAdapter.cs
├── DBExtend
│ ├── DBExtend.cs
│ ├── DBExtendAutoSp.cs
│ ├── DBExtendDelete.cs
│ ├── DBExtendInsert.cs
│ ├── DBExtendQuery.cs
│ ├── DBExtendUpdate.cs
│ ├── DynamicQuery.cs
│ └── FunctionType.cs
├── Dynamic
│ ├── DapperRowMetaObject.cs
│ ├── DynamicObjConvert.cs
│ └── DynamicObject.cs
├── ExistsTableCache.cs
├── ExpressionJoin.cs
├── ExtensionMethod.cs
├── IModelBase.cs
├── IgnoreCaseDictionary.cs
├── LambdaQuery
│ ├── CRLExpression.cs
│ ├── CRLExpressionVisitor.cs
│ ├── Distinct.cs
│ ├── ExpressionVisitor.cs
│ ├── Extensions.cs
│ ├── Group.cs
│ ├── Join.cs
│ ├── JoinExpressionVisitor.cs
│ ├── JoinType.cs
│ ├── LambdaCreater.cs
│ ├── LambdaQuery.cs
│ ├── MethodAnalyze.cs
│ └── ParameterRebinder.cs
├── MemoryDataCache.cs
├── ObjectConvert.cs
├── ParameCollection.cs
├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
├── Resources
│ └── area.txt
├── SettingConfig.cs
├── SummaryAnalysis.cs
├── TypeCache.cs
└── Update.txt
├── CRLWebTest
├── CRLExpressionTest.aspx
├── CRLExpressionTest.aspx.cs
├── CRLExpressionTest.aspx.designer.cs
├── Code
│ ├── AccountManage.cs
│ ├── LocalSqlHelper.cs
│ ├── Member.cs
│ ├── MemberManage.cs
│ ├── ModelTest.cs
│ ├── Order.cs
│ ├── OrderManage.cs
│ ├── ProductData.cs
│ ├── ProductDataManage.cs
│ ├── Setting.cs
│ └── TransactionManage.cs
├── DBConnection
│ ├── Default.config
│ └── Default1.config
├── Default.aspx
├── Default.aspx.cs
├── Default.aspx.designer.cs
├── Global.asax
├── Global.asax.cs
├── Page
│ ├── About.aspx
│ ├── About.aspx.cs
│ ├── About.aspx.designer.cs
│ ├── AutoSp.aspx
│ ├── AutoSp.aspx.cs
│ ├── AutoSp.aspx.designer.cs
│ ├── Cache.aspx
│ ├── Cache.aspx.cs
│ ├── Cache.aspx.designer.cs
│ ├── Cache2.aspx
│ ├── Cache2.aspx.cs
│ ├── Cache2.aspx.designer.cs
│ ├── CacheManage.aspx
│ ├── CacheManage.aspx.cs
│ ├── CacheManage.aspx.designer.cs
│ ├── CacheServer.ashx
│ ├── CacheServer.ashx.cs
│ ├── DataVerification.aspx
│ ├── DataVerification.aspx.cs
│ ├── DataVerification.aspx.designer.cs
│ ├── Delete.aspx
│ ├── Delete.aspx.cs
│ ├── Delete.aspx.designer.cs
│ ├── ExportAndImport.aspx
│ ├── ExportAndImport.aspx.cs
│ ├── ExportAndImport.aspx.designer.cs
│ ├── ExportModelInfo.aspx
│ ├── ExportModelInfo.aspx.cs
│ ├── ExportModelInfo.aspx.designer.cs
│ ├── ExtensionMethod.aspx
│ ├── ExtensionMethod.aspx.cs
│ ├── ExtensionMethod.aspx.designer.cs
│ ├── Insert.aspx
│ ├── Insert.aspx.cs
│ ├── Insert.aspx.designer.cs
│ ├── Model.aspx
│ ├── Model.aspx.cs
│ ├── Model.aspx.designer.cs
│ ├── OrderTest.aspx
│ ├── OrderTest.aspx.cs
│ ├── OrderTest.aspx.designer.cs
│ ├── Pager.aspx
│ ├── Pager.aspx.cs
│ ├── Pager.aspx.designer.cs
│ ├── Query1.aspx
│ ├── Query1.aspx.cs
│ ├── Query1.aspx.designer.cs
│ ├── Query2.aspx
│ ├── Query2.aspx.cs
│ ├── Query2.aspx.designer.cs
│ ├── Query3.aspx
│ ├── Query3.aspx.cs
│ ├── Query3.aspx.designer.cs
│ ├── SqlTransaction.aspx
│ ├── SqlTransaction.aspx.cs
│ ├── SqlTransaction.aspx.designer.cs
│ ├── Synchronous.aspx
│ ├── Synchronous.aspx.cs
│ ├── Synchronous.aspx.designer.cs
│ ├── Update.aspx
│ ├── Update.aspx.cs
│ ├── Update.aspx.designer.cs
│ ├── UserTransactionTest.aspx
│ ├── UserTransactionTest.aspx.cs
│ ├── UserTransactionTest.aspx.designer.cs
│ ├── test.aspx
│ ├── test.aspx.cs
│ ├── test.aspx.designer.cs
│ └── xml.png
├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ └── Resources.resx
├── Resources
│ ├── sp_ExecuteScript_ORACLE.sql
│ ├── sp_page_MSSql.sql
│ ├── sp_page_MySql.sql
│ └── sp_page_ORACLE.sql
├── Site1.Master
├── Site1.Master.cs
├── Site1.Master.designer.cs
├── TableCache.config
├── Update.txt
├── Web.config
├── WebTest.2010.sln
├── WebTest.csproj
├── WebTest.publish.csproj
├── config
│ └── CustomSetting.config
├── css
│ ├── bootstrap-responsive.css
│ ├── bootstrap-responsive.min.css
│ ├── bootstrap.css
│ └── bootstrap.min.css
├── data.xml
├── img
│ ├── cache.png
│ ├── cache2.png
│ ├── glyphicons-halflings-white.png
│ ├── glyphicons-halflings.png
│ └── model.png
├── js
│ ├── bootstrap.js
│ ├── bootstrap.min.js
│ └── jquery-1.9.1.min.js
├── log
│ ├── 100
│ │ ├── 2015-07-02.DataCache.txt
│ │ └── 2015-07-02.txt
│ ├── 107
│ │ ├── 2015-05-13.DataCache.txt
│ │ ├── 2015-05-13.DbError.txt
│ │ ├── 2015-05-13.Error.txt
│ │ ├── 2015-05-13.socket.txt
│ │ ├── 2015-05-13.txt
│ │ ├── 2015-05-14.DataCache.txt
│ │ ├── 2015-05-14.socket.txt
│ │ ├── 2015-05-14.txt
│ │ ├── 2015-05-18.DataCache.txt
│ │ ├── 2015-05-18.txt
│ │ └── 2015-06-04.txt
│ ├── 111
│ │ └── 2015-04-14.txt
│ ├── 116
│ │ ├── 2015-04-21.DataCache.txt
│ │ ├── 2015-04-21.txt
│ │ ├── 2015-04-22.txt
│ │ ├── 2015-04-23.DataCache.txt
│ │ ├── 2015-04-23.txt
│ │ ├── 2015-04-24.DataCache.txt
│ │ ├── 2015-04-24.txt
│ │ ├── 2015-04-27.DataCache.txt
│ │ ├── 2015-04-27.socket.txt
│ │ ├── 2015-04-27.txt
│ │ ├── 2015-05-04.DataCache.txt
│ │ ├── 2015-05-04.txt
│ │ ├── 2015-05-06.DataCache.txt
│ │ ├── 2015-05-06.txt
│ │ ├── 2015-05-08.DbError.txt
│ │ ├── 2015-05-08.txt
│ │ ├── 2015-05-11.txt
│ │ ├── 2015-05-12.DataCache.txt
│ │ └── 2015-05-12.txt
│ ├── 2015-05-13.txt
│ └── 2015-05-14.txt
├── modelProductData.html
├── pay.aspx
├── pay.aspx.cs
├── pay.aspx.designer.cs
└── ref
│ ├── CRL.XML
│ ├── CRL.dll
│ ├── CoreHelper.dll
│ ├── CoreHelper.xml
│ ├── MySql.Data.dll
│ └── Quartz.dll
├── FormTest
├── Code
│ ├── CacheTest.cs
│ ├── ITest.cs
│ ├── LocalSqlHelper.cs
│ ├── MultiThreadTest.cs
│ ├── ProductData.cs
│ └── ProductDataManage.cs
├── Form1.Designer.cs
├── Form1.cs
├── Form1.resx
├── FormTest.csproj
├── Program.cs
├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
├── ThreadForm.Designer.cs
├── ThreadForm.cs
└── ThreadForm.resx
├── README.md
├── Untitled Diagram.drawio
└── ref
├── CoreHelper.dll
├── CoreHelper.xml
├── Enyim.Caching.dll
├── Enyim.Caching.xml
├── MemcachedProviders.dll
├── Newtonsoft.Json.dll
└── log4net.dll
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto
3 |
4 | # Custom for Visual Studio
5 | *.cs diff=csharp
6 |
7 | # Standard to msysgit
8 | *.doc diff=astextplain
9 | *.DOC diff=astextplain
10 | *.docx diff=astextplain
11 | *.DOCX diff=astextplain
12 | *.dot diff=astextplain
13 | *.DOT diff=astextplain
14 | *.pdf diff=astextplain
15 | *.PDF diff=astextplain
16 | *.rtf diff=astextplain
17 | *.RTF diff=astextplain
18 |
--------------------------------------------------------------------------------
/CRL2/Attribute/FieldIndexType.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace CRL.Attribute
7 | {
8 | ///
9 | /// 索引类型
10 | ///
11 | public enum FieldIndexType
12 | {
13 | ///
14 | /// 无
15 | ///
16 | 无,
17 | ///
18 | /// 非聚集
19 | ///
20 | 非聚集,
21 | ///
22 | /// 非聚集唯一
23 | ///
24 | 非聚集唯一
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/CRL2/Attribute/FieldType.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace CRL.Attribute
7 | {
8 | ///
9 | /// 字段类型
10 | ///
11 | public enum FieldType
12 | {
13 | NONE,
14 | 数据库字段,
15 | 虚拟字段,
16 | 关联字段,
17 | 关联对象
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/CRL2/Attribute/ModelProxyAttribute.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace CRL.Attribute
7 | {
8 | public class ModelProxyAttribute : System.Runtime.Remoting.Proxies.ProxyAttribute
9 | {
10 | public override MarshalByRefObject CreateInstance(Type serverType)
11 | {
12 | AopProxy realProxy = new AopProxy(serverType);
13 | if (!SettingConfig.UseAopProxy)
14 | {
15 | SettingConfig.UseAopProxy = true;
16 | }
17 | return realProxy.GetTransparentProxy() as MarshalByRefObject;
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/CRL2/Attribute/TableAttribute.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Linq.Expressions;
6 | using System.Runtime.Remoting.Messaging;
7 |
8 | namespace CRL.Attribute
9 | {
10 |
11 | [AttributeUsage(AttributeTargets.Class)]
12 | public class TableAttribute : System.Attribute
13 | {
14 | public override string ToString()
15 | {
16 | return TableName;
17 | }
18 | ///
19 | /// 表名
20 | ///
21 | public string TableName
22 | {
23 | get;
24 | set;
25 | }
26 | ///
27 | /// 默认排序
28 | ///
29 | public string DefaultSort
30 | {
31 | get;
32 | set;
33 | }
34 | ///
35 | /// 自增主键
36 | ///
37 | internal FieldAttribute PrimaryKey
38 | {
39 | get;
40 | set;
41 | }
42 | ///
43 | /// 对象类型
44 | ///
45 | public Type Type;
46 | DBAdapter.DBAdapterBase _DBAdapter;
47 | ///
48 | /// 当前数据库适配器
49 | ///
50 | internal DBAdapter.DBAdapterBase DBAdapter
51 | {
52 | get
53 | {
54 | if (_DBAdapter == null)
55 | {
56 | //throw new Exception("dBAdapter尚未初始化");
57 | }
58 | return _DBAdapter;
59 | }
60 | set
61 | {
62 | _DBAdapter = value;
63 | }
64 | }
65 | ///
66 | /// 所有字段
67 | ///
68 | internal List Fields = new List();
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/CRL2/Business/Account/Model/AccountDetail.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace CRL.Account
7 | {
8 | public sealed class IAccountDetail : AccountDetail
9 | {
10 | }
11 | ///
12 | /// 帐户信息 不可继承
13 | ///
14 | [Attribute.Table(TableName = "AccountInfo")]
15 | public class AccountDetail : IModelBase
16 | {
17 | ///
18 | /// 帐号类型
19 | /// 用以区分不同业务的帐号
20 | /// 如,商家,会员
21 | ///
22 | [Attribute.Field(FieldIndexType = Attribute.FieldIndexType.非聚集)]
23 | public int AccountType
24 | {
25 | get;
26 | set;
27 | }
28 | ///
29 | /// 对应的帐号
30 | ///
31 | [Attribute.Field(FieldIndexType = Attribute.FieldIndexType.非聚集)]
32 | public string Account
33 | {
34 | get;
35 | set;
36 | }
37 | ///
38 | /// 流水种类
39 | ///
40 | [Attribute.Field(FieldIndexType = Attribute.FieldIndexType.非聚集)]
41 | public int TransactionType
42 | {
43 | get;
44 | set;
45 | }
46 | ///
47 | /// 锁定金额
48 | ///
49 | public decimal LockedAmount
50 | {
51 | get;
52 | set;
53 | }
54 | ///
55 | /// 当前金额
56 | ///
57 | public decimal CurrentBalance
58 | {
59 | get;
60 | set;
61 | }
62 | ///
63 | /// 可用余额
64 | ///
65 | public decimal AvailableBalance
66 | {
67 | get
68 | {
69 | return CurrentBalance - LockedAmount;
70 | }
71 | }
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/CRL2/Business/Account/Model/LockRecord.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace CRL.Account
7 | {
8 | public class ILockRecord : LockRecord
9 | {
10 |
11 | }
12 | ///
13 | /// 锁定记录
14 | ///
15 | [Attribute.Table(TableName = "LockRecord")]
16 | public class LockRecord : IModelBase
17 | {
18 | public override string CheckData()
19 | {
20 | return "";
21 | }
22 | public int AccountId
23 | {
24 | get;
25 | set;
26 | }
27 | public decimal Amount
28 | {
29 | get;
30 | set;
31 | }
32 | [Attribute.Field(Length = 500)]
33 | public string Remark
34 | {
35 | get;
36 | set;
37 | }
38 | ///
39 | /// 是否处理过
40 | ///
41 | public bool Checked
42 | {
43 | get;
44 | set;
45 | }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/CRL2/Business/Account/Model/OperateType.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using CoreHelper;
6 | namespace CRL.Account
7 | {
8 | ///
9 | /// 操作类型
10 | ///
11 | public enum OperateType
12 | {
13 | ///
14 | /// 收入
15 | ///
16 | [ItemDisc("收入")]
17 | 收入 = 1,
18 | ///
19 | /// 支出
20 | ///
21 | [ItemDisc("支出")]
22 | 支出 = 2
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/CRL2/Business/Account/TransactionType.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace CRL.Account
7 | {
8 | ///
9 | /// 流水类型
10 | ///
11 | public enum TransactionType1
12 | {
13 | 钱,
14 | 积分
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/CRL2/Business/Area/Area.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace CRL.Area
7 | {
8 | public class IArea : Area
9 | {
10 | }
11 | ///
12 | /// 区域
13 | ///
14 | public class Area
15 | {
16 | public string Code
17 | {
18 | get;
19 | set;
20 | }
21 | ///
22 | /// 父ID
23 | ///
24 | public string ParentCode
25 | {
26 | get;
27 | set;
28 | }
29 | public int Level
30 | {
31 | get;
32 | set;
33 | }
34 | public string Name
35 | {
36 | get;
37 | set;
38 | }
39 | public override string ToString()
40 | {
41 | return Name;
42 | }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/CRL2/Business/Article/ArticleAction.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Data;
6 | using System.Reflection;
7 |
8 | namespace CRL.Article
9 | {
10 | ///
11 | /// 文章内容维护
12 | ///
13 | public class ArticleAction : BaseAction where TType : class
14 | {
15 |
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/CRL2/Business/Article/ArticleBusiness.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace CRL.Article
7 | {
8 | public class ArticleBusiness : BaseProvider
9 | where TType : class
10 | where TModel : Article, new()
11 | {
12 | protected override DBExtend dbHelper
13 | {
14 | get { return GetDbHelper(); }
15 | }
16 |
17 | //public static ArticleBusiness Instance
18 | //{
19 | // get { return new ArticleBusiness(); }
20 | //}
21 |
22 |
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/CRL2/Business/Category/Category.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace CRL.Category
7 | {
8 | public class ICategory : Category
9 | {
10 | }
11 | ///
12 | /// 分类,由于缓存,只能实现一种类型,不要继承此类实现多个实例
13 | ///
14 | [Attribute.Table(TableName = "Category")]
15 | public class Category : IModelBase
16 | {
17 | public override string CheckData()
18 | {
19 | return "";
20 | }
21 | ///
22 | /// 类型,以作不同用途
23 | ///
24 | public int DataType
25 | {
26 | get;
27 | set;
28 | }
29 | public string Name
30 | {
31 | get;
32 | set;
33 | }
34 | public string SequenceCode
35 | {
36 | get;
37 | set;
38 | }
39 | public string ParentCode
40 | {
41 | get;
42 | set;
43 | }
44 | public string Remark
45 | {
46 | get;
47 | set;
48 | }
49 | ///
50 | /// 是否禁用
51 | ///
52 | public bool Disable
53 | {
54 | get;
55 | set;
56 | }
57 | public int Sort
58 | {
59 | get;
60 | set;
61 | }
62 | public override string ToString()
63 | {
64 | return Name;
65 | }
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/CRL2/Business/Comment/Comment.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace CRL.Comment
7 | {
8 | public class IComment : Comment
9 | {
10 | }
11 | ///
12 | /// 评论
13 | ///
14 | [Attribute.Table(TableName = "Comment")]
15 | public class Comment : IModelBase
16 | {
17 | public override string CheckData()
18 | {
19 | return "";
20 | }
21 | [Attribute.Field(FieldIndexType = Attribute.FieldIndexType.非聚集)]
22 | public string UserId
23 | {
24 | get;
25 | set;
26 | }
27 | public string Author
28 | {
29 | get;
30 | set;
31 | }
32 | ///
33 | /// 源对象ID
34 | ///
35 | [Attribute.Field(FieldIndexType = Attribute.FieldIndexType.非聚集)]
36 | public int ObjId
37 | {
38 | get;
39 | set;
40 | }
41 | public int Type
42 | {
43 | get;
44 | set;
45 | }
46 | public string Title
47 | {
48 | get;
49 | set;
50 | }
51 | public string IP
52 | {
53 | get;
54 | set;
55 | }
56 | ///
57 | /// 评级
58 | ///
59 | public int Rating
60 | {
61 | get;
62 | set;
63 | }
64 | [Attribute.Field(Length = 500)]
65 | public string Content
66 | {
67 | get;
68 | set;
69 | }
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/CRL2/Business/Comment/CommentAction.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace CRL.Comment
7 | {
8 | ///
9 | /// 评论维护
10 | ///
11 | public class CommentAction : BaseAction where TType : class
12 | {
13 | ///
14 | /// 查询指定项目的评论
15 | ///
16 | ///
17 | ///
18 | ///
19 | ///
20 | ///
21 | ///
22 | ///
23 | ///
24 | ///
25 | public static List QueryObjComment(int type,bool _checked, int objId, string userId, int pageIndex, int pageSize, out int count) where TItem : IComment, new()
26 | {
27 | DBExtend helper = dbHelper;
28 | ParameCollection c = new ParameCollection();
29 | c.SetQueryPageIndex(pageIndex);
30 | c.SetQueryPageSize(pageSize);
31 | string where = "type=" + type + " and objId=" + objId + " and checked=" + Convert.ToInt32(_checked);
32 | if (!string.IsNullOrEmpty(userId))
33 | {
34 | where += " and userId=" + userId;
35 | }
36 | c.SetQueryCondition(where);
37 | c.SetQuerySortField("id");
38 | c.SetQuerySortDesc(true);
39 | return QueryListByPage(c, out count);
40 | }
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/CRL2/Business/Comment/CommentBusiness.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace CRL.Comment
7 | {
8 | ///
9 | /// 评论维护
10 | ///
11 | public class CommentBusiness : BaseProvider
12 | where TType : class
13 | where TModel : Comment, new()
14 | {
15 | public static CommentBusiness Instance
16 | {
17 | get { return new CommentBusiness(); }
18 | }
19 | protected override DBExtend dbHelper
20 | {
21 | get { return GetDbHelper(); }
22 | }
23 | ///
24 | /// 查询指定项目的评论
25 | ///
26 | ///
27 | ///
28 | ///
29 | ///
30 | ///
31 | ///
32 | ///
33 | ///
34 | ///
35 | public List QueryObjComment(int type, bool _checked, int objId, string userId, int pageIndex, int pageSize, out int count)
36 | {
37 | ParameCollection c = new ParameCollection();
38 | c.SetQueryPageIndex(pageIndex);
39 | c.SetQueryPageSize(pageSize);
40 | string where = "type=" + type + " and objId=" + objId + " and checked=" + Convert.ToInt32(_checked);
41 | if (!string.IsNullOrEmpty(userId))
42 | {
43 | where += " and userId=" + userId;
44 | }
45 | c.SetQueryCondition(where);
46 | c.SetQuerySort("id desc");
47 | return QueryListByPage(c, out count);
48 | }
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/CRL2/Business/DicConfig/DicConfig.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace CRL.DicConfig
7 | {
8 | public class IDicConfig : DicConfig
9 | {
10 | }
11 | ///
12 | /// 字典配置,用来保存固定值或动态值
13 | /// 不要继承
14 | ///
15 | [Attribute.Table(TableName = "DicConfig")]
16 | public class DicConfig : IModelBase
17 | {
18 | public override string CheckData()
19 | {
20 | return "";
21 | }
22 |
23 | ///
24 | /// 类型
25 | ///
26 | [Attribute.Field(FieldIndexType= Attribute.FieldIndexType.非聚集,NotNull=true)]
27 | public string DicType
28 | {
29 | get;
30 | set;
31 | }
32 |
33 | ///
34 | /// 名称
35 | ///
36 | [Attribute.Field(FieldIndexType= Attribute.FieldIndexType.非聚集,NotNull = true)]
37 | public string Name
38 | {
39 | get;
40 | set;
41 | }
42 | [Attribute.Field(Length = 200, NotNull = true)]
43 | ///
44 | /// 值
45 | ///
46 | public string Value
47 | {
48 | get;
49 | set;
50 | }
51 | public string Remark
52 | {
53 | get;
54 | set;
55 | }
56 | ///
57 | /// 是否能更改值
58 | ///
59 | public bool CanChange
60 | {
61 | get;
62 | set;
63 | }
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/CRL2/Business/FavoriteProduct/FavoriteBusiness.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace CRL.FavoriteProduct
7 | {
8 | ///
9 | /// 商品收藏
10 | ///
11 | public class FavoriteBusiness : BaseProvider
12 | where TType : class
13 | where TModel : FavoriteProduct,new()
14 | {
15 | public static FavoriteBusiness Instance
16 | {
17 | get { return new FavoriteBusiness(); }
18 | }
19 | protected override DBExtend dbHelper
20 | {
21 | get { return GetDbHelper(); }
22 | }
23 | ///
24 | /// 添加到收藏
25 | ///
26 | ///
27 | ///
28 | public void AddToFavorite(TModel product)
29 | {
30 | //Delete(b => b.UserId == product.UserId && b.ProductId == product.ProductId);
31 | if (QueryItem(b => b.UserId == product.UserId && b.ProductId == product.ProductId) == null)
32 | {
33 | Add(product);
34 | }
35 | }
36 |
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/CRL2/Business/FavoriteProduct/FavoriteProduct.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace CRL.FavoriteProduct
7 | {
8 | public class IFavoriteProduct : FavoriteProduct
9 | {
10 | }
11 | [Attribute.Table(TableName = "FavoriteProduct")]
12 | public class FavoriteProduct:IModelBase
13 | {
14 | public override string CheckData()
15 | {
16 | return "";
17 | }
18 | ///
19 | /// 会员号
20 | ///
21 | [Attribute.Field(FieldIndexType = Attribute.FieldIndexType.非聚集)]
22 | public string UserId
23 | {
24 | get;
25 | set;
26 | }
27 | ///
28 | /// 产品编号
29 | ///
30 | public int ProductId
31 | {
32 | get;
33 | set;
34 | }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/CRL2/Business/Freight/DeliverType.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace CRL.Freight
7 | {
8 | ///
9 | /// 送货方式
10 | ///
11 | public enum DeliverType
12 | {
13 | 物流 = 0,
14 | 快递 = 1
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/CRL2/Business/OnlinePay/Company/Alipay/AlipayMD5.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Security.Cryptography;
6 |
7 | namespace CRL.Business.OnlinePay.Company.Alipay
8 | {
9 | public sealed class AlipayMD5
10 | {
11 |
12 | ///
13 | /// 签名字符串
14 | ///
15 | /// 需要签名的字符串
16 | /// 密钥
17 | /// 编码格式
18 | /// 签名结果
19 | public static string Sign(string prestr, string key, string _input_charset)
20 | {
21 | StringBuilder sb = new StringBuilder(32);
22 |
23 | prestr = prestr + key;
24 |
25 | MD5 md5 = new MD5CryptoServiceProvider();
26 | byte[] t = md5.ComputeHash(Encoding.GetEncoding(_input_charset).GetBytes(prestr));
27 | for (int i = 0; i < t.Length; i++)
28 | {
29 | sb.Append(t[i].ToString("x").PadLeft(2, '0'));
30 | }
31 |
32 | return sb.ToString();
33 | }
34 |
35 | ///
36 | /// 验证签名
37 | ///
38 | /// 需要签名的字符串
39 | /// 签名结果
40 | /// 密钥
41 | /// 编码格式
42 | /// 验证结果
43 | public static bool Verify(string prestr, string sign, string key, string _input_charset)
44 | {
45 | string mysign = Sign(prestr, key, _input_charset);
46 | if (mysign == sign)
47 | {
48 | return true;
49 | }
50 | else
51 | {
52 | return false;
53 | }
54 | }
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/CRL2/Business/OnlinePay/Company/Alipay/Config.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace CRL.Business.OnlinePay.Company.Alipay
7 | {
8 | public class Config
9 | {
10 | public static string Partner
11 | {
12 | get
13 | {
14 | return ChargeConfig.GetConfigKey(CompanyType.支付宝, ChargeConfig.DataType.User);
15 | }
16 | }
17 |
18 | public static string Key
19 | {
20 | get
21 | {
22 | return ChargeConfig.GetConfigKey(CompanyType.支付宝, ChargeConfig.DataType.Key);
23 | }
24 | }
25 | public static string Input_charset = ChargeConfig.Charset;
26 | public static string Sign_type = "MD5";
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/CRL2/Business/OnlinePay/Company/Bill99/GetDynNumContent/Request.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace CRL.Business.OnlinePay.Company.Bill99.GetDynNumContent
7 | {
8 | //动态鉴权
9 | public class Request : PCIBase
10 | {
11 | public override string InterfacePath
12 | {
13 | get
14 | {
15 | return "/cnp/getDynNum";
16 | }
17 | }
18 | ///
19 | /// 外部跟踪编号
20 | ///
21 | public string externalRefNumber;
22 | ///
23 | /// 银行代码
24 | ///
25 | public string bankId;
26 | ///
27 | /// 金额
28 | ///
29 | public string amount;
30 |
31 | #region 第二次时不需要传
32 | ///
33 | /// 持卡人姓名
34 | ///
35 | public string cardHolderName;
36 | ///
37 | /// 证件类型
38 | ///
39 | public string idType;
40 | ///
41 | /// 持卡人身份证号
42 | ///
43 | public string cardHolderId;
44 | ///
45 | /// 卡号
46 | ///
47 | public string pan;
48 | ///
49 | /// 卡效期
50 | ///
51 | public string expiredDate;
52 | ///
53 | /// 电话
54 | ///
55 | public string phoneNO;
56 | ///
57 | /// 卡验证码
58 | ///
59 | public string cvv2;
60 | #endregion
61 |
62 | ///
63 | /// 缩略卡号 卡的前6后4
64 | ///
65 | public string storablePan;
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/CRL2/Business/OnlinePay/Company/Bill99/GetDynNumContent/Response.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Xml;
6 |
7 | namespace CRL.Business.OnlinePay.Company.Bill99.GetDynNumContent
8 | {
9 | public class Response:PCIBase
10 | {
11 | ///
12 | /// 令牌号
13 | ///
14 | public string token;
15 | public static Response FromXml(XmlDocument xmlDoc)
16 | {
17 | var obj = new Response();
18 | obj.customerId = xmlDoc.SelectSingleNode("MasMessage/GetDynNumContent/customerId").InnerText;
19 | obj.token = xmlDoc.SelectSingleNode("MasMessage/GetDynNumContent/token").InnerText;
20 | obj.responseCode = xmlDoc.SelectSingleNode("MasMessage/GetDynNumContent/responseCode").InnerText;
21 | return obj;
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/CRL2/Business/OnlinePay/Company/Bill99/PciDataContent/Request.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace CRL.Business.OnlinePay.Company.Bill99.PciDataContent
7 | {
8 | //PCI存储
9 | public class Request : PCIBase
10 | {
11 | public override string InterfacePath
12 | {
13 | get
14 | {
15 | return "/cnp/pci_store";
16 | }
17 | }
18 | ///
19 | /// 持卡人姓名
20 | ///
21 | public string cardHolderName;
22 | ///
23 | /// 证件类型
24 | ///
25 | public string idType;
26 | ///
27 | /// 持卡人证件号码
28 | ///
29 | public string cardHolderId;
30 | ///
31 | /// //卡号
32 | ///
33 | public string pan;
34 | ///
35 | /// 银行代码
36 | ///
37 | public string bankId;
38 | ///
39 | /// 卡有效期
40 | ///
41 | public string expiredDate;
42 | ///
43 | /// 手机号码
44 | ///
45 | public string phoneNO;
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/CRL2/Business/OnlinePay/Company/Bill99/PciDataContent/Response.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Xml;
6 |
7 | namespace CRL.Business.OnlinePay.Company.Bill99.PciDataContent
8 | {
9 | public class Response : PCIBase
10 | {
11 | ///
12 | /// 缩略卡号
13 | ///
14 | public string storablePan;
15 | public static Response FromXml(XmlDocument xmlDoc)
16 | {
17 | var obj = new Response();
18 | obj.customerId = xmlDoc.SelectSingleNode("MasMessage/PciDataContent/customerId").InnerText;
19 | obj.storablePan = xmlDoc.SelectSingleNode("MasMessage/PciDataContent/storablePan").InnerText;
20 | obj.responseCode = xmlDoc.SelectSingleNode("MasMessage/PciDataContent/responseCode").InnerText;
21 | return obj;
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/CRL2/Business/OnlinePay/Company/Bill99/PciQueryContent/Request.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace CRL.Business.OnlinePay.Company.Bill99.PciQueryContent
7 | {
8 | //PCI查询
9 | public class Request : PCIBase
10 | {
11 | public override string InterfacePath
12 | {
13 | get
14 | {
15 | return "/cnp/pci_querys";
16 | }
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/CRL2/Business/OnlinePay/Company/Bill99/PciQueryContent/Response.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Xml;
6 |
7 | namespace CRL.Business.OnlinePay.Company.Bill99.PciQueryContent
8 | {
9 | public class Response : PCIBase
10 | {
11 | ///
12 | /// 卡类型
13 | ///
14 | public string cardType;
15 | ///
16 | /// 银行代码
17 | ///
18 | public string bankId;
19 | ///
20 | /// 缩略卡号
21 | ///
22 | public string storablePan;
23 | ///
24 | /// 手机号
25 | ///
26 | public string phoneNO;
27 | public static Response FromXml(XmlDocument xmlDoc)
28 | {
29 | var obj = new Response();
30 | obj.customerId = xmlDoc.SelectSingleNode("MasMessage/PciQueryContent/customerId").InnerText;
31 | obj.cardType = xmlDoc.SelectSingleNode("MasMessage/PciQueryContent/cardType").InnerText;
32 | obj.responseCode = xmlDoc.SelectSingleNode("MasMessage/PciQueryContent/responseCode").InnerText;
33 | obj.bankId = xmlDoc.SelectSingleNode("MasMessage/PciQueryContent/pciInfos/pciInfo/bankId").InnerText;
34 | obj.storablePan = xmlDoc.SelectSingleNode("MasMessage/PciQueryContent/pciInfos/pciInfo/storablePan").InnerText;
35 | obj.phoneNO = xmlDoc.SelectSingleNode("MasMessage/PciQueryContent/pciInfos/pciInfo/phoneNO").InnerText;
36 | return obj;
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/CRL2/Business/OnlinePay/Company/ChinaPay/CancelTender/Response.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace CRL.Business.OnlinePay.Company.ChinaPay.CancelTender
7 | {
8 | public class Response : ResponseBase
9 | {
10 | public override string ResponseName
11 | {
12 | get { return "C101TenderCancelRs"; }
13 | }
14 | ///
15 | /// 投标订单号
16 | ///
17 | public string OrderNo
18 | {
19 | get;
20 | set;
21 | }
22 | ///
23 | /// 标的号
24 | ///
25 | public string SubjectNo
26 | {
27 | get;
28 | set;
29 | }
30 | ///
31 | /// 投资人用户号
32 | ///
33 | public string PyrUserId
34 | {
35 | get;
36 | set;
37 | }
38 | ///
39 | /// 借款人用户号
40 | ///
41 | public string PyeUserId
42 | {
43 | get;
44 | set;
45 | }
46 | ///
47 | /// 币种
48 | ///
49 | public string CurCode
50 | {
51 | get;
52 | set;
53 | }
54 | ///
55 | /// 投标金额
56 | ///
57 | public string PyrAmt
58 | {
59 | get;
60 | set;
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/CRL2/Business/OnlinePay/Company/ChinaPay/Charge/Response.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace CRL.Business.OnlinePay.Company.ChinaPay.Charge
7 | {
8 | public class Response:ResponseBase
9 | {
10 | public override string ResponseName
11 | {
12 | get { return "C101RechargeCbRq"; }
13 | }
14 | ///
15 | /// 商户私有域
16 | ///
17 | public string MerPriv
18 | {
19 | get;
20 | set;
21 | }
22 | ///
23 | /// 扩展域
24 | ///
25 | public string Reserved
26 | {
27 | get;
28 | set;
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/CRL2/Business/OnlinePay/Company/ChinaPay/Loan/Response.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace CRL.Business.OnlinePay.Company.ChinaPay.Loan
7 | {
8 | public class Response : ResponseBase
9 | {
10 | public override string ResponseName
11 | {
12 | get { return "C101LoanRs"; }
13 | }
14 | ///
15 | /// 投标订单号
16 | ///
17 | public string OrderNo
18 | {
19 | get;
20 | set;
21 | }
22 | ///
23 | /// 标的号
24 | ///
25 | public string SubjectNo
26 | {
27 | get;
28 | set;
29 | }
30 | ///
31 | /// 投资人用户号
32 | ///
33 | public string PyrUserId
34 | {
35 | get;
36 | set;
37 | }
38 | ///
39 | /// 借款人用户号
40 | ///
41 | public string PyeUserId
42 | {
43 | get;
44 | set;
45 | }
46 | ///
47 | /// 币种
48 | ///
49 | public string CurCode
50 | {
51 | get;
52 | set;
53 | }
54 | ///
55 | /// 投资金额
56 | ///
57 | public string PyrAmt
58 | {
59 | get;
60 | set;
61 | }
62 | ///
63 | /// 扩展域
64 | ///
65 | public string Reserved
66 | {
67 | get;
68 | set;
69 | }
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/CRL2/Business/OnlinePay/Company/ChinaPay/Repay/Response.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace CRL.Business.OnlinePay.Company.ChinaPay.Repay
7 | {
8 | public class Response:ResponseBase
9 | {
10 | public override string ResponseName
11 | {
12 | get { return "C101RepayRs"; }
13 | }
14 | ///
15 | /// 投标订单号
16 | ///
17 | public string OrgOrderNo
18 | {
19 | get;
20 | set;
21 | }
22 | ///
23 | /// 标的号
24 | ///
25 | public string SubjectNo
26 | {
27 | get;
28 | set;
29 | }
30 | ///
31 | /// 还款人用户号
32 | ///
33 | public string PyrUserId
34 | {
35 | get;
36 | set;
37 | }
38 | ///
39 | /// 投资人用户号
40 | ///
41 | public string PyeUserId
42 | {
43 | get;
44 | set;
45 | }
46 | ///
47 | /// 币种
48 | ///
49 | public string CurCode
50 | {
51 | get;
52 | set;
53 | }
54 | ///
55 | /// 还款金额
56 | ///
57 | public string PyrAmt
58 | {
59 | get;
60 | set;
61 | }
62 | ///
63 | /// 扩展域
64 | ///
65 | public string Reserved
66 | {
67 | get;
68 | set;
69 | }
70 |
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/CRL2/Business/OnlinePay/Company/ChinaPay/TradeQuery/Request.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace CRL.Business.OnlinePay.Company.ChinaPay.TradeQuery
7 | {
8 | ///
9 | /// 交易查询
10 | ///
11 | public class Request:RequestBase
12 | {
13 | protected override string Host
14 | {
15 | get
16 | {
17 | return "http://210.22.91.77:8404/channel";
18 | }
19 | }
20 | protected override string InterfacePath
21 | {
22 | get { return "/Business/EasMerchant/" + RequestName; }
23 | }
24 |
25 | public override string MessageCode
26 | {
27 | get { return "201814"; }
28 | }
29 |
30 | public override string RequestName
31 | {
32 | get { return "A101TranStaInqRq"; }
33 | }
34 | ///
35 | /// 原交易请求流水号
36 | ///
37 | public string OrgSrcReqId
38 | {
39 | get;
40 | set;
41 | }
42 | ///
43 | /// 原交易系统日期
44 | ///
45 | public string OrgSrcReqDate
46 | {
47 | get;
48 | set;
49 | }
50 | ///
51 | /// 原交易类型
52 | ///
53 | public string OrgTxnType
54 | {
55 | get;
56 | set;
57 | }
58 | ///
59 | /// 扩展域
60 | ///
61 | public string Reserved
62 | {
63 | get;
64 | set;
65 | }
66 |
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/CRL2/Business/OnlinePay/Company/ChinaPay/TradeQuery/Response.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace CRL.Business.OnlinePay.Company.ChinaPay.TradeQuery
7 | {
8 | public class Response : ResponseBase
9 | {
10 | public override string ResponseName
11 | {
12 | get { return "A101TranStaInqRs"; }
13 | }
14 | ///
15 | /// 原交易请求流水号
16 | ///
17 | public string OrgSrcReqId
18 | {
19 | get;
20 | set;
21 | }
22 | ///
23 | /// 原交易系统日期
24 | ///
25 | public string OrgSrcReqDate
26 | {
27 | get;
28 | set;
29 | }
30 | ///
31 | /// 交易状态 00 交易成功 01 交易不存在 02 交易失败
32 | ///
33 | public string Status
34 | {
35 | get;
36 | set;
37 | }
38 | ///
39 | /// 失败原因
40 | ///
41 | public string ReturnMsg
42 | {
43 | get;
44 | set;
45 | }
46 | ///
47 | /// 订单号
48 | ///
49 | public string OrgOrderNo
50 | {
51 | get;
52 | set;
53 | }
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/CRL2/Business/OnlinePay/Company/ChinaPay/UserBalanceQuery/Request.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace CRL.Business.OnlinePay.Company.ChinaPay.UserBalanceQuery
7 | {
8 | ///
9 | /// 查询用户余额
10 | ///
11 | public class Request : RequestBase
12 | {
13 | protected override string Host
14 | {
15 | get
16 | {
17 | return "http://210.22.91.77:8404/channel";
18 | }
19 | }
20 | protected override string InterfacePath
21 | {
22 | get { return "/Business/EasMerchant/" + RequestName; }
23 | }
24 |
25 | public override string MessageCode
26 | {
27 | get { return "201811"; }
28 | }
29 |
30 | public override string RequestName
31 | {
32 | get { return "A101AcctBalInqRq"; }
33 | }
34 | ///
35 | /// 用户号
36 | ///
37 | public string UserId
38 | {
39 | get;
40 | set;
41 | }
42 | ///
43 | /// 扩展域
44 | ///
45 | public string Reserved
46 | {
47 | get;
48 | set;
49 | }
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/CRL2/Business/OnlinePay/Company/ChinaPay/UserBalanceQuery/Response.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace CRL.Business.OnlinePay.Company.ChinaPay.UserBalanceQuery
7 | {
8 | public class Response:ResponseBase
9 | {
10 | public override string ResponseName
11 | {
12 | get { return "A101AcctBalInqRs"; }
13 | }
14 | ///
15 | /// 用户号
16 | ///
17 | public string UserId
18 | {
19 | get;
20 | set;
21 | }
22 | ///
23 | /// 用户状态
24 | ///
25 | public string Status
26 | {
27 | get;
28 | set;
29 | }
30 | ///
31 | /// 账面余额
32 | ///
33 | public string Bal
34 | {
35 | get;
36 | set;
37 | }
38 | ///
39 | /// 冻结金额
40 | ///
41 | public string FrzBal
42 | {
43 | get;
44 | set;
45 | }
46 | ///
47 | /// 可用余额
48 | ///
49 | public string AvailableBal
50 | {
51 | get;
52 | set;
53 | }
54 | ///
55 | /// 可提现余额
56 | ///
57 | public string DrawBal
58 | {
59 | get;
60 | set;
61 | }
62 | ///
63 | /// 币种
64 | ///
65 | public string CurCode
66 | {
67 | get;
68 | set;
69 | }
70 | ///
71 | /// 扩展域
72 | ///
73 | public string Reserved
74 | {
75 | get;
76 | set;
77 | }
78 |
79 | }
80 | }
81 |
--------------------------------------------------------------------------------
/CRL2/Business/OnlinePay/Company/ChinaPay/UserBalanceQuery/UserBalanceQuery.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace CRL.Business.OnlinePay.Company.ChinaPay.UserBalanceQuery
7 | {
8 | public class Request:RequestBase
9 | {
10 | protected override string InterfacePath
11 | {
12 | get { return "/Business/EasMerchant/" + RequestName; }
13 | }
14 |
15 | public override string MessageCode
16 | {
17 | get { return "201811"; }
18 | }
19 |
20 | public override string RequestName
21 | {
22 | get { return "A101AcctBalInqRq"; }
23 | }
24 | ///
25 | /// 用户号
26 | ///
27 | public string UserId
28 | {
29 | get;
30 | set;
31 | }
32 | ///
33 | /// 扩展域
34 | ///
35 | public string Reserved
36 | {
37 | get;
38 | set;
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/CRL2/Business/OnlinePay/Company/Chinapnr/ChargeResponse.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace CRL.Business.OnlinePay.Company.Chinapnr
7 | {
8 | public class ChargeResponse : MessageBase
9 | {
10 | public string CmdId;
11 | public string MerId;
12 | public string RespCode;
13 | public string TrxId;
14 | public string OrdAmt;
15 | public string CurCode;
16 | public string Pid;
17 | public string OrdId;
18 | public string MerPriv;
19 | public string RetType;
20 | public string DivDetails;
21 | public string GateId;
22 | public string ChkValue;
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/CRL2/Business/OnlinePay/Company/Chinapnr/ChargeSubmit.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace CRL.Business.OnlinePay.Company.Chinapnr
7 | {
8 | public class ChargeSubmit : MessageBase
9 | {
10 | public string Version="10";
11 | public string CmdId = "Buy";
12 | public string MerId;
13 | public string OrdId;
14 | public string OrdAmt;
15 | public string CurCode;
16 | public string Pid;
17 | public string RetUrl;
18 | public string MerPriv;
19 | public string GateId;
20 | public string UsrMp;
21 | public string DivDetails;
22 | public string OrderType;
23 | public string PayUsrId;
24 | public string PnrNum;
25 | public string BgRetUrl;
26 | public string IsBalance;
27 | public string ChkValue;
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/CRL2/Business/OnlinePay/Company/Chinapnr/MessageBase.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace CRL.Business.OnlinePay.Company.Chinapnr
7 | {
8 | public class MessageBase
9 | {
10 | public string GetSignData()
11 | {
12 | var fields = GetType().GetFields();
13 | string returnStr = "";
14 | foreach (var item in fields)
15 | {
16 | if (item.Name == "ChkValue")
17 | {
18 | continue;
19 | }
20 | string paramValue = item.GetValue(this) + "";
21 | returnStr += paramValue;
22 | }
23 | return returnStr;
24 | }
25 | static string privateKey = CoreHelper.CustomSetting.GetConfigKey("汇付天下私钥文件");
26 | static string publicKey = CoreHelper.CustomSetting.GetConfigKey("汇付天下公钥文件");
27 | public string MakeSign()
28 | {
29 | string data = GetSignData();
30 | return data;
31 | }
32 |
33 | public bool CheckSign(string sign)
34 | {
35 | var signMsgVal = GetSignData();
36 | return sign == signMsgVal;
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/CRL2/Business/OnlinePay/Company/FieldIndexAttribute.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace CRL.Business.OnlinePay.Company
7 | {
8 | [AttributeUsage(AttributeTargets.Property)]
9 | public class FieldIndexAttribute : System.Attribute
10 | {
11 | public FieldIndexAttribute(int _index)
12 | {
13 | index = _index;
14 | }
15 | int index = 999;
16 |
17 | public int Index
18 | {
19 | get { return index; }
20 | set { index = value; }
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/CRL2/Business/OnlinePay/Company/Lianlian/Md5Algorithm.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 | using System.IO;
5 | using System.Security.Cryptography;
6 |
7 | namespace CRL.Business.OnlinePay.Company.Lianlian
8 | {
9 |
10 | /**
11 | * 32位MD5摘要算法
12 | * @author shmily
13 | * @date 2012-6-28 下午02:34:45
14 | */
15 | public sealed class Md5Algorithm {
16 |
17 | public Md5Algorithm(){
18 |
19 | }
20 |
21 | private static Md5Algorithm instance;
22 |
23 | public static Md5Algorithm getInstance(){
24 | if(null == instance)
25 | return new Md5Algorithm();
26 | return instance;
27 | }
28 |
29 |
30 |
31 | private static String[] hexDigits = { "0", "1", "2", "3", "4", "5",
32 | "6", "7", "8", "9", "a", "b", "c", "d", "e", "f" };
33 |
34 | /**
35 | * 转换字节数组�?6进制字串
36 | * @param b 字节数组
37 | * @return 16进制字串
38 | */
39 | private String byteArrayToHexString(byte[] b) {
40 | StringBuilder resultSb = new StringBuilder();
41 | for (int i = 0; i < b.Length; i++) {
42 | resultSb.Append(byteToHexString(b[i]));
43 | }
44 | return resultSb.ToString();
45 | }
46 |
47 | /**
48 | * 转换字节数组为高位字符串
49 | * @param b 字节数组
50 | * @return
51 | */
52 | private String byteToHexString(byte b) {
53 | int n = b;
54 | if (n < 0)
55 | n = 256 + n;
56 | int d1 = n / 16;
57 | int d2 = n % 16;
58 | return hexDigits[d1] + hexDigits[d2];
59 | }
60 |
61 | /**
62 | * MD5 摘要计算(byte[]).
63 | * @param src byte[]
64 | * @throws Exception
65 | * @return String
66 | */
67 | public String md5Digest(byte[] src) {
68 | try {
69 | // MD5 is 32 bit message digest
70 | MD5 md5 = new MD5CryptoServiceProvider();
71 | return byteArrayToHexString(md5.ComputeHash(src));
72 | } catch (Exception e) {
73 | Console.WriteLine ("异常:" + e.Message);
74 | return null;
75 | }
76 |
77 | }
78 | }
79 | }
--------------------------------------------------------------------------------
/CRL2/Business/OnlinePay/Company/Lianlian/Message/BankCardQuery.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace CRL.Business.OnlinePay.Company.Lianlian.Message
7 | {
8 | public class BankCardQuery : MessageBase
9 | {
10 | public override string InterFaceUrl
11 | {
12 | get
13 | {
14 | return "https://yintong.com.cn/traderapi%20/bankcardquery.htm";
15 | }
16 | }
17 | ///
18 | /// 银行卡号
19 | ///
20 | public string card_no;
21 | ///
22 | /// 支付方式
23 | /// 2:快捷支付 (默认)D:认证支付
24 | ///
25 | public string pay_type;
26 | ///
27 | /// 是否返回限额标 0:不返回(默认)
28 | ///
29 | public string flag_amt_limit;
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/CRL2/Business/OnlinePay/Company/Lianlian/Message/BankCardQueryResponse.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace CRL.Business.OnlinePay.Company.Lianlian.Message
7 | {
8 | public class BankCardQueryResponse : MessageBase
9 | {
10 | ///
11 | /// 交易结果代码 是 定(4) 0000
12 | ///
13 | public string ret_code;
14 | ///
15 | /// 交易结果描述 是 变(100) 交易成功
16 | ///
17 | public string ret_msg;
18 |
19 | ///
20 | /// 所属银行编号 是 定(8)
21 | ///
22 | public string bank_code;
23 | ///
24 | /// 所属银行名称 是 变(32)
25 | ///
26 | public string bank_name;
27 | ///
28 | /// 银行卡类型 是 定(1) 2-储蓄卡 3-信用卡
29 | ///
30 | public string card_type;
31 | ///
32 | /// 单笔限额 否 String 单位 元
33 | ///
34 | public string single_amt;
35 | ///
36 | /// 单日限额 否 String 单位 元
37 | ///
38 | public string day_amt;
39 | ///
40 | /// 单月限额 否 String 单位 元
41 | ///
42 | public string month_amt;
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/CRL2/Business/OnlinePay/Company/Lianlian/Message/BindCardQuery.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace CRL.Business.OnlinePay.Company.Lianlian.Message
7 | {
8 | public class BindCardQuery:MessageBase
9 | {
10 | public override string InterFaceUrl
11 | {
12 | get
13 | {
14 | return "https://yintong.com.cn/traderapi%20/userbankcard.htm";
15 | }
16 | }
17 | public string user_id;
18 | public string platform;
19 | public string pay_type = "D";
20 | ///
21 | /// 签约协议号
22 | ///
23 | public string no_agree;
24 | public string card_no;
25 | public string offset = "0";
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/CRL2/Business/OnlinePay/Company/Lianlian/Message/BindCardQueryResponse.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace CRL.Business.OnlinePay.Company.Lianlian.Message
7 | {
8 | public class BindCardQueryResponse : MessageBase
9 | {
10 | ///
11 | /// 交易结果代码 是 定(4) 0000
12 | ///
13 | public string ret_code;
14 | ///
15 | /// 交易结果描述 是 变(100) 交易成功
16 | ///
17 | public string ret_msg;
18 |
19 | public string user_id;
20 |
21 | public string count;
22 | public List agreement_list;
23 | }
24 | public class agreement_list
25 | {
26 | public string no_agree;
27 | ///
28 | /// 所属银行编号 是 定(8)
29 | ///
30 | public string bank_code;
31 | ///
32 | /// 所属银行名称 是 变(32)
33 | ///
34 | public string bank_name;
35 | ///
36 | /// 银行卡类型 是 定(1) 2-储蓄卡 3-信用卡
37 | ///
38 | public string card_type;
39 | public string card_no;
40 | public string bind_mobile;
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/CRL2/Business/OnlinePay/Company/Lianlian/Message/OrderQuery.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace CRL.Business.OnlinePay.Company.Lianlian.Message
7 | {
8 | public class OrderQuery : MessageBase
9 | {
10 | public override string InterFaceUrl
11 | {
12 | get
13 | {
14 | return "https://yintong.com.cn/traderapi/orderquery.htm";
15 | }
16 | }
17 | ///
18 | /// 商户订单时间
19 | ///
20 | public string dt_order;
21 |
22 | ///
23 | /// 商户唯一订单号
24 | ///
25 | public string no_order;
26 | ///
27 | /// 连连支付支付单号
28 | ///
29 | public string oid_paybill;
30 | ///
31 | /// 查询版本号
32 | ///
33 | public string query_version;
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/CRL2/Business/OnlinePay/Company/Lianlian/Message/OrderQueryResponse.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace CRL.Business.OnlinePay.Company.Lianlian.Message
7 | {
8 | public class OrderQueryResponse : MessageBase
9 | {
10 | ///
11 | /// 交易结果代码
12 | ///
13 | public string ret_code;
14 | ///
15 | /// 交易结果描述
16 | ///
17 | public string ret_msg;
18 | ///
19 | /// 支付结果SUCCESS 成功
20 | ////WAITING 等待支付
21 | ////PROCESSING 银行支付处理中
22 | ////REFUND 退款
23 | ////FAILURE 失败
24 | ////支付结果以此为准,商户按此进行后续是否
25 | ////发货操作
26 | ///
27 | public string result_pay;
28 | ///
29 | /// 商户订单时间
30 | ///
31 | public string dt_order;
32 |
33 | ///
34 | /// 商户唯一订单号
35 | ///
36 | public string no_order;
37 | ///
38 | /// 连连支付支付单号
39 | ///
40 | public string oid_paybill;
41 | ///
42 | /// 交易金额
43 | ///
44 | public string money_order;
45 | ///
46 | /// 清算日期
47 | ///
48 | public string settle_date;
49 |
50 | ///
51 | /// 订单描述
52 | ///
53 | public string info_order;
54 | ///
55 | /// 支付方式
56 | ///
57 | public string pay_type;
58 | public string bank_code;
59 | public string bank_name;
60 | public string memo;
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/CRL2/Business/OnlinePay/Company/Lianlian/Message/WapAuth/PayReturn.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace CRL.Business.OnlinePay.Company.Lianlian.Message.WapAuth
7 | {
8 | public class PayReturn : MessageBase
9 | {
10 | ///
11 | /// 商户订单时间
12 | ///
13 | public string dt_order;
14 |
15 | ///
16 | /// 商户唯一订单号
17 | ///
18 | public string no_order;
19 | ///
20 | /// 连连支付支付单号
21 | ///
22 | public string oid_paybill;
23 | ///
24 | /// 交易金额
25 | ///
26 | public string money_order;
27 | ///
28 | /// 支付结果
29 | /// SUCCESS 成功
30 | ///
31 | public string result_pay;
32 | ///
33 | /// 清算日期
34 | ///
35 | public string settle_date;
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/CRL2/Business/OnlinePay/Company/Lianlian/Message/Web/PayNotify.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace CRL.Business.OnlinePay.Company.Lianlian.Message.Web
7 | {
8 | ///
9 | /// 交易结果代码 ret_code 是 定(4) 0000
10 | ///交易结果描述 ret_msg 是 变(100) 交易成功
11 | ///
12 | public class PayNotify : PayReturn
13 | {
14 | ///
15 | /// 签约协议号
16 | ///
17 | public string no_agree;
18 | ///
19 | /// 证件类型
20 | ///
21 | public string id_type;
22 | ///
23 | /// 证件号码
24 | ///
25 | public string id_no;
26 | ///
27 | /// 银行账号姓名
28 | ///
29 | public string acct_name;
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/CRL2/Business/OnlinePay/Company/Lianlian/Message/Web/PayReturn.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace CRL.Business.OnlinePay.Company.Lianlian.Message.Web
7 | {
8 | public class PayReturn:MessageBase
9 | {
10 | ///
11 | /// 商户订单时间
12 | ///
13 | public string dt_order;
14 |
15 | ///
16 | /// 商户唯一订单号
17 | ///
18 | public string no_order;
19 | ///
20 | /// 连连支付支付单号
21 | ///
22 | public string oid_paybill;
23 | ///
24 | /// 交易金额
25 | ///
26 | public string money_order;
27 | ///
28 | /// 支付结果
29 | /// SUCCESS 成功
30 | ///
31 | public string result_pay;
32 | ///
33 | /// 清算日期
34 | ///
35 | public string settle_date;
36 | ///
37 | /// 订单描述
38 | ///
39 | public string info_order;
40 | ///
41 | /// 支付方式
42 | ///
43 | public string pay_type;
44 | ///
45 | /// 银行编号
46 | ///
47 | public string bank_code;
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/CRL2/Business/OnlinePay/Company/Lianlian/PartnerConfig.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | /**
4 | * 商户基础 配置
5 | * @author guoyx e-mail:guoyx@lianlian.com
6 | * @date:2013-6-25 下午01:45:40
7 | * @version :1.0
8 | *
9 | */
10 |
11 | namespace CRL.Business.OnlinePay.Company.Lianlian
12 | {
13 | public class PartnerConfig
14 | {
15 |
16 | // RSA银通公钥
17 | public static string YT_PUB_KEY
18 | {
19 | get
20 | {
21 | var file = CoreHelper.CustomSetting.GetConfigKey("连连公钥文件");
22 | return System.IO.File.ReadAllText(file);
23 | }
24 | }
25 | // RSA商户私钥
26 | public static string TRADER_PRI_KEY
27 | {
28 | get
29 | {
30 | var file = CoreHelper.CustomSetting.GetConfigKey("连连私钥文件");
31 | return System.IO.File.ReadAllText(file);
32 | }
33 | }
34 | // MD5 KEY
35 | public static string MD5_KEY
36 | {
37 | get
38 | {
39 | return ChargeConfig.GetConfigKey(CompanyType.连连, ChargeConfig.DataType.Key);
40 | }
41 | }
42 |
43 | // 商户编号
44 | public static string OID_PARTNER
45 | {
46 | get
47 | {
48 | return ChargeConfig.GetConfigKey(CompanyType.连连, ChargeConfig.DataType.User);
49 | }
50 | }
51 | // 签名方式 RSA或MD5
52 | public static string SIGN_TYPE="MD5"; //请选择签名方式
53 | // 接口版本号,固定1.0
54 | public static string VERSION = "1.0";
55 | // 业务类型,连连支付根据商户业务为商户开设的业务类型; (101001:虚拟商品销售、109001:实物商品销售、108001:外部账户充值)
56 | public static string BUSI_PARTNER = "101001"; //请选择业务类型
57 | }
58 | }
59 |
60 |
--------------------------------------------------------------------------------
/CRL2/Business/OnlinePay/Company/Lianlian/ResourceConfig.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | /**
4 | * 支付配置信息
5 | * @author guoyx e-mail:guoyx@lianlian.com
6 | * @date:2013-6-25 下午01:45:06
7 | * @version :1.0
8 | *
9 | */
10 |
11 | namespace CRL.Business.OnlinePay.Company.Lianlian
12 | {
13 | public class ResourceConfig
14 | {
15 | public static string SERVER_URL = "https://test.yintong.com.cn/payment/bankgateway.htm"; // 连连银通连连钱包WAP支付服务地址
16 | }
17 | }
18 |
19 |
--------------------------------------------------------------------------------
/CRL2/Business/OnlinePay/Company/Lianlian/ServerURLConfig.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | /**
4 | * 请求服务地址 配置
5 | *
6 | */
7 |
8 | namespace CRL.Business.OnlinePay.Company.Lianlian
9 | {
10 | public class ServerURLConfig
11 | {
12 | public static string PAY_URL = "https://yintong.com.cn/payment/bankgateway.htm"; // 连连支付WEB收银台支付服务地址
13 | public static string QUERY_USER_BANKCARD_URL = "https://yintong.com.cn/traderapi/userbankcard.htm"; // 用户已绑定银行卡列表查询
14 | public static string QUERY_BANKCARD_URL = "https://yintong.com.cn/traderapi/bankcardquery.htm"; //银行卡卡bin信息查询
15 | }
16 | }
17 |
18 |
--------------------------------------------------------------------------------
/CRL2/Business/OnlinePay/Company/Lianlian/SignTypeEnum.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 |
4 | /**
5 | * 签名方式枚举
6 | * @author guoyx
7 | * @date:May 13, 2013 8:22:15 PM
8 | * @version :1.0
9 | *
10 | */
11 |
12 | namespace CRL.Business.OnlinePay.Company.Lianlian
13 | {
14 | public enum SignTypeEnum
15 | {
16 | RSA,MD5
17 | }
18 |
19 | public class SignTypeEnumClass
20 | {
21 | public static string getCode(SignTypeEnum x)
22 | {
23 | switch (x) {
24 | case SignTypeEnum.MD5:
25 | return "MD5";
26 | case SignTypeEnum.RSA:
27 | return "RSA";
28 | default:
29 | return "";
30 | }
31 | }
32 | }
33 | }
34 |
35 |
--------------------------------------------------------------------------------
/CRL2/Business/OnlinePay/Company/Tenpay/tenpay/CheckRequestHandler.cs:
--------------------------------------------------------------------------------
1 | namespace tenpay
2 | {
3 | using System;
4 | using System.Collections;
5 | using System.Text;
6 | using System.Web;
7 |
8 | public class CheckRequestHandler : RequestHandler
9 | {
10 | public CheckRequestHandler(HttpContext httpContext) : base(httpContext)
11 | {
12 | base.setGateUrl("http://mch.tenpay.com/cgi-bin/mchdown_real_new.cgi");
13 | }
14 |
15 | protected override void createSign()
16 | {
17 | StringBuilder builder = new StringBuilder();
18 | ArrayList list = new ArrayList();
19 | list.Add("spid");
20 | list.Add("trans_time");
21 | list.Add("stamp");
22 | list.Add("cft_signtype");
23 | list.Add("mchtype");
24 | foreach (string str in list)
25 | {
26 | string strB = (string) base.parameters[str];
27 | if ((((strB != null) && ("".CompareTo(strB) != 0)) && ("sign".CompareTo(str) != 0)) && ("key".CompareTo(str) != 0))
28 | {
29 | builder.Append(str + "=" + strB + "&");
30 | }
31 | }
32 | builder.Append("key=" + base.getKey());
33 | string parameterValue = MD5Util.GetMD5(builder.ToString(), this.getCharset()).ToLower();
34 | base.setParameter("sign", parameterValue);
35 | base.setDebugInfo(builder.ToString() + " => sign:" + parameterValue);
36 | }
37 | }
38 | }
39 |
40 |
--------------------------------------------------------------------------------
/CRL2/Business/OnlinePay/Company/Tenpay/tenpay/MD5Util.cs:
--------------------------------------------------------------------------------
1 | namespace tenpay
2 | {
3 | using System;
4 | using System.Security.Cryptography;
5 | using System.Text;
6 |
7 | public class MD5Util
8 | {
9 | public static string GetMD5(string encypStr, string charset)
10 | {
11 | byte[] bytes;
12 | MD5CryptoServiceProvider provider = new MD5CryptoServiceProvider();
13 | try
14 | {
15 | bytes = Encoding.GetEncoding(charset).GetBytes(encypStr);
16 | }
17 | catch (Exception)
18 | {
19 | bytes = Encoding.GetEncoding("GB2312").GetBytes(encypStr);
20 | }
21 | return BitConverter.ToString(provider.ComputeHash(bytes)).Replace("-", "").ToUpper();
22 | }
23 | }
24 | }
25 |
26 |
--------------------------------------------------------------------------------
/CRL2/Business/OnlinePay/CompanyType.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Data;
3 | using System.Configuration;
4 | using System.Linq;
5 | using System.Web;
6 | using System.Web.Security;
7 | using System.Web.UI;
8 | using System.Web.UI.HtmlControls;
9 | using System.Web.UI.WebControls;
10 | using System.Web.UI.WebControls.WebParts;
11 | using System.Xml.Linq;
12 | using CoreHelper;
13 | namespace CRL.Business.OnlinePay
14 | {
15 | ///
16 | /// 支付公司类型
17 | ///
18 | public enum CompanyType
19 | {
20 |
21 | ///
22 | /// 未指定
23 | ///
24 | None = 9999,
25 | ///
26 | /// 财付通
27 | ///
28 | 财付通 = 1,
29 | ///
30 | /// 支付宝
31 | ///
32 | 支付宝 = 2,
33 | 银联托管 = 3,
34 | 快钱=4,
35 | 连连=5,
36 | 汇付天下=6
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/CRL2/Business/OnlinePay/OrderState.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Data;
3 | using System.Configuration;
4 | using System.Linq;
5 | using System.Web;
6 | using System.Web.Security;
7 | using System.Web.UI;
8 | using System.Web.UI.HtmlControls;
9 | using System.Web.UI.WebControls;
10 | using System.Web.UI.WebControls.WebParts;
11 | using System.Xml.Linq;
12 | using CoreHelper;
13 | namespace CRL.Business.OnlinePay
14 | {
15 | ///
16 | /// 订单状态
17 | ///
18 | public enum OrderStatus
19 | {
20 | ///
21 | /// 默认
22 | ///
23 | 已提交=0,
24 | ///
25 | /// 超时
26 | ///
27 | 已过期=1,
28 | ///
29 | ///已确认
30 | ///
31 | 已确认=2,
32 | ///
33 | /// 已退款
34 | ///
35 | 已退款 = 3
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/CRL2/Business/OnlinePay/OrderType.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Data;
3 | using System.Configuration;
4 | using System.Linq;
5 | using System.Web;
6 | using System.Web.Security;
7 | using System.Web.UI;
8 | using System.Web.UI.HtmlControls;
9 | using System.Web.UI.WebControls;
10 | using System.Web.UI.WebControls.WebParts;
11 | using System.Xml.Linq;
12 |
13 | namespace CRL.Business.OnlinePay
14 | {
15 | ///
16 | /// 订单类型
17 | ///
18 | public enum OrderType
19 | {
20 | ///
21 | /// 充值
22 | ///
23 | 充值 = 0,
24 | ///
25 | /// 支付
26 | ///
27 | 支付 = 1
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/CRL2/Business/Order/Order.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace CRL.Order
7 | {
8 | public class IOrder : Order
9 | {
10 | }
11 | ///
12 | /// 订单原型
13 | ///
14 | public class Order : IModelBase
15 | {
16 | public override string CheckData()
17 | {
18 | return "";
19 | }
20 | ///
21 | /// 订单ID 会自动生成
22 | ///
23 | [Attribute.Field(FieldIndexType = Attribute.FieldIndexType.非聚集唯一)]
24 | public string OrderId
25 | {
26 | get;
27 | set;
28 | }
29 | ///
30 | /// 用户编号
31 | ///
32 | [Attribute.Field(FieldIndexType = Attribute.FieldIndexType.非聚集)]
33 | public string UserId
34 | {
35 | get;
36 | set;
37 | }
38 | ///
39 | /// 状态,为了可扩展,不直接用枚举
40 | ///
41 | [CRL.Attribute.Field(FieldIndexType = CRL.Attribute.FieldIndexType.非聚集)]
42 | public int Status
43 | {
44 | get;
45 | set;
46 | }
47 | ///
48 | /// 备注
49 | ///
50 | [Attribute.Field(Length = 3000, NotNull = false)]
51 | public string Remark
52 | {
53 | get;
54 | set;
55 | }
56 | ///
57 | /// 付款方式
58 | ///
59 | public PayType PayType
60 | {
61 | get;
62 | set;
63 | }
64 | public DateTime UpdateTime
65 | {
66 | get;
67 | set;
68 | }
69 | }
70 | public enum PayType
71 | {
72 | 余额,
73 | 在线支付
74 | }
75 | }
76 |
--------------------------------------------------------------------------------
/CRL2/Business/Order/OrderStatus.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using CoreHelper;
6 | namespace CRL.Order
7 | {
8 | ///
9 | /// 一般订单状态
10 | ///
11 | public enum OrderStatus
12 | {
13 | ///
14 | /// 已提交
15 | ///
16 | 已提交,
17 |
18 | ///
19 | /// 已确认
20 | ///
21 | 已确认,
22 |
23 | ///
24 | /// 已取消
25 | ///
26 | 已取消
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/CRL2/Business/Order/ProductOrder/OrderDetail.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace CRL.Order.ProductOrder
7 | {
8 | public class IOrderDetail : OrderDetail
9 | {
10 | }
11 | ///
12 | /// 订单明细,不继承
13 | ///
14 | [Attribute.Table(TableName = "OrderDetail")]
15 | public class OrderDetail : ShoppingCart.ICartItem
16 | {
17 | ///
18 | /// 订单号
19 | ///
20 | [Attribute.Field(FieldIndexType = Attribute.FieldIndexType.非聚集)]
21 | public string OrderId
22 | {
23 | get;
24 | set;
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/CRL2/Business/Order/ProductOrder/ProductOrderStatus.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using CoreHelper;
6 | namespace CRL.Order.ProductOrder
7 | {
8 | ///
9 | /// 产品订单状态
10 | ///
11 | public enum ProductOrderStatus
12 | {
13 |
14 | ///
15 | /// 等待付款
16 | ///
17 | 等待付款 = 0,
18 | ///
19 | /// 已付款
20 | ///
21 | 已付款 = 1,
22 |
23 | #region 发货状态,如果需要调用
24 | ///
25 | /// 等待发货
26 | ///
27 | 等待发货 = 2,
28 | ///
29 | /// 已发货
30 | ///
31 | 已发货 = 3,
32 | ///
33 | /// 正常流程走完
34 | ///
35 | 确认收货 = 4,
36 | #endregion
37 |
38 | ///
39 | /// 已提交申请取消
40 | ///
41 | 已申请退货 = 5,
42 | 同意退货 = 6,
43 | 不同意退货 = 7,
44 | 退货成功 = 8,
45 | //[ItemDisc("已取消但未退款")]
46 | /////
47 | ///// 已取消但未退款(退款暂时未成功,如退还到网银)
48 | /////
49 | //已取消但未退款,
50 |
51 | ///
52 | /// 已取消
53 | ///
54 | 已取消 = 99
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/CRL2/Business/Person/IMember.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace CRL.Person
7 | {
8 | public class IMember : Member
9 | {
10 | }
11 | ///
12 | /// 会员
13 | ///
14 | [Attribute.Table(TableName = "Member")]
15 | public class Member : IPerson
16 | {
17 | [Attribute.Field(Length=100)]
18 | public string PayPass
19 | {
20 | get;
21 | set;
22 | }
23 | public string QQ
24 | {
25 | get;
26 | set;
27 | }
28 | public string Sex
29 | {
30 | get;
31 | set;
32 | }
33 | [Attribute.Field(Length = 100)]
34 | public string Address
35 | {
36 | get;
37 | set;
38 | }
39 | ///
40 | /// 省
41 | ///
42 | public string Province
43 | {
44 | get;
45 | set;
46 | }
47 | ///
48 | /// 市
49 | ///
50 | public string City
51 | {
52 | get;
53 | set;
54 | }
55 | ///
56 | /// 区/县
57 | ///
58 | public string County
59 | {
60 | get;
61 | set;
62 | }
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/CRL2/Business/Person/LoginLog.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace CRL.Person
7 | {
8 | public class LoginLog : CRL.IModelBase
9 | {
10 | [Attribute.Field(FieldIndexType = Attribute.FieldIndexType.非聚集)]
11 | public int UserId
12 | {
13 | get;
14 | set;
15 | }
16 | public string UserName
17 | {
18 | get;
19 | set;
20 | }
21 | ///
22 | /// 来源
23 | ///
24 | [Attribute.Field(FieldIndexType = Attribute.FieldIndexType.非聚集)]
25 | public string Source
26 | {
27 | get;
28 | set;
29 | }
30 | [Attribute.Field(FieldIndexType = Attribute.FieldIndexType.非聚集)]
31 | public string UserType
32 | {
33 | get;
34 | set;
35 | }
36 | public string RemoteIp
37 | {
38 | get;
39 | set;
40 | }
41 | [Attribute.Field(Length=200)]
42 | public string Browser
43 | {
44 | get;
45 | set;
46 | }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/CRL2/Business/Person/ShopSupplier.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace CRL.Person
7 | {
8 | public class IShopSupplier : ShopSupplier
9 | {
10 | }
11 | ///
12 | /// 商家/供货商
13 | ///
14 | [Attribute.Table(TableName = "ShopSupplier")]
15 | public class ShopSupplier : Person
16 | {
17 | ///
18 | /// 免运费金额
19 | ///
20 | public decimal MinFreePostAmount
21 | {
22 | get;
23 | set;
24 | }
25 | //todo 其它字段
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/CRL2/Business/Person/SmsSendRecord.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace CRL.Person
7 | {
8 | public class SmsSendRecordManage : CRL.BaseProvider
9 | {
10 | public static SmsSendRecordManage Instance
11 | {
12 | get
13 | {
14 | return new SmsSendRecordManage();
15 | }
16 | }
17 | }
18 | public class SmsSendRecord : CRL.IModelBase
19 | {
20 | [CRL.Attribute.Field(FieldIndexType = CRL.Attribute.FieldIndexType.非聚集)]
21 | public string Mobile
22 | {
23 | get;
24 | set;
25 | }
26 | public string Code
27 | {
28 | get;
29 | set;
30 | }
31 | public string ModuleName
32 | {
33 | get;
34 | set;
35 | }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/CRL2/Business/Product/ProductStatus.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using CoreHelper;
6 | namespace CRL.Product
7 | {
8 | ///
9 | /// 渠道产品状态
10 | ///
11 | public enum ChannelProductStatus
12 | {
13 | ///
14 | /// 默认0
15 | ///
16 | 默认,
17 | ///
18 | /// 已上架1
19 | ///
20 | 已上架,
21 | ///
22 | /// 已下架2
23 | ///
24 | 已下架
25 | }
26 |
27 | ///
28 | /// 产品状态
29 | ///
30 | public enum ProductStatus
31 | {
32 | ///
33 | /// 默认0
34 | ///
35 | 默认,
36 | ///
37 | /// 已上架1
38 | ///
39 | 已上架,
40 | ///
41 | /// 已下架2
42 | ///
43 | 已下架
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/CRL2/Business/Property/PropertyName.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace CRL.Property
7 | {
8 | ///
9 | /// 属性名称
10 | /// 不要继承
11 | ///
12 | [Attribute.Table(TableName = "PropertyName")]
13 | public sealed class PropertyName : IModelBase
14 | {
15 | public override string CheckData()
16 | {
17 | return "";
18 | }
19 | public string Name
20 | {
21 | get;
22 | set;
23 | }
24 | ///
25 | /// 分类Code
26 | ///
27 | public string CategoryCode
28 | {
29 | get;
30 | set;
31 | }
32 | public string Remark
33 | {
34 | get;
35 | set;
36 | }
37 | public int Sort
38 | {
39 | get;
40 | set;
41 | }
42 | ///
43 | /// 类型,以作不同用途
44 | ///
45 | public PropertyType Type
46 | {
47 | get;
48 | set;
49 | }
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/CRL2/Business/Property/PropertyType.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace CRL.Property
7 | {
8 | ///
9 | /// 属性类型
10 | ///
11 | public enum PropertyType
12 | {
13 | ///
14 | /// 产品属性
15 | ///
16 | 产品属性=1,
17 | ///
18 | /// 产品规格
19 | ///
20 | 产品规格=2
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/CRL2/Business/Property/PropertyValue.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace CRL.Property
7 | {
8 | ///
9 | /// 属性值
10 | /// 不要继承
11 | ///
12 | [Attribute.Table(TableName = "PropertyValue")]
13 | public sealed class PropertyValue : IModelBase
14 | {
15 | public override string CheckData()
16 | {
17 | return "";
18 | }
19 | public int PropertyId
20 | {
21 | get;
22 | set;
23 | }
24 | public string Name
25 | {
26 | get;
27 | set;
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/CRL2/Business/ReceiveAddress/AddressAction.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Collections;
6 |
7 | namespace CRL.ReceiveAddress
8 | {
9 | ///
10 | /// 收货地址维护
11 | ///
12 | public class AddressAction : BaseAction where TType : class
13 | {
14 | ///
15 | /// 获取用户收货地址
16 | ///
17 | ///
18 | ///
19 | public static List QueryUserAddress(string userId)where T:IAddress,new()
20 | {
21 | DBExtend helper = dbHelper;
22 | LamadaQuery query = new LamadaQuery();
23 | query = query.Select().Where(b => b.UserId == userId).OrderBy(b => b.DefaultAddress, true);
24 | string key;
25 | return helper.QueryList(query, 0, out key);
26 | }
27 | ///
28 | /// 设为默认
29 | ///
30 | ///
31 | ///
32 | public static void SetDefault(string userId,int id)where T:IAddress,new()
33 | {
34 | ParameCollection setValue = new ParameCollection();
35 | setValue["DefaultAddress"] = 0;
36 | Update((b=>b.UserId==userId), setValue);//去掉默认
37 |
38 | setValue["DefaultAddress"] = 1;
39 | Update(b => b.Id == id, setValue);//设为默认
40 | }
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/CRL2/Business/ReceiveAddress/AddressBusiness.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Collections;
6 |
7 | namespace CRL.ReceiveAddress
8 | {
9 | ///
10 | /// 收货地址维护
11 | ///
12 | public class AddressBusiness : BaseProvider
13 | where TType : class
14 | where TModel : Address,new()
15 | {
16 | public static AddressBusiness Instance
17 | {
18 | get { return new AddressBusiness(); }
19 | }
20 | protected override DBExtend dbHelper
21 | {
22 | get { return GetDbHelper(); }
23 | }
24 | ///
25 | /// 获取用户收货地址
26 | ///
27 | ///
28 | ///
29 | public List QueryUserAddress(string userId)
30 | {
31 | LambdaQuery query = GetLamadaQuery();
32 | query = query.Where(b => b.UserId == userId).OrderBy(b => b.DefaultAddress, true);
33 | return QueryList(query);
34 | }
35 | ///
36 | /// 设为默认
37 | ///
38 | ///
39 | ///
40 | public void SetDefault(string userId,int id)
41 | {
42 | ParameCollection setValue = new ParameCollection();
43 | setValue["DefaultAddress"] = 0;
44 | Update((b=>b.UserId==userId), setValue);//去掉默认
45 |
46 | setValue["DefaultAddress"] = 1;
47 | Update(b => b.Id == id, setValue);//设为默认
48 | }
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/CRL2/Business/RoleAuthorize/AccessControl.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace CRL.RoleAuthorize
7 | {
8 | ///
9 | /// 访问控制
10 | ///
11 | public sealed class AccessControl:IModelBase
12 | {
13 | ///
14 | /// 菜单
15 | ///
16 | [Attribute.Field(FieldIndexType = Attribute.FieldIndexType.非聚集)]
17 | public string MenuCode
18 | {
19 | get;
20 | set;
21 | }
22 | public bool Que
23 | {
24 | get;
25 | set;
26 | }
27 | ///
28 | /// 角色类型,组还是用户
29 | ///
30 | [Attribute.Field(FieldIndexType = Attribute.FieldIndexType.非聚集)]
31 | public RoleType RoleType
32 | {
33 | get;
34 | set;
35 | }
36 | ///
37 | /// 角色或用户
38 | ///
39 | public int Role
40 | {
41 | get;
42 | set;
43 | }
44 | ///
45 | /// 系统ID
46 | ///
47 | [Attribute.Field(FieldIndexType = Attribute.FieldIndexType.非聚集)]
48 | public int SystemTypeId
49 | {
50 | get;
51 | set;
52 | }
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/CRL2/Business/RoleAuthorize/Department.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace CRL.Business.RoleAuthorize
7 | {
8 | [Attribute.Table(TableName = "Department")]
9 | public class Department:Category.Category
10 | {
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/CRL2/Business/RoleAuthorize/DepartmentBusiness.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace CRL.Business.RoleAuthorize
7 | {
8 | public class DepartmentBusiness : Category.CategoryBusiness
9 | {
10 | public static DepartmentBusiness Instance
11 | {
12 | get { return new DepartmentBusiness(); }
13 | }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/CRL2/Business/RoleAuthorize/EmployeeBusiness.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace CRL.RoleAuthorize
7 | {
8 | ///
9 | ///
10 | ///
11 | public class EmployeeBusiness : Person.PersonBusiness
12 | {
13 | public static EmployeeBusiness Instance
14 | {
15 | get
16 | {
17 | return new EmployeeBusiness();
18 | }
19 | }
20 |
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/CRL2/Business/RoleAuthorize/Menu.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace CRL.RoleAuthorize
7 | {
8 | ///
9 | /// 菜单
10 | ///
11 | [Attribute.Table(TableName="Menu")]
12 | public sealed class Menu : Category.ICategory
13 | {
14 | [Attribute.Field(Length = 200)]
15 | public string Url
16 | {
17 | get;
18 | set;
19 | }
20 | ///
21 | /// 只在设置权限时使用
22 | ///
23 | public bool Que;
24 | private bool showInNav = true;
25 | ///
26 | /// 是否在导航菜单中显示
27 | ///
28 | public bool ShowInNav
29 | {
30 | get { return showInNav; }
31 | set { showInNav = value; }
32 | }
33 | public bool Enabled = true;
34 | public string GetPadding()
35 | {
36 | string str = "";
37 | int n = SequenceCode.Length / 2;
38 | if (n > 1)
39 | {
40 | str = "└";
41 | }
42 | for (int i = 1; i < n;i++ )
43 | {
44 | str += "────";
45 | }
46 | return str;
47 | }
48 | public override string ToString()
49 | {
50 | return string.Format("{0} {1}",SequenceCode,Name);
51 | }
52 | [CRL.Attribute.Field(MappingField = false)]
53 | public int Hit
54 | {
55 | get;
56 | set;
57 | }
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/CRL2/Business/RoleAuthorize/MenuOperation.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace CRL.RoleAuthorize
7 | {
8 | public enum MenuOperation
9 | {
10 | Query = 1,
11 | Insert = 2,
12 | Update = 3,
13 | Delete = 4
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/CRL2/Business/RoleAuthorize/Role.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace CRL.RoleAuthorize
7 | {
8 | ///
9 | /// 角色组
10 | ///
11 | [Attribute.Table( TableName="Roles")]
12 | public sealed class Role : IModelBase
13 | {
14 | [CRL.Attribute.Field(FieldIndexType = CRL.Attribute.FieldIndexType.非聚集唯一)]
15 | public string Name
16 | {
17 | get;
18 | set;
19 | }
20 | public string Remark
21 | {
22 | get;
23 | set;
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/CRL2/Business/RoleAuthorize/RoleBusiness.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace CRL.RoleAuthorize
7 | {
8 | public class RoleBusiness : BaseProvider
9 | {
10 | public IEnumerable allCache
11 | {
12 | get
13 | {
14 | return AllCache;
15 | }
16 | }
17 | public static RoleBusiness Instance
18 | {
19 | get { return new RoleBusiness(); }
20 | }
21 | protected override DBExtend dbHelper
22 | {
23 | get { return GetDbHelper(); }
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/CRL2/Business/RoleAuthorize/RoleType.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace CRL.RoleAuthorize
7 | {
8 | ///
9 | /// 角色类型
10 | ///
11 | public enum RoleType
12 | {
13 | 角色,
14 | 用户
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/CRL2/Business/RoleAuthorize/SystemType.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace CRL.RoleAuthorize
7 | {
8 | public sealed class SystemType : IModelBase
9 | {
10 | public string Name
11 | {
12 | get;
13 | set;
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/CRL2/Business/RoleAuthorize/SystemTypeBusiness.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace CRL.RoleAuthorize
7 | {
8 | public class SystemTypeBusiness : BaseProvider
9 | {
10 | public static SystemTypeBusiness Instance
11 | {
12 | get { return new SystemTypeBusiness(); }
13 | }
14 | protected override DBExtend dbHelper
15 | {
16 | get { return GetDbHelper(); }
17 | }
18 | //static List systemTypes;
19 | public List SystemTypes
20 | {
21 | get
22 | {
23 | //if (systemTypes == null)
24 | //{
25 | var systemTypes = QueryList().OrderByDescending(b=>b.Id).ToList();
26 | //}
27 | return systemTypes;
28 | }
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/CRL2/Business/Stock/Style.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace CRL.Stock
7 | {
8 | ///
9 | /// 规格
10 | ///
11 | [Attribute.Table(TableName = "Style")]
12 | public class Style : IModelBase
13 | {
14 | public override string CheckData()
15 | {
16 | return "";
17 | }
18 | public string Name
19 | {
20 | get;
21 | set;
22 | }
23 | [Attribute.Field(FieldIndexType = Attribute.FieldIndexType.非聚集)]
24 | public int ProductId
25 | {
26 | get;
27 | set;
28 | }
29 | public int Num
30 | {
31 | get;
32 | set;
33 | }
34 | public int Num2
35 | {
36 | get;
37 | set;
38 | }
39 | public string BarCode
40 | {
41 | get;
42 | set;
43 | }
44 | ///
45 | /// SKU值串
46 | ///
47 | [Attribute.Field(Length = 200)]
48 | public string SKU
49 | {
50 | get;
51 | set;
52 | }
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/CRL2/Business/TradeType/TradeDirection.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace CRL.Business.TradeType
7 | {
8 | ///
9 | /// 交易方向
10 | ///
11 | public enum TradeDirection
12 | {
13 | 收入 = 1,
14 | 支出 = 2
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/CRL2/Business/TradeType/TradeType.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace CRL.Business.TradeType
7 | {
8 | ///
9 | /// 交易类型
10 | ///
11 | [CRL.Attribute.Table(TableName = "TradeType")]
12 | public class TradeType : CRL.Category.ICategory
13 | {
14 | ///
15 | /// 交易方向
16 | ///
17 | public TradeDirection TradeDirection
18 | {
19 | get;
20 | set;
21 | }
22 | ///
23 | /// 重新计算后的交易类型代码
24 | ///
25 | [CRL.Attribute.Field(FieldIndexType = CRL.Attribute.FieldIndexType.非聚集唯一)]
26 | public string TradeCode
27 | {
28 | get;
29 | set;
30 | }
31 | }
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/CRL2/CacheServer/CacheServer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace CRL.CacheServer
7 | {
8 | public class CacheServer
9 | {
10 | public static string Query(string json)
11 | {
12 | var obj = LambdaQuery.CRLQueryExpression.FromJson(json);
13 | return Query(obj);
14 | }
15 | public static string Query(LambdaQuery.CRLQueryExpression queryExpression)
16 | {
17 | if (SettingConfig.ExpressionQueryData == null)
18 | {
19 | throw new Exception("请实现SettingConfig.ExpressionQueryData");
20 | }
21 | var data = SettingConfig.ExpressionQueryData(queryExpression);
22 | var result = new ResultData() { Data = data, Total = queryExpression.Total };
23 | return CoreHelper.StringHelper.SerializerToJson(result);
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/CRL2/CacheServer/CacheService.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace CRL.CacheServer
7 | {
8 | ///
9 | /// 查询服务
10 | ///
11 | public class CacheService
12 | {
13 | ///
14 | /// 按json格式查询
15 | ///
16 | ///
17 | ///
18 | public static string Deal(string command)
19 | {
20 | var commandObj = Command.FromJson(command);
21 | //var obj = LambdaQuery.CRLQueryExpression.FromJson(commandObj.Data);
22 | return Deal(commandObj);
23 | }
24 | ///
25 | /// 按CRLExpression 查询
26 | ///
27 | ///
28 | ///
29 | internal static string Deal(CacheServer.Command command)
30 | {
31 | if (command.CommandType == CommandType.获取配置)
32 | {
33 | return CoreHelper.StringHelper.SerializerToJson(CacheServerSetting.ServerTypeSetting);
34 | }
35 | var type = command.ObjectType;
36 | if (!CacheServerSetting.CacheServerDealDataRules.ContainsKey(type))
37 | {
38 | return "error,服务端未找到SettingConfig.CacheServerDealDataRules对应的处理:" + type;
39 | }
40 | var handler = CacheServerSetting.CacheServerDealDataRules[type];
41 | var data = handler(command);
42 | return CoreHelper.StringHelper.SerializerToJson(data);
43 | }
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/CRL2/CacheServer/Command.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace CRL.CacheServer
7 | {
8 | public enum CommandType
9 | {
10 | 查询,
11 | 更新,
12 | 获取配置
13 | }
14 | public class Command
15 | {
16 | ///
17 | /// 对象类型,FullName
18 | ///
19 | public string ObjectType
20 | {
21 | get;
22 | set;
23 | }
24 | public CommandType CommandType
25 | {
26 | get;
27 | set;
28 | }
29 | ///
30 | /// json data
31 | ///
32 | public string Data
33 | {
34 | get;
35 | set;
36 | }
37 | public static Command FromJson(string json)
38 | {
39 | var result = (Command)CoreHelper.StringHelper.SerializerFromJSON(System.Text.Encoding.UTF8.GetBytes(json), typeof(Command));
40 | return result;
41 | }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/CRL2/CacheServer/ResultData.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace CRL.CacheServer
7 | {
8 | public class ResultData
9 | {
10 | public int Total
11 | {
12 | get;
13 | set;
14 | }
15 | ///
16 | /// json结果
17 | ///
18 | public string JsonData
19 | {
20 | get;
21 | set;
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/CRL2/CacheServer/TcpServer.cs:
--------------------------------------------------------------------------------
1 | using CoreHelper.SocketUtil;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Net.Sockets;
6 | using System.Text;
7 | using System.Threading;
8 | namespace CRL.CacheServer
9 | {
10 | ///
11 | /// Tcp服务端
12 | ///
13 | public class TcpServer : CoreHelper.SocketUtil.TcpService
14 | {
15 | public TcpServer(int port)
16 | : base(port)
17 | {
18 | Connected += new NetEventHandler(server_Connected);
19 | DisConnect += new NetEventHandler(server_DisConnect);
20 | }
21 |
22 | void server_DisConnect(IDataTransmit sender, NetEventArgs e)
23 | {
24 | //Log(sender.RemoteEndPoint.ToString() + " 连接断开");
25 | }
26 |
27 | void server_Connected(IDataTransmit sender, NetEventArgs e)
28 | {
29 | //Log(sender.RemoteEndPoint.ToString() + " 连接成功");
30 | sender.ReceiveData += new NetEventHandler(sender_ReceiveData);
31 | //接收数据
32 | sender.Start();
33 | }
34 | System.Text.Encoding encode = System.Text.Encoding.UTF8;
35 | //接收数据并修改部分数据然后发送回去
36 | void sender_ReceiveData(IDataTransmit sender, NetEventArgs e)
37 | {
38 | string result;
39 | try
40 | {
41 | byte[] data = (byte[])e.EventArg;
42 | var json = encode.GetString(data);
43 | result = CRL.CacheServer.CacheService.Deal(json);
44 | }
45 | catch (Exception ex)
46 | {
47 | Log("处理数据出错:" + ex.Message);
48 | result = "error,服务器内部错误:" + ex.Message;
49 | }
50 | //发送数据
51 | var data2 = encode.GetBytes(result);
52 | sender.Send(data2);
53 | }
54 | }
55 | }
--------------------------------------------------------------------------------
/CRL2/CallBackDataReader.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace CRL
7 | {
8 | ///
9 | /// DataRead关闭回调方法
10 | ///
11 | ///
12 | internal delegate int DataReaderHandler();
13 | ///
14 | /// 可回调取出out参数的DataReader
15 | ///
16 | internal class CallBackDataReader
17 | {
18 | System.Data.Common.DbDataReader reader;
19 | DataReaderHandler handler;
20 | public CallBackDataReader(System.Data.Common.DbDataReader _reader, DataReaderHandler _handler)
21 | {
22 | reader = _reader;
23 | handler = _handler;
24 | }
25 | public List GetData(out int outParame, ParameCollection fieldMapping = null) where T : class,new()
26 | {
27 | var data = ObjectConvert.DataReaderToList(reader, false, fieldMapping);
28 | reader.Close();
29 | outParame = handler();
30 | return data;
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/CRL2/DBExtend/DBExtendDelete.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Linq.Expressions;
5 | using System.Text;
6 |
7 | namespace CRL
8 | {
9 | public partial class DBExtend
10 | {
11 | #region delete
12 | ///
13 | /// 按条件删除
14 | ///
15 | ///
16 | ///
17 | ///
18 | public int Delete(string where) where T : IModel,new()
19 | {
20 | CheckTableCreated();
21 | string table = TypeCache.GetTableName(typeof(T));
22 | string sql = _DBAdapter.GetDeleteSql(table, where);
23 | sql = _DBAdapter.SqlFormat(sql);
24 | int n = helper.Execute(sql);
25 | ClearParame();
26 | return n;
27 | }
28 | ///
29 | /// 按主键删除
30 | ///
31 | ///
32 | ///
33 | ///
34 | public int Delete(int id) where T : IModelBase, new()
35 | {
36 | return Delete(b => b.Id == id);
37 | }
38 | ///
39 | /// 指定条件删除
40 | ///
41 | ///
42 | ///
43 | ///
44 | public int Delete(Expression> expression) where T : IModel, new()
45 | {
46 | LambdaQuery query = new LambdaQuery(this,false);
47 | string condition = query.FormatExpression(expression);
48 | query.FillParames(this);
49 | return Delete(condition);
50 | }
51 | #endregion
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/CRL2/DBExtend/FunctionType.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace CRL
7 | {
8 | internal enum FunctionType
9 | {
10 | MAX,
11 | MIN,
12 | COUNT,
13 | SUM
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/CRL2/IgnoreCaseDictionary.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace CRL
7 | {
8 | ///
9 | /// 不区分大小的字典
10 | ///
11 | public class IgnoreCaseDictionary : Dictionary where T : class
12 | {
13 | ///
14 | /// 获取键值,按小写
15 | ///
16 | ///
17 | ///
18 | public new T this[string key]
19 | {
20 | get
21 | {
22 | T obj = null;
23 | TryGetValue(key.ToLower(), out obj);
24 | return obj as T;
25 | }
26 | set
27 | {
28 | base[key.ToLower()] = value;
29 | }
30 | }
31 | ///
32 | /// 按小写名添加到字典
33 | ///
34 | ///
35 | ///
36 | public new void Add(string key, T value)
37 | {
38 | base.Add(key.ToLower(), value);
39 | }
40 | public new bool ContainsKey(string key)
41 | {
42 | return base.ContainsKey(key.ToLower());
43 | }
44 | public new bool Remove(string key)
45 | {
46 | return base.Remove(key.ToLower());
47 | }
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/CRL2/LambdaQuery/Distinct.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Data;
6 | using System.Linq.Expressions;
7 | using System.Reflection;
8 | using System.Collections;
9 | using CRL.LambdaQuery;
10 | using System.Text.RegularExpressions;
11 |
12 | namespace CRL
13 | {
14 | public partial class LambdaQuery where T : IModel, new()
15 | {
16 | bool DistinctFields = false;
17 | ///
18 | /// 表示 Distinct字段
19 | ///
20 | ///
21 | ///
22 | ///
23 | public LambdaQuery DistinctBy(Expression> resultSelector)
24 | {
25 | var fields = GetSelectField(resultSelector);
26 | DistinctFields = true;
27 | QueryFields = fields;
28 | return this;
29 | }
30 | bool distinctCount = false;
31 | ///
32 | /// 表示count Distinct
33 | /// 结果名为Total
34 | ///
35 | ///
36 | public LambdaQuery DistinctCount()
37 | {
38 | distinctCount = true;
39 | return this;
40 | }
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/CRL2/LambdaQuery/JoinType.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace CRL.LambdaQuery
7 | {
8 | public enum JoinType
9 | {
10 | Left,
11 | Inner,
12 | Right
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/CRL2/LambdaQuery/ParameterRebinder.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Linq.Expressions;
3 | namespace CRL.LambdaQuery
4 | {
5 | ///
6 | /// 参数重绑定操作
7 | ///
8 | public class ParameterRebinder : ExpressionVisitor
9 | {
10 | ///
11 | /// 参数字典
12 | ///
13 | private readonly Dictionary _map;
14 |
15 | ///
16 | /// 初始化参数重绑定操作
17 | ///
18 | /// 参数字典
19 | public ParameterRebinder(Dictionary map)
20 | {
21 | _map = map ?? new Dictionary();
22 | }
23 |
24 | ///
25 | /// 替换参数
26 | ///
27 | /// 参数字典
28 | /// 表达式
29 | public static Expression ReplaceParameters(Dictionary map, Expression exp)
30 | {
31 | return new ParameterRebinder(map).Visit(exp);
32 | }
33 |
34 | ///
35 | /// 访问参数
36 | ///
37 | /// 参数
38 | protected override Expression VisitParameter(ParameterExpression parameterExpression)
39 | {
40 | ParameterExpression replacement;
41 | if (_map.TryGetValue(parameterExpression, out replacement))
42 | parameterExpression = replacement;
43 | return base.VisitParameter(parameterExpression);
44 | }
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/CRL2/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // 有关程序集的常规信息通过下列属性集
6 | // 控制。更改这些属性值可修改
7 | // 与程序集关联的信息。
8 | [assembly: AssemblyTitle("CRL")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("hubro")]
12 | [assembly: AssemblyProduct("CRL")]
13 | [assembly: AssemblyCopyright("Copyright © hubro 2014")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // 将 ComVisible 设置为 false 使此程序集中的类型
18 | // 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型,
19 | // 则将该类型上的 ComVisible 属性设置为 true。
20 | [assembly: ComVisible(false)]
21 |
22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
23 | [assembly: Guid("26e77519-4a31-444e-bdf1-c3fba97964dd")]
24 |
25 | // 程序集的版本信息由下面四个值组成:
26 | //
27 | // 主版本
28 | // 次版本
29 | // 内部版本号
30 | // 修订号
31 | //
32 | // 可以指定所有这些值,也可以使用“内部版本号”和“修订号”的默认值,
33 | // 方法是按如下所示使用“*”:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("2.3.0.0")]
36 | [assembly: AssemblyFileVersion("2.3.0.0")]
37 |
--------------------------------------------------------------------------------
/CRL2/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // 此代码由工具生成。
4 | // 运行时版本:4.0.30319.18408
5 | //
6 | // 对此文件的更改可能会导致不正确的行为,并且如果
7 | // 重新生成代码,这些更改将会丢失。
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace CRL.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
17 |
18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
19 |
20 | public static Settings Default {
21 | get {
22 | return defaultInstance;
23 | }
24 | }
25 |
26 | [global::System.Configuration.ApplicationScopedSettingAttribute()]
27 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
28 | [global::System.Configuration.SpecialSettingAttribute(global::System.Configuration.SpecialSetting.ConnectionString)]
29 | [global::System.Configuration.DefaultSettingValueAttribute("Data Source=192.168.0.253,2866;Initial Catalog=AccountCenter;Persist Security Inf" +
30 | "o=True;User ID=sa;Password=sql@serverzhshw369518")]
31 | public string AccountCenterConnectionString {
32 | get {
33 | return ((string)(this["AccountCenterConnectionString"]));
34 | }
35 | }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/CRL2/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | <?xml version="1.0" encoding="utf-16"?>
7 | <SerializableConnectionString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
8 | <ConnectionString>Data Source=192.168.0.253,2866;Initial Catalog=AccountCenter;Persist Security Info=True;User ID=sa;Password=sql@serverzhshw369518</ConnectionString>
9 | <ProviderName>System.Data.SqlClient</ProviderName>
10 | </SerializableConnectionString>
11 | Data Source=192.168.0.253,2866;Initial Catalog=AccountCenter;Persist Security Info=True;User ID=sa;Password=sql@serverzhshw369518
12 |
13 |
14 |
--------------------------------------------------------------------------------
/CRL2/Resources/area.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hubro-xx/CRL2/98a2e031e54adebf0f228746a76e2bb83ffd569e/CRL2/Resources/area.txt
--------------------------------------------------------------------------------
/CRLWebTest/CRLExpressionTest.aspx:
--------------------------------------------------------------------------------
1 | <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CRLExpressionTest.aspx.cs" Inherits="WebTest.CRLExpressionTest" %>
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/CRLWebTest/CRLExpressionTest.aspx.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Web;
5 | using System.Web.UI;
6 | using System.Web.UI.WebControls;
7 |
8 | namespace WebTest
9 | {
10 | public partial class CRLExpressionTest : System.Web.UI.Page
11 | {
12 | protected void Page_Load(object sender, EventArgs e)
13 | {
14 | int m = 10;
15 | var query = new CRL.LambdaQuery.CRLExpressionVisitor();
16 | //var re = query.Where(b => b.ProductName.Contains("22"));
17 | var re = query.Where(b => b.ProductName.Substring(2)=="22");
18 | //var re = query.Where(b => b.ProductName.IndexOf("22")==1);
19 | var obj = CRL.LambdaQuery.CRLQueryExpression.FromJson(re);
20 | var expression = query.CreateLambda(obj.Expression);
21 | //re = CRL.CacheServer.CacheServer.Query(obj);
22 | Response.Write(re);
23 | }
24 | }
25 | }
--------------------------------------------------------------------------------
/CRLWebTest/CRLExpressionTest.aspx.designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | // <自动生成>
3 | // 此代码由工具生成。
4 | //
5 | // 对此文件的更改可能会导致不正确的行为,并且如果
6 | // 重新生成代码,这些更改将会丢失。
7 | // 自动生成>
8 | //------------------------------------------------------------------------------
9 |
10 | namespace WebTest {
11 |
12 |
13 | public partial class CRLExpressionTest {
14 |
15 | ///
16 | /// form1 控件。
17 | ///
18 | ///
19 | /// 自动生成的字段。
20 | /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
21 | ///
22 | protected global::System.Web.UI.HtmlControls.HtmlForm form1;
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/CRLWebTest/Code/AccountManage.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Web;
5 |
6 | namespace WebTest.Code
7 | {
8 | ///
9 | /// 帐户管理
10 | ///
11 | public class AccountManage : CRL.Account.AccountBusiness
12 | {
13 | public static AccountManage Instance
14 | {
15 | get { return new AccountManage(); }
16 | }
17 | protected override CRL.DBExtend dbHelper
18 | {
19 | get { return GetDbHelper(this.GetType()); }
20 | }
21 |
22 | }
23 | }
--------------------------------------------------------------------------------
/CRLWebTest/Code/LocalSqlHelper.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Data;
3 | using System.Configuration;
4 | using System.Linq;
5 | using System.Web;
6 | using System.Web.Security;
7 | using System.Web.UI;
8 | using System.Web.UI.HtmlControls;
9 | using System.Web.UI.WebControls;
10 | using System.Web.UI.WebControls.WebParts;
11 | using System.Xml.Linq;
12 |
13 | namespace WebTest.Code
14 | {
15 | public class LocalSqlHelper
16 | {
17 | static CoreHelper.DBHelper CreateDbHelper(string name)
18 | {
19 | string connString;
20 | //mssql
21 | //更改DBConnection目录内数据连接文件
22 | connString = CoreHelper.CustomSetting.GetConnectionString(name);
23 | return new CoreHelper.SqlHelper(connString);
24 |
25 | ////mysql
26 | //connString = "Server=127.0.0.1;Port=3306;Stmt=;Database=testDB; User=root;Password=;";
27 | //return new CoreHelper.MySqlHelper(connString);
28 |
29 | //oracle
30 | //connString = "Data Source={0};User ID={1};Password={2};Integrated Security=no;";
31 | //connString = string.Format(connString, "orcl", "SCOTT", "a123");
32 | //return new CoreHelper.OracleHelper(connString);
33 | }
34 | public static CoreHelper.DBHelper TestConnection
35 | {
36 | get
37 | {
38 | return CreateDbHelper("Default");
39 | }
40 | }
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/CRLWebTest/Code/Member.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Web;
5 |
6 | namespace WebTest.Code
7 | {
8 | public class Member:CRL.Person.Member
9 | {
10 | }
11 | }
--------------------------------------------------------------------------------
/CRLWebTest/Code/MemberManage.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Web;
5 |
6 | namespace WebTest.Code
7 | {
8 | public class MemberManage : CRL.BaseProvider
9 | {
10 | public static MemberManage ContextInstance(CRL.BaseProvider baseProvider) where T : CRL.IModel, new()
11 | {
12 | var instance = Instance;
13 | instance.SetContext(baseProvider);
14 | return instance;
15 | }
16 |
17 | ///
18 | /// 实例访问入口
19 | ///
20 | public static MemberManage Instance
21 | {
22 | get { return new MemberManage(); }
23 | }
24 | }
25 | }
--------------------------------------------------------------------------------
/CRLWebTest/Code/Order.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Web;
5 |
6 | namespace WebTest.Code
7 | {
8 | [CRL.Attribute.Table(TableName = "OrderMain")]//重新指定对应的表名
9 | public class Order : CRL.Order.IOrder
10 | {
11 | //新增Channel属性
12 | public string Channel
13 | {
14 | get;
15 | set;
16 | }
17 |
18 | }
19 | }
--------------------------------------------------------------------------------
/CRLWebTest/Code/Setting.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Web;
5 | using System.Diagnostics;
6 | namespace WebTest.Code
7 | {
8 | public class Setting
9 | {
10 | public static string GetVersion()
11 | {
12 | return CRL.Base.GetVersion().ToString();
13 | string path = HttpContext.Current.Server.MapPath("/bin/CRL.dll");
14 | FileVersionInfo myFileVersion = FileVersionInfo.GetVersionInfo(path);
15 | return myFileVersion.FileVersion;
16 |
17 | }
18 | }
19 | }
--------------------------------------------------------------------------------
/CRLWebTest/Code/TransactionManage.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Web;
5 |
6 | namespace WebTest.Code
7 | {
8 | ///
9 | /// 交易流水管理
10 | ///
11 | public class TransactionManage : CRL.Account.TransactionBusiness
12 | {
13 | public static TransactionManage Instance
14 | {
15 | get { return new TransactionManage(); }
16 | }
17 | protected override CRL.DBExtend dbHelper
18 | {
19 | get { return GetDbHelper(this.GetType()); }
20 | }
21 | }
22 | }
--------------------------------------------------------------------------------
/CRLWebTest/DBConnection/Default.config:
--------------------------------------------------------------------------------
1 | Data Source=192.168.1.222;Initial Catalog=RoleAuthorize;User ID=sa;Password=server@dj888;
--------------------------------------------------------------------------------
/CRLWebTest/DBConnection/Default1.config:
--------------------------------------------------------------------------------
1 | Data Source=127.0.0.1;Initial Catalog=testDB;User ID=sa;Password=123
--------------------------------------------------------------------------------
/CRLWebTest/Default.aspx.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Diagnostics;
4 | using System.Linq;
5 | using System.Web;
6 | using System.Web.UI;
7 | using System.Web.UI.WebControls;
8 | //using CRL;
9 | namespace WebTest
10 | {
11 | public partial class Default : System.Web.UI.Page
12 | {
13 | protected void Page_Load(object sender, EventArgs e)
14 | {
15 |
16 | }
17 |
18 |
19 | protected void Button1_Click(object sender, EventArgs e)
20 | {
21 | //创建表
22 | Code.ProductDataManage.Instance.CreateTable();
23 | Code.AccountManage.Instance.CreateTable();
24 | Code.TransactionManage.Instance.CreateTable();
25 | Code.OrderManage.Instance.CreateTable();
26 | Button3_Click(null, null);
27 | Response.Write("初始表结构完成" );
28 | }
29 |
30 | protected void Button2_Click(object sender, EventArgs e)
31 | {
32 | string file = Server.MapPath("data.xml");
33 | Code.ProductDataManage.Instance.ExportToFile(file, b => b.Id > 0);
34 | Response.Write("导出文件为:" + file);
35 | }
36 |
37 | protected void Button3_Click(object sender, EventArgs e)
38 | {
39 | string file = Server.MapPath("data.xml");
40 | Code.ProductDataManage.Instance.ImportFromFile(file, b => b.Id > 0);
41 | Response.Write("成功导入文件:" + file);
42 | }
43 | }
44 | }
--------------------------------------------------------------------------------
/CRLWebTest/Default.aspx.designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | // <自动生成>
3 | // 此代码由工具生成。
4 | //
5 | // 对此文件的更改可能会导致不正确的行为,并且如果
6 | // 重新生成代码,这些更改将会丢失。
7 | // 自动生成>
8 | //------------------------------------------------------------------------------
9 |
10 | namespace WebTest {
11 |
12 |
13 | public partial class Default {
14 |
15 | ///
16 | /// Button1 控件。
17 | ///
18 | ///
19 | /// 自动生成的字段。
20 | /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
21 | ///
22 | protected global::System.Web.UI.WebControls.Button Button1;
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/CRLWebTest/Global.asax:
--------------------------------------------------------------------------------
1 | <%@ Application Codebehind="Global.asax.cs" Inherits="WebTest.Global" Language="C#" %>
2 |
--------------------------------------------------------------------------------
/CRLWebTest/Page/About.aspx:
--------------------------------------------------------------------------------
1 | <%@ Page Title="" Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="true" CodeBehind="About.aspx.cs" Inherits="WebTest.About" %>
2 |
3 |
4 |
5 |
6 | 当前版本 CRL<%=WebTest.Code.Setting.GetVersion() %>
7 | 暂不发布源码,想深入理解请反编译了解,或留言讨论
8 | 版本更新请关注:http://www.cnblogs.com/hubro
9 |
10 | QQ群:1582632
11 |
12 | 有好的意见或建议请邮箱:hubro@163.com
13 |
14 | 最后编译时间 2015-03-03
15 |
16 |
17 |
--------------------------------------------------------------------------------
/CRLWebTest/Page/About.aspx.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Web;
5 | using System.Web.UI;
6 | using System.Web.UI.WebControls;
7 |
8 | namespace WebTest
9 | {
10 | public partial class About : System.Web.UI.Page
11 | {
12 | protected void Page_Load(object sender, EventArgs e)
13 | {
14 |
15 | }
16 | }
17 | }
--------------------------------------------------------------------------------
/CRLWebTest/Page/About.aspx.designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | // <自动生成>
3 | // 此代码由工具生成。
4 | //
5 | // 对此文件的更改可能会导致不正确的行为,并且如果
6 | // 重新生成代码,这些更改将会丢失。
7 | // 自动生成>
8 | //------------------------------------------------------------------------------
9 |
10 | namespace WebTest {
11 |
12 |
13 | public partial class About {
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/CRLWebTest/Page/AutoSp.aspx:
--------------------------------------------------------------------------------
1 | <%@ Page Title="" Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="true" CodeBehind="AutoSp.aspx.cs" Inherits="WebTest.AutoSp" %>
2 |
3 |
4 |
5 | 以下演示了将标准查询或SQL语句动态编译成存储过程
6 |
7 | 对应的数据库帐号需要有创建存储过程的权限
8 | 以下查询会成成类似 ZautoSp_1E719B3EE5AFF6F4 的储储过程,删除后再查询时会自动生成
9 |
10 |
11 |
12 | var query = Code.ProductDataManage.Instance.GetLamadaQuery();
13 | //会按条件不同创建不同的存储过程
14 | query = query.Where(b => b.Id < 700);
15 | string name = Request["name"];
16 | if (!string.IsNullOrEmpty(name))
17 | {
18 | query = query.Where(b => b.InterFaceUser == name);
19 | }
20 | var list = Code.ProductDataManage.Instance.QueryList(query, compileSp: true);
21 |
22 |
23 |
24 | var helper = dbHelper;
25 | string sql = "select * from ProductData where datediff(d,addtime,@date)=0";
26 | helper.AddParam("date", date);
27 | return helper.AutoSpQuery(sql);
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/CRLWebTest/Page/AutoSp.aspx.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Web;
5 | using System.Web.UI;
6 | using System.Web.UI.WebControls;
7 | using CRL;
8 | namespace WebTest
9 | {
10 | public partial class AutoSp : System.Web.UI.Page
11 | {
12 | protected void Page_Load(object sender, EventArgs e)
13 | {
14 | }
15 | //对应的数据库帐号需要有创建存储过程的权限
16 | //以下查询会成成类似 ZautoSp_1E719B3EE5AFF6F4 的储储过程,删除后再查询时会自动生成
17 | protected void Button1_Click(object sender, EventArgs e)
18 | {
19 | var query = Code.ProductDataManage.Instance.GetLamadaQuery();
20 | //会按条件不同创建不同的存储过程
21 | query = query.Where(b => b.Id < 700);
22 | string name = Request["name"];
23 | if (!string.IsNullOrEmpty(name))
24 | {
25 | query = query.Where(b => b.InterFaceUser == name);
26 | }
27 | var list = Code.ProductDataManage.Instance.QueryList(query, compileSp: true);
28 | }
29 |
30 | protected void Button2_Click(object sender, EventArgs e)
31 | {
32 | Code.ProductDataManage.Instance.QueryDayProduct(DateTime.Parse("2014-06-23"));
33 | }
34 | }
35 | }
--------------------------------------------------------------------------------
/CRLWebTest/Page/AutoSp.aspx.designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | // <自动生成>
3 | // 此代码由工具生成。
4 | //
5 | // 对此文件的更改可能会导致不正确的行为,并且如果
6 | // 重新生成代码,这些更改将会丢失。
7 | // 自动生成>
8 | //------------------------------------------------------------------------------
9 |
10 | namespace WebTest {
11 |
12 |
13 | public partial class AutoSp {
14 |
15 | ///
16 | /// Button1 控件。
17 | ///
18 | ///
19 | /// 自动生成的字段。
20 | /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
21 | ///
22 | protected global::System.Web.UI.WebControls.Button Button1;
23 |
24 | ///
25 | /// Button2 控件。
26 | ///
27 | ///
28 | /// 自动生成的字段。
29 | /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
30 | ///
31 | protected global::System.Web.UI.WebControls.Button Button2;
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/CRLWebTest/Page/Cache.aspx.designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | // <自动生成>
3 | // 此代码由工具生成。
4 | //
5 | // 对此文件的更改可能会导致不正确的行为,并且如果
6 | // 重新生成代码,这些更改将会丢失。
7 | // 自动生成>
8 | //------------------------------------------------------------------------------
9 |
10 | namespace WebTest {
11 |
12 |
13 | public partial class Cache {
14 |
15 | ///
16 | /// Button1 控件。
17 | ///
18 | ///
19 | /// 自动生成的字段。
20 | /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
21 | ///
22 | protected global::System.Web.UI.WebControls.Button Button1;
23 |
24 | ///
25 | /// Button2 控件。
26 | ///
27 | ///
28 | /// 自动生成的字段。
29 | /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
30 | ///
31 | protected global::System.Web.UI.WebControls.Button Button2;
32 |
33 | ///
34 | /// Button3 控件。
35 | ///
36 | ///
37 | /// 自动生成的字段。
38 | /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
39 | ///
40 | protected global::System.Web.UI.WebControls.Button Button3;
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/CRLWebTest/Page/Cache2.aspx.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Diagnostics;
4 | using System.Linq;
5 | using System.Web;
6 | using System.Web.UI;
7 | using System.Web.UI.WebControls;
8 |
9 | namespace WebTest.Page
10 | {
11 | public partial class Cache2 : System.Web.UI.Page
12 | {
13 | protected void Page_Load(object sender, EventArgs e)
14 | {
15 |
16 | }
17 |
18 | protected void Button1_Click(object sender, EventArgs e)
19 | {
20 | Stopwatch sw = new Stopwatch();
21 | sw.Start();
22 | var item = Code.ProductDataManage.Instance.QueryItemFromAllCache(b => b.Id > 0 && b.ProductName.Contains("product"));
23 | sw.Stop();
24 |
25 | Response.Write(string.Format("Compile:{0} value:{1}", sw.ElapsedMilliseconds, item.Number));
26 | }
27 |
28 | protected void Button2_Click(object sender, EventArgs e)
29 | {
30 | var item = Code.ProductDataManage.Instance.QueryItem(b => b.Id > 0);
31 | item.Number = DateTime.Now.Second;
32 | Code.ProductDataManage.Instance.Update(item);
33 | //CRL.CacheServerSetting.CacheClientProxy.GetServerTypeSetting();
34 | }
35 | }
36 | }
--------------------------------------------------------------------------------
/CRLWebTest/Page/Cache2.aspx.designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | // <自动生成>
3 | // 此代码由工具生成。
4 | //
5 | // 对此文件的更改可能会导致不正确的行为,并且如果
6 | // 重新生成代码,这些更改将会丢失。
7 | // 自动生成>
8 | //------------------------------------------------------------------------------
9 |
10 | namespace WebTest.Page {
11 |
12 |
13 | public partial class Cache2 {
14 |
15 | ///
16 | /// Button1 控件。
17 | ///
18 | ///
19 | /// 自动生成的字段。
20 | /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
21 | ///
22 | protected global::System.Web.UI.WebControls.Button Button1;
23 |
24 | ///
25 | /// Button2 控件。
26 | ///
27 | ///
28 | /// 自动生成的字段。
29 | /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
30 | ///
31 | protected global::System.Web.UI.WebControls.Button Button2;
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/CRLWebTest/Page/CacheManage.aspx.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Web;
5 | using System.Web.UI;
6 | using System.Web.UI.WebControls;
7 |
8 | namespace WebTest.Page
9 | {
10 | public partial class CacheManage : System.Web.UI.Page
11 | {
12 | public List caches=new List();
13 | protected void Page_Load(object sender, EventArgs e)
14 | {
15 | if (Request["type"] == "update")
16 | {
17 | Update();
18 | Response.End();
19 | }
20 | var all = Code.ProductDataManage.Instance.AllCache;//调用缓存,让它生成
21 | caches = CRL.MemoryDataCache.GetCacheList();
22 | }
23 | void Update()
24 | {
25 | string key = Request["key"];
26 | var time = DateTime.Now;
27 | var a = CRL.MemoryDataCache.UpdateCache(key);
28 | var ts = DateTime.Now - time;
29 | var str = string.Format("更新 {0},用时 {1}", a, ts);
30 | Response.Write(str);
31 | }
32 | }
33 | }
--------------------------------------------------------------------------------
/CRLWebTest/Page/CacheManage.aspx.designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | // <自动生成>
3 | // 此代码由工具生成。
4 | //
5 | // 对此文件的更改可能会导致不正确的行为,并且如果
6 | // 重新生成代码,这些更改将会丢失。
7 | // 自动生成>
8 | //------------------------------------------------------------------------------
9 |
10 | namespace WebTest.Page {
11 |
12 |
13 | public partial class CacheManage {
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/CRLWebTest/Page/CacheServer.ashx:
--------------------------------------------------------------------------------
1 | <%@ WebHandler Language="C#" CodeBehind="CacheServer.ashx.cs" Class="WebTest.Page.CacheServer" %>
2 |
--------------------------------------------------------------------------------
/CRLWebTest/Page/CacheServer.ashx.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Web;
5 |
6 | namespace WebTest.Page
7 | {
8 | ///
9 | /// CacheServer 的摘要说明
10 | ///
11 | public class CacheServer : IHttpHandler
12 | {
13 |
14 | public void ProcessRequest(HttpContext context)
15 | {
16 | context.Response.ContentType = "text/plain";
17 | string q = context.Request["q"];
18 |
19 | }
20 |
21 | public bool IsReusable
22 | {
23 | get
24 | {
25 | return false;
26 | }
27 | }
28 | }
29 | }
--------------------------------------------------------------------------------
/CRLWebTest/Page/DataVerification.aspx:
--------------------------------------------------------------------------------
1 | <%@ Page Title="" Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="true" CodeBehind="DataVerification.aspx.cs" Inherits="WebTest.DataVerification" %>
2 |
3 |
4 |
5 | 以下演示了数据有效性检测
6 |
7 | 数据校验可以保证数据在插入或更新不符合规则时,终止操作,保证数据完整性
8 |
区别于前台验证,能实现业务逻辑验证,更灵活
9 |
10 |
11 |
12 | //ProductData 限定了 BarCode不能为空
13 | public override string CheckData()
14 | {
15 | if (string.IsNullOrEmpty(BarCode))
16 | {
17 | return "BarCode不能为空";
18 | }
19 | if (Number < 0)
20 | {
21 | return "Number不能小于0";
22 | }
23 | return "";
24 | }
25 |
26 | //这里设为空,提交时会抛出异常
27 | var item = new Code.ProductData() { InterFaceUser = "2222", ProductName = "product2", BarCode = "" };
28 | var msg = item.CheckData();
29 | if (!string.IsNullOrEmpty(msg))//手动判断对象数据是否合法
30 | {
31 | Response.Write(msg);
32 | }
33 | try
34 | {
35 | Code.ProductDataManage.Instance.Add(item);
36 | }
37 | catch(Exception ero)//捕获异常
38 | {
39 | Response.Write(ero.Message);
40 | }
41 |
42 |
43 |
--------------------------------------------------------------------------------
/CRLWebTest/Page/DataVerification.aspx.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Web;
5 | using System.Web.UI;
6 | using System.Web.UI.WebControls;
7 |
8 | namespace WebTest
9 | {
10 | public partial class DataVerification : System.Web.UI.Page
11 | {
12 | protected void Page_Load(object sender, EventArgs e)
13 | {
14 |
15 | }
16 |
17 | protected void Button1_Click(object sender, EventArgs e)
18 | {
19 | //ProductData 限定了 BarCode不能为空
20 | //这里设为空,提交时会抛出异常
21 | var item = new Code.ProductData() { InterFaceUser = "2222", ProductName = "product2", BarCode = "" };
22 | var msg = item.CheckData();
23 | if (!string.IsNullOrEmpty(msg))//手动判断对象数据是否合法
24 | {
25 | Response.Write(msg);
26 | }
27 | try
28 | {
29 | Code.ProductDataManage.Instance.Add(item);
30 | }
31 | catch(Exception ero)//捕获异常
32 | {
33 | Response.Write(ero.Message);
34 | }
35 | }
36 | }
37 | }
--------------------------------------------------------------------------------
/CRLWebTest/Page/DataVerification.aspx.designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | // <自动生成>
3 | // 此代码由工具生成。
4 | //
5 | // 对此文件的更改可能会导致不正确的行为,并且如果
6 | // 重新生成代码,这些更改将会丢失。
7 | // 自动生成>
8 | //------------------------------------------------------------------------------
9 |
10 | namespace WebTest {
11 |
12 |
13 | public partial class DataVerification {
14 |
15 | ///
16 | /// Button1 控件。
17 | ///
18 | ///
19 | /// 自动生成的字段。
20 | /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
21 | ///
22 | protected global::System.Web.UI.WebControls.Button Button1;
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/CRLWebTest/Page/Delete.aspx:
--------------------------------------------------------------------------------
1 | <%@ Page Title="" Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="true" CodeBehind="Delete.aspx.cs" Inherits="WebTest.Delete" %>
2 |
3 |
4 |
5 | 以下演示了如何删除
6 |
7 |
8 | Code.ProductDataManage.Instance.Delete(b => b.Id == 0);//按条件删除
9 | Code.ProductDataManage.Instance.DeleteById(1);//按主键删除
10 |
11 |
12 |
--------------------------------------------------------------------------------
/CRLWebTest/Page/Delete.aspx.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Web;
5 | using System.Web.UI;
6 | using System.Web.UI.WebControls;
7 |
8 | namespace WebTest
9 | {
10 | public partial class Delete : System.Web.UI.Page
11 | {
12 | protected void Page_Load(object sender, EventArgs e)
13 | {
14 |
15 | }
16 |
17 | protected void Button1_Click(object sender, EventArgs e)
18 | {
19 | Code.ProductDataManage.Instance.Delete(b => b.Id == 0);//按条件删除
20 | Code.ProductDataManage.Instance.DeleteById(1);//按主键删除
21 | }
22 |
23 | protected void Button1_Click1(object sender, EventArgs e)
24 | {
25 |
26 | }
27 | }
28 | }
--------------------------------------------------------------------------------
/CRLWebTest/Page/Delete.aspx.designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | // <自动生成>
3 | // 此代码由工具生成。
4 | //
5 | // 对此文件的更改可能会导致不正确的行为,并且如果
6 | // 重新生成代码,这些更改将会丢失。
7 | // 自动生成>
8 | //------------------------------------------------------------------------------
9 |
10 | namespace WebTest {
11 |
12 |
13 | public partial class Delete {
14 |
15 | ///
16 | /// Button1 控件。
17 | ///
18 | ///
19 | /// 自动生成的字段。
20 | /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
21 | ///
22 | protected global::System.Web.UI.WebControls.Button Button1;
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/CRLWebTest/Page/ExportAndImport.aspx:
--------------------------------------------------------------------------------
1 | <%@ Page Title="" Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="true" CodeBehind="ExportAndImport.aspx.cs" Inherits="WebTest.ExportAndImport" %>
2 |
3 |
4 |
5 | 以下演示了如何导出/导入数据
6 |
7 |
8 | string file = Server.MapPath("/data.xml");
9 | Code.ProductDataManage.Instance.ExportToFile(file, b => b.Id > 0);//导出到文件
10 | Response.Write("成功导出到文件:" + file);
11 | var xml = Code.ProductDataManage.Instance.ExportToXml(b => b.Id > 0);//导出为字符串
12 |
13 |
14 |
15 | string file = Server.MapPath("/data.xml");
16 | Code.ProductDataManage.Instance.ImportFromFile(file, b => b.Id > 0);//从文件中导入
17 | Response.Write("成功从文件导入:" + file);
18 | //Code.ProductDataManage.Instance.ImportFromXml("", b => b.Id > 0);//从XML序列化字符串导入
19 |
20 |
21 |
--------------------------------------------------------------------------------
/CRLWebTest/Page/ExportAndImport.aspx.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Web;
5 | using System.Web.UI;
6 | using System.Web.UI.WebControls;
7 |
8 | namespace WebTest
9 | {
10 | public partial class ExportAndImport : System.Web.UI.Page
11 | {
12 | protected void Page_Load(object sender, EventArgs e)
13 | {
14 |
15 | }
16 |
17 | protected void Button1_Click(object sender, EventArgs e)
18 | {
19 |
20 | string file = Server.MapPath("/data.xml");
21 | Code.ProductDataManage.Instance.ExportToFile(file, b => b.Id > 0);//导出到文件
22 | Response.Write("成功导出到文件:" + file);
23 | var xml = Code.ProductDataManage.Instance.ExportToXml(b => b.Id > 0);//导出为字符串
24 | }
25 |
26 | protected void Button2_Click(object sender, EventArgs e)
27 | {
28 | string file = Server.MapPath("/data.xml");
29 | Code.ProductDataManage.Instance.ImportFromFile(file, b => b.Id > 0);//从文件中导入
30 | Response.Write("成功从文件导入:" + file);
31 | //Code.ProductDataManage.Instance.ImportFromXml("", b => b.Id > 0);//从XML序列化字符串导入
32 | }
33 | }
34 | }
--------------------------------------------------------------------------------
/CRLWebTest/Page/ExportAndImport.aspx.designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | // <自动生成>
3 | // 此代码由工具生成。
4 | //
5 | // 对此文件的更改可能会导致不正确的行为,并且如果
6 | // 重新生成代码,这些更改将会丢失。
7 | // 自动生成>
8 | //------------------------------------------------------------------------------
9 |
10 | namespace WebTest {
11 |
12 |
13 | public partial class ExportAndImport {
14 |
15 | ///
16 | /// Button1 控件。
17 | ///
18 | ///
19 | /// 自动生成的字段。
20 | /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
21 | ///
22 | protected global::System.Web.UI.WebControls.Button Button1;
23 |
24 | ///
25 | /// Button2 控件。
26 | ///
27 | ///
28 | /// 自动生成的字段。
29 | /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
30 | ///
31 | protected global::System.Web.UI.WebControls.Button Button2;
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/CRLWebTest/Page/ExportModelInfo.aspx:
--------------------------------------------------------------------------------
1 | <%@ Page Title="" Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="true" CodeBehind="ExportModelInfo.aspx.cs" Inherits="WebTest.ExportModelInfo" %>
2 |
3 |
4 |
5 | 以下演示了导出对象文档
6 |
7 | 在数据库里查看表结构,其实是非常不方便,在项目里同样
8 | 通过CRL里提供的方法,导出指定程序集的对象文档,对象结构一目了然
9 |
10 | 文档示例
11 | 
12 |
编译MODEL所在的DLL时,在项目属性=>生成 选中下面的框,生成XML文档
13 |
14 | XML文档地址/bin/WebTest.xml
15 |
16 |
17 |
18 |
19 | Type[] types = new Type[] { typeof(Code.ProductData) };
20 | string[] xmlFiles = new string[] { Server.MapPath(TextBox1.Text) };
21 | CRL.SummaryAnalysis.ExportToFile(types, xmlFiles);
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/CRLWebTest/Page/ExportModelInfo.aspx.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Web;
5 | using System.Web.UI;
6 | using System.Web.UI.WebControls;
7 |
8 | namespace WebTest
9 | {
10 | public partial class ExportModelInfo : System.Web.UI.Page
11 | {
12 | protected void Page_Load(object sender, EventArgs e)
13 | {
14 |
15 | }
16 |
17 | protected void Button1_Click(object sender, EventArgs e)
18 | {
19 | Type[] types = new Type[] { typeof(Code.ProductData) };
20 | string[] xmlFiles = new string[] { Server.MapPath(TextBox1.Text) };
21 | CRL.SummaryAnalysis.ExportToFile(types, xmlFiles);
22 | }
23 | }
24 | }
--------------------------------------------------------------------------------
/CRLWebTest/Page/ExportModelInfo.aspx.designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | // <自动生成>
3 | // 此代码由工具生成。
4 | //
5 | // 对此文件的更改可能会导致不正确的行为,并且如果
6 | // 重新生成代码,这些更改将会丢失。
7 | // 自动生成>
8 | //------------------------------------------------------------------------------
9 |
10 | namespace WebTest {
11 |
12 |
13 | public partial class ExportModelInfo {
14 |
15 | ///
16 | /// TextBox1 控件。
17 | ///
18 | ///
19 | /// 自动生成的字段。
20 | /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
21 | ///
22 | protected global::System.Web.UI.WebControls.TextBox TextBox1;
23 |
24 | ///
25 | /// Button1 控件。
26 | ///
27 | ///
28 | /// 自动生成的字段。
29 | /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
30 | ///
31 | protected global::System.Web.UI.WebControls.Button Button1;
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/CRLWebTest/Page/ExtensionMethod.aspx:
--------------------------------------------------------------------------------
1 | <%@ Page Title="" Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="true" CodeBehind="ExtensionMethod.aspx.cs" Inherits="WebTest.Page.Extension" %>
2 |
3 |
4 |
5 | 以下演示了如何使用扩展方法
6 |
7 |
8 | using CRL 以获取扩展方法
9 |
一些系统方法已经解析,不支持的方法将会抛出异常
10 | 目前只实现了MSSQL数据库
11 |
12 |
13 | var query = Code.ProductDataManage.Instance.GetLamadaQuery();
14 | query.Where(b => b.ProductName.Contains("122"));//包含字符串
15 | query.Where(b => b.ProductName.In("111", "222"));//string in
16 | query.Where(b => b.AddTime.Between(DateTime.Now, DateTime.Now));//在时间段内
17 | query.Where(b => b.AddTime.DateDiff(DatePart.dd, DateTime.Now) > 1);//时间比较
18 | query.Where(b => b.ProductName.Substring(0, 3) == "222");//截取字符串
19 | query.Where(b => b.Id.In(1, 2, 3));//in
20 | query.Where(b => b.Id.NotIn(1, 2, 3));//not in
21 | var list = Code.ProductDataManage.Instance.QueryList(query);
22 |
23 |
24 |
--------------------------------------------------------------------------------
/CRLWebTest/Page/ExtensionMethod.aspx.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Web;
5 | using System.Web.UI;
6 | using System.Web.UI.WebControls;
7 | using CRL;
8 | namespace WebTest.Page
9 | {
10 | public partial class Extension : System.Web.UI.Page
11 | {
12 | protected void Page_Load(object sender, EventArgs e)
13 | {
14 |
15 | }
16 |
17 | protected void Button1_Click(object sender, EventArgs e)
18 | {
19 | var query = Code.ProductDataManage.Instance.GetLamadaQuery();
20 | query.Where(b => b.ProductName.Contains("122"));//包含字符串
21 | query.Where(b => b.ProductName.In("111", "222"));//string in
22 | query.Where(b => b.AddTime.Between(DateTime.Now, DateTime.Now));//在时间段内
23 | query.Where(b => b.AddTime.DateDiff(DatePart.dd, DateTime.Now) > 1);//时间比较
24 | query.Where(b => b.ProductName.Substring(0, 3) == "222");//截取字符串
25 | query.Where(b => b.Id.In(1, 2, 3));//in
26 | query.Where(b => b.Id.NotIn(1, 2, 3));//not in
27 | var list = Code.ProductDataManage.Instance.QueryList(query);
28 | }
29 | }
30 | }
--------------------------------------------------------------------------------
/CRLWebTest/Page/ExtensionMethod.aspx.designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | // <自动生成>
3 | // 此代码由工具生成。
4 | //
5 | // 对此文件的更改可能会导致不正确的行为,并且如果
6 | // 重新生成代码,这些更改将会丢失。
7 | // 自动生成>
8 | //------------------------------------------------------------------------------
9 |
10 | namespace WebTest.Page {
11 |
12 |
13 | public partial class Extension {
14 |
15 | ///
16 | /// Button1 控件。
17 | ///
18 | ///
19 | /// 自动生成的字段。
20 | /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
21 | ///
22 | protected global::System.Web.UI.WebControls.Button Button1;
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/CRLWebTest/Page/Insert.aspx:
--------------------------------------------------------------------------------
1 | <%@ Page Title="" Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="true" CodeBehind="Insert.aspx.cs" Inherits="WebTest.Insert" %>
2 |
3 |
4 |
5 | 以下演示了如何插入记录
6 |
7 | 当数据库为MSSQL时,单个插入和批量插入实现不一样,单个插入为SQL语法,批量为SqlBulkCopy
8 | 此时批量没有事务控制,效率也最高,其它数据库暂没类似功能
9 |
10 |
11 |
12 | var item = new Code.ProductData() { InterFaceUser = "2222", ProductName = "product2", BarCode = "1212122" };
13 | Code.ProductDataManage.Instance.Add(item);
14 |
15 |
16 |
17 | var list = new List<Code.ProductData>();
18 | list.Add(new Code.ProductData() { InterFaceUser = "2222", ProductName = "product2", BarCode = "1212122" });
19 | list.Add(new Code.ProductData() { InterFaceUser = "2222", ProductName = "product3", BarCode = "21312313" });
20 | Code.ProductDataManage.Instance.BatchInsert(list);
21 |
22 |
23 |
--------------------------------------------------------------------------------
/CRLWebTest/Page/Insert.aspx.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Web;
5 | using System.Web.UI;
6 | using System.Web.UI.WebControls;
7 |
8 | namespace WebTest
9 | {
10 | public partial class Insert : System.Web.UI.Page
11 | {
12 | protected void Page_Load(object sender, EventArgs e)
13 | {
14 | var count = Code.ProductDataManage.Instance.Count(b => b.Id > 0);
15 | Response.Write(count);
16 | }
17 |
18 | protected void Button1_Click(object sender, EventArgs e)
19 | {
20 | var item = new Code.ProductData() { InterFaceUser = "2222", ProductName = "product2", BarCode = "1212122" };
21 |
22 | Code.ProductDataManage.Instance.Add(item);
23 | }
24 |
25 | protected void Button2_Click(object sender, EventArgs e)
26 | {
27 | var list = new List();
28 | for (int i = 1; i < 1000; i++)
29 | {
30 | list.Add(new Code.ProductData() { InterFaceUser = "2222", ProductName = "product" + i, BarCode = "code" + i });
31 | }
32 | Code.ProductDataManage.Instance.BatchInsert(list);
33 | }
34 | }
35 | }
--------------------------------------------------------------------------------
/CRLWebTest/Page/Insert.aspx.designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | // <自动生成>
3 | // 此代码由工具生成。
4 | //
5 | // 对此文件的更改可能会导致不正确的行为,并且如果
6 | // 重新生成代码,这些更改将会丢失。
7 | // 自动生成>
8 | //------------------------------------------------------------------------------
9 |
10 | namespace WebTest {
11 |
12 |
13 | public partial class Insert {
14 |
15 | ///
16 | /// Button1 控件。
17 | ///
18 | ///
19 | /// 自动生成的字段。
20 | /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
21 | ///
22 | protected global::System.Web.UI.WebControls.Button Button1;
23 |
24 | ///
25 | /// Button2 控件。
26 | ///
27 | ///
28 | /// 自动生成的字段。
29 | /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
30 | ///
31 | protected global::System.Web.UI.WebControls.Button Button2;
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/CRLWebTest/Page/Model.aspx.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Web;
5 | using System.Web.UI;
6 | using System.Web.UI.WebControls;
7 |
8 | namespace WebTest.Page
9 | {
10 | public partial class Model : System.Web.UI.Page
11 | {
12 | protected void Page_Load(object sender, EventArgs e)
13 | {
14 |
15 | }
16 | }
17 | }
--------------------------------------------------------------------------------
/CRLWebTest/Page/Model.aspx.designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | // <自动生成>
3 | // 此代码由工具生成。
4 | //
5 | // 对此文件的更改可能会导致不正确的行为,并且如果
6 | // 重新生成代码,这些更改将会丢失。
7 | // 自动生成>
8 | //------------------------------------------------------------------------------
9 |
10 | namespace WebTest.Page {
11 |
12 |
13 | public partial class Model {
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/CRLWebTest/Page/OrderTest.aspx:
--------------------------------------------------------------------------------
1 | <%@ Page Title="" Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="true" CodeBehind="OrderTest.aspx.cs" Inherits="WebTest.OrderTest" %>
2 |
3 |
4 |
5 | 以下演示了如何继承实现业务
6 |
7 |
8 |
9 | var order = new Code.Order() { UserId = "1", Remark = "test" };
10 | order.Channel = "channel1";//Channel是新增加的属性
11 | //通过继承实现新增业务,不需要再写提交订单方法
12 | Code.OrderManage.Instance.SubmitOrder(order);
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/CRLWebTest/Page/OrderTest.aspx.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Web;
5 | using System.Web.UI;
6 | using System.Web.UI.WebControls;
7 |
8 | namespace WebTest
9 | {
10 | public partial class OrderTest : System.Web.UI.Page
11 | {
12 | protected void Page_Load(object sender, EventArgs e)
13 | {
14 |
15 | }
16 |
17 | protected void Button1_Click(object sender, EventArgs e)
18 | {
19 | var order = new Code.Order() { UserId = "1", Remark = "test" };
20 | order.Channel = "channel1";//Channel是新增加的属性
21 | //通过继承实现新增业务,不需要再写提交订单方法
22 | Code.OrderManage.Instance.SubmitOrder(order);
23 | }
24 | }
25 | }
--------------------------------------------------------------------------------
/CRLWebTest/Page/OrderTest.aspx.designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | // <自动生成>
3 | // 此代码由工具生成。
4 | //
5 | // 对此文件的更改可能会导致不正确的行为,并且如果
6 | // 重新生成代码,这些更改将会丢失。
7 | // 自动生成>
8 | //------------------------------------------------------------------------------
9 |
10 | namespace WebTest {
11 |
12 |
13 | public partial class OrderTest {
14 |
15 | ///
16 | /// Button1 控件。
17 | ///
18 | ///
19 | /// 自动生成的字段。
20 | /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
21 | ///
22 | protected global::System.Web.UI.WebControls.Button Button1;
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/CRLWebTest/Page/Pager.aspx.designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | // <自动生成>
3 | // 此代码由工具生成。
4 | //
5 | // 对此文件的更改可能会导致不正确的行为,并且如果
6 | // 重新生成代码,这些更改将会丢失。
7 | // 自动生成>
8 | //------------------------------------------------------------------------------
9 |
10 | namespace WebTest.Page {
11 |
12 |
13 | public partial class Pager {
14 |
15 | ///
16 | /// Button3 控件。
17 | ///
18 | ///
19 | /// 自动生成的字段。
20 | /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
21 | ///
22 | protected global::System.Web.UI.WebControls.Button Button3;
23 |
24 | ///
25 | /// Button2 控件。
26 | ///
27 | ///
28 | /// 自动生成的字段。
29 | /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
30 | ///
31 | protected global::System.Web.UI.WebControls.Button Button2;
32 |
33 | ///
34 | /// Button4 控件。
35 | ///
36 | ///
37 | /// 自动生成的字段。
38 | /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
39 | ///
40 | protected global::System.Web.UI.WebControls.Button Button4;
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/CRLWebTest/Page/Query1.aspx:
--------------------------------------------------------------------------------
1 | <%@ Page Title="" Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="true" CodeBehind="Query1.aspx.cs" Inherits="WebTest.Query1" %>
2 |
3 |
4 |
5 | 以下演示了标准查询
6 |
7 |
8 |
9 | //查询一项
10 | var item = Code.ProductDataManage.Instance.QueryItem(b => b.Id >0);
11 |
12 |
13 |
14 | //查询集合
15 | var list = Code.ProductDataManage.Instance.QueryList(b => b.Id < 650);
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/CRLWebTest/Page/Query1.aspx.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Web;
5 | using System.Web.UI;
6 | using System.Web.UI.WebControls;
7 |
8 | namespace WebTest
9 | {
10 | public partial class Query1 : System.Web.UI.Page
11 | {
12 | protected void Page_Load(object sender, EventArgs e)
13 | {
14 |
15 | }
16 |
17 | protected void Button1_Click(object sender, EventArgs e)
18 | {
19 | //查询一项
20 | var item = Code.ProductDataManage.Instance.QueryItem(b => b.Id > 0 && b.Number == 0);
21 |
22 | GridView1.DataSource = new List