Esempio n. 1
0
        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();
                }
            }
        }
Esempio n. 2
0
        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();
                }
            }
        }
Esempio n. 3
0
        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();
                }
            }
        }
Esempio n. 4
0
        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();
                    }
                }

            }
        }
Esempio n. 5
0
        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);
                }
            }
        }
Esempio n. 6
0
        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);
                }
            }
        }
Esempio n. 7
0
        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();
                }
            }
        }
Esempio n. 8
0
        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();
                }
            }
        }
Esempio n. 9
0
        /// <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();
                }
            }
        }