摘要: “三层结构”是“外观层”、“商业逻辑层”、“数据库层”假设以这样的结构制作一个留言板,那么应该是: # 留言板页面的外观代码都存放在 .aspx 文件中 # 当用户点击页面上的提交按钮时,先将文本信息传递给一个 LeaveWord 类对象 (LeaveWord 类的定义被封装到“商业逻辑层”) # 之后让这个对象执行 Post() 将留言信息发送到数据库用一个简单的代码就是: textarea id="Content" runat="server"/textarea input type="button" id="Post" runat="server" / // -------- 阅读全文
posted @ 2007-03-24 17:23 leonardleonard 阅读(139) 评论(0) 推荐(0) 编辑
摘要: 一个示例: classAppTest { privateExcel.ApplicationClass_x; publicstaticvoidMain0() { AppTesta=newAppTest(); a._x=newExcel.ApplicationClass(); a._x.UserControl=false; for(inti=0;i4;i++) { a.SaveToXls("D:\\test\\"+i+".xls");//本例是在D盘下建立的test文件夹 } a._x.Quit(); System.Runtime.InteropServices.Marshal.Release 阅读全文
posted @ 2007-03-24 17:20 leonardleonard 阅读(535) 评论(0) 推荐(0) 编辑
摘要: if(fileupload.PostedFile!=null){ //addto为要添加的属性,aboutfile为文件说明string nam = fileupload.PostedFile.FileName ;//取得文件名(抱括路径)里最后一个"."的索引int i= nam.LastIndexOf(".");//取得文件扩展名string newext =nam.Substring(i);//这里我自动根据日期和文件大小不同为文件命名,确保文件名不重复DateTime now = DateTime.Now; string newname=now.DayOfYear.ToString() 阅读全文
posted @ 2007-03-24 17:19 leonardleonard 阅读(122) 评论(0) 推荐(0) 编辑
摘要: 前两年写的东西,现在整理一下发出来!以前公司需要做WebService,并且对WebService的SoapHeader进行加密,所以就写了这么个东东!使用这个类,需要密钥管理!为了保证数据的安全性往往要对数据进行加密,但是加密的缺点之一,就是影响程序的运行效率,所以,当时我的思路是只对用户的登录信息(用户名,密码)进行加密!数据用明文传输,用户信息验证没有通过的情况下, 不进行数据传输。 实际在网络通讯中,使用密钥匙的方式并非无懈可击,如果黑客可以捕捉到用密钥加密的,用户验证信息,然后,做个模拟请求,向提供WebService的服务器发请求,还是可以获得请求数据!所以,我又使用了IP或者域名 阅读全文
posted @ 2007-03-24 17:16 leonardleonard 阅读(183) 评论(0) 推荐(0) 编辑
摘要: /* FTPFactory.cs Better view with tab space=4 Written by Jaimon Mathew (jaimonmathew@rediffmail.com) Rolander,Dan (Dan.Rolander@marriott.com) has modified the download method to cope with file name with path information. He also provided the XML comments so that the library provides Intellisense des 阅读全文
posted @ 2007-03-24 17:15 leonardleonard 阅读(122) 评论(0) 推荐(0) 编辑
摘要: 类(class)是C#类型中最基础的类型。类是一个数据结构,将状态(字段)和行为(方法和其他函数成员)组合在一个单元中。类提供了用于动态创建类实例的定义,也就是对象(object)。类支持继承(inheritance)和多态(polymorphism),即派生类能够扩展和特殊化基类的机制。 使用类声明可以创建新的类。类声明以一个声明头开始,其组成方式如下:先是指定类的特性和修饰符,后跟类的名字,基类(如果有的话)的名字,以及被该类实现的接口名。声明头后面就是类体了,它由一组包含在大括号({})中的成员声明组成。 下面是一个名为Point的简单类的声明: public class Point { 阅读全文
posted @ 2007-03-24 17:12 leonardleonard 阅读(167) 评论(0) 推荐(0) 编辑
摘要: 码输入是一种常用的控件,我记得第一次看见这种控件是在Visual FoxPro中!感觉功能强,不错。现在用C#开发ASP.NET应用程序也需要用到这种输入的控件,便琢磨着自己做一个。但是由于Visual FoxPro中的掩码文本框功能太强了,一时还不敢去做。网上也有一些自制的如:http://www.weste.net/2004/11-25/09162561988.html,但是感觉功能都不很适合。后来在http://www.stedy.com上看到了他们做的掩码文本框,感觉这种方式在Web应用上很适合,就把客户端代码down下来了!(stedy software 作的是产品,要花钱!而且很贵 阅读全文
posted @ 2007-03-24 17:10 leonardleonard 阅读(333) 评论(0) 推荐(0) 编辑
摘要: using System; using System.IO; using System.Security.Cryptography; namespace Vavic { /// summary /// Security 的摘要说明。 /// /summary public class Security { const string KEY_64 = "VavicApp"; const string IV_64 = "VavicApp"; //注意了,是8个字符,64位 public Security() { // // TODO: 在此处添加构造函数逻辑 // } public sta 阅读全文
posted @ 2007-03-24 17:08 leonardleonard 阅读(161) 评论(0) 推荐(0) 编辑
摘要: 1 在工程中引用Microsoft.VisualBasic.dll 一般此文件在.net框架环境目录中如C:\ WINNT \Microsoft.NET \Framework \v1.1.4322 \Microsoft.VisualBasic.dll。 2 使用方法 Microsoft.VisualBasic.Strings.StrConv( “instr”,Microsoft.VisualBasic.VbStrConv.TraditionalChinese, System.Globalization.CultureInfo.CurrentCulture.LCID); * 该方法的使用可以在m 阅读全文
posted @ 2007-03-24 17:07 leonardleonard 阅读(133) 评论(0) 推荐(0) 编辑
摘要: using System; using System.Text; using System.IO; using System.Net; using System.Net.Sockets; using System.Collections; namespace lion_office.Data.Library.MailClass { public class ESmtpMail { private string enter="\r\n"; /// summary /// 设定语言代码,默认设定为GB2312,如不需要可设置为"" /// /summary public string Ch 阅读全文
posted @ 2007-03-24 17:06 leonardleonard 阅读(146) 评论(0) 推荐(0) 编辑
摘要: using System; using System.Xml; using System.Text; using System.Net; using System.IO; using System.Collections; using System.Text.RegularExpressions; public class App { public static void Main() { string strCode; ArrayList alLinks; Console.Write("请输入一个网页地址:"); string strURL = Console.ReadLine(); if( 阅读全文
posted @ 2007-03-24 17:04 leonardleonard 阅读(213) 评论(0) 推荐(0) 编辑
摘要: using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; using System.Messaging ; using System.Threading ; namespace WinMsmq { /// summary /// Form1 的摘要说明。 /// /summary public class Form1 : System.Windows.Forms.Form 阅读全文
posted @ 2007-03-24 17:03 leonardleonard 阅读(252) 评论(0) 推荐(0) 编辑
摘要: GPRS上网,好象很多内容都是要付费的,就只有下载铃声,什么图片的,没劲!最好能用手机看看小说,网络上好象没有免费的WAP小说,办公室的小妹妹也想用手机看小说,看来只有自己做一个了。 都说JAVA是开发WAP的利器,不过WAP需要这个“码”转到那个“码”,真是麻烦,算了,看一下能不能用C#做一个WAP小站。 想来也很简单的,WAP就是用UTF8编码嘛,好象还有什么WML之类的,WML在网上查查资料,就和XML差不多,平时用XML也蛮多的,WML也就简单了,C#直接可以设RESPONSE的编码的,看来有戏了,先写一个“Hello 老婆“吧, //设置ContentType类型 Response. 阅读全文
posted @ 2007-03-24 17:01 leonardleonard 阅读(245) 评论(0) 推荐(0) 编辑
摘要: 当我要写一个MD5算法的程序时,发现中英文的语言描述都有一些不确切的地方,某些个细节 讲得不清楚,或者说很费解。最后不得不拿出C语言的源程序来调试,这对于理解算法是很不 利的。于是就总结了一下我摸索到的一些要点。 1.来历 MD5的全称是message-digest algorithm 5(信息-摘要算法,在90年代初由mit laboratory for computer science和rsa data security inc的ronald l. rivest开发出来, 经md2、md3和md4发展而来。http://www.ietf.org/rfc/rfc1321.txt,是一份最权威 阅读全文
posted @ 2007-03-24 17:00 leonardleonard 阅读(179) 评论(0) 推荐(0) 编辑
摘要: 第一步:在Visual Studio 2005中编写代码 using System; using System.Data; using System.Data.Sql; using System.Data.SqlServer; using System.Data.SqlTypes; public partial class Triggers { // Enter existing table or view for the target and uncomment the attribute line // [SqlTrigger (Name="myTrigger", Target="Tabl 阅读全文
posted @ 2007-03-24 16:58 leonardleonard 阅读(183) 评论(0) 推荐(0) 编辑
摘要: //本周是本年第几周 private int DatePart(System.DateTime dt) { int weeknow = Convert.ToInt32(dt.DayOfWeek);//今天星期几 int daydiff = (-1) * (weeknow+1);//今日与上周末的天数差 int days = System.DateTime.Now.AddDays(daydiff).DayOfYear;//上周末是本年第几天 int weeks = days/7; if(days%7 != 0) { weeks++; } //此时,weeks为上周是本年的第几周 return ( 阅读全文
posted @ 2007-03-24 16:56 leonardleonard 阅读(158) 评论(0) 推荐(0) 编辑
摘要: 在写C#程序时,string和byte[]之间的转换比较烦,在移植一些老程序时感觉很不好。我在C#中使用DES和TripleDES时移植一块老代码时也遇到了同样的情况。为了下次不为同样的事情烦恼,就写了下面的帮助类。 主要实现了以下的函数 代码中出现的Sidle是我的网名。 /* * @Author WuErPing * @Version 1.0 * @Date 2004/11/30 * @Description: */ using System; using System.Text; namespace SidleHelper { /// summary /// Summary desc 阅读全文
posted @ 2007-03-24 16:55 leonardleonard 阅读(165) 评论(0) 推荐(0) 编辑
摘要: using System; using System.Collections; public class Nevermore60Customer:Customer { public override string GetFunnyString() { return "Nevermore60.Nevenmore!"; } -------------------------------------------------------------------------------- public class Customer { public virtual string GetFunnyStri 阅读全文
posted @ 2007-03-24 16:54 leonardleonard 阅读(182) 评论(0) 推荐(0) 编辑
摘要: private void Form1_DragEnter(object sender, System.Windows.Forms.DragEventArgs e) { if (e.Data.GetDataPresent(DataFormats.FileDrop)) e.Effect = DragDropEffects.Link; else e.Effect = DragDropEffects.None; } private void Form1_DragDrop(object sender, System.Windows.Forms.DragEventArgs e) { //其中label1. 阅读全文
posted @ 2007-03-24 16:53 leonardleonard 阅读(122) 评论(0) 推荐(0) 编辑
摘要: Code List: ------------------------------------------------------------------------- /***************************************************************** ** File Name: frmMain.cs ** Copyright (c) 1999 -2003 ** Creator: FirePhoenix ** Created Date: 2004-11-13 15:24 ** Modifier: ** Modify Date: ** Descr 阅读全文
posted @ 2007-03-24 16:52 leonardleonard 阅读(309) 评论(0) 推荐(0) 编辑