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

📄 msgobj.cs

📁 专业的办公oa代码下载 c#语言编写 三层结构
💻 CS
📖 第 1 页 / 共 2 页
字号:
			csCommand.Fill(msgobj,MessageData.MESSAGE_TABLE);
			int count = msgobj.Tables[MessageData.MESSAGE_TABLE].Rows.Count;
			string sendperson = command.Parameters["@sendperson"].Value.ToString();
			for(int i = 0; i < count; i ++)
			{
				msgobj.Tables[MessageData.MESSAGE_TABLE].Rows[i][MessageData.MESSAGEPERSON_FIELD] = sendperson;
			}
			return msgobj;
		}

		public void WatchTimesAdd(string reid)
		{
			SqlCommand command  = new SqlCommand();
			command.CommandText = "Mag_AddTimes";
			command.CommandType = CommandType.StoredProcedure;
			command.Connection  = conn;
			SqlParameter para   = new SqlParameter("@reID",SqlDbType.Int);
			para.Value = Convert.ToInt32(reid,10);
			command.Parameters.Add(para);
			conn.Open();
			command.ExecuteNonQuery();
			conn.Close();
		}

		public int [] MsgNotice(int personid)
		{
			SqlCommand command = new SqlCommand();
			command.CommandText = "Msg_Notice";
			command.CommandType = CommandType.StoredProcedure;
			SqlParameter [] paras = {   new SqlParameter("@personid",SqlDbType.Int),
										new SqlParameter("@seen",SqlDbType.Int),
										new SqlParameter("@unseen",SqlDbType.Int)
									};
			paras[0].Value = personid;
			paras[1].Direction = ParameterDirection.Output;
			paras[2].Direction = ParameterDirection.Output;
			
			foreach(SqlParameter para in paras)
			{
				command.Parameters.Add(para);
			}
			command.Connection = conn;
			conn.Open();

			command.ExecuteNonQuery();

			int [] see = new int[2];
			see[0] = Convert.ToInt32(command.Parameters["@seen"].Value.ToString(),10);
			see[1] = Convert.ToInt32(command.Parameters["@unseen"].Value.ToString(),10);
			return see;
		}

		public DataSet SeeDraft(string msgid,string personid)
		{
			SqlDataAdapter csCommand = new SqlDataAdapter();
			SqlCommand command = new SqlCommand();
			command.CommandType = CommandType.StoredProcedure;
			command.CommandText = "Msg_GetDraft";
			SqlParameter [] paras = {   new SqlParameter("@personid",SqlDbType.Int),
										new SqlParameter("@msgid",SqlDbType.Int)
									};
			paras[0].Value = personid;
			paras[1].Value = msgid;
			foreach(SqlParameter para in paras)
				command.Parameters.Add(para);
			csCommand.SelectCommand = command;
			csCommand.SelectCommand.Connection = conn;
			DataSet data = new DataSet();
			csCommand.Fill(data,"draftmsg");
			return data;
		}


		public void InsertAgain(string msgid, MsgCont msgobj,int _status)
		{
			SqlCommand command  = new SqlCommand();
			command.CommandText = "Msg_SendAgain";
			command.CommandType = CommandType.StoredProcedure;
			command.Connection  = conn;

			SqlParameter [] paras = {   new SqlParameter("@msgid",SqlDbType.Int),
										new SqlParameter("@SendTo",SqlDbType.NVarChar,200),
										new SqlParameter("@SecretTo",SqlDbType.NVarChar,200),
										new SqlParameter("@SendToID",SqlDbType.NVarChar,200),
										new SqlParameter("@SecretToID",SqlDbType.NVarChar,200),
										new SqlParameter("@Title",SqlDbType.NVarChar,50),
										new SqlParameter("@Content",SqlDbType.Text),
										new SqlParameter("@SendDate",SqlDbType.DateTime),
										new SqlParameter("@Accessory",SqlDbType.NVarChar,200),
										new SqlParameter("@AccessoryID",SqlDbType.NVarChar,200),
										new SqlParameter("@Status",SqlDbType.Int),
										new SqlParameter("@Important",SqlDbType.Bit)
									};
			paras[0].Value = Convert.ToInt32(msgid,10);
			paras[1].Value = msgobj.SendTo;
			paras[2].Value = msgobj.SecretTo;
			paras[3].Value = msgobj.SendToID;
			paras[4].Value = msgobj.SecretToID;
			paras[5].Value = msgobj.Title;
			paras[6].Value = msgobj.Content;
			paras[7].Value = msgobj.SendTime;
			paras[8].Value = msgobj.Accessory;
			paras[9].Value = msgobj.AccessoryID;
			paras[10].Value = _status;	//此参数表示是发送还是再次保存
			paras[11].Value = msgobj.Important;
			foreach(SqlParameter para in paras)
				command.Parameters.Add(para);
			conn.Open();
			command.ExecuteNonQuery();
			conn.Close();
			if(_status == 0)
			{
				int msgkey = Convert.ToInt32(msgid,10);
				AddMsgIndex(msgkey,msgobj.SendToID,msgobj.SecretToID,msgobj.SendTime,msgobj.Important);
			}
		}

		public void DeleteMessage(string msgid,string personid,string status)
		{
			SqlCommand command = new SqlCommand();
			command.CommandText = "Msg_DelMsg";
			command.CommandType = CommandType.StoredProcedure;
			command.Connection  = conn;
			SqlParameter [] paras = {   new SqlParameter("@msgid",SqlDbType.Int),
										new SqlParameter("@personid", SqlDbType.Int),
										new SqlParameter("@status" ,SqlDbType.Int)
									};
			paras[0].Value = Convert.ToInt32(msgid);
			paras[1].Value = Convert.ToInt32(personid);
			paras[2].Value = Convert.ToInt32(status);
			foreach(SqlParameter para in paras)
			{
				command.Parameters.Add(para);
			}
			conn.Open();
			command.ExecuteNonQuery();
			conn.Close();
		}


		public void MoveMessage(string msgid,string personid, string status)
		{
			SqlCommand command = new SqlCommand();
			command.CommandText = "Msg_MoveMsg";
			command.CommandType = CommandType.StoredProcedure;
			command.Connection  = conn;
			SqlParameter [] paras = {   new SqlParameter("@msgid",SqlDbType.Int),
										new SqlParameter("@personid", SqlDbType.Int),
										new SqlParameter("@status" ,SqlDbType.Int)
									};
			paras[0].Value = Convert.ToInt32(msgid);
			paras[1].Value = Convert.ToInt32(personid);
			paras[2].Value = Convert.ToInt32(status);
			foreach(SqlParameter para in paras)
			{
				command.Parameters.Add(para);
			}
			conn.Open();
			command.ExecuteNonQuery();
			conn.Close();
		}

		public string [] MsgFolder(string personid)
		{
			SqlCommand command = new SqlCommand();
			command.CommandText = "Msg_Folder";
			command.CommandType = CommandType.StoredProcedure;
			command.Connection  = conn;
			SqlParameter [] paras = {   new SqlParameter("@personid",SqlDbType.Int),
										new SqlParameter("@send",SqlDbType.Int),
										new SqlParameter("@resive_new",SqlDbType.Int),
										new SqlParameter("@resive_old",SqlDbType.Int),
										new SqlParameter("@draft",SqlDbType.Int),
										new SqlParameter("@rubbish_1",SqlDbType.Int),
				                        new SqlParameter("@rubbish_2",SqlDbType.Int)
									};
			paras[0].Value = Convert.ToInt32(personid,10);
			paras[1].Direction = ParameterDirection.Output;
			paras[2].Direction = ParameterDirection.Output;
			paras[3].Direction = ParameterDirection.Output;
			paras[4].Direction = ParameterDirection.Output;
			paras[5].Direction = ParameterDirection.Output;
			paras[6].Direction = ParameterDirection.Output;

			foreach(SqlParameter para in paras)
			{
				command.Parameters.Add(para);
			}

			conn.Open();
			command.ExecuteNonQuery();
			string [] info_list = new string [6];
			info_list[0] = command.Parameters["@send"].Value.ToString();
			info_list[1] = command.Parameters["@resive_new"].Value.ToString();
			info_list[2] = command.Parameters["@resive_old"].Value.ToString();
			info_list[3] = command.Parameters["@draft"].Value.ToString();
			info_list[4] = command.Parameters["@rubbish_1"].Value.ToString();
			info_list[5] = command.Parameters["@rubbish_2"].Value.ToString();
			conn.Close();
			return info_list;
		}


		public void RemainMsg(string msgid,string personid,string status)
		{
			SqlCommand command = new SqlCommand();
			command.CommandText = "Msg_RemainMsg";
			command.CommandType = CommandType.StoredProcedure;
			command.Connection  = conn;
			SqlParameter [] paras = {   new SqlParameter("@msgid",SqlDbType.Int),
										new SqlParameter("@personid", SqlDbType.Int),
										new SqlParameter("@status" ,SqlDbType.Int)
									};
			paras[0].Value = Convert.ToInt32(msgid);
			paras[1].Value = Convert.ToInt32(personid);
			paras[2].Value = Convert.ToInt32(status);
			foreach(SqlParameter para in paras)
			{
				command.Parameters.Add(para);
			}
			conn.Open();
			command.ExecuteNonQuery();
			conn.Close();
		}
	}
}

⌨️ 快捷键说明

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