Exemple #1
0
        public void ViewReport()
        {
            XtraReportPROGRESS_ITEMS progressReport  = new XtraReportPROGRESS_ITEMS();
            PROJECT_REPORT           dbProjectReport = loaderCollection.GetObject <PROJECT_REPORT>();

            if (dbProjectReport != null)
            {
                string reportString = dbProjectReport.REPORT.ToString();
                using (StreamWriter sw = new StreamWriter(new MemoryStream()))
                {
                    sw.Write(reportString);
                    sw.Flush();
                    progressReport.LoadLayout(sw.BaseStream);
                }
            }

            PROJECTSummaryBuilder projectSummaryBuilder = new PROJECTSummaryBuilder(currentPROJECTSummary);

            CalculateStatsForReport(projectSummaryBuilder);
            progressReport.AssignProperties(currentPROJECTSummary, loadPROGRESS.PROJECT.NAME);
            DocumentPreviewWindow previewWindow = new DocumentPreviewWindow();

            previewWindow.PreviewControl.DocumentSource = progressReport;
            previewWindow.WindowStartupLocation         = WindowStartupLocation.CenterScreen;
            previewWindow.WindowState        = WindowState.Maximized;
            progressReport.RequestParameters = false;
            progressReport.CreateDocument(true);
            previewWindow.ShowDialog();
        }
Exemple #2
0
        private void OnPrint()
        {
            XtraReport report;

            if (IsByCustomer)
            {
                report = new SalesReport();
                if (SelectedCustomer != null)
                {
                    report.DataSource = Transactions.Where(c => c.Customer.Id == SelectedCustomer.Id).ToList();
                }
            }
            else
            {
                report            = new AllTransactionReport();
                report.DataSource = Transactions;
            }

            var window = new DocumentPreviewWindow();

            window.PreviewControl.DocumentSource = report;
            report.CreateDocument(true);
            report.PrintingSystem.Document.AutoFitToPagesWidth = 1;
            window.WindowStartupLocation = WindowStartupLocation.CenterScreen;
            window.WindowState           = WindowState.Maximized;
            window.ShowDialog();
        }
Exemple #3
0
        public void ViewReport()
        {
            XtraReportBASELINE_ITEMS baselineReport  = new XtraReportBASELINE_ITEMS();
            PROJECT_REPORT           dbProjectReport = loaderCollection.GetObject <PROJECT_REPORT>();

            if (dbProjectReport != null)
            {
                string reportString = dbProjectReport.REPORT.ToString();
                using (StreamWriter sw = new StreamWriter(new MemoryStream()))
                {
                    sw.Write(reportString);
                    sw.Flush();
                    baselineReport.LoadLayout(sw.BaseStream);
                }
            }

            //make sure disciplines are all populated
            PopulateNavigationalProperties();
            baselineReport.AssignProperties(loadPROJECT, loadBASELINE, MainViewModel.Entities);
            DocumentPreviewWindow previewWindow = new DocumentPreviewWindow();

            previewWindow.PreviewControl.DocumentSource = baselineReport;
            previewWindow.WindowStartupLocation         = WindowStartupLocation.CenterScreen;
            previewWindow.WindowState        = WindowState.Maximized;
            baselineReport.RequestParameters = false;
            baselineReport.CreateDocument(true);
            previewWindow.ShowDialog();
        }
        private void btnExport_Click(object sender, RoutedEventArgs e)
        {
            DateTime dtBegin      = (DateTime)deBegin.EditValue;
            DateTime dtEnd        = (DateTime)deEnd.EditValue;
            string   formatString = "dd.MM.yy HH_mm";

            DocumentPreviewWindow preview = new DocumentPreviewWindow();
            CollectionViewLink    link    = new CollectionViewLink();

            link.PrintingSystem.ExportOptions.PrintPreview.DefaultExportFormat = DevExpress.XtraPrinting.PrintingSystemCommand.ExportXlsx;
            link.PrintingSystem.ExportOptions.PrintPreview.DefaultFileName     = string.Format("{0} (с {1} по {2})", Item.Description, dtBegin.ToString(formatString), dtEnd.ToString(formatString));
            link.PaperKind        = DevExpress.Xpf.Drawing.Printing.PaperKind.A4;
            link.Margins.Bottom   = link.Margins.Top = link.Margins.Left = link.Margins.Right = 10;
            link.ExportServiceUri = string.Format("http://{0}/ExportService.svc", Global.Default.ServerIPAddress);
            LinkPreviewModel model = new LinkPreviewModel(link);

            CollectionViewSource collectionViewSource = new CollectionViewSource
            {
                Source = Trends
            };

            link.CollectionView = collectionViewSource.View;

            link.DetailTemplate       = (DataTemplate)Resources["trendDataTemplate"];
            link.ReportHeaderTemplate = (DataTemplate)Resources["trendHeaderTemplate"];

            preview.Model = model;
            link.CreateDocument(false);
            preview.ShowDialog();
        }
Exemple #5
0
        private void _bbidocgiareport_ItemClick(object sender, DevExpress.Xpf.Bars.ItemClickEventArgs e)
        {
            MemBerAll             report = new MemBerAll();
            DocumentPreviewWindow window = new DocumentPreviewWindow();

            window.PreviewControl.DocumentSource = report;
            report.CreateDocument(true);
            window.ShowDialog();
        }
Exemple #6
0
        private void ShowPreview(object sender, RoutedEventArgs e)
        {
            Report report = new Report();
            DocumentPreviewWindow window = new DocumentPreviewWindow();

            window.PreviewControl.DocumentSource = report;
            report.CreateDocument(true);
            window.ShowDialog();
        }
Exemple #7
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            DocumentPreviewWindow preview = new DocumentPreviewWindow();
            PrintableControlLink  link    = new PrintableControlLink(view);
            LinkPreviewModel      model   = new LinkPreviewModel(link);

            preview.Model = model;
            link.CreateDocument(true);
            preview.ShowDialog();
        }
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            RichEditDocumentServer documentServer = new RichEditDocumentServer();

            documentServer.Text = "RichEditDocumentServer Print Preview.";
            LegacyPrintableComponentLink link   = new LegacyPrintableComponentLink(documentServer);
            DocumentPreviewWindow        window = new DocumentPreviewWindow();

            window.PreviewControl.DocumentSource = link;
            link.CreateDocument(false);
            window.ShowDialog();
        }
Exemple #9
0
        private void PrintXtraReport()
        {
            var xtraReport = new XtraReport2();

            var window = new DocumentPreviewWindow {
                WindowStartupLocation = WindowStartupLocation.CenterScreen
            };

            window.PreviewControl.DocumentSource = xtraReport;
            xtraReport.CreateDocument(true);
            window.ShowDialog();
        }
        private void ShowPrintPreview(GridControl grid)
        {
            DocumentPreviewWindow preview = new DocumentPreviewWindow();
            PrintableControlLink  link    = new PrintableControlLink(grid.View as DevExpress.Xpf.Printing.IPrintableControl);

            link.ExportServiceUri = "../ExportService1.svc";
            LinkPreviewModel model = new LinkPreviewModel(link);

            preview.Model = model;
            link.CreateDocument(false);
            preview.ShowDialog();
        }
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            DocumentPreviewWindow preview = new DocumentPreviewWindow();
            PrintableControlLink  link    = new PrintableControlLink(grid.View as DevExpress.Xpf.Printing.IPrintableControl);

            link.ExportServiceUri = "../ExportService1.svc";
            LinkPreviewModel model = new LinkPreviewModel(link);

            preview.Model = model;
            link.CreateDocument(true);
            preview.ShowDialog();
        }
        public void ShowPreview(string serviceUri, string reportName)
        {
            ReportServicePreviewModel model = new ReportServicePreviewModel(serviceUri);

            model.ReportName = reportName;
            DocumentPreviewWindow preview = new DocumentPreviewWindow()
            {
                Model = model
            };

            model.CreateDocument();
            preview.ShowDialog();
        }
Exemple #13
0
        private void button1_Click(object sender, RoutedEventArgs e)
        {
            ReportHelper.ReportGeneratonHelper helper = new ReportHelper.ReportGeneratonHelper();
            XtraReport            report = helper.GenerateReport(grid, grid.ItemsSource);
            DocumentPreviewWindow dp     = new DocumentPreviewWindow()
            {
                Owner = this
            };

            dp.PreviewControl.DocumentSource = report;
            report.CreateDocument(false);
            dp.ShowDialog();
        }
        private void button1_Click(object sender, RoutedEventArgs e)
        {
            SimpleLink            link    = new SimpleLink("ListViewDocument");
            DocumentPreviewWindow preview = new DocumentPreviewWindow();

            preview.PreviewControl.DocumentSource = link;

            link.PageHeaderTemplate = (DataTemplate)Resources["printHeaderTemplate"];
            link.DetailTemplate     = (DataTemplate)Resources["printDataTemplate"];
            link.DetailCount        = listView1.Items.Count;
            link.CreateDetail      += new EventHandler <CreateAreaEventArgs>(link_CreateDetail);
            link.CreateDocument(true);
            preview.ShowDialog();
        }
Exemple #15
0
        private void ShowPreview(object sender, RoutedEventArgs e)
        {
            RemoteDocumentSource remoteSource = new RemoteDocumentSource();

            remoteSource.ServiceUri = @"http://localhost:50786/ReportService1.svc";
            remoteSource.ReportName = "ReportService.Reports.Report, Reporting";

            DocumentPreviewWindow window = new DocumentPreviewWindow();

            window.PreviewControl.DocumentSource = remoteSource;
            remoteSource.CreateDocument();

            window.ShowDialog();
        }
Exemple #16
0
        private void ShowPreview(object sender, RoutedEventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();

            if (ofd.ShowDialog() == true)
            {
                Report report = new Report();
                report.xrRichText1.Rtf = File.ReadAllText(ofd.FileName);

                DocumentPreviewWindow window = new DocumentPreviewWindow();
                window.PreviewControl.DocumentSource = report;
                report.CreateDocument(true);
                window.ShowDialog();
            }
        }
Exemple #17
0
        public void Print(Window ownerWindow)
        {
            //TableViewAllEmployees.ShowPrintPreviewDialog(ownerWindow);

            using (var print = new PrintableControlLink(TableViewAllEmployees))
            {
                var preview = new DocumentPreviewWindow
                {
                    Owner = ownerWindow,
                    Model = new LinkPreviewModel(print)
                };

                print.CreateDocument(true);

                preview.FlowDirection = FlowDirection.RightToLeft;
                preview.ShowDialog();
            }
        }
Exemple #18
0
        private void btnExport_Click(object sender, RoutedEventArgs e)
        {
            //Global.Default.ShowForm(ref ExportDocumentPanel, "Форма экспорта данных.", "/WebControl;component/Forms/DataGridExport.xaml", new Size(800, 600), true, this);

            DateTime dtBegin      = (DateTime)deBegin.EditValue;
            DateTime dtEnd        = (DateTime)deEnd.EditValue;
            string   formatString = "dd.MM.yy HH_mm";

            DocumentPreviewWindow preview = new DocumentPreviewWindow();
            PrintableControlLink  link    = new PrintableControlLink(gridControl.View as DevExpress.Xpf.Printing.IPrintableControl);

            link.PrintingSystem.ExportOptions.PrintPreview.DefaultExportFormat = DevExpress.XtraPrinting.PrintingSystemCommand.ExportXlsx;
            link.PrintingSystem.ExportOptions.PrintPreview.DefaultFileName     = string.Format("Отчет Ангидрит. МТБ. (с {0} по {1})", dtBegin.ToString(formatString), dtEnd.ToString(formatString));
            link.PaperKind        = DevExpress.Xpf.Drawing.Printing.PaperKind.A4;
            link.Margins.Bottom   = link.Margins.Top = link.Margins.Left = link.Margins.Right = 10;
            link.ExportServiceUri = string.Format("http://{0}/ExportService.svc", Global.Default.ServerIPAddress);
            LinkPreviewModel model = new LinkPreviewModel(link);

            preview.Model = model;
            link.CreateDocument(false);
            preview.ShowDialog();
        }
Exemple #19
0
        private void Window_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.F1)
            {
                XtraReport1 report            = new XtraReport1();
                SQLiteConnectionParameters FF = new SQLiteConnectionParameters();
                FF.FileName = Properties.Settings.Default.path;
                ((SqlDataSource)report.DataSource).ConnectionParameters = FF;
                XtraReportPreviewModel model   = new XtraReportPreviewModel(report);
                DocumentPreviewWindow  windoww = new DocumentPreviewWindow()
                {
                    Model = model
                };
                report.CreateDocument(true);
                windoww.ShowDialog();
                //using (ReportPrintTool printTool = new ReportPrintTool(report))
                //{

                //    printTool.Print();

                //    //or printTool.PrintDialog();
                //}
            }
        }
Exemple #20
0
 private void _reportprint_Click(object sender, RoutedEventArgs e)
 {
     if (_rdall.IsChecked == true)
     {
         if (_rccahaitc.IsChecked == true)
         {
             BooksLoanAll report = new BooksLoanAll();
             //report.FilterString = "[DaTra] = false";
             DocumentPreviewWindow window = new DocumentPreviewWindow();
             window.PreviewControl.DocumentSource = report;
             report.CreateDocument(true);
             window.ShowDialog();
         }
         if (_rddatratc.IsChecked == true)
         {
             BooksLoanAll report = new BooksLoanAll();
             report.FilterString = "[DaTra] = true";
             DocumentPreviewWindow window = new DocumentPreviewWindow();
             window.PreviewControl.DocumentSource = report;
             report.CreateDocument(true);
             window.ShowDialog();
         }
         if (_rdchuatratc.IsChecked == true)
         {
             BooksLoanAll report = new BooksLoanAll();
             report.FilterString = "[DaTra] = false";
             DocumentPreviewWindow window = new DocumentPreviewWindow();
             window.PreviewControl.DocumentSource = report;
             report.CreateDocument(true);
             window.ShowDialog();
         }
     }
     if (_rdsachmember.IsChecked == true)
     {
         if (_cbbtendocgia.SelectedItem == null)
         {
             MessageBox.Show("Chon Doi Tuong", "Thong Bao", MessageBoxButton.OK, MessageBoxImage.Warning);
             return;
         }
         if (_ckcahai.IsChecked == true)
         {
             BookLoanByMemBer report = new BookLoanByMemBer((_cbbtendocgia.SelectedItem as View_Models.DocGia).MaDocGia);
             //report.FilterString = "[DaTra] = false";
             DocumentPreviewWindow window = new DocumentPreviewWindow();
             window.PreviewControl.DocumentSource = report;
             report.CreateDocument(true);
             window.ShowDialog();
         }
         if (_ckchuatra.IsChecked == true)
         {
             BookLoanByMemBer report = new BookLoanByMemBer((_cbbtendocgia.SelectedItem as View_Models.DocGia).MaDocGia);
             report.FilterString = "[DaTra] = false";
             DocumentPreviewWindow window = new DocumentPreviewWindow();
             window.PreviewControl.DocumentSource = report;
             report.CreateDocument(true);
             window.ShowDialog();
         }
         if (_ckdatra.IsChecked == true)
         {
             BookLoanByMemBer report = new BookLoanByMemBer((_cbbtendocgia.SelectedItem as View_Models.DocGia).MaDocGia);
             report.FilterString = "[DaTra] = true";
             DocumentPreviewWindow window = new DocumentPreviewWindow();
             window.PreviewControl.DocumentSource = report;
             report.CreateDocument(true);
             window.ShowDialog();
         }
     }
 }
Exemple #21
0
        private void Print_Click(object sender, RoutedEventArgs e)
        {
            var SumPricee = new FunctionsOfSum();

            var Fa_delete = new Assest.OrcDataAcess();
            var FA        = new Assest.OrcDataAcess();

            try
            {
                double afo      = 0;
                var    Filtring = new List <string>();
                foreach (string item in PriceList)
                {
                    Filtring.Add(item.Replace("SAR", ""));
                }

                var           accc = new Assest.OrcDataAcess();
                List <string> L0   = new List <string>();
                List <string> L1   = new List <string>();
                List <string> L2   = new List <string>();
                List <string> L3   = new List <string>();
                List <string> L4   = new List <string>();
                List <string> L5   = new List <string>();
                List <string> L6   = new List <string>(); //
                List <string> L7   = new List <string>(); //dis
                List <string> L8   = new List <string>(); //pricef
                List <string> L9   = new List <string>(); //dat


                /*
                 *
                 *
                 *
                 */



                DataTable tt = new DataTable();
                accc.Show(tt);

                //                Finall_Price = (Double)((Price * Discount) / 100) - Price;

                foreach (DataRow r in tt.Rows)
                {
                    L1.Add(r.Field <string>("NAME"));
                    L2.Add(r.Field <string>("BARCODE"));
                    L3.Add(r.Field <string>("PRICE_A"));
                    L4.Add(r.Field <string>("PRICE"));
                    L5.Add(r.Field <string>("ID"));
                    L6.Add(r.Field <string>("QUANTITY"));
                    L7.Add(r.Field <string>("Dis"));
                    L8.Add(r.Field <string>("Price_F"));
                }
                tt.Clear();
                accc.show3(tt);
                foreach (DataRow r in tt.Rows)
                {
                    L0.Add(r.Field <String>("NUMF"));
                }
                foreach (string asf in Filtring)
                {
                    afo += double.Parse(asf);
                }
                PriceList.Add(afo.ToString());
                Pricce.Text = "SAR " + afo.ToString();

                var RepHelper = new ReportHelper();
                var ILIST     = new List <ReportHelper>();
                ILIST.Add(new ReportHelper()
                {
                    Getprice_ = Pricce.Text
                });
                XtraReport3 report            = new XtraReport3();
                SQLiteConnectionParameters FF = new SQLiteConnectionParameters();
                FF.FileName = System.Windows.Forms.Application.StartupPath + "\\dbPascal.db";
                ((SqlDataSource)report.DataSource).ConnectionParameters = FF;
                XtraReportPreviewModel model   = new XtraReportPreviewModel(report);
                DocumentPreviewWindow  windoww = new DocumentPreviewWindow()
                {
                    Model = model
                };
                report.CreateDocument(true);
                windoww.ShowDialog();

                string id_3 = "";
                //int finalprice = int.Parse(SumPricee.sumPrice().Replace("SAR", "").Replace(",", ""));
                //double Ristt = double.Parse(afo.ToString().Replace("SAR", "").Replace(",", ""));
                //double FInaal = finalprice + Ristt;
                for (int i = 0; i < L1.Count; i++)
                {
                    if (L1[i] == Name.Text)
                    {
                        id_3 = L5[i];
                    }
                }
                List <int> sawf = new List <int>();

                foreach (string d in L0)
                {
                    sawf.Add(int.Parse(d));
                }
                #region Convert Days to arabic language
                string dayoftheweek = "";
                switch (DateTime.Now.DayOfWeek)
                {
                case DayOfWeek.Sunday:
                {
                    dayoftheweek = ".الاحد";
                    break;
                }

                case DayOfWeek.Monday:
                {
                    dayoftheweek = ".الاثنين";
                    break;
                }

                case DayOfWeek.Thursday:
                {
                    dayoftheweek = ".الخميس";
                    break;
                }

                case DayOfWeek.Saturday:
                {
                    dayoftheweek = ".السبت";
                    break;
                }

                case DayOfWeek.Friday:
                {
                    dayoftheweek = "الجمعة.";
                    break;
                }

                case DayOfWeek.Tuesday:
                {
                    dayoftheweek = "الثلاثاء.";
                    break;
                }

                case DayOfWeek.Wednesday:
                {
                    dayoftheweek = "الاربعاء.";
                    break;
                }
                }
                #endregion
                if (L0.Count == 0)
                {
                    //null
                }

                else
                {
                    numfa = sawf.Max() + 1;
                }
                if (sawf.Count == 0)
                {
                    UmAlQuraCalendar um          = new UmAlQuraCalendar();
                    String           CurrentDate = (int.Parse(DateTime.Now.Year.ToString()) < 1600) ? DateTime.Now.Year.ToString() + "/" + DateTime.Now.Month.ToString() + "/" + DateTime.Now.Day.ToString() :
                                                   um.GetYear(DateTime.Parse(DateTime.Now.ToString())).ToString() + "/" + um.GetMonth(DateTime.Parse(DateTime.Now.ToString())).ToString() + "/" + um.GetDayOfMonth(DateTime.Parse(DateTime.Now.ToString())).ToString();

                    for (int i = 0; i < L1.Count; i++)
                    {
                        double Price        = 0;
                        double Discount     = 0;
                        double Finall_Price = 0;
                        string Result       = "";

                        DateTime dtttt = new DateTime();
                        for (int ii = 0; ii < asdf.Count; ii++)
                        {
                            if (L1[i] == asdf[ii])
                            {
                                accc.insert3(CurrentDate, L1[i], getwholeprice(i, L4, L7), L5[i], L6[i], L3[i], L2[i], numfa.ToString(), dayoftheweek, Pricce.Text);

                                Price        = (String.IsNullOrEmpty(L4[i].Replace("SAR", ""))) ? 0 : (Double)Double.Parse(double.Parse(L4[i].Replace("SAR", "")).ToString().Replace("SAR", ""));
                                Discount     = (String.IsNullOrEmpty(L7[i].Replace("%", ""))) ? 0 : (Double)Double.Parse(double.Parse(L7[i].Replace("%", "")).ToString().Replace("%", ""));
                                Finall_Price = (Double)((Price * Discount) / 100) - Price;
                                Finall_Price = Finall_Price * int.Parse(L6[i]);
                                Result       = "SAR " + Finall_Price.ToString("N2").Replace("-", "");
                                var mainwi = new MainWindow(L1[i], L4[i], L6[i], L2[i], L3[i], L5[i], L7[i], Result);
                                mainwi.EDIT_MAX();
                            }

                            /*
                             *
                             * L1.Add(r.Field<string>("NAME"));
                             * L2.Add(r.Field<string>("BARCODE"));
                             * L3.Add(r.Field<string>("PRICE_A"));
                             * L4.Add(r.Field<string>("PRICE"));
                             * L5.Add(r.Field<string>("ID"));
                             * L6.Add(r.Field<string>("QUANTITY"));
                             * L7.Add(r.Field<string>("Dis"));
                             * L8.Add(r.Field<string>("Price_F"));
                             */
                        }
                    }

                    if (GID.Count > 0)
                    {
                        for (int i = 0; i < GID.Count; i++)
                        {
                            FA.Delete(GID[i]);
                        }
                    }
                }
                else
                {
                    #region Date

                    UmAlQuraCalendar um          = new UmAlQuraCalendar();
                    String           CurrentDate = (int.Parse(DateTime.Now.Year.ToString()) < 1600) ? DateTime.Now.Year.ToString() + "/" + DateTime.Now.Month.ToString() + "/" + DateTime.Now.Day.ToString() :
                                                   um.GetYear(DateTime.Parse(DateTime.Now.ToString())).ToString() + "/" + um.GetMonth(DateTime.Parse(DateTime.Now.ToString())).ToString() + "/" + um.GetDayOfMonth(DateTime.Parse(DateTime.Now.ToString())).ToString();

                    #endregion


                    for (int i = 0; i < L1.Count; i++)
                    {
                        double Price        = 0;
                        double Discount     = 0;
                        double Finall_Price = 0;
                        string Result       = "";

                        DateTime dtttt = new DateTime();
                        for (int ii = 0; ii < asdf.Count; ii++)
                        {
                            if (L1[i] == asdf[ii])
                            {
                                accc.insert3(CurrentDate, L1[i], getwholeprice(i, L4, L7), L5[i], L6[i], L3[i], L2[i], numfa.ToString(), dayoftheweek, Pricce.Text);
                                Price        = (String.IsNullOrEmpty(L4[i].Replace("SAR", ""))) ? 0 : (Double)Double.Parse(double.Parse(L4[i].Replace("SAR", "")).ToString().Replace("SAR", ""));
                                Discount     = (String.IsNullOrEmpty(L7[i].Replace("%", ""))) ? 0 : (Double)Double.Parse(double.Parse(L7[i].Replace("%", "")).ToString().Replace("%", ""));
                                Finall_Price = (Double)((Price * Discount) / 100) - Price;
                                Finall_Price = Finall_Price * int.Parse(L6[i]);
                                Result       = "SAR " + Finall_Price.ToString("N2").Replace("-", "");
                                var mainwi = new MainWindow(L1[i], L4[i], L6[i], L2[i], L3[i], L5[i], L7[i], Result);
                                mainwi.EDIT_MAX();
                            }
                        }
                    }

                    if (GID.Count > 0)
                    {
                        for (int i = 0; i < GID.Count; i++)
                        {
                            FA.Updating_QUa("0", GID[i].ToString());
                        }
                    }
                }
                asdf.Clear();



                for (int i = 0; i < PriceList.Count; i++)
                {
                    Fa_delete._Delete(double.Parse(PriceList[i].Replace("SAR", "").Replace(",", "")));
                }
            }
            catch (Exception ex) { System.Windows.MessageBox.Show(ex.Message + ":" + ex.HResult.ToString()); }
            DD.ItemsSource = "";
            Observ.Clear();
            NameList.Clear();
            PriceList.Clear();
        }
Exemple #22
0
        private void _btnchangepass_Click(object sender, RoutedEventArgs e)
        {
            //if (_btnchangepass.Content.Equals("Change Pass"))
            //{
            //    _btnchangepass.Content = "Save";
            //    passwordBox1.IsEnabled = true;
            //    passwordBox.Clear();
            //    passwordBox1.ToolTip = "Nhập Lại Pass";
            //    _btncancelsavepass.Visibility = Visibility.Visible;
            //    _btncancelsavepass.IsEnabled = true;
            //    passwordBox.Focus();
            //    return;
            //}
            //string warning = "";
            //if (String.IsNullOrWhiteSpace(passwordBox.Password))
            //{
            //    warning += "Nhập password." + '\n';
            //}
            //if (String.IsNullOrWhiteSpace(passwordBox1.Password))
            //{
            //    warning += "Pass nhập lại không đúng." + '\n';
            //}
            //if (!warning.Equals(""))
            //{
            //    MessageBox.Show(warning,
            //        "Cập Nhật Pass",
            //        MessageBoxButton.OK,
            //        MessageBoxImage.Warning);
            //    return;
            //}
            //try
            //{
            //    if (passwordBox.Password == passwordBox1.Password)
            //    {
            //        UserController us = new UserController();
            //        View_Models.User user = us.GetById(Id);
            //        user.PASSWORD = passwordBox.Password.Trim();
            //        if (us.Edit(user))
            //        {
            //            MessageBox.Show("Cập Nhật thành công", "Cập Nhật Password", MessageBoxButton.OK, MessageBoxImage.Information);
            //        }
            //        else
            //        {
            //            MessageBox.Show("Cập Nhật thất bại", "Cập Nhật Password", MessageBoxButton.OK, MessageBoxImage.Information);
            //        }
            //    }
            //    else
            //    {
            //        MessageBox.Show("Pass word nhập lại không trùng khớp", "Cập Nhật Password", MessageBoxButton.OK, MessageBoxImage.Information); return;
            //    }
            //    _btnchangepass.Content = "Change Pass";
            //    passwordBox1.IsEnabled = false;
            //    passwordBox1.Clear();
            //}
            //catch { }
            BookLoanByMemBer report = new BookLoanByMemBer("DG003");

            report.FilterString = "[DaTra] = false";
            DocumentPreviewWindow window = new DocumentPreviewWindow();

            window.PreviewControl.DocumentSource = report;
            report.CreateDocument(true);
            window.ShowDialog();
        }
Exemple #23
0
        private async void PrivewDoucmentPrinter_Click(object sender, RoutedEventArgs e)
        {
            if (IS_SELECTED)
            {
                if (PrintHelper.Print.IsMounth_)
                {
                    PrintHelper.Print.GET_STRATED();
                    var         Dataopp           = new Assest.OrcDataAcess();
                    XtraReport4 report            = new XtraReport4();
                    SQLiteConnectionParameters FF = new SQLiteConnectionParameters();
                    FF.FileName = System.Windows.Forms.Application.StartupPath + "\\dbPascal.db";
                    ((SqlDataSource)report.DataSource).ConnectionParameters = FF;
                    XtraReportPreviewModel model   = new XtraReportPreviewModel(report);
                    DocumentPreviewWindow  windoww = new DocumentPreviewWindow()
                    {
                        Model = model
                    };
                    report.CreateDocument(true);
                    windoww.ShowDialog();
                    Dataopp.Delete4();
                }
                else if (PrintHelper.Print.IsYear_)
                {
                    PrintHelper.Print.GET_STRATED();
                    var         Dataopp           = new Assest.OrcDataAcess();
                    XtraReport4 report            = new XtraReport4();
                    SQLiteConnectionParameters FF = new SQLiteConnectionParameters();
                    FF.FileName = System.Windows.Forms.Application.StartupPath + "\\dbPascal.db";
                    ((SqlDataSource)report.DataSource).ConnectionParameters = FF;
                    XtraReportPreviewModel model   = new XtraReportPreviewModel(report);
                    DocumentPreviewWindow  windoww = new DocumentPreviewWindow()
                    {
                        Model = model
                    };
                    report.CreateDocument(true);
                    windoww.ShowDialog();
                    Dataopp.Delete4();
                }
                else if (PrintHelper.Print.IsDay_)
                {
                    PrintHelper.Print.GET_STRATED();
                    var         Dataopp           = new Assest.OrcDataAcess();
                    XtraReport4 report            = new XtraReport4();
                    SQLiteConnectionParameters FF = new SQLiteConnectionParameters();
                    FF.FileName = System.Windows.Forms.Application.StartupPath + "\\dbPascal.db";
                    ((SqlDataSource)report.DataSource).ConnectionParameters = FF;
                    XtraReportPreviewModel model   = new XtraReportPreviewModel(report);
                    DocumentPreviewWindow  windoww = new DocumentPreviewWindow()
                    {
                        Model = model
                    };
                    report.CreateDocument(true);
                    windoww.ShowDialog();
                    Dataopp.Delete4();
                }
                else if (!PrintHelper.Print.IsDay_ &&
                         !PrintHelper.Print.IsMounth_ &&
                         !PrintHelper.Print.IsYear_)
                {
                    SYear();
                    PrintHelper.Print.GET_STRATED();
                    var         Dataopp           = new Assest.OrcDataAcess();
                    XtraReport4 report            = new XtraReport4();
                    SQLiteConnectionParameters FF = new SQLiteConnectionParameters();
                    FF.FileName = System.Windows.Forms.Application.StartupPath + "\\dbPascal.db";
                    ((SqlDataSource)report.DataSource).ConnectionParameters = FF;
                    XtraReportPreviewModel model   = new XtraReportPreviewModel(report);
                    DocumentPreviewWindow  windoww = new DocumentPreviewWindow()
                    {
                        Model = model
                    };
                    report.CreateDocument(true);
                    windoww.ShowDialog();
                    Dataopp.Delete4();
                }
            }
            else if (!is_Repair_Selected)
            {
                XtraReport1 report            = new XtraReport1();
                SQLiteConnectionParameters FF = new SQLiteConnectionParameters();
                FF.FileName = System.Windows.Forms.Application.StartupPath + "\\dbPascal.db";
                ((SqlDataSource)report.DataSource).ConnectionParameters = FF;
                XtraReportPreviewModel model   = new XtraReportPreviewModel(report);
                DocumentPreviewWindow  windoww = new DocumentPreviewWindow()
                {
                    Model = model
                };
                report.CreateDocument(true);
                windoww.ShowDialog();
            }

            if (is_Repair_Selected)
            {
                if (Encode1.Text == "/d")
                {
                    NewModel(type_of_date.day);
                    PrintHelper.Print.IsMounth_ = false;
                    PrintHelper.Print.IsDay_    = true;
                    PrintHelper.Print.IsYear_   = false;
                    Reports.XtraReport5        report = new Reports.XtraReport5();
                    SQLiteConnectionParameters FF     = new SQLiteConnectionParameters();
                    FF.FileName = System.Windows.Forms.Application.StartupPath + "\\dbPascal.db";
                    ((SqlDataSource)report.DataSource).ConnectionParameters = FF;
                    XtraReportPreviewModel model   = new XtraReportPreviewModel(report);
                    DocumentPreviewWindow  windoww = new DocumentPreviewWindow()
                    {
                        Model = model
                    };
                    report.CreateDocument(true);
                    windoww.ShowDialog();
                    mo.Delete1();
                    PrintHelper.Print.IsMounth_ = false;
                    PrintHelper.Print.IsDay_    = false;
                    PrintHelper.Print.IsYear_   = false;
                }
                else if (Encode1.Text == "/m")
                {
                    NewModel(type_of_date.month);
                    PrintHelper.Print.IsMounth_ = true;
                    PrintHelper.Print.IsDay_    = false;
                    PrintHelper.Print.IsYear_   = false;
                    Reports.XtraReport5        report = new Reports.XtraReport5();
                    SQLiteConnectionParameters FF     = new SQLiteConnectionParameters();
                    FF.FileName = System.Windows.Forms.Application.StartupPath + "\\dbPascal.db";
                    ((SqlDataSource)report.DataSource).ConnectionParameters = FF;
                    XtraReportPreviewModel model   = new XtraReportPreviewModel(report);
                    DocumentPreviewWindow  windoww = new DocumentPreviewWindow()
                    {
                        Model = model
                    };
                    report.CreateDocument(true);
                    windoww.ShowDialog();
                    mo.Delete1();
                    PrintHelper.Print.IsMounth_ = false;
                    PrintHelper.Print.IsDay_    = false;
                    PrintHelper.Print.IsYear_   = false;
                }
                else if (Encode1.Text == "/y")
                {
                    NewModel(type_of_date.year);
                    PrintHelper.Print.IsMounth_ = false;
                    PrintHelper.Print.IsDay_    = false;
                    PrintHelper.Print.IsYear_   = true;
                    Reports.XtraReport5        report = new Reports.XtraReport5();
                    SQLiteConnectionParameters FF     = new SQLiteConnectionParameters();
                    FF.FileName = System.Windows.Forms.Application.StartupPath + "\\dbPascal.db";
                    ((SqlDataSource)report.DataSource).ConnectionParameters = FF;
                    XtraReportPreviewModel model   = new XtraReportPreviewModel(report);
                    DocumentPreviewWindow  windoww = new DocumentPreviewWindow()
                    {
                        Model = model
                    };
                    report.CreateDocument(true);
                    windoww.ShowDialog();
                    mo.Delete1();
                    PrintHelper.Print.IsMounth_ = false;
                    PrintHelper.Print.IsDay_    = false;
                    PrintHelper.Print.IsYear_   = false;
                }
                else if (String.IsNullOrEmpty(Encode1.Text))
                {
                    NewModel(type_of_date.year);
                    PrintHelper.Print.IsMounth_ = false;
                    PrintHelper.Print.IsDay_    = false;
                    PrintHelper.Print.IsYear_   = true;
                    Reports.XtraReport5        report = new Reports.XtraReport5();
                    SQLiteConnectionParameters FF     = new SQLiteConnectionParameters();
                    FF.FileName = System.Windows.Forms.Application.StartupPath + "\\dbPascal.db";
                    ((SqlDataSource)report.DataSource).ConnectionParameters = FF;
                    XtraReportPreviewModel model   = new XtraReportPreviewModel(report);
                    DocumentPreviewWindow  windoww = new DocumentPreviewWindow()
                    {
                        Model = model
                    };
                    report.CreateDocument(true);
                    windoww.ShowDialog();
                    mo.Delete1();
                    PrintHelper.Print.IsMounth_ = false;
                    PrintHelper.Print.IsDay_    = false;
                    PrintHelper.Print.IsYear_   = false;
                }
                else
                {
                    //later
                }
            }
        }
Exemple #24
0
/*
 * private System.Drawing.Image fQRCode(string mQRTitle, string mQRData){
 *  try{
 *     // Dim QRPath As String
 *      BarcodeSettings QRSetting = new BarcodeSettings();
 *      QRSetting.Type = BarCodeType.QRCode;
 *      QRSetting.Data = mQRData;
 *      QRSetting.Data2D = mQRTitle;
 *      QRSetting.QRCodeDataMode = QRCodeDataMode.AlphaNumber;
 *
 *      QRSetting.ResolutionType = ResolutionType.Graphics;
 *      QRSetting.Unit = System.Drawing.GraphicsUnit.Millimeter;
 *      QRSetting.DpiX = 300;
 *      QRSetting.DpiY = 300;
 *
 *      QRSetting.BarHeight = 25;
 *      QRSetting.HasBorder = false;
 *      QRSetting.BorderWidth = 1;
 *
 *      QRSetting.ImageHeight = 25; // 2.53 Inch | 64.2 Inch |128mm | 480 Pixel
 *      QRSetting.ImageWidth = 25;
 *      QRSetting.AutoResize = true;
 *
 *      QRSetting.X = 0.5F;
 *      QRSetting.QRCodeECL = QRCodeECL.H;
 *      QRSetting.TopMargin = 1;
 *      QRSetting.LeftMargin = 1;
 *      QRSetting.RightMargin = 1;
 *      QRSetting.BottomMargin = 1;
 *      QRSetting.ForeColor = System.Drawing.Color.Black;
 *      // QRSetting.ForeColor = Color.CadetBlue
 *
 *      System.Drawing.Font myFont = new System.Drawing.Font("Verdana", 8);
 *      QRSetting.TextFont = myFont;
 *      QRSetting.ShowText = false;
 *      QRSetting.TopText = mQRTitle;
 *      QRSetting.TopTextColor = System.Drawing.Color.Green;
 *      QRSetting.ShowTextOnBottom = false;
 *
 *      BarCodeGenerator QRGer = new BarCodeGenerator(QRSetting);
 *      System.Drawing.Image Img = QRGer.GenerateImage();
 *
 *      // 'Dim QRBitmap As System.Drawing.Bitmap = oQR.GetGraphic(20)
 *      System.IO.MemoryStream oMS = new System.IO.MemoryStream();
 *      Img.Save(oMS, System.Drawing.Imaging.ImageFormat.Png);
 *      return Img;
 *  }
 *  catch (Exception ex)
 *  {
 *      return null;
 *  }
 * }
 */

        #endregion

        public void rptInMaVach(DataTable oTblSP, Boolean isDG = false, Boolean isMaQR = true, String isMauIn = "25_15")
        {
            try
            {
                if (oTblSP == null || oTblSP.Rows.Count <= 0)
                {
                    Utils.showMessage(String.Format("Bạn chưa chọn sản phẩm cần tạo mã {0}", isMaQR == true ? " QRCode.." : " Vạch.."), "Lưu ý");
                    return;
                }

                SqlParameter[] arrPara = new SqlParameter[5];
                arrPara[0]       = new SqlParameter("@tblMasp", SqlDbType.Structured);
                arrPara[0].Value = oTblSP;
                arrPara[1]       = new SqlParameter("@Loai", SqlDbType.TinyInt);
                arrPara[1].Value = isMaQR == true ? 0 : 1;
                arrPara[2]       = new SqlParameter("@Cogia", SqlDbType.Bit);
                arrPara[2].Value = isDG == true ? 1 : 0;
                arrPara[3]       = new SqlParameter("@Denngay", SqlDbType.NVarChar, 15);
                arrPara[3].Value = MTGlobal.MT_DENNGAY;
                arrPara[4]       = new SqlParameter("@Nguoidung", SqlDbType.NVarChar, 50);
                arrPara[4].Value = MTGlobal.MT_USER_LOGIN;

                DataTable otblMaCode = new MTSQLServer().wRead("rptDM_InMaQRCode", arrPara);
                if (otblMaCode != null)
                {
                    switch (isMauIn)
                    {
                    case "25_15":
                        rptHH_QRCode_25_15 oReport = new rptHH_QRCode_25_15();
                        oReport.InitMacode(isMaQR);
                        oReport.DataSource = otblMaCode;
                        oReport.BindData();
                        SetCustomPageQR(oReport, isMauIn);
                        setFormatReport(oReport);

                        XtraReportPreviewModel model = new XtraReportPreviewModel(oReport);
                        model.AutoShowParametersPanel = false;
                        DocumentPreviewWindow oPrev = new DocumentPreviewWindow()
                        {
                            Model = model
                        };

                        oPrev.WindowStyle           = System.Windows.WindowStyle.SingleBorderWindow;
                        oPrev.WindowState           = System.Windows.WindowState.Normal;
                        oPrev.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
                        oPrev.Title = "IN MÃ VẠCH";

                        oPrev.ShowDialog();
                        break;

                    //3TEM/ROW
                    case "35_22":
                        /*
                         * Spire.Barcode.BarcodeSettings.ApplyKey("3GZHB-UT3PY-9YAGD-EXYS6-PREGK");
                         * DataTable oTblCode = new DataTable();
                         * oTblCode.Columns.Add("Macode", typeof(System.String));
                         * oTblCode.Columns.Add("MacodeText", typeof(System.String));
                         * oTblCode.Columns.Add("PicCode", typeof(System.Drawing.Image));
                         * foreach (DataRow vR in otblMaCode.Rows) {
                         *  DataRow dR = oTblCode.NewRow();
                         *  dR["Macode"] = vR["Macode"];
                         *  dR["MacodeText"] = vR["MacodeText"];
                         *  dR["PicCode"] =fQRCode(vR["MacodeText"].ToString(),vR["Macode"].ToString());
                         *  oTblCode.Rows.Add(dR);
                         *
                         * }
                         * oTblCode.AcceptChanges();
                         * rptHH_QRCode_3temImg_35_22 oReport3t = new rptHH_QRCode_3temImg_35_22();
                         * oReport3t.InitMacode(isMaQR);
                         * oReport3t.DataSource = oTblCode;
                         * oReport3t.BindData();
                         * SetCustomPageQR(oReport3t, isMauIn);
                         * setFormatReport(oReport3t);
                         *
                         * PrintPreview oPreview3t = new PrintPreview();
                         * oPreview3t.report = oReport3t;
                         *
                         * oPreview3t.Show();
                         * break;
                         */

                        if (isMaQR)
                        {
                            rptHH_QRCode_35_22 oRptQRcode3T = new rptHH_QRCode_35_22();
                            oRptQRcode3T.InitMacode(isMaQR);
                            oRptQRcode3T.DataSource = otblMaCode;
                            oRptQRcode3T.BindData();
                            SetCustomPageQR(oRptQRcode3T, isMauIn);
                            setFormatReport(oRptQRcode3T);

                            PrintPreview oPreviewQR = new PrintPreview();
                            oPreviewQR.report = oRptQRcode3T;
                            oPreviewQR.ShowDialog();

                            /*
                             * XtraReportPreviewModel model2 = new XtraReportPreviewModel(oRptQRcode3T);
                             * model2.AutoShowParametersPanel = false;
                             * DocumentPreviewWindow oPrev2 = new DocumentPreviewWindow() { Model = model2 };
                             * oPrev2.UpdateLayout();
                             *
                             * oPrev2.WindowStyle = System.Windows.WindowStyle.SingleBorderWindow;
                             * oPrev2.WindowState = System.Windows.WindowState.Normal;
                             * oPrev2.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
                             * oPrev2.Title = "IN MÃ QRCODE";
                             * //oPrev2.Topmost = true;
                             * oPrev2.ShowDialog(); */
                        }
                        else
                        {
                            rptHH_Barcode_35_22 oRptBarcode3T = new rptHH_Barcode_35_22();
                            oRptBarcode3T.InitMacode(isMaQR);
                            oRptBarcode3T.DataSource = otblMaCode;
                            oRptBarcode3T.BindData();

                            XtraReportPreviewModel model2 = new XtraReportPreviewModel(oRptBarcode3T);
                            model2.AutoShowParametersPanel = false;
                            DocumentPreviewWindow oPrev2 = new DocumentPreviewWindow()
                            {
                                Model = model2
                            };
                            //oRptBarcode3T.CreateDocument(false);
                            oPrev2.WindowStyle           = System.Windows.WindowStyle.SingleBorderWindow;
                            oPrev2.WindowState           = System.Windows.WindowState.Normal;
                            oPrev2.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
                            oPrev2.Title = "IN MÃ VẠCH";
                            //oPrev2.Topmost = true;
                            //SetCustomPageQR(oRptBarcode3T, isMauIn);
                            setFormatReport(oRptBarcode3T);
                            oPrev2.ShowDialog();
                        }

                        break;

                    case "30_30":
                        rptHH_QRCode_30_30 oReport30 = new rptHH_QRCode_30_30();
                        oReport30.InitMacode(isMaQR);
                        oReport30.DataSource = otblMaCode;
                        oReport30.BindData();
                        setFormatReport(oReport30);
                        SetCustomPageQR(oReport30);
                        PrintPreview oPreview30 = new PrintPreview();
                        oPreview30.report = oReport30;
                        oPreview30.ShowDialog();
                        break;
                    }
                }
                else
                {
                    Utils.showMessage("Không thể đọc dữ liệu tạo mã vạch..", "Thông báo");
                }
            }
            catch { }
        }
Exemple #25
0
        private void _btnadd_Click(object sender, RoutedEventArgs e)
        {
            if (_btnadd.Content.Equals("Add new"))
            {
                _btnadd.Content           = "Hoàn tất";
                _btnadd_cancel.IsEnabled  = true;
                _btnadd_cancel.Visibility = Visibility.Visible;
                _btnsave.IsEnabled        = false;
                _btndelete.IsEnabled      = false;
                _btndelete.IsEnabled      = false;
                _btnload.IsEnabled        = false;
                gridSachMuon.IsEnabled    = false;

                _txtmamuon.Clear();
                _txtsoluongmuon.Clear();
                _txttiencoc.Clear();
                _datemuon.Clear();
                _datetra.Clear();
                _checkdatra.IsChecked      = false;
                _cbbtendocgia.SelectedItem = null;
                _cbbtensach.SelectedItem   = null;


                return;
            }

            string warning = "";

            if (String.IsNullOrWhiteSpace(_txtsoluongmuon.Text))
            {
                warning += "Vui lòng nhập Số Lượng Sách Mượn." + '\n';
            }
            if (String.IsNullOrWhiteSpace(_txttiencoc.Text))
            {
                warning += "Vui lòng nhập tiền cọc." + '\n';
            }
            if (String.IsNullOrWhiteSpace(_cbbtendocgia.Text))
            {
                warning += "Vui lòng Chọn Độc Giả." + '\n';
            }
            if (String.IsNullOrWhiteSpace(_cbbtensach.Text))
            {
                warning += "Vui lòng Chọn Tên Sách." + '\n';
            }

            if (!warning.Equals(""))
            {
                MessageBox.Show(
                    warning,
                    "Thêm mới Sách Mượn",
                    MessageBoxButton.OK,
                    MessageBoxImage.Warning);
                return;
            }
            MuonSach sach = new MuonSach();

            try
            {
                sach.SoLuongMuon = Convert.ToInt16(_txtsoluongmuon.Text);
                sach.TienCoc     = Convert.ToDecimal(_txttiencoc.Text);
                if (_checkdatra.IsChecked == true)
                {
                    sach.DaTra = true;
                }
                else
                {
                    sach.DaTra = false;
                }

                if (_datemuon.Text.Equals("") == false && _datetra.Text.Equals("") == false)
                {
                    try
                    {
                        sach.NgayMuon = DateTime.Today;
                        sach.NgayHen  = Convert.ToDateTime(_datetra.Text);
                    }
                    catch { }
                }
                else
                {
                    sach.NgayMuon = DateTime.Today;
                    sach.NgayHen  = DateTime.Today;
                }
            }
            catch
            {
            }
            if (_cbbtendocgia.SelectedItem != null)
            {
                sach.MaDocGia = (_cbbtendocgia.SelectedItem as View_Models.DocGia).MaDocGia;
            }
            if (_cbbtensach.SelectedItem != null)
            {
                sach.MaSach = (_cbbtensach.SelectedItem as View_Models.Sach).MaSach;
            }
            Sach temp = _cbbtensach.SelectedItem as Sach;
            int  slcm = sachControll.CheckChoMuon(temp);

            if (slcm == 0)
            {
                warning += "Sách trong kho đã hết" + '\n';
            }
            if (slcm < sach.SoLuongMuon)
            {
                warning += "Sách trong kho còn:" + slcm + '\n';
            }
            if (!warning.Equals(""))
            {
                MessageBox.Show(
                    warning,
                    "Thêm mới Sách Mượn",
                    MessageBoxButton.OK,
                    MessageBoxImage.Warning);
                return;
            }

            if (sachMuonControll.Add(sach))
            {
                Sach sachtemp = sachControll.GetById(sach.MaSach);

                sachtemp.LuongDaMuon = sachMuonControll.GetTongSachMuon(sachtemp) == null? 0: sachMuonControll.GetTongSachMuon(sachtemp).Value;
                sachControll.Edit(sachtemp);
                DocGia dgtemp = docGiaControll.GetById(sach.MaDocGia);
                dgtemp.TienKiGui = sachMuonControll.GetTongTienCoc(dgtemp) == null ? 0 : sachMuonControll.GetTongTienCoc(dgtemp).Value;
                docGiaControll.Edit(dgtemp);
                MessageBox.Show(
                    "Thêm mới thành công",
                    "Thêm mới Sách Muọn",
                    MessageBoxButton.OK,
                    MessageBoxImage.Information);
                MessageBoxResult re;
                re = MessageBox.Show("Bạn có muốn in phiếu không", "In Phiếu", MessageBoxButton.YesNo, MessageBoxImage.Question);
                if (re == MessageBoxResult.Yes)
                {
                    BookLoanPhieuMuon report = new BookLoanPhieuMuon(sach.MaDocGia, sach.NgayMuon);
                    report.FilterString = "[DaTra] = false";
                    DocumentPreviewWindow window = new DocumentPreviewWindow();
                    window.PreviewControl.DocumentSource = report;
                    report.CreateDocument(true);
                    window.ShowDialog();
                }
            }
            else
            {
                MessageBox.Show(
                    "Thêm mới thất bại",
                    "Thêm mới Sách Mượn",
                    MessageBoxButton.OK,
                    MessageBoxImage.Error);
            }

            _btnadd.Content           = "Add new";
            _btnadd_cancel.IsEnabled  = false;
            _btnadd_cancel.Visibility = Visibility.Hidden;
            _btnsave.IsEnabled        = true;
            _btndelete.IsEnabled      = true;
            _btnload.IsEnabled        = true;
            gridSachMuon.IsEnabled    = true;
            LoadSachMuonTable();
        }