📄 b_unit_info.cs
字号:
using System;
using System.Collections;
using OI.Modules;
namespace OI.NjObjCheck.DataClass
{
//设计人:陈仕欣 日期:2003-11-29
//v1.0 修改日期:2003-11-29
/// <summary>
/// 枚举类:b_unit_infos
/// 集合元素类:b_unit_info
/// </summary>
/// <example>
/// <code>
/// b_unit_infos oFileList=new b_unit_infos()
/// foreach(b_unit_infos.b_unit_info in oFileList)
/// {
/// }
/// </code>
/// <code>
/// b_unit_infos.b_unit_info oFileList=new
/// </code>
/// </example>
public class b_unit_infos :OI.Data.DbObject,IEnumerable
{
private int nCurrentRecordNum;
private string cSearchKey;
//出错信息;
private string cUnitID="";
private string cUnitName="";
private string cShortName="";
private string cUnitAddress="";
private string cUnitManager="";
private string cUnitLinkman="";
private string cLinkphone="";
private string cOperateman="";
private string cUnitRank="";
private string cNotReportedAll="";
/// <summary>
/// 设置过滤条件:
/// </summary>
public string UnitID
{
get
{
return cUnitID;
}
set
{
cUnitID=OI.Modules.String.GenSafeChars(value);;
}
}
/// <summary>
/// 设置过滤条件:
/// </summary>
public string UnitName
{
get
{
return cUnitName;
}
set
{
cUnitName=OI.Modules.String.GenSafeChars(value);;
}
}
/// <summary>
/// 设置过滤条件:
/// </summary>
public string ShortName
{
get
{
return cShortName;
}
set
{
cShortName=OI.Modules.String.GenSafeChars(value);;
}
}
/// <summary>
/// 设置过滤条件:
/// </summary>
public string UnitAddress
{
get
{
return cUnitAddress;
}
set
{
cUnitAddress=OI.Modules.String.GenSafeChars(value);;
}
}
/// <summary>
/// 设置过滤条件:
/// </summary>
public string UnitManager
{
get
{
return cUnitManager;
}
set
{
cUnitManager=OI.Modules.String.GenSafeChars(value);;
}
}
/// <summary>
/// 设置过滤条件:
/// </summary>
public string UnitLinkman
{
get
{
return cUnitLinkman;
}
set
{
cUnitLinkman=OI.Modules.String.GenSafeChars(value);;
}
}
/// <summary>
/// 设置过滤条件:
/// </summary>
public string Linkphone
{
get
{
return cLinkphone;
}
set
{
cLinkphone=OI.Modules.String.GenSafeChars(value);;
}
}
/// <summary>
/// 设置过滤条件:
/// </summary>
public string Operateman
{
get
{
return cOperateman;
}
set
{
cOperateman=OI.Modules.String.GenSafeChars(value);;
}
}
/// <summary>
/// 设置过滤条件:
/// </summary>
public string UnitRank
{
get
{
return cUnitRank;
}
set
{
cUnitRank=OI.Modules.String.GenSafeChars(value);;
}
}
System.Data.DataSet oDataSet;
/// <summary>
/// 当前的记录
/// </summary>
public int CurrentRecordNum
{
get
{
return nCurrentRecordNum;
}
set
{
nCurrentRecordNum=value;
}
}
/// <summary>
/// 组织查询条件
/// </summary>
/// <returns>查询字符串</returns>
private string GenSqlFilter()
{
string cSql="";
if(this.cUnitID!="")
{
if(cSql!="")
cSql=cSql+" and UnitID ='"+this.cUnitID+"' " ;
else
cSql=cSql+" where UnitID ='"+this.cUnitID+"' " ;
}
if(this.cUnitName!="")
{
if(cSql!="")
cSql=cSql+" and UnitName ='"+this.cUnitName+"' " ;
else
cSql=cSql+" where UnitName ='"+this.cUnitName+"' " ;
}
if(this.cShortName!="")
{
if(cSql!="")
cSql=cSql+" and ShortName ='"+this.cShortName+"' " ;
else
cSql=cSql+" where ShortName ='"+this.cShortName+"' " ;
}
if(this.cUnitAddress!="")
{
if(cSql!="")
cSql=cSql+" and UnitAddress ='"+this.cUnitAddress+"' " ;
else
cSql=cSql+" where UnitAddress ='"+this.cUnitAddress+"' " ;
}
if(this.cUnitManager!="")
{
if(cSql!="")
cSql=cSql+" and UnitManager ='"+this.cUnitManager+"' " ;
else
cSql=cSql+" where UnitManager ='"+this.cUnitManager+"' " ;
}
if(this.cUnitLinkman!="")
{
if(cSql!="")
cSql=cSql+" and UnitLinkman ='"+this.cUnitLinkman+"' " ;
else
cSql=cSql+" where UnitLinkman ='"+this.cUnitLinkman+"' " ;
}
if(this.cLinkphone!="")
{
if(cSql!="")
cSql=cSql+" and Linkphone ='"+this.cLinkphone+"' " ;
else
cSql=cSql+" where Linkphone ='"+this.cLinkphone+"' " ;
}
if(this.cOperateman!="")
{
if(cSql!="")
cSql=cSql+" and Operateman ='"+this.cOperateman+"' " ;
else
cSql=cSql+" where Operateman ='"+this.cOperateman+"' " ;
}
if(this.cUnitRank!="")
{
if(cSql!="")
cSql=cSql+" and UnitRank ='"+this.cUnitRank+"' " ;
else
cSql=cSql+" where UnitRank ='"+this.cUnitRank+"' " ;
}
if(this.cNotReportedAll!="")
{
if(cSql!="")
cSql=cSql+" and "+cNotReportedAll;
else
cSql=cSql+" where "+cNotReportedAll;
}
if(cSearchKey!=null&&cSearchKey!="")
{
if(cSql!="")
cSql=cSql+" And ( UnitRank like '%"+cSearchKey+"%' or Operateman like '%"+cSearchKey+"%' or Linkphone like '%"+cSearchKey+"%' or UnitLinkman like '%"+cSearchKey+"%' or UnitManager like '%"+cSearchKey+"%' or UnitAddress like '%"+cSearchKey+"%' or ShortName like '%"+cSearchKey+"%' or UnitName like '%"+cSearchKey+"%')";
else
cSql=cSql+" Where ( UnitRank like '%"+cSearchKey+"%' or Operateman like '%"+cSearchKey+"%' or Linkphone like '%"+cSearchKey+"%' or UnitLinkman like '%"+cSearchKey+"%' or UnitManager like '%"+cSearchKey+"%' or UnitAddress like '%"+cSearchKey+"%' or ShortName like '%"+cSearchKey+"%' or UnitName like '%"+cSearchKey+"%')";
}
return cSql;
}
/// <summary>
/// 从项目中获取数据
/// </summary>
/// <returns>成功/失败</returns>
public void GetData()
{
if(oDataSet !=null)
oDataSet.Clear();
string sqlFilter=this.GenSqlFilter();
string calculateCmdString="select count(*) as RecordCount From b_unit_info"+sqlFilter;//在此写入查询总记录数Sql查询语句
string sql="Select UnitID,UnitName,ShortName,UnitAddress,UnitManager,UnitLinkman,Linkphone,Operateman,UnitRank From b_unit_info"+sqlFilter+" order by UnitName ";//在此写入Sql查询语句
try
{
oDataSet=this.RunCommand(calculateCmdString,sql,"b_unit_info");//在此写入表名
}
catch(System.Data.SqlClient.SqlException e)
{
if(this.Connection.State==System.Data.ConnectionState.Open)
this.Connection.Close();
throw new AppException("执行下列语句出错:\n\r"+sql,e);
}
}
public void SetNotReportedAllFilter(string SetYear)
{
SetYear=OI.Modules.String.GenSafeChars(SetYear);
this.cNotReportedAll=" ( UnitID in (select UnitID from o_function_object where DoCheck='未上报' and SetYear='"+SetYear+"') "+
" or UnitID in (select UnitID from o_mono_object_info where DoCheck='未上报' and SetYear='"+SetYear+"') ) ";
}
/// <summary>
/// 查询关键字
///在以下项目中查询:
///、、、、、、、、
/// </summary>
public string SearchKey
{
get
{
return cSearchKey;
}
set
{
cSearchKey=OI.Modules.String.GenSafeChars(value);
}
}
/// <summary>
/// 获取查询后的数据XML格式字符串
/// </summary>
/// <returns>成功或失败</returns>
public string GetDataXml()
{
if(this.oDataSet==null)
GetData();
return oDataSet.GetXml() ;
}
/// <summary>
/// 构造函数
/// </summary>
public b_unit_infos()
{
}
/// <summary>
/// 判断该单位的考核数据是否已全部考核完毕
/// </summary>
/// <param name="UnitID"></param>
/// <param name="SetYear"></param>
/// <returns></returns>
public bool CheckedAll(string UnitID,string SetYear)
{
UnitID=OI.Modules.String.GenSafeChars(UnitID);
SetYear=OI.Modules.String.GenSafeChars(SetYear);
string sql;
System.Data.SqlClient.SqlDataReader oSqlDataReader;
//首先判断职能目标是否已考核完毕
sql="select count(*) from o_function_object "+
" where DoCheck<>'已审核' and DoCheck<>'已分解' and UnitID='"+UnitID+"' and SetYear='"+SetYear+"'";
oSqlDataReader=this.RunCommand(sql);
if(oSqlDataReader.Read())
{
if(oSqlDataReader.GetInt32(0)>0)
return false;
}
oSqlDataReader.Close();
//判断单项目标是否已考核完毕
sql="select count(*) from o_mono_object_info "+
" where DoCheck<>'已审核' and UnitID='"+UnitID+"' and SetYear='"+SetYear+"'";
oSqlDataReader=this.RunCommand(sql);
if(oSqlDataReader.Read())
{
if(oSqlDataReader.GetInt32(0)>0)
return false;
}
oSqlDataReader.Close();
//判断其他加分是否已考核完毕
sql="select count(*) from c_mark_detail "+
" where IsPublic<>'1' and UnitID='"+UnitID+"' and SetYear='"+SetYear+"'";
oSqlDataReader=this.RunCommand(sql);
if(oSqlDataReader.Read())
{
if(oSqlDataReader.GetInt32(0)>0)
return false;
}
oSqlDataReader.Close();
//关闭数据库连接
this.Connection.Close();
return true;
}
/// <summary>
/// 判断该单位的考核数据是否已全部上报完毕
/// </summary>
/// <param name="UnitID"></param>
/// <param name="SetYear"></param>
/// <returns></returns>
public bool ReportedAll(string UnitID,string SetYear)
{
UnitID=OI.Modules.String.GenSafeChars(UnitID);
SetYear=OI.Modules.String.GenSafeChars(SetYear);
string sql;
System.Data.SqlClient.SqlDataReader oSqlDataReader;
//首先判断职能目标
sql="select count(*) from o_function_object "+
" where DoCheck=='未上报' and UnitID='"+UnitID+"' and SetYear='"+SetYear+"'";
oSqlDataReader=this.RunCommand(sql);
if(oSqlDataReader.Read())
{
if(oSqlDataReader.GetInt32(0)>0)
return false;
}
oSqlDataReader.Close();
//判断单项目标
sql="select count(*) from o_mono_object_info "+
" where DoCheck=='未上报' and UnitID='"+UnitID+"' and SetYear='"+SetYear+"'";
oSqlDataReader=this.RunCommand(sql);
if(oSqlDataReader.Read())
{
if(oSqlDataReader.GetInt32(0)>0)
return false;
}
oSqlDataReader.Close();
//关闭数据库连接
this.Connection.Close();
return true;
}
/// <summary>
/// 添加单位信息
/// </summary>
/// <param name="Linkphone">联系电话</param>
/// <param name="Operateman">经办人</param>
/// <param name="UnitRank">单位级别</param>
/// <param name="UnitAddress">地址</param>
/// <param name="UnitManager">负责人</param>
/// <param name="UnitLinkman">联系人</param>
/// <param name="UnitName">单位名称</param>
/// <param name="ShortName">单位简称</param>
/// <param name="UnitID">单位ID</param>
/// <returns>成功或失败</returns>
public bool Addb_unit_info(string Linkphone ,string Operateman ,string UnitRank,string UnitAddress ,string UnitManager ,string UnitLinkman ,string UnitName ,string ShortName ,out string UnitID)
{
UnitID="";
Linkphone=OI.Modules.String.GenSafeChars(Linkphone);
Operateman=OI.Modules.String.GenSafeChars(Operateman);
UnitRank=OI.Modules.String.GenSafeChars(UnitRank);
UnitAddress=OI.Modules.String.GenSafeChars(UnitAddress);
UnitManager=OI.Modules.String.GenSafeChars(UnitManager);
UnitLinkman=OI.Modules.String.GenSafeChars(UnitLinkman);
UnitName=OI.Modules.String.GenSafeChars(UnitName);
ShortName=OI.Modules.String.GenSafeChars(ShortName);
System.Data.SqlClient.SqlParameter paraReturn=new System.Data.SqlClient.SqlParameter("@ReturnValue",System.Data.SqlDbType.Int,4);
System.Data.SqlClient.SqlParameter paraLinkphone=new System.Data.SqlClient.SqlParameter("@Linkphone",System.Data.SqlDbType.VarChar,20);
System.Data.SqlClient.SqlParameter paraOperateman=new System.Data.SqlClient.SqlParameter("@Operateman",System.Data.SqlDbType.VarChar,20);
System.Data.SqlClient.SqlParameter paraUnitRank=new System.Data.SqlClient.SqlParameter("@UnitRank",System.Data.SqlDbType.VarChar,20);
System.Data.SqlClient.SqlParameter paraUnitAddress=new System.Data.SqlClient.SqlParameter("@UnitAddress",System.Data.SqlDbType.VarChar,100);
System.Data.SqlClient.SqlParameter paraUnitManager=new System.Data.SqlClient.SqlParameter("@UnitManager",System.Data.SqlDbType.VarChar,20);
System.Data.SqlClient.SqlParameter paraUnitLinkman=new System.Data.SqlClient.SqlParameter("@UnitLinkman",System.Data.SqlDbType.VarChar,20);
System.Data.SqlClient.SqlParameter paraUnitName=new System.Data.SqlClient.SqlParameter("@UnitName",System.Data.SqlDbType.VarChar,100);
System.Data.SqlClient.SqlParameter paraShortName=new System.Data.SqlClient.SqlParameter("@ShortName",System.Data.SqlDbType.VarChar,20);
System.Data.SqlClient.SqlParameter paraUnitID=new System.Data.SqlClient.SqlParameter("@UnitID",System.Data.SqlDbType.VarChar,20);
paraUnitID.Direction=System.Data.ParameterDirection.Output;
paraReturn.Direction=System.Data.ParameterDirection.ReturnValue;
paraLinkphone.Value=Linkphone;
paraOperateman.Value=Operateman;
paraUnitRank.Value=UnitRank;
paraUnitAddress.Value=UnitAddress;
paraUnitManager.Value=UnitManager;
paraUnitLinkman.Value=UnitLinkman;
paraUnitName.Value=UnitName;
paraShortName.Value=ShortName;
System.Data.SqlClient.SqlParameter[] oSqlParameter=new System.Data.SqlClient.SqlParameter[10];
oSqlParameter[0]=paraReturn;
oSqlParameter[1]=paraLinkphone;
oSqlParameter[2]=paraOperateman;
oSqlParameter[3]=paraUnitRank;
oSqlParameter[4]=paraUnitAddress;
oSqlParameter[5]=paraUnitManager;
oSqlParameter[6]=paraUnitLinkman;
oSqlParameter[7]=paraUnitName;
oSqlParameter[8]=paraShortName;
oSqlParameter[9]=paraUnitID;
int rowsAffected;
int returnvalue;
try
{
returnvalue=(int)this.RunProcedure("Addb_unit_info",oSqlParameter,out rowsAffected);
}
catch(System.Data.SqlClient.SqlException e)
{
string msg="";
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -