bklLiudl
2024-07-23 277bbae216debe7e6c04e8cc6ee6e1ba9763e14b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
using System.Collections;
using Model;
namespace BLL
{
    public class DALLoginLog:IDALUserLoginLog
    {
        public bool Add(LoginLog log)
        {
            bool result = false;
 
            try
            {
                Hashtable ht = new Hashtable();
                ht["UserCode"] = string.IsNullOrEmpty(log.Usercode) ? "''" : "'" + log.Usercode + "'";
                ht["guid"] = string.IsNullOrEmpty(log.guid) ? "''" : log.guid;
                ht["Username"] = string.IsNullOrEmpty(log.Username) ? "''": "'" + log.Username + "'";
                ht["LoginIp"] = string.IsNullOrEmpty(log.LoginIp) ? "''" : "'" + log.LoginIp + "'";
                ht["RealName"] = string.IsNullOrEmpty(log.RealName) ? "''" : "'" + log.RealName + "'";
                ht["RoleNo"] = string.IsNullOrEmpty(log.RoleName) ? "''" : "(select ID from Roles where RoleName ='" + log.RoleName + "')"; 
                ht["DepartNo"] = string.IsNullOrEmpty(log.DepartName) ? "''" : "(select ID from DepartMent where DepartName ='" + log.DepartName +"')";
                ht["Demo"] = string.IsNullOrEmpty(log.Dome) ? "''" : "'" + log.Dome + "'";
                ht["LoginTime"] = string.IsNullOrEmpty(log.LoginTime) ? "''" : log.LoginTime;
 
                int _ret = DataFactory.SqlDataBase().InsertByHashtableNullParam("Login_Log", ht);
 
                if (_ret == 1) result = true;
                return result;
            }
            catch
            {
                return result;
                
            }
            
        }
    }
}