Ejemplo n.º 1
0
 protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     base.OnNavigatedTo(e);
     if (e.NavigationMode == NavigationMode.Back && PhoneApplicationService.Current.State.ContainsKey("sessionTimedout"))
     {
         return;
     }
     if ((e.NavigationMode == NavigationMode.Back) && (e.Content.GetType() == typeof(Dashboard)))
     {
         try
         {
             ServiceInvoker.InvokeServiceUsingGet("/api/t360/Invoice/GetDashboardInfo", delegate(object a, ServiceEventArgs serviceEventArgs)
             {
                 ServiceResponse result      = serviceEventArgs.Result;
                 DashboardInfo dashBoardInfo = JsonConvert.DeserializeObject <DashboardInfo>(result.Output);
                 Deployment.Current.Dispatcher.BeginInvoke(() =>
                 {
                     string invoiceCount        = UserData.Instance.AwaitingInvoiceCount = dashBoardInfo.InvoiceCount;
                     invoiceCountLabel.FontSize = 72;
                     if (invoiceCount.Length > 2)
                     {
                         invoiceCountLabel.FontSize = 48;
                     }
                     invoiceCountLabel.Text = UserData.Instance.AwaitingInvoiceCount;
                 });
             }, false);
         }
         catch (Exception ex)
         {
             ShowError((AppException)ex);
         }
     }
 }
Ejemplo n.º 2
0
        private void lbInvoice_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (InvoiceListModel.SelectedIndex < 0)
            {
                return;
            }

            try
            {
                InvoiceModel invoiceModel = (InvoiceModel)lbInvoice.SelectedItem;
                if (IsInMultiSelect)
                {
                    invoiceModel.IsCheckboxChecked = !invoiceModel.IsCheckboxChecked;
                    InvoiceListModel.SelectedIndex = -1;
                }
                else
                {
                    PageInProgress = true;
                    this.ProgressBar.Show();
                    DisableApplicationBar();
                    ServiceInvoker.InvokeServiceUsingGet("/api/t360/networks/invoice/" + invoiceModel.InvoiceId, GetInvoiceSummary, false);
                }
            }
            catch (Exception ex)
            {
                if (ex is AppException)
                {
                    ShowError((AppException)ex);
                }
                else
                {
                    ShowError(new AppException(T360ErrorCodes.UNKNOWN));
                }
            }
        }
Ejemplo n.º 3
0
 private void LoadSettings()
 {
     try
     {
         ServiceInvoker.InvokeServiceUsingGet("/api/t360/Settings/GetSettings", delegate(object a, ServiceEventArgs serviceEventArgs)
         {
             ServiceResponse result = serviceEventArgs.Result;
             if (result.Status)
             {
                 UserSettings userSettings = JsonConvert.DeserializeObject <UserSettings>(result.Output);
                 Deployment.Current.Dispatcher.BeginInvoke(() =>
                 {
                     DisableEvents();
                     preferredCurrencyToggleSwitch.IsChecked = userSettings.IsPreferenceCurrencyEnabled;
                     preferredCurrencyLabel.Text             = string.Format("({0})", userSettings.PreferenceCurrencyCode);
                     EnableEvents();
                 });
             }
             else
             {
                 ShowError(new AppException(result.ErrorDetails), SettingsError);
             }
             PageInProgress = false;
         }, false);
     }
     catch (Exception ex)
     {
         ShowError((AppException)ex);
     }
 }
Ejemplo n.º 4
0
        public static void LogOff()
        {
            ServiceInvoker.InvokeServiceUsingGet("api/t360/Security/DoLogOff", delegate(object a, ServiceEventArgs serviceEventArgs)
            {
                ServiceResponse result = serviceEventArgs.Result;
            }, false);

            PhoneApplicationService.Current.State.Clear();
            UserData.Instance.Clear();
            Credential.Instance.Clear();
            UserActivity.Instance.StopTimer();
            ServiceInvoker.ClearCookies();
        }
Ejemplo n.º 5
0
        private void GetInvoiceSummary(object sender, ServiceEventArgs se)
        {
            ServiceResponse result = se.Result;

            if (result.Status)
            {
                InvoiceSummaryDetails = JsonConvert.DeserializeObject <InvoiceSummary>(result.Output);

                Deployment.Current.Dispatcher.BeginInvoke(() =>
                {
                    try
                    {
                        InvoiceModel invoiceModel = (InvoiceModel)lbInvoice.SelectedItem;
                        ServiceInvoker.InvokeServiceUsingGet("/api/t360/networks/invoices/" + invoiceModel.InvoiceId + "/lineitem", GetLineItemList, false);
                    }
                    catch (Exception ex)
                    {
                        if (ex is AppException)
                        {
                            ShowError((AppException)ex);
                        }
                        else
                        {
                            ShowError(new AppException(T360ErrorCodes.UNKNOWN));
                        }
                    }
                });
            }
            else
            {
                List <Error> resultError = result.ErrorDetails;
                ShowError(new AppException(resultError), Constants.InvoiceListError);

                Deployment.Current.Dispatcher.BeginInvoke(() =>
                {
                    lbInvoice.SelectionChanged -= lbInvoice_SelectionChanged;
                    lbInvoice.SelectedIndex     = -1;
                    lbInvoice.SelectionChanged += lbInvoice_SelectionChanged;
                });
                if (resultError[0] != null && T360ErrorCodes.NotInReviewerQueue == resultError[0].Code)
                {
                    Deployment.Current.Dispatcher.BeginInvoke(() =>
                    {
                        LoadInvoiceList();
                    });
                }
            }
        }
Ejemplo n.º 6
0
 private void LoadInvoiceList()
 {
     try
     {
         PageInProgress = true;
         ProgressBar.Show();
         ServiceInvoker.InvokeServiceUsingGet("/api/t360/Invoice/GetAwaitingInvoiceList", GetAwaitingInvoiceList, false);
     }
     catch (Exception ex)
     {
         if (ex is AppException)
         {
             ShowError((AppException)ex);
         }
         else
         {
             ShowError(new AppException(T360ErrorCodes.UNKNOWN));
         }
     }
 }
Ejemplo n.º 7
0
 private void RetrieveLineItemSummary(int index)
 {
     try
     {
         string lineItemId = LineItemList[index].LineItemId.ToString();
         PageInProgress = true;
         this.ProgressBar.Show();
         DisableApplicationBar();
         ServiceInvoker.InvokeServiceUsingGet("/api/t360/networks/invoices/" + HeaderDetails.InvoiceId + "/lineitem/" + lineItemId,
                                              GetLineItemDetails,
                                              false);
     }
     catch (Exception ex)
     {
         if (ex is AppException)
         {
             ShowError((AppException)ex);
         }
         else
         {
             ShowError(new AppException(T360ErrorCodes.UNKNOWN));
         }
     }
 }
Ejemplo n.º 8
0
        private void acceptButton_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            try
            {
                this.ProgressBar.Show();
                PageInProgress = true;
                if (!ServiceInvoker.IsConnected)
                {
                    ShowError(new AppException(T360ErrorCodes.UnableToConnectServer));
                    return;
                }

                ServiceInvoker.InvokeServiceUsingGet("api/t360/Security/AcceptDisclaimer", delegate(object a, ServiceEventArgs serviceEventArgs)
                {
                    ServiceResponse response = serviceEventArgs.Result;

                    if (!response.Status)
                    {
                        if (T360ErrorCodes.PasswordReset.Equals(response.ErrorDetails[0].Code) ||
                            T360ErrorCodes.RequestPasswordReset.Equals(response.ErrorDetails[0].Code) ||
                            T360ErrorCodes.TooSimplePassword.Equals(response.ErrorDetails[0].Code))
                        {
                            Deployment.Current.Dispatcher.BeginInvoke(() =>
                            {
                                Credential credential = Credential.Instance;
                                credential.Rules      = response.ErrorDetails[0].Data;
                                credential.ShowKeepCurrentPassword = T360ErrorCodes.RequestPasswordReset.Equals(response.ErrorDetails[0].Code);
                                Uri uri = new Uri("/Tymetrix.T360.Mobile.Client.AppWP8;component/ResetPassword/ResetPassword.xaml", UriKind.Relative);
                                this.NavigationService.Navigate(uri);
                                this.ProgressBar.Hide();
                            });
                        }
                        else if (T360ErrorCodes.LicenseAgreement.Equals(response.ErrorDetails[0].Code))
                        {
                            Deployment.Current.Dispatcher.BeginInvoke(() =>
                            {
                                ShowError(new AppException(T360ErrorCodes.LicenseAgreement), "Login Failed");
                                this.ProgressBar.Hide();
                                RedirectToLogin();
                            });
                        }
                        else
                        {
                            Deployment.Current.Dispatcher.BeginInvoke(() =>
                            {
                                ShowError(new AppException(response.ErrorDetails), "Login Failed");
                                this.ProgressBar.Hide();
                            });
                        }
                        return;
                    }
                    Deployment.Current.Dispatcher.BeginInvoke(() =>
                    {
                        ProcessUserData(response.Output, "/Tymetrix.T360.Mobile.Client.AppWP8");
                    });
                }, false);
            }
            catch (AppException ex)
            {
                ShowError(ex, "Login Failed");
            }
        }