⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tourismprostock.cs.svn-base

📁 走吧旅游网站前后台源代码
💻 SVN-BASE
字号:
using System;
using System.Data;
using System.Text;
using System.Data.SqlClient;
using Maticsoft.DBUtility;//请先添加引用
namespace Maticsoft.DAL
{
	/// <summary>
	/// 数据访问类TourismProStock。
	/// </summary>
	public class TourismProStock
	{
		public TourismProStock()
		{}
		#region  成员方法

		/// <summary>
		/// 是否存在该记录
		/// </summary>
		public bool Exists(string LinesID)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select count(1) from TourismProStock");
			strSql.Append(" where LinesID=@LinesID ");
			SqlParameter[] parameters = {
					new SqlParameter("@LinesID", SqlDbType.NVarChar,50)};
			parameters[0].Value = LinesID;

			return DbHelperSQL.Exists(strSql.ToString(),parameters);
		}


		/// <summary>
		/// 增加一条数据
		/// </summary>
		public void Add(Maticsoft.Model.TourismProStock model)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("insert into TourismProStock(");
			strSql.Append("LinesID,LinesName,Days,Traffic,ShopManPrice,PeerManPrice,InterManPrice,ShopChildrenPrice,PeerChildrenPrice,InterChildrenPrice,SetAddres,ReceiveCityID)");
			strSql.Append(" values (");
			strSql.Append("@LinesID,@LinesName,@Days,@Traffic,@ShopManPrice,@PeerManPrice,@InterManPrice,@ShopChildrenPrice,@PeerChildrenPrice,@InterChildrenPrice,@SetAddres,@ReceiveCityID)");
			SqlParameter[] parameters = {
					new SqlParameter("@LinesID", SqlDbType.NVarChar,12),
					new SqlParameter("@LinesName", SqlDbType.NVarChar,50),
					new SqlParameter("@Days", SqlDbType.Int,4),
					new SqlParameter("@Traffic", SqlDbType.NVarChar,200),
					new SqlParameter("@ShopManPrice", SqlDbType.Decimal,9),
					new SqlParameter("@PeerManPrice", SqlDbType.Decimal,9),
					new SqlParameter("@InterManPrice", SqlDbType.Decimal,9),
					new SqlParameter("@ShopChildrenPrice", SqlDbType.Decimal,9),
					new SqlParameter("@PeerChildrenPrice", SqlDbType.Decimal,9),
					new SqlParameter("@InterChildrenPrice", SqlDbType.Decimal,9),
					new SqlParameter("@SetAddres", SqlDbType.NVarChar,200),
					new SqlParameter("@ReceiveCityID", SqlDbType.NVarChar,12)};
			parameters[0].Value = model.LinesID;
			parameters[1].Value = model.LinesName;
			parameters[2].Value = model.Days;
			parameters[3].Value = model.Traffic;
			parameters[4].Value = model.ShopManPrice;
			parameters[5].Value = model.PeerManPrice;
			parameters[6].Value = model.InterManPrice;
			parameters[7].Value = model.ShopChildrenPrice;
			parameters[8].Value = model.PeerChildrenPrice;
			parameters[9].Value = model.InterChildrenPrice;
			parameters[10].Value = model.SetAddres;
			parameters[11].Value = model.ReceiveCityID;

			DbHelperSQL.ExecuteSql(strSql.ToString(),parameters);
		}
		/// <summary>
		/// 更新一条数据
		/// </summary>
		public void Update(Maticsoft.Model.TourismProStock model)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("update TourismProStock set ");
			strSql.Append("LinesName=@LinesName,");
			strSql.Append("Days=@Days,");
			strSql.Append("Traffic=@Traffic,");
			strSql.Append("ShopManPrice=@ShopManPrice,");
			strSql.Append("PeerManPrice=@PeerManPrice,");
			strSql.Append("InterManPrice=@InterManPrice,");
			strSql.Append("ShopChildrenPrice=@ShopChildrenPrice,");
			strSql.Append("PeerChildrenPrice=@PeerChildrenPrice,");
			strSql.Append("InterChildrenPrice=@InterChildrenPrice,");
			strSql.Append("SetAddres=@SetAddres,");
			strSql.Append("ReceiveCityID=@ReceiveCityID");
			strSql.Append(" where LinesID=@LinesID ");
			SqlParameter[] parameters = {
					new SqlParameter("@LinesID", SqlDbType.NVarChar,12),
					new SqlParameter("@LinesName", SqlDbType.NVarChar,50),
					new SqlParameter("@Days", SqlDbType.Int,4),
					new SqlParameter("@Traffic", SqlDbType.NVarChar,200),
					new SqlParameter("@ShopManPrice", SqlDbType.Decimal,9),
					new SqlParameter("@PeerManPrice", SqlDbType.Decimal,9),
					new SqlParameter("@InterManPrice", SqlDbType.Decimal,9),
					new SqlParameter("@ShopChildrenPrice", SqlDbType.Decimal,9),
					new SqlParameter("@PeerChildrenPrice", SqlDbType.Decimal,9),
					new SqlParameter("@InterChildrenPrice", SqlDbType.Decimal,9),
					new SqlParameter("@SetAddres", SqlDbType.NVarChar,200),
					new SqlParameter("@ReceiveCityID", SqlDbType.NVarChar,12)};
			parameters[0].Value = model.LinesID;
			parameters[1].Value = model.LinesName;
			parameters[2].Value = model.Days;
			parameters[3].Value = model.Traffic;
			parameters[4].Value = model.ShopManPrice;
			parameters[5].Value = model.PeerManPrice;
			parameters[6].Value = model.InterManPrice;
			parameters[7].Value = model.ShopChildrenPrice;
			parameters[8].Value = model.PeerChildrenPrice;
			parameters[9].Value = model.InterChildrenPrice;
			parameters[10].Value = model.SetAddres;
			parameters[11].Value = model.ReceiveCityID;

			DbHelperSQL.ExecuteSql(strSql.ToString(),parameters);
		}

		/// <summary>
		/// 删除一条数据
		/// </summary>
		public void Delete(string LinesID)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("delete TourismProStock ");
			strSql.Append(" where LinesID=@LinesID ");
			SqlParameter[] parameters = {
					new SqlParameter("@LinesID", SqlDbType.NVarChar,50)};
			parameters[0].Value = LinesID;

			DbHelperSQL.ExecuteSql(strSql.ToString(),parameters);
		}


		/// <summary>
		/// 得到一个对象实体
		/// </summary>
		public Maticsoft.Model.TourismProStock GetModel(string LinesID)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select LinesID,LinesName,Days,Traffic,ShopManPrice,PeerManPrice,InterManPrice,ShopChildrenPrice,PeerChildrenPrice,InterChildrenPrice,SetAddres,ReceiveCityID from TourismProStock ");
			strSql.Append(" where LinesID=@LinesID ");
			SqlParameter[] parameters = {
					new SqlParameter("@LinesID", SqlDbType.NVarChar,50)};
			parameters[0].Value = LinesID;

			Maticsoft.Model.TourismProStock model=new Maticsoft.Model.TourismProStock();
			DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters);
			if(ds.Tables[0].Rows.Count>0)
			{
				model.LinesID=ds.Tables[0].Rows[0]["LinesID"].ToString();
				model.LinesName=ds.Tables[0].Rows[0]["LinesName"].ToString();
				if(ds.Tables[0].Rows[0]["Days"].ToString()!="")
				{
					model.Days=int.Parse(ds.Tables[0].Rows[0]["Days"].ToString());
				}
				model.Traffic=ds.Tables[0].Rows[0]["Traffic"].ToString();
				if(ds.Tables[0].Rows[0]["ShopManPrice"].ToString()!="")
				{
					model.ShopManPrice=decimal.Parse(ds.Tables[0].Rows[0]["ShopManPrice"].ToString());
				}
				if(ds.Tables[0].Rows[0]["PeerManPrice"].ToString()!="")
				{
					model.PeerManPrice=decimal.Parse(ds.Tables[0].Rows[0]["PeerManPrice"].ToString());
				}
				if(ds.Tables[0].Rows[0]["InterManPrice"].ToString()!="")
				{
					model.InterManPrice=decimal.Parse(ds.Tables[0].Rows[0]["InterManPrice"].ToString());
				}
				if(ds.Tables[0].Rows[0]["ShopChildrenPrice"].ToString()!="")
				{
					model.ShopChildrenPrice=decimal.Parse(ds.Tables[0].Rows[0]["ShopChildrenPrice"].ToString());
				}
				if(ds.Tables[0].Rows[0]["PeerChildrenPrice"].ToString()!="")
				{
					model.PeerChildrenPrice=decimal.Parse(ds.Tables[0].Rows[0]["PeerChildrenPrice"].ToString());
				}
				if(ds.Tables[0].Rows[0]["InterChildrenPrice"].ToString()!="")
				{
					model.InterChildrenPrice=decimal.Parse(ds.Tables[0].Rows[0]["InterChildrenPrice"].ToString());
				}
				model.SetAddres=ds.Tables[0].Rows[0]["SetAddres"].ToString();
				model.ReceiveCityID=ds.Tables[0].Rows[0]["ReceiveCityID"].ToString();
				return model;
			}
			else
			{
			return null;
			}
		}

		/// <summary>
		/// 获得数据列表
		/// </summary>
		public DataSet GetList(string strWhere)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select LinesID,LinesName,Days,Traffic,ShopManPrice,PeerManPrice,InterManPrice,ShopChildrenPrice,PeerChildrenPrice,InterChildrenPrice,SetAddres,ReceiveCityID ");
			strSql.Append(" FROM TourismProStock ");
			if(strWhere.Trim()!="")
			{
				strSql.Append(" where "+strWhere);
			}
			return DbHelperSQL.Query(strSql.ToString());
		}

		/*
		/// <summary>
		/// 分页获取数据列表
		/// </summary>
		public DataSet GetList(int PageSize,int PageIndex,string strWhere)
		{
			SqlParameter[] parameters = {
					new SqlParameter("@tblName", SqlDbType.VarChar, 255),
					new SqlParameter("@fldName", SqlDbType.VarChar, 255),
					new SqlParameter("@PageSize", SqlDbType.Int),
					new SqlParameter("@PageIndex", SqlDbType.Int),
					new SqlParameter("@IsReCount", SqlDbType.Bit),
					new SqlParameter("@OrderType", SqlDbType.Bit),
					new SqlParameter("@strWhere", SqlDbType.VarChar,1000),
					};
			parameters[0].Value = "TourismProStock";
			parameters[1].Value = "ID";
			parameters[2].Value = PageSize;
			parameters[3].Value = PageIndex;
			parameters[4].Value = 0;
			parameters[5].Value = 0;
			parameters[6].Value = strWhere;	
			return DbHelperSQL.RunProcedure("UP_GetRecordByPage",parameters,"ds");
		}*/

		#endregion  成员方法
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -