public async Task <bool> DeleteSelectedInfoAsync() { IsBusy = true; var infoServices = new InfoServices(); var success = await infoServices.DeleteInfoAsync(_selectedInfo.Id); IsBusy = false; return(success); }
public void NewInfoPopupStore(string popupStoreName) { try { InfoServices.CreatePopupStoreInfo(popupStoreName); RefreshInfo(); }catch (Exception e) { MessageBox.Show(e.Message); } }
private void MenuBar_CashRegisterButton_Click(object sender, RoutedEventArgs e) { if (InfoServices.PopupStoreInfoExist()) { ZoneContent.Content = new SalesPage(); } else { AlertShopNotCreated(); } }
public void ExportToHtml(string outputPath, bool overwrite) { File.Copy(@".\UI\Resource\HTML_Template\MyPopupStore_ReportTemplate.html", outputPath, overwrite); string textHtml = File.ReadAllText(outputPath); textHtml = textHtml.Replace("MyPopupStore_Title", InfoServices.GetPopupStoreInfo().PopupStoreName); textHtml = textHtml.Replace("MyPopupStore_Interval", $"{Start.ToString("dd MMMM yyyy")} - {End.ToString("dd MMMM yyyy")}"); textHtml = textHtml.Replace("MyPopupStore_LineProduct", WriteLinesOfTable(CollectProduct())); textHtml = textHtml.Replace("MyPopupStore_Total", SaleServices.GetTotal(Start, End).ToString()); File.WriteAllText(outputPath, textHtml); }
private void RefreshInfo() { if (InfoServices.PopupStoreInfoExist()) { Info info = InfoServices.GetPopupStoreInfo(); ExistShopVisibility = "Visible"; CreationDate = info.CreationDate.ToString(); NamePopupStore = info.PopupStoreName; } else { ExistShopVisibility = "Hidden"; } }
/// <summary> /// déclanche la procédure de cloture du popupstore /// </summary> public void CloturePopupStore() { ClosePopupValidation closePopupValidation = new(); if (closePopupValidation.ShowDialog() == true) { InfoServices.DeletePopupStoreInfo(); SaleServices.DeleteSaleAndSaleDetails(); if (closePopupValidation.DeleteProduct) { ProductServices.RemoveAllProduct(); } } RefreshInfo(); }
public async Task InitializeInfo() { //await Connectivity.DoIfConnectedAndReachable(async () => //{ var infoServices = new InfoServices(); var infoHelp = new ObservableCollection <Info>(); //Info = new ObservableCollection<Info>(); IsBusy = true; //Info.AddRange(await infoServices.GetInfoForMonthAsync(DateTime.Now)); infoHelp.AddRange(await infoServices.GetInfoForMonthAsync(DateTime.Now)); if (infoHelp.Count > 0) // aktualizujem info iba ak som nejake vytiahol z db { this.Info = infoHelp; } IsBusy = false; //}); }
/// <summary> /// déclenche la procédure d'exportation du compte rendu /// </summary> public void SaveReport() { Export export = new(); ReportManageView reportManageView = new(); SaveFileDialog saveFileDialog = new(); if (reportManageView.ShowDialog() == true) { export.End = reportManageView.ReportManageViewModel.DateEnd; export.Start = reportManageView.ReportManageViewModel.DateStart; saveFileDialog.Filter = "Text Files(*.html)|*.html|All files (*.*)|*.*"; saveFileDialog.FileName = InfoServices.GetPopupStoreInfo().PopupStoreName + ".html"; if (saveFileDialog.ShowDialog() == true) { export.ExportToHtml(saveFileDialog.FileName, true); } } }
public ReportManageViewModel() { dateStart = InfoServices.GetPopupStoreInfo().CreationDate; dateEnd = DateTime.Now; }