Exemple #1
0
        private void ExcutePrintCommand()
        {
            var  repUtil = new ReportUtility();
            bool printed = repUtil.DirectPrinter(ReportToView);

            //Increment letter references
            if (printed)
            {
                try
                {
                    if (ReportToView != null)
                    {
                        string reportName = ReportToView.GetType().Name;

                        const string letersWithReferenceNum =
                            "LabourList_LabourListAmh_LabourListNew_LabourSingleLetterCustom1_" +
                            "LabourSingleLetterCustom4_TestimonialLetter_TestimonialLetterFor2_ForensicList";

                        if (letersWithReferenceNum.Contains(reportName))
                        {
                            _unitOfWork = new UnitOfWork(DbContextUtil.GetDbContextInstance());
                            SettingDTO setting = _unitOfWork.Repository <SettingDTO>().Query().Get().FirstOrDefault();
                            if (setting != null)
                            {
                                setting.CurrentLetterReferenceNumber++;
                                _unitOfWork.Repository <SettingDTO>().InsertUpdate(setting);
                                _unitOfWork.Commit();
                            }
                            _unitOfWork.Dispose();
                        }
                    }
                }
                catch
                {
                    MessageBox.Show("Can't Increment Letter Number");
                }
            }
        }