?? cw_kjnd.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 + -