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

📄 st_tempstore.cs

📁 数据库:Microsoft SQL Server 2000。 技术平台:Microsoft .NET Framework 2.0.0.0版本。 IIS:Internet Informati
💻 CS
字号:
using System;
using System.Data;
using System.Data.SqlClient;
using System.Text;

namespace ST_GROUP.FlowerPrearrange
{
	/// <summary>
	/// Summary description for ST_TempStore.
	/// </summary>
	public class ST_TempStore:ST_Base 
	{
		private int ST_flowerId;		
		private int ST_userId;
		
		public ST_TempStore()
		{
			//
			// TODO: Add constructor logic here
			//
		}

		#region Properties of temp store
		/// <summary>
		/// ST_Flower ID
		/// </summary>
		public int ST_FlowerId
		{
			get
			{
				return ST_flowerId;
			}
			set
			{
				ST_flowerId = value;
			}
		}


		/// <summary>
		/// ST_User ID
		/// </summary>
		public int ST_UserId
		{
			get
			{
				return ST_userId;
			}
			set
			{
				ST_userId = value;
			}
		}
		#endregion


		#region ST_Functions of temp store
		/// <summary>
		/// Add new Flower in temp store
		/// need Flower ID、ST_User ID.
		/// </summary>		
		public void ST_Add()
		{

			if(ST_IsExist())
			{
				throw new Exception("Exist this Flower in your temp store!");
			}
			else
			{
				ST_strSQL = "Insert into ST_TempStore (ST_FlowerId,ST_UserId) Values("				
					+ this.ST_FlowerId.ToString()  + ","							
					+ this.ST_UserId.ToString()  + ")";

				try
				{
					ST_ExecuteSql(ST_strSQL);				
				}
				catch
				{
					throw new Exception("添加鲜花失败!");
				}			
			}			
		}


		/// <summary>
		/// Add new Flower in temp store.
		/// </summary>		
		public static void ST_Add(int FlowerId,int userId)
		{
			if(ST_IsExist(FlowerId,userId))
			{
				throw new Exception("Exist this Flower in your temp store!");
			}
			else
			{
				ST_strSQL = "Insert into ST_TempStore (ST_FlowerId,ST_UserId) Values("				
					+ FlowerId.ToString()  + ","							
					+ userId.ToString()  + ")";

				try
				{
					ST_ExecuteSql(ST_strSQL);				
				}
				catch
				{
					throw new Exception("Add new Flower FAILED!");
				}			
			}					
		}


		/// <summary>
		/// Delete Flower from temp store
		/// </summary>
		/// <param name="FlowerId">ST_Flower ID(int)</param>		
		/// <param name="userId">ST_User ID(int)</param>	
		public static void ST_Delete(int FlowerId,int userId)
		{
			ST_strSQL = "Delete From ST_TempStore Where ST_FlowerId="+FlowerId.ToString()
				+" And ST_UserId=" + userId.ToString();
			
			try
			{
				ST_ExecuteSql(ST_strSQL);
			}
			catch
			{
				throw new Exception("Delete Flower FAILED!");
			}
		}


		/// <summary>
		/// Delete Flower from temp store
		/// </summary>				
		public void ST_Delete()
		{
			ST_strSQL = "Delete From ST_TempStore Where ST_FlowerId=" + this.ST_FlowerId.ToString()
				+" And ST_UserId=" + this.ST_UserId.ToString();
			
			try
			{
				ST_ExecuteSql(ST_strSQL);
			}
			catch
			{
				throw new Exception("Delete Flower FAILED!");
			}
		}



		/// <summary>
		/// Clear user's temp store
		/// </summary>
		/// <param name="userId">userId</param>		
		public static void ST_Clear(int userId)
		{
			ST_strSQL = "Delete From ST_TempStore Where ST_UserId = " + userId.ToString();
			
			try
			{
				ST_ExecuteSql(ST_strSQL);				
			}
			catch
			{
				throw new Exception("Clear temp store FAILED!");
			}
		}


		/// <summary>
		/// Does this Flower exist?
		/// </summary>
		/// <returns>return bool value</returns>
		public bool ST_IsExist()
		{
			ST_strSQL = "Select FlowerId from ST_TempStore Where ST_FlowerId="
				+ this.ST_FlowerId.ToString() + " And ST_UserId=" + this.ST_UserId.ToString();

			try
			{
				ST_ExecuteSql4Value(ST_strSQL);
				return true;
			}
			catch
			{
				return false;
			}

		}


		/// <summary>
		/// Does this Flower exist?
		/// </summary>
		/// <param name="FlowerId">ST_Flower ID(int)</param>	
		/// <param name="userId">ST_User ID(int)</param>	
		/// <returns>return bool value</returns>
		public static bool ST_IsExist(int FlowerId,int userId)
		{
			ST_strSQL = "Select FlowerId from ST_TempStore Where ST_FlowerId="
				+ FlowerId.ToString() + " And ST_UserId=" + userId.ToString();

			try
			{
				ST_ExecuteSql4Value(ST_strSQL);
				return true;
			}
			catch
			{
				return false;
			}

		}



		/// <summary>
		///  Get all the Flowers in the temp store
		/// </summary>
		/// <param name="userId">ST_User ID(int)</param>	
		/// <returns>return Flowers(DataSet)</returns>
		public static DataSet ST_GetFlowers(int userId)
		{
			ST_strSQL = "SELECT * FROM ST_TempStoreV Where ST_UserId=" + userId.ToString();

			try
			{
				return ST_ExecuteSql4Ds(ST_strSQL);				
			}
			catch
			{
				throw new Exception("获取鲜花失败!");
			}			
		}
		
		#endregion
	}
}

⌨️ 快捷键说明

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