/// <summary> /// The execute invoice view. /// </summary> private void ExecuteInvoiceView() { if (this.SelectedPod == null) { MessageBox.Show("Please select a POD first"); return; } if (this.context != null) { this.context.Dispose(); } this.IsBusy = true; this.context = new MusterContext(); var query = this.context.pod.FirstOrDefault(p => p.id_pod == this.SelectedPod.id_pod); if (query == null) { return; } var list = new ObservableCollection <abrechnung>(query.abrechnung.ToList()); this.Abrechnungen = list; this.IsBusy = false; this.IsConfigVisible = false; this.IsInvoiceVisible = true; this.IsOverviewVisible = false; }
/// <summary> /// The load entities. /// </summary> private void LoadEntities() { if (this.context != null) { this.context.Dispose(); } this.context = new MusterContext(); var query = this.context.pod.ToList(); if (this.Pods == null) { this.Pods = new ObservableCollection <pod>(query); } }
/// <summary> /// The load entities. /// </summary> private void LoadEntities() { if (this.context != null) { this.context.Dispose(); } try { this.context = new MusterContext(); var query = this.context.pod.ToList(); if (this.Pods == null) { this.Pods = new ObservableCollection <pod>(query); } } catch (Exception e) { MessageBox.Show("Keine Verbindung zur Datenbank"); return; } }
/// <summary> /// The execute config. /// </summary> private void ExecuteConfig() { if (this.SelectedPod == null) { MessageBox.Show("Please select a pod first"); return; } if (this.context != null) { this.context.Dispose(); } this.context = new MusterContext(); if (this.SelectedPod == null) { this.SelectedPod = this.context.pod.FirstOrDefault(p => p.id_pod == this.SelectedPod.id_pod); } this.IsConfigVisible = true; this.IsInvoiceVisible = false; this.IsOverviewVisible = false; }
/// <summary> /// The calculate obsolete value. /// </summary> /// <param name="choosedPod"> /// The choosed pod. /// </param> public void CalculateObsoleteValue(pod choosedPod) { if (choosedPod == null) { return; } using (var db = new MusterContext()) { var query = db.pod.FirstOrDefault(p => p.id_pod == choosedPod.id_pod); if (query == null) { return; } var obsolete = query.location; var value = string.Empty + (from location in obsolete from position in location.position_abrechnung where position.abrechnung == null select(int) position.preis).Sum(); this.ObsoleteValue = value; } }
/// <summary> /// The execute invoice view. /// </summary> private void ExecuteInvoiceView() { if (this.SelectedPod == null) { MessageBox.Show("Please select a POD first"); return; } if (this.context != null) { this.context.Dispose(); } this.IsBusy = true; this.context = new MusterContext(); var query = this.context.pod.FirstOrDefault(p => p.id_pod == this.SelectedPod.id_pod); if (query == null) { return; } var list = new ObservableCollection<abrechnung>(query.abrechnung.ToList()); this.Abrechnungen = list; this.IsBusy = false; this.IsConfigVisible = false; this.IsInvoiceVisible = true; this.IsOverviewVisible = false; }
/// <summary> /// The calculate obsolete value. /// </summary> /// <param name="choosedPod"> /// The choosed pod. /// </param> public void CalculateObsoleteValue(pod choosedPod) { if (choosedPod == null) { return; } using (var db = new MusterContext()) { var query = db.pod.FirstOrDefault(p => p.id_pod == choosedPod.id_pod); if (query == null) { return; } var obsolete = query.location; var value = string.Empty + (from location in obsolete from position in location.position_abrechnung where position.abrechnung == null select (int)position.preis).Sum(); this.ObsoleteValue = value; } }
/// <summary> /// The load entities. /// </summary> private void LoadEntities() { if (this.context != null) { this.context.Dispose(); } this.context = new MusterContext(); var query = this.context.pod.ToList(); if (this.Pods == null) { this.Pods = new ObservableCollection<pod>(query); } }
/// <summary> /// The load entities. /// </summary> private void LoadEntities() { if (this.context != null) { this.context.Dispose(); } try { this.context = new MusterContext(); var query = this.context.pod.ToList(); if (this.Pods == null) { this.Pods = new ObservableCollection<pod>(query); } } catch (Exception e) { MessageBox.Show("Keine Verbindung zur Datenbank"); return; } }