Example #1
0
        public void InsertUserPermission(BLUser myUser)
        {
            SqlParameter        param     = new SqlParameter();
            List <SqlParameter> paramList = new List <SqlParameter>();

            param       = SQLHelper.CreateParameter("@UserID", SqlDbType.VarChar);
            param.Value = StrUserName;
            paramList.Add(param);

            param       = SQLHelper.CreateParameter("@MenuID", SqlDbType.VarChar);
            param.Value = myUser.StrMenuID;
            paramList.Add(param);

            SQLHelper.ExecuteNonQuery("SP_InsertUserPermission", CommandType.StoredProcedure, paramList);
        }
Example #2
0
        public void PasswordChange(BLUser myUser)
        {
            SqlParameter        param     = new SqlParameter();
            List <SqlParameter> paramList = new List <SqlParameter>();

            param       = SQLHelper.CreateParameter("@UserID", SqlDbType.VarChar);
            param.Value = StrUserName;
            paramList.Add(param);

            param       = SQLHelper.CreateParameter("@Password", SqlDbType.VarChar);
            param.Value = StrUserPassword;
            paramList.Add(param);

            SQLHelper.ExecuteNonQuery("update [User] set Password ='******' where UserID='" + StrUserName + "'", CommandType.Text, paramList);
        }
Example #3
0
        public DataTable ListUserPermissionbyUserID(BLUser myUser)
        {
            SqlParameter        param     = new SqlParameter();
            List <SqlParameter> paramList = new List <SqlParameter>();

            param       = SQLHelper.CreateParameter("@UserID", SqlDbType.VarChar);
            param.Value = StrUserName;
            paramList.Add(param);

            DataTable dt = new DataTable();

            dt.Columns.Add(new DataColumn("Password"));
            dt.Columns.Add(new DataColumn("MenuName"));

            DataRow       dtrow;
            SqlDataReader dataReader;

            dtrow      = dt.NewRow();
            dataReader = SQLHelper.ExecuteReader("SELECT dbo.[User].Password, dbo.Menu.MenuName FROM dbo.[User] INNER JOIN dbo.UserPermission ON dbo.[User].UserID = dbo.UserPermission.UserID COLLATE SQL_Latin1_General_CP1_CI_AS INNER JOIN dbo.Menu ON dbo.UserPermission.MenuID = dbo.Menu.MenuID WHERE    (dbo.[User].UserID = '" + StrUserName + "')", CommandType.Text, paramList);

            while (dataReader.Read())
            {
                dtrow = dt.NewRow();

                if (!dataReader.IsDBNull(0))
                {
                    dtrow[0] = dataReader.GetString(0).Trim();
                }

                if (!dataReader.IsDBNull(1))
                {
                    dtrow[1] = dataReader.GetString(1).Trim();
                }

                dt.Rows.Add(dtrow);
            }
            dataReader.Close();
            return(dt);
        }
Example #4
0
        public void InsertUser(BLUser myUser)
        {
            SqlParameter        param     = new SqlParameter();
            List <SqlParameter> paramList = new List <SqlParameter>();

            param       = SQLHelper.CreateParameter("@UserID", SqlDbType.VarChar);
            param.Value = StrUserName;
            paramList.Add(param);

            param       = SQLHelper.CreateParameter("@Password", SqlDbType.VarChar);
            param.Value = StrUserPassword;
            paramList.Add(param);

            param       = SQLHelper.CreateParameter("@CreatedBy", SqlDbType.VarChar);
            param.Value = StrUserName;
            paramList.Add(param);

            param       = SQLHelper.CreateParameter("@UserRole", SqlDbType.VarChar);
            param.Value = StrRole;
            paramList.Add(param);

            SQLHelper.ExecuteNonQuery("sp_InsertUser", CommandType.StoredProcedure, paramList);
        }