随笔分类 -  C#.NET

1 2 下一页
让你的.NET程序支持多语言
摘要:辛辛苦苦做出来的软件,我们当然希望能让更多的人用,支持多语言是必须的。下面我将以Asp.net Web Form为例来介绍如何支持多语言。其他程序比如windows程序,过程都是大同小异的。大概分以下几个步骤:生成默认资源文件,翻译资源文件。写一点代码实现语言切换一些高级话题。例子总是简单的,真实项... 阅读全文
posted @ 2014-07-31 18:18 cw_volcano 阅读(1008) 评论(0) 推荐(0)
在文件中读取、存储Json格式的字符串
摘要:public class Weather { static readonly string FilePath = System.Environment.CurrentDirectory + @"\Area.txt"; public static Models.Are... 阅读全文
posted @ 2014-06-16 11:49 cw_volcano 阅读(518) 评论(0) 推荐(0)
文件写操作--WriteLog
摘要:private static void Write(string sMsg, string fileName) { if (sMsg != "") { try { var dir = new FileInfo(Assembly.GetEntryAssembly().Location).DirectoryName + "\\log\\"; if (!Directory.Exists(dir)) ... 阅读全文
posted @ 2014-03-12 22:10 cw_volcano 阅读(521) 评论(0) 推荐(0)
Enum 枚举
摘要:一:1.foreach (int val in Enum.GetValues(typeof(AppEnum.HarbourStatus))){ ddlStatus.Items.Add(new ListItem(Enum.GetName(typeof(AppEnum.HarbourStatus), val), val.ToString()));}ddlStatus.Items.FindByText(AppEnum.HarbourStatus.Avtal.ToString()).Selected = true;2.public enum HarbourStatus{ ... 阅读全文
posted @ 2014-02-25 11:37 cw_volcano 阅读(336) 评论(0) 推荐(0)
XML新增、修改、选择
摘要:using System;using System.Linq;using System.Xml.Linq;using DFS.Kiosk.Provider.Simulator.Common.Utilities;using DFS.Kiosk.Provider.Simulators.Utilities... 阅读全文
posted @ 2014-02-20 09:51 cw_volcano 阅读(360) 评论(0) 推荐(0)
ASP.NET返回Json数据
摘要:Schedule.ashx:using System;using System.Data;using System.Text;using System.Web;using System.Web.Script.Serialization;public class Schedule : IHttpHandler { public void ProcessRequest (HttpContext context) { context.Response.ContentType = "application/json;charset=utf-8"; //Java... 阅读全文
posted @ 2013-08-30 14:59 cw_volcano 阅读(2023) 评论(0) 推荐(0)
Excel和XML文件导入
摘要:using System;using System.Collections;using System.Collections.Generic;using System.Configuration;using System.Data;using System.Data.OleDb;using System.Data.SqlClient;using System.IO;using System.Linq;using System.Net.Mail;using System.Runtime.InteropServices;using System.Web;using System.Web.UI;us 阅读全文
posted @ 2013-07-30 16:29 cw_volcano 阅读(366) 评论(0) 推荐(0)
Stop Wrapping Exceptions in Exceptions: Use the .Data Collection on an Exception Instead
摘要:IntroductionWhether you are writing a WinForms application or a complex .NET web site, you will invariably be catching exceptions, logging them and reporting them somewhere.(In this article, I'm not going to explain how to log exceptions). Simply reporting the exception as-thrown rarely captures 阅读全文
posted @ 2012-09-20 12:41 cw_volcano 阅读(154) 评论(0) 推荐(0)
C#实现PDF转SWF的操作
摘要:http://www.cpbcw.com/codetree1365/PSD2swfHelper.cs.htmlhttp://tangshuo.iteye.com/blog/5383611.using System.Web;using System.Text;public static class PSD2swfHelper{ /// <summary> /// 转换所有的页,图片质量80% /// </summary> /// <param name="pdfPath">PDF文件地址</param> /// <para 阅读全文
posted @ 2012-07-06 15:56 cw_volcano 阅读(2842) 评论(0) 推荐(0)
解决Excel只验证前8行字符串的长度
摘要:Check out the [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Jet\4.0\Engines\Excel] located registry REG_DWORD "TypeGuessRows". That's the key to not letting Excel use only the first 8 rows to guess the columns data type. Set this value to 0 to scan all rows. This might hurt performance.I chan 阅读全文
posted @ 2012-06-20 10:05 cw_volcano 阅读(243) 评论(1) 推荐(0)
page life cycle of master page with content page
摘要:Generally one question is faced by very developer what is asp.net page life cycle every body know very well like sequence of asp.net page event likepage_initPage_loadPage_renderPage_unloadit is fine for standalone pages but if a page have master page then what the page life cycle? confuse!!!Below is 阅读全文
posted @ 2012-06-18 18:11 cw_volcano 阅读(170) 评论(0) 推荐(0)
DataSet、ExecuteScalar、ExecuteReader
摘要:using System;using System.Data;using System.Configuration;using System.Linq;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.HtmlControls;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using System.Data;using System.Data.SqlClient;namespace 阅读全文
posted @ 2012-06-04 11:12 cw_volcano 阅读(275) 评论(0) 推荐(0)
C#判断一个字符串是否为整数
摘要:/// <summary> /// 判断一个字符串是否为合法整数(不限制长度) /// </summary> /// <param name="s">字符串</param> /// <returns></returns> public static bool IsInteger(string s) { string pattern = @"^\d*$"; return Regex.IsMatch(s,pattern); ... 阅读全文
posted @ 2012-05-31 16:26 cw_volcano 阅读(6917) 评论(0) 推荐(0)
C#中处理货币中带有逗号的情况
摘要:javascript:Remove all non dot / digits:var currency ="$1,100.00";var number =Number(currency.replace(/[^0-9\.]+/g,""));C#:CultureInfo culture = CultureInfo.GetCultureInfo(IocServiceFactory.Resolve<IStateStorage>().UserFormatLanguage);double result = 0.0;bool success = doubl 阅读全文
posted @ 2012-05-22 13:08 cw_volcano 阅读(646) 评论(0) 推荐(0)
How to Hash and Salt Passwords in ASP.NET
摘要:Use a hashing algorithm, such as SHA256,to store passwords. Make sure tosalt the hashes.Step 1. Compute the SaltYou can compute the salt value by using theRNGCryptoServiceProviderclass, as shown in the following code example.using System.Security.Cryptography;...private static string CreateSalt(int 阅读全文
posted @ 2012-05-21 19:15 cw_volcano 阅读(319) 评论(0) 推荐(0)
string数组类型转换为int数组(数组类型之间的转换)
摘要:string数组类型转换为int数组.方法一:ConvertAll的用法publicstaticintStrToInt(stringstr){returnint.Parse(str);}string[]arrs=newstring[]{"100","300","200"};int[]arri=Array.ConvertAll(arrs,newConverter<string,int>(StrToInt));方法二:使用数组循环分别转换。string[]str1=newstring[]{"100",&qu 阅读全文
posted @ 2012-02-01 12:01 cw_volcano 阅读(2988) 评论(0) 推荐(0)
uploadfy导入Excel内容到数据库中
摘要:aspx:<script src="/Content/Scripts/jquery-1.4.1.min.js" type="text/javascript"></script><script src="/Content/Scripts/swfobject.js" type="text/javascript"></script><script src="/Content/Scripts/jquery.uploadify.v2.1.0.min.js&quo 阅读全文
posted @ 2011-09-11 10:24 cw_volcano 阅读(457) 评论(0) 推荐(0)
txt内容导入数据库
摘要:public bool ImportPurviewManIds(string fileName, string CurrentUserDomainId, string Pduid, string uploadtype) { try { if (File.Exists(fileName)) { //读取文件 一行一行读取 StreamReader objReader = new StreamReader(fileName, Encoding.Default); string sLine = ""; List<string> arrText = new List&l 阅读全文
posted @ 2011-09-11 10:21 cw_volcano 阅读(241) 评论(0) 推荐(0)
IIS部署说明
摘要:2. 目录权限设置部署目录:右健属性→安全选项→添加两个用户.ASPNET_USER_RES.NETWORK SERVICE并赋予上述用户足够的操作权限。同时点击“高级”按键,在弹出的窗口中的“权限”分页中,选中第一个checkbox,否则可能会因为子目录没有权限导致访问失败。iis主目录配置:先尝试右侧两个框内不作任何配置,如果不行,则“插入”“C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll”(具体路径示安装情况而定),如果还不行,则再尝试备注中的操作备注:如果.NET Framework实在装IIS之前就已经装好 阅读全文
posted @ 2011-07-17 10:30 cw_volcano 阅读(195) 评论(0) 推荐(0)
Windows进程,定时执行
摘要:install.batInstallUtil.exenamespace MailService{public partial class Service1 : ServiceBase{private const string ERROR_MAIL_TITLE = "邮件发送失败";private System.Timers.Timer mailTimer, mailTimer2, mailTimer3;private static int i = 0, j = 0, k = 0;public Service1(){InitializeComponent();}protect 阅读全文
posted @ 2011-07-17 10:27 cw_volcano 阅读(153) 评论(0) 推荐(0)

1 2 下一页