Example #1
0
        protected void Page_LoadComplete(object sender, EventArgs e)
        {
            Processes.Check_status();

            try
            {
                ReportList = ClientReports.GenerateClientReport(Request.QueryString["Client"], Request.QueryString["Start"], Request.QueryString["End"]);
                foreach (var item in ReportList.ToList())
                {
                    ClientReports.Sum += TimeSpan.Parse(item.Fulltime);
                }
            }
            catch (Exception)
            {
            }


            rpTableClients.DataSource = ReportList;
            rpTableClients.DataBind();

            ddlClient.DataSource     = ClientList;
            ddlClient.DataTextField  = "Title";
            ddlClient.DataValueField = "IDClient";
            ddlClient.DataBind();
        }
 public ExcelPrintedDocument GetClientReportPrintedDocument(ClientReports reports)
 {
     try
     {
         using (var printService = new ExcelDocumentBuilder())
         {
             return(printService.GetReportOfClientList(reports));
         }
     }
     catch (Exception ex)
     {
         LoggerProvider.Logger.Log(ex);
         throw;
     }
 }
Example #3
0
        public ClientReports GetClientReports()
        {
            try
            {
                using (var aimp = new Aimp(_login, _password))
                {
                    var result = new ClientReports();

                    result.Banks = aimp.GetBanks();

                    result.Items = aimp.GetBankReportClients()
                                   .GroupBy(g => g.ClientReport)
                                   .Select(x => new ClientReportListItem()
                    {
                        Id = x.Key.Id,
                        BankStatusesReportClient = (from b in result.Banks
                                                    join bs in x.Select(y => new { y.Bank.Id, y.BankStatus.MiddleName })
                                                    on b.Id equals bs.Id
                                                    into statusDefault
                                                    from bs in statusDefault.DefaultIfEmpty()
                                                    select bs?.MiddleName
                                                    ).ToArray(),
                        ClientStatusReportClient      = x.Key.ClientStatus?.Name,
                        DateReportClient              = x.Key.Date.ToString("dd.MM.yyyy"),
                        FullNameReportClient          = x.Key.FullName,
                        ManagerReportClient           = x.Key.User?.LastName,
                        PriceTrancportReportClient    = x.Key.Price.ToString(),
                        ProgrammCreditReportClient    = x.Key.CreditProgramm?.Name,
                        SourceInfoReportClient        = x.Key.Source,
                        TelefonReportClient           = x.Key.Telefon,
                        TotalContributionReportClient = x.Key.TotalContribution?.ToString(),
                        TrancportNameReportClient     = x.Key.Trancport
                    });

                    return(result);
                }
            }
            catch (Exception ex)
            {
                return(new ClientReports(ex));
            }
        }
        public IPrintedDocument PrintReport(ClientReports report)
        {
            try
            {
                CheckViewRight();

                using (var printService = new ExcelPrintedDocumentService())
                {
                    return(printService.GetReportOfClientList(report));
                }
            }
            catch (AccessDeniedException)
            {
                throw;
            }
            catch (Exception ex)
            {
                Logger.Instance.Log(ex);
                throw new Exception("Не удалось сформировать отчет, обратитесь к администратору");
            }
        }
Example #5
0
        public ClientReports GetClientReports()
        {
            var result = new ClientReports();

            result.UserLastNameForFilter   = _logic.GetUser().LastName;
            result.ClientStatusesForFilter = _logic.GetClientStatuses()
                                             .Where(x => x.UsedFilter)
                                             .Select(x => x.Name);
            result.Banks = _logic.GetBanks();

            result.Items = _logic.GetBankReportClients().ToList()
                           .GroupBy(g => g.ClientReport)
                           .OrderByDescending(x => x.Key.Date)
                           .Select(x => new ClientReportListItem()
            {
                Id = x.Key.Id,
                BankStatusesReportClient = (from b in result.Banks
                                            join bs in x.Select(y => new { y.Bank.Id, y.BankStatus.MiddleName })
                                            on b.Id equals bs.Id
                                            into statusDefault
                                            from bs in statusDefault.DefaultIfEmpty()
                                            select bs?.MiddleName
                                            ).ToArray(),
                ClientStatusReportClient      = x.Key.ClientStatus.Name,
                DateReportClient              = x.Key.Date.ToString(DataFormats.DateFormat),
                FullNameReportClient          = x.Key.FullName,
                ManagerReportClient           = x.Key.User.LastName,
                PriceTrancportReportClient    = x.Key.Price.ToString(),
                ProgrammCreditReportClient    = x.Key.CreditProgramm.Name,
                SourceInfoReportClient        = x.Key.Source,
                TelefonReportClient           = x.Key.Telefon,
                TotalContributionReportClient = x.Key.TotalContribution?.ToString(),
                TrancportNameReportClient     = x.Key.Trancport
            }).ToList();

            return(result);
        }
Example #6
0
        public ExcelPrintedDocumentDto GetClientReportPrintedDocument(ClientReports reports)
        {
            try
            {
                _WriteLineConsole("get client report printed document");

                using (var printedService = new ClientReportHelper())
                {
                    return(new ExcelPrintedDocumentDto()
                    {
                        Document = printedService.GetPrintedReportList(reports)
                    });
                }
            }
            catch (Exception ex)
            {
                _WriteLineError("get client report printed document", ex.Message);
                return(new ExcelPrintedDocumentDto()
                {
                    Error = true,
                    Message = ex.Message
                });
            }
        }
 public ExcelPrintedDocument GetClientReportPrintedDocument(ClientReports reports)
 {
     throw new NotImplementedException();
 }
        public IPrintedDocument GetReportOfClientList(ClientReports reports)
        {
            string _pathSaveFile = Directory.GetCurrentDirectory();
            string fileName      = _pathSaveFile + "\\tmpPDoc" +
                                   Guid.NewGuid().ToString() +
                                   ".xlsx";
            string saveFile = _pathSaveFile + "\\tmpPDoc" +
                              Guid.NewGuid().ToString() +
                              ".xlsx";

            try
            {
                _excel = new DocExcel("Отчёт", "Отчёт", Microsoft.Office.Interop.Excel.XlPageOrientation.xlLandscape);
                _excel.SetColumn(1, 1, "Дата подачи заявки");
                _excel.SetColumn(1, 2, "Ф.И.О. Заемщика");
                _excel.SetColumn(1, 3, "Телефон");
                _excel.SetColumn(1, 4, "Данные ТС");
                _excel.SetColumn(1, 5, "Стоимость ТС");
                _excel.SetColumn(1, 6, "Общий взнос");
                _excel.SetColumn(1, 7, "Программа кредитования");
                int bankColumnsCount = reports.Banks.Count();
                var banks            = reports.Banks.ToList();
                for (int iColumn = 8; iColumn < bankColumnsCount; iColumn++)
                {
                    _excel.SetColumn(1, iColumn, banks[iColumn].Name, Microsoft.Office.Interop.Excel.XlOrientation.xlVertical);
                }
                _excel.SetColumn(1, bankColumnsCount, "Статус клиента");
                _excel.SetColumn(1, bankColumnsCount + 1, "Источник");
                int iRow = 1;
                foreach (var iReport in reports.Items)
                {
                    iRow++;
                    _excel.SetValue(iRow, 1, iReport.DateReportClient);
                    _excel.SetValue(iRow, 2, iReport.FullNameReportClient);
                    _excel.SetValue(iRow, 3, iReport.TelefonReportClient);
                    _excel.SetValue(iRow, 4, iReport.TrancportNameReportClient);
                    _excel.SetValue(iRow, 5, iReport.PriceTrancportReportClient);
                    _excel.SetValue(iRow, 6, iReport.TotalContributionReportClient);
                    _excel.SetValue(iRow, 7, iReport.ProgrammCreditReportClient);
                    for (int iColumn = 8; iColumn < bankColumnsCount; iColumn++)
                    {
                        _excel.SetValue(iRow, iColumn, iReport.BankStatusesReportClient[iColumn]);
                    }
                    _excel.SetValue(iRow, bankColumnsCount, iReport.ClientStatusReportClient);
                    _excel.SetValue(iRow, bankColumnsCount + 1, iReport.SourceInfoReportClient);
                }
                _excel.Save(saveFile);

                byte[] file = File.ReadAllBytes(saveFile);
                return(new ExcelPrintedDocument()
                {
                    File = file
                });
            }
            catch (Exception ex)
            {
                Dispose();

                throw ex;
            }
            finally
            {
                try
                {
                    File.Delete(fileName);
                    File.Delete(saveFile);
                    _excel.Quit();
                }
                catch (Exception ex)
                { }
            }
        }
Example #9
0
 public ExcelPrintedDocument GetPrintedReportList(ClientReports reports)
 {
     return((ExcelPrintedDocument)_logic.PrintReport(reports));
 }
        public ClientReports GetClientReports()
        {
            try
            {
                using (var context = IoC.Resolve <IAimpContext>())
                {
                    var result = new ClientReports();
                    result.UserLastNameForFilter   = context.Users.Get(CurrentUserProvider.Account.Id).LastName;
                    result.ClientStatusesForFilter = context.ClientStatuses.All()
                                                     .Where(x => x.UsedFilter)
                                                     .Select(x => x.Name)
                                                     .ToList();
                    result.Banks = context.Banks.All().ToList();

                    IEnumerable <IBankReportClient> bankReportClients = null;
                    if (CurrentUserProvider.Account.IsAdmin())
                    {
                        bankReportClients = context.BankReportClients
                                            .All(x => x.BankStatus, x => x.ClientReport.User, x => x.ClientReport.ClientStatus, x => x.ClientReport.CreditProgramm)
                                            .ToList();
                    }
                    else
                    {
                        bankReportClients = context.BankReportClients
                                            .All(x => x.BankStatus, x => x.ClientReport.User, x => x.ClientReport.ClientStatus, x => x.ClientReport.CreditProgramm)
                                            .Where(x => x.ClientReport.User.Id == CurrentUserProvider.Account.Id)
                                            .ToList();
                    }

                    result.Items = bankReportClients
                                   .GroupBy(g => g.ClientReport)
                                   .OrderByDescending(x => x.Key.Date)
                                   .Select(x => new ClientReportListItem()
                    {
                        Id = x.Key.Id,
                        BankStatusesReportClient = (from b in result.Banks
                                                    join bs in x.Select(y => new { y.Bank.Id, y.BankStatus.MiddleName })
                                                    on b.Id equals bs.Id
                                                    into statusDefault
                                                    from bs in statusDefault.DefaultIfEmpty()
                                                    select bs?.MiddleName
                                                    ).ToArray(),
                        ClientStatusReportClient      = x.Key.ClientStatus.Name,
                        DateReportClient              = x.Key.Date.ToString(AimpDataFormats.DateFormat),
                        FullNameReportClient          = x.Key.FullName,
                        ManagerReportClient           = x.Key.User.LastName,
                        PriceTrancportReportClient    = x.Key.Price.ToString(),
                        ProgrammCreditReportClient    = x.Key.CreditProgramm.Name,
                        SourceInfoReportClient        = x.Key.Source,
                        TelefonReportClient           = x.Key.Telefon,
                        TotalContributionReportClient = x.Key.TotalContribution?.ToString(),
                        TrancportNameReportClient     = x.Key.Trancport
                    }).ToList();

                    return(result);
                }
            }
            catch (Exception ex)
            {
                LoggerProvider.Logger.Log(ex);
                throw;
            }
        }