|
|
|
|
using System;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using DSWeb.Models;
|
|
|
|
|
using DSWeb.EntityDA;
|
|
|
|
|
|
|
|
|
|
namespace DSWeb.Authority
|
|
|
|
|
{
|
|
|
|
|
public class UserAuthorityManage
|
|
|
|
|
{
|
|
|
|
|
private UserAuthorityEntity _userAuthorityEntity;
|
|
|
|
|
private UserAuthorityRangeEntity _userAuthorityRangeEntity;
|
|
|
|
|
private UserAuthorityDA _userAuthorityDA;
|
|
|
|
|
private AuthorityType _visibleType = AuthorityType.NULL;
|
|
|
|
|
private AuthorityType _operateType = AuthorityType.NULL;
|
|
|
|
|
|
|
|
|
|
public UserAuthorityManage()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public UserAuthorityManage(string tempUserID,string tempAuthorityModuleName)
|
|
|
|
|
{
|
|
|
|
|
if (_userAuthorityDA == null)
|
|
|
|
|
{
|
|
|
|
|
_userAuthorityDA = new UserAuthorityDA();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_userAuthorityRangeEntity = _userAuthorityDA.GetUserAuthorityRange(tempUserID, tempAuthorityModuleName);
|
|
|
|
|
|
|
|
|
|
if (_userAuthorityRangeEntity != null)
|
|
|
|
|
{
|
|
|
|
|
if (_userAuthorityRangeEntity.GID != null)
|
|
|
|
|
{
|
|
|
|
|
_visibleType = GetAuthorityType(_userAuthorityRangeEntity.VisableRange);
|
|
|
|
|
_operateType = GetAuthorityType(_userAuthorityRangeEntity.OperateRange);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string GetVisibleRangeSql(AuthorityType tempType,ModuleType tempModuleType,string tempShowName,string tempCompanyID,string tempDeptName,string tempUserID)
|
|
|
|
|
{
|
|
|
|
|
string strResult = "";
|
|
|
|
|
switch (tempType)
|
|
|
|
|
{
|
|
|
|
|
case AuthorityType.NONE:
|
|
|
|
|
strResult = " AND 1 < 0 ";
|
|
|
|
|
break;
|
|
|
|
|
case AuthorityType.BYPERSONAL:
|
|
|
|
|
if (tempModuleType == ModuleType.OPSEAEFEE || tempModuleType == ModuleType.FEEAUDIT || tempModuleType == ModuleType.INVOICEAPPSEARCH || tempModuleType == ModuleType.INVOICEIMPORT)
|
|
|
|
|
{
|
|
|
|
|
strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM op_seae WHERE INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}') ", tempShowName);
|
|
|
|
|
}
|
|
|
|
|
else if (tempModuleType == ModuleType.INVOICEMAKEOUT)
|
|
|
|
|
{
|
|
|
|
|
strResult = string.Format(" AND A.APPLICANT = '{0}' ", tempUserID);
|
|
|
|
|
}
|
|
|
|
|
else if (tempModuleType == ModuleType.INVOICEAPPLIST)
|
|
|
|
|
{
|
|
|
|
|
strResult = string.Format(" AND A.APPLICANT = '{0}'", tempUserID);
|
|
|
|
|
}
|
|
|
|
|
else if (tempModuleType == ModuleType.PAYSETTLELIST)
|
|
|
|
|
{
|
|
|
|
|
strResult = string.Format(" AND A.SETTLEUSER = '{0}' ", tempUserID);
|
|
|
|
|
}
|
|
|
|
|
else if (tempModuleType == ModuleType.PAYSETTLESEARCH || tempModuleType == ModuleType.PAYSETTLESEARCH || tempModuleType == ModuleType.RECVSETTLESEARCH)
|
|
|
|
|
{
|
|
|
|
|
strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM op_seae WHERE INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}') ", tempShowName);
|
|
|
|
|
}
|
|
|
|
|
else if (tempModuleType == ModuleType.PAYSETTLEAPPLIST)
|
|
|
|
|
{
|
|
|
|
|
strResult = string.Format(" AND (A.SETTLEUSER = '{0}' OR A.APPLICANT = '{0}') ", tempUserID);
|
|
|
|
|
}
|
|
|
|
|
else if (tempModuleType == ModuleType.RECVSETTLELIST)
|
|
|
|
|
{
|
|
|
|
|
strResult = string.Format(" AND A.SETTLEUSER = '{0}' ", tempUserID);
|
|
|
|
|
}
|
|
|
|
|
if (tempModuleType == ModuleType.SEAEORDERLIST)
|
|
|
|
|
{
|
|
|
|
|
strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM crm_seaeorder WHERE INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}') ", tempShowName);
|
|
|
|
|
}
|
|
|
|
|
if (tempModuleType == ModuleType.OPSEAELIST)
|
|
|
|
|
{
|
|
|
|
|
strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM op_seae WHERE INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}') ", tempShowName);
|
|
|
|
|
}
|
|
|
|
|
if (tempModuleType == ModuleType.RECVFEE)
|
|
|
|
|
{
|
|
|
|
|
strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM op_seae WHERE INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}') AND FEETYPE = 1 ", tempShowName);
|
|
|
|
|
}
|
|
|
|
|
if (tempModuleType == ModuleType.PAYFEE)
|
|
|
|
|
{
|
|
|
|
|
strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM op_seae WHERE INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}') AND FEETYPE = 2 ", tempShowName);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case AuthorityType.BYDEPARTMENT:
|
|
|
|
|
|
|
|
|
|
if (tempModuleType == ModuleType.OPSEAEFEE || tempModuleType == ModuleType.FEEAUDIT || tempModuleType == ModuleType.INVOICEAPPSEARCH || tempModuleType == ModuleType.INVOICEIMPORT)
|
|
|
|
|
{
|
|
|
|
|
strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM op_seae WHERE INPUTBY IN (SELECT SHOWNAME FROM [user] WHERE GID IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' AND USERID IN"
|
|
|
|
|
+ " (SELECT USERID FROM user_baseinfo WHERE DEPTNAME = '{2}')) OR (INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}'))) ",tempShowName,tempCompanyID,tempDeptName);
|
|
|
|
|
}
|
|
|
|
|
else if (tempModuleType == ModuleType.INVOICEMAKEOUT)
|
|
|
|
|
{
|
|
|
|
|
strResult = string.Format(" AND A.APPLICANT IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' AND USERID IN (SELECT USERID FROM user_baseinfo WHERE DEPTNAME = '{2}')) "
|
|
|
|
|
+ " OR A.APPLICANT = '{0}' ", tempUserID, tempCompanyID, tempDeptName);
|
|
|
|
|
}
|
|
|
|
|
else if (tempModuleType == ModuleType.INVOICEAPPLIST)
|
|
|
|
|
{
|
|
|
|
|
strResult = string.Format(" AND A.APPLICANT IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' AND USERID IN (SELECT USERID FROM user_baseinfo WHERE DEPTNAME = '{2}')) "
|
|
|
|
|
+ " OR A.APPLICANT = '{0}' ", tempUserID, tempCompanyID, tempDeptName);
|
|
|
|
|
}
|
|
|
|
|
else if (tempModuleType == ModuleType.PAYSETTLELIST)
|
|
|
|
|
{
|
|
|
|
|
strResult = string.Format(" AND (A.SETTLEUSER IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' AND USERID IN (SELECT USERID FROM user_baseinfo WHERE DEPTNAME = '{2}')) "
|
|
|
|
|
+ " OR A.SETTLEUSER = '{0}') ", tempUserID, tempCompanyID, tempDeptName);
|
|
|
|
|
}
|
|
|
|
|
else if (tempModuleType == ModuleType.PAYSETTLESEARCH || tempModuleType == ModuleType.PAYSETTLEAPPSEARCH || tempModuleType == ModuleType.RECVSETTLESEARCH)
|
|
|
|
|
{
|
|
|
|
|
strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM op_seae WHERE INPUTBY IN (SELECT SHOWNAME FROM [user] WHERE GID IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' AND USERID IN"
|
|
|
|
|
+ " (SELECT USERID FROM user_baseinfo WHERE DEPTNAME = '{2}')) OR (INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}'))) ", tempShowName, tempCompanyID, tempDeptName);
|
|
|
|
|
}
|
|
|
|
|
else if(tempModuleType == ModuleType.PAYSETTLEAPPLIST)
|
|
|
|
|
{
|
|
|
|
|
strResult = string.Format(" AND (A.APPLICANT IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' AND USERID IN (SELECT USERID FROM user_baseinfo WHERE DEPTNAME = '{2}')) "
|
|
|
|
|
+ " OR A.APPLICANT = '{0}') ", tempUserID, tempCompanyID, tempDeptName);
|
|
|
|
|
}
|
|
|
|
|
else if (tempModuleType == ModuleType.RECVSETTLELIST)
|
|
|
|
|
{
|
|
|
|
|
strResult = string.Format(" AND (A.SETTLEUSER IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' AND USERID IN (SELECT USERID FROM user_baseinfo WHERE DEPTNAME = '{2}')) "
|
|
|
|
|
+ " OR A.SETTLEUSER = '{0}') ", tempUserID, tempCompanyID, tempDeptName);
|
|
|
|
|
}
|
|
|
|
|
if (tempModuleType == ModuleType.SEAEORDERLIST)
|
|
|
|
|
{
|
|
|
|
|
strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM crm_seaeorder WHERE INPUTBY IN (SELECT SHOWNAME FROM [user] WHERE GID IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' AND USERID IN"
|
|
|
|
|
+ " (SELECT USERID FROM user_baseinfo WHERE DEPTNAME = '{2}')) OR (INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}'))) ", tempShowName, tempCompanyID, tempDeptName);
|
|
|
|
|
}
|
|
|
|
|
if (tempModuleType == ModuleType.OPSEAELIST)
|
|
|
|
|
{
|
|
|
|
|
strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM op_seae WHERE INPUTBY IN (SELECT SHOWNAME FROM [user] WHERE GID IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' AND USERID IN"
|
|
|
|
|
+ " (SELECT USERID FROM user_baseinfo WHERE DEPTNAME = '{2}')) OR (INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}'))) ", tempShowName, tempCompanyID, tempDeptName);
|
|
|
|
|
}
|
|
|
|
|
if (tempModuleType == ModuleType.RECVFEE)
|
|
|
|
|
{
|
|
|
|
|
strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM op_seae WHERE INPUTBY IN (SELECT SHOWNAME FROM [user] WHERE GID IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' AND USERID IN"
|
|
|
|
|
+ " (SELECT USERID FROM user_baseinfo WHERE DEPTNAME = '{2}')) OR (INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}'))) AND FEETYPE = 1 ", tempShowName, tempCompanyID, tempDeptName);
|
|
|
|
|
}
|
|
|
|
|
if (tempModuleType == ModuleType.PAYFEE)
|
|
|
|
|
{
|
|
|
|
|
strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM op_seae WHERE INPUTBY IN (SELECT SHOWNAME FROM [user] WHERE GID IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' AND USERID IN"
|
|
|
|
|
+ " (SELECT USERID FROM user_baseinfo WHERE DEPTNAME = '{2}')) OR (INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}'))) AND FEETYPE = 2 ", tempShowName, tempCompanyID, tempDeptName);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case AuthorityType.BYSUBCOMPANY:
|
|
|
|
|
if (tempModuleType == ModuleType.OPSEAEFEE || tempModuleType == ModuleType.FEEAUDIT || tempModuleType == ModuleType.INVOICEAPPSEARCH || tempModuleType == ModuleType.INVOICEIMPORT)
|
|
|
|
|
{
|
|
|
|
|
strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM op_seae WHERE INPUTBY IN (SELECT SHOWNAME FROM [user] WHERE GID IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' "
|
|
|
|
|
+ ") OR (INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}'))) ",tempShowName,tempCompanyID);
|
|
|
|
|
}
|
|
|
|
|
else if (tempModuleType == ModuleType.INVOICEMAKEOUT)
|
|
|
|
|
{
|
|
|
|
|
strResult = string.Format(" AND A.APPLICANT IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}') "
|
|
|
|
|
+ " OR A.APPLICANT = '{0}' ", tempUserID, tempCompanyID);
|
|
|
|
|
}
|
|
|
|
|
else if (tempModuleType == ModuleType.INVOICEAPPLIST)
|
|
|
|
|
{
|
|
|
|
|
strResult = string.Format(" AND A.APPLICANT IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}') "
|
|
|
|
|
+ " OR A.APPLICANT = '{0}' ", tempUserID, tempCompanyID);
|
|
|
|
|
}
|
|
|
|
|
else if (tempModuleType == ModuleType.PAYSETTLELIST)
|
|
|
|
|
{
|
|
|
|
|
strResult = string.Format(" AND (A.SETTLEUSER IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}') "
|
|
|
|
|
+ " OR A.SETTLEUSER = '{0}') ", tempUserID, tempCompanyID);
|
|
|
|
|
}
|
|
|
|
|
else if (tempModuleType == ModuleType.PAYSETTLESEARCH || tempModuleType == ModuleType.PAYSETTLEAPPSEARCH || tempModuleType == ModuleType.RECVSETTLESEARCH)
|
|
|
|
|
{
|
|
|
|
|
strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM op_seae WHERE INPUTBY IN (SELECT SHOWNAME FROM [user] WHERE GID IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' "
|
|
|
|
|
+ ") OR (INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}'))) ", tempShowName, tempCompanyID);
|
|
|
|
|
}
|
|
|
|
|
else if(tempModuleType == ModuleType.PAYSETTLEAPPLIST)
|
|
|
|
|
{
|
|
|
|
|
strResult = string.Format(" AND (A.APPLICANT IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}') "
|
|
|
|
|
+ " OR A.APPLICANT = '{0}') ", tempUserID, tempCompanyID);
|
|
|
|
|
}
|
|
|
|
|
else if(tempModuleType == ModuleType.RECVSETTLELIST)
|
|
|
|
|
{
|
|
|
|
|
strResult = string.Format(" AND (A.SETTLEUSER IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}') "
|
|
|
|
|
+ " OR A.SETTLEUSER = '{0}') ", tempUserID, tempCompanyID);
|
|
|
|
|
}
|
|
|
|
|
if (tempModuleType == ModuleType.SEAEORDERLIST)
|
|
|
|
|
{
|
|
|
|
|
strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM crm_seaeorder WHERE INPUTBY IN (SELECT SHOWNAME FROM [user] WHERE GID IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' "
|
|
|
|
|
+ ") OR (INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}'))) ", tempShowName, tempCompanyID);
|
|
|
|
|
}
|
|
|
|
|
if (tempModuleType == ModuleType.OPSEAELIST)
|
|
|
|
|
{
|
|
|
|
|
strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM op_seae WHERE INPUTBY IN (SELECT SHOWNAME FROM [user] WHERE GID IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' "
|
|
|
|
|
+ ") OR (INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}'))) ", tempShowName, tempCompanyID);
|
|
|
|
|
}
|
|
|
|
|
if (tempModuleType == ModuleType.RECVFEE)
|
|
|
|
|
{
|
|
|
|
|
strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM op_seae WHERE INPUTBY IN (SELECT SHOWNAME FROM [user] WHERE GID IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' "
|
|
|
|
|
+ ") OR (INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}'))) AND FEETYPE = 1 ", tempShowName, tempCompanyID);
|
|
|
|
|
}
|
|
|
|
|
if (tempModuleType == ModuleType.PAYFEE)
|
|
|
|
|
{
|
|
|
|
|
strResult = string.Format(" AND BSNO IN (SELECT BSNO FROM op_seae WHERE INPUTBY IN (SELECT SHOWNAME FROM [user] WHERE GID IN (SELECT USERID FROM user_company WHERE COMPANYID='{1}' "
|
|
|
|
|
+ ") OR (INPUTBY = '{0}' OR SALE = '{0}' OR OP = '{0}' OR DOC = '{0}' OR CUSTSERVICE = '{0}'))) AND FEETYPE = 2 ", tempShowName, tempCompanyID);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case AuthorityType.ALL:
|
|
|
|
|
if (tempModuleType == ModuleType.OPSEAEFEE || tempModuleType == ModuleType.FEEAUDIT || tempModuleType == ModuleType.INVOICEAPPSEARCH || tempModuleType == ModuleType.INVOICEIMPORT)
|
|
|
|
|
{
|
|
|
|
|
strResult = "";
|
|
|
|
|
}
|
|
|
|
|
else if (tempModuleType == ModuleType.INVOICEMAKEOUT)
|
|
|
|
|
{
|
|
|
|
|
strResult = "";
|
|
|
|
|
}
|
|
|
|
|
else if (tempModuleType == ModuleType.INVOICEAPPLIST)
|
|
|
|
|
{
|
|
|
|
|
strResult = "";
|
|
|
|
|
}
|
|
|
|
|
else if (tempModuleType == ModuleType.PAYSETTLELIST)
|
|
|
|
|
{
|
|
|
|
|
strResult = "";
|
|
|
|
|
}
|
|
|
|
|
else if (tempModuleType == ModuleType.PAYSETTLESEARCH)
|
|
|
|
|
{
|
|
|
|
|
strResult = "";
|
|
|
|
|
}
|
|
|
|
|
else if (tempModuleType == ModuleType.PAYSETTLEAPPSEARCH)
|
|
|
|
|
{
|
|
|
|
|
strResult = "";
|
|
|
|
|
}
|
|
|
|
|
else if (tempModuleType == ModuleType.PAYSETTLEAPPLIST)
|
|
|
|
|
{
|
|
|
|
|
strResult = "";
|
|
|
|
|
}
|
|
|
|
|
else if (tempModuleType == ModuleType.RECVSETTLESEARCH)
|
|
|
|
|
{
|
|
|
|
|
strResult = "";
|
|
|
|
|
}
|
|
|
|
|
else if (tempModuleType == ModuleType.RECVSETTLELIST)
|
|
|
|
|
{
|
|
|
|
|
strResult = "";
|
|
|
|
|
}
|
|
|
|
|
else if (tempModuleType == ModuleType.SEAEORDERLIST)
|
|
|
|
|
{
|
|
|
|
|
strResult = "";
|
|
|
|
|
}
|
|
|
|
|
else if (tempModuleType == ModuleType.OPSEAELIST)
|
|
|
|
|
{
|
|
|
|
|
strResult = "";
|
|
|
|
|
}
|
|
|
|
|
else if (tempModuleType == ModuleType.RECVFEE)
|
|
|
|
|
{
|
|
|
|
|
strResult = "";
|
|
|
|
|
}
|
|
|
|
|
else if (tempModuleType == ModuleType.PAYFEE)
|
|
|
|
|
{
|
|
|
|
|
strResult = "";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return strResult;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public int CheckOperateRange(ModuleType tempModuleType,AuthorityType tempAuthorityType,string tempShowName,string tempCompanyID,string tempDeptName,string tempBSNO,string tempBillNO,string tempUserID)
|
|
|
|
|
{
|
|
|
|
|
int iResult = 0;
|
|
|
|
|
string strSql = "";
|
|
|
|
|
|
|
|
|
|
if (tempModuleType == ModuleType.OPSEAEFEE)
|
|
|
|
|
{
|
|
|
|
|
iResult = _userAuthorityDA.GetSqlCount(String.Format(" SELECT COUNT(*) FROM op_seae WHERE BSNO = '{0}' {1}", tempBSNO, GetVisibleRangeSql(tempAuthorityType, tempModuleType, tempShowName, tempCompanyID, tempDeptName,"")));
|
|
|
|
|
}
|
|
|
|
|
else if (tempModuleType == ModuleType.FEEAUDIT)
|
|
|
|
|
{
|
|
|
|
|
iResult = _userAuthorityDA.GetSqlCount(String.Format(" SELECT COUNT(*) FROM op_seae WHERE BSNO = '{0}' {1}", tempBSNO, GetVisibleRangeSql(tempAuthorityType, tempModuleType, tempShowName, tempCompanyID, tempDeptName,"")));
|
|
|
|
|
}
|
|
|
|
|
else if (tempModuleType == ModuleType.INVOICEMAKEOUT)
|
|
|
|
|
{
|
|
|
|
|
iResult = _userAuthorityDA.GetSqlCount(String.Format(" SELECT COUNT(*) FROM ch_fee_invoice as A WHERE A.BILLNO = '{0}' {1}", tempBillNO, GetVisibleRangeSql(tempAuthorityType, tempModuleType, tempShowName, tempCompanyID, tempDeptName, tempUserID)));
|
|
|
|
|
}
|
|
|
|
|
else if (tempModuleType == ModuleType.INVOICEAPPLIST)
|
|
|
|
|
{
|
|
|
|
|
iResult = _userAuthorityDA.GetSqlCount(String.Format(" SELECT COUNT(*) FROM ch_fee_invoiceapplication as A WHERE A.BILLNO = '{0}' {1}", tempBillNO, GetVisibleRangeSql(tempAuthorityType, tempModuleType, tempShowName, tempCompanyID, tempDeptName, tempUserID)));
|
|
|
|
|
}
|
|
|
|
|
else if (tempModuleType == ModuleType.INVOICEAPPSEARCH)
|
|
|
|
|
{
|
|
|
|
|
iResult = _userAuthorityDA.GetSqlCount(String.Format(" SELECT COUNT(*) FROM op_seae WHERE BSNO = '{0}' {1}", tempBSNO, GetVisibleRangeSql(tempAuthorityType, tempModuleType, tempShowName, tempCompanyID, tempDeptName, "")));
|
|
|
|
|
}
|
|
|
|
|
else if (tempModuleType == ModuleType.INVOICEIMPORT)
|
|
|
|
|
{
|
|
|
|
|
iResult = _userAuthorityDA.GetSqlCount(String.Format(" SELECT COUNT(*) FROM op_seae WHERE BSNO = '{0}' {1}", tempBSNO, GetVisibleRangeSql(tempAuthorityType, tempModuleType, tempShowName, tempCompanyID, tempDeptName, "")));
|
|
|
|
|
}
|
|
|
|
|
else if (tempModuleType == ModuleType.PAYSETTLELIST)
|
|
|
|
|
{
|
|
|
|
|
iResult = _userAuthorityDA.GetSqlCount(String.Format(" SELECT COUNT(*) FROM ch_fee_settlement as A WHERE A.BILLNO = '{0}' {1}", tempBillNO, GetVisibleRangeSql(tempAuthorityType, tempModuleType, tempShowName, tempCompanyID, tempDeptName, tempUserID)));
|
|
|
|
|
}
|
|
|
|
|
if (tempModuleType == ModuleType.PAYSETTLESEARCH)
|
|
|
|
|
{
|
|
|
|
|
iResult = _userAuthorityDA.GetSqlCount(String.Format(" SELECT COUNT(*) FROM op_seae WHERE BSNO = '{0}' {1}", tempBSNO, GetVisibleRangeSql(tempAuthorityType, tempModuleType, tempShowName, tempCompanyID, tempDeptName, "")));
|
|
|
|
|
}
|
|
|
|
|
if (tempModuleType == ModuleType.PAYSETTLEAPPSEARCH)
|
|
|
|
|
{
|
|
|
|
|
iResult = _userAuthorityDA.GetSqlCount(String.Format(" SELECT COUNT(*) FROM op_seae WHERE BSNO = '{0}' {1}", tempBSNO, GetVisibleRangeSql(tempAuthorityType, tempModuleType, tempShowName, tempCompanyID, tempDeptName, "")));
|
|
|
|
|
}
|
|
|
|
|
if (tempModuleType == ModuleType.PAYSETTLEAPPLIST)
|
|
|
|
|
{
|
|
|
|
|
iResult = _userAuthorityDA.GetSqlCount(String.Format(" SELECT COUNT(*) FROM ch_fee_payapplication as A WHERE A.BILLNO = '{0}' {1}", tempBillNO, GetVisibleRangeSql(tempAuthorityType, tempModuleType, tempShowName, tempCompanyID, tempDeptName, tempUserID)));
|
|
|
|
|
}
|
|
|
|
|
if (tempModuleType == ModuleType.RECVSETTLESEARCH)
|
|
|
|
|
{
|
|
|
|
|
iResult = _userAuthorityDA.GetSqlCount(String.Format(" SELECT COUNT(*) FROM op_seae WHERE BSNO = '{0}' {1}", tempBSNO, GetVisibleRangeSql(tempAuthorityType, tempModuleType, tempShowName, tempCompanyID, tempDeptName, "")));
|
|
|
|
|
}
|
|
|
|
|
if (tempModuleType == ModuleType.RECVSETTLELIST)
|
|
|
|
|
{
|
|
|
|
|
iResult = _userAuthorityDA.GetSqlCount(String.Format(" SELECT COUNT(*) FROM ch_fee_settlement as A WHERE A.BILLNO = '{0}' {1}", tempBillNO, GetVisibleRangeSql(tempAuthorityType, tempModuleType, tempShowName, tempCompanyID, tempDeptName, tempUserID)));
|
|
|
|
|
}
|
|
|
|
|
if (tempModuleType == ModuleType.SEAEORDERLIST)
|
|
|
|
|
{
|
|
|
|
|
iResult = _userAuthorityDA.GetSqlCount(String.Format(" SELECT COUNT(*) FROM crm_seaeorder WHERE BSNO = '{0}' {1}", tempBSNO, GetVisibleRangeSql(tempAuthorityType, tempModuleType, tempShowName, tempCompanyID, tempDeptName, "")));
|
|
|
|
|
}
|
|
|
|
|
if (tempModuleType == ModuleType.OPSEAELIST)
|
|
|
|
|
{
|
|
|
|
|
iResult = _userAuthorityDA.GetSqlCount(String.Format(" SELECT COUNT(*) FROM op_seae WHERE BSNO = '{0}' {1}", tempBSNO, GetVisibleRangeSql(tempAuthorityType, tempModuleType, tempShowName, tempCompanyID, tempDeptName, "")));
|
|
|
|
|
}
|
|
|
|
|
if (tempModuleType == ModuleType.RECVFEE)
|
|
|
|
|
{
|
|
|
|
|
if (tempAuthorityType == AuthorityType.NONE || tempAuthorityType == AuthorityType.NULL)
|
|
|
|
|
{
|
|
|
|
|
iResult = _userAuthorityDA.GetSqlCount(String.Format(" SELECT COUNT(*) FROM ch_fee WHERE BSNO = '{0}' {1} AND 1 < 0 ", tempBSNO, GetVisibleRangeSql(tempAuthorityType, tempModuleType, tempShowName, tempCompanyID, tempDeptName, "")));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
iResult = _userAuthorityDA.GetSqlCount(String.Format(" SELECT CASE WHEN COUNT(*) = 0 THEN 1 ELSE COUNT(*) END FROM ch_fee WHERE BSNO = '{0}' {1}", tempBSNO, GetVisibleRangeSql(tempAuthorityType, tempModuleType, tempShowName, tempCompanyID, tempDeptName, "")));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (tempModuleType == ModuleType.PAYFEE)
|
|
|
|
|
{
|
|
|
|
|
if (tempAuthorityType == AuthorityType.NONE || tempAuthorityType == AuthorityType.NULL)
|
|
|
|
|
{
|
|
|
|
|
iResult = _userAuthorityDA.GetSqlCount(String.Format(" SELECT COUNT(*) FROM ch_fee WHERE BSNO = '{0}' {1} AND 1 < 0 ", tempBSNO, GetVisibleRangeSql(tempAuthorityType, tempModuleType, tempShowName, tempCompanyID, tempDeptName, "")));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
iResult = _userAuthorityDA.GetSqlCount(String.Format(" SELECT CASE WHEN COUNT(*) = 0 THEN 1 ELSE COUNT(*) END FROM ch_fee WHERE BSNO = '{0}' {1}", tempBSNO, GetVisibleRangeSql(tempAuthorityType, tempModuleType, tempShowName, tempCompanyID, tempDeptName, "")));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return iResult;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private AuthorityType GetAuthorityType(int iUserAuthorityType)
|
|
|
|
|
{
|
|
|
|
|
AuthorityType resultType = AuthorityType.NONE;
|
|
|
|
|
switch (iUserAuthorityType)
|
|
|
|
|
{
|
|
|
|
|
case 0:
|
|
|
|
|
resultType = AuthorityType.ALL;
|
|
|
|
|
break;
|
|
|
|
|
case 1:
|
|
|
|
|
resultType = AuthorityType.BYSUBCOMPANY;
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
resultType = AuthorityType.BYDEPARTMENT;
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
|
|
|
|
resultType = AuthorityType.BYPERSONAL;
|
|
|
|
|
break;
|
|
|
|
|
case 4:
|
|
|
|
|
resultType = AuthorityType.NONE;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return resultType;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public AuthorityType VisibleType
|
|
|
|
|
{
|
|
|
|
|
get{ return _visibleType;}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public AuthorityType OperateType
|
|
|
|
|
{
|
|
|
|
|
get{ return _operateType;}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public enum AuthorityType
|
|
|
|
|
{
|
|
|
|
|
ALL = 0,
|
|
|
|
|
BYSUBCOMPANY = 1,
|
|
|
|
|
BYDEPARTMENT = 2,
|
|
|
|
|
BYPERSONAL = 3,
|
|
|
|
|
NONE = 4,
|
|
|
|
|
NULL = 5
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public enum ModuleType
|
|
|
|
|
{
|
|
|
|
|
OPSEAEFEE = 0,
|
|
|
|
|
FEEAUDIT = 1,
|
|
|
|
|
INVOICEMAKEOUT = 2,
|
|
|
|
|
INVOICEAPPLIST = 3,
|
|
|
|
|
INVOICEAPPSEARCH = 4,
|
|
|
|
|
INVOICEIMPORT = 5,
|
|
|
|
|
PAYSETTLELIST = 6,
|
|
|
|
|
PAYSETTLESEARCH = 7,
|
|
|
|
|
PAYSETTLEAPPSEARCH = 8,
|
|
|
|
|
PAYSETTLEAPPLIST = 9,
|
|
|
|
|
RECVSETTLESEARCH = 10,
|
|
|
|
|
RECVSETTLELIST = 11,
|
|
|
|
|
SEAEORDERLIST = 12,
|
|
|
|
|
OPSEAELIST = 13,
|
|
|
|
|
RECVFEE = 14,
|
|
|
|
|
PAYFEE = 15
|
|
|
|
|
}
|
|
|
|
|
}
|