Example #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);
     }
 }
Example #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);
            }
        }
Example #4
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);
     }
 }
        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));
        }
Example #6
0
 private void RewriteData()
 {
     dispatcher.BeginInvoke(DispatcherPriority.Normal, (ThreadStart) delegate()
     {
         timetableForTheDaysLogic.Distribution(ToList(), ZeroOrNull() + SelectedDay.ToString() + "." + day.GetNumberOfMonth(SelectedMonth) + "." + SelectedYear.ToString());
     });
 }
Example #7
0
 private void SearchingExistingCases()
 {
     if (timetableForTheDaysLogic.NumberOfCases > 0)
     {
         ListOfTasks = timetableForTheDaysLogic.GetTasksInThisDate(ZeroOrNull() + SelectedDay.ToString() + "." + day.GetNumberOfMonth(SelectedMonth) + "." + SelectedYear.ToString());
     }
 }
Example #8
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());
        }
Example #9
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));
     });
 }
Example #10
0
 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);
     });
 }
Example #11
0
 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);
     });
 }
Example #12
0
 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());
     });
 }
Example #13
0
 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;
 }