Example #1
0
        public ResponseInfo <CreateOrderOrderResult> CreateOrder(OrderInfo orderinfo)
        {
            _log.Debug("order data:" + JsonConvert.SerializeObject(orderinfo));
            ApiSetting setting = new ApiSetting(null);

            if (string.IsNullOrWhiteSpace(orderinfo.memberId))
            {
                orderinfo.memberId   = setting.DefaultMemberId;
                orderinfo.memberName = "匿名用户";
            }
            var datmap = new CreateOrderDatamap()
            {
                memberId = orderinfo.memberId, orderList = new OrderInfo[] { orderinfo }
            };

            var response = SecurityHttpClient.Post <CreateOrderDatamap, CreateOrderOrderResult>(setting.JavaOrder_Uri + "generateOrder", datmap);

            if (response == null)
            {
                throw new ApplicationException("调用java下单接口失败!");
            }
            if (response.respCode != "0")
            {
                throw new ApplicationException("调用java下单接口失败!" + response.respCode + ":" + response.respMsg);
            }
            if (response.dataMap == null)
            {
                throw new ApplicationException("调用java下单接口失败!返回数据为null");
            }
            response.dataMap.orderId = response.dataMap.orderIds.First().Value;

            return(response);
        }
Example #2
0
        public void ApiSetting_Default()
        {
            var apiSetting = new ApiSetting();

            Assert.NotNull(apiSetting.SupportedContentTypes);
            Assert.NotNull(apiSetting.SupportedResources);
        }
        public async SystemTasks.Task Invoke(HttpContext context, IOptionsSnapshot <ApiSetting> apiSettings, ISspProxyService _sspProxyService)
        {
            _sspApiSettings = apiSettings.Get("SspApiSetting");

            var request = new CommandRequest();

            var forwardingUrl = context.Request.Path.Value.Replace($"{_sspApiSettings.BasePath}/", "");

            request.Headers    = context.Request.Headers.Select(h => KeyValuePair.Create(h.Key, string.Join("; ", (h.Value.ToList()))));
            request.Method     = HttpMethod.Get; //could be more types in future, so fetch from context
            request.ForwardUrl = new Uri(WebUtility.UrlDecode(forwardingUrl));
            request.Forwarded  = new Forwarded
            {
                By       = context.Connection.LocalIpAddress.ToString(),
                For      = context.Connection.RemoteIpAddress.ToString(),
                Host     = request.ForwardUrl.Host,
                Protocol = _sspApiSettings.Secure ? "https" : "http"
            };

            var result = await _sspProxyService.ForwardRequest(request);

            context.Response.StatusCode = result.StatusCode;

            foreach (var resHeader in result.Headers)
            {
                context.Response.Headers.Add(resHeader.Key, new StringValues(resHeader.Value.ToArray()));
            }

            await context.Response.Body.WriteAsync(result.Content, 0, result.Content.Length);
        }
Example #4
0
        public ResponseInfo <FeeResponseDatamap> GetFee(string ordertype, string amount, string providerid, int orderfrom, string memberId = null)
        {
            var config             = new ApiSetting(null);
            FeeRequestDatamap info = new FeeRequestDatamap()
            {
                orderType = ordertype, amount = amount, providerCode = providerid, memberId = memberId == null ? config.DefaultMemberId : memberId
            };


            var response = SecurityHttpClient.Post <FeeRequestDatamap, FeeResponseDatamap>(config.JavaFee_Uri, info, orderfrom.ToString(), "v1");

            switch (response.respCode)
            {
            case "CS00002":
                throw new ErrorCodeException(response.respCode, "金额不能为空");

            case "CS00004":
                throw new ErrorCodeException(response.respCode, "请求来源不能为空");

            case "CS00005":
                throw new ErrorCodeException(response.respCode, "订单类型不能为空");

            case "00006":
                throw new ErrorCodeException(response.respCode, "版本信息错误");

            case "00002":
                throw new ErrorCodeException(response.respCode, "Java获取数据超时,请稍后重试!");
            }
            return(response);
        }
 public DocumentsServices(IOptions <ExternalApiSetting> externalApiSetting, IOptions <ApiSetting> apiSetting, ISdsService sdsService, IFhirConnector fhirConnector)
 {
     _spineSettings = externalApiSetting.Value;
     _apiSettings   = apiSetting.Value;
     _sdsService    = sdsService;
     _fhirConnector = fhirConnector;
 }
Example #6
0
 public Api(ApiSetting setting)
 {
     _locker          = new ManualResetEvent(true);
     _setting         = setting;
     _responseHandler = new ApiResponseHandler(this);
     _globalHandlers  = new ConcurrentDictionary <Type, Action <BaseObject> >();
     functions        = new Functions(this);
 }
 public PointerService(IOptions <ApiSetting> apiSetting, IDocumentReferenceServices docRefService, IPatientServices patientService, IOrganisationServices organisationServices, IMemoryCache cache, IDocumentsServices docService)
 {
     _apiSetting           = apiSetting.Value;
     _docRefService        = docRefService;
     _patientService       = patientService;
     _organisationServices = organisationServices;
     _cache      = cache;
     _docService = docService;
 }
Example #8
0
        public ResponseInfo <GetOrdersDatamap> Gets(GetOrdersCondition condition)
        {
            var config   = new ApiSetting(null);
            var response = SecurityHttpClient.Post <GetOrdersCondition, GetOrdersDatamap>(config.JavaOrder_Uri + "queryOrders", condition);

            if (response.respCode != "0")
            {
                throw new ApplicationException(response.respMsg);
            }
            return(response);
        }
Example #9
0
        public static IWebHost BuildWebHost(string[] args)
        {
            var config = GetConfigurationRoot();

            ApiSetting apiSettings = new ApiSetting();

            config.GetSection("DemonstratorApi").Bind(apiSettings);

            return(WebHost.CreateDefaultBuilder(args)
                   .UseKestrel(options =>
            {
                options.AddServerHeader = false;
                // if we use the apiSettings.Secure flag we can toggle the below
                // for demo we will leave both open


                // listen for HTTP
                if (!apiSettings.SecureOnly)
                {
                    options.Listen(IPAddress.Any, int.Parse(apiSettings.DefaultPort));
                }


                // listen for HTTPS
                if (apiSettings.Secure)
                {
                    var certificate = ServerCertificate();

                    if (certificate != null)
                    {
                        options.Listen(IPAddress.Any, int.Parse(apiSettings.SecurePort), listenOptions =>
                        {
                            listenOptions.UseHttps(new HttpsConnectionAdapterOptions
                            {
                                SslProtocols = SslProtocols.Tls12,
                                CheckCertificateRevocation = false,     //TODO: turn this on
                                ClientCertificateMode = ClientCertificateMode.NoCertificate,
                                ServerCertificate = certificate
                            });
                        });
                    }
                }
            })
                   .ConfigureLogging((hostingContext, logging) =>
            {
                logging.AddConfiguration(hostingContext.Configuration.GetSection("Logging"));
                logging.AddConsole();
                //logging.AddDebug();

                //TODO: add log persistence store
            })
                   .UseStartup <Startup>()
                   .Build());
        }
Example #10
0
        public ResponseInfo <CreateOrderOrderResult> CreateMallOrder(MallOrderInfos orderinfos)
        {
            _log.Debug("order data:" + JsonConvert.SerializeObject(orderinfos));
            var config   = new ApiSetting(null);
            var response = SecurityHttpClient.Post <MallOrderInfos, CreateOrderOrderResult>(config.JavaOrder_Uri + "generateOrder", orderinfos);

            if (response.respCode != "0")
            {
                throw new ApplicationException(response.respMsg);
            }
            return(response);
        }
Example #11
0
        public async SystemTasks.Task Invoke(HttpContext context, IOptionsSnapshot <ApiSetting> nrlsApiSettings)
        {
            CheckRequestRequirements(context);

            _nrlsApiSettings = nrlsApiSettings.Get("NrlsApiSetting");

            var formatKey = "_format";
            var acceptKey = HeaderNames.Accept;

            var parameters = context.Request.QueryString.Value.GetParameters();

            bool   hasFormatParam = parameters?.FirstOrDefault(x => x.Item1 == "_format") != null;
            string formatParam    = parameters != null?parameters.GetParameter(formatKey) : null;

            string acceptHeader    = null;
            bool   hasAcceptHeader = context.Request.Headers.ContainsKey(acceptKey);

            if (hasAcceptHeader)
            {
                acceptHeader = context.Request.Headers[acceptKey];
            }

            var validFormatParam  = !hasFormatParam || (!string.IsNullOrWhiteSpace(formatParam) && _nrlsApiSettings.SupportedContentTypes.Contains(formatParam));
            var validAcceptHeader = !hasAcceptHeader || (!string.IsNullOrWhiteSpace(acceptHeader) && ValidAccept(acceptHeader));

            if (!validFormatParam && (hasFormatParam || !validAcceptHeader))
            {
                throw new HttpFhirException("Unsupported Media Type", OperationOutcomeFactory.CreateInvalidMediaType(), HttpStatusCode.UnsupportedMediaType);
            }

            if (validFormatParam)
            {
                var accepted = ContentType.GetResourceFormatFromFormatParam(formatParam);
                if (accepted != ResourceFormat.Unknown)
                {
                    var newAcceptHeader = ContentType.XML_CONTENT_HEADER;

                    if (accepted == ResourceFormat.Json)
                    {
                        newAcceptHeader = ContentType.JSON_CONTENT_HEADER;
                    }

                    var header = new MediaTypeHeaderValue(newAcceptHeader);

                    context.Request.Headers.Remove(acceptKey);
                    context.Request.Headers.Add(acceptKey, new StringValues(header.ToString()));
                }
            }

            await this._next(context);
        }
        public async SystemTasks.Task Invoke(HttpContext context, IOptionsSnapshot <ApiSetting> nrlsApiSettings)
        {
            _nrlsApiSettings = nrlsApiSettings.Get("NrlsApiSetting");


            //Order of validation is Important
            var request = context.Request;
            var headers = request.Headers;
            var method  = request.Method;


            //Accept is optional but must be valid if supplied
            //Check is delegated to FhirInputMiddleware


            var authorization = GetHeaderValue(headers, HeaderNames.Authorization);
            var scope         = method == HttpMethods.Get ? JwtScopes.Read : JwtScopes.Write;
            var jwtResponse   = _nrlsValidation.ValidJwt(new Tuple <JwtScopes, string>(scope, "DocumentReference"), authorization);

            if (string.IsNullOrEmpty(authorization) || !jwtResponse.Success)
            {
                SetJwtError(HeaderNames.Authorization, jwtResponse.Message);
            }

            var fromASID    = GetHeaderValue(headers, FhirConstants.HeaderFromAsid);
            var clientCache = _sdsService.GetFor(fromASID);

            if (clientCache == null)
            {
                SetError(FhirConstants.HeaderFromAsid, null);
            }

            var toASID = GetHeaderValue(headers, FhirConstants.HeaderToAsid);

            if (string.IsNullOrEmpty(toASID) || toASID != _spineSettings.Asid)
            {
                SetError(FhirConstants.HeaderToAsid, null);
            }

            var interactionId = GetInteractionId(method, request.Path.Value);

            if (string.IsNullOrEmpty(interactionId) || !clientCache.Interactions.Contains(interactionId))
            {
                throw new HttpFhirException("Client interaction request invalid", OperationOutcomeFactory.CreateAccessDenied(), HttpStatusCode.Forbidden);
            }

            //We've Passed! Continue to App...
            await _next.Invoke(context);

            return;
        }
Example #13
0
        public void HandleShip(string orderid, string memberid)
        {
            var config             = new ApiSetting(null);
            HandleShipRequest info = new HandleShipRequest()
            {
                orderId = orderid, memberId = memberid
            };
            var response = SecurityHttpClient.Post <HandleShipRequest, HandleShipResponse>(config.JavaOrder_Uri + "convenShipping", info, "1", "v1");

            if (response.respCode != "0")
            {
                throw new ApplicationException(response.respMsg);
            }
        }
        public async Task Invoke(HttpContext context, IOptionsSnapshot <ApiSetting> apiSettings)
        {
            _nrlsApiSetting = apiSettings.Get("NrlsApiSetting");

            //Fake SSP Interaction/ASID datastore

            if (_nrlsApiSetting.Secure && context.Request.IsHttps)
            {
                var clientAsidMap     = _cache.Get <ClientAsidMap>(ClientAsidMap.Key);
                var clientCertificate = context.Connection.ClientCertificate;

                using (var store = new X509Store(StoreName.My, StoreLocation.CurrentUser))
                {
                    //Get ASID
                    var fromAsid = GetHeaderValue(context.Request.Headers, FhirConstants.HeaderFromAsid);
                    if (string.IsNullOrEmpty(fromAsid) || clientCertificate == null)
                    {
                        SetError();
                    }

                    //Check Certificate
                    store.Open(OpenFlags.ReadOnly);

                    var clientCertificates = store.Certificates.Find(X509FindType.FindByThumbprint, clientCertificate.Thumbprint, false);
                    if (clientCertificates.Count < 1)
                    {
                        SetError();
                    }

                    //Check client ASID Thumbprint against Supplied Certificate Thumbprint
                    var clientmap = _cache.Get <ClientAsidMap>(ClientAsidMap.Key);

                    if (clientmap != null)
                    {
                        var client = clientmap.ClientAsids.FirstOrDefault(x => x.Key == fromAsid);

                        if (client.Value != null && client.Value.Thumbprint.ToLowerInvariant() != clientCertificate.Thumbprint.ToLowerInvariant())
                        {
                            SetError();
                        }
                    }
                }
            }


            await _next.Invoke(context);

            return;
        }
Example #15
0
        public ResponseInfo <CancelOrderDatamap> Cancel(string orderid, string memberid)
        {
            CancelOrderInfo info = new CancelOrderInfo()
            {
                memberId = memberid, orderId = orderid
            };
            ApiSetting setting  = new ApiSetting(null);
            var        response = SecurityHttpClient.Post <CancelOrderInfo, CancelOrderDatamap>(setting.JavaOrder_Uri + "cancel", info);

            if (response.respCode != "0")
            {
                throw new ApplicationException(response.respMsg);
            }
            return(response);
        }
Example #16
0
        public ResponseInfo <RefundOrderDatamap> Refund(string orderid, string memberid)
        {
            RefundOrderInfo info = new RefundOrderInfo()
            {
                orderId = orderid
            };
            var config   = new ApiSetting(null);
            var response = SecurityHttpClient.Post <RefundOrderInfo, RefundOrderDatamap>(config.JavaOrder_Uri + "orderStatusRefund", info);

            if (response.respCode != "0")
            {
                throw new ApplicationException(response.respMsg);
            }
            return(response);
        }
Example #17
0
        public ResponseInfo <TransferorderDatamap> GetTransferOrderDetail(string orderid, string memberid)
        {
            GetOrderCondition info = new GetOrderCondition()
            {
                memberId = memberid, orderId = orderid
            };
            var config   = new ApiSetting(null);
            var response = SecurityHttpClient.Post <GetOrderCondition, TransferorderDatamap>(config.JavaOrder_Uri + "queryOrdersById", info);

            if (response.respCode != "0")
            {
                throw new ApplicationException(response.respMsg);
            }
            return(response);
        }
Example #18
0
        public async SystemTasks.Task Invoke(HttpContext context, IOptionsSnapshot <ApiSetting> apiSettings)
        {
            CheckRequestRequirements(context);

            _apiSettings = apiSettings.Value;

            var parameters = context.Request.QueryString.Value.GetParameters();

            bool   hasFormatParam = parameters?.FirstOrDefault(x => x.Item1 == "_format") != null;
            string formatParam    = parameters?.GetParameter("_format");

            bool   hasAcceptHeader = context.Request.Headers.ContainsKey(HeaderNames.Accept);
            string acceptHeader    = hasAcceptHeader ? context.Request.Headers[HeaderNames.Accept] : StringValues.Empty;


            var validFormatParam  = !hasFormatParam || ValidContentType(formatParam);
            var validAcceptHeader = !hasAcceptHeader || ValidContentType(acceptHeader);

            if (!validFormatParam && (hasFormatParam || !validAcceptHeader))
            {
                throw new HttpFhirException("Unsupported Media Type", OperationOutcomeFactory.CreateInvalidMediaType(), HttpStatusCode.UnsupportedMediaType);
            }

            if (validFormatParam)
            {
                var accepted = ContentType.GetResourceFormatFromFormatParam(formatParam);
                if (accepted != ResourceFormat.Unknown)
                {
                    var newAcceptHeader = ContentType.XML_CONTENT_HEADER;

                    if (accepted == ResourceFormat.Json)
                    {
                        newAcceptHeader = ContentType.JSON_CONTENT_HEADER;
                    }

                    var header = new MediaTypeHeaderValue(newAcceptHeader);

                    context.Request.Headers.Remove(HeaderNames.Accept);
                    context.Request.Headers.Add(HeaderNames.Accept, new StringValues(header.ToString()));
                }
            }

            //TODO: add default switch on controller
            context.Request.Headers.Remove(FhirConstants.HeaderXFhirDefault);
            context.Request.Headers.Add(FhirConstants.HeaderXFhirDefault, ContentType.XML_CONTENT_HEADER);

            await _next(context);
        }
Example #19
0
        private IExchangeApi GetExchange(Bot bot)
        {
            ApiSetting exchangeSetting = bot.User.ApiSettings.FirstOrDefault(x => x.Exchange.ExchangeId == bot.Exchange.ExchangeId);

            return
                (ExchangeFactory.GetExchangeApi((Enumerations.ExchangesEnum)bot.Exchange.ExchangeId, new ExchangeSettings
            {
                Url = exchangeSetting.Url,
                SocketUrl = exchangeSetting.SocketUrl,
                PassPhrase = exchangeSetting.Passphrase,
                ApiKey = exchangeSetting.Key,
                Secret = exchangeSetting.Secret,
                CommissionRate = exchangeSetting.ComissionRate,
                Simulate = exchangeSetting.Simulated
            }));
        }
Example #20
0
        public ResponseInfo <FinishOrderDatamap> Finish(string orderid, string memberid, string provideid)
        {
            FinishOrderInfo info = new FinishOrderInfo()
            {
                memberId = memberid, orderId = orderid, providerId = provideid
            };

            var config   = new ApiSetting(null);
            var response = SecurityHttpClient.Post <FinishOrderInfo, FinishOrderDatamap>(config.JavaOrder_Uri + "finishedCall", info);

            if (response.respCode != "0")
            {
                throw new ApplicationException(response.respMsg);
            }
            return(response);
        }
Example #21
0
        public ResponseInfo <UpdateProviderResopneBody> UpdateProvider(string orderid, string memberid, string providerid)
        {
            var info = new SendSupplierBody()
            {
                memberId   = memberid,
                orderId    = orderid,
                providerId = providerid
            };
            var config   = new ApiSetting(null);
            var response = SecurityHttpClient.Post <SendSupplierBody, UpdateProviderResopneBody>(config.JavaOrder_Uri + "updateProviderId", info);

            if (response.respCode != "0")
            {
                throw new ApplicationException(response.respMsg);
            }
            return(response);
        }
Example #22
0
        public Core(bool debugMode, Action <string, string> logger, ApiSetting apiSetting)
        {
            this.debugMode = debugMode;
            _token         = _tokenSource.Token;

            // handling multi thread
            ThreadPool.GetAvailableThreads(out int wT, out int cT);
            ThreadPool.SetMinThreads(wT, cT);
            ThreadPool.SetMaxThreads(wT, cT);

            // running logger
            Logger.setLogger(logger);
            Logger.Run(_token, debugMode);

            // initializing api instance
            api = new Api(apiSetting);
        }
Example #23
0
        public async SystemTasks.Task Invoke(HttpContext context, IOptionsSnapshot <ApiSetting> nrlsApiSettings)
        {
            _nrlsApiSettings = nrlsApiSettings.Get("NrlsApiSetting");


            //Order of validation is Important
            var request = context.Request;
            var headers = request.Headers;
            var method  = request.Method;


            //Accept is optional but must be valid if supplied
            //Check is delegated to FhirInputMiddleware


            var authorization = GetHeaderValue(headers, HeaderNames.Authorization);
            var scope         = method == HttpMethods.Get ? JwtScopes.Read : JwtScopes.Write;
            var jwtResponse   = _nrlsValidation.ValidJwt(scope, authorization);

            if (string.IsNullOrEmpty(authorization) || !jwtResponse.Success)
            {
                SetJwtError(HeaderNames.Authorization, jwtResponse.Message);
            }

            var fromASID = GetHeaderValue(headers, FhirConstants.HeaderFromAsid);

            if (string.IsNullOrEmpty(fromASID) || GetFromAsidMap(fromASID) == null)
            {
                SetError(FhirConstants.HeaderFromAsid, null);
            }

            var toASID = GetHeaderValue(headers, FhirConstants.HeaderToAsid);

            if (string.IsNullOrEmpty(toASID) || toASID != _spineSettings.Asid)
            {
                SetError(FhirConstants.HeaderToAsid, null);
            }

            //We've Passed! Continue to App...
            await _next.Invoke(context);

            return;
        }
        public FhirInputMiddlewareTests()
        {
            var opts = new ApiSetting
            {
                BaseUrl               = "://localhost.com",
                Secure                = false,
                SecureOnly            = false,
                DefaultPort           = "51913",
                SecurePort            = "44313",
                SupportedContentTypes = new List <string> {
                    "application/fhir+json"
                }
            };

            var settingsMock = new Mock <IOptionsSnapshot <ApiSetting> >();

            settingsMock.Setup(op => op.Value).Returns(opts);

            _apiSettings = settingsMock.Object;
        }
Example #25
0
        /// <summary>
        /// 通知发货失败
        /// </summary>
        /// <param name="orderid">订单号</param>
        /// <param name="memberid">会员号</param>
        /// <param name="errormessage">错误信息</param>
        /// <param name="isReverseFail">是否冲正失败</param>
        public void NotifyShipFail(string orderid, string memberid, string errormessage, bool isReverseFail)
        {
            var             config = new ApiSetting(null);
            ShipFailRequest info   = new ShipFailRequest()
            {
                orderId = orderid, memberId = memberid
            };

            info.orderSubStatus = "2";
            if (isReverseFail)
            {
                info.orderSubStatus = "3";
            }
            info.failReason = errormessage;
            var response = SecurityHttpClient.Post <ShipFailRequest, ShipFailResponse>(config.JavaOrder_Uri + "convenShippingFail", info, "1", "v1");

            if (response.respCode != "0")
            {
                throw new ApplicationException(response.respMsg);
            }
        }
Example #26
0
 public FhirExceptionMiddleware(IHostingEnvironment env, IOptionsSnapshot <ApiSetting> nrlsApiSettings)
 {
     _env             = env;
     _nrlsApiSettings = nrlsApiSettings.Get("NrlsApiSetting");
 }
 public ApplicationFilesController(IApplication_FilesRepository applicationFilesRepository, IOptions <ApiSetting> setting, IHostingEnvironment hostingEnvironement)
 {
     _applicationFilesRepository = applicationFilesRepository;
     _apiSetting        = setting.Value;
     _hostingEnviroment = hostingEnvironement;
 }
 public NrlsController(IOptionsSnapshot <ApiSetting> apiSettings, INrlsSearch nrlsSearch, INrlsMaintain nrlsMaintain)
 {
     _nrlsSearch      = nrlsSearch;
     _nrlsMaintain    = nrlsMaintain;
     _nrlsApiSettings = apiSettings.Get("NrlsApiSetting");
 }
Example #29
0
 public static void Main(string[] args)
 {
     ApiSetting.LoadApis();
     CreateWebHostBuilder(args).Build().Run();
 }
Example #30
0
        public static SignInfo BuildSignList(SortedList <string, object> values, string version, string reqfrom, string createdate = null)
        {
            DateTime signTime = DateTime.Now;
            object   memberid = string.Empty;

            if (values != null)
            {
                values.TryGetValue("memberId", out memberid);
            }
            else
            {
                values = new SortedList <string, object>();
            }
            ApiSetting config   = new ApiSetting(null);
            string     password = string.Empty;

            if (memberid == null || string.IsNullOrEmpty(memberid.ToString()))
            {
                memberid = config.DefaultMemberId;
                password = config.DefaultMemberPwd;
            }
            if (string.IsNullOrWhiteSpace(password))
            {
                password = MemberPwdManager.GetPassword(memberid.ToString());
            }
            var datetime = signTime.ToString(DateTimeFormat);

            if (!string.IsNullOrWhiteSpace(createdate))
            {
                datetime = createdate;
            }
            ILog log = LogManager.GetLogger(typeof(SignBuilder));

            log.InfoFormat("user:{0} password:{1}", memberid, password);
            values.Add("reqTime", datetime);

            if (!string.IsNullOrWhiteSpace(version))
            {
                values.Add("version", version);
            }
            if (!string.IsNullOrWhiteSpace(reqfrom))
            {
                values.Add("reqFrom", reqfrom);
            }
            //values.Add("", password);
            var stringtosign = string.Empty;
            var x            = values.OrderBy(o => o.Key);

            foreach (var keyvaluepair in x)
            {
                if (keyvaluepair.Value is string)
                {
                    string value = "";
                    value = keyvaluepair.Value.ToString();
                    if (!string.IsNullOrWhiteSpace(value))
                    {
                        if (!string.IsNullOrWhiteSpace(stringtosign))
                        {
                            stringtosign += "&";
                        }
                        stringtosign += keyvaluepair.Key + "=" + value;
                    }
                }
            }
            var encyptstring =
                MD5.Encrypt(AES.Encrypt(password, MD5.Encrypt(memberid + datetime).Substring(0, 16)));

            stringtosign += encyptstring;

            var sign     = MD5.Encrypt(stringtosign);
            var singinfo = new SignInfo()
            {
                ReqTime = datetime, Sign = sign
            };

            return(singinfo);
        }