?? documentflow.cs
字號:
using System;
using System.Data;
using System.Data.SqlClient;
namespace UDS.Components
{
#region 工作流的函數
/// <summary>
/// DocumentFlow 的摘要說明。
/// </summary>
public class DocumentFlow
{
//////////////////////////////////////////
/// 公文流轉
//////////////////////////////////////////
#region 添加文檔
/// <summary>
/// 添加文檔
/// </summary>
/// <param name="UserName">擬稿人</param>
/// <param name="FlowID">所用流程ID</param>
/// <param name="SQL">樣式表數據的SQL語句</param>
public int AddDocument(string UserName,long FlowID,string SQL)
{
int iReturn=-1;
UDS.Components.Database mySQL = new UDS.Components.Database();
SqlParameter[] parameters = {
mySQL.MakeInParam("@DocBuilder",SqlDbType.VarChar,300,UserName),
mySQL.MakeInParam("@FlowID",SqlDbType.Int ,4,FlowID),
mySQL.MakeInParam("@SQL",SqlDbType.NText,4000,SQL)
};
try
{
iReturn = mySQL.RunProc("sp_Flow_AddDocument",parameters);
}
catch(Exception e)
{
Error.Log(e.ToString());
}
finally
{
mySQL.Close();
mySQL = null;
}
return iReturn;
}
#endregion
#region 刪除文檔
/// <summary>
/// 刪除文檔
/// </summary>
/// <param name="DocID">被刪除的文檔ID</param>
public int DeleteDocument(long DocID)
{
int iReturn=-1;
UDS.Components.Database mySQL = new UDS.Components.Database();
SqlParameter[] parameters = {
mySQL.MakeInParam("@DocID",SqlDbType.Int ,4,DocID)
};
try
{
iReturn = mySQL.RunProc("sp_Flow_DeleteDocument",parameters);
}
catch(Exception e)
{
Error.Log(e.ToString());
}
finally
{
mySQL.Close();
mySQL = null;
}
return iReturn;
}
#endregion
#region 修改文檔
/// <summary>
/// 修改文檔
/// </summary>
/// <param name="UpdateSQL">更新文檔語句</param>
public int UpdateDocument(string UpdateSQL)
{
int iReturn=-1;
UDS.Components.Database mySQL = new UDS.Components.Database();
SqlParameter[] parameters = {
mySQL.MakeInParam("@SQL",SqlDbType.NText,4000,UpdateSQL)
};
try
{
iReturn = mySQL.RunProc("sp_Flow_UpdateDocument",parameters);
}
catch(Exception e)
{
Error.Log(e.ToString());
}
finally
{
mySQL.Close();
mySQL = null;
}
return iReturn;
}
#endregion
#region 文檔簽收
/// <summary>
/// 文檔簽收
/// </summary>
/// <param name="UserName">簽收人</param>
/// <param name="DocID">要被簽收的文檔ID</param>
public int SignInDocument(string UserName,long DocID)
{
int iReturn=-1;
UDS.Components.Database mySQL = new UDS.Components.Database();
SqlParameter[] parameters = {
mySQL.MakeInParam("@StaffName",SqlDbType.VarChar ,300,UserName),
mySQL.MakeInParam("@DocID",SqlDbType.Int,4,DocID)
};
try
{
iReturn = mySQL.RunProc("sp_Flow_SignINDoc",parameters);
}
catch(Exception e)
{
Error.Log(e.ToString());
}
finally
{
mySQL.Close();
mySQL = null;
}
return iReturn;
}
#endregion
#region 取消簽收
/// <summary>
/// 取消簽收
/// </summary>
/// <param name="UserName">簽收人</param>
/// <param name="DocID">被取消的文檔ID</param>
public int CancelSignInDocument(string UserName,long DocID)
{
int iReturn=-1;
UDS.Components.Database mySQL = new UDS.Components.Database();
SqlParameter[] parameters = {
mySQL.MakeInParam("@StaffName",SqlDbType.VarChar ,300,UserName),
mySQL.MakeInParam("@DocID",SqlDbType.Int,4,DocID)
};
try
{
iReturn = mySQL.RunProc("sp_Flow_CancelSignINDoc",parameters);
}
catch(Exception e)
{
Error.Log(e.ToString());
}
finally
{
mySQL.Close();
mySQL = null;
}
return iReturn;
}
#endregion
#region 添加批注
/// <summary>
/// 添加批注
/// </summary>
/// <param name="UserName">批注人</param>
/// <param name="DocID">批注的文檔ID</param>
/// <param name="PostilType">批注類型,通過,拒絕,完成</param>
public int AddPostil(string UserName,long DocID,string Postil,int PostilType,long ObjID,long ObjType)
{
int iReturn=-1;
UDS.Components.Database mySQL = new UDS.Components.Database();
SqlParameter[] parameters = {
mySQL.MakeInParam("@DocID",SqlDbType.Int ,4,DocID),
mySQL.MakeInParam("@Postiler",SqlDbType.VarChar ,300,UserName),
mySQL.MakeInParam("@PostilContent",SqlDbType.NText,3000,Postil),
mySQL.MakeInParam("@PostilType",SqlDbType.Int ,4,PostilType),
mySQL.MakeInParam("@ObjID",SqlDbType.Int ,4,ObjID),
mySQL.MakeInParam("@ObjType",SqlDbType.Int ,4,ObjType)
};
try
{
iReturn = mySQL.RunProc("sp_Flow_AddPostil",parameters);
}
catch(Exception e)
{
Error.Log(e.ToString());
}
finally
{
mySQL.Close();
mySQL = null;
}
return iReturn;
}
#endregion
#region 否決文檔
/// <summary>
/// 否決文檔
/// </summary>
/// <param name="DocID">被否決的文檔ID</param>
public int FaileDocument(long DocID)
{
int iReturn=-1;
UDS.Components.Database mySQL = new UDS.Components.Database();
SqlParameter[] parameters = {
mySQL.MakeInParam("@DocID",SqlDbType.Int ,4,DocID)
};
try
{
iReturn = mySQL.RunProc("sp_Flow_FaileDocument",parameters);
}
catch(Exception e)
{
Error.Log(e.ToString());
}
finally
{
mySQL.Close();
mySQL = null;
}
return iReturn;
}
#endregion
#region 打回文檔
/// <summary>
/// 打回文檔
/// </summary>
/// <param name="DocID">被打回的文檔ID</param>
public int BackDocument(long DocID)
{
int iReturn=-1;
UDS.Components.Database mySQL = new UDS.Components.Database();
SqlParameter[] parameters = {
mySQL.MakeInParam("@DocID",SqlDbType.Int ,4,DocID)
};
try
{
iReturn = mySQL.RunProc("sp_Flow_BackDocument",parameters);
}
catch(Exception e)
{
Error.Log(e.ToString());
}
finally
{
mySQL.Close();
mySQL = null;
}
return iReturn;
}
#endregion
#region 通過文檔
/// <summary>
/// 通過文檔
/// </summary>
/// <param name="UserName">審批人</param>
/// <param name="DocID">當前文檔ID</param>
/// <param name="ProjectID">所在項目ID</param>
public int PostDocument(string UserName,long DocID,long ProjectID)
{
int iReturn=-1;
UDS.Components.Database mySQL = new UDS.Components.Database();
SqlParameter[] parameters = {
mySQL.MakeInParam("@StaffName",SqlDbType.VarChar,300,UserName),
mySQL.MakeInParam("@DocID",SqlDbType.VarChar,300,DocID),
mySQL.MakeInParam("@ProjectID",SqlDbType.Int,4,ProjectID)
};
try
{
iReturn = mySQL.RunProc("sp_Flow_PostDocument",parameters);
}
catch(Exception e)
{
Error.Log(e.ToString());
}
finally
{
mySQL.Close();
mySQL = null;
}
return iReturn;
}
#endregion
#region 結束文檔
/// <summary>
/// 結束文檔
/// </summary>
/// <param name="DocID">被結束的文檔ID</param>
public int FinishDocument(long DocID)
{
int iReturn=-1;
UDS.Components.Database mySQL = new UDS.Components.Database();
SqlParameter[] parameters = {
mySQL.MakeInParam("@DocID",SqlDbType.Int ,4,DocID)
};
try
{
iReturn = mySQL.RunProc("sp_Flow_FinishDocument",parameters);
}
catch(Exception e)
{
Error.Log(e.ToString());
}
finally
{
mySQL.Close();
mySQL = null;
}
return iReturn;
}
#endregion
#region 刪除文檔最近的批注
/// <summary>
/// 刪除文檔最近的批注
/// </summary>
/// <param name="DocID">文檔ID</param>
public int CancelPostil(long DocID)
{
int iReturn=-1;
UDS.Components.Database mySQL = new UDS.Components.Database();
SqlParameter[] parameters = {
mySQL.MakeInParam("@DocID",SqlDbType.Int ,4,DocID)
};
try
{
iReturn = mySQL.RunProc("sp_Flow_CancelPostil",parameters);
}
catch(Exception e)
{
Error.Log(e.ToString());
}
finally
{
mySQL.Close();
mySQL = null;
}
return iReturn;
}
#endregion
#region 獲得步驟流轉規則
/// <summary>
/// 獲得步驟流轉規則
/// </summary>
/// <param name="FlowID">流程ID</param>
/// <param name="StepID">步驟ID</param>
public int GetStepRule(long FlowID,long StepID)
{
int iReturn=-1;
UDS.Components.Database mySQL = new UDS.Components.Database();
SqlParameter[] parameters = {
mySQL.MakeInParam("@FlowID",SqlDbType.Int,4,FlowID),
mySQL.MakeInParam("@StepID",SqlDbType.Int,4,StepID)
};
try
{
iReturn = mySQL.RunProc("sp_Flow_GetStepRule",parameters);
}
catch(Exception e)
{
Error.Log(e.ToString());
}
finally
{
mySQL.Close();
mySQL = null;
}
return iReturn;
}
#endregion
#region 獲得步驟結束權利
/// <summary>
/// 獲得步驟結束權利
/// </summary>
/// <param name="FlowID">流程ID</param>
/// <param name="StepID">步驟ID</param>
public int GetStepRightToFinish(long FlowID,long StepID)
{
int iReturn=-1;
UDS.Components.Database mySQL = new UDS.Components.Database();
SqlParameter[] parameters = {
mySQL.MakeInParam("@FlowID",SqlDbType.Int,4,FlowID),
mySQL.MakeInParam("@StepID",SqlDbType.Int,4,StepID)
};
try
{
iReturn = mySQL.RunProc("sp_Flow_GetStepRightToFinish",parameters);
}
catch(Exception e)
{
Error.Log(e.ToString());
}
finally
{
mySQL.Close();
mySQL = null;
}
return iReturn;
}
#endregion
#region 獲得文檔的是否為新擬稿
/// <summary>
/// 獲得流程的表格樣式描述
/// </summary>
/// <param name="DocID">文檔ID</param>
public int IsNewDocument(long DocID)
{
int iReturn=-1;
UDS.Components.Database mySQL = new UDS.Components.Database();
SqlParameter[] parameters = {
mySQL.MakeInParam("@DocID",SqlDbType.Int ,4,DocID)
};
try
{
iReturn = mySQL.RunProc("sp_Flow_IsNewDocument",parameters);
}
catch(Exception e)
{
Error.Log(e.ToString());
}
finally
{
mySQL.Close();
mySQL = null;
}
return iReturn;
}
#endregion
#region 獲得用戶所有的項目,返回表格
/// <summary>
/// 獲得用戶所有的項目
/// </summary>
/// <param name="UserName">用戶名</param>
/// <param name="dt">返回表格</param>
public int GetProject(string UserName,out DataTable dt )
{
//int iReturn=0;
SqlDataReader dr;
UDS.Components.Database mySQL = new UDS.Components.Database();
SqlParameter[] parameters = {
mySQL.MakeInParam("@UserName",SqlDbType.VarChar ,300,UserName)
};
try
{
mySQL.RunProc("sp_GetTaskClass",parameters,out dr);
dt = UDS.Components.Tools.ConvertDataReaderToDataTable(dr);
}
catch(Exception e)
{
Error.Log(e.ToString());
dt = null;
}
finally
{
mySQL.Close();
mySQL = null;
}
return 0;
}
#endregion
#region 獲得用戶所有的項目,返回表格
/// <summary>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -