public void DeleteAllSession() { using (XinJishu.Data.SQLServer.DataAccess conn = new Data.SQLServer.DataAccess(connectionStringName)) { using (var cmd = conn.GetCommand()) { List<RoleModel> roles = new List<RoleModel>(); cmd.CommandText = "[xju].[Session_DeleteAll]"; cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.ExecuteNonQuery(); } } }
public Hashtable DeleteSessionById(Int32 id) { using (XinJishu.Data.SQLServer.DataAccess conn = new Data.SQLServer.DataAccess(connectionStringName)) { using (var cmd = conn.GetCommand()) { List<RoleModel> roles = new List<RoleModel>(); cmd.CommandText = "[xju].[Session_Delete]"; cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.Parameters.Clear(); cmd.Parameters.AddWithValue("@id", id); return conn.ExecuteHash(cmd).FirstOrDefault(); } } }
public void DeleteRole(Object name) { using (XinJishu.Data.SQLServer.DataAccess conn = new Data.SQLServer.DataAccess(connectionStringName)) { using (var cmd = conn.GetCommand()) { List<RoleModel> roles = new List<RoleModel>(); cmd.CommandText = "[xju].[Roles_Delete]"; cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.Parameters.Clear(); cmd.Parameters.AddWithValue("@name", name); cmd.ExecuteNonQuery(); } } }
public void Log() { if (HttpContext.Current != null) { var ipAddress = HttpContext.Current.Request.UserHostAddress; var dnsName = HttpContext.Current.Request.UserHostName; var langs = HttpContext.Current.Request.UserLanguages; var requestUrl = HttpContext.Current.Request.RawUrl; var requestParams = HttpContext.Current.Request.Params; var requestType = HttpContext.Current.Request.RequestType; using (XinJishu.Data.SQLServer.DataAccess conn = new Data.SQLServer.DataAccess(connectionStringName)) { using (var cmd = conn.GetCommand()) { cmd.CommandText = "[xju].[WebRequest_Insert]"; cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.ExecuteNonQuery(); } } } }
public IList<Hashtable> ListSessionsForUsername(Object username) { using (XinJishu.Data.SQLServer.DataAccess conn = new Data.SQLServer.DataAccess(connectionStringName)) { using (var cmd = conn.GetCommand()) { List<RoleModel> roles = new List<RoleModel>(); cmd.CommandText = "[xju].[Session_ListByUsername]"; cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.Parameters.Clear(); cmd.Parameters.AddWithValue("@username", username); return conn.ExecuteHash(cmd); } } }
public IList<Hashtable> ListSessions() { using (XinJishu.Data.SQLServer.DataAccess conn = new Data.SQLServer.DataAccess(connectionStringName)) { using (var cmd = conn.GetCommand()) { List<RoleModel> roles = new List<RoleModel>(); cmd.CommandText = "[xju].[Session_List]"; cmd.CommandType = System.Data.CommandType.StoredProcedure; return conn.ExecuteHash(cmd); } } }
public void RemoveUserFromRole(Object userId, Object roleId) { using (XinJishu.Data.SQLServer.DataAccess conn = new Data.SQLServer.DataAccess(connectionStringName)) { using (var cmd = conn.GetCommand()) { List<RoleModel> roles = new List<RoleModel>(); cmd.CommandText = "[xju].[Roles_RemoveUserFromRole]"; cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.Parameters.Clear(); cmd.Parameters.AddWithValue("@userId", userId); cmd.Parameters.AddWithValue("@roleId", roleId); cmd.ExecuteNonQuery(); } } }
public Hashtable GetUserByEmail(String email) { using (XinJishu.Data.SQLServer.DataAccess conn = new Data.SQLServer.DataAccess(connectionStringName)) { using (var cmd = conn.GetCommand()) { List<RoleModel> roles = new List<RoleModel>(); cmd.CommandText = "[xju].[User_GetByEmail]"; cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.Parameters.Clear(); cmd.Parameters.AddWithValue("@email", email); return conn.ExecuteHash(cmd).FirstOrDefault(); } } }
/// <summary> /// Updates a UserModel object against the database /// </summary> /// <param name="user"></param> public void UpdateUser(UserModel user) { using (XinJishu.Data.SQLServer.DataAccess conn = new Data.SQLServer.DataAccess(connectionStringName)) { using (var cmd = conn.GetCommand()) { List<RoleModel> roles = new List<RoleModel>(); cmd.CommandText = "[xju].[User_Update]"; cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.Parameters.Clear(); cmd.Parameters.AddWithValue("@id", user.id); cmd.Parameters.AddWithValue("@email", user.email); cmd.Parameters.AddWithValue("@pwd", user.pwd); foreach (var item in user.fields) cmd.Parameters.AddWithValue("@" + item.Key, item.Value); cmd.ExecuteNonQuery(); } } }