Files
Groupware/SubProject/FCOMMON/Auth.cs
chikyun.kim 11d7c7f704 ..
2019-07-26 17:28:19 +09:00

48 lines
1.1 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,
}
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 [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;
}
}
}