随笔分类 - ASP.NET
摘要:public AController() { ViewBag["Class"] = GetClass(0); } private List<BlogsClass> GetClass(int parentId) { List<BlogsClass> list; //查询出分类 尼玛每次都得查,很烦!
阅读全文
摘要:[ServiceContract] public interface IUser { [OperationContract(Name="ByUseId")] User GetUser(int id); [OperationContract(Name="ByUserEmail")] User GetU
阅读全文
摘要:using System;using System.Collections.Generic;using System.Linq;using System.Data;using System.Data.SqlClient;using System.Web;using Model.Enum;/// ///UserPurview 的摘要说明:用户权限/// public class UserPurview : System.Web.UI.Page{ #region 获取用户是否拥有权限 /// /// 获取用户是否拥有权限,传入权限枚举 (与运算) /// //...
阅读全文
摘要:Select()Select(string filterExpression)Select(string filterExpression, string sort)Select(string filterExpression,string sort, DataViewRowState record States)。1) Select()——获取所有 System.Data.DataRow 对象的数组。2) Select(string filterExpression)——按照主键顺序(如果没有主键,则按照添加顺序)获取与筛选条件相匹配的所有 System.Data.DataRow 对象的数组
阅读全文
摘要:/// <summary> /// 获取客户网站发件箱信息 /// </summary> /// <returns></returns> public static ECustomerMailServer GetCustomerMailServer() { ECustomerMailServer _ECustomerMailServer = null; if (HttpContext.Current.Cache["CustomerMailServer"] == null) { int CID ...
阅读全文
摘要:1.声明用户自定义表类型CREATE TYPE [dbo].[pmodelTable] AS TABLE( [pmodel] [varchar](60) NULL --要传入的列)GO2.存储过程中使用自定义表类型create proc P_GetPmidByPmodel(@pmodel pmodelTable readonly --自定义的表类型)asbegin select pmid from V_ProductModel v inner join @pmodel p on v.pmodel=p.pmodelendgo3.测试效果declare @table as pm...
阅读全文
摘要:提示: 错误 1 类型“System.Web.Mvc.ModelClientValidationRule”同时存在于“C:\Program Files\Microsoft ASP.NET\ASP.NET MVC 3\Assemblies\System.Web.Mvc.dll”和“C:\Program
阅读全文
摘要:#region 获取标准北京时间 ///<summary> /// 获取标准北京时间 ///</summary> ///<returns></returns> public static DateTime GetStandardTime() { //<?xml version="1.0" encoding="GB2312" ?> //- <ntsc> //- <time> // <year>2011</year> ...
阅读全文
摘要:public static class Common {/// <summary> /// 密钥 /// </summary> public static string key = "@#$!"; #region 解密 /// <summary> /// 解密 /// </summary> /// <param name="str"></param> /// <param name="key"></param> /// <return
阅读全文
摘要:public static class ChineseToPinYin { private static readonly Dictionary<int, string> CodeCollections = new Dictionary<int, string> { { -20319, "a" }, { -20317, "ai" }, { -20304, "an" }, { -20295, "ang" }, { -20292, "ao" }, { -20
阅读全文
摘要:通常情况下,我们为了从一个页面传递某些数据到另外一个页面,总是喜欢用 URL参数或者Seesion来实现。但在数据量特别大的情况下,这两种方式明显就不合适宜,这意味着我们要写很多的URL参数或者是Seesion变量来保存数据。但在学习《Professional ASP.NET 3.5 SP1 Edition in C# and VB》的过程中我发现还有一些我不知道的其它方法可以实现。我觉的有必要与大家一起分享,与是决定写下这篇笔记。在asp时代,我们经常使用跨页面传递的方式传输数据,但当我们进入到ASP.NET时代后却发现这种方式基本无法继续延续了。这不禁让我们在某些时候怀念ASP的灵活性了,
阅读全文
摘要:public static string ClientIP() { string result = String.Empty; result = HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"]; if (result != null && result != String.Empty) { //可能有代理 if (result.IndexOf(".") == -1) //没有“.”肯定是非...
阅读全文
摘要:只要参数是值类型 就会自动 给我多加对应的布尔型参数而引用类型的没问题 查来查去 发现是 WCF 默认序列化 (接口中)用的是 DataContractSerializer把 接口中 默认的DataContractSerializer(隐藏的)换成XmlSerializerFormat 即可
阅读全文
摘要:/// <summary> /// {table:[{column1:1,column2:2,column3:3},{column1:1,column2:2,column3:3}]} /// </summary> /// <param name="strJson">Json字符串</param> /// <returns></returns> public static DataTable JsonToDataTable(string strJson) { ...
阅读全文
摘要:数据页面代码View Code #region 将table转换为json /// <summary> /// 将table转换为json /// </summary> /// <param name="dt"></param> /// <returns></returns> public string ConvertDataTableToJson(DataTable dt) { StringBuilder sbs = new StringBuilder(); if (dt.Rows.Count >
阅读全文

浙公网安备 33010602011771号