設(shè)備管理系統(tǒng) 源代碼及運(yùn)行界面_第1頁
設(shè)備管理系統(tǒng) 源代碼及運(yùn)行界面_第2頁
設(shè)備管理系統(tǒng) 源代碼及運(yùn)行界面_第3頁
設(shè)備管理系統(tǒng) 源代碼及運(yùn)行界面_第4頁
設(shè)備管理系統(tǒng) 源代碼及運(yùn)行界面_第5頁
已閱讀5頁,還剩109頁未讀 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡介

1、精品文檔就在這里精品文檔就在這里各類專業(yè)好文檔,值得你下載,教育,管理,論文,制度,方案手冊(cè),應(yīng)有盡有,精品文檔,精品文檔,精品文檔,精品文檔源代碼及運(yùn)行界面1.model類aDepart.csusingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text;namespacemodelpublicclassDepartpublicDepart()#regionmodelprivateint_departid;privatestring_departname;privateint_parentid;pub

2、licintDepartIDset_departid=value;getreturn_departid;publicstringDepartNameset_departname=value;getreturn_departname;publicintParentIDset_parentid=value;getreturn_parentid;#endregionmodelbDevice.csusingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text;namespacemodelpublicclassD

3、evicepublicDevice()#regionmodelprivateint_deviceid;privatestring_devicetypeid;privateint_typeid;privateint_classid;privatestring_devicestate;privateSingle_price;privateint_useofyear;privateSingle_svp;privatestring_manufacture;privateDateTime_stocktime;publicintDeviceIDset_deviceid=value;getreturn_de

4、viceid;publicstringDeviceTypeIDset_devicetypeid=value;getreturn_devicetypeid;publicintTypelDset_typeid=value;getreturn_typeid;publicintClassIDset_classid=value;getreturn_classid;publicstringDeviceStateset_devicestate=value;getreturn_devicestate;publicSinglePriceset_price=value;getreturn_price;public

5、intUseOfYearset_useofyear=value;getreturn_useofyear;publicSingleSVPset_svp=value;getreturn_svp;publicstringManufactureset_manufacture=value;getreturn_manufacture;publicDateTimeStockDateset_stocktime=value;getreturn_stocktime;#endregionmodelcDeviceClass.csusingSystem;usingSystem.Collections.Generic;u

6、singSystem.Linq;usingSystem.Text;namespacemodelpublicclassDeviceClasspublicDeviceClass()#regionmodelprivateint_classid;privatestring_classname;privateint_typeid;publicintClassIDset_classid=value;getreturn_classid;publicstringClassNameset_classname=value;getreturn_classname;publicintTypeIDset_typeid=

7、value;getreturn_typeid;#endregionmodeldDeviceType.csusingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text;namespacemodelpublicclassDeviceTypepublicDeviceType()#regionmodelprivateint_typeid;privatestring_typename;publicintTypeIDset_typeid=value;getreturn_typeid;publicstringTyp

8、eNameset_typename=value;getreturn_typename;#endregionmodeleRepairInfo.csusingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text;namespacemodelpublicclassRepairInfopublicRepairInfo()#regionmodelprivateint_repairid;privateint_deviceid;privatestring_repairpeople;privateDateTime_be

9、ginrepairdate;privateSingle_repairprice;privateint_repairoftime;privatestring_faultcause;privatestring_remark;publicintRepairIDset_repairid=value;getreturn_repairid;publicintDeviceIDset_deviceid=value;getreturn_deviceid;publicstringRepairPeopleset_repairpeople=value;getreturn_repairpeople;publicDate

10、TimeBeginRepairDateset_beginrepairdate=value;getreturn_beginrepairdate;publicSingleRepairPriceset_repairprice=value;getreturn_repairprice;publicintRepairOfTimeset_repairoftime=value;getreturn_repairoftime;publicstringFaultCauseset_faultcause=value;getreturn_faultcause;publicstringRemarkset_remark=va

11、lue;getreturn_remark;#endregionmodelfTransInfo.csusingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text;namespacemodelpublicclassTransInfopublicTransInfo()#regionmodelprivateint_transid;privateint_deviceid;privateint_departid;privatestring_usepeople;privateDateTime_begintransd

12、ate;privateint_useofmonth;privatestring_remark;publicintTransIDset_transid=value;getreturn_transid;publicintDeviceIDset_deviceid=value;getreturn_deviceid;publicintDepartIDset_departid=value;getreturn_departid;publicstringUsePeopleset_usepeople=value;getreturn_usepeople;publicDateTimeBeginTransDatese

13、t_begintransdate=value;getreturn_begintransdate;ppublicintUseOfMonthsetp_useofmonth=value;getpreturn_useofmonth;ppublicstringRemarksetp_remark=value;getpreturn_remark;#endregionmodelgUserLevel.csusingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text;namespacemodelpublicclassUs

14、erLevelpublicUserLevel()p#regionmodelprivatestring_levelid;privatestring_levelname;privatestring_description;publicstringLevelIDsetp_levelid=value;getpreturn_levelid;publicstringLevelNamesetp_levelname=value;getpreturn_levelname;publicstringDescriptionsetp_description=value;getpreturn_description;#e

15、ndregionmodelhUsers.csusingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text;namespacemodelpublicclassUserspublicUsers()p#regionmodelprivatestring_userid;privatestring_userpwd;privatestring_levelid;publicstringUserIDsetp_userid=value;getpreturn_userid;publicstringUserPwd2.set_

16、userpwd=value;getreturn_userpwd;publicstringLevelIDset_levelid=value;getreturn_levelid;#endregionmodelart.csusingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text;usingSystem.Collections;usingSystem.Data;usingSystem.Data.SqlClient;namespaceDALpublicclassDepartsqlhelpsql=newsql

17、help();publicDepart()#region成員方法publicArrayListGetListByParentID(intpid)ArrayListal=newArrayList();strings=select*fromDepartwhereParentID=+pid;DataTabledt=null;dt=sql.Execusql(s);for(inti=0;idt.Rows.Count;i+)model.Departmodeldepart=newmodel.Depart();modeldepart.DepartID=Convert.ToInt32(dt.RowsiDepar

18、tID);modeldepart.ParentID=Convert.ToInt32(dt.RowsiParentID);modeldepart.DepartName=dt.RowsiDepartName.ToString();al.Add(modeldepart);returnal;publicintInsert(model.Departmod)intn=0;strings=InsertintoDepart(DepartName,ParentID)values(+mod.DepartName+,+mod.ParentID+);n=sql.Execsql(s);returnn;publicArr

19、ayListGetList()ArrayListal=newArrayList();strings=select*fromDepartwhereDepartID!=1;DataTabledt=null;dt=sql.Execusql(s);for(inti=0;idt.Rows.Count;i+)model.Departmodeldepart=newmodel.Depart();modeldepart.DepartID=Convert.ToInt32(dt.RowsiDepartID);modeldepart.ParentID=Convert.ToInt32(dt.RowsiParentID)

20、;modeldepart.DepartName=dt.RowsiDepartName.ToString();al.Add(modeldepart);returnal;publicDataTableGetDepartList(stringstrwhere)DataTabledt=null;strings=select*fromView2where+strwhere;if(strwhere=)s=select*fromView2;dt=sql.Execusql(s);returndt;publicDataTableGetDepartByID(intid)DataTabledt=null;strin

21、gs=select*fromDepartwhereDepartID=+id;dt=sql.Execusql(s);returndt;publicintUpdate(model.Departmod)intn=0;strings=UpdateDepartSetDepartName=+mod.DepartName+,ParentID=mod.ParentID+whereDepartID=+mod.DepartID;n=sql.Execsql(s);returnn;publicintDelete(intid)intn=0;strings=deletefromDepartwhereDepartID=+i

22、d;n=sql.Execsql(s);returnn;#endregion成員方法bDevice.csusingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text;usingSystem.Data;namespaceDALnamespaceDALpublicclassDevicesqlhelpsql=newsqlhelp();publicDevice()#region成員方法publicDataTableGetDeviceByID(intdeviceid)strings=select*fromDevi

23、cewhereDeviceID=+deviceid;DataTabledt=null;dt=sql.Execusql(s);returndt;publicintInsert(model.Devicemodeldevice)intn=0;InsertintoDevicevalues(+modeldevice.DeviceID+,+modeldevice.TypeID+,+modeldevice.ClassID+,InsertintoDevicevalues(+modeldevice.DeviceID+,+modeldevice.TypeID+,+modeldevice.ClassID+,+mod

24、eldevice.Price+,+modeldevice.UseOfYear+,+modeldevice.StockDate+);n=sql.Execsql(s);returnn;publicDataTableGetList(stringstrwhere)DataTabledt=null;strings=Select*fromView1where+strwhere;if(strwhere=)s=select*fromView1;dt=sql.Execusql(s);returndt;publicDataTableGetDeviceList(stringstrwhere)DataTabledt=

25、null;strings=Select*fromDevicewhere+strwhere;if(strwhere=)s=select*fromDevice;dt=sql.Execusql(s);returndt;publicintDelete(intid)intn=0;strings=deletefromDevicewhereDeviceID=+id;n=sql.Execsql(s);returnn;publicintUpdate(model.Devicemod)intn=0;strings=UpdateDevicesetDeviceState=+mod.DeviceState,TypeID=

26、+mod.TypeID+,ClassID=+mod.ClassID+,DeviceTypeID=+mod.DeviceTypeID,Price=+mod.Price+,SVP=+mod.SVP+,StockDate=+mod.StockDate+,Manufacture=mod.Manufacture+,UseOfYear=+mod.UseOfYear+whereDeviceID=+mod.DeviceID;n=sql.Execsql(s);returnn;#endregion成員方法cDeviceClass.csusingSystem;usingSystem.Collections.Gene

27、ric;usingSystem.Linq;usingSystem.Text;usingSystem.Data;namespaceDALnamespaceDALpublicclassDeviceClasssqlhelpsql=newsqlhelp();publicDeviceClass()#region成員方法publicDataTableGetClass(intid)strings=select*fromDeviceClasswhereTypeID=+id;DataTabledt=null;dt=sql.Execusql(s);returndt;/得到設(shè)備類別列表/publicDataTabl

28、egetDeviceClassList()stringsqlstr=select*fromDeviceClass;DataTabledt=sql.Execusql(sqlstr);returndt;/條件查詢/publicDataTablefindDeviceClassList(stringstrClassId,stringstrClassName,stringstrTypeID)if(strClassId.Trim().Length=0)精品文檔就在這里精品文檔就在這里各類專業(yè)好文檔,值得你下載,教育,管理,論文,制度,方案手冊(cè),應(yīng)有盡有精品文檔就在這里精品文檔就在這里各類專業(yè)好文檔,值得你

29、下載,教育,管理,論文,制度,方案手冊(cè),應(yīng)有盡有,精品文檔,精品文檔,精品文檔,精品文檔if(strClassName.Trim().Length=0)strClassId=%;strClassName=%;if(strTypeID.Trim().Length=0)strTypeID=%;stringsqlstr=select*fromDeviceClasswhereClassIdlike%+strClassId.Trim()+%andClassNamelike%+strClassName.Trim()+%andTypeIDlike%+strTypeID.Trim()+%;DataTabled

30、t=sql.Execusql(sqlstr);returndt;/得到一條設(shè)備類別記錄/publicmodel.DeviceClassgetDeviceClassModel(intid)model.DeviceClassmodel=newmodel.DeviceClass();stringsqlstr=select*fromDeviceClasswhereClassID=+id;DataTabledt=sql.Execusql(sqlstr);if(dt.Rows.Count0)if(dt.Rows0ClassID.ToString()!=)model.ClassID=int.Parse(dt

31、.Rows0ClassID.ToString();model.ClassName=dt.Rows0ClassName.ToString();elsereturnnull;returnmodel;/修改設(shè)備類別記錄/publicintupdateDeviceClass(model.DeviceClassmodel)intn=0;stringsqlstr=updateDeviceClasssetClassName=+model.ClassName+,TypeID=+model.TypeID+whereClassID=+model.ClassID;n=sql.Execsql(sqlstr);retu

32、rnn;/刪除一條設(shè)備類別記錄/publicintdeleteDeviceClass(intid)intn=0;stringsqlstr=deletefromDeviceClasswhereClassID=+id;精品文檔就在這里精品文檔就在這里各類專業(yè)好文檔,值得你下載,教育,管理,論文,制度,方案手冊(cè),應(yīng)有盡有精品文檔就在這里精品文檔就在這里各類專業(yè)好文檔,值得你下載,教育,管理,論文,制度,方案手冊(cè),應(yīng)有盡有n=sql.Execsql(sqlstr);returnn;/獲得類別最大編號(hào)/publicintgetMaxId()intn=0;stringsqlstr=selectmax(Cl

33、assID)fromDeviceClass;DataTabledt=sql.Execusql(sqlstr);n=Convert.ToInt32(dt.Rows00);returnn;/增加一個(gè)設(shè)備類別記錄/publicintaddDeviceClass(model.DeviceClassmodel)intn=0;intid=getMaxId()+1;stringsqlstr=insertintoDeviceClass(ClassID,ClassName,TypeID)values(+id+,+model.ClassName+,+model.TypeID+);n=sql.Execsql(sql

34、str);dreturnn;#endregion成員方法DeviceType.csusingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text;usingSystem.Data;usingSystem.Data.SqlClient;namespaceDALpublicclassDeviceTypesqlhelpsql=newsqlhelppublicDeviceType()();#region成員方法publicDataTableGetTypeList()DataTabledt=null;string

35、s=select*fromDeviceType;dt=sql.Execusql(s);returndt;/得到設(shè)備類型列表/publicDataTablegetDeviceTypeList()stringsqlstr=select*fromDeviceType;DataTabledt=sql.Execusql(sqlstr);returndt;精品文檔精品文檔就在這里精品文檔就在這里各類專業(yè)好文檔,值得你下載,教育,管理,論文,制度,方案手冊(cè),應(yīng)有盡有精品文檔就在這里精品文檔就在這里各類專業(yè)好文檔,值得你下載,教育,管理,論文,制度,方案手冊(cè),應(yīng)有盡有/得到一條設(shè)備記錄/publicmodel

36、.DeviceTypegetDeviceTypeModel(intid)model.DeviceTypemodel=newmodel.DeviceType();stringsqlstr=select*fromDeviceTypewhereTypeID=+id;DataTabledt=sql.Execusql(sqlstr);if(dt.Rows.Count0)if(dt.Rows0TypeID.ToString()!=)model.TypeID=int.Parse(dt.Rows0TypeID.ToString();model.TypeName=dt.Rows0TypeName.ToStrin

37、g();returnmodel;elsereturnnull;/修改設(shè)備類型記錄/publicintupdateDeviceType(model.DeviceTypemodel)intn=0;stringsqlstr=updateDeviceTypesetTypeName=+model.TypeName+whereTypeID=+model.TypeID;n=sql.Execsql(sqlstr);returnn;/插入一條設(shè)備類型記錄/publicintaddDeviceType(model.DeviceTypemodel)intn=0;stringsqlstr=insertintoDevi

38、ceType(TypeName)values(+model.TypeName+);n=sql.Execsql(sqlstr);returnn;/刪除一條設(shè)備類型記錄/publicintdeleteDeviceType(intid)intn=0;stringsqlstr=deletefromDeviceTypewhereTypeID=+id;n=sql.Execsql(sqlstr);returnn;/精品文檔精品文檔就在這里精品文檔就在這里各類專業(yè)好文檔,值得你下載,教育,管理,論文,制度,方案手冊(cè),應(yīng)有盡有精品文檔就在這里精品文檔就在這里各類專業(yè)好文檔,值得你下載,教育,管理,論文,制度,方

39、案手冊(cè),應(yīng)有盡有精品文檔精品文檔精品文檔精品文檔%;/條件查詢/ppublicDataTablefindDeviceTypeList(stringstrTypeID,StringstrTypeName)stringsqlstr=;if(strTypeID.Trim().Length=0)if(strTypeName.Trim().Length=0)strTypeName=%;sqlstr=select*fromDeviceTypewhereTypeNamelike%+strTypeName.Trim()+elseif(strTypeName.Trim().Length=0)strTypeNam

40、e=%;sqlstr=select*fromDeviceTypewhereTypeID=+Convert.ToInt32(strTypeID.Trim()+andTypeNamelike%+strTypeName.Trim()+%;DataTabledt=sql.Execusql(sqlstr);returndt;#endregion成員方法eRepairInfo.csusingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text;usingSystem.Data;usingSystem.Data.Sq

41、lClient;namespaceDALpublicclassRepairInfosqlhelpsql=newsqlhelp();ppublicRepairInfo()#region成員方法publicintInsert(model.RepairInfomod)intn=0,m=0;strings=InsertintoRepairInfo(DeviceID,RepairPeople,BeginRepairDate,RepairPrice,RepairOfTime,FaultCause,Remark)values(+mod.DeviceID+,+mod.RepairPeople+,+mod.Be

42、ginRepairDate+,+mod.RepairPrice+,+mod.RepairOfTime+,+mod.FaultCause+,+mod.Remark+);n=sql.Execsql(s);if(mod.Remark=正在維修)s=UpdateDevicesetDeviceState=故障whereDeviceID=+mod.DeviceID;m=sql.Execsql(s);elses=UpdateDevicesetDeviceState=空閑whereDeviceID=+mod.DevicelD;m=sql.Execsql(s);if(m=1&n=1)pn=1;elsepn=0;

43、returnn;publicDataTableGetList(stringstrwhere)精品文檔就在這里精品文檔就在這里各類專業(yè)好文檔,值得你下載,教育,管理,論文,制度,方案手冊(cè),應(yīng)有盡有精品文檔就在這里精品文檔就在這里各類專業(yè)好文檔,值得你下載,教育,管理,論文,制度,方案手冊(cè),應(yīng)有盡有DataTabledt=null;strings=Select*fromRepairInfowhere+strwhere;if(strwhere=)s=select*fromRepairInfo;dt=sql.Execusql(s);returndt;publicDataTableGetRepairIn

44、foByID(intid)DataTabledt=null;strings=select*fromRepairInfowhereRepairID=+id;dt=sql.Execusql(s);returndt;publicintUpdate(model.RepairInfomod)intn=0,m=0;strings=dateRepairInfosetDeviceID=+mod.DeviceID+,RepairPeople=+mod.RepairPeople+,BeepairDate=+mod.BeginRepairDate+,Repairprice=+mod.RepairPrice+,Rep

45、airOfTime=+mod.RepairOfTime+,FaultCause=+mod.FaultCause+,Remark=+mod.Remark+whereRepairID=+mod.RepairID+;n=sql.Execsql(s);if(mod.Remark=正在維修)elses=UpdateDevicesetDeviceState=故障whereDeviceID=elses=UpdateDevicesetDeviceState=空閑whereDeviceID=+mod.DevicelD;m=sql.Execsql(s);if(m=1&n=1)n=1;elsen=0;returnn

46、;publicintDelete(intid)intn=0;strings=deletefromRepairInfowhereRepairID=+id;n=sql.Execsql(s);returnn;#endregion成員方法fTransInfo.csusingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text;usingSystem.Collections;usingSystem.Data;usingSystem.Data.SqlClient;namespaceDALpublicclassTra

47、nsInfosqlhelpsql=newsqlhelp();publicTransInfo()#region成員方法publicintInsert(model.TransInfomod)intointn=0,m=0;intostrings=InsertTransInfo(DeviceID,DepartID,UsePeople,BeginTransDate,UseOfMonth,Remark)values(+mod.DeviceID+,+mod.DepartID+,+mod.UsePeople+,+mod.BeginTransDate+,+mod.UseOfMonth+,+mod.Remark+

48、);n=sql.Execsql(s);if(mod.Remaik=未歸還)、s=UpdateDevicesetDeviceState=忙碌whereDeviceID=+mod.DeviceID;精品文檔精品文檔就在這里精品文檔就在這里各類專業(yè)好文檔,值得你下載,教育,管理,論文,制度,方案手冊(cè),應(yīng)有盡有精品文檔就在這里精品文檔就在這里各類專業(yè)好文檔,值得你下載,教育,管理,論文,制度,方案手冊(cè),應(yīng)有盡有,精品文檔,精品文檔,精品文檔,精品文檔m=sql.Execsql(s);if(m=1&n=1)n=1;elsen=0;returnn;ppublicDataTableGetList(strin

49、gstrwhere)DataTabledt=null;strings=select*fromView3where+strwhere;if(strwhere=)s=select*fromView3;dt=sql.Execusql(s);returndt;publicDataTableGetTransByID(intid)DataTabledt=null;strings=select*fromTransInfowhereTransID=+id;dt=sql.Execusql(s);returndt;publicintUpdate(model.TransInfomod)intn=0,m=0;stri

50、ngs=updateTransInfosetDepartID=+mod.DepartID+,UsePeople=+mod.UsePeople+,BeginTransDate=+mod.BeginTransDate+,UseOfMonth=+mod.UseOfMonth+,Remark=+mod.Remark+whereTransID=+mod.TransID;n=sql.Execsql(s);if(mod.Remark=未歸還)elses=UpdateDevicesetDeviceState=忙碌whereDeviceID=+mod.DevicelD;elsem=sql.Execsql(s);

51、if(m=1&n=1)n=1;elsen=0;s=UpdateDevicesetDeviceState=空閑m=sql.Execsql(s);if(m=1&n=1)n=1;elsen=0;returnn;publicintDelete(intid)intn=0;strings=deletefromTransInfowhereTransID=+id;n=sql.Execsql(s);returnn;#endregion成員方法gUserLevel.csusingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.

52、Text;usingSystem.Data;namespaceDALppublicclassUserLevelsqlhelpsql=newsqlhelp();publicUserLevel()#region成員方法/得到用戶權(quán)限列表/publicDataTablegetUsersLevelList()stringsqlstr=select*fromUserLevel;DataTabledt=sql.Execusql(sqlstr);returndt;#endregion成員方法hUsers.csusingSystem;usingSystem.Collections.Generic;usingS

53、ystem.Linq;usingSystem.Text;usingSystem.Data;namespaceDALsqlhelpsql=newsqlhelp();publicUsers()sqlhelpsql=newsqlhelp();publicUsers()#region成員方法/得到用戶列表/publicDataTablegetUsersList()stringsqlstr=select*fromUsers;DataTabledt=sql.Execusql(sqlstr);returndt;/或得一條用戶記錄/publicmodel.UsersgetUsersModel(stringid

54、)model.Usersmodel=newmodel.Users();stringsqlstr=select*fromUserswhereUserID=+id+;DataTabledt=sql.Execusql(sqlstr);if(dt.Rows.Count0)model.UserID=dt.Rows0UserID.ToString();model.UserPwd=dt.Rows0UserPwd.ToString();model.LevelID=dt.Rows0LevelID.ToString();returnmodel;elsereturnnull;/獲得下一個(gè)用戶編號(hào)/publicstr

55、inggetNextUsersId()stringidstr=;stringsqlstr=selectmax(UserID)fromUsers;DataTabledt=sql.Execusql(sqlstr);精品文檔就在這里精品文檔就在這里各類專業(yè)好文檔,值得你下載,教育,管理,論文,制度,方案手冊(cè),應(yīng)有盡有精品文檔就在這里精品文檔就在這里各類專業(yè)好文檔,值得你下載,教育,管理,論文,制度,方案手冊(cè),應(yīng)有盡有精品文檔就在這里精品文檔就在這里各類專業(yè)好文檔,值得你下載,教育,管理,論文,制度,方案手冊(cè),應(yīng)有盡有,精品文檔,精品文檔,精品文檔,精品文檔,精品文檔,精品文檔intid1=Conve

56、rt.ToInt32(dt.Rows00)+1;idstr=id1+;returnidstr;/插入一條用戶記錄/publicintaddUser(model.Usersmodel)intn=0;stringsqlstr=insertintoUsersvalues(+model.UserID+,+model.UserPwd+,+model.LevelID+);n=sql.Execsql(sqlstr);returnn;/修改一個(gè)用戶/publicintupdateUser(model.Usersmodel)intn=0;stringsqlstr=updateUserssetUserPwd=+m

57、odel.UserPwd+,LevelID=+model.LevelID+whereUserID=+model.UserID+;n=sql.Execsql(sqlstr);returnn;/刪除一個(gè)用戶/publicintdeleteUser(stringid)intn=0;stringsqlstr=deletefromUserswhereUserID=+id+;n=sql.Execsql(sqlstr);returnn;/條件查詢/publicDataTablefindUsersList(stringstrUserID,StringstrLevelID)if(strUserID.Trim()

58、.Length=0)strUserID=%;if(strLevelID.Trim().Length=0)strLevelID=%;stringsqlstr=select*fromUserswhereUserIDlike%+strUserID.Trim()+%andLevelIDlike%+strLevelID.Trim()+%;DataTabledt=sql.Execusql(sqlstr);returndt;publicDataTableUserLogin(stringuname,stringupwd,stringlevel)strings=select*fromUserswhereUser

59、ID=+uname+andUserPwd=+upwd+andLevelID=+level+;DataTabledt=null;dt=sql.Execusql(s);returndt;#endregion成員方法isqlhelp.csusingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text;usingSystem.Data.SqlClient;usingSystem.Data;usingSystem.Configuration;namespaceDALpublicclasssqlhelppublic

60、SqlConnectioncon=newSqlConnection();stringconn=ConfigurationManager.ConnectionStringsApplicationServices.ConnectionString;publicsqlhelp()con.ConnectionString=conn;publicintExecsql(stringsql)intn=0;SqlCommandcmd=newSqlCommand(sql,con);con.Open();n=cmd.ExecuteNonQuery();con.Close();catchif(con.State=C

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

評(píng)論

0/150

提交評(píng)論