|
|
@@ -1,4 +1,5 @@
|
|
|
using System.Collections.Generic;
|
|
|
+using System.Data;
|
|
|
using System.Text;
|
|
|
|
|
|
namespace UAS_AutoPass.ToolClass
|
|
|
@@ -49,6 +50,72 @@ namespace UAS_AutoPass.ToolClass
|
|
|
dh.ExecuteSql(sql.ToString(), "insert");
|
|
|
}
|
|
|
|
|
|
+ public static bool CheckUserLogin(string iUserCode, string iPassWord, out string oErrorMessage)
|
|
|
+ {
|
|
|
+ oErrorMessage = "";
|
|
|
+ string SQL = "select em_code from employee where upper(em_code)=:UserName and em_password =:PassWord";
|
|
|
+ DataTable dt;
|
|
|
+ dt = (DataTable)dh.ExecuteSql(SQL, "select", iUserCode.ToUpper(), iPassWord);
|
|
|
+ if (dt.Rows.Count > 0)
|
|
|
+ return true;
|
|
|
+ else
|
|
|
+ {
|
|
|
+ oErrorMessage = "用户名或者密码不正确!";
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public static bool CheckUserAndResourcePassed(string iUserCode, string iSourceCode, out string oErrorMessage)
|
|
|
+ {
|
|
|
+ oErrorMessage = "";
|
|
|
+ iUserCode = iUserCode.ToUpper();
|
|
|
+ iSourceCode = iSourceCode.ToUpper();
|
|
|
+ string SQL = "select em_code,em_type from employee where upper(em_code)=:UserName ";
|
|
|
+ DataTable dt;
|
|
|
+ dt = (DataTable)dh.ExecuteSql(SQL, "select", iUserCode);
|
|
|
+ if (dt.Rows.Count > 0)
|
|
|
+ {
|
|
|
+ string em_type = dt.Rows[0]["em_type"].ToString();
|
|
|
+ if (iSourceCode == "")
|
|
|
+ {
|
|
|
+ oErrorMessage = "岗位资源不允许为空";
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if (em_type == "admin")
|
|
|
+ {
|
|
|
+ if (dh.CheckExist("Source", "upper(sc_code)='" + iSourceCode + "' and sc_statuscode='AUDITED'"))
|
|
|
+ {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ oErrorMessage = "岗位资源编号错误或者未审核!";
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ dt = dh.getFieldsDatasByCondition("cs$empgroup left join cs$userresource on ur_groupcode=eg_groupcode left join source on ur_resourcecode=sc_code", new string[] { "upper(ur_resourcecode) ur_resourcecode" }, "upper(eg_emcode)= '" + iUserCode + "' and sc_statuscode='AUDITED'");
|
|
|
+ //如果存在该编号
|
|
|
+ if (dt.Rows.Count > 0)
|
|
|
+ {
|
|
|
+ //判断如果多个岗位资源存在,用户输入的只要在其中就行
|
|
|
+ for (int i = 0; i < dt.Rows.Count; i++)
|
|
|
+ {
|
|
|
+ if (dt.Rows[i]["ur_resourcecode"].ToString() == iSourceCode)
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ oErrorMessage = "用户不处于当前资源所属分组!";
|
|
|
+ }
|
|
|
+ else
|
|
|
+ oErrorMessage = "岗位资源编号错误或者未审核!";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ oErrorMessage = "用户不存在!";
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
public static bool SetStepResult(string iMakeCode, string iSourceCode, string iSN, string iMPKind, string iResult, string iUserCode, out string oErrorMessage)
|
|
|
{
|
|
|
return CS_SetResult(iMakeCode, iSourceCode, iSN, iUserCode, iResult, out oErrorMessage);
|