Click here to Skip to main content
15,891,828 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello Team,

I have the code below:

   [WebMethod]
        public static string GetDEOIDCount(object qcAllocationDetails)
        {
            string resultMessage = string.Empty;
            Result result = null;
            IQCAllocation qcallocation = QBpoEntityCreator.GetQCAllocationEntity();
            try
            {
                qcallocation = qcAllocationDetails.ConvertToJsonString().JsonToObject(qcallocation.GetType()) as IQCAllocation;
                DisplayDEOIDCount = QbpController.GetDEOIDCount(qcallocation).Entity.ConvertToJsonString();

if (DisplayDEOIDCount == "" || DisplayDEOIDCount == null)
                {
                    ////DisplayDEOIDCount = show the message : Count is not present
                }
                if (result != null && result.Error.GetCount() > 0)
                {
                    resultMessage = result.Error.GetAll();
                }

            }
            catch (Exception exception)
            {
                resultMessage = string.Format("Technical error ocurred. {0}. Please contact to system administrator.", exception.Message);
            }

            return DisplayDEOIDCount;

        }


I want to show the message in If condition ,if count is not present
How it is possible.

Please Guide Me
Thanks
Harshal.
Posted
Comments
R Harshal 3-Apr-14 4:36am    
Sorry .I think i just want to pass a message in string thats it .
Thanks.
Harshal
R Harshal 3-Apr-14 4:36am    
DisplayDEOIDCount = "show the message : Count is not present";
R Harshal 3-Apr-14 4:41am    
If suppose ,if i get a exception,then how should i show in return DisplayDEOIDCount;
If you check , i am returing the DisplayDEOIDCount value not exception.
How to show the exception as well as DisplayDEOIDCount value.Please anyone can guide me .
Thanks
Harshal

1 solution

You can simple put return statement in the catch block that will return the error message. More Over you can modify the error message with anything you want to display.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900