About Zu

Posts by Zu:

 
0

Insert Products

on September 17, 2010 in Ektron
‘Add product Types (sub categories)
Dim catalogApi As New CatalogEntryApi()
Dim productTypeApi As New ProductTypeApi()
Dim inventoryAPI As New InventoryApi()

Dim dr As SqlDataReader
Dim currentUserId As Long = catalogApi.UserId
Dim Currency_USD As Integer = 840

‘ Create and Populate ApplicantDetails
If currentUserId > 0 Then
Dim folderId As Long = 0
Long.TryParse([folder id], folderId)

Dim productTypeId As Long = 0
Long.TryParse([product id], productTypeId)

Dim price As Decimal = 0
Decimal.TryParse(txtprice.text.ToString().Trim(), price)

Dim entryData As EntryData = Nothing
Dim entryType As Ektron.Cms.Common.EkEnumeration.CatalogEntryType = productTypeApi.GetItem(productTypeId).EntryClass

Select Case entryType

Case Ektron.Cms.Common.EkEnumeration.CatalogEntryType.Kit
entryData = New KitData()
entryData.LanguageId = catalogApi.ContentLanguage
Exit Select

Case Ektron.Cms.Common.EkEnumeration.CatalogEntryType.Bundle
entryData = New BundleData()
entryData.LanguageId = catalogApi.ContentLanguage
Exit Select

Case Ektron.Cms.Common.EkEnumeration.CatalogEntryType.SubscriptionProduct
entryData = New SubscriptionProductData()
entryData.LanguageId = catalogApi.ContentLanguage
Exit Select
Case Else

entryData = New ProductData(catalogApi.ContentLanguage)
Exit Select

End Select

entryData.Title =
entryData.TaxClassId =
entryData.Sku =
entryData.GoLive =
entryData.EndDate =
entryData.CurrencyId = Currency_USD

entryData.ProductType = New ProductTypeData()
entryData.ProductType.Id = productTypeId
entryData.Pricing = New PricingData(Currency_USD, price, price)
entryData.FolderId = folderId

entryData.Html = "Other  " & txtclassname.text & _
" " & txtDescription.text & "  "

Try
catalogApi.Add(entryData)
lblMessage.Text = lblMessage.Text & "
Entry Saved.  ID: "
& entryData.Id

Dim inventoryData As New InventoryData()
inventoryData.EntryId = entryData.Id
inventoryData.UnitsInStock =

Try
inventoryAPI.SaveInventory(inventoryData)

Dim tax As New Taxonomy()
Dim itemRequest As New TaxonomyContentRequest()
itemRequest.TaxonomyList =
itemRequest.ContentId = entryData.Id

‘Assign productID
Try
tax.AddTaxonomyItem(itemRequest)
Catch ex As Exception
lblMessage.Text = lblMessage.Text & "

An error occured while saving the taxonomy.
" & ex.Message
End Try

Catch ex As Exception
lblMessage.Text = lblMessage.Text & "

An error occured while saving the inventory.
" & ex.Message
End Try

Catch ex As Exception
lblMessage.Text = lblMessage.Text & "

An error occured while saving the entry.
" & ex.Message
End Try
Else
lblMessage.Text = "Not logged in."
End If

 
0

Insert into HTML Form

on September 17, 2010 in Ektron

Dim cApi As New Ektron.Cms.ContentAPI() Dim fSubData As New FormSubmittedData() Dim userapi As Ektron.Cms.UserAPI = New Ektron.Cms.UserAPI() Dim fDataItem As FormFieldDataItem() = New FormFieldDataItem(1) {} fDataItem(0) = New FormFieldDataItem() fDataItem(0).FieldName = "EmployerID" fDataItem(0).DataValue = txtid.text fDataItem(1) = New FormFieldDataItem() fDataItem(1).FieldName = "JobTitle" fDataItem(1).DataValue = txtJobTitle.Text fSubData.DataItems = fDataItem fSubData.DateSubmitted = Now.Date() Try cApi.SubmitFormFieldData([form id], fSubData, [...]

 
0

for xml explicit

on July 8, 2010 in SQL

SELECT 1 AS tag, NULL AS parent, user_id AS [li!1!title], name AS [li!1] FROM t_users FOR xml explicit comes out as: <li title="1">user Name 1 </li> <li title="2">user Name 2 </li> <li title="3">user Name 3 </li> etc.

 
0

Debugging Classic ASP in VS08

on June 24, 2010 in ASP, Visual Studio

1. Go to Control Panel>Administrative Tools>Computer Management. Add IWAM_ComputerName account to the Debugger Users group. 2. Create a Web Application Project in VS 2005 and add .asp files. 3. Create a virtual directory in IIS for the web application project that you created. 4. On the properties tab of the virtual directory in IIS do [...]

 
0

useful SQL queries

on May 13, 2010 in SQL

Find all users that are in tblUser table  but are not in tblTransaction (very useful if there’s a foreign key issue) SELECT USER_ID FROM tblTransaction WHERE USER_ID NOT IN (SELECT ID FROM TBLUSER) Now this one is used when you have a table linking a many to many relationship.  This query pulls all currently assigned [...]

 
0

Migrating and Encrypting

on May 12, 2010 in .Net

getOldUsers – read the ds one by one from the old db, where the passwords are not yet encrypted. InsertUserx – writes the users into your new (current) db, with passwords encrypted. Public Function MigrateUser() As Integer Dim dr As DataRow Dim ds As DataSet Dim dt As DataTable Dim userID As Integer ds = [...]

 
0

A more recent version of the file has been saved….

on May 3, 2010 in Visual Studio

OMG. the following message has been popping up more and more often when using FTP via VS08, and the larger the project gets the more “No”s you have to click…. A more recent version of the file [filename] has been saved to the Web server by [username] on [DateTime] Do you want to replace the [...]

 
0

Return Inserted Identity from Stored Procedure

on April 23, 2010 in ASP

Stored Procedure looks like this: ALTER PROCEDURE [dbo].[spInsertSomething] @txtName varchar(255), @txtDisplayName varchar(80), @txtPhone varchar(50) AS BEGIN INSERT INTO tblSomeTable ( txtName , txtDisplayName , txtPhone ) VALUES ( @ txtName , @ txtDisplayName , @ txtPhone ) SELECT NEWID = SCOPE_IDENTITY() END

 
0

.NET Repeaters Cheat Sheet (vb)

on March 17, 2010 in .Net

<asp:Repeater ID=”rpPostTest” runat=”server” OnItemDataBound=”rpPostTest_OnItemDataBound”> <ItemTemplate> <asp:Label ID=”lblQuestion” runat=”server”></asp:Label> <asp:Label ID=”lblQID” visible=”false” runat=”server”></asp:Label> <br /> <asp:RadioButtonList ID=”answer” runat=”server”  > <asp:ListItem    Text=”True”  Value=”T” ></asp:ListItem> <asp:ListItem   Text=”False”  Value=”F”></asp:ListItem> </asp:RadioButtonList> <hr /> </ItemTemplate> </asp:Repeater> create the repeater &lt;asp:Repeater ID="rpPostTest" runat="server" OnItemDataBound="rpPostTest_OnItemDataBound"&gt; &lt;ItemTemplate&gt; &lt;asp:Label ID="lblQuestion" runat="server"&gt;&lt;/asp:Label&gt; &lt;asp:Label ID="lblQID" visible="false" runat="server"&gt;&lt;/asp:Label&gt; &lt;br /&gt; &lt;asp:RadioButtonList ID="answer" runat="server"  &gt; &lt;asp:ListItem  Text="True"  [...]

 
0

A few useful things to remember…

on November 30, 2009 in .Net

App_Offline.htm “The way app_offline.htm works is that you place this file in the root of the application.  When ASP.NET sees it, it will shut-down the app-domain for the application (and not restart it for requests) and instead send back the contents of the app_offline.htm file in response to all new dynamic requests for the application.  [...]

Copyright © 2007-2012 Cheat Sheet All rights reserved.
Desk Mess Mirrored v1.8.1 theme from BuyNowShop.com.