SQLite: sql script demo

来源:https://www.cnblogs.com/geovindu/archive/2018/09/14/9646783.html
-Advertisement-
Play Games

如果有成熟的架構,如何根據資料庫關係的表、視圖等,進行代碼生成架構?減少寫代碼的時間? 主、外鍵關聯要考慮 實體類層: 數據處理層: 用於UI層要操作: ...


如果有成熟的架構,如何根據資料庫關係的表、視圖等,進行代碼生成架構?減少寫代碼的時間?

-- 考慮主鍵外鍵
-- 
create database geovindu;

use geovindu;

--2 
create table EnterpriseType
(
   EnterpriseTypeID INTEGER PRIMARY KEY AUTOINCREMENT,
   EnterpriseTypeName nvarchar(100) not null					--企業類型名稱
);
insert into EnterpriseType (EnterpriseTypeName) values(N'分公司');
insert into EnterpriseType (EnterpriseTypeName) values(N'店鋪');

select * from OperatingUser;
-- 3
drop table CompanyBranch;

create table CompanyBranch
(
    CompanyID INTEGER PRIMARY KEY AUTOINCREMENT,
    CompanyName nvarchar(100) not null,
    CompanyTypeID int not null,
    CompanyDate  datetime DEFAULT (datetime('now','localtime')),
    CompanyDesc NVARCHAR(500) null,
    CompanyTel varchar(100) null,
    CompanyFax VARCHAR(100) NULL,
    CompanyAddress NVARCHAR(500) NULL,
    FOREIGN KEY(CompanyTypeID) REFERENCES EnterpriseType(EnterpriseTypeID)
);

insert into CompanyBranch(CompanyName,CompanyTypeID,CompanyTel,CompanyFax,CompanyAddress,CompanyDesc) values('六福珠寶營銷策劃(深圳)有限公司',1,'','','','');

select * from CompanyBranch

select * from EnterpriseType

drop table OperatingUser;
-- 1
create table OperatingUser
(
	UserID  INTEGER PRIMARY KEY AUTOINCREMENT,
    UserName nvarchar(200) not null,						--用戶名
	RealName NVARCHAR(50) NOT NULL,						--真姓名
	UserPassword varchar(100) not null,					--密碼
	UserCompanyId int not null,						--公司ID
	UserPasswordProblems nvarchar(100),					--找回密碼問題	
	UserMail varchar(100) null,						--密碼
	UserDate datetime DEFAULT (datetime('now','localtime')),                                     --預設日期
	FOREIGN KEY(UserCompanyId) REFERENCES CompanyBranch(CompanyID)

);

select * from OperatingUser;


--4
drop table LoginDiaryList;

CREATE TABLE LoginDiaryList
(
	LoginDiaryID INTEGER PRIMARY KEY AUTOINCREMENT,
	LoginDiaryUserName nvarchar(50) null,		--登錄用戶名	
	LoginDiaryUserId int not null, 			--員工ID
	LoginDiaryBrowser varchar(50) null,		--客戶端瀏覽
	LoginDiaryScreen varchar(50) null,			--顯示器大小
	LoginDiaryOpertor varchar(50) null,		--操作系統
	LoginDiaryInput nvarchar(150) null,		--輸入法
	LoginDiaryDate datetime DEFAULT (datetime('now','localtime')),  	--日期
    FOREIGN KEY(LoginDiaryUserId) REFERENCES OperatingUser(UserID)

);

select * from LoginDiaryList;

select * from PrintWordDocumentTemplateList;

-- 5
create table PrintWordDocumentTemplateList
(
	PrintWordDocumentId INTEGER PRIMARY KEY AUTOINCREMENT,
	--PrintWordDocumentUid Uniqueidentifier DEFAULT(NEWID())  PRIMARY KEY,	
	--PrintWordPayTypeUidKey Uniqueidentifier,				---考核類型(試用期,年終,特別)
	--PrintWordJobTypeUidKey Uniqueidentifier,				---職位類型(文職類,員工類,管理級別類等)
	PrintWordOnlyPassIs bit default(0),				---通過試用期並成為正式員工
	PrintWordPlusSalaryIs bit default(0),				---通過並加薪
	PrintWordPromotionIs bit default(0),				---通過晉升
	PrintWordExtensionIs bit default(0),				--延長試用期
	PrintWordDismissIs bit default(0),					--解僱
	PrintWordDepartmentIs bit default(0),				--新部門
	PrintWordDocumentName Nvarchar(100) not null,				--文檔標題
	PrintWordDocumentUrl nvarchar(200) null,				--文檔鏈接
	PrintWordDocumentContent nvarchar(300) null,				--文檔簡要描述
	PrintWordDocumentAddDate  datetime DEFAULT (datetime('now','localtime')) ,
	PrintWordDocumentByte BLOB null,
	PrintWordType int default(1)	 				--文檔類型 1.分公司,2.分店
	--PrintWordLetterSignature nvarchar(100) null				--信函簽名

);

-- 6
-- 客戶表Customer(需方) 名稱,工地名稱
drop table CustomerList;

CREATE TABLE CustomerList
(
	CustomerID INTEGER PRIMARY KEY AUTOINCREMENT,
	CustomerName NVARCHAR(200) NOT NULL,
	CustomerNamePin VARCHAR(500) NULL,
	CustomerContact NVARCHAR(50) NULL,			--聯系人
	CustomerTel VARCHAR(100) NULL,			-- 聯系人電話
	CustomerDate  datetime DEFAULT (datetime('now','localtime')) 
);

-- 7表單關聯人類型RelationshipsType: 指定收貨人 跟單業務員 工地驗收人 運輸人
drop table RelationshipsType;

CREATE TABLE RelationshipsType
(
	RelationshipsTypeID INTEGER PRIMARY KEY AUTOINCREMENT,
	RelationshipsTypeName NVARCHAR(100) NOT NULL,
	RelationshipsTypePin VARCHAR(500) NULL
);

insert into RelationshipsType(RelationshipsTypeName) values('指定收貨人');
insert into RelationshipsType(RelationshipsTypeName) values('跟單業務員');
insert into RelationshipsType(RelationshipsTypeName) values('工地驗收人');
insert into RelationshipsType(RelationshipsTypeName) values('運輸人');

-- 8表單關係人錶RelationshipsPerson
drop table RelationshipsPerson;

CREATE TABLE RelationshipsPerson
(
	PersonID INTEGER PRIMARY KEY AUTOINCREMENT,
	PersonName NVARCHAR(100) NOT NULL,
	PersonNamePin VARCHAR(500) NULL,
	PersonTel VARCHAR(100),
	PersonType int NOT NULL,
	PersonDate datetime DEFAULT (datetime('now','localtime')),
	FOREIGN KEY(PersonType) REFERENCES RelationshipsType(RelationshipsTypeID)
);

select * from RelationshipsPerson;



-- 9產品名稱表 ProductTypeList
drop table ProductTypeList;

CREATE TABLE ProductTypeList
(
	ProductTypeID INTEGER PRIMARY KEY AUTOINCREMENT,
	ProductTypeName NVARCHAR(800) NOT NULL,
	ProductTypePin VARCHAR(500) NULL     --字首字母
);
-- 10單位表 UnitList
drop table UnitList;

CREATE TABLE UnitList
(
	UnitID INTEGER PRIMARY KEY AUTOINCREMENT,
	UnitName NVARCHAR(100) NOT NULL,
	UnitPin VARCHAR(500) NULL
);

select * from UnitList;

delete from UnitList where UnitName='';

drop table ProductModel;
-- 產品規格
CREATE TABLE ProductModel
(
	ModelID INTEGER PRIMARY KEY AUTOINCREMENT,
	ModelProductTypeID INT NOT NULL,        -- 產品名稱ID 外鍵 ProductTypeList
	ModelName NVARCHAR(800) NOT NULL,
	ModelPin VARCHAR(500) NULL,
	FOREIGN KEY(ModelProductTypeID) REFERENCES ProductTypeList(ProductTypeID)
);

drop table UnitPrice;

-- 單價表
CREATE TABLE UnitPrice
(
	UnitPriceID INTEGER PRIMARY KEY AUTOINCREMENT,
	UnitProductTypeID INT NOT NULL,        -- 產品名稱ID 外鍵 ProductTypeList
	UnitPriceNuber DECIMAL(20,2) NOT NULL,
	UnitPricePin VARCHAR(500) NULL,
	FOREIGN KEY(UnitProductTypeID) REFERENCES ProductTypeList(ProductTypeID)
);

select * from UnitPrice;

drop table CustomerAddress;
--  客戶地址表 
CREATE TABLE CustomerAddress
(
	AddressID INTEGER PRIMARY KEY AUTOINCREMENT,
	AddressName NVARCHAR(100) NOT NULL,
	AddressPin VARCHAR(500) NULL
);


-- 11級別表 LevelList
drop table LevelList;

CREATE TABLE LevelList
(
	LevelID INTEGER PRIMARY KEY AUTOINCREMENT,
	LevelName NVARCHAR(100) NOT NULL,
	LevelPin VARCHAR(500) NULL
);

select * from LevelList;

delete from LevelList where LevelName='';


-- 12工地名名稱表 建築工地名Construction site name
drop table ConstructionNameList;

CREATE TABLE ConstructionNameList
(
	ConstructionID INTEGER PRIMARY KEY AUTOINCREMENT,
	ConstructionName VARCHAR(100) NOT NULL,
	ConstructionPin VARCHAR(500) NULL
);

select * from ConstructionNameList;

delete from ConstructionNameList where ConstructionName='';

-- 訂單產品詳情表
drop table OrderItDetails;

CREATE TABLE OrderItDetails
(
	OrderID INTEGER PRIMARY KEY AUTOINCREMENT,	
	OrderDate datetime DEFAULT (datetime('now','localtime')),	 	-- 送貨日期
	OrderWord VARCHAR(50) NULL,				-- 字
	OrderNo VARCHAR(100) NULL,				-- 號
	OrderCustomerId INT NOT NULL,				-- 客戶名稱
	OrderAddressID INT NOT NULL,				-- 客戶地址名稱		
	OrderPrepared INT NULL,				-- 製單人
	OrderBusiness INT NULL,				-- 指定收貨人											
	OrderPrintDate datetime DEFAULT (datetime('now','localtime')),	--打單時間
	FOREIGN KEY(OrderCustomerId) REFERENCES CustomerList(CustomerID),
	FOREIGN KEY(OrderAddressID) REFERENCES CustomerAddress(AddressID),
	FOREIGN KEY(OrderPrepared) REFERENCES RelationshipsPerson(PersonID),
	FOREIGN KEY(OrderBusiness) REFERENCES RelationshipsPerson(PersonID)
);

-- 訂單產品詳情
drop table ProductItOrderDetails;

CREATE TABLE ProductItOrderDetails
(
    ProductDetailsId INTEGER PRIMARY KEY AUTOINCREMENT,	
    ProductOrderId INT NOT NULL,			-- 產品訂單ID  外錶OrderDetails
	ProductOrderTypeId INT NOT NULL,			--產品名稱
	ProductModleId INT,	  			--規格
	ProductUnitID INT ,				-- 單位
	ProductQty DECIMAL(18,2) DEFAULT(0),		--數量
	ProductPriceID INT NOT NULL,			--單價
	ProductMeters DECIMAL(25,2) DEFAULT(0),		--金額
	ProductDescription VARCHAR(1000) NULL,		--說明
	FOREIGN KEY(ProductOrderId) REFERENCES OrderItDetails(OrderID),
	FOREIGN KEY(ProductOrderTypeId) REFERENCES ProductTypeList(ProductTypeID),
	FOREIGN KEY(ProductModleId) REFERENCES ProductModel(ModelID),
	FOREIGN KEY(ProductUnitID) REFERENCES UnitList(UnitID),
	FOREIGN KEY(ProductPriceID) REFERENCES UnitPrice(UnitPriceID)
);


-- 13打單表內容 ProductDetails
-- https://www.sqlite.org/datatype3.html
drop table OrderDetails;

CREATE TABLE OrderDetails
(
	OrderID INTEGER PRIMARY KEY AUTOINCREMENT,	
	OrderDate datetime DEFAULT (datetime('now','localtime')),		--日期
	OrderWord NVARCHAR(50) NULL,				-- 字
	OrderNo NVARCHAR(100) NULL,				--號
	OrderCustomerId int NOT NULL,				--需求方
	OrderConstructionId int NOT NULL,				--工地名稱   
    	--OrderProductId int NOT NULL,				-- 產品訂單詳情ID  外錶ProductOrderDetails
	OrderAcceptor int NULL,				-- 工地驗收人
	OrderTransportation	 INTEGER NULL,			-- 運輸人
	OrderPrepared int NULL,				--製單人
	OrderBusiness int NULL,				-- 指定業務人
	OrderMerchandiser int NULL,				--跟單業務員											
	OrderPrintDate datetime DEFAULT (datetime('now','localtime')),	--打單時間
	FOREIGN KEY(OrderCustomerId) REFERENCES CustomerList(CustomerID),
	FOREIGN KEY(OrderConstructionId) REFERENCES ConstructionNameList(ConstructionID),	
    FOREIGN KEY(OrderAcceptor) REFERENCES RelationshipsPerson(PersonID),
    FOREIGN KEY(OrderTransportation) REFERENCES RelationshipsPerson(PersonID),
	FOREIGN KEY(OrderPrepared) REFERENCES RelationshipsPerson(PersonID),
	FOREIGN KEY(OrderBusiness) REFERENCES RelationshipsPerson(PersonID),
	FOREIGN KEY(OrderMerchandiser) REFERENCES RelationshipsPerson(PersonID)
	
);

-- 14訂單產品詳情表 NUMERIC 
drop table ProductOrderDetails;

CREATE TABLE ProductOrderDetails
(
    ProductDetailsId INTEGER PRIMARY KEY AUTOINCREMENT,	
	ProductOrderId INT NOT NULL,				-- 產品訂單ID  外錶OrderDetails
	ProductTypeId int NOT NULL,				--產品名稱規格
	ProductUnitID int NOT NULL,				-- 單位
	ProductQty DECIMAL(18,2) DEFAULT(0),			--數量
	ProductLevelID int NOT NULL,				--級別
	ProductMeters DECIMAL(25,2) DEFAULT(0),			--米數
	ProductDescription NVARCHAR(1000) NULL,			--說明
	FOREIGN KEY(ProductOrderId) REFERENCES OrderDetails(OrderID),
	FOREIGN KEY(ProductTypeId) REFERENCES ProductTypeList(ProductTypeID),
	FOREIGN KEY(ProductUnitID) REFERENCES UnitList(UnitID),
	FOREIGN KEY(ProductLevelID) REFERENCES LevelList(LevelID)	
	
);



-- 設置移動列印X,Y坐標糾正值
drop table PrintSetNumber;

CREATE TABLE PrintSetNumber
(
	PrintSetId INTEGER PRIMARY KEY AUTOINCREMENT,
	PrintSetX int DEFAULT(0),  --com 列坐標
	PrintSetY int DEFAULT(0)	, -- row 行坐標
	PrintPrinter VARCHAR(200) NULL,	--預設印表機名
	PrintFont VARCHAR(200) NULL default '宋體' ,---預設字體名
    PrintBottom boolean default(0),	--底部文字是否雙排 
	TitleFontSize int default(8),     -- 標題字體大小
	ConFontSize int default(8),	-- 內容字體大小
	HeadFontSize int default(8),	--表頭字體大小
	BoomFontSize int default(8)	-- 表底字體大小
);

--表的描述
drop table DataTableDesc;

CREATE TABLE DataTableDesc
(
	TableId INTEGER PRIMARY KEY AUTOINCREMENT,
	TableName nvahrcar(100) not null,
	TableDesc nvarchar(100) null
);


--列的列描述 columnName
drop table DataColumnDesc;

CREATE TABLE DataColumnDesc
(
	ColumnId INTEGER PRIMARY KEY AUTOINCREMENT,
	ColumnTableId int not null,
	ColumnName nvahrcar(100) not null,
	ColumnDesc nvarchar(100) null,
	FOREIGN KEY(ColumnTableId) REFERENCES DataTableDesc(TableId)
);

select * from DataTableDesc;

select * from DataColumnDesc;


select * from PrintSetNumber;

--視圖
CREATE VIEW v_DataTableColumn as select DataColumnDesc.*,DataTableDesc.TableName,DataTableDesc.TableDesc from DataColumnDesc,DataTableDesc 
where DataTableDesc.TableId=DataColumnDesc.ColumnTableId;

CREATE VIEW v_OperatingUser as select OperatingUser.*,CompanyBranch.CompanyName,CompanyBranch.companyTel,CompanyBranch.CompanyFax,CompanyBranch.CompanyAddress from OperatingUser,CompanyBranch where OperatingUser.UserCompanyId=CompanyBranch.CompanyID


drop view v_CompanyBranch;
--公司
create view v_CompanyBranch
as
select CompanyBranch.*,EnterpriseType.EnterpriseTypeName from CompanyBranch, EnterpriseType where CompanyBranch.CompanyTypeID=EnterpriseType.EnterpriseTypeID;


select CompanyBranch.*,EnterpriseType.EnterpriseTypeName from CompanyBranch, EnterpriseType where CompanyBranch.CompanyTypeID=EnterpriseType.EnterpriseTypeID;

select * from v_CompanyBranch;


drop view v_OperatingUser;
--用戶
create view v_OperatingUser
as
select OperatingUser.*,CompanyBranch.CompanyName,CompanyBranch.companyTel,CompanyBranch.CompanyFax,CompanyBranch.CompanyAddress from OperatingUser,CompanyBranch  where OperatingUser.UserCompanyId=CompanyBranch.CompanyID;

select * from v_OperatingUser;

--錶單用戶視圖

CREATE VIEW view_relationshipsPerson
AS
select RelationshipsPerson.*,RelationshipsType.RelationshipsTypeName FROM RelationshipsPerson,RelationshipsType
WHERE RelationshipsPerson.PersonType=RelationshipsType.RelationshipsTypeID; 


主、外鍵關聯要考慮

實體類層:

using System;
using System.Collections.Generic;
using System.Text;
 using System.Drawing;

namespace Geovin.Du.Model
{
	/// <summary>
	/// ProductTypeList的實體類產品名稱表
	///生成時間2018/9/14 15:11:05
	///塗聚文(Geovin Du)
	///</summary>
	public class ProductTypeListInfo
	{
		private int _ProductTypeID;

		/// <summary>
		/// ID,主鍵
		/// </summary>
		public int ProductTypeID
		{
			get { return _ProductTypeID; }
			set {_ProductTypeID = value; }
		}

		private string _ProductTypeName;

		/// <summary>
		/// 產品名稱
		/// </summary>
		public string ProductTypeName
		{
			get { return _ProductTypeName; }
			set {_ProductTypeName = value; }
		}

		private string _ProductTypePin;

		/// <summary>
		/// 字首字母
		/// </summary>
		public string ProductTypePin
		{
			get { return _ProductTypePin; }
			set {_ProductTypePin = value; }
		}

		private List<ProductModelInfo> _ProductModel;

		/// <summary>
		/// 主表:ProductTypeList產品名稱表,外鍵表:ProductModel產品規格,外鍵欄位:ModelProductTypeID;
		///</summary>
		public  List<ProductModelInfo> ProductModelList 
		{
			get { return _ProductModel; }
			set {_ProductModel = value; }
		}

		private DataTable _ProductModelData;

		/// <summary>
		/// 主表:ProductTypeList產品名稱表,外鍵表:ProductModel產品規格,外鍵欄位:ModelProductTypeID;
		///</summary>
		public  DataTable ProductModelData 
		{
			get { return _ProductModelData; }
			set {_ProductModelData = value; }
		}

		private DataSet _ProductModelDaset;

		/// <summary>
		/// 主表:ProductTypeList產品名稱表,外鍵表:ProductModel產品規格,外鍵欄位:ModelProductTypeID;
		///</summary>
		public  DataSet ProductModelDaset 
		{
			get { return _ProductModelDaset; }
			set {_ProductModelDaset = value; }
		}

		private List<UnitPriceInfo> _UnitPrice;

		/// <summary>
		/// 主表:ProductTypeList產品名稱表,外鍵表:UnitPrice單價表,外鍵欄位:UnitProductTypeID;
		///</summary>
		public  List<UnitPriceInfo> UnitPriceList 
		{
			get { return _UnitPrice; }
			set {_UnitPrice = value; }
		}

		private DataTable _UnitPriceData;

		/// <summary>
		/// 主表:ProductTypeList產品名稱表,外鍵表:UnitPrice單價表,外鍵欄位:UnitProductTypeID;
		///</summary>
		public  DataTable UnitPriceData 
		{
			get { return _UnitPriceData; }
			set {_UnitPriceData = value; }
		}

		private DataSet _UnitPriceDaset;

		/// <summary>
		/// 主表:ProductTypeList產品名稱表,外鍵表:UnitPrice單價表,外鍵欄位:UnitProductTypeID;
		///</summary>
		public  DataSet UnitPriceDaset 
		{
			get { return _UnitPriceDaset; }
			set {_UnitPriceDaset = value; }
		}

		private List<ProductItOrderDetailsInfo> _ProductItOrderDetails;

		/// <summary>
		/// 主表:ProductTypeList產品名稱表,外鍵表:ProductItOrderDetails,外鍵欄位:ProductTypeId;
		///</summary>
		public  List<ProductItOrderDetailsInfo> ProductItOrderDetailsList 
		{
			get { return _ProductItOrderDetails; }
			set {_ProductItOrderDetails = value; }
		}

		private DataTable _ProductItOrderDetailsData;

		/// <summary>
		/// 主表:ProductTypeList產品名稱表,外鍵表:ProductItOrderDetails,外鍵欄位:ProductTypeId;
		///</summary>
		public  DataTable ProductItOrderDetailsData 
		{
			get { return _ProductItOrderDetailsData; }
			set {_ProductItOrderDetailsData = value; }
		}

		private DataSet _ProductItOrderDetailsDaset;

		/// <summary>
		/// 主表:ProductTypeList產品名稱表,外鍵表:ProductItOrderDetails,外鍵欄位:ProductTypeId;
		///</summary>
		public  DataSet ProductItOrderDetailsDaset 
		{
			get { return _ProductItOrderDetailsDaset; }
			set {_ProductItOrderDetailsDaset = value; }
		}

		private List<ProductOrderDetailsInfo> _ProductOrderDetails;

		/// <summary>
		/// 主表:ProductTypeList產品名稱表,外鍵表:ProductOrderDetails,外鍵欄位:ProductTypeId;
		///</summary>
		public  List<ProductOrderDetailsInfo> ProductOrderDetailsList 
		{
			get { return _ProductOrderDetails; }
			set {_ProductOrderDetails = value; }
		}

		private DataTable _ProductOrderDetailsData;

		/// <summary>
		/// 主表:ProductTypeList產品名稱表,外鍵表:ProductOrderDetails,外鍵欄位:ProductTypeId;
		///</summary>
		public  DataTable ProductOrderDetailsData 
		{
			get { return _ProductOrderDetailsData; }
			set {_ProductOrderDetailsData = value; }
		}

		private DataSet _ProductOrderDetailsDaset;

		/// <summary>
		/// 主表:ProductTypeList產品名稱表,外鍵表:ProductOrderDetails,外鍵欄位:ProductTypeId;
		///</summary>
		public  DataSet ProductOrderDetailsDaset 
		{
			get { return _ProductOrderDetailsDaset; }
			set {_ProductOrderDetailsDaset = value; }
		}

		
	}
}

  

 

數據處理層:

using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using System.Data.SQLite;
using System.Drawing;
using Geovin.Du.Commn;
using Geovin.Du.Model;
using Geovin.Du.Interface;

namespace Geovin.Du.SQLiteDAL
{
	/// <summary>
	/// ProductItOrderDetails數據訪問層
	///生成時間2018/9/14 14:36:05
	///塗聚文(Geovin Du)
	///</summary>
	public class ProductItOrderDetailsDAL : IProductItOrderDetails
	{
		///<summary>
		/// 追加記錄
		///</summary>
		///<param name="ProductItOrderDetailsInfo"></param>
		///<returns></returns>
		public int InsertProductItOrderDetails(ProductItOrderDetailsInfo productItOrderDetails)
		{
			int ret = 0;
			try
			{
				StringBuilder strSql = new StringBuilder();
				strSql.Append("INSERT INTO ProductItOrderDetails([ProductOrderId] ,[ProductTypeId] ,[ProductModleId] ,[ProductUnitID] ,[ProductQty] ,[ProductPriceID] ,[ProductMeters] ,[ProductDescription]");
				strSql.Append(") VALUES (");
				strSql.Append("@ProductOrderId ,@ProductTypeId ,@ProductModleId ,@ProductUnitID ,@ProductQty ,@ProductPriceID ,@ProductMeters ,@ProductDescription)");
				SQLiteParameter[] par = new SQLiteParameter[]{
				new SQLiteParameter("@ProductOrderId",DbType.Int32,4),
				new SQLiteParameter("@ProductTypeId",DbType.Int32,4),
				new SQLiteParameter("@ProductModleId",DbType.Int32,4),
				new SQLiteParameter("@ProductUnitID",DbType.Int32,4),
				new SQLiteParameter("@ProductQty",DbType.Decimal,8),
				new SQLiteParameter("@ProductPriceID",DbType.Int32,4),
				new SQLiteParameter("@ProductMeters",DbType.Decimal,8),
				new SQLiteParameter("@ProductDescription",DbType.String,1000),
				};
				par[0].Value = productItOrderDetails.ProductOrderId;
				par[1].Value = productItOrderDetails.ProductTypeId;
				par[2].Value = productItOrderDetails.ProductModleId;
				par[3].Value = productItOrderDetails.ProductUnitID;
				par[4].Value = productItOrderDetails.ProductQty;
				par[5].Value = productItOrderDetails.ProductPriceID;
				par[6].Value = productItOrderDetails.ProductMeters;
				par[7].Value = productItOrderDetails.ProductDescription;
				ret = SQLiteHelper.ExecuteSql(strSql.ToString(), CommandType.Text, par);
			}
			catch (SQLiteException ex)
			{
				throw ex;
			}
			return ret;
		}
		///<summary>
		/// 追加記錄返回值
		///</summary>
		///<param name="ProductItOrderDetailsInfo"></param>
		///<returns></returns>
		public int InsertProductItOrderDetailsOutput (ProductItOrderDetailsInfo productItOrderDetails,out int productDetailsId)
		{
			int ret = 0;
			productDetailsId= 0;
			try
			{
				StringBuilder strSql = new StringBuilder();
				strSql.Append("INSERT INTO ProductItOrderDetails([ProductOrderId] ,[ProductTypeId] ,[ProductModleId] ,[ProductUnitID] ,[ProductQty] ,[ProductPriceID] ,[ProductMeters] ,[ProductDescription]");
				strSql.Append(") VALUES (");
				strSql.Append("@ProductOrderId ,@ProductTypeId ,@ProductModleId ,@ProductUnitID ,@ProductQty ,@ProductPriceID ,@ProductMeters ,@ProductDescription)");
				SQLiteParameter[] par = new SQLiteParameter[]{
				new SQLiteParameter("@ProductOrderId",DbType.Int32,4),
				new SQLiteParameter("@ProductTypeId",DbType.Int32,4),
				new SQLiteParameter("@ProductModleId",DbType.Int32,4),
				new SQLiteParameter("@ProductUnitID",DbType.Int32,4),
				new SQLiteParameter("@ProductQty",DbType.Decimal,8),
				new SQLiteParameter("@ProductPriceID",DbType.Int32,4),
				new SQLiteParameter("@ProductMeters",DbType.Decimal,8),
				new SQLiteParameter("@ProductDescription",DbType.String,1000),
				new SQLiteParameter("@ProductDetailsId",DbType.Int32,8),
				};
				par[0].Value = productItOrderDetails.ProductOrderId;
				par[1].Value = productItOrderDetails.ProductTypeId;
				par[2].Value = productItOrderDetails.ProductModleId;
				par[3].Value = productItOrderDetails.ProductUnitID;
				par[4].Value = productItOrderDetails.ProductQty;
				par[5].Value = productItOrderDetails.ProductPriceID;
				par[6].Value = productItOrderDetails.ProductMeters;
				par[7].Value = productItOrderDetails.ProductDescription;
				//par[8].Direction = ParameterDirection.Output;
				ret = SQLiteHelper.ExecuteSql(strSql.ToString(), out productDetailsId, par);
			
				if(ret>0)
				{
				
					//productDetailsId=(int)par[8].Value;
			
				}
			}
			catch (SQLiteException ex)
			{
				throw ex;
			}
			return ret;
		}
		///<summary>
		///修改記錄
		///</summary>
		///<param name="ProductItOrderDetailsInfo"></param>
		///<returns></returns>
		public int UpdateProductItOrderDetails(ProductItOrderDetailsInfo productItOrderDetails)
		{
			int ret = 0;
			try
			{
				StringBuilder strSql = new StringBuilder();
				strSql.Append("UPDATE ProductItOrderDetails SET ");
				strSql.Append("[ProductOrderId]=@ProductOrderId ,");
				strSql.Append("[ProductTypeId]=@ProductTypeId ,");
				strSql.Append("[ProductModleId]=@ProductModleId ,");
				strSql.Append("[ProductUnitID]=@ProductUnitID ,");
				strSql.Append("[ProductQty]=@ProductQty ,");
				strSql.Append("[ProductPriceID]=@ProductPriceID ,");
				strSql.Append("[ProductMeters]=@ProductMeters ,");
				strSql.Append("[ProductDescription]=@ProductDescription");
				strSql.Append(" where ");
				strSql.Append("[ProductDetailsId]=@ProductDetailsId");
				SQLiteParameter[] par = new SQLiteParameter[]{
				new SQLiteParameter("@ProductOrderId",DbType.Int32,4),
				new SQLiteParameter("@ProductTypeId",DbType.Int32,4),
				new SQLiteParameter("@ProductModleId",DbType.Int32,4),
				new SQLiteParameter("@ProductUnitID",DbType.Int32,4),
				new SQLiteParameter("@ProductQty",DbType.Decimal,8),
				new SQLiteParameter("@ProductPriceID",DbType.Int32,4),
				new SQLiteParameter("@ProductMeters",DbType.Decimal,8),
				new SQLiteParameter("@ProductDescription",DbType.String,1000),
				new SQLiteParameter("@ProductDetailsId",DbType.Int32),
				};
				par[0].Value = productItOrderDetails.ProductOrderId;
				par[1].Value = productItOrderDetails.ProductTypeId;
				par[2].Value = productItOrderDetails.ProductModleId;
				par[3].Value = productItOrderDetails.ProductUnitID;
				par[4].Value = productItOrderDetails.ProductQty;
				par[5].Value = productItOrderDetails.ProductPriceID;
				par[6].Value = productItOrderDetails.ProductMeters;
				par[7].Value = productItOrderDetails.ProductDescription;
				par[8].Value = productItOrderDetails.ProductDetailsId;
				ret = SQLiteHelper.ExecuteSql(strSql.ToString(), CommandType.Text, par);
			}
			catch (SQLiteException ex)
			{
				throw ex;
			}
			return ret;
		}
		///<summary>
		/// 刪除記錄
		///</summary>
		///<param name="productDetailsIdInfo"></param>
		///<returns></returns>
		public bool DeleteProductItOrderDetails(int productDetailsId)
		{
			bool ret = false;
			try
			{
				StringBuilder strSql = new StringBuilder();
				strSql.Append("delete from productItOrderDetails");
				strSql.Append(" where  ProductDetailsId=");
				strSql.Append("@ProductDetailsId ");
				SQLiteParameter[] par = new SQLiteParameter[]{
					 new SQLiteParameter("@ProductDetailsId",productDetailsId)
				};
				int temp = 0 ;
				temp = SQLiteHelper.ExecuteSql(strSql.ToString(), CommandType.Text, par);
				if(temp!=0)
				{
					ret = true;
				}
			}
			catch (SQLiteException ex)
			{
				throw ex;
			}
			return ret;
		}
		/// <summary>
		/// 刪除外鍵的記錄,當此關聯的主鍵表要刪除記錄,外鍵記錄要刪除
		/// </summary>
		/// <param name="tableId"></param>
		/// <returns></returns>
		public bool DeleteProductPriceID(int productPriceID)
		{
			bool ret = false;
			try
			{
				StringBuilder strSql = new StringBuilder();
				strSql.Append("delete from ProductItOrderDetails");
				strSql.Append(" where  ProductPriceID=");
				strSql.Append("@ProductPriceID ");
				SQLiteParameter[] par = new SQLiteParameter[]{
				new SQLiteParameter("@ProductPriceID",productPriceID)
					}
				int temp = 0;
				temp = SQLiteHelper.ExecuteSql(strSql.ToString(), CommandType.Text, par);
				if (temp != 0)
				{
					ret = true;
				}
			}
			catch (SQLiteException ex)
			{
				throw ex;
			}
			return ret;
			}
		/// <summary>
		/// 刪除外鍵的記錄,當此關聯的主鍵表要刪除記錄,外鍵記錄要刪除
		/// </summary>
		/// <param name="tableId"></param>
		/// <returns></returns>
		public bool DeleteProductUnitID(int productUnitID)
		{
			bool ret = false;
			try
			{
				StringBuilder strSql = new StringBuilder();
				strSql.Append("delete from ProductItOrderDetails");
				strSql.Append(" where  ProductUnitID=");
				strSql.Append("@ProductUnitID ");
				SQLiteParameter[] par = new SQLiteParameter[]{
				new SQLiteParameter("@ProductUnitID",productUnitID)
					}
				int temp = 0;
				temp = SQLiteHelper.ExecuteSql(strSql.ToString(), CommandType.Text, par);
				if (temp != 0)
				{
					ret = true;
				}
			}
			catch (SQLiteException ex)
			{
				throw ex;
			}
			return ret;
			}
		/// <summary>
		/// 刪除外鍵的記錄,當此關聯的主鍵表要刪除記錄,外鍵記錄要刪除
		/// </summary>
		/// <param name="tableId"></param>
		/// <returns></returns>
		public bool DeleteProductModleId(int productModleId)
		{
			bool ret = false;
			try
			{
				StringBuilder strSql = new StringBuilder();
				strSql.Append("delete from ProductItOrderDetails");
				strSql.Append(" where  ProductModleId=");
				strSql.Append("@ProductModleId ");
				SQLiteParameter[] par = new SQLiteParameter[]{
				new SQLiteParameter("@ProductModleId",productModleId)
					}
				int temp = 0;
				temp = SQLiteHelper.ExecuteSql(strSql.ToString(), CommandType.Text, par);
				if (temp != 0)
				{
					ret = true;
				}
			}
			catch (SQLiteException ex)
			{
				throw ex;
			}
			return ret;
			}
		/// <summary>
		/// 刪除外鍵的記錄,當此關聯的主鍵表要刪除記錄,外鍵記錄要刪除
		/// </summary>
		/// <param name="tableId"></param>
		/// <returns></returns>
		public bool DeleteProductTypeId(int productTypeId)
		{
			bool ret = false;
			try
			{
				StringBuilder strSql = new StringBuilder();
				strSql.Append("delete from ProductItOrderDetails");
				strSql.Append(" where  ProductTypeId=");
				strSql.Append("@ProductTypeId ");
				SQLiteParameter[] par = new SQLiteParameter[]{
				new SQLiteParameter("@ProductTypeId",productTypeId)
					}
				int temp = 0;
				temp = SQLiteHelper.ExecuteSql(strSql.ToString(), CommandType.Text, par);
				if (temp != 0)
				{
					ret = true;
				}
			}
			catch (SQLiteException ex)
			{
				throw ex;
			}
			return ret;
			}
		/// <summary>
		/// 刪除外鍵的記錄,當此關聯的主鍵表要刪除記錄,外鍵記錄要刪除
		/// </summary>
		/// <param name="tableId"></param>
		/// <returns></returns>
		public bool DeleteProductOrderId(int productOrderId)
		{
			bool ret = false;
			try
			{
				StringBuilder strSql = new StringBuilder();
				strSql.Append("delete from ProductItOrderDetails");
				strSql.Append(" where  ProductOrderId=");
				strSql.Append("@ProductOrderId ");
				SQLiteParameter[] par = new SQLiteParameter[]{
				new SQLiteParameter("@ProductOrderId",productOrderId)
					}
				int temp = 0;
				temp = SQLiteHelper.ExecuteSql(strSql.ToString(), CommandType.Text, par);
				if (temp != 0)
				{
					ret = true;
				}
			}
			catch (SQLiteException ex)
			{
				throw ex;
			}
			return ret;
			}
		///<summary>
		/// 查詢記錄
		///</summary>
		///<param name="productDetailsIdInfo"></param>
		///<returns></returns>
		public ProductItOrderDetailsInfo SelectProductItOrderDetails(int productDetailsId)
		{
			ProductItOrderDetailsInfo productItOrderDetails = null;
			try
			{
				StringBuilder strSql = new StringBuilder();
				strSql.Append("select * from  productItOrderDetails");
				strSql.Append(" where  ProductDetailsId=");
				strSql.Append("@ProductDetailsId ");
				SQLiteParameter[] par = new SQLiteParameter[]{
					new SQLiteParameter("@ProductDetailsId",productDetailsId)
				};
				using (SQLiteDataReader reader = SQLiteHelper.GetReader(strSql.ToString(), CommandType.Text, par))
				{
					if (reader.Read())
					{
						productItOrderDetails = new ProductItOrderDetailsInfo();
						productItOrderDetails.ProductDetailsId =(!object.Equals(reader["ProductDetailsId"],null))? int.Parse(reader["ProductDetailsId"].ToString()):0;
						productItOrderDetails.ProductOrderId =(!object.Equals(reader["ProductOrderId"],null))? int.Parse(reader["ProductOrderId"].ToString()):0;
						productItOrderDetails.ProductTypeId =(!object.Equals(reader["ProductTypeId"],null))? int.Parse(reader["ProductTypeId"].ToString()):0;
						productItOrderDetails.ProductModleId =(!object.Equals(reader["ProductModleId"],null))? int.Parse(reader["ProductModleId"].ToString()):0;
						productItOrderDetails.ProductUnitID =(!object.Equals(reader["ProductUnitID"],null))? int.Parse(reader["ProductUnitID"].ToString()):0;
						productItOrderDetails.ProductQty = (Decimal) reader["ProductQty"];
						productItOrderDetails.ProductPriceID =(!object.Equals(reader["ProductPriceID"],null))? int.Parse(reader["ProductPriceID"].ToString()):0;
						productItOrderDetails.ProductMeters = (Decimal) reader["ProductMeters"];
						productItOrderDetails.ProductDescription =(!object.Equals(reader["ProductDescription"],null))? (string) reader["ProductDescription"]:"";
						
					}
				}
			}
			catch (SQLiteException ex)
			{
				throw ex;
			}
			return productItOrderDetails;
		}
		
		/// <summary>
		/// 查詢外鍵ID的所有記錄
		/// </summary>
		/// <param name="ProductPriceID">外鍵ID</param>
		/// <returns></returns>
		public List<ProductItOrderDetailsInfo> SelectListProductItOrderDetailsProductPriceID(int productPriceID)
		{
			List<ProductItOrderDetailsInfo> list = new List<ProductItOrderDetailsInfo>();
			ProductItOrderDetailsInfo productItOrderDetails = null;
			try
			{
				StringBuilder strSql = new StringBuilder();
				strSql.Append("select * from  ProductItOrderDetails");
				strSql.Append(" where  ProductPriceID=");
				strSql.Append("@ProductPriceID ");
				SQLiteParameter[] par = new SQLiteParameter[]{
					new SQLiteParameter("@ProductPriceID",productPriceID)
				};
				using (SQLiteDataReader reader = SQLiteHelper.GetReader(strSql.ToString(), CommandType.Text, par))
				{
					while (reader.Read())
					{
						productItOrderDetails = new ProductItOrderDetailsInfo();
						productItOrderDetails.ProductDetailsId =(!object.Equals(reader["ProductDetailsId"],null))? int.Parse(reader["ProductDetailsId"].ToString()):0;
						productItOrderDetails.ProductOrderId =(!object.Equals(reader["ProductOrderId"],null))? int.Parse(reader["ProductOrderId"].ToString()):0;
						productItOrderDetails.ProductTypeId =(!object.Equals(reader["ProductTypeId"],null))? int.Parse(reader["ProductTypeId"].ToString()):0;
						productItOrderDetails.ProductModleId =(!object.Equals(reader["ProductModleId"],null))? int.Parse(reader["ProductModleId"].ToString()):0;
						productItOrderDetails.ProductUnitID =(!object.Equals(reader["ProductUnitID"],null))? int.Parse(reader["ProductUnitID"].ToString()):0;
						productItOrderDetails.ProductQty = (Decimal) reader["ProductQty"];
						productItOrderDetails.ProductPriceID =(!object.Equals(reader["ProductPriceID"],null))? int.Parse(reader["ProductPriceID"].ToString()):0;
						productItOrderDetails.ProductMeters = (Decimal) reader["ProductMeters"];
						productItOrderDetails.ProductDescription =(!object.Equals(reader["ProductDescription"],null))? (string) reader["ProductDescription"]:"";
						list.Add(productItOrderDetails);
					}
					}
				}
				catch (SQLiteException ex)
				{
					throw ex;
				}
			return list;
		}
		/// <summary>
		/// 查詢外鍵ID的所有記錄
		/// </summary>
		/// <param name="ProductPriceID">外鍵ID</param>
		/// <returns></returns>
		public DataTable SelectProductItOrderDetailsProductPriceID(int productPriceID)
		{
			DataTable dt = null;
			try
			{
				StringBuilder strSql = new StringBuilder();
				strSql.Append("select * from  ProductItOrderDetails");
				strSql.Append(" where  ProductPriceID=");
				strSql.Append("@ProductPriceID ");
				SQLiteParameter[] par = new SQLiteParameter[]{
					new SQLiteParameter("@ProductPriceID",productPriceID)
				};
				using (DataTable reader = SQLiteHelper.GetTable(strSql.ToString(), CommandType.Text, par))
				{
					dt = reader;
				}
			}
			catch (SQLiteException ex)
			{
				throw ex;
			}
			return dt;
		}
		/// <summary>
		/// 查詢外鍵ID的所有記錄
		/// </summary>
		/// <param name="ProductUnitID">外鍵ID</param>
		/// <returns></returns>
		public List<ProductItOrderDetailsInfo> SelectListProductItOrderDetailsProductUnitID(int productUnitID)
		{
			List<ProductItOrderDetailsInfo> list = new List<ProductItOrderDetailsInfo>();
			ProductItOrderDetailsInfo productItOrderDetails = null;
			try
			{
				StringBuilder strSql = new StringBuilder();
				strSql.Append("select * from  ProductItOrderDetails");
				strSql.Append(" where  ProductUnitID=");
				strSql.Append("@ProductUnitID ");
				SQLiteParameter[] par = new SQLiteParameter[]{
					new SQLiteParameter("@ProductUnitID",productUnitID)
				};
				using (SQLiteDataReader reader = SQLiteHelper.GetReader(strSql.ToString(), CommandType.Text, par))
				{
					while (reader.Read())
					{
						productItOrderDetails = new ProductItOrderDetailsInfo();
						productItOrderDetails.ProductDetailsId =(!object.Equals(reader["ProductDetailsId"],null))? int.Parse(reader["ProductDetailsId"].ToString()):0;
						productItOrderDetails.ProductOrderId =(!object.Equals(reader["ProductOrderId"],null))? int.Parse(reader["ProductOrderId"].ToString()):0;
						productItOrderDetails.ProductTypeId =(!object.Equals(reader["ProductTypeId"],null))? int.Parse(reader["ProductTypeId"].ToString()):0;
						productItOrderDetails.ProductModleId =(!object.Equals(reader["ProductModleId"],null))? int.Parse(reader["ProductModleId"].ToString()):0;
						productItOrderDetails.ProductUnitID =(!object.Equals(reader["ProductUnitID"],null))? int.Parse(reader["ProductUnitID"].ToString()):0;
						productItOrderDetails.ProductQty = (Decimal) reader["ProductQty"];
						productItOrderDetails.ProductPriceID =(!object.Equals(reader["ProductPriceID"],null))? int.Parse(reader["ProductPriceID"].ToString()):0;
						productItOrderDetails.ProductMeters = (Decimal) reader["ProductMeters"];
						productItOrderDetails.ProductDescription =(!object.Equals(reader["ProductDescription"],null))? (string) reader["ProductDescription"]:"";
						list.Add(productItOrderDetails);
					}
					}
				}
				catch (SQLiteException ex)
				{
					throw ex;
				}
			return list;
		}
		/// <summary>
		/// 查詢外鍵ID的所有記錄
		/// </summary>
		/// <param name="ProductUnitID">外鍵ID</param>
		/// <returns></returns>
		public DataTable SelectProductItOrderDetailsProductUnitID(int productUnitID)
		{
			DataTable dt = null;
			try
			{
				StringBuilder strSql = new StringBuilder();
				strSql.Append("select * from  ProductItOrderDetails");
				strSql.Append(" where  ProductUnitID=");
				strSql.Append("@ProductUnitID ");
				SQLiteParameter[] par = new SQLiteParameter[]{
					new SQLiteParameter("@ProductUnitID",productUnitID)
				};
				using (DataTable reader = SQLiteHelper.GetTable(strSql.ToString(), CommandType.Text, par))
				{
					dt = reader;
				}
			}
			catch (SQLiteException ex)
			{
				throw ex;
			}
			return dt;
		}
		/// <summary>
		/// 查詢外鍵ID的所有記錄
		/// </summary>
		/// <param name="ProductModleId">外鍵ID</param>
		/// <returns></returns>
		public List<ProductItOrderDetailsInfo> SelectListProductItOrderDetailsProductModleId(int productModleId)
		{
			List<ProductItOrderDetailsInfo> list = new List<ProductItOrderDetailsInfo>();
			ProductItOrderDetailsInfo productItOrderDetails = null;
			try
			{
				StringBuilder strSql = new StringBuilder();
				strSql.Append("select * from  ProductItOrderDetails");
				strSql.Append(" where  ProductModleId=");
				strSql.Append("@ProductModleId ");
				SQLiteParameter[] par = new SQLiteParameter[]{
					new SQLiteParameter("@ProductModleId",productModleId)
				};
				using (SQLiteDataReader reader = SQLiteHelper.GetReader(strSql.ToString(), CommandType.Text, par))
				{
					while (reader.Read())
					{
						productItOrderDetails = new ProductItOrderDetailsInfo();
						productItOrderDetails.ProductDetailsId =(!object.Equals(reader["ProductDetailsId"],null))? int.Parse(reader["ProductDetailsId"].ToString()):0;
						productItOrderDetails.ProductOrderId =(!object.Equals(reader["ProductOrderId"],null))? int.Parse(reader["ProductOrderId"].ToString()):0;
						productItOrderDetails.ProductTypeId =(!object.Equals(reader["ProductTypeId"],null))? int.Parse(reader["ProductTypeId"].ToString()):0;
						productItOrderDetails.ProductModleId =(!object.Equals(reader["ProductModleId"],null))? int.Parse(reader["ProductModleId"].ToString()):0;
						productItOrderDetails.ProductUnitID =(!object.Equals(reader["ProductUnitID"],null))? int.Parse(reader["ProductUnitID"].ToString()):0;
						productItOrderDetails.ProductQty = (Decimal) reader["ProductQty"];
						productItOrderDetails.ProductPriceID =(!object.Equals(reader["ProductPriceID"],null))? int.Parse(reader["ProductPriceID"].ToString()):0;
						productItOrderDetails.ProductMeters = (Decimal) reader["ProductMeters"];
						productItOrderDetails.ProductDescription =(!object.Equals(reader["ProductDescription"],null))? (string) reader["ProductDescription"]:"";
						list.Add(productItOrderDetails);
					}
					}
				}
				catch (SQLiteException ex)
				{
					throw ex;
				}
			return list;
		}
		/// <summary>
		/// 查詢外鍵ID的所有記錄
		/// </summary>
		/// <param name="ProductModleId">外鍵ID</param>
		/// <returns></returns>
		public DataTable SelectProductItOrderDetailsProductModleId(int productModleId)
		{
			DataTable dt = null;
			try
			{
				StringBuilder strSql = new StringBuilder();
				strSql.Append("select * from  ProductItOrderDetails");
				strSql.Append(" where  ProductModleId=");
				strSql.Append("@ProductModleId ");
				SQLiteParameter[] par = new SQLiteParameter[]{
					new SQLiteParameter("@ProductModleId",productModleId)
				};
				using (DataTable reader = SQLiteHelper.GetTable(strSql.ToString(), CommandType.Text, par))
				{
					dt = reader;
				}
			}
			catch (SQLiteException ex)
			{
				throw ex;
			}
			return dt;
		}
		/// <summary>
		/// 查詢外鍵ID的所有記錄
		/// </summary>
		/// <param name="ProductTypeId">外鍵ID</param>
		/// <returns></returns>
		public List<ProductItOrderDetailsInfo> SelectListProductItOrderDetailsProductTypeId(int productTypeId)
		{
			List<ProductItOrderDetailsInfo> list = new List<ProductItOrderDetailsInfo>();
			ProductItOrderDetailsInfo productItOrderDetails = null;
			try
			{
				StringBuilder strSql = new StringBuilder();
				strSql.Append("select * from  ProductItOrderDetails");
				strSql.Append(" where  ProductTypeId=");
				strSql.Append("@ProductTypeId ");
				SQLiteParameter[] par = new SQLiteParameter[]{
					new SQLiteParameter("@ProductTypeId",productTypeId)
				};
				using (SQLiteDataReader reader = SQLiteHelper.GetReader(strSql.ToString(), CommandType.Text, par))
				{
					while (reader.Read())
					{
						productItOrderDetails = new ProductItOrderDetailsInfo();
						productItOrderDetails.ProductDetailsId =(!object.Equals(reader["ProductDetailsId"],null))? int.Parse(reader["ProductDetailsId"].ToString()):0;
						productItOrderDetails.ProductOrderId =(!object.Equals(reader["ProductOrderId"],null))? int.Parse(reader["ProductOrderId"].ToString()):0;
						productItOrderDetails.ProductTypeId =(!object.Equals(reader["ProductTypeId"],null))? int.Parse(reader["ProductTypeId"].ToString()):0;
						productItOrderDetails.ProductModleId =(!object.Equals(reader["ProductModleId"],null))? int.Parse(reader["ProductModleId"].ToString()):0;
						productItOrderDetails.ProductUnitID =(!object.Equals(reader["ProductUnitID"],null))? int.Parse(reader["ProductUnitID"].ToString()):0;
						productItOrderDetails.ProductQty = (Decimal) reader["ProductQty"];
						productItOrderDetails.ProductPriceID =(!object.Equals(reader["ProductPriceID"],null))? int.Parse(reader["ProductPriceID"].ToString()):0;
						productItOrderDetails.ProductMeters = (Decimal) reader["ProductMeters"];
						productItOrderDetails.ProductDescription =(!object.Equals(reader["ProductDescription"],null))? (string) reader["ProductDescription"]:"";
						list.Add(productItOrderDetails);
					}
					}
				}
				catch (SQLiteException ex)
				{
					throw ex;
				}
			return list;
		}
		/// <summary>
		/// 查詢外鍵ID的所有記錄
		/// </summary>
		/// <param name="ProductTypeId">外鍵ID</param>
		/// <returns></returns>
		public DataTable SelectProductItOrderDetailsProductTypeId(int productTypeId)
		{
			DataTable dt = null;
			try
			{
				StringBuilder strSql = new StringBuilder();
				strSql.Append("select * from  ProductItOrderDetails");
				strSql.Append(" where  ProductTypeId=");
				strSql.Append("@ProductTypeId ");
				SQLiteParameter[] par = new SQLiteParameter[]{
					new SQLiteParameter("@ProductTypeId",productTypeId)
				};
				using (DataTable reader = SQLiteHelper.GetTable(strSql.ToString(), CommandType.Text, par))
				{
					dt = reader;
				}
			}
			catch (SQLiteException ex)
			{
				throw ex;
			}
			return dt;
		}
		/// <summary>
		/// 查詢外鍵ID的所有記錄
		/// </summary>
		/// <param name="ProductOrderId">外鍵ID</param>
		/// <returns></returns>
		public List<ProductItOrderDetailsInfo> SelectListProductItOrderDetailsProductOrderId(int productOrderId)
		{
			List<ProductItOrderDetailsInfo> list = new List<ProductItOrderDetailsInfo>();
			ProductItOrderDetailsInfo productItOrderDetails = null;
			try
			{
				StringBuilder strSql = new StringBuilder();
				strSql.Append("select * from  ProductItOrderDetails");
				strSql.Append(" where  ProductOrderId=");
				strSql.Append("@ProductOrderId ");
				SQLiteParameter[] par = new SQLiteParameter[]{
					new SQLiteParameter("@ProductOrderId",productOrderId)
				};
				using (SQLiteDataReader reader = SQLiteHelper.GetReader(strSql.ToString(), CommandType.Text, par))
				{
					while (reader.Read())
					{
						productItOrderDetails = new ProductItOrderDetailsInfo();
						productItOrderDetails.ProductDetailsId =(!object.Equals(reader["ProductDetailsId"],null))? int.Parse(reader["ProductDetailsId"].ToString()):0;
						productItOrderDetails.ProductOrderId =(!object.Equals(reader["ProductOrderId"],null))? int.Parse(reader["ProductOrderId"].ToString()):0;
						productItOrderDetails.ProductTypeId =(!object.Equals(reader["ProductTypeId"],null))? int.Parse(reader["ProductTypeId"].ToString()):0;
						productItOrderDetails.ProductModleId =(!object.Equals(reader["ProductModleId"],null))? int.Parse(reader["ProductModleId"].ToString()):0;
						productItOrderDetails.ProductUnitID =(!object.Equals(reader["ProductUnitID"],null))? int.Parse(reader["ProductUnitID"].ToString()):0;
						productItOrderDetails.ProductQty = (Decimal) reader["ProductQty"];
						productItOrderDetails.ProductPriceID =(!object.Equals(reader["ProductPriceID"],null))? int.Parse(reader["ProductPriceID"].ToString()):0;
						productItOrderDetails.ProductMeters = (Decimal) reader["ProductMeters"];
						productItOrderDetails.ProductDescription =(!object.Equals(reader["ProductDescription"],null))? (string) reader["ProductDescription"]:"";
						list.Add(productItOrderDetails);
					}
					}
				}
				catch (SQLiteException ex)
				{
					throw ex;
				}
			return list;
		}
		/// <summary>
		/// 查詢外鍵ID的所有記錄
		/// </summary>
		/// <param name="ProductOrderId">外鍵ID</param>
		/// <returns></returns>
		public DataTable SelectProductItOrderDetailsProductOrderId(int productOrderId)
		{
			DataTable dt = null;
			try
			{
				StringBuilder strSql = new StringBuilder();
				strSql.Append("select * from  ProductItOrderDetails");
				strSql.Append(" where  ProductOrderId=");
				strSql.Append("@ProductOrderId ");
				SQLiteParameter[] par = new SQLiteParameter[]{
					new SQLiteParameter("@ProductOrderId",productOrderId)
				};
				using (DataTable reader = SQLiteHelper.GetTable(strSql.ToString(), CommandType.Text, par))
				{
					dt = reader;
				}
			}
			catch (SQLiteException ex)
			{
				throw ex;
			}
			return dt;
		}
		///<summary>
		/// 查詢所有記錄
		///</summary>
		///<returns></returns>
		public List<ProductItOrderDetailsInfo> SelectProductItOrderDetailsAll()
		{
			List<ProductItOrderDetailsInfo> list = new List<ProductItOrderDetailsInfo>();
			ProductItOrderDetailsInfo productItOrderDetails = null;
			try
			{
				StringBuilder strSql = new StringBuilder();
				strSql.Append("select * from  productItOrderDetails");
				using (SQLiteDataReader reader = SQLiteHelper.GetReader(strSql.ToString(),CommandType.Text, null))
				{
					while (reader.Read())
					{
						productItOrderDetails = new ProductItOrderDetailsInfo();
						productItOrderDetails.ProductDetailsId =(!object.Equals(reader["ProductDetailsId"],null))? int.Parse(reader["ProductDetailsId"].ToString()):0;
						productItOrderDetails.ProductOrderId =(!object.Equals(reader["ProductOrderId"],null))? int.Parse(reader["ProductOrderId"].ToString()):0;
						productItOrderDetails.ProductTypeId =(!object.Equals(reader["ProductTypeId"],null))? int.Parse(reader["ProductTypeId"].ToString()):0;
						productItOrderDetails.ProductModleId =(!object.Equals(reader["ProductModleId"],null))? int.Parse(reader["ProductModleId"].ToString()):0;
						productItOrderDetails.ProductUnitID =(!object.Equals(reader["ProductUnitID"],null))? int.Parse(reader["ProductUnitID"].ToString()):0;
						productItOrderDetails.ProductQty = (Decimal) reader["ProductQty"];
						productItOrderDetails.ProductPriceID =(!object.Equals(reader["ProductPriceID"],null))? int.Parse(reader["ProductPriceID"].ToString()):0;
						productItOrderDetails.ProductMeters = (Decimal) reader["ProductMeters"];
						productItOrderDetails.ProductDescription =(!object.Equals(reader["ProductDescription"],null))? (string) reader["ProductDescription"]:"";
						list.Add(productItOrderDetails);
						
					}
				}
			}
			catch (SQLiteException ex)
			{
				throw ex;
			}
			return list;
		}
		///<summary>
		/// 查詢所有記錄
		///</summary>
		///<returns></returns>
		public DataTable SelectProductItOrderDetailsDataTableAll()
		{
			DataTable dt = new DataTable();
			try
			{
				StringBuilder strSql = new StringBuilder();
				strSql.Append("select * from productItOrderDetails");
				using (DataTable reader = SQLiteHelper.GetTable(strSql.ToString(), CommandType.Text, null))
				{
					dt = reader;
						
					
				}
			}
			catch (SQLiteException ex)
			{
				throw ex;
			}
			return dt;
		}
		///<summary>
		///SQL腳本 刪除多條記錄
		///</summary>
		///<param name="productDetailsIdInfo"></param>
		///<returns></returns>
		public bool DeleteProductItOrderDetailsId(string productDetailsId)
		{
			bool ret = false;
			try
			{
				StringBuilder strSql = new StringBuilder();
				strSql.Append("delete from productItOrderDetails");
				strSql.Append(" where  ProductDetailsId in (");
				strSql.Append("@ProductDetailsId )");
				//SQLiteParameter[] par = new SQLiteParameter[]{};
				SQLiteParameter par =new SQLiteParameter("@ProductDetailsId",productDetailsId);
				int temp = 0 ;
				temp = SQLiteHelper.ExecuteSql(strSql.ToString(), CommandType.Text, par);
				if(temp!=0)
				{
					ret = true;
				}
			}
			catch (SQLiteException ex)
			{
				throw ex;
			}
			return ret;
		}
		/// <summary>
		/// SQL script查詢分頁
		/// </summary>
		/// <param name="pageSize">每頁頁數</param>
		/// <param name="currentPage">當前頁碼</param>
		/// <param name="strWhere">查詢的條件</param>
		/// <param name="filedOrder">排序欄位</param>
		/// <param name="recordCount">每頁的記錄數</param>
		/// <returns></returns>
		public DataSet GetPageList(int pageSize, int currentPage, string strWhere, string filedOrder, out int recordCount)
		{
			int topNum = pageSize * currentPage;
			StringBuilder strSql = new StringBuilder();
			strSql.Append("select * FROM ProductItOrderDetails");
			if (strWhere.Trim() !="")
			{
				strSql.Append(" where " + strWhere);
			}
			recordCount = Convert.ToInt32(SQLiteHelper.GetSingle(PagingHelper.CreateCountingSql(strSql.ToString())));
			return SQLiteHelper.Query(PagingHelper.CreatePagingSql(recordCount, pageSize, currentPage, strSql.ToString(), filedOrder));
		}
		/// <summary>
		/// SQL語句分頁 
		/// </summary>
		/// <param name="pageSize">每頁頁數</param>
		/// <param name="pageIndex">當前頁碼</param>
		/// <param name="filedOrder">排序欄位</param>
		/// <param name="recordCount">返回每頁的記錄數</param>
		/// <returns></returns>
		public DataSet GetPageList(int pageSize, int pageIndex, string filedOrder, out int recordCount)
		{
			StringBuilder strSql = new StringBuilder();
			strSql.Append("select *  FROM ProductItOrderDetails");
			recordCount = Convert.ToInt32(SQLiteHelper.GetSingle(PagingHelper.CreateCountingSql(strSql.ToString())));
			return SQLiteHelper.Query(PagingHelper.CreatePagingSql(recordCount, pageSize, pageIndex, strSql.ToString(), filedOrder));
		}
		/// <summary>
		/// SQL語句分頁
		/// </summary>
		/// <param name="pageSize">每頁頁數</param>
		/// <param name="pageIndex">當前頁碼</param>
		/// <param name="recordCount">返回每頁的記錄數</param>
		/// <returns></returns>
		public DataSet GetPageList(int pageSize, int pageIndex, out int recordCount)
		{
			string filedOrder = " order by ProductDetailsId desc";
			StringBuilder strSql = new StringBuilder();
			strSql.Append("select *  FROM ProductItOrderDetails");
			recordCount = Convert.ToInt32(SQLiteHelper.GetSingle(PagingHelper.CreateCountingSql(strSql.ToString())));
			return SQLiteHelper.Query(PagingHelper.CreatePagingSql(recordCount, pageSize, pageIndex, strSql.ToString(), filedOrder));
		}
		/// <summary>
		///SQL腳本 模糊查詢
		/// </summary>
		/// <param name="filedlist">顯示欄位列表</param>
		/// <param name="strkey">輸入的關鍵字</param>
		/// <returns></returns>
		public DataTable GetDataTableProductItOrderDetailsFuzzySearch(string filedlist, string strkey)
		{
			DataTable dt = new DataTable();
			try
			{
				StringBuilder strSql = new StringBuilder();
			strSql.Append("select ");
			if (string.IsNullOrEmpty(filedlist))
			{
				strSql.Append(" * ");
			}
			else
			{
				strSql.Append(" from ProductItOrderDetails");
			}
			if (!string.IsNullOrEmpty(strkey))
			{
				strSql.Append(" where " + StringConvert.getStrWhere("ProductDescription",strkey));
			}
			dt = SQLiteHelper.Query(strSql.ToString()).Tables[0];
			}
			catch (SQLiteException ex)
			{
				throw ex;
			}
			return dt;
		}
		/// <summary>
		///SQL腳本 是否存在該記錄
		/// </summary>
		/// <param name="id"></param>
		/// <returns></returns>
		public bool Exists(int id)
		{
			StringBuilder strSql = new StringBuilder();
			strSql.Append("select count(1) from ProductItOrderDetails");
			strSql.Append(" where ProductDetailsId=@ProductDetailsId ");
			SQLiteParameter[] parameters = {
				new SQLiteParameter("@ProductDetailsId", DbType.Int32,4)};
			parameters[0].Value = id;
			return SQLiteHelper.Exists(strSql.ToString(), parameters);
		}
		/// <summary>
		/// 是否存在該記錄
		/// </summary>
		/// <param name="id"></param>
		/// <returns></returns>
		public bool ExistsId(int id)
		{
			StringBuilder strSql = new StringBuilder();
			strSql.Append("select count(1) from ProductItOrderDetails");
			strSql.Append(" where ProductDetailsId=@ProductDetailsId ");
			SQLiteParameter[] parameters = {
				new SQLiteParameter("@ProductDetailsId", DbType.Int32,10)};
			parameters[0].Value = id;
			return SQLiteHelper.Exists(strSql.ToString(), parameters);
		}
		/// <summary>
		/// 檢查單位名是否存在
		/// </summary>
		/// <param name="Name"></param>
		/// <returns></returns>
		public bool ExistsName(string columnName)
		{
			StringBuilder strSql = new StringBuilder();
			strSql.Append("select count(1) from ProductItOrderDetails");
			strSql.Append(" where ColumnName=@ColumnName ");
			SQLiteParameter[] parameters = {
				new SQLiteParameter("@ColumnName", DbType.String,100)};
			parameters[0].Value = columnName;
			return SQLiteHelper.Exists(strSql.ToString(), parameters);
		}
		/// <summary>
		/// 找到名稱ID
		/// </summary>
		/// <param name="Name"></param>
		/// <returns></returns>
		public int GetName(string name)
		{
			int name = 0; 
			StringBuilder strSql = new StringBuilder();
			strSql.Append("select ProductDetailsId from ProductItOrderDetails");
			strSql.Append(" where ColumnName=@ColumnName ");
			SQLiteParameter[] parameters = {
				new SQLiteParameter("@ColumnName", DbType.String,100)
		};
		parameters[0].Value = name;
		name = Convert.ToInt32(SQLiteHelper.GetSingle(strSql.ToString(), parameters));
		return name;
		}
		/// <summary>
		///SQL腳本 返回視圖數據總數
		/// </summary>
		/// <param name="strWhere"></param>
		/// <returns></returns>
		public int GetCountView(string strWhere)
		{
			StringBuilder strSql = new StringBuilder();
			strSql.Append("select count(*) as H ");
			strSql.Append(" from ProductItOrderDetailsView");
			if (strWhere.Trim() != "")
			{
				strSql.Append(" where " + strWhere);
			}
			return Convert.ToInt32(SQLiteHelper.GetSingle(strSql.ToString()));
		}
		/// <summary>
		///SQL腳本 返回數據總數
		/// </summary>
		/// <param name="strWhere"></param>
		/// <returns></returns>
		public int GetCount(string strWhere)
		{
			StringBuilder strSql = new StringBuilder();
			strSql.Append("select count(*) as H ");
			strSql.Append(" from ProductItOrderDetails");
			if (strWhere.Trim() != "")
			{
				strSql.Append(" where " + strWhere);
			}
			return Convert.ToInt32(SQLiteHelper.GetSingle(strSql.ToString()));
		}
		/// <summary>
		///SQL腳本 修改一列數據
		/// </summary>
		/// <param name="id"></param>
		/// <param name="strValue"></param>
		/// <returns></returns>
		public int UpdateField(int Id, string fieldValue)
		{
			StringBuilder strSql = new StringBuilder();
			strSql.Append("update ProductItOrderDetails set  @fieldValue");
			strSql.Append(" where ProductDetailsId= @Id");
			SQLiteParameter[] parameters = {
				new SQLiteParameter("@fieldValue", DbType.String),
				new SQLiteParameter("@ProductDetailsId", DbType.Int32,8),
			};
			parameters[0].Value = Id;
			parameters[1].Value = fieldValue;
			return SQLiteHelper.ExecuteSql(strSql.ToString(), CommandType.Text,parameters);
		}
		/// <summary>
		///SQL腳本 返回指字欄位的字串
		/// </summary>
		/// <param name="id"></param>
		/// <param name="fieldName"></param>
		/// <returns></returns>
		public string GetTitle(int Id, string fieldName)
		{
			StringBuilder strSql = new StringBuilder();
			strSql.Append("select top 1 " + fieldName + " from ProductItOrderDetails");
			strSql.Append(" where ProductDetailsId=" + Id);
			string title = Convert.ToString(SQLiteHelper.GetSingle(strSql.ToString()));
			if (string.IsNullOrEmpty(title))
			{
				return string.Empty;
			}
			return title;
		}
		
	}
}

  用於UI層要操作:

using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Windows.Forms;
using System.Drawing;
using System.Text.RegularExpressions;
using Geovin.Du.Model;
using Geovin.Du.Commn;
using Geovin.Du.BasicUI;
using Geovin.Du.BLL;

namespace Geovin.Du.CommnUI
{
	/// <summary>
	/// ProductTypeList表產品名稱表Windows窗體數據處理
	///生成時間2018/9/14 15:11:06
	///塗聚文(Geovin Du)
	///</summary>
	public class ProductTypeListControl
	{
		ProductTypeListBLL dal = new ProductTypeListBLL();
		///<summary>
		/// 追加記錄
		///</summary>
		///<param name="ProductTypeList">輸入參數:ProductTypeListInfo</param>
		///<returns>返回添加的記錄條數</returns>
		public int Add(ProductTypeListInfo productTypeList)
		{
			return dal.InsertProductTypeList(productTypeList);
		}

		///<summary>
		/// 追加記錄返回值
		///</summary>
		///<param name="ProductTypeList">輸入參數:ProductTypeListInfo</param>
		///<param name="ProductTypeID">返回參數:ProductTypeID</param>
		///<returns>返回是否添加的個數</returns>
		public int AddOutput(ProductTypeListInfo productTypeList,out int productTypeID)
		{
			return dal.InsertProductTypeListOutput(productTypeList,out productTypeID);
		}

		///<summary>
		///修改記錄
		///</summary>
		///<param name="ProductTypeList">輸入參數:ProductTypeListInfo</param>
		///<returns>返回修改的多少記錄數</returns>
		public int Edit(ProductTypeListInfo productTypeList)
		{
			return dal.UpdateProductTypeList(productTypeList);
		}

		///<summary>
		/// 刪除記錄
		///</summary>
		///<param name="productTypeID">輸入參數:ProductTypeID</param>
		///<returns>返回刪除記錄條數</returns>
		public bool Del(int productTypeID)
		{
			bool isdel = dal.DeleteProductTypeList(productTypeID);
			if (isdel)
			{
				//刪除關聯的外鍵記錄     
				ProductModelBLL productModelbll = new ProductModelBLL();
				productModelbll.DeleteModelProductTypeID(int.Parse(productTypeID));
				//刪除關聯的外鍵記錄     
				UnitPriceBLL unitPricebll = new UnitPriceBLL();
				unitPricebll.DeleteUnitProductTypeID(int.Parse(productTypeID));
				//刪除關聯的外鍵記錄     
				ProductItOrderDetailsBLL productItOrderDetailsbll = new ProductItOrderDetailsBLL();
				productItOrderDetailsbll.DeleteProductTypeId(int.Parse(productTypeID));
				//刪除關聯的外鍵記錄     
				ProductOrderDetailsBLL productOrderDetailsbll = new ProductOrderDetailsBLL();
				productOrderDetailsbll.DeleteProductTypeId(int.Parse(productTypeID));
			}
			return isdel;
		}
		///<summary>
		/// 刪除多條記錄
		///</summary>
		///<param name="productTypeID">輸入參數:ProductTypeID</param>
		///<returns>返回刪除多少記錄</returns>
		public bool DelId(string productTypeID)
		{
			bool isdel = dal.DeleteProductTypeListId(productTypeID);
			if (isdel)
			{
				//刪除關聯的外鍵記錄,要考慮
				string[] sArray = tableId.Split(new string[] { ",", "," }, StringSplitOptions.RemoveEmptyEntries);
				foreach (string tid in sArray)
				{
					ProductModelBLL productModelbll = new ProductModelBLL();
					productModelbll.DeleteModelProductTypeID(int.Parse(productTypeID));
					UnitPriceBLL unitPricebll = new UnitPriceBLL();
					unitPricebll.DeleteUnitProductTypeID(int.Parse(productTypeID));
					ProductItOrderDetailsBLL productItOrderDetailsbll = new ProductItOrderDetailsBLL();
					productItOrderDetailsbll.DeleteProductTypeId(int.Parse(productTypeID));
					ProductOrderDetailsBLL productOrderDetailsbll = new ProductOrderDetailsBLL();
					productOrderDetailsbll.DeleteProductTypeI

您的分享是我們最大的動力!

-Advertisement-
Play Games
更多相關文章
  • phpmyadmin 下載、安裝、配置 2017年05月05日 15:52:39 wodecc_u 閱讀數:14363 標簽: phpmyadmin 更多 個人分類: 環境配置 phpmyadmin 下載、安裝、配置 phpmyadmin 下載、安裝、配置 2017年05月05日 15:52:39 ...
  • explain為mysql提供語句的執行計劃信息。可以應用在select、delete、insert、update和place語句上。explain的執行計劃,只是作為語句執行過程的一個參考,實際執行的過程不一定和計劃完全一致,但是執行計劃中透露出的訊息卻可以幫助選擇更好的索引和寫出更優化的查詢語句... ...
  • 1. 查詢某存儲過程的訪問情況 SELECT TOP 1000 db_name(d.database_id) as DBName, s.name as 存儲名字, s.type_desc as 存儲類型, d.cached_time as SP添加到緩存的時間, d.last_execution_t ...
  • [20180914]oracle 12c 表 full_hash_value如何計算.txt--//昨天在12c下看表full_hash_value與11g的full_hash_value不同,不過12c使用pdb,猜測跟PDB有關.--//通過測試說明問題.1.環境:SCOTT@book> @ & ...
  • 歡迎大家前往 "騰訊雲+社區" ,獲取更多騰訊海量技術實踐乾貨哦~ 本文由 "騰訊雲資料庫團隊 " 發表於 "雲+社區專欄" 作者介紹:簡懷兵,騰訊雲資料庫高級工程師,負責騰訊雲CDB內核及基礎設施建設;先後供職於Thomson Reuters和YY等公司,PTimeDB作者,曾獲一項發明專利;從事 ...
  • 登錄MySQL 添加新用戶 允許本地 IP 訪問 localhost, 127.0.0.1 允許外網 IP 訪問 刷新授權 為用戶創建資料庫 為新用戶分配許可權 授予用戶通過外網IP對於該資料庫的全部許可權 授予用戶在本地伺服器對該資料庫的全部許可權 刷新許可權 退出 root 重新登錄 用新帳號 test ...
  • 前言:Spark編程模型兩個主要抽象,一個是彈性分散式數據集RDD,它是一種特殊集合,支持多種數據源,可支持並行計算,可緩存;另一個是兩種共用變數,支持並行計算的廣播變數和累加器。 1.RDD介紹 Spark大數據處理平臺建立在RDD之上,RDD是Spark的核心概念,最主要的抽象之一。RDD和Sp ...
  • 直奔主題 xshell工具source導入幾個G的資料庫 1、先把sql文件通過ftp或者winscp上傳到伺服器對應站點根目錄,如圖所示 2、進入xshell界面,進入資料庫之前一定設定編碼,否者會報錯 輸入密碼 進入資料庫 進行 資料庫操作 查看 資料庫 show databases; 創建數據 ...
一周排行
    -Advertisement-
    Play Games
  • 移動開發(一):使用.NET MAUI開發第一個安卓APP 對於工作多年的C#程式員來說,近來想嘗試開發一款安卓APP,考慮了很久最終選擇使用.NET MAUI這個微軟官方的框架來嘗試體驗開發安卓APP,畢竟是使用Visual Studio開發工具,使用起來也比較的順手,結合微軟官方的教程進行了安卓 ...
  • 前言 QuestPDF 是一個開源 .NET 庫,用於生成 PDF 文檔。使用了C# Fluent API方式可簡化開發、減少錯誤並提高工作效率。利用它可以輕鬆生成 PDF 報告、發票、導出文件等。 項目介紹 QuestPDF 是一個革命性的開源 .NET 庫,它徹底改變了我們生成 PDF 文檔的方 ...
  • 項目地址 項目後端地址: https://github.com/ZyPLJ/ZYTteeHole 項目前端頁面地址: ZyPLJ/TreeHoleVue (github.com) https://github.com/ZyPLJ/TreeHoleVue 目前項目測試訪問地址: http://tree ...
  • 話不多說,直接開乾 一.下載 1.官方鏈接下載: https://www.microsoft.com/zh-cn/sql-server/sql-server-downloads 2.在下載目錄中找到下麵這個小的安裝包 SQL2022-SSEI-Dev.exe,運行開始下載SQL server; 二. ...
  • 前言 隨著物聯網(IoT)技術的迅猛發展,MQTT(消息隊列遙測傳輸)協議憑藉其輕量級和高效性,已成為眾多物聯網應用的首選通信標準。 MQTTnet 作為一個高性能的 .NET 開源庫,為 .NET 平臺上的 MQTT 客戶端與伺服器開發提供了強大的支持。 本文將全面介紹 MQTTnet 的核心功能 ...
  • Serilog支持多種接收器用於日誌存儲,增強器用於添加屬性,LogContext管理動態屬性,支持多種輸出格式包括純文本、JSON及ExpressionTemplate。還提供了自定義格式化選項,適用於不同需求。 ...
  • 目錄簡介獲取 HTML 文檔解析 HTML 文檔測試參考文章 簡介 動態內容網站使用 JavaScript 腳本動態檢索和渲染數據,爬取信息時需要模擬瀏覽器行為,否則獲取到的源碼基本是空的。 本文使用的爬取步驟如下: 使用 Selenium 獲取渲染後的 HTML 文檔 使用 HtmlAgility ...
  • 1.前言 什麼是熱更新 游戲或者軟體更新時,無需重新下載客戶端進行安裝,而是在應用程式啟動的情況下,在內部進行資源或者代碼更新 Unity目前常用熱更新解決方案 HybridCLR,Xlua,ILRuntime等 Unity目前常用資源管理解決方案 AssetBundles,Addressable, ...
  • 本文章主要是在C# ASP.NET Core Web API框架實現向手機發送驗證碼簡訊功能。這裡我選擇是一個互億無線簡訊驗證碼平臺,其實像阿裡雲,騰訊雲上面也可以。 首先我們先去 互億無線 https://www.ihuyi.com/api/sms.html 去註冊一個賬號 註冊完成賬號後,它會送 ...
  • 通過以下方式可以高效,並保證數據同步的可靠性 1.API設計 使用RESTful設計,確保API端點明確,並使用適當的HTTP方法(如POST用於創建,PUT用於更新)。 設計清晰的請求和響應模型,以確保客戶端能夠理解預期格式。 2.數據驗證 在伺服器端進行嚴格的數據驗證,確保接收到的數據符合預期格 ...