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

📄 order.cs.bak

📁 ASP.net+sql server2000编写的完整鲜花在线销售系统
💻 BAK
字号:
using System;
using System.Data;

namespace flower
{
	/// <summary>
	/// Order 的摘要说明。
	/// </summary>
	public class Order
	{
		public Order()
		{
			//
			// TODO: 在此处添加构造函数逻辑
			//
		}DBOP myDBOP=new DBOP();
		string strComm;

		public struct OrderStru
		{
			public int id;
			public string name;
			public int userid;
			public string beginday;
			public string endday;
			public string state;
			public int orderitemsid;
		};
		public struct OrderItemsStru
		{
			public int id;
			public int orderid;
			public int flowerid;
			public string flowername;
			public int outprice;
			public int count;
			public string unit;
		};


		public OrderStru GetOrderDetail(int id)
		{
			//myDBOP=new DBOP();
			DataSet myDS;
			OrderStru myOrderStru=new OrderStru();
 
			strComm="select * from orders where id="+ id +"";

			//return myDBOP.GetOrderDetail(strComm);

			myDS=myDBOP.mySelect(strComm);

			myOrderStru.id=id;
			myOrderStru.name=myDS.Tables[0].Rows[0][1].ToString().Trim();
			myOrderStru.userid=Convert.ToInt32(myDS.Tables[0].Rows[0][2].ToString().Trim());
			myOrderStru.beginday=myDS.Tables[0].Rows[0][3].ToString().Trim();
			myOrderStru.endday=myDS.Tables[0].Rows[0][4].ToString().Trim();
			myOrderStru.state=myDS.Tables[0].Rows[0][5].ToString().Trim();
			//myOrderStru.descr=myDS.Tables[0].Rows[0][6].ToString().Trim();

			return myOrderStru;
		}

		public DataSet GetOrderItemsDetail(int id)
		{
			OrderItemsStru myOrderItemsStru=new OrderItemsStru();

			strComm="select * from orderitems where orderid="+id+"";

			DataSet myDS=myDBOP.mySelect(strComm);

			return myDS;
		}

		public bool AddOrderDetail(OrderStru myOrderStru)
		{
			strComm="insert into orders (id,name,userid,beginday,endday,state) values("+myOrderStru.id+",'"+myOrderStru.name+"',"+myOrderStru.userid+",'"+myOrderStru.beginday+"','"+myOrderStru.endday+"','"+myOrderStru.state+"')";
			return myDBOP.myAdd(strComm);
		}

		public bool AddOrderItems(OrderItemsStru myOrderItemsStru)
		{
			strComm="insert into orderitems (id,orderid,flowerid,flowername,count,outprice,unit) values("+myOrderItemsStru.id+","+myOrderItemsStru.orderid+","+myOrderItemsStru.flowerid+",'"+myOrderItemsStru.flowername+"',"+myOrderItemsStru.count+","+myOrderItemsStru.outprice+",'"+myOrderItemsStru.unit+"')";
			return myDBOP.myAdd(strComm);
		}
		public bool UpdateOrderDetail(OrderStru myOrderStru)
		{
			//myDBOP=new DBOP();
			strComm="update orders set name='"+myOrderStru.name+"',userid="+myOrderStru.userid+",beginday='"+myOrderStru.beginday+"',endday='"+myOrderStru.endday+"',state='"+myOrderStru.state+"' where id="+myOrderStru.id+"";
			return myDBOP.myUpdate(strComm);
		}

		public bool DeleteOrderDetail(int id)
		{
			strComm="delete from orders where id="+id+"";
			return myDBOP.myDelete(strComm);
		}

		public bool DeleteOrderItemsDetail(int id)
		{
			strComm="delete from orderitems where orderid="+id+"";
			return myDBOP.myDelete(strComm);
		}

		public DataSet GetAllOrderDS(int RsCount,int PageSize)
		{			
			strComm="select * from orders order by id";		    
			return myDBOP.mySelect(strComm,RsCount,PageSize);//重载方法mySelect。
		}

		public DataSet GetAllOrderDS(int RsCount,int PageSize,int id)
		{
			strComm="select * from orders where userid="+id+" order by id";		    
			return myDBOP.mySelect(strComm,RsCount,PageSize);//重载方法mySelect。
		}

		public int GetAllOrderCount()
		{
			strComm="select count(*) from orders";
			return int.Parse(myDBOP.mySelect(strComm).Tables[0].Rows[0][0].ToString().Trim());
		}

		public int GetAllOrderCount(int id)//重载方法,查询单个用户的所有订单。
		{
			strComm="select count(*) from orders where userid="+id+"";
			return int.Parse(myDBOP.mySelect(strComm).Tables[0].Rows[0][0].ToString().Trim());
		}

		public int GetOrderMaxID()
		{
			strComm="select max(id) from orders";
			return int.Parse(myDBOP.mySelect(strComm).Tables[0].Rows[0][0].ToString().Trim());
		}
		public int GetOrderItemsMaxID()
		{
			strComm="select max(id) from orderitems";
			return int.Parse(myDBOP.mySelect(strComm).Tables[0].Rows[0][0].ToString().Trim());
		}

		public bool UpdateOrderState(int id)
		{
			strComm="update orders set state='已处理' where id="+id+"";
			return myDBOP.myUpdate(strComm);
		}

	}
}

⌨️ 快捷键说明

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