xwdreamer的专栏

我所写的,都是被我所验证过的

测试我用WLW在CSDN上的第一篇博客

CSDN上写博客让人很纠结,因为很慢,而且会丢失信息,这让我很郁闷,为了这个我都想将CSDN上的博客搬家到CNBLOG上去了。但是发现使用WLW既可以写CSDN的博客,也可以写CNBLOG的博客,我有想试一下,如果可以的话就不搬家了。我还是喜欢CSDN的环境。

下面测试代码能否插入。这里使用了插件Paste AS VS Code,而不是使用WindowsLiveWriter.SourceCode.dll这个插件。

Code Snippet
  1. Private Sub cmdImportUsers_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdImportUsers.Click
  2.          Dim xmlDoc As New XmlDocument
  3.          xmlDoc.LoadXml(txtUserXML.Text)
  4.          ' update the user record in the database
  5.          Dim responseBuilder As StringBuilder = New StringBuilder()
  6.          For Each xmlItem As XmlElement In xmlDoc.SelectNodes("/Users/User")
  7.  
  8.              Dim oUserInfo As New UserInfo
  9.              oUserInfo.PortalID = 0
  10.              oUserInfo.Membership.Username = GetXmlItemValue(xmlItem, "Username")
  11.              oUserInfo.Username = GetXmlItemValue(xmlItem, "Username")
  12.              oUserInfo.Profile.FirstName = GetXmlItemValue(xmlItem, "FirstName")
  13.              oUserInfo.FirstName = GetXmlItemValue(xmlItem, "FirstName")
  14.              oUserInfo.Profile.LastName = GetXmlItemValue(xmlItem, "LastName")
  15.              oUserInfo.LastName = GetXmlItemValue(xmlItem, "LastName")
  16.              oUserInfo.Profile.Unit = GetXmlItemValue(xmlItem, "Unit")
  17.              oUserInfo.Profile.Street = GetXmlItemValue(xmlItem, "Street")
  18.              oUserInfo.Profile.City = GetXmlItemValue(xmlItem, "City")
  19.              oUserInfo.Profile.Region = GetXmlItemValue(xmlItem, "Region")
  20.              oUserInfo.Profile.PostalCode = GetXmlItemValue(xmlItem, "PostalCode")
  21.              oUserInfo.Profile.Country = GetXmlItemValue(xmlItem, "Country")
  22.              oUserInfo.Profile.Telephone = GetXmlItemValue(xmlItem, "Telephone")
  23.              oUserInfo.Membership.Email = GetXmlItemValue(xmlItem, "Email")
  24.              oUserInfo.Email = GetXmlItemValue(xmlItem, "Email")
  25.              oUserInfo.Membership.Approved = True
  26.              oUserInfo.AffiliateID = Null.NullInteger
  27.              oUserInfo.Membership.Password = GetXmlItemValue(xmlItem, "Password")
  28.          Dim createStatus As UserCreateStatus = UserController.CreateUser(oUserInfo)
  29.  
  30.          '    If createStatus = UserCreateStatus.Success Then
  31.          '    responseBuilder.AppendLine(String.Format("User '{0}' created successfully", oUserInfo.Username))
  32.  
  33.          '    Else
  34.          '    responseBuilder.AppendLine(String.Format("User '{0}' creation failed: {1}", oUserInfo.Username, [Enum].GetName(GetType(UserCreateStatus), createStatus)))
  35.  
  36.          'End If
  37.          '只输出导入不成功的用户。
  38.          If createStatus <> UserCreateStatus.Success Then
  39.              responseBuilder.AppendLine(String.Format("User '{0}' creation failed: {1}", oUserInfo.Username, [Enum].GetName(GetType(UserCreateStatus), createStatus)))
  40.          End If
  41.  
  42.          Next
  43.          txtUserXML.Text = responseBuilder.ToString()
  44.      End Sub
然后是测试图片能够上传

02175993

阅读更多
个人分类: 随笔
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭