Exemple #1
0
        private async void SelectYear(object obj)
        {
            var indexYear = (int)obj;

            SelectedYear               = Years[indexYear];
            ChartDescription           = SelectedYear.ToString();
            IsYearSelectionChartActive = true;
            await LoadCharDataPerYear();
        }
 /// <summary>
 /// Performing the licence purchase action.
 /// </summary>
 /// <param name="parm"></param>
 private void OnPurchase(object parm)
 {
     if (!string.IsNullOrEmpty(CardName) && !string.IsNullOrEmpty(CardNumber) && !string.IsNullOrEmpty(SelectedMonth) &&
         !string.IsNullOrEmpty(SelectedYear.ToString()) && !string.IsNullOrEmpty(CardCVV.ToString()))
     {
         var kvp = new Dictionary <string, string>();
         kvp.Add("Amount", "750");
         NavigateNextPage("PurchasePage", kvp);
     }
 }
Exemple #3
0
        /// <summary>
        /// Performing the licence purchase action.
        /// </summary>
        /// <param name="parm"></param>
        private void OnPurchase(object parm)
        {
            if (!string.IsNullOrEmpty(CardName) && !string.IsNullOrEmpty(CardNumber) && !string.IsNullOrEmpty(SelectedMonth) &&
                !string.IsNullOrEmpty(SelectedYear.ToString()) && !string.IsNullOrEmpty(CardCVV.ToString()))
            {
                //Add to cart
                CartItems item = new CartItems();
                item.SubscriptionTypeId = Convert.ToInt32(AppState.Instance.SelectedSubscription.Id);
                item.Quantity           = 1;
                item.DateCreated        = DateTime.Now;
                item.UserId             = AppState.Instance.User.ServerUserId;
                HttpClient client0 = AppState.CreateClient(ServiceType.CentralizeWebApi.ToString());
                client0.DefaultRequestHeaders.Add("Authorization", "Bearer " + AppState.Instance.CentralizedToken.access_token);
                var response = client0.PostAsJsonAsync("api/Cart/Create", item).Result;
                client0.Dispose();
                // ===================

                SubscriptionList userSubscriptionList = null;
                var        serviceType = System.Configuration.ConfigurationManager.AppSettings.Get("ServiceType");
                HttpClient client      = AppState.CreateClient(ServiceType.CentralizeWebApi.ToString());
                client.DefaultRequestHeaders.Add("Authorization", "Bearer " + AppState.Instance.CentralizedToken.access_token);
                response = client.PostAsync("api/cart/OnlinePayment/" + AppState.Instance.User.ServerUserId, null).Result;
                if (response.IsSuccessStatusCode)
                {
                    var jsondata = response.Content.ReadAsStringAsync().Result;
                    if (!string.IsNullOrEmpty(jsondata))
                    {
                        userSubscriptionList = JsonConvert.DeserializeObject <SubscriptionList>(jsondata);
                        string userId = string.Empty;
                        userId = AppState.Instance.User.UserId;
                        List <UserSubscriptionData> subscriptionData = new List <UserSubscriptionData>();
                        foreach (var subDtls in userSubscriptionList.Subscriptions)
                        {
                            //Code to save the user Subscription details to Database.
                            UserSubscriptionData userSubscription = new UserSubscriptionData();
                            userSubscription.SubscriptionDate = subDtls.SubscriptionDate;
                            userSubscription.SubscriptionId   = subDtls.SubscriptionTypeId;
                            userSubscription.UserId           = userId;
                            userSubscription.Quantity         = subDtls.OrderdQuantity;
                            userSubscription.Subscription     = subDtls;
                            userSubscription.LicenseKeys      = subDtls.LicenseKeyProductMapping;
                            subscriptionData.Add(userSubscription);
                        }
                        client.Dispose();
                        HttpClient client1 = AppState.CreateClient(ServiceType.OnPremiseWebApi.ToString());
                        client1.DefaultRequestHeaders.Add("Authorization", "Bearer " + AppState.Instance.OnPremiseToken.access_token);
                        var response1 = client1.PostAsJsonAsync("api/UserSubscription/SyncSubscription", subscriptionData).Result;
                        client1.Dispose();
                    }
                }
                var kvp = new Dictionary <string, string>();
                kvp.Add("Amount", AppState.Instance.SelectedSubscription.Price.ToString());
                NavigateNextPage("RedirectToAmountPaymentPage", kvp);
            }
        }
Exemple #4
0
        public ExporterViewModel()
        {
            InitialFileName = SelectedYear.CombineLatest(SelectedMonth, (year, month) => $"工数管理_{year}年{month:00}月分")
                              .ToReadOnlyReactivePropertySlim();

            UseWorkingHourApiImport.Value = string.IsNullOrEmpty(_ExporterModel.WorkingHourImportUrl) == false;

            var paramConfig = UserConfigurationManager.Instance.GetConfiguration <ImportParamConfig>(ConfigKey.ImportParam);

            ImportKey.Value = paramConfig?.Param ?? "";
        }
Exemple #5
0
 /// <summary>
 /// Data validation on user input.
 /// </summary>
 /// <param name="columnName">property name</param>
 /// <returns></returns>
 public string this[string columnName]
 {
     get
     {
         if ("CardName" == columnName)
         {
             if (string.IsNullOrEmpty(CardName))
             {
                 return("Name field is empty");
             }
         }
         if ("CardNumber" == columnName)
         {
             if (string.IsNullOrEmpty(CardNumber))
             {
                 return("Card number field is empty");
             }
             if (CardNumber.Length != Constants.CARD_NUMBER_LENGTH)
             {
                 return("Invalid card number");
             }
         }
         if ("SelectedMonth" == columnName)
         {
             if (string.IsNullOrEmpty(SelectedMonth))
             {
                 return("Month field is empty");
             }
         }
         if ("SelectedYear" == columnName)
         {
             if (string.IsNullOrEmpty(SelectedYear.ToString()))
             {
                 return("Year field is empty");
             }
         }
         if ("CardCVV" == columnName)
         {
             if (string.IsNullOrEmpty(CardCVV.ToString()))
             {
                 return("CVV field is empty");
             }
             if (CardCVV.ToString().Length != Constants.CARD_CVV_LENGTH)
             {
                 return("Invalid CVV");
             }
         }
         return(string.Empty);
     }
 }
 public void LoadCardsOnPopup(PaymentListModel paymentListModel)
 {
     Number        = (paymentListModel.CARD_NUMBER ?? "").ToString();
     Chname        = paymentListModel.CARD_HOLDER_NAME;
     SelectedMonth = paymentListModel.CARD_EXP_DATE;
     if (!(SelectedMonth == null))
     {
         SelectedMonth = SelectedMonth.Substring(0, 2);
     }
     SelectedYear = paymentListModel.CARD_EXP_DATE;
     if (!(SelectedYear == null))
     {
         SelectedYear = "20" + SelectedYear.Substring(2, 2);
     }
 }
        private async Task SaveCardAsync()
        {
            if (CrossConnectivity.Current.IsConnected)
            {
                paymentListModel.CARD_NUMBER      = Convert.ToInt64(Number);
                paymentListModel.CARD_HOLDER_NAME = Chname;
                paymentListModel.CARD_EXP_DATE    = SelectedMonth + SelectedYear.Substring(2, 2);
                var ResultContent = await _apiServicesPayment.SaveCardAsync(paymentListModel);

                JObject jwtDynamic = JsonConvert.DeserializeObject <dynamic>(ResultContent);
                var     Message    = jwtDynamic.Value <string>("Message");
                if (Message.Equals("Card Saved."))
                {
                    await PopupNavigation.Instance.PopAsync();
                }
            }
        }
        /* Notes on Filter Methods:
         * When using multiple filters, do not explicitly set anything to true.  Rather,
         * only hide things which do not match the filter criteria
         * by setting e.Accepted = false.  If you set e.Accept = true, if effectively
         * clears out any previous filters applied to it.
         */

        private void FilterByYear(object sender, FilterEventArgs e)
        {
            // see Notes on Filter Methods:
            var src = e.Item as RouteVideoViewModel;

            if (src == null)
            {
                e.Accepted = false;
            }
            else if (_yearListFirstItem != null && SelectedYear == _yearListFirstItem)
            {
                e.Accepted = true;
            }
            else if (SelectedYear.CompareTo(src.CreateDT.Year.ToString()) != 0)
            {
                e.Accepted = false;
            }
        }
        private void ControlValueChanged(object sender, EventArgs e)
        {
            if (FilterChanged == null)
            {
                return;
            }
            if (eventOff)
            {
                return;
            }
            if (sender is RadioButton && txtSearch.Text.Length == 0)
            {
                return;
            }

            List <string> messages = new List <string>();

            if (SelectedCacheType != null)
            {
                messages.Add(SelectedCacheType);
            }
            if (SelectedYear > 0)
            {
                messages.Add(SelectedYear.ToString());
            }
            if (SelectedState != null)
            {
                messages.Add(SelectedState);
            }
            if (SelectedCountry != null)
            {
                messages.Add(SelectedCountry);
            }
            if (ArchivedStatus != null)
            {
                messages.Add(ArchivedStatus);
            }
            this.simpleListing = chkSimpleList.Checked;
            FilterChanged(sender, string.Join(", ", messages));
        }
Exemple #10
0
        public NewImportantDateViewModel(ImportantDatesLogic importantDatesLogic, int numberOfDay, string month, int year, string eventText, int annually)
        {
            this.importantDatesLogic = importantDatesLogic;
            Overall();
            selectedMonth = month;
            selectedYear  = year;
            int count = day.GetNumberOfDaysInThisMonth(month, year);

            for (int i = 1; i <= count; i++)
            {
                Days.Add(i);
            }
            SelectedDay = numberOfDay;
            Text        = eventText;
            if (annually == 1)
            {
                IsAnnually = true;
            }
            else
            {
                IsAnnually = false;
            }
            editId = importantDatesLogic.GetIdByEventAndDate(Text, ZeroOrNull() + SelectedDay.ToString() + "." + day.GetNumberOfMonth(SelectedMonth) + "." + SelectedYear.ToString());
        }
Exemple #11
0
 private void UpdateDate(object annually)
 {
     dispatcher.BeginInvoke(DispatcherPriority.Normal, (ThreadStart) delegate()
     {
         importantDatesLogic.UpdateData(editId, Text, ZeroOrNull() + SelectedDay.ToString() + "." + day.GetNumberOfMonth(SelectedMonth) + "." + SelectedYear.ToString(), Convert.ToInt32(annually));
     });
 }
 private void DeleteData(object id)
 {
     dispatcher.BeginInvoke(DispatcherPriority.Normal, (ThreadStart) delegate()
     {
         timetableForTheDaysLogic.Distribution(ToList((int)id), ZeroOrNull(pastSelect) + pastSelect.ToString() + "." + calendar.GetNumberOfMonth(SelectedMonth) + "." + SelectedYear.ToString());
         StandardActions(pastSelect);
     });
 }
 private void RewriteData(object id)
 {
     dispatcher.BeginInvoke(DispatcherPriority.Normal, (ThreadStart) delegate()
     {
         timetableForTheDaysLogic.UpdateTask(ElementByIndex((int)id), ZeroOrNull(pastSelect) + pastSelect.ToString() + "." + calendar.GetNumberOfMonth(SelectedMonth) + "." + SelectedYear.ToString());
     });
 }
 private void ViewTasks(int number)
 {
     IsNeed = false;
     if (timetableForTheDaysLogic.NumberOfCases > 0)
     {
         ListOfTasks = timetableForTheDaysLogic.GetTasksInThisDate(ZeroOrNull(number) + number.ToString() + "." + calendar.GetNumberOfMonth(SelectedMonth) + "." + SelectedYear.ToString());
     }
     CanAreEdit = IsNowDate(number);
     Select(number);
     Count = ListOfTasks.Count;
 }
Exemple #15
0
 private void SearchingExistingCases()
 {
     if (timetableForTheDaysLogic.NumberOfCases > 0)
     {
         ListOfTasks = timetableForTheDaysLogic.GetTasksInThisDate(ZeroOrNull() + SelectedDay.ToString() + "." + day.GetNumberOfMonth(SelectedMonth) + "." + SelectedYear.ToString());
     }
 }
Exemple #16
0
 private void RewriteData()
 {
     dispatcher.BeginInvoke(DispatcherPriority.Normal, (ThreadStart) delegate()
     {
         timetableForTheDaysLogic.Distribution(ToList(), ZeroOrNull() + SelectedDay.ToString() + "." + day.GetNumberOfMonth(SelectedMonth) + "." + SelectedYear.ToString());
     });
 }
 private void DeleteTimetable()
 {
     dispatcher.BeginInvoke(DispatcherPriority.Normal, (ThreadStart) delegate()
     {
         timetableForTheDaysLogic.Distribution(new List <TaskForTheDay>()
         {
             ElementByIndex(0)
         }, ZeroOrNull(pastSelect) + pastSelect.ToString() + "." + calendar.GetNumberOfMonth(SelectedMonth) + "." + SelectedYear.ToString());
         ListOfTasks.Clear();
         StandardActions(pastSelect);
     });
 }