?? documentflow.cs
字號:
mySQL = null;
}
return iReturn;
}
#endregion
#region 得到步驟基本信息
/// <summary>
/// 得到步驟基本信息
/// </summary>
/// <param name="FlowID">流程ID</param>
/// <param name="StepID">步驟ID</param>
/// <param name="dt">返回表格</param>
public int GetStep(long FlowID,long StepID,out DataTable dt)
{
int iReturn=-1;
SqlDataReader dr;
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
{
mySQL.RunProc("sp_Flow_GetStep",parameters,out dr);
iReturn = 0;
dt = Tools.ConvertDataReaderToDataTable(dr);
}
catch(Exception e)
{
Error.Log(e.ToString());
dt = null;
}
finally
{
mySQL.Close();
mySQL = null;
}
return iReturn;
}
#endregion
#region 得到流程的最大步驟
/// <summary>
/// 得到流程的最大步驟
/// </summary>
/// <param name="FlowID">流程ID</param>
/// <returns>最大步驟</returns>
public int GetMaxStep(long FlowID)
{
int iReturn=-1;
UDS.Components.Database mySQL = new UDS.Components.Database();
SqlParameter[] parameters = {
mySQL.MakeInParam("@FlowID",SqlDbType.Int ,4,FlowID)
};
try
{
iReturn = mySQL.RunProc("sp_Flow_GetMaxStep",parameters);
}
catch(Exception e)
{
Error.Log(e.ToString());
}
finally
{
mySQL.Close();
mySQL = null;
}
return iReturn;
}
#endregion
#region 得到步驟名
/// <summary>
/// 得到步驟名
/// </summary>
/// <param name="FlowID">流程ID</param>
public string GetStepTitle(long FlowID,long StepID)
{
string strReturn="";
SqlDataReader dr;
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
{
mySQL.RunProc("sp_Flow_GetStep",parameters,out dr);
if(dr.Read())
{
strReturn = "<a href='#' title='" + dr["Step_Remark"].ToString() + "'>" + dr["Step_Name"].ToString() + "</a>";
}
dr.Close();
}
catch(Exception e)
{
Error.Log(e.ToString());
}
finally
{
mySQL.Close();
mySQL = null;
}
return strReturn;
}
#endregion
//////////////////////////////////////////////
/// 流程跳轉(zhuǎn)管理相關(guān)
//////////////////////////////////////////////
#region 添加跳轉(zhuǎn)
/// <summary>
/// 添加跳轉(zhuǎn)
/// </summary>
/// <param name="FlowID">流程ID</param>
/// <param name="StepID">步驟ID</param>
/// <param name="FieldName">字段名</param>
/// <param name="Compare">比較符號</param>
/// <param name="CompareValue">比較值</param>
/// <returns></returns>
public int AddJump(long FlowID,long StepID,string FieldName,string Compare,double CompareValue,long ToStepID,int FlowRule)
{
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),
mySQL.MakeInParam("@FieldName",SqlDbType.VarChar ,50,FieldName),
mySQL.MakeInParam("@Compare",SqlDbType.VarChar,50,Compare),
mySQL.MakeInParam("@CompareValue",SqlDbType.Float ,8,CompareValue),
mySQL.MakeInParam("@ToStepID",SqlDbType.Float ,8,ToStepID),
mySQL.MakeInParam("@FlowRule",SqlDbType.Int ,4,FlowRule)
};
try
{
iReturn = mySQL.RunProc("sp_Flow_AddJump",parameters);
}
catch (Exception ex)
{
UDS.Components.Error.Log(ex.ToString());
}
finally
{
mySQL.Close();
mySQL = null;
}
return iReturn;
}
#endregion
#region 刪除跳轉(zhuǎn)
/// <summary>
/// 刪除步驟
/// </summary>
/// <param name="FlowID">被刪除的跳轉(zhuǎn)的流程ID</param>
/// <param name="StepID">被刪除的跳轉(zhuǎn)的步驟ID</param>
/// <param name="Priority">被刪除的跳轉(zhuǎn)的優(yōu)先等級</param>
public int DeleteJump(long FlowID,long StepID,long Priority)
{
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),
mySQL.MakeInParam("@Priority",SqlDbType.Int ,4,Priority)
};
try
{
iReturn = mySQL.RunProc("sp_Flow_DeleteJump",parameters);
}
catch(Exception e)
{
Error.Log(e.ToString());
}
finally
{
mySQL.Close();
mySQL = null;
}
return iReturn;
}
#endregion
#region 修改跳轉(zhuǎn)
/// <summary>
/// 修改跳轉(zhuǎn)
/// </summary>
/// <param name="FlowID">流程ID</param>
/// <param name="StepID">步驟ID</param>
/// <param name="Priority">優(yōu)先級</param>
/// <param name="FieldName">字段名</param>
/// <param name="Compare">比較符號</param>
/// <param name="CompareValue">比較值</param>
/// <returns></returns>
public int UpdateJump(long FlowID,long StepID,long Priority,string FieldName,string Compare,double CompareValue,long ToStepID)
{
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),
mySQL.MakeInParam("@Priority",SqlDbType.Int ,4,Priority),
mySQL.MakeInParam("@FieldName",SqlDbType.VarChar ,50,FieldName),
mySQL.MakeInParam("@Compare",SqlDbType.VarChar,50,Compare),
mySQL.MakeInParam("@CompareValue",SqlDbType.Float ,8,CompareValue),
mySQL.MakeInParam("@ToStepID",SqlDbType.Float ,8,ToStepID)
};
try
{
iReturn = mySQL.RunProc("sp_Flow_UpdateJump",parameters);
}
catch (Exception ex)
{
UDS.Components.Error.Log(ex.ToString());
}
finally
{
mySQL.Close();
mySQL = null;
}
return iReturn;
}
#endregion
#region 上移跳轉(zhuǎn)
/// <summary>
/// 上移跳轉(zhuǎn)
/// </summary>
/// <param name="FlowID">流程ID</param>
/// <param name="StepID">步驟ID</param>
/// <param name="Priority">優(yōu)先級</param>
public int MoveUpJump(long FlowID,long StepID,long Priority)
{
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),
mySQL.MakeInParam("@Priority",SqlDbType.Int ,4,Priority)
};
try
{
iReturn = mySQL.RunProc("sp_Flow_MoveUpJump",parameters);
}
catch (Exception ex)
{
UDS.Components.Error.Log(ex.ToString());
}
finally
{
mySQL.Close();
mySQL = null;
}
return iReturn;
}
#endregion
#region 得到跳轉(zhuǎn)基本信息
/// <summary>
/// 得到步驟基本信息
/// </summary>
/// <param name="FlowID">流程ID</param>
/// <param name="StepID">步驟ID</param>
/// <param name="Priority">優(yōu)先級</param>
/// <param name="dt">返回表格</param>
public int GetJump(long FlowID,long StepID,long Priority,out DataTable dt)
{
int iReturn=-1;
SqlDataReader dr;
UDS.Components.Database mySQL = new UDS.Components.Database();
SqlParameter[] parameters = {
mySQL.MakeInParam("@FlowID",SqlDbType.Int ,4,FlowID),
mySQL.MakeInParam("@StepID",SqlDbType.Int ,4,StepID),
mySQL.MakeInParam("@Priority",SqlDbType.Int ,4,Priority)
};
try
{
mySQL.RunProc("sp_Flow_GetJump",parameters,out dr);
iReturn = 0;
dt = Tools.ConvertDataReaderToDataTable(dr);
}
catch(Exception e)
{
Error.Log(e.ToString());
dt = null;
}
finally
{
mySQL.Close();
mySQL = null;
}
return iReturn;
}
#endregion
//////////////////////////////////////////////
/// 其他雜項(xiàng)
//////////////////////////////////////////////
#region 處理消息
/// <summary>
/// 獲得流程的表格樣式描述
/// </summary>
/// <param name="ErrorNum">錯(cuò)誤消息</param>
/// <param name="DocID">文檔ID</param>
public string DoMessage(int ErrorNum,long DocID,bool DefaultOperation)
{
string ErrorMessage="";
switch(ErrorNum)
{
case 0:
ErrorMessage="成功";
break;
case -1:
ErrorMessage="流程結(jié)束!";
break;
case -2:
if(DefaultOperation==true)
{
if(this.IsNewDocument(DocID)>0)
this.DeleteDocument(DocID);
else
this.CancelPostil(DocID);
}
ErrorMessage="沒有職位上級";
break;
case -3:
if(DefaultOperation==true)
{
if(this.IsNewDocument(DocID)>0)
this.DeleteDocument(DocID);
else
this.CancelPostil(DocID);
}
ErrorMessage="沒有項(xiàng)目上級";
break;
case -4:
ErrorMessage="需要全體通過";
break;
case -5:
ErrorMessage="通過人數(shù)不夠";
break;
case -6:
if(DefaultOperation==true)
{
if(this.IsNewDocument(DocID)>0)
this.DeleteDocument(DocID);
else
this.CancelPostil(DocID);
}
ErrorMessage="該流程無你所在的環(huán)節(jié)";
break;
case -7:
ErrorMessage="下一步驟沒有成員";
break;
default:
break;
}
return ErrorMessage;
}
#endregion
#region 獲得文檔的存在狀態(tài)
/// <summary>
/// 獲得文檔的存在狀態(tài)
/// </summary>
/// <param name="DocID">被檢查的文檔ID</param>
public int GetDocumentStatus(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_GetDocumentStatus",parameters);
}
catch(Exception e)
{
Error.Log(e.ToString());
}
finally
{
mySQL.Close();
mySQL = null;
}
return iReturn;
}
#endregion
#region 獲得文檔的操作狀態(tài)
/// <summary>
/// 獲得文檔的操作狀態(tài)
/// </summary>
/// <param name="DocID">被檢查的文檔ID</param>
public int GetDocumentStatus(long DocID,string UserName)
{
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_GetDocumentStatusByStaff",parameters);
}
catch(Exception e)
{
Error.Log(e.ToString());
}
finally
{
mySQL.Close();
mySQL = null;
}
return iReturn;
}
#endregion
#region 權(quán)限判斷
/// <summary>
/// 權(quán)限判斷
/// </summary>
/// <param name="classID">對象接點(diǎn)ID</param>
/// <param name="UserName">用戶名</param>
/// <param name="actID">權(quán)利代號</param>
/// <returns>是否有權(quán)利 1有 0無</returns>
public bool GetAccessPermission(int classID,string UserName,int actID)
{
int flag = 0;
// 定義數(shù)據(jù)庫操作類及DataReader
Database data = new Database();
// 執(zhí)行存儲過程,并返回SqlDataReader對象
SqlParameter[] prams = {
data.MakeInParam("@Class_ID" , SqlDbType.Int, 20, classID),
data.MakeInParam("@UserName" , SqlDbType.NVarChar, 20, UserName),
data.MakeInParam("@Act_ID" , SqlDbType.Int, 20, actID),
// data.MakeInParam("@Inheit" , SqlDbType.Bit, 1, 1),
data.MakeOutParam("@ReturnValue",SqlDbType.Int,20)
};
try
{
data.RunProc("sp_GetAccessPermission",prams);
flag = Int32.Parse(prams[3].Value.ToString());
return (flag==1)?true:false;
}
catch(Exception ex)
{
Error.Log(ex.ToString());
throw new Exception("獲取訪問權(quán)出錯(cuò)",ex);
}
finally
{
data = null;
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -