..
This commit is contained in:
39
SubProject/FCOMMON/Auth.cs
Normal file
39
SubProject/FCOMMON/Auth.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Data.SqlClient;
|
||||
|
||||
namespace FCOMMON
|
||||
{
|
||||
public static partial class DBM
|
||||
{
|
||||
|
||||
public static int getAuth_Purchase(string uid)
|
||||
{
|
||||
return getAuth("purchase", uid);
|
||||
}
|
||||
public static int getAuth_Purchase()
|
||||
{
|
||||
return getAuth("purchase", info.Login.no);
|
||||
}
|
||||
public 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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,7 @@ using System.Data.SqlClient;
|
||||
|
||||
namespace FCOMMON
|
||||
{
|
||||
public static class DBM
|
||||
public static partial class DBM
|
||||
{
|
||||
public static SqlConnection getCn()
|
||||
{
|
||||
@@ -72,6 +72,7 @@ namespace FCOMMON
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
public static sItemInfo getItemInfo(int idx)
|
||||
{
|
||||
var cn = getCn();
|
||||
|
||||
@@ -45,6 +45,7 @@
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Auth.cs" />
|
||||
<Compile Include="DataBaseManager.cs" />
|
||||
<Compile Include="fBase.cs">
|
||||
<SubType>Form</SubType>
|
||||
|
||||
Reference in New Issue
Block a user