示例#1
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);
        }
 private void RefreshInfo()
 {
     if (InfoServices.PopupStoreInfoExist())
     {
         Info info = InfoServices.GetPopupStoreInfo();
         ExistShopVisibility = "Visible";
         CreationDate        = info.CreationDate.ToString();
         NamePopupStore      = info.PopupStoreName;
     }
     else
     {
         ExistShopVisibility = "Hidden";
     }
 }
        /// <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;
 }