Exemplo n.º 1
0
        public BaseResponse Ipps(NippsLicenseRequest ippsRequest)
        {
            NippsLicenseResponse response = new NippsLicenseResponse();
            response.Result = Result.OK;
            response.ResultMessages = new List<string>();

            try
            {
                if (ippsRequest == null || string.IsNullOrEmpty(ippsRequest.Version))
                    throw new ArgumentNullException("Request.Version.");

                string[] psParts = ippsRequest.Version.Split(':');
                if (psParts == null || psParts.Length != 2)
                    throw new ArgumentException("Request.Version");

                if (!LicenseWrapper.Valid())
                {
                    response.Result = Result.FAIL;
                    response.ResultMessages.Add(string.Format("License is not VALID."));
                }

                LicenseWrapper.Valid(psParts[0], psParts[1]);
                
            }
            catch (Exception ex)
            {
                Logger.Error("{0}> {1}", ippsRequest.ToString(), ex.ToString());
                response.Result = Result.FAIL;
                response.ResultMessages.Add(ex.ToString());
            }
            return response;
        }
Exemplo n.º 2
0
        public BaseResponse Load(NippsLicenseRequest request)
        {
            NippsLicenseResponse response = new NippsLicenseResponse();
            response.Result = Result.OK;
            response.ResultMessages = new List<string>();

            try
            {
                if (string.IsNullOrEmpty(request.Content))
                {
                    response.Result = Result.FAIL;
                    response.ResultMessages.Add("Request.Content");
                    Logger.Error(response.ResultMessages[0]);
                }
                else
                {
                    if (!LicenseWrapper.Valid(request.Content))
                    {
                        response.Result = Result.FAIL;
                        response.ResultMessages.Add(string.Format("License is not VALID."));
                    }
                }
                    
            }
            catch(Exception ex) 
            {
                Logger.Error(ex.ToString());
                response.Result = Result.FAIL;
                response.ResultMessages.Add(ex.ToString());
            }
            
            return response;
        }
Exemplo n.º 3
0
        public NippsLicenseResponse Get()
        {
            NippsLicenseResponse response = new NippsLicenseResponse();
            response.Result = Result.OK;
            response.ResultMessages = new List<string>();

            try
            {
                if (!LicenseWrapper.Valid())
                {
                    response.Result = Result.FAIL;
                    response.ResultMessages.Add(string.Format("License is not VALID."));
                }

                response.License = LicenseWrapper.License;

            }
            catch (Exception ex)
            {
                Logger.Error(ex.ToString());
                response.Result = Result.FAIL;
                response.ResultMessages.Add(ex.ToString());
            }
            return response;
        }