49 lines
1.2 KiB
C#
49 lines
1.2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Data.SqlClient;
|
|
|
|
namespace FCOMMON
|
|
{
|
|
public static partial class DBM
|
|
{
|
|
|
|
public enum eAutoType
|
|
{
|
|
purchase,
|
|
holyday,
|
|
project,
|
|
jobreport,
|
|
}
|
|
public static int getAuth(eAutoType type, string uid)
|
|
{
|
|
return getAuth(type.ToString(), uid);
|
|
}
|
|
public static int getAuth(eAutoType type)
|
|
{
|
|
return getAuth(type.ToString(), info.Login.no);
|
|
}
|
|
|
|
|
|
private static int getAuth(string field,string uid)
|
|
{
|
|
var cn = getCn();
|
|
cn.Open();
|
|
|
|
int retval = 0;
|
|
|
|
string sql = string.Format("select isnull([{0}],0) from Auth where [user]= '{1}'",field,uid);
|
|
var cmd = new SqlCommand(sql, cn);
|
|
var rdr = cmd.ExecuteScalar();
|
|
if(rdr != null )
|
|
retval = int.Parse(rdr.ToString());
|
|
|
|
cn.Close();
|
|
cn.Dispose();
|
|
return retval;
|
|
}
|
|
|
|
}
|
|
}
|