Exemplo n.º 1
0
        public async Task <Report> GetByTitle(ReportTitle title)
        {
            var titleFilter = new FilterDefinitionBuilder <ReportDto>().Eq(dto => dto.Title, title.Value);
            var result      = await _collection.FindAsync(titleFilter);

            return((await result.FirstOrDefaultAsync()).FromDto());
        }
Exemplo n.º 2
0
        // GET: Reports
        public ActionResult Index(DateTime?dateFrom, DateTime?dateTo)
        {
            //var dateFrom = DateTime.Parse( "3/1/2020");
            //var dateTo = DateTime.Parse("3/30/2020");
            if (dateFrom == null || dateTo == null)
            {
                return(View());
            }

            var grpId  = Operator().OwnerGroupId;
            var church = db.Churches.Where(x => x.OwnerGroupId == grpId).FirstOrDefault();

            var reporTitle = new ReportTitle()
            {
                ChurchName = church.Name,
                Period     = string.Format("Period: {0} - {1}", dateFrom.Value.ToShortDateString(), dateTo.Value.ToShortDateString())
            };

            var resut = new IncomeStatement()
            {
                Incomes                   = GetReportByType(AccountChartTypeEnum.Income, dateFrom.Value, dateTo.Value),
                Expenses                  = GetReportByType(AccountChartTypeEnum.Expenses, dateFrom.Value, dateTo.Value),
                NetAssetEndOfPeriod       = GetNetAsset(null, dateTo.Value, NetAsset.End),
                NetAssetBeginningOfPeriod = GetNetAsset(null, dateFrom.Value, NetAsset.Begginning),
                ReportTitle               = reporTitle
            };

            return(View(resut));
        }
Exemplo n.º 3
0
        private Report CreateAndSaveReport(int randomSalt)
        {
            var report = Report.CreateNew(
                ReportTitle.Make($"Report {randomSalt}"),
                $"Report {randomSalt} details",
                ReportShortcut.Make(randomSalt.ToString()),
                Color.Make(randomSalt, randomSalt, randomSalt),
                alwaysUniqueChecker
                );

            ReportRepository.Save(report);
            return(report);
        }
Exemplo n.º 4
0
        private void ScheduleJobButton_Click(object sender, RoutedEventArgs e)
        {
            Log($"Sending job #{ _jobId }.");

            var job = new ReportMessage(_jobId++, ReportTitle.Text);

            ReportTitle.SelectAll();

            Task.Run(async() =>
            {
                var retVal = await _api.Ask(job);
                Log(retVal.ToString());
            });
        }
Exemplo n.º 5
0
 public override int GetHashCode()
 {
     unchecked
     {
         int result = Title.GetHashCode();
         result = (result * 397) ^ Command.GetHashCode();
         result = (result * 397) ^ Arguments.GetHashCode();
         result = (result * 397) ^ InitialDirectory.GetHashCode();
         result = (result * 397) ^ OutputToImmediateWindow.GetHashCode();
         result = (result * 397) ^ ReportTitle.GetHashCode();
         result = (result * 397) ^ ArgsCollectorDllPath.GetHashCode();
         result = (result * 397) ^ ArgsCollectorClassName.GetHashCode();
         result = (result * 397) ^ ToolDirPath.GetHashCode();
         result = (result * 397) ^ (PackageVersion == null ? 0 : PackageVersion.GetHashCode());
         result = (result * 397) ^ (PackageIdentifier == null ? 0 : PackageIdentifier.GetHashCode());
         result = (result * 397) ^ (PackageName == null ? 0 : PackageName.GetHashCode());
         return(result);
     }
 }
Exemplo n.º 6
0
        public ActionResult FinancialPosition()
        {
            var grpId      = Operator().OwnerGroupId;
            var church     = db.Churches.Where(x => x.OwnerGroupId == grpId).FirstOrDefault();
            var reporTitle = new ReportTitle()
            {
                ChurchName = church.Name,
                Period     = string.Format("As of: {0}", DateTime.Now.ToShortDateString())
            };

            var result = new FinancialPosition()
            {
                ReportTitle = reporTitle,
                Assets      = GetFinancialPositionByType(AccountChartTypeEnum.Asset),
                LIabilities = GetFinancialPositionByType(AccountChartTypeEnum.Liability),
                NetAssets   = GetNetAsset(null, null, NetAsset.Net),
            };

            return(View(result));
        }
Exemplo n.º 7
0
 public Task <Report> GetByTitle(ReportTitle title)
 => Task.FromResult(_reports.Values.FirstOrDefault(report => report.Title == title));
Exemplo n.º 8
0
        public DirectoryReturn CheckForDirectory(string type)
        {
            string directoryPath = @"C:\Users\Public\Documents";
            string date          = DateTime.Now.ToShortDateString();
            string time          = DateTime.Now.ToShortTimeString();
            string BOM           = _jobNumber + "_Electrical_BOM_" + date + "_" + time;

            BOM = BOM.Replace('/', '.');
            BOM = BOM.Replace(':', '.');
            string path       = directoryPath + $"\\{BOM}_Report.xlsx";
            var    splitTitle = BOM.Split('_');

            ReportTitle = BOM;

            DirectoryReturn ReturnInfo;
            bool            IsAvailable = false;
            bool            canContinue = true;

            char[] noNoCharacters = { '*', '[', ']', '?', '|', ':', '<', '>' };
            if (ReportTitle == "")
            {
                string   user     = System.Security.Principal.WindowsIdentity.GetCurrent().Name;
                string[] username = user.Split('\\');
                ReportTitle = username[1] + "_" + DateTime.Now.ToShortDateString() + "_" + DateTime.Now.ToLongTimeString();
                ReportTitle = ReportTitle.Replace('/', '.');
                ReportTitle = ReportTitle.Replace(':', '.');
            }
            else
            {
                ReportTitle = ReportTitle.Replace('/', '_');
            }

            if (DirectoryPath == "" || DirectoryPath == null)
            {
                DirectoryPath = @"C:\Users\Public\Documents";
            }

            if (type == "PDF")
            {
                try
                {
                    string[] files = Directory.GetFiles(DirectoryPath, $"{ReportTitle}_REPORT.pdf", SearchOption.TopDirectoryOnly);
                    Path = DirectoryPath + $"\\{ReportTitle}_REPORT.pdf";

                    if (files.Contains(Path))
                    {
                        // Tools.Global.DisplayDialogBox(DialogBox.DialogType.OK, DialogBox.DialogImage.IMPORTANT, "There is a PDF with this name already. \nPlease change the name and export again.");
                        MessageBox.Show("There is a PDF with this name already. \nPlease change the name and export again.");
                        IsAvailable = false;
                    }
                    else
                    {
                        IsAvailable = true;
                    }
                }
                catch
                {
                    IsAvailable = false;
                }
            }

            if (type == "Excel")
            {
                try
                {
                    string[] files = Directory.GetFiles(DirectoryPath, $"{ReportTitle}_REPORT.xlsx", SearchOption.TopDirectoryOnly);
                    Path = DirectoryPath + $"\\{ReportTitle}_REPORT.xlsx";

                    if (files.Contains(Path))
                    {
                        //Tools.Global.DisplayDialogBox(DialogBox.DialogType.OK, DialogBox.DialogImage.IMPORTANT, "There is a excel file with this name already. \nPlease change the name and export again.");
                        MessageBox.Show("There is a excel file with this name already. \nPlease change the name and export again.");
                        IsAvailable = false;
                    }
                    else
                    {
                        IsAvailable = true;
                    }
                }
                catch
                {
                    IsAvailable = false;
                }
            }
            if (type == "Save")
            {
                try
                {
                    string[] files = Directory.GetFiles(DirectoryPath, $"{ReportTitle}_REPORT.xlsx", SearchOption.TopDirectoryOnly);
                    Path = DirectoryPath + $"\\{ReportTitle}_REPORT.xlsx";

                    if (files.Contains(Path))
                    {
                        MessageBox.Show("There is a excel file with this name already. \nPlease change the name and export again.");
                        //Tools.Global.DisplayDialogBox(DialogBox.DialogType.OK, DialogBox.DialogImage.IMPORTANT, "There is a excel file with this name already. \nPlease change the name and export again.");
                        IsAvailable = false;
                        canContinue = false;
                    }
                    else
                    {
                        IsAvailable = true;
                    }
                }
                catch
                {
                    IsAvailable = false;
                    canContinue = false;
                }
                if (canContinue)
                {
                    try
                    {
                        string[] files = Directory.GetFiles(DirectoryPath, $"{ReportTitle}_REPORT.pdf", SearchOption.TopDirectoryOnly);
                        Path = DirectoryPath + $"\\{ReportTitle}_REPORT.pdf";

                        if (files.Contains(Path))
                        {
                            //  Tools.Global.DisplayDialogBox(DialogBox.DialogType.OK, DialogBox.DialogImage.IMPORTANT, "There is a PDF with this name already. \nPlease change the name and export again.");
                            MessageBox.Show("There is a PDF with this name already. \nPlease change the name and export again.");
                            IsAvailable = false;
                        }
                        else
                        {
                            IsAvailable = true;
                        }
                    }
                    catch
                    {
                        IsAvailable = false;
                    }
                }
            }
            foreach (var item in noNoCharacters)
            {
                if (ReportTitle.Contains(item))
                {
                    //Tools.Global.DisplayDialogBox(DialogBox.DialogType.OK, DialogBox.DialogImage.IMPORTANT, "Couldn't save the file. \n-Make sure there is no file with the same name or the file with the same name is open.\n-Make sure the file name does not contain any of the following characters:  <  >  ?  [  ]  :  | or  *");
                    MessageBox.Show("Couldn't save the file. \n-Make sure there is no file with the same name or the file with the same name is open.\n-Make sure the file name does not contain any of the following characters:  <  >  ?  [  ]  :  | or  *");
                    IsAvailable = false;
                    break;
                }
            }
            ReturnInfo = new DirectoryReturn(ReportTitle, Path, IsAvailable);
            return(ReturnInfo);
        }
Exemplo n.º 9
0
 public async Task <bool> IsUnique(ReportTitle title)
 => await _repository.GetByTitle(title) == null;
Exemplo n.º 10
0
 public ReportTitleMustBeUniqueRule(IReportUniqueTitleChecker checker, ReportTitle reportTitle)
 {
     _checker = checker;
     _title   = reportTitle;
 }