firts commit
This commit is contained in:
61
REPORT_API_ver6/Services/User.cs
Normal file
61
REPORT_API_ver6/Services/User.cs
Normal file
@@ -0,0 +1,61 @@
|
||||
using System.Data;
|
||||
|
||||
namespace REPORT_API_ver6.Services
|
||||
{
|
||||
public class User
|
||||
{
|
||||
static readonly log4net.ILog logger = log4net.LogManager.GetLogger(typeof(User));
|
||||
|
||||
/// <summary>
|
||||
/// Login
|
||||
/// </summary>
|
||||
/// <param name="userEmail">ID</param>
|
||||
/// <param name="userPW">PW</param>
|
||||
/// <returns>User 정보</returns>
|
||||
public DataTable userLogin(string userEmail, string userPW)
|
||||
{
|
||||
DAL dal = new DAL();
|
||||
var connection = dal.ConnectIntra();
|
||||
|
||||
string sqlString = " select p_no, p_user_mail as mail, p_name as member_name, p_depart_now + p_team_now as team, '' as member_redirect ";
|
||||
sqlString += " , CASE WHEN p_depart_now + p_team_now='M101' AND p_job_now = '02' THEN 1 ELSE 2 END as is_kri ";
|
||||
sqlString += " from project2.dbo.V_PERSON ";
|
||||
sqlString += " where p_resign = '0' and p_pass_new is not null ";
|
||||
sqlString += " and (p_user_mail = '" + userEmail + "' or p_user_mail = '" + userEmail + "@kric.com') and p_pass_new COLLATE Korean_Wansung_CS_AS = '" + userPW + "'";
|
||||
|
||||
DataTable resultTable = dal.GetDataTable(sqlString, connection);
|
||||
dal.Disconnect(connection);
|
||||
|
||||
if (resultTable.Rows.Count < 1)
|
||||
{
|
||||
connection = dal.ConnectReport();
|
||||
sqlString = " SELECT 99999999 as p_no, member_mail as mail, member_name as member_name, 'CLIENT' as team, member_redirect, is_kri ";
|
||||
sqlString += " FROM REPORT_MEMBER ";
|
||||
sqlString += " where is_use = 1 and member_mail = '" + userEmail + "' and member_pw = '" + userPW + "' ";
|
||||
|
||||
resultTable = dal.GetDataTable(sqlString, connection);
|
||||
dal.Disconnect(connection);
|
||||
}
|
||||
|
||||
return resultTable;
|
||||
}
|
||||
|
||||
public static string getDinIDs()
|
||||
{
|
||||
string returnString = string.Empty;
|
||||
|
||||
DAL dal = new DAL();
|
||||
var connection = dal.ConnectIntra();
|
||||
|
||||
DataTable resultTable = dal.GetDataTable("SELECT STRING_AGG(''''+p_user_mail+'''',',') as DinIDs FROM [project2].[dbo].[person] WHERE p_depart_now='S' and p_team_now in ('101','201')", connection);
|
||||
dal.Disconnect(connection);
|
||||
|
||||
if(resultTable.Rows.Count > 0)
|
||||
{
|
||||
returnString = resultTable.Rows[0][0].ToString();
|
||||
}
|
||||
|
||||
return returnString;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user