?? applyinfo.cs
字號:
using System;
using System.Data ;
using HRAdmin.COMMON ;
using HRAdmin.DAL ;
namespace HRAdmin.BLL
{
/// <summary>
/// ApplyInfo 的摘要說明。
/// </summary>
public class ApplyInfo
{
public ApplyInfo()
{
//
// TODO: 在此處添加構造函數邏輯
//
}
#region 私有變量
private int _applyID ;
private string _type ;
private string _status ;
private DateTime _startDate ;
private DateTime _endDate ;
private string _dsc ;
private int _persID ;
private int _deptID ;
private DateTime _putDate ;
#endregion
#region 公共屬性
public int ApplyID
{
get {return _applyID ;}
set {_applyID = value ;}
}
public string Type
{
get {return _type ;}
set { _type = value ;}
}
public string Status
{
get {return _status ;}
set {_status = value ;}
}
public DateTime StartDate
{
get { return _startDate ;}
set { _startDate = value ;}
}
public DateTime EndDate
{
get { return _endDate ;}
set { _endDate = value ;}
}
public string Dsc
{
get {return _dsc ;}
set { _dsc = value ;}
}
public int PersID
{
get {return _persID ;}
set { _persID = value ;}
}
public int DeptID
{
get{ return _deptID ; }
set{ _deptID = value ;}
}
public DateTime PutDate
{
get{return _putDate ;}
set{_putDate=value ;}
}
#endregion
#region 公共方法
/// <summary>
/// 根據申請信息ID查詢申請信息
/// </summary>
/// <param name="applyid"></param>
/// <returns></returns>
public int GetApplyInfo(int applyid)
{
int ret = -1 ;
//存儲過程名
string spName = "HR_Apply_Get" ;
//參數
object[] para = new object[] {applyid} ;
//執行存儲過程
DataTable dt = DataAccess.ExecuteDataTable(spName,para) ;
if(dt.Rows.Count > 0)
{
//查詢成功,初始化申請信息的各個屬性
DataRow dr = dt.Rows[0] ;
AssignAttribute(dr) ;
//返回成功
ret = 0 ;
}
return ret ;
}
/// <summary>
/// 員工查詢個人申請信息
/// </summary>
/// <returns>DataTable個人的申請信息</returns>
public static DataTable GetApplyInfo_Psn(string type,DateTime startDate,DateTime endDate,int pID)
{
//存儲過程名
string spName = "HR_Apply_GetPsn" ;
//參數
object[] para = new object[] {type,startDate,endDate,pID} ;
//執行存儲過程,并返回DataTable
return DataAccess.ExecuteDataTable(spName,para) ;
}
/// <summary>
/// 部門經理查詢申請信息
/// </summary>
/// <param name="id">ID</param>
/// <returns>DataTable部門的申請信息</returns>
public static DataTable GetApplyInfo_Mgr(string type,int deptID)
{
//存儲過程名
string spName = "HR_Apply_GetMgr" ;
//參數
object[] para = new object[] {type,deptID} ;
//執行存儲過程,并返回DataTable
return DataAccess.ExecuteDataTable(spName,para) ;
}
/// <summary>
/// 指定申請信息屬性
/// </summary>
/// <param name="dr">dr</param>
public void AssignAttribute(DataRow dr)
{
this._applyID = CommHandler.StringToInt(dr["APPLYID"].ToString()) ;
this._type = dr["TYPE"].ToString() ;
this._status = dr["STATUS"].ToString() ;
this._startDate = CommHandler.StringToDateTime(dr["STARTDATE"].ToString()) ;
this._endDate = CommHandler.StringToDateTime(dr["ENDDATE"].ToString()) ;
this._dsc = dr["Dsc"].ToString() ;
}
/// <summary>
/// 添加申請信息
/// </summary>
/// <returns>新產生的申請信息ID</returns>
public int AddApply()
{
//存儲過程名
string spName = "HR_Apply_Add" ;
//存儲過程參數
object[] para = new object[] {"",_type,_status,_startDate,_endDate,_dsc,_persID,_deptID,_putDate} ;
//調用數據訪問層的方法訪問存儲過程
_applyID = DataAccess.ExecuteNonQuery(spName,true,para) ;
//返回新申請信息ID
return _applyID ;
}
/// <summary>
/// 修改申請信息
/// </summary>
/// <returns>修改的命令所影響的行數</returns>
public int ModifyApply()
{
int ret = -1 ;
//存儲過程名
string spName = "HR_Apply_Modify" ;
//存儲過程參數
object[] para = new object[] {_applyID,_type,_status,_startDate,_endDate,_dsc} ;
//調用數據訪問層的方法執行存儲過程,并返回受影響的行數
ret = DataAccess.ExecuteNonQuery(spName,false,para) ;
return ret ;
}
/// <summary>
/// 刪除申請信息
/// </summary>
/// <param name="id">申請信息ID</param>
/// <returns>刪除結果</returns>
public static int DeleteApply(string id)
{
int ret = -1 ;
//刪除申請信息的存儲過程
string spName = "HR_Apply_Delete" ;
//存儲過程參數
object[] para = new object[] {id} ;
//調用數據訪問方法執行存儲過程,并返回受影響的行數
ret = DataAccess.ExecuteNonQuery(spName,false,para) ;
return ret ;
}
/// <summary>
/// 審批申請
/// </summary>
/// <param name="id">申請信息ID</param>
/// <param name="result">審批結果</param>
/// <param name="response">批復內容</param>
/// <returns>受影響的行數</returns>
public static int ExamineApply(int id,string result,string response)
{
int ret = -1 ;
//存儲過程名
string spName = "HR_Apply_Examine" ;
//存儲過程參數
object[] para = new object[] {id,result,response} ;
//調用數據訪問層的方法執行存儲過程,并返回受影響的行數
ret = DataAccess.ExecuteNonQuery(spName,false,para) ;
return ret ;
}
#endregion
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -