Hi there,
I have an several enum types that starts from a nunmber other than 0.
For example:
public enum InternalStatus
{
Pending = 1,
Ported = 2,
Suspended = 3
}
I put this values in a int column of a MSSQL table.
When I try to read tha values back from the database and cast it to
the enuum type, the casting acts as the enum type starts from 0.
I tried Enum.Parse, but it didn't help.
Any suggestion...? 4 1966
On Aug 17, 9:35 am, mitdej <mit...@gmail.comwrote:
I have an several enum types that starts from a nunmber other than 0.
For example:
public enum InternalStatus
{
Pending = 1,
Ported = 2,
Suspended = 3
}
I put this values in a int column of a MSSQL table.
When I try to read tha values back from the database and cast it to
the enuum type, the casting acts as the enum type starts from 0.
I tried Enum.Parse, but it didn't help.
Any suggestion...?
That sounds very unlikely to me. Could you post a short but complete
example showing the problem? The database side should be irrelevant,
as by the time you're casting you should already have the value as an
integer.
Jon
This is the problem code. Now that I look closely to the code it is
the opposite situation. Converting the enumeration to int value.
psn.RemoveSent((int)PortingNotification_WS.CDBMess ageType.PortingFromDonor_Notification
+1, Convert.ToInt32(dr["OperatorID"]), fromDate, toDate))
This is called from a Client App which is calling a web service and
the enumeration is trransferred as part of the proxy class.
The enumeration is on the server side and is defined as:
public enum CDBMessageType
{
SuspensionOfService_Notification = 1,
TerminateSuspension_Notification = 2,
Disconnection_Notification = 3,
RoutingErrors_Notification = 4,
PortingFromDonor_Notification = 5,
PortAccross_Notification = 6,
PortingAcceptance_Notification = 7,
PortingRejection_Notification = 8,
CancelPorting_Notification = 9,
ChangeInAssignedSeriesOfSubscriberNumbers_Notifica tion = 10
}
As You can see I have to add 1 to the value of the enumeration so it
can be casted to the correct int.
I think that WSDL doesn't transfer the information of the values of
the enuumeration types.
Any smarter solution?
On Aug 17, 10:58 am, mitdej <mit...@gmail.comwrote:
<snip>
This is called from a Client App which is calling a web service and
the enumeration is trransferred as part of the proxy class.
That may well be the problem. Have you tried looking at the XML
responses with something like Fiddler?
Jon
I haven't heard about fiddler :)
this is the enumeration as is generated in the proxy class:
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("Sy stem.Xml",
"2.0.50727.832")]
[System.SerializableAttribute()]
[System.Xml.Serialization.XmlTypeAttribute(Namespac e="http://
tempuri.org/")]
public enum CDBMessageType {
/// <remarks/>
SuspensionOfService_Notification,
/// <remarks/>
TerminateSuspension_Notification,
/// <remarks/>
Disconnection_Notification,
/// <remarks/>
RoutingErrors_Notification,
/// <remarks/>
PortingFromDonor_Notification,
/// <remarks/>
PortAccross_Notification,
/// <remarks/>
PortingAcceptance_Notification,
/// <remarks/>
PortingRejection_Notification,
/// <remarks/>
CancelPorting_Notification,
/// <remarks/>
ChangeInAssignedSeriesOfSubscriberNumbers_Notifica tion,
}
there are no assigned int values to the enumeration values, so I Guess
this is the problem.
Maybe Microsoft team should be informed about this.
Anyway thank You for Your quick responses to my posts. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: martinacevedo |
last post by:
I made a library in c++ gcc(3.4) with some classes. Within a classes,
I have an enumerator type, the problem is when I use the library from
another c++ project( the library is dynamic linked) I...
|
by: babylon |
last post by:
I have an enum
public enum MyEnum : int
{
X,
Y
}
I have to do
int a = (int) MyEnum.X;
can i overload the operator or other means to do something like
|
by: Fei Li |
last post by:
Hi,
Whi can help to expain what logic is when I cast enum a to b?
Thanks
|
by: Visual Systems AB \(Martin Arvidsson\) |
last post by:
Hi!
I have created an enum list like this:
enum myEnum : int
{
This = 2,
That,
NewVal = 10,
LastItm
|
by: Greg |
last post by:
Not sure if this is best place for this problem, but here it is. I have a
project that is simply a C# class that interfaces with an IFilter. This is
so I can retreive the text from Word docs. ...
| |
by: Jason Larion |
last post by:
When working with enums, I've noticed some behaviour that seems
completely counter-intuitive to me. I was wondering if someone here
could help restore my sanity, or at least help me to understand...
|
by: John Goche |
last post by:
Hello,
The following program compiler and runs fine under gcc and produces
the output 3. However, I am not sure whether such behavior is legal.
In particular, as a related question, how would I...
|
by: PokerMan |
last post by:
Hi guys,
Maybe someone can explain thisi have this enum:
public enum LimitType : int
{
BottomLimit,
TopLimit,
Limit
}
|
by: MSNEWS |
last post by:
HI
Public Enum WindowStyles As UInteger
WS_OVERLAPPED = 0x00000000
WS_POPUP = 0x80000000
WS_CHILD = 0x40000000
end enum
In the above i get an error at
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
| |