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; } } } }