您目前尚未登陆,请选择【登陆】或【注册
首页->功能源码->VS2005典型实例源码大全(C#)>>Web/App-Code/Test.cs>>源码在线查看
温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:VS2005典型实例源码大全(C#)
当前文件:文件类型 VS2005Helper/Web/App_Code/Test.cs打开代码结构图
普通视图
		            
1using System; 2using System.Data; 3using System.Configuration; 4using System.Web; 5using System.Web.Security; 6using System.Web.UI; 7using System.Web.UI.WebControls; 8using System.Web.UI.WebControls.WebParts; 9using System.Web.UI.HtmlControls; 10 11using TestDatabaseTableAdapters; 12using System.ComponentModel; 13 14/// <summary> 15/// Test 的摘要说明 16/// </summary> 17[DataObject] 18public class Test 19{ 20 [DataObjectMethod(DataObjectMethodType.Select, true)] 21 public TestDatabase.TestDataTable GetTest() 22 { 23 return Singleton<TestTableAdapter>.Instance.GetTest(); 24 } 25 26 [DataObjectMethod(DataObjectMethodType.Select, false)] 27 public TestDatabase.TestDataTable GetTestById(int id) 28 { 29 return Singleton<TestTableAdapter>.Instance.GetTestById(id); 30 } 31 32 [DataObjectMethod(DataObjectMethodType.Insert, true)] 33 public int?[] InsertTest(int? parentId, string name, DateTime? publishTime, decimal? price, bool? isGood, out int? minId) 34 { 35 // 仅为说明如何做错误处理 36 if (String.IsNullOrEmpty(name)) 37 throw new ArgumentException("参数不能是空", "name"); 38 39 int? id = null; 40 int? count = null; 41 minId = null; 42 43 Singleton<TestTableAdapter>.Instance.InsertTest(parentId, name, publishTime, price, isGood, ref id, ref count, ref minId); 44 return new int?[] { id, count }; 45 } 46 47 [DataObjectMethod(DataObjectMethodType.Delete, true)] 48 public int? DeleteTest(int id) 49 { 50 int? rowAffected; 51 52 rowAffected = Singleton<TestTableAdapter>.Instance.DeleteTest(id); 53 return rowAffected; 54 } 55 56 [DataObjectMethod(DataObjectMethodType.Update, true)] 57 public int? UpdateTest(int? id, int? parentId, string name, DateTime? publishTime, decimal? price, bool? isGood) 58 { 59 int? rowAffected; 60 61 rowAffected = Singleton<TestTableAdapter>.Instance.UpdateTest(id, parentId, name, publishTime, price, isGood); 62 return rowAffected; 63 } 64} 65
还没有找到您心仪的内容?请用.net源码大搜捕
代码片断 打包下载该项目完整源码:VS2005典型实例源码大全(C#)
51Aspx.com 版权所有 CopyRight © 2000-2008. 京ICP备06046876号