資源簡介
基本的功能:動態菜單,增刪改查,窗體間帶參數跳轉,列表頁面跳到update頁面,列表跳到add頁面,完成add,從新綁定列表頁面。

代碼片段和文件信息
using?System;
using?System.Collections.Generic;
using?System.Linq;
using?System.Text;
using?System.Data;
using?System.Data.SqlClient;
using?Mycems.Model;
using?DAL;
namespace?Mycems.DAL
{
????public?class?AdapterService
????{
????????public?AdapterService()
????????{
????????}
#region??成員方法
///?
///?是否存在該記錄
///?
????????public?bool?Exists(string?AdapterNo)
{
SqlParameter[]?parameters?=?{
new?SqlParameter(“@AdapterNo“?SqlDbType.Char22)};
????????????parameters[0].Value?=?AdapterNo;
????????????return?new?DbaseHelper().Exists(“CheckAdapterNo“?parameters);
}
///?
///??增加一條數據
///?
public?bool?Add(Adapter?model)
{
????????????SqlParameter[]?parameters?=?{
new?SqlParameter(“@AdapterNo“?SqlDbType.Char22)
new?SqlParameter(“@AdapterName“?SqlDbType.NVarChar50)
new?SqlParameter(“@AdapterAlias“?SqlDbType.NChar16)
new?SqlParameter(“@AdapterType“?SqlDbType.Char20)
new?SqlParameter(“@DeviceNo“?SqlDbType.Char20)
new?SqlParameter(“@IP“?SqlDbType.Char20)
new?SqlParameter(“@Port“?SqlDbType.Int4)};
????????????parameters[0].Value?=?model.AdapterNo;
????????????parameters[1].Value?=?model.AdapterName;
????????????parameters[2].Value?=?model.AdapterAlias;
????????????parameters[3].Value?=?model.AdapterType;
????????????parameters[4].Value?=?model.DeviceNo;
????????????parameters[5].Value?=?model.IP;
????????????parameters[6].Value?=?model.Port;
????????????if(new?DbaseHelper().ExecuteNonQuery(“AddAdapter“?parameters)?>?0)
????????????????return?true;
????????????else
????????????????return?false;
}
///?
///??更新一條數據
///?
????????public?bool?Update(Adapter?model)
{
????????????SqlParameter[]?parameters?=?{
new?SqlParameter(“@AdapterNo“?SqlDbType.Char22)
new?SqlParameter(“@AdapterName“?SqlDbType.NVarChar50)
new?SqlParameter(“@AdapterAlias“?SqlDbType.NChar16)
new?SqlParameter(“@AdapterType“?SqlDbType.Char20)
new?SqlParameter(“@DeviceNo“?SqlDbType.Char20)
new?SqlParameter(“@IP“?SqlDbType.Char20)
new?SqlParameter(“@Port“?SqlDbType.Int4)};
????????????parameters[0].Value?=?model.AdapterNo;
????????????parameters[1].Value?=?model.AdapterName;
????????????parameters[2].Value?=?model.AdapterAlias;
????????????parameters[3].Value?=?model.AdapterType;
????????????parameters[4].Value?=?model.DeviceNo;
????????????parameters[5].Value?=?model.IP;
????????????parameters[6].Value?=?model.Port;
????????????if(new?DbaseHelper().ExecuteNonQuery(“UpdateAdapter“?parameters)?>?0)
????????????????return?true;
????????????else
????????????????return?false;
}
///?
///?刪除一條數據
///?
????????public?bool?Delete(string?AdapterNo)
{
SqlParameter[]?parameters?=?{
new?SqlParameter(“@AdapterNos“?SqlDbType.NVarChar150)};
????????????parameters[0].Value?=?AdapterNo;
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????3562??2013-01-13?15:28??Winform程序例子-1-13\WindowsFormsFunctionPro\WindowsFormsFunctionPro.sln
????..A..H.?????75776??2013-04-04?16:09??Winform程序例子-1-13\WindowsFormsFunctionPro\WindowsFormsFunctionPro.suo
?????文件????3145728??2013-04-04?16:07??Winform程序例子-1-13\WindowsFormsFunctionPro\數據庫\CemsMenuTest.mdf
?????文件????1048576??2013-04-04?16:07??Winform程序例子-1-13\WindowsFormsFunctionPro\數據庫\CemsMenuTest_log.ldf
?????文件????????372??2013-01-13?16:42??Winform程序例子-1-13\WindowsFormsFunctionPro\WindowsFormsFunction\Child1.cs
?????文件???????2954??2013-01-13?16:42??Winform程序例子-1-13\WindowsFormsFunctionPro\WindowsFormsFunction\Child1.Designer.cs
?????文件???????5817??2013-01-13?16:42??Winform程序例子-1-13\WindowsFormsFunctionPro\WindowsFormsFunction\Child1.resx
?????文件????????370??2013-01-13?15:35??Winform程序例子-1-13\WindowsFormsFunctionPro\WindowsFormsFunction\Form1.cs
?????文件???????1417??2013-01-13?15:35??Winform程序例子-1-13\WindowsFormsFunctionPro\WindowsFormsFunction\Form1.Designer.cs
?????文件???????5817??2013-01-13?15:35??Winform程序例子-1-13\WindowsFormsFunctionPro\WindowsFormsFunction\Form1.resx
?????文件????????628??2013-01-13?16:43??Winform程序例子-1-13\WindowsFormsFunctionPro\WindowsFormsFunction\LOGIN.cs
?????文件???????7858??2013-01-13?16:43??Winform程序例子-1-13\WindowsFormsFunctionPro\WindowsFormsFunction\LOGIN.Designer.cs
?????文件???????5817??2013-01-13?16:43??Winform程序例子-1-13\WindowsFormsFunctionPro\WindowsFormsFunction\LOGIN.resx
?????文件??????10137??2013-01-13?16:41??Winform程序例子-1-13\WindowsFormsFunctionPro\WindowsFormsFunction\MDIMenus.cs
?????文件???????3124??2013-01-13?16:19??Winform程序例子-1-13\WindowsFormsFunctionPro\WindowsFormsFunction\MDIMenus.Designer.cs
?????文件???????6385??2013-01-13?16:19??Winform程序例子-1-13\WindowsFormsFunctionPro\WindowsFormsFunction\MDIMenus.resx
?????文件????????653??2013-04-04?15:52??Winform程序例子-1-13\WindowsFormsFunctionPro\WindowsFormsFunction\Program.cs
?????文件???????9134??2013-03-16?20:28??Winform程序例子-1-13\WindowsFormsFunctionPro\WindowsFormsFunction\WindowsFormsFunction.csproj
?????文件????????552??2013-01-15?19:25??Winform程序例子-1-13\WindowsFormsFunctionPro\WindowsFormsFunction\WindowsFormsFunction.csproj.user
?????文件???????1396??2013-01-13?13:32??Winform程序例子-1-13\WindowsFormsFunctionPro\WindowsFormsFunction\Properties\AssemblyInfo.cs
?????文件???????2890??2013-01-13?13:32??Winform程序例子-1-13\WindowsFormsFunctionPro\WindowsFormsFunction\Properties\Resources.Designer.cs
?????文件???????5612??2013-01-13?13:32??Winform程序例子-1-13\WindowsFormsFunctionPro\WindowsFormsFunction\Properties\Resources.resx
?????文件???????1105??2013-01-13?13:32??Winform程序例子-1-13\WindowsFormsFunctionPro\WindowsFormsFunction\Properties\Settings.Designer.cs
?????文件????????249??2013-01-13?13:32??Winform程序例子-1-13\WindowsFormsFunctionPro\WindowsFormsFunction\Properties\Settings.settings
?????文件???????4440??2013-01-13?14:36??Winform程序例子-1-13\WindowsFormsFunctionPro\WindowsFormsFunction\obj\x86\Debug\DesignTimeResolveAssemblyReferences.cache
?????文件???????6568??2013-04-04?16:06??Winform程序例子-1-13\WindowsFormsFunctionPro\WindowsFormsFunction\obj\x86\Debug\DesignTimeResolveAssemblyReferencesInput.cache
?????文件??????13711??2013-04-04?16:06??Winform程序例子-1-13\WindowsFormsFunctionPro\WindowsFormsFunction\obj\x86\Debug\ResolveAssemblyReference.cache
?????文件????????180??2013-04-04?16:06??Winform程序例子-1-13\WindowsFormsFunctionPro\WindowsFormsFunction\obj\x86\Debug\WindowsFormsFunction.Child1.resources
?????文件????????180??2013-04-04?16:06??Winform程序例子-1-13\WindowsFormsFunctionPro\WindowsFormsFunction\obj\x86\Debug\WindowsFormsFunction.Form1.resources
?????文件????????180??2013-04-04?16:06??Winform程序例子-1-13\WindowsFormsFunctionPro\WindowsFormsFunction\obj\x86\Debug\WindowsFormsFunction.LOGIN.resources
............此處省略106個文件信息
- 上一篇:SQL Server數據庫備份與恢復C#代碼
- 下一篇:社會保障管理系統
評論
共有 條評論