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

📄 cw_kjnd.cs

📁 ASP.NET的一些开发实例,有论坛管理系统等
💻 CS
字号:
using System;
using System.Data;
using System.Data.SqlClient;
using System.Collections;
using com.unicafe.common;
using Com.Ascs.Plp.CW;


namespace Com.Ascs.Plp.CW
{
	/// <summary>
	///  对象CW_KJND的定义
	///  根据表 CW_KJND
	/// </summary>
	
	public class CW_KJND
	{
		/// <summary>
		/// 对象CW_KJND的构造函数
		/// </summary>
		public CW_KJND()
		{
			m_KJND = "";
		}
		
		private string m_KJND;
		
		/// <summary>
		/// 属性 KJND
		/// </summary>
		public string KJND
		{
			get
			{
				return m_KJND;
			}
			set
			{
				m_KJND = value;
			}
		}
		
	}
	
}
namespace Com.Ascs.Plp.CW
{
	/// <summary>
	/// 实现对 CW_KJND对象的管理
	/// </summary>
	
	 public class CW_KJNDMgr
	{
		/// <summary>
		///  添加新的CW_KJND对象
		/// </summary>
		/// <param name="theCW_KJND">要添加的CW_KJND对象</param>
		
		public bool AddCW_KJND(CW_KJND theCW_KJND)
		{
			try
			{
				SqlConnection cn = new SqlConnection (com.unicafe.common.Configuration.GetDBConnectionString());
				cn.Open();
				
				string sql;
				sql = "insert into CW_KJND (KJND) values (@KJND)";
				
				SqlCommand cmd = new SqlCommand(sql, cn);
				
				cmd.Parameters.Add ("@KJND", theCW_KJND.KJND);
				
				cmd.ExecuteNonQuery();

				SqlDataReader dr = cmd.ExecuteReader();

				cn.Close();
				return true;
			}
			catch(Exception e)
			{
				LogService.Write ("AddCW_KJND(CW_KJND theCW_KJND)");
				LogService.Write (e.Message);
				return false;
			}
		}
		
		/// <summary>
		///  更新CW_KJND对象
		/// </summary>
		/// <param name="theCW_KJND">要更新的CW_KJND对象</param>
		
		public bool UpdateCW_KJND(CW_KJND theCW_KJND)
		{
			try
			{
				SqlConnection cn = new SqlConnection (com.unicafe.common.Configuration.GetDBConnectionString());
				cn.Open();
				
				string sql;
				sql = "update CW_KJND set  where KJND=@KJND";
				
				SqlCommand cmd = new SqlCommand(sql, cn);
				
				cmd.Parameters.Add ("@KJND", theCW_KJND.KJND);
				
				cmd.ExecuteNonQuery();
				
				cn.Close();
				return true;
			}
			catch(Exception e)
			{
				LogService.Write ("UpdateCW_KJND(CW_KJND theCW_KJND)");
				LogService.Write (e.Message);
				return false;
			}
		}
		
		/// <summary>
		///  删除CW_KJND对象
		/// </summary>
		/// <param name="KJND">主键</param>
		
		public bool DelCW_KJND(SqlCommand cmd, string KJND)
		{
			try
			{
				cmd.Parameters.Clear();
				cmd.Parameters.Add ("@KJND", KJND);

				//查询该会计年度在会计期间表中是否已经有设置
				string sql;
				sql = "select Count(*) from CW_KJQJ Where KJND=@KJND";
				cmd.CommandText = sql;
				if(int.Parse(cmd.ExecuteScalar().ToString()) != 0)
				{
					return false;
				}

				//查询该会计年度在财务系统设置表中是否已经有设置
				sql = "select Count(*) from CW_CWXTSZ Where KJND=@KJND";
				cmd.CommandText = sql;
				if(int.Parse(cmd.ExecuteScalar().ToString()) != 0)
				{
					return false;
				}

				//查询该会计年度在资金占用表中是否已经有设置
				sql = "select Count(*) from CW_ZJZY Where ND=@KJND";
				cmd.CommandText = sql;
				if(int.Parse(cmd.ExecuteScalar().ToString()) != 0)
				{
					return false;
				}

				//查询该会计年度在结转损益对应表中是否已经有设置
				sql = "select Count(*) from CW_JZSYDY Where KJND=@KJND";
				cmd.CommandText = sql;
				if(int.Parse(cmd.ExecuteScalar().ToString()) != 0)
				{
					return false;
				}

				sql = "Delete from CW_KJND where KJND=@KJND";
				cmd.CommandText = sql;
				cmd.Parameters.Clear();
				cmd.Parameters.Add ("@KJND", KJND);
				
				cmd.ExecuteNonQuery();
				return true;
			}
			catch(Exception e)
			{
				LogService.Write ("DelCW_KJND(string KJND)");
				LogService.Write (e.Message);
				return false;
			}
		}
		
		/// <summary>
		///  根据主键标识获得CW_KJND对象
		/// </summary>
		/// <param name="KJND">主键</param>
		
		public CW_KJND GetCW_KJND(string KJND)
		{
			try
			{
				CW_KJND result = null;
				
				SqlConnection cn = new SqlConnection (com.unicafe.common.Configuration.GetDBConnectionString());
				cn.Open();
				
				string sql;
				sql = "select * from CW_KJND where KJND=@KJND";
				
				SqlCommand cmd = new SqlCommand(sql,cn);
				cmd.Parameters.Add ("@KJND", KJND);
				
				SqlDataReader dr = cmd.ExecuteReader();
				
				if (dr.Read())
				{
					result = new CW_KJND();
					if (dr["KJND"] != null)
						if (!System.DBNull.Equals(dr["KJND"], System.DBNull.Value))
							result.KJND = (string)dr["KJND"];
				}
				dr.Close();
				cn.Close();
				return result;
			}
			catch(Exception e)
			{
				LogService.Write ("GetCW_KJND(string KJND)");
				LogService.Write (e.Message);
				return null;
			}
		}
	
		/// <summary>
		///  查找CW_KJND对象
		/// </summary>
	
		public ArrayList FindCW_KJND()
		{
			try
			{
				ArrayList result = new ArrayList();
			
				SqlConnection cn = new SqlConnection (com.unicafe.common.Configuration.GetDBConnectionString());
				cn.Open();
			
				string sql;
				sql = "select * from CW_KJND";
			
				SqlCommand cmd = new SqlCommand(sql, cn);
			
				SqlDataReader dr = cmd.ExecuteReader();
			
				while (dr.Read())
				{
					CW_KJND obj = new CW_KJND();
					if (dr["KJND"] != null)
						if (!System.DBNull.Equals(dr["KJND"], System.DBNull.Value))
							obj.KJND = (string)dr["KJND"];
					result.Add(obj);
				}
				dr.Close();
				cn.Close();
				return result;
			}
			catch(Exception e)
			{
				LogService.Write ("FindCW_KJND()");
				LogService.Write (e.Message);
				return null;
			}
		}
	
	
	}
}

⌨️ 快捷键说明

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