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

📄 outboxsystem.cs

📁 手机串口编程 手机串口编程 手机串口编程
💻 CS
字号:
using System;

namespace JB.GraduateDesign.ESM.Business
{
	using JB.GraduateDesign.ESM.Entity;
	using JB.GraduateDesign.ESM.DataAccess;

	/// <summary>
	/// OutBoxSystem 的摘要说明。
	/// </summary>
	public class OutBoxSystem
	{
		public OutBoxSystem()
		{
			
		}

		public bool DeleteOutBox ( int[] outBoxIds )
		{

			for ( int i = 0; i < outBoxIds.Length; i ++ )
			{
				if ( outBoxIds[i] <= 0 )
				{
					throw new ApplicationException ( "参数错误,参数必须大于0" ); 
				}
			}

			OutBoxes outBoxes = new OutBoxes();
			try
			{
				return outBoxes.DeleteOutBox ( outBoxIds );

			}
			catch ( Exception e )
			{
				throw e;
			}
		}

		public OutBoxData GetSendedMessage ( int sendUserId )
		{
			if ( sendUserId <= 0 )
			{
				throw new ApplicationException ("参数错误。");
			}

			OutBoxes outBoxes = new OutBoxes();
			try
			{
				return outBoxes.SelectOutBox ( sendUserId, 0 );
			}
			catch ( Exception e )
			{
				throw e;
			}

		}

		public bool SendMessage ( OutBoxData data )
		{
			if ( data.OutBox.Count == 0 )
			{
				throw new ApplicationException ( "缺少要发送信息。" );
			}
			if ( data.OutBoxDetail.Count == 0 )
			{
				throw new ApplicationException ( "缺少接受信息的用户。" );
			}
			if ( data.OutBox.Count > 1 )
			{
				throw new ApplicationException ( "一次只能发送一条信息。" );
			}
			
			
			OutBoxes outBoxes = new OutBoxes();
			
			try
			{
				outBoxes.InsertOutBox ( data );
			}
			catch ( Exception e )
			{
				throw e;
			}
			finally
			{
				outBoxes.Dispose();
			}
			return true;
		}
	}
}

⌨️ 快捷键说明

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