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

📄 discountmgmt.cs

📁 本论文叙述了联机考试系统的现状以及C#语言的概况。重点介绍了联机考试系统的实现过程:包括系统分析、 系统调查、 数据流程分析、功能设计、 数据库设计、 系统物理配置方案、 系统实现、 系统测试和调试。
💻 CS
字号:
using System;
using System.Data;
using System.Data.OleDb;

namespace SupermarketProject
{
	/// <summary>
	/// Summary description for DiscountMgmt.
	/// </summary>
	
	public struct stDiscount
	{
		public int StockId;
		public int Discount;
		public string ValidFrom;
		public string ValidTo;
	};

	public class DiscountMgmt
	{
		public DiscountMgmt()
		{
			//
			// TODO: Add constructor logic here
			//
		}

		public DataTable FetchDiscountDetails(int searchValue)
		{
							
				string str="";
	
				str="Select Discount,ValidFrom ,ValidTo from Discount where StockId ="+searchValue+"";
				
						
				//processing 
				OleDbDataAdapter adapter=new OleDbDataAdapter(str,DataConnection.oleconn);
				DataSet dset = new DataSet();
				
				// Filling the Adapter with values
				adapter.Fill(dset);

				

				// Returning the Data Table
				return dset.Tables[0]; 
			
		}
	
	public void AddDiscount(stDiscount stDisc)
		{
         	
		string str="Insert into Discount(StockId,Discount,ValidFrom,ValidTo)values("+stDisc.StockId+","+stDisc.Discount+",#"+stDisc.ValidFrom+"#,#"+stDisc.ValidTo+"#)";
			Console.WriteLine(str);
			
			DataConnection.commnd.CommandText=str;
			DataConnection.commnd.ExecuteNonQuery ();
			
		}
		
		public void ModifyDiscount(stDiscount stDisc)
		{
			string str="Update Discount set Discount ="+stDisc.Discount+",ValidFrom =#"+stDisc.ValidFrom+"#,validTo = #"+stDisc.ValidTo+"# where StockId = "+stDisc.StockId+"";
			Console.WriteLine(str);
			
			DataConnection.commnd.CommandText=str;
			DataConnection.commnd.ExecuteNonQuery();
			
			Console.WriteLine("已更新");
		}
	
	}
}

⌨️ 快捷键说明

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