logo
Welcome Guest! To enable all features please Login. New Registrations are disabled.

Notification

Icon
Error

Options
Go to last post Go to first unread
bart  
#1 Posted : Tuesday, November 10, 2009 6:24:55 PM(UTC)
bart

Rank: Administration

Reputation:

Groups: Administration
Joined: 10/8/2008(UTC)
Posts: 188
Man

Was thanked: 1 time(s) in 1 post(s)
Hi There,

Here is a nice example of a dropdownlist overrule
you have to make sure The Value of the selected Item is the same as de relationfield in the cms, else you get an error
Code:
Imports Microsoft.visualbasic
==>END IMPORTS

select FormId
  case 2
  Dim KlantId as integer = Cint(pbw.Get_CustomerId_cookie(session))
  Dim prefix as string = CID & "U_"
  select FieldName    
    case "BetalingsmethodeId"
      
      Dim Leveringsconditie as integer= 0
      Dim i as integer =0
      
      Dim Queryleveringsmethode as string = ""
      Queryleveringsmethode &= "select Code,BetalingsMethode  from " & prefix & "ShopBetMethode "
      
      Dim shopstring as string = pbw.Get_Shop_cookie(Session)
      Dim aantalartikelen as integer = pbw.Shop_Get_ProductsCount(session)
      Dim Query2 as string = ""
      Dim voorraadNL as decimal = 0
      Dim voorraadFR as decimal = 0
      Dim NLbestelling as boolean = false
      Dim FRbestelling as boolean = false

      for i = 1 to aantalartikelen
        Query2 &= pbw.Shop_Get_Product_Property(pbw.Get_Parameter_Value(shopstring, i), 1)
        Query2 &= ","
      next

      Query2 = "Select voorraadNL,voorraadFR from " & prefix & "ShopArtikel where Id in(" & Query2 & "0)"

      Dim con0 as new SqlConnection(Constring)
        Dim com0 as new SqlCommand(Query2,con0)
        try
        con0.open()
        Dim reader0 as SqlDataREader = Com0.ExecuteReader()
        while reader0.read()
          if NOT ISDBNULL(Reader0(0)) then
            voorraadNL = Reader0(0)
          else
            voorraadNL = 0
          end if 
          if NOT ISDBNULL(Reader0(1)) then
            voorraadFR  = Reader0(1)
          else
            voorraadFR  = 0
          end if

          if voorraadNL > 0 or (voorraadNL=0 and voorraadFR=0) then
            NLbestelling = true
          else
            FRbestelling = true
          end if
        end while
        catch ex as exception
        end try
        con0.close()
      if NLbestelling = true and FRbestelling = true then
        Dim vervolgurl as string = ""
        pbw.Get_Config(cid, 0, "SHOPWINKELWAGENBESTELURL", vervolgurl , constring)
        response.redirect(vervolgurl,false)
      else 
      Dropdown.items.clear
      Dim QuerygetLeveringsconditie as string = ""
      QuerygetLeveringsconditie &= "select Leveringsconditie from " & prefix & "ShopKlanten where klantId=" & klantId
      Dim Con1 As New SqlConnection(constring)  
      Dim Com1 As New SqlCommand(QuerygetLeveringsconditie, Con1)
      try
      Con1.Open()
      Dim Reader1 As SqlDataReader = Com1.ExecuteReader()
      Reader1.Read()  
        Leveringsconditie = Reader1(0)
      catch
      end try
      Con1.Close()
      
      if FRbestelling = true then
        Queryleveringsmethode &= " where Code in(7,8) "
      else          
        Select Leveringsconditie
          case 13
            Queryleveringsmethode &= " where Code =1 "
          case 11
            Queryleveringsmethode &= " where Code =2 "
          case else
            Queryleveringsmethode &= " where Code in(1,2,4,5,6) "         
        end select
      end if
      Queryleveringsmethode &= " order by BetalingsMethode  "
      
      Dim Con2 As New SqlConnection(constring)  
      Dim Com2 As New SqlCommand(Queryleveringsmethode, Con2)
      try
      Con2.Open()
      Dim Reader2 As SqlDataReader = Com2.ExecuteReader()
      while Reader2.Read()  
        Dropdown.Items.Add(Reader2(1))
        Dropdown.items(Dropdown.items.count-1).value = Reader2(0)

      end while
      catch
      end try
      Con2.Close()
      end if

  end select


end Select

Wanna join the discussion?! Login to your Sienn Forum forum account. New Registrations are disabled.

Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.