Example #1
0
        /// <summary>
        /// Checks the file transfer support on receiver side.
        /// </summary>
        /// <param name="sUID">A string containing the sender user id.</param>
        /// <param name="rUID">A string containing the receiver user id.</param>
        public void CheckSupport(string sUID, string rUID)
        {
            #region log user request and response

            /***********************************************
            *  To log user request
            ***********************************************/
            if (_logRequestResponse)
            {
                LogManager.CurrentInstance.InfoLogger.LogInfo(
                    System.Reflection.MethodBase.GetCurrentMethod().DeclaringType, System.Reflection.MethodBase.GetCurrentMethod().Name + "===>" +
                    "CheckSupport -- Request ===> senderID : " + sUID + ", receiverID : " + rUID);
            }

            #endregion
            ulong temp = 0;
            sUID = (sUID != null) ? sUID.Trim() : sUID;
            rUID = (rUID != null) ? rUID.Trim() : rUID;
            // #region Verify User
            //var request = OperationContext.Current.IncomingMessageProperties[HttpRequestMessageProperty.Name] as HttpRequestMessageProperty;
            //string keyFromClient = request.Headers["key"];
            //if (NeeoUtility.AuthenticateUserRequest(sUID, keyFromClient))
            //{
            //    #endregion

            if (NeeoUtility.IsNullOrEmpty(sUID) && !ulong.TryParse(sUID, out temp) && NeeoUtility.IsNullOrEmpty(rUID) && !ulong.TryParse(rUID, out temp))
            {
                NeeoUtility.SetServiceResponseHeaders(CustomHttpStatusCode.InvalidArguments);
            }
            else
            {
                try
                {
                    NeeoUser senderUser = new NeeoUser(sUID);
                    if (!senderUser.IsFileTransferSupported(rUID))
                    {
                        NeeoUtility.SetServiceResponseHeaders(CustomHttpStatusCode.FileTransferNotSupported);
                    }
                }
                catch (ApplicationException appExp)
                {
                    NeeoUtility.SetServiceResponseHeaders((CustomHttpStatusCode)(Convert.ToInt32(appExp.Message)));
                }
            }
            //}
            //else
            //{
            //    NeeoUtility.SetServiceResponseHeaders((CustomHttpStatusCode)HttpStatusCode.Unauthorized);

            //}
        }