コード例 #1
0
        public async Task <bool> DeleteSelectedInfoAsync()
        {
            IsBusy = true;
            var infoServices = new InfoServices();
            var success      = await infoServices.DeleteInfoAsync(_selectedInfo.Id);

            IsBusy = false;

            return(success);
        }
コード例 #2
0
 public void NewInfoPopupStore(string popupStoreName)
 {
     try
     {
         InfoServices.CreatePopupStoreInfo(popupStoreName);
         RefreshInfo();
     }catch (Exception e)
     {
         MessageBox.Show(e.Message);
     }
 }
コード例 #3
0
        private void MenuBar_CashRegisterButton_Click(object sender, RoutedEventArgs e)
        {
            if (InfoServices.PopupStoreInfoExist())
            {
                ZoneContent.Content = new SalesPage();
            }

            else
            {
                AlertShopNotCreated();
            }
        }
コード例 #4
0
        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);
        }
コード例 #5
0
 private void RefreshInfo()
 {
     if (InfoServices.PopupStoreInfoExist())
     {
         Info info = InfoServices.GetPopupStoreInfo();
         ExistShopVisibility = "Visible";
         CreationDate        = info.CreationDate.ToString();
         NamePopupStore      = info.PopupStoreName;
     }
     else
     {
         ExistShopVisibility = "Hidden";
     }
 }
コード例 #6
0
        /// <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();
        }
コード例 #7
0
        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;
            //});
        }
コード例 #8
0
        /// <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);
                }
            }
        }
コード例 #9
0
 public ReportManageViewModel()
 {
     dateStart = InfoServices.GetPopupStoreInfo().CreationDate;
     dateEnd   = DateTime.Now;
 }