Пример #1
0
        public async Task <RegisterMasterStoreResponseEntity> RegisterMasterStore(RegisterMasterStoreRequestEntity reqEntity)
        {
            if (!Connectivity.IsInternetAvailable)
            {
                return(new RegisterMasterStoreResponseEntity()
                {
                    StatusCode = (int)GenericStatusValue.NoInternetConnection
                });
            }

            var reqContract = Mapper.Map <RegisterMasterStoreRequestContract>(reqEntity);

            var respContract = await _windowsWebService.RegisterMasterStore(reqContract);

            var respEntity = Mapper.Map <RegisterMasterStoreResponseEntity>(respContract);

            if (respEntity.StatusCode == (int)GenericStatusValue.Success)
            {
                respEntity.TimeZone = reqEntity.SelectedTimeZone;
                string json = JsonConvert.SerializeObject(respEntity);
                json = CryptoEngine.Encrypt(json, Config.SymmetricKey);

                using (var outputFile = new StreamWriter(Config.FilePath + "master-store.json", false, Encoding.UTF8))
                {
                    outputFile.WriteLine(json);
                }

                File.SetAttributes(Config.FilePath + "master-store.json", FileAttributes.Hidden);
            }

            return(respEntity);
        }
Пример #2
0
        public async Task <RegisterMasterStoreResponseEntity> RegisterMasterStore(RegisterMasterStoreRequestEntity reqEntity)
        {
            if (!Connectivity.IsInternetAvailable)
            {
                return(new RegisterMasterStoreResponseEntity()
                {
                    StatusCode = (int)GenericStatusValue.NoInternetConnection
                });
            }

            var reqContract = Mapper.Map <RegisterMasterStoreRequestContract>(reqEntity);

            var respContract = await _windowsWebService.RegisterMasterStore(reqContract);

            var respEntity = Mapper.Map <RegisterMasterStoreResponseEntity>(respContract);

            if (respEntity.StatusCode == (int)GenericStatusValue.Success)
            {
                string json = JsonConvert.SerializeObject(respEntity);

                Config.SaveMasterDataLocal(json);
            }

            return(respEntity);
        }