/// <summary>
 ///	Overloaded Constructor with two arguments for setting up Error code and session
 /// </summary>
 /// <param name="errCode">ErrorCode</param>
 /// <param name="sess">OFISession Object</param>
 public NandanaResult(NandanaError.ErrorType errCode, NandanaSession sess)
 {
     status    = StatusType.ERROR;
     errorCode = errCode;
     resultDS  = null;
     resultObj = null;
     session   = sess;
     NandanaError.PostError(this);
 }
 /// <summary>
 ///	Overloaded Constructor with three arguments for setting up Error code, Error Desc and session
 /// </summary>
 /// <param name="errCode">ErrorCode</param>
 /// <param name="errDesc">Error Description Object</param>
 /// <param name="sess">OFISession Object</param>
 public NandanaResult(NandanaError.ErrorType errCode, string errDesc, NandanaSession sess)
 {
     status    = StatusType.ERROR;
     errorCode = errCode;
     resultDS  = null;
     resultObj = null;
     session   = sess;
     // append the description to the existing one
     errorDescr += (null != errorDescr && 0 < errorDescr.Length && null != errDesc && 0 < errDesc.Length ? " : ":"") + errDesc;
     NandanaError.PostError(this);
 }
 /// <summary>
 ///	Check Condition function to validate a condition and fire the error.
 /// </summary>
 public static NandanaResult CheckCondition(bool condition, NandanaError.ErrorType errCode, string errDesc, NandanaSession sess)
 {
     if (!condition)
     {
         if ((null == errDesc) || (0 == errDesc.Length))
         {
             return(new NandanaResult(errCode, sess));
         }
         else
         {
             return(new NandanaResult(errCode, errDesc, sess, null));
         }
     }
     else
     {
         return(new NandanaResult());
     }
 }
        /// <summary>
        ///	Overloaded Constructor with four arguments for setting up Error code, Error Desc, session and exception
        /// </summary>
        /// <param name="errCode">ErrorCode</param>
        /// <param name="errDesc">Error Description Object</param>
        /// <param name="sess">OFISession Object</param>
        /// <param name="exp">Exception Object</param>
        public NandanaResult(NandanaError.ErrorType errCode, string errDesc, NandanaSession sess, Exception exp)
        {
            status         = StatusType.ERROR;
            errorCode      = errCode;
            errorException = exp;
            resultDS       = null;
            resultObj      = null;
            session        = sess;
            // append the description to the existing one, set by IBCError object
            errorDescr += (null != errorDescr && 0 < errorDescr.Length && null != errDesc && 0 < errDesc.Length ? " : ":"") + errDesc;
            if (null != exp)
            {
#if (DEBUG)
                errorDescr += (null != errorDescr && 0 < errorDescr.Length ? " : ":"") + exp.ToString();
#else
                errorDescr += (null != errorDescr && 0 < errorDescr.Length ? " : ":"") + exp.Message;
#endif
            }
            NandanaError.PostError(this);
        }
 /// <summary>
 ///	Validates a value to be not null and returns the status
 /// </summary>
 /// <param name="val">Value to be checked</param>
 /// <param name="errType">Error type to be used for result object initialization</param>
 /// <param name="errMessage">Error message to be embedded</param>
 /// <returns>Result object with status</returns>
 protected NandanaResult CheckNotNull(string val, NandanaError.ErrorType errType, string errMessage)
 {
     return(NandanaResult.CheckCondition((null != val) && (0 != val.Length),
                                         errType, errMessage, m_oSession));
 }