private void lvAllOptions_Click(object sender, RoutedEventArgs e) { var item = (sender as ListView).SelectedItem; if (item != null) { try { //dynamic selectedClient = (ExpandoObject)item; selectedOptions = (OptionLazy)item; btnAllProducts.IsEnabled = true; lvFunctions.ItemsSource = selectedOptions.Functions; btnUpdateOption.IsEnabled = (Global.ADUser.IsAdministrator == true) ? true : false; btnDeleteProduct.IsEnabled = (Global.ADUser.IsAdministrator == true) ? true : false; // Needs to be moved to Products //ClientOptions CO = new ClientOptions(selectedOptions.GUID); //CO.Show(); } catch (Exception exception) { ErrorHandler.ErrorHandle error = ErrorHandler.ErrorHandle.getInstance(); error.handle(exception, true, true); } } }
public void updateView() { lvOptionsToChooseFrom.ItemsSource = null; OptionLazy optionLazy = new OptionLazy(); optionList = optionLazy.LoadAllOptions(); lvOptionsToChooseFrom.ItemsSource = optionList; }
public void updateView() { OptionLazy optionLazy = new OptionLazy(); options = optionLazy.LoadAllOptions(); lblProductCount.Content = options.Count < 10 ? string.Format("0{0}", options.Count) : options.Count.ToString(); lvOptions.ItemsSource = options; }
private void lvOptionsToChooseFrom_MouseUp(object sender, MouseButtonEventArgs e) { var item = (sender as ListView).SelectedItem; if (item != null) { try { //dynamic selectedClient = (ExpandoObject)item; currentOption = (OptionLazy)item; } catch (Exception exception) { ErrorHandler.ErrorHandle error = ErrorHandler.ErrorHandle.getInstance(); error.handle(exception, true); } } }
public void updateInnerView(ClassLibrary.classes.System singleSystem) { if (singleSystem != null) { txtContractIdentifier.Text = singleSystem.Contract.ContractIdentifier; txtIsActive.Text = singleSystem.Contract.IsActive ? "Yes" : "No"; txtServiceLevel.Text = singleSystem.Contract.ServiceLevel; txtStartDate.Text = singleSystem.Contract.StartDate.ToString("d MMMM, yyyy"); txtEndDate.Text = singleSystem.Contract.EndDate.ToString("d MMMM, yyyy"); txtUpgradeOptions.Text = singleSystem.Contract.UpgradeOptions; txtCritical.Text = singleSystem.Status.Citical == 1 ? singleSystem.Status.Messages : "None"; txtWarning.Text = singleSystem.Status.Warning == 1 ? singleSystem.Status.Messages : "None"; OptionLazy optionLoad = new OptionLazy(singleSystem.GUID); singleSystem.Options = optionLoad.OptionList; List <ExpandoObject> optionListView = new List <ExpandoObject>(); foreach (OptionLazy option in singleSystem.Options) { dynamic javascript = new ExpandoObject(); javascript.Name = option.Name; javascript.Price = string.Format("R {0:0.00}", (option.CombinedPrice + option.Price)).EndsWith("00") ? string.Format("R {0}", Convert.ToInt32((option.CombinedPrice + option.Price))) : string.Format("R {0:0.00}", (option.CombinedPrice + option.Price)); javascript.Guid = option.GUID; optionListView.Add(javascript); } lvClientOptions.ItemsSource = optionListView; if (optionListView.Count != 0) { lvClientOptions.SelectedIndex = 0; } // string.Format("R {0:0.00}", accountLazy.CostPerMonth).EndsWith("00") ? string.Format("R {0}", Convert.ToInt32(accountLazy.CostPerMonth)) : string.Format("R {0:0.00}", accountLazy.CostPerMonth); //.ToString("d MMMM, yyyy"); } else { // Error message } }
public void updateOptions() { OptionLazy optionLoad = new OptionLazy(currentSystem.GUID); currentSystem.Options = optionLoad.OptionList; List <ExpandoObject> optionListView = new List <ExpandoObject>(); foreach (OptionLazy option in currentSystem.Options) { dynamic javascript = new ExpandoObject(); javascript.Name = option.Name; javascript.Price = string.Format("R {0:0.00}", (option.CombinedPrice + option.Price)).EndsWith("00") ? string.Format("R {0}", Convert.ToInt32((option.CombinedPrice + option.Price))) : string.Format("R {0:0.00}", (option.CombinedPrice + option.Price)); javascript.Guid = option.GUID; optionListView.Add(javascript); } lvClientOptions.ItemsSource = optionListView; if (optionListView.Count != 0) { lvClientOptions.SelectedIndex = 0; } }
public static OptionData <A> Lazy <A>(OptionLazy <A> f) { object sync = new object(); (bool, A)value = default((bool, A)); bool hasValue = false; return(new OptionData <A>(OptionState.Lazy, default(A), () => { if (hasValue) { return value; } lock (sync) { if (!hasValue) { value = f(); hasValue = true; } } return value; })); }
private void listView_Click(object sender, RoutedEventArgs e) { var item = (sender as ListView).SelectedItem; if (item != null) { try { dynamic selectedClient = (ExpandoObject)item; currentSelectedOption = new OptionLazy(); currentSelectedOption.GUID = selectedClient.Guid; // Needs to be moved to Products //ClientOptions CO = new ClientOptions(selectedClient.Guid); //CO.Show(); btnRemoveOption.IsEnabled = (Global.ADUser.IsAdministrator == true || Global.ADUser.IsEmployee == true) ? true : false; } catch (Exception exception) { ErrorHandler.ErrorHandle error = ErrorHandler.ErrorHandle.getInstance(); error.handle(exception, true, true); } } }
public static OptionData <A> Lazy <A>(OptionLazy <A> f) => new OptionData <A>(OptionState.Lazy, default(A), f);