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

📄 cngpsendmessage.cs

📁 网通网关Cngp
💻 CS
字号:
using System;
using System.Collections;
using WriteLog;
using Pierce.AttributeClass;
using Pierce.OracleHelper;
using System.Data;
using System.Data.OleDb;
namespace Cngp
{
	/// <summary>
	/// CngpSendMessage :
	/// 判断数据库中有没有要发送的信息,
	/// 从数据库中取一条要发送的信息
	/// </summary>
	[LastModified("2005-11-22","增加从数据库中取数据的长度")]
	[LastModified("2006-01-05","使用OracleHelper类访问数据库")]
	[LastModified("2006-01-18","修改属性Con,使用新的OracleHelper类实例")]
	[LastModified("2007-02-01","增加OracleHelper(),返回类实例,供其他方法调用,防止多个方式使用单个类实例冲突")]
	[LastModified("2007-02-26","增加写状态报告的函数")]
	internal class CngpSendMessage
	{
		
		private OraData oradata=new OraData();

		public static ArrayList ArrayMessage=new ArrayList(1000);//store Message

		/// <summary>
		/// 属性,只读,返回数据库联接
		/// 使用新的OracleHelpel类实例,防止函数使用DataReader时,遇到其他函数操作,
		/// 导致没有实例化错误
		/// </summary>
		[LastModified("2006-01-18","使用新的oraclehelper类实例,防止Datareader和其他Dml"
			 +"操作冲突")]
		public OleDbConnection Con
		{
			get
			{
								
				return Helper().Con;
			}
		}
		/// <summary>
		/// 获取OracleHelper类实例
		/// </summary>
		/// <returns>返回OracleHelper类实例</returns>
		[LastModified("2007-02-01","生成OracleHelper类实例")]
		private OracleHelper Helper()
		{
			OracleHelper helper=new OracleHelper();
			helper.OraUser=ConfigInformation.OraUser;
			helper.OraPassword=ConfigInformation.OraPassword;
			helper.OraService=ConfigInformation.OraService;
			helper.Init(OracleHelper.DbType.Oracle);
			//
			return helper;
		}
		/// <summary>
		/// 构造函数,实例化各个OracleHelper
		/// </summary>
		[LastModified("2007-02-01","不做操作, 原先操作改由Helper()完成")]
		public CngpSendMessage()
		{
						
		}


		/// <summary>
		/// 调用过程,取1条数据
		/// </summary>
		/// <param name="mobileid">用户号码</param>
		/// <param name="content">发送内容</param>
		/// <param name="feetype">计费类型</param>
		/// <param name="feecode">计费金额</param>
		/// <param name="serviceid">栏目代码</param>
		/// <param name="sourceid">服务代码</param>
		/// <param name="priority">优先级</param>
		/// <param name="subtype">Mo,Mt类型</param>
		/// <param name="Procedure">过程名称</param>
		[LastModified("2005-11-22","增加从数据库中取数据的长度")]
		public void GetInfo(
			ref string mobileid,
			ref string content,	
			ref string feetype,
			ref string feecode,
			ref string serviceid,
			ref string sourceid,
			ref int priority,
			ref int subtype,
			string Procedure
			)
		{
			try
			{
				
				string[] matrixContent=new string[7];
					
				//调用过程,赋值
				Helper().CallProcedureOut(Procedure,ref matrixContent);
					
				mobileid=matrixContent[0];
				content=matrixContent[1];
				feetype=matrixContent[2];
				feecode=matrixContent[3];
				serviceid=matrixContent[4];
				sourceid=matrixContent[5];
				priority=Convert.ToInt32(matrixContent[6]);
				//
				//
				//
				if(Procedure.ToLower()=="procedure_sendmessage2")
				{
					subtype=2;
				}
				else
				{
					subtype=3;
				}
			}
			catch(Exception ex)
			{
				Logs.writeLog(ex.Message.ToString(),false);
			}
			
		}
	
		/// <summary>
		///  判断有没有没有发送的信息,有:返回false,没有:返回true
		/// </summary>
		/// <returns>true:没有要发送的信息;false:有要发送的信息</returns>
		public int IfNoData(string table)
		{
			try
			{
				string sqlstring="select count(*) from "+table+" where processflag=0";
				int Count=Convert.ToInt32(Helper().TableCount(sqlstring).ToString());
				
				return Count;
			}
			catch(Exception ex)
			{
				Logs.writeLog(ex.Message.ToString()+"\r\n"+ex.StackTrace,false);
				return 0;
				
			}
		}
		/// <summary>
		/// 把Mo信息写入数据库,调用过程完成
		/// </summary>
		/// <param name="SmsCode">上行代码</param>
		/// <param name="Mobileid">手机号</param>
		/// <param name="Content">用户发送内容</param>
		public void InsertMORecord(string SmsCode,string Mobileid,string Content)
		{
			try
			{
				string[] matrix=new string[]{SmsCode,Mobileid,Content};
				Helper().CallProcedure("moprocess1.main",matrix);
				//
				
			}
			catch(Exception ex)
			{
				Logs.writeLog(ex.Message.ToString(),false);
			}
		

		}
		/// <summary>
		/// 把状态报告写入数据库
		/// </summary>
		/// <param name="Mobileid">号码</param>
		/// <param name="Content">状态报告内容</param>
		[LastModified("2007-02-26","写状态报告如数据库")]
		public void InsertStatusReport(string Mobileid,string Content,string MessageId)
		{
			try
			{
				string[] para=new string[]{Mobileid,Content,MessageId};
				Helper().CallProcedure("procedure_report",para);

			}
			catch(Exception ex)
			{
				Logs.writeLog(ex.Message.ToString(),false);
			}
		}
		/// <summary>
		/// 把Msgid以及发送信息写入数据库
		/// </summary>
		/// <param name="Mobileid">手机号</param>
		/// <param name="Serviceid">业务类型</param>
		/// <param name="Msgcontent">发送内容</param>
		/// <param name="Msgid">流水号</param>
		[LastModified("2007-04-03","写入Msgid到数据库")]
		public void InsertSubmitResp(string Mobileid,string Serviceid,string Msgcontent,string Msgid)
		{
			try
			{
				string[] para=new string[]{Mobileid,Serviceid,Msgcontent,Msgid};
				Helper().CallProcedure("procedure_submitresp",para);

			}
			catch(Exception ex)
			{
				Logs.writeLog(ex.Message.ToString(),false);
			}

		}
		/// <summary>
		/// 把错误信息写入数据库
		/// </summary>
		/// <param name="Content">错误信息</param>
		[LastModified("2007-02-26","写错误信息到数据库")]
		public void InsertErrorMessage(string Content)
		{
			try
			{
				string[] para=new string[]{Content};
				Helper().CallProcedure("procedure_errormessage",para);
			}
			catch(Exception ex)
			{
				Logs.writeLog(ex.Message,false);
			}
		}
		/// <summary>
		///  判断有没有没有发送的信息
		/// </summary>
		/// <returns></returns>
		public bool IfFeeData()
		{
			string sqlstring="select count(*) from realtime_sendmessage where processflag=0";
			int Count=Convert.ToInt16(Helper().TableCount(sqlstring).ToString());
			if(Count==0)
			{
				return true;
			}
			else
			{
				return false;
			}
		}


		/// <summary>
		/// 从数据库中获取计费信息,只取1条
		/// </summary>
		/// <param name="mobileid">用户手机号码</param>
		/// <param name="content">发送内容</param>
		/// <param name="feetype">计费类型</param>
		/// <param name="feecode">计费代码</param>
		/// <param name="serviceid">栏目代码</param>
		/// <param name="sourceid">下发代码</param>
		public void GetFee(
			ref string mobileid,
			ref string content,
			ref string feetype,
			ref string feecode,
			ref string serviceid,
			ref string sourceid
			)
		{
			try
			{
				string[] matrixContent=new string[6];
					
				//调用过程,赋值
				Helper().CallProcedureOut("procedure_GetFee",ref matrixContent);
					
				mobileid=matrixContent[0];
				content=matrixContent[1];
				feetype=matrixContent[2];
				feecode=matrixContent[3];
				serviceid=matrixContent[4];
				sourceid=matrixContent[5];
				
			}
			catch(Exception ex)
			{
				Logs.writeLog(string.Concat(
					ex.Message.ToString(),
					"\r\n",
					ex.StackTrace.ToString()
					),false);
			}
		
		}
	}
}

⌨️ 快捷键说明

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