public EbMqResponse Post(BrowserExceptionRequest request) { try { this.EbConnectionFactory = new EbConnectionFactory(request.SolnId, this.Redis); string sql = @"INSERT INTO eb_browser_exceptions(user_id, device_info, ip_address, error_msg, eb_created_at) VALUES ( :userid, :deviceInfo, :ipaddress, :errorMsg, NOW());"; DbParameter[] parameters = new DbParameter[] { this.EbConnectionFactory.DataDB.GetNewParameter("userid", EbDbTypes.Int32, request.UserId), this.EbConnectionFactory.DataDB.GetNewParameter("deviceInfo", EbDbTypes.String, request.Device_info), this.EbConnectionFactory.DataDB.GetNewParameter("ipaddress", EbDbTypes.String, request.Ip_address), this.EbConnectionFactory.DataDB.GetNewParameter("errorMsg", EbDbTypes.String, request.Error_msg) }; int t = this.EbConnectionFactory.DataDB.DoNonQuery(sql, parameters.ToArray()); if (t < 0) { Console.WriteLine("data stored into eb_browser_exceptions table"); } } catch (Exception e) { Console.WriteLine("BrowserExceptionRequest" + e.Message + e.StackTrace); } return(MqResponse); }
public IEnumerable <File> GetFolderByName(int folder, string name) { var condition = new SQLCondition(); condition.Expression = "where Folder = @folder and [Name] like '%" + name + "%'"; var dbParameter = new DbParameter[] { new SqlParameter() { DbType = DbType.Int32, Value = folder, ParameterName = "@folder" } }; return(_file.Query(condition: condition, param: dbParameter.ToArray())); }
public File GetFileById(int id) { var condition = new SQLCondition(); condition.Expression = "where Id = @Id"; var dbParameter = new DbParameter[] { new SqlParameter() { DbType = DbType.Int32, Value = id, ParameterName = "@Id" } }; return(_file.Query(condition: condition, param: dbParameter.ToArray()).FirstOrDefault()); }
public IEnumerable <Folder> GetFolderByGroup(int group) { var condition = new SQLCondition(); condition.Expression = "where Group = @group"; var dbParameter = new DbParameter[] { new SqlParameter() { DbType = DbType.Int32, Value = group, ParameterName = "@group" } }; return(_folder.Query(condition: condition, param: dbParameter.ToArray())); }
public IEnumerable <Folder> GetFolderByParent(int parent, string roleId) { var condition = new SQLCondition(); condition.Expression = "where Parent = @parent and Role like '%" + roleId + "%'"; var dbParameter = new DbParameter[] { new SqlParameter() { DbType = DbType.Int32, Value = parent, ParameterName = "@parent" } }; return(_folder.Query(condition: condition, param: dbParameter.ToArray())); }
public int AddLogin(VLogin item, string ipAddress) { var login = new Login(); item.SessionId = Guid.NewGuid().ToString() + login.LoginTime.ToString("yyyyMMddHHmmss"); login.SessionId = item.SessionId; login.UserId = item.User.Id; login.UserName = item.User.Name; login.IPAddress = ipAddress; login.LoginTime = DateTime.UtcNow; var sql = "update Login set IsDrop = 0 where UserId=@userId "; var dbParameter = new DbParameter[] { new SqlParameter() { DbType = DbType.Int32, Value = item.User.Id, ParameterName = "@userId" }, }; _login.Exec(sql, dbParameter.ToArray()); return(_login.Add(login)); }