55 lines
1.3 KiB
C#
55 lines
1.3 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 eAuthType
|
|
{
|
|
purchase,
|
|
holyday,
|
|
project,
|
|
jobreport,
|
|
savecost,
|
|
equipment,
|
|
otconfirm,
|
|
kuntae,
|
|
holyreq,
|
|
account,
|
|
purchaseEB,
|
|
}
|
|
public static int getAuth(eAuthType type, string uid)
|
|
{
|
|
return getAuth(type.ToString(), uid);
|
|
}
|
|
public static int getAuth(eAuthType 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 gcode='{2}' and [user]= '{1}'",field,uid,FCOMMON.info.Login.gcode);
|
|
var cmd = new SqlCommand(sql, cn);
|
|
var rdr = cmd.ExecuteScalar();
|
|
if(rdr != null )
|
|
retval = int.Parse(rdr.ToString());
|
|
|
|
cn.Close();
|
|
cn.Dispose();
|
|
return retval;
|
|
}
|
|
|
|
}
|
|
}
|