|
Home > Archive > Commerce Server General > September 2005 > Profiles
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
| csstarter 2005-08-29, 8:50 pm |
| I was trying to add gift certificate funtionality to my website
I added a profile where i will have Certificate_Num(primary and join
key(dual key))-string type,PIN-string,balance-currency type
Its not related to any user its a separate pofile
CommerceContext csCTX=CommerceContext.Current;
AuthenticationInfo csAuth=csCTX.AuthenticationInfo;
bool bloggedOn=csAuth.IsAuthenticated();
if(bloggedOn==true)
{
Profile prof;
ProfileContext profContext=csCTX.ProfileSystem;
prof=profContext.GetProfile("Certificate_Num",number,"GiftCertificates");
.......
}
When I use this code I get invalid argument error for
profContext.GetProfile("Certificate_Num",number,"GiftCertificates");
what is it Iam doing wrong,"number" is the txtbox value where the user
will enter the gift certificate number...
How do I access a Profile which is not linked to any user from the
code...
Iam completly clueless what Iam doing wrong over here....
I have used the same functionality when Iam adding a user to the site
by creating a profile object and adding the userobject properties it
runs fine over there but here it fails...
any help will be appreciated
Does my GiftCertificates profile has to link with other profiles?????
| |
| David Hargis [MSFT] 2005-08-31, 8:50 pm |
|
One thing I noticed is that, since Certificate_Num is the dual key, you
should be using the overload GetProfile(string keyValue, string
profileType). This overload assumes that the value you are providing is
the primary key value.
Does "Certificate_Num" belong to a group - it could be that the name is not
fully qualified (i.e. GeneralInfo.Certificate_Num instead of
Certificate_Num). You could also try running a SQL profiler trace to
determine if the database is ever getting queried.
There are no requirements that profiles be linked to the UserObject
profile. You can get any arbitrary profile as long as you know (a) the
primary key value, or the value of one property marked as a Unique key and
(b) the profile type.
--------------------
NNTP-Posting-Date: Mon, 29 Aug 2005 19:43:04 -0500
Subject: Profiles
From: rayeesur@gmail-dot-com.no-spam.invalid (csstarter)
Newsgroups: microsoft.public.commerceserver.general
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit
User-Agent: newsSync (Commerce Server) 6838
Message-ID: <p4CdnakcmrgFNo7eRVn_vQ@giganews.com>
Date: Mon, 29 Aug 2005 19:43:04 -0500
Lines: 1
X-Trace:
sv3-G9PuahUDG0/jwgxBL8KM4OgP9++tvU0bwMkk3GMQiEFZBIE/ewI0kNkW25/w+svE5IU/B1bE
UBMw3O8!OgO8Moel4/ x6fC2ryafxZGi08MEiSqcFFetaR1DHfSqq0fHHGd
fCDuwk7Rhy
X-Complaints-To: abuse@giganews.com
X-DMCA-Notifications: http://www.giganews.com/info/dmca.html
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your
complaint properly
X-Postfilter: 1.3.32
Path:
TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed00.sul.t-online.de!t-onli
ne.de!border2.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.gigan
ews.com!local01.nntp.dca.giganews.com!news.giganews.com.POSTED!not-for-mail
Xref: TK2MSFTNGXA01.phx.gbl microsoft.public.commerceserver.general:3320
X-Tomcat-NG: microsoft.public.commerceserver.general
I was trying to add gift certificate funtionality to my website
I added a profile where i will have Certificate_Num(primary and join
key(dual key))-string type,PIN-string,balance-currency type
Its not related to any user its a separate pofile
CommerceContext csCTX=CommerceContext.Current;
AuthenticationInfo csAuth=csCTX.AuthenticationInfo;
bool bloggedOn=csAuth.IsAuthenticated();
if(bloggedOn==true)
{
Profile prof;
ProfileContext profContext=csCTX.ProfileSystem;
prof=profContext.GetProfile("Certificate_Num",number,"GiftCertificates");
.......
}
When I use this code I get invalid argument error for
profContext.GetProfile("Certificate_Num",number,"GiftCertificates");
what is it Iam doing wrong,"number" is the txtbox value where the user
will enter the gift certificate number...
How do I access a Profile which is not linked to any user from the
code...
Iam completly clueless what Iam doing wrong over here....
I have used the same functionality when Iam adding a user to the site
by creating a profile object and adding the userobject properties it
runs fine over there but here it fails...
any help will be appreciated
Does my GiftCertificates profile has to link with other profiles?????
--
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
Note: For the benefit of the community-at-large, all responses to this
message are best directed to the newsgroup/thread from which they
originated.
| |
| csstarter 2005-09-01, 5:55 pm |
| I appreciate ur reply...
I did get the Getprofile function working now i have a diff
problem...
Iam trying to write a scriptor component which will check the gift
certificate balance and deduct the final amount on the order ,if i
were to plug this component in totals pipeline how can i define the
context for this scriptor component ?
This is my scriptor component
function MSCSExecute(config, orderform, context, flags)
Dim giftCertificate
Set giftCertificate=context.GiftCertificate
if
(CCur(giftCertificate.Balance)>CCur(orderform.[_cy_total_total]))then
orderform& #91;_cy_total_total]=CCur(giftCertificat
e.Balance-orderform.[_cy_total_total])
else
giftCertificate.Balance=0
end if
giftCertificate.Update
MSCSExecute = 1
end function
sub MSCSOpen(config)
end sub
sub MSCSClose()
end sub
Now in this component Iam defining a new context called
giftCertificates
When I add this component in the Totals pipeline how do I pass this
context giftcertificate ?
| |
| David Hargis [MSFT] 2005-09-07, 5:52 pm |
| I'm afraid I don't know much about scriptor components and the orders
system. You might want to begin a different thread for this question with
a more appropriate title. Most people that know about this area probably
would skip a post titled "Profiles".
Thanks,
David
--------------------
NNTP-Posting-Date: Thu, 01 Sep 2005 11:43:06 -0500
Subject: re:Profiles
From: rayeesur@gmail-dot-com.no-spam.invalid (csstarter)
Newsgroups: microsoft.public.commerceserver.general
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit
User-Agent: newsSync (Commerce Server) 6879
References: <p4CdnakcmrgFNo7eRVn_vQ@giganews.com>
Message-ID: <9qednbxiPLMHsoreRVn_vA@giganews.com>
Date: Thu, 01 Sep 2005 11:43:06 -0500
Lines: 1
X-Trace:
sv3-2gqxiJrZXg2TBr8o2/m2JZB3a06eOvUpgTMPbhHCWXKGWKSM3wDa7i/Pd+a93JpLFrCFscOO
jPtFx6H!EFEvlvHX15DpYprKK5Xr5Rm4J8FBkIl7
CCQiEs2j/3av6BA7wi1nUy1w6j1v
X-Complaints-To: abuse@giganews.com
X-DMCA-Notifications: http://www.giganews.com/info/dmca.html
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your
complaint properly
X-Postfilter: 1.3.32
Path:
TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed00.sul.t-online.de!t-onli
ne.de!border2.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.gigan
ews.com!local01.nntp.dca.giganews.com!news.giganews.com.POSTED!not-for-mail
Xref: TK2MSFTNGXA01.phx.gbl microsoft.public.commerceserver.general:3341
X-Tomcat-NG: microsoft.public.commerceserver.general
I appreciate ur reply...
I did get the Getprofile function working now i have a diff
problem...
Iam trying to write a scriptor component which will check the gift
certificate balance and deduct the final amount on the order ,if i
were to plug this component in totals pipeline how can i define the
context for this scriptor component ?
This is my scriptor component
function MSCSExecute(config, orderform, context, flags)
Dim giftCertificate
Set giftCertificate=context.GiftCertificate
if
(CCur(giftCertificate.Balance)>CCur(orderform.[_cy_total_total]))then
orderform& #91;_cy_total_total]=CCur(giftCertificat
e.Balance-orderform.[_cy_total
_total])
else
giftCertificate.Balance=0
end if
giftCertificate.Update
MSCSExecute = 1
end function
sub MSCSOpen(config)
end sub
sub MSCSClose()
end sub
Now in this component Iam defining a new context called
giftCertificates
When I add this component in the Totals pipeline how do I pass this
context giftcertificate ?
--
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
Note: For the benefit of the community-at-large, all responses to this
message are best directed to the newsgroup/thread from which they
originated.
|
|
|
|
|