private async void cmdRemove_Clicked(object sender, EventArgs e)
        {
            if (lstInventoryItems.SelectedItem == null)
            {
                await App.Current.MainPage.DisplayAlert("Error", "No item selected", "OK");

                return;
            }

            try
            {
                gridProgress.IsVisible = true;
                await Task.Run(async() =>
                {
                    DCEMVDemoServerClient client = SessionSingleton.GenDCEMVServerApiClient();
                    using (SessionSingleton.HttpClient)
                    {
                        await client.StoreInventoryitemDeleteAsync(((InventoryItem)lstInventoryItems.SelectedItem).InventoryItemId);
                        Device.BeginInvokeOnMainThread(() =>
                        {
                            items.Remove((InventoryItemDetailViewModel)lstInventoryItems.SelectedItem);
                        });
                    }
                });
            }
            catch (Exception ex)
            {
                await App.Current.MainPage.DisplayAlert("Error", ex.Message, "OK");
            }
            finally
            {
                gridProgress.IsVisible = false;
            }
        }
示例#2
0
 private async Task CallTransactByQRCodeWebService(string fromAccountNumber, string toAccountNumber, long?amount, string trackingId)
 {
     Device.BeginInvokeOnMainThread(() =>
     {
         gridProgress.IsVisible = true;
     });
     try
     {
         Proxies.DCEMVDemoServerClient client = SessionSingleton.GenDCEMVServerApiClient();
         using (SessionSingleton.HttpClient)
         {
             QRCodeTransferTransaction tx = new QRCodeTransferTransaction()
             {
                 Amount      = amount.Value,
                 AccountFrom = fromAccountNumber,
                 AccountTo   = toAccountNumber,
                 TrackingId  = trackingId,
             };
             await client.TransactionQrcodetransferPostAsync(tx.ToJsonString());
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
     finally
     {
         Device.BeginInvokeOnMainThread(() =>
         {
             gridProgress.IsVisible = false;
         });
     }
 }
示例#3
0
 private async void cmdRemovePhoneNumber_Clicked(object sender, EventArgs e)
 {
     try
     {
         gridProgress.IsVisible = true;
         await Task.Run(async() =>
         {
             DCEMVDemoServerClient client = SessionSingleton.GenDCEMVServerApiClient();
             using (SessionSingleton.HttpClient)
             {
                 await client.ProfileRemovephonenumberPostAsync();
                 profile.PhoneNumber = null;
                 UpdataView();
             }
         });
     }
     catch (Exception ex)
     {
         await App.Current.MainPage.DisplayAlert("Error", ex.Message, "OK");
     }
     finally
     {
         gridProgress.IsVisible = false;
     }
 }
示例#4
0
 private async Task CallTopUpWebService(string toAccountNumber, long?amount, string cvv, TLV emvData)
 {
     Device.BeginInvokeOnMainThread(() =>
     {
         gridProgress.IsVisible = true;
     });
     try
     {
         Proxies.DCEMVDemoServerClient client = SessionSingleton.GenDCEMVServerApiClient();
         using (SessionSingleton.HttpClient)
         {
             CCTopUpTransaction tx = new CCTopUpTransaction()
             {
                 Amount   = amount.Value,
                 CVV      = cvv,
                 EMV_Data = TLVasJSON.ToJSON(emvData),
             };
             await client.TransactionTopupPostAsync(tx.ToJsonString());
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
     finally
     {
         Device.BeginInvokeOnMainThread(() =>
         {
             gridProgress.IsVisible = false;
         });
     }
 }
示例#5
0
        private async void cmdPhoneAddOk_Clicked(object sender, EventArgs e)
        {
            try
            {
                gridProgress.IsVisible = true;
                await Task.Run(async() =>
                {
                    DCEMVDemoServerClient client = SessionSingleton.GenDCEMVServerApiClient();
                    using (SessionSingleton.HttpClient)
                    {
                        await client.ProfileAddphonenumberPostAsync(txtPhoneNumber.Text);
                        Device.BeginInvokeOnMainThread(() =>
                        {
                            gridProgress.IsVisible = false;

                            gridConfirmCode.IsVisible = true;
                            ctlConfirmCode.Init(TerminalCommon.CodeType.PhoneNumber);
                            ctlConfirmCode.PhoneNumber = txtPhoneNumber.Text;
                            ctlConfirmCode.OTP         = "";
                            gridAddPhone.IsVisible     = false;
                            gridPhoneAdmin.IsVisible   = false;
                        });
                    }
                });
            }
            catch (Exception ex)
            {
                await App.Current.MainPage.DisplayAlert("Error", ex.Message, "OK");
            }
            finally
            {
                gridProgress.IsVisible = false;
            }
        }
示例#6
0
 public PhoneNumberAdminView()
 {
     InitializeComponent();
     gridProgress.IsVisible    = true;
     gridAddPhone.IsVisible    = false;
     gridPhoneAdmin.IsVisible  = true;
     gridConfirmCode.IsVisible = false;
     ctlConfirmCode.OKClicked += CtlConfirmCode_OKClicked;
     try
     {
         Task.Run(async() =>
         {
             DCEMVDemoServerClient client = SessionSingleton.GenDCEMVServerApiClient();
             using (SessionSingleton.HttpClient)
             {
                 profile = await client.ProfileGetprofiledetailsGetAsync();
                 UpdataView();
             }
         });
     }
     catch (Exception ex)
     {
         Task.Run(async() => { await App.Current.MainPage.DisplayAlert("Error", ex.Message, "OK"); });
     }
 }
示例#7
0
        public async Task <ObservableCollection <InventoryGroup> > GetInventoryGroups()
        {
            if (groups.Count == 0)
            {
                DCEMVDemoServerClient client = SessionSingleton.GenDCEMVServerApiClient();
                using (SessionSingleton.HttpClient)
                {
                    ObservableCollection <string> list = await client.StoreInventorygroupsGetAsync();

                    ObservableCollection <InventoryGroup> listRet = new ObservableCollection <InventoryGroup>();
                    list.ToList().ForEach(z =>
                    {
                        InventoryGroup igi = InventoryGroup.FromJsonString(z);
                        listRet.Add(igi);
                    });
                    if (list == null)
                    {
                        return(groups);
                    }
                    else
                    {
                        groups = listRet;
                    }
                }
            }

            return(groups);
        }
        private async void cmdUnlink_Clicked(object sender, EventArgs e)
        {
            if (viewCardList.SelectedItem == null)
            {
                await App.Current.MainPage.DisplayAlert("Error", "No card selected", "OK");

                return;
            }

            try
            {
                gridProgress.IsVisible = true;
                await Task.Run(async() =>
                {
                    Proxies.DCEMVDemoServerClient client = SessionSingleton.GenDCEMVServerApiClient();
                    using (SessionSingleton.HttpClient)
                    {
                        await client.CardCancelcardPostAsync(((Card)viewCardList.SelectedItem).CardSerialNumberId);
                        Device.BeginInvokeOnMainThread(() =>
                        {
                            ((Card)viewCardList.SelectedItem).CardState = CardState.Cancelled;
                        });
                    }
                });
            }
            catch (Exception ex)
            {
                await App.Current.MainPage.DisplayAlert("Error", ex.Message, "OK");
            }
            finally
            {
                gridProgress.IsVisible = false;
            }
        }
 private async Task RegisterCard(string accountNumberId, string cardSerialNumber)
 {
     Device.BeginInvokeOnMainThread(() =>
     {
         gridProgress.IsVisible = true;
     });
     try
     {
         Proxies.DCEMVDemoServerClient client = SessionSingleton.GenDCEMVServerApiClient();
         using (SessionSingleton.HttpClient)
         {
             await client.CardRegistercardPostAsync(cardSerialNumber);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
     finally
     {
         Device.BeginInvokeOnMainThread(() =>
         {
             gridProgress.IsVisible = false;
         });
     }
 }
示例#10
0
 private async void CmdOk_Clicked(object sender, EventArgs e)
 {
     try
     {
         gridProgress.IsVisible = true;
         await Task.Run(async() =>
         {
             DCEMVDemoServerClient client = SessionSingleton.GenDCEMVServerApiClient();
             using (SessionSingleton.HttpClient)
             {
                 await client.ProfileChangepasswordPostAsync(txtOldPassword.Text, txtPassword.Text);
                 Password    = txtPassword.Text;
                 IsCancelled = false;
                 ClosePage();
             }
         });
     }
     catch (Exception ex)
     {
         await App.Current.MainPage.DisplayAlert("Error", ex.Message, "OK");
     }
     finally
     {
         gridProgress.IsVisible = false;
     }
 }
示例#11
0
 private async void cmdOk_Clicked(object sender, EventArgs e)
 {
     try
     {
         gridProgress.IsVisible = true;
         await Task.Run(async() =>
         {
             DCEMVDemoServerClient client = SessionSingleton.GenDCEMVServerApiClient();
             using (SessionSingleton.HttpClient)
             {
                 CallBackUrl callbackUrl = await client.ProfileRegisterPostAsync(txtEmail.Text, txtPassword.Text);
                 Device.BeginInvokeOnMainThread(() =>
                 {
                     txtEmail.Text = callbackUrl.Url;
                     //ClosePage();
                 });
             }
         });
     }
     catch (Exception ex)
     {
         await App.Current.MainPage.DisplayAlert("Error", ex.Message, "OK");
     }
     finally
     {
         gridProgress.IsVisible = false;
     }
 }
示例#12
0
 private async Task <bool> CallTransactGetStateWebService(string trackingId)
 {
     Device.BeginInvokeOnMainThread(() =>
     {
         gridProgress.IsVisible = true;
     });
     try
     {
         Proxies.DCEMVDemoServerClient client = SessionSingleton.GenDCEMVServerApiClient();
         using (SessionSingleton.HttpClient)
         {
             return(await client.TransactionGettransactionstateGetAsync(trackingId));
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
     finally
     {
         Device.BeginInvokeOnMainThread(() =>
         {
             gridProgress.IsVisible = false;
         });
     }
 }
        private async void CtlConfirmCode_OKClicked(object sender, EventArgs e)
        {
            try
            {
                gridProgress.IsVisible = true;
                await Task.Run(async() =>
                {
                    DCEMVDemoServerClient client = SessionSingleton.GenDCEMVServerApiClient();
                    using (SessionSingleton.HttpClient)
                    {
                        switch (ctlConfirmCode.CodeType)
                        {
                        case CodeType.EmailAddress:
                            await client.ProfileConfirmemailPostAsync(ctlConfirmCode.EmailAddress, ctlConfirmCode.OTP);
                            break;

                        case CodeType.PhoneNumber:
                            await client.ProfileVerifyphonenumberPostAsync(ctlConfirmCode.PhoneNumber, ctlConfirmCode.OTP);
                            break;
                        }
                    }
                });
            }
            catch (Exception ex)
            {
                await App.Current.MainPage.DisplayAlert("Error", ex.Message, "OK");
            }
            finally
            {
                gridProgress.IsVisible = false;
            }
        }
        private async void cmdAddEditOk_Clicked(object sender, EventArgs e)
        {
            try
            {
                gridProgress.IsVisible = true;
                InventoryGroup group = (pickGroup.SelectedItem as InventoryGroup);
                InventoryItem.InventoryGroupIdRef = group.InventoryGroupId;
                InventoryItem ii = new InventoryItem()
                {
                    Name                = InventoryItem.Name,
                    Description         = InventoryItem.Description,
                    Barcode             = InventoryItem.Barcode,
                    InventoryGroupIdRef = InventoryItem.InventoryGroupIdRef,
                    Price               = InventoryItem.Price
                };
                DCEMVDemoServerClient client = SessionSingleton.GenDCEMVServerApiClient();
                using (SessionSingleton.HttpClient)
                {
                    switch (updateType)
                    {
                    case UpdateType.Add:
                        int id = await client.StoreInventoryitemPostAsync(ii.ToJsonString());

                        InventoryItem.InventoryItemId = id;

                        items.Add(InventoryItem);
                        UpdataView();     //TODO:needed because of bug? in xamarin forms, edited field does not display

                        break;

                    case UpdateType.Update:
                        InventoryItem.InventoryGroupIdRef = group.InventoryGroupId;
                        ii.InventoryItemId = InventoryItem.InventoryItemId;
                        await client.StoreInventoryitemPutAsync(ii.ToJsonString());

                        InventoryItem selectedItem = (InventoryItem)lstInventoryItems.SelectedItem;
                        selectedItem.Name                = InventoryItem.Name;
                        selectedItem.Description         = InventoryItem.Description;
                        selectedItem.Barcode             = InventoryItem.Barcode;
                        selectedItem.Price               = InventoryItem.Price;
                        selectedItem.InventoryGroupIdRef = InventoryItem.InventoryGroupIdRef;

                        UpdataView();     //TODO:needed because of bug? in xamarin forms, edited field does not display

                        break;
                    }
                }
                gridInventoryItemList.IsVisible = true;
                gridAddEdit.IsVisible           = false;
            }
            catch (Exception ex)
            {
                await App.Current.MainPage.DisplayAlert("Error", ex.Message, "OK");
            }
            finally
            {
                gridProgress.IsVisible = false;
            }
        }
示例#15
0
        private static async Task LoadAccountEx()
        {
            Proxies.DCEMVDemoServerClient client = SessionSingleton.GenDCEMVServerApiClient();
            using (SessionSingleton.HttpClient)
            {
                Proxies.Account accountJson = await client.AccountGetAsync();

                Account account = Account.FromJsonString(accountJson.ToJson());
                SessionSingleton.Account = account;
            }
        }
        private async Task <Account> CallGetTransactionsWebService()
        {
            try
            {
                Proxies.DCEMVDemoServerClient client = SessionSingleton.GenDCEMVServerApiClient();
                using (SessionSingleton.HttpClient)
                {
                    Proxies.Account ret = await client.TransactionsGetAsync();

                    return(Account.FromJsonString(ret.ToJson()));
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        private async void cmdOk_Clicked(object sender, EventArgs e)
        {
            try
            {
                gridProgress.IsVisible = true;
                await Task.Run(async() =>
                {
                    Proxies.DCEMVDemoServerClient client = SessionSingleton.GenDCEMVServerApiClient();
                    using (SessionSingleton.HttpClient)
                    {
                        account.CustomerType = MapPickerValue();
                        switch (account.CustomerType)
                        {
                        case CustomerType.Individual:
                            await client.AccountUpdateindividualaccountdetailsPostAsync(account.ToJsonString());

                            SessionSingleton.Account.AccountState = 0;
                            SessionSingleton.Account.CustomerType = account.CustomerType;
                            SessionSingleton.Account.FirstName    = account.FirstName;
                            SessionSingleton.Account.LastName     = account.LastName;
                            break;

                        case CustomerType.Business:
                            await client.AccountUpdatebusinessaccountdetailsPostAsync(account.ToJsonString());

                            SessionSingleton.Account.AccountState     = 0;
                            SessionSingleton.Account.CustomerType     = account.CustomerType;
                            SessionSingleton.Account.BusinessName     = account.BusinessName;
                            SessionSingleton.Account.CompanyRegNumber = account.CompanyRegNumber;
                            SessionSingleton.Account.TaxNumber        = account.TaxNumber;
                            break;
                        }
                    }
                    ClosePage();
                });
            }
            catch (Exception ex)
            {
                await App.Current.MainPage.DisplayAlert("Error", ex.Message, "OK");
            }
            finally
            {
                gridProgress.IsVisible = false;
            }
        }
示例#18
0
        private async void cmdEditCardOk_Clicked(object sender, EventArgs e)
        {
            try
            {
                gridProgress.IsVisible = true;
                Card cardDto = new Card()
                {
                    CardSerialNumberId = card.CardSerialNumberId,
                    FreindlyName       = card.FreindlyName,
                    DailySpendLimit    = Convert.ToInt64(card.DailySpendLimit),
                    MonthlySpendLimit  = Convert.ToInt64(card.MonthlySpendLimit)
                };
                await Task.Run(async() =>
                {
                    Proxies.DCEMVDemoServerClient client = SessionSingleton.GenDCEMVServerApiClient();
                    using (SessionSingleton.HttpClient)
                    {
                        await client.CardUpdatecarddetailsPostAsync(cardDto.ToJsonString());

                        Card cardRepo              = SessionSingleton.Account.Cards.ToList().Find(x => x.CardSerialNumberId == card.CardSerialNumberId);
                        cardRepo.FreindlyName      = card.FreindlyName;
                        cardRepo.DailySpendLimit   = Convert.ToInt64(card.DailySpendLimit);
                        cardRepo.MonthlySpendLimit = Convert.ToInt64(card.MonthlySpendLimit);
                    }
                    Device.BeginInvokeOnMainThread(() =>
                    {
                        viewCardList.ItemsSource = null;
                        viewCardList.ItemsSource = SessionSingleton.Account.Cards;
                        UpdateView(CardAdminViewState.CardList);
                    });
                });
            }
            catch (Exception ex)
            {
                await App.Current.MainPage.DisplayAlert("Error", ex.Message, "OK");
            }
            finally
            {
                gridProgress.IsVisible = false;
            }
        }
示例#19
0
        private async Task CallPosTransactWebService(string fromAccountNumber, string toAccountNumber, string cardSerialNumberFrom, string cardSerialNumberTo, long?amount, TransactionType transactionType, TLV emvData)
        {
            Device.BeginInvokeOnMainThread(() =>
            {
                gridProgress.IsVisible = true;
            });
            try
            {
                Proxies.DCEMVDemoServerClient client = SessionSingleton.GenDCEMVServerApiClient();
                using (SessionSingleton.HttpClient)
                {
                    POSTransaction posTx = new POSTransaction();
                    posTx.InvItems = ConvertLineItems(basketItems.ToList());

                    CardTransferTransaction tx = new CardTransferTransaction()
                    {
                        Amount          = amount.Value,
                        AccountFrom     = fromAccountNumber,
                        AccountTo       = toAccountNumber,
                        CardSerialFrom  = cardSerialNumberFrom,
                        CardSerialTo    = cardSerialNumberTo,
                        CardFromEMVData = TLVasJSON.ToJSON(emvData),
                    };
                    await client.StoreSalebycardPostAsync(tx.ToJsonString(), posTx.ToJsonString());
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                Device.BeginInvokeOnMainThread(() =>
                {
                    gridProgress.IsVisible = false;
                });
            }
        }
示例#20
0
        public async Task <ObservableCollection <InventoryItemDetailViewModel> > GetinventoryItems()
        {
            if (items.Count == 0)
            {
                DCEMVDemoServerClient client = SessionSingleton.GenDCEMVServerApiClient();
                using (SessionSingleton.HttpClient)
                {
                    ObservableCollection <string> list = await client.StoreInventoryitemsGetAsync();

                    ObservableCollection <InventoryItemDetailViewModel> listRet = new ObservableCollection <InventoryItemDetailViewModel>();
                    list.ToList().ForEach(z =>
                    {
                        InventoryItem x = InventoryItem.FromJsonString(z);
                        InventoryItemDetailViewModel ivm = new InventoryItemDetailViewModel()
                        {
                            Barcode             = x.Barcode,
                            Description         = x.Description,
                            InventoryGroupIdRef = x.InventoryGroupIdRef,
                            InventoryItemId     = x.InventoryItemId,
                            Name  = x.Name,
                            Price = x.Price,
                        };
                        listRet.Add(ivm);
                    });

                    if (list == null)
                    {
                        return(items);
                    }
                    else
                    {
                        items = listRet;
                    }
                }
            }

            return(items);
        }
示例#21
0
 private async void cmdOk_Clicked(object sender, EventArgs e)
 {
     try
     {
         gridProgress.IsVisible = true;
         await Task.Run(async() =>
         {
             DCEMVDemoServerClient client = SessionSingleton.GenDCEMVServerApiClient();
             using (SessionSingleton.HttpClient)
             {
                 await client.ProfileResendconfirmemailGetAsync(txtEmail.Text);
             }
             ClosePage();
         });
     }
     catch (Exception ex)
     {
         await App.Current.MainPage.DisplayAlert("Error", ex.Message, "OK");
     }
     finally
     {
         gridProgress.IsVisible = false;
     }
 }