Ejemplo n.º 1
0
        protected override void doSetupContent(Graphics g)
        {
            string ukupanPrihodText = "Ukupan prihod za period ";
            ukupanPrihodText += fromDate.ToShortDateString() + " - "
                + toDate.ToShortDateString();

            decimal ukupanPrihod = DAOFactoryFactory.DAOFactory.GetUplataClanarineDAO().getUkupanPrihod(fromDate, toDate, null);
            string ukupanPrihodIznos = "   " + ukupanPrihod.ToString("F2");

            StringFormat format = new StringFormat();
            format.Alignment = StringAlignment.Far;
            float ukupanPrihodHeight = Math.Max(ukupanPrihodCaptionFont.GetHeight(g),
                ukupanPrihodIznosFont.GetHeight(g));
            RectangleF ukupanPrihodRect = new RectangleF(contentBounds.X,
                contentBounds.Y + ukupanPrihodHeight, contentBounds.Width, ukupanPrihodHeight);

            ukupanPrihodIznosReportText = new ReportText(
                ukupanPrihodIznos, ukupanPrihodIznosFont,
                blackBrush, ukupanPrihodRect, format);

            ukupanPrihodRect.Width -=
                g.MeasureString(ukupanPrihodIznos, ukupanPrihodIznosFont).Width;
            ukupanPrihodCaptionReportText = new ReportText(
                ukupanPrihodText, ukupanPrihodCaptionFont,
                blackBrush, ukupanPrihodRect, format);

            float listaStartOffset = 3 * ukupanPrihodHeight;
            if (listaStartOffset > contentBounds.Height)
                throw new SmallPageSizeException();

            lista.StartY = contentBounds.Y + listaStartOffset;
            lista.setupContent(g, contentBounds);
            lastPageNum = lista.LastPageNum;
        }
Ejemplo n.º 2
0
 public PharmacyHttp(MyDbContext context)
 {
     SftpService       = new SftpService();
     HttpRequests      = new HttpRequests();
     SmptServerService = new SmptServerService();
     ReportText        = new ReportText(context);
 }
Ejemplo n.º 3
0
 private void CompileToolStripMenuItem_Click(object sender, EventArgs e)
 {
     ReportText.Clear();
     ErrorText.Clear();
     try
     {
         File.WriteAllText(ConfigurationManager.AppSettings.Get("ErrorsFile"), string.Empty);
         if (string.IsNullOrEmpty(currFile))
         {
             MessageBox.Show("Збережіть файл перед тим як компілювати");
             return;
         }
         if (!ifSave)
         {
             Save();
         }
         tabControl.SelectedIndex = tabControl.TabPages.IndexOfKey("ReportTab");
         // Отримання і формування мен ввхідних та вихідних файлів
         var inFileName  = currFile;
         var outFileName = currWay + "\\" + currName + ".mc";
         ReportText.AppendText("Компілювання проекту почалось...\r\n");
         ReportText.AppendText("Вхідний файл проекту " + currName + ".as.\r\n");
         ReportText.AppendText("Пошук помилок...\r\n");
         bool isError = false;
         try
         {
             sol = new ASol();
             sol.Run(inFileName, outFileName);
         }
         catch (MessageException ex)
         {
             isError = true;
             File.WriteAllText(ConfigurationManager.AppSettings.Get("ErrorsFile"), ex.Message);
         }
         ErrorText.AppendText(File.ReadAllText(ConfigurationManager.AppSettings.Get("ErrorsFile")));
         if (!isError)
         {
             ReportText.AppendText("Помилок не знайдено.\r\n");
             ReportText.AppendText("Компілювання завершено.\r\n");
             ReportText.AppendText("Тепер можете запустити проект.\r\n");
             RunToolStripMenuItem.Enabled = true;
         }
         else
         {
             tabControl.SelectedIndex = tabControl.TabPages.IndexOfKey("ErrorTab");
             ReportText.AppendText("Упс.. знайшлись помилки.\r\n");
         }
     }
     catch (Exception ex)
     {
         Logger.Log.Error(ex.Message + " " + ex.StackTrace);
         tabControl.SelectedIndex = tabControl.TabPages.IndexOfKey("ErrorTab");
         ErrorText.AppendText("Упс.. щось сталось, гляньте Error.log");
         MessageBox.Show("Ой...щось пішло не так, гляньте Error.log", "НЛО", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Ejemplo n.º 4
0
 public ExportController(ReportContext context, IAuthorizeService authorizeService, IImageService imageService, IEmailService emailService)
 {
     _context          = context;
     _imageService     = imageService;
     _authorizeService = authorizeService;
     _emailService     = emailService;
     _imageHandler     = new ImageHandler();
     _largeRegularFont = new XFont("Arial", 20, XFontStyle.Bold);
     _medRegularFont   = new XFont("Arial", 13, XFontStyle.Regular);
     _medBoldFont      = new XFont("Arial", 13, XFontStyle.Bold);
     _smallRegularFont = new XFont("Arial", 8, XFontStyle.Regular);
     _smallBoldFont    = new XFont("Arial", 8, XFontStyle.Bold);
     _document         = new PdfDocument();
     _color            = new XSolidBrush(XColor.FromArgb(179, 204, 204));
     _text             = new ReportText();
 }
Ejemplo n.º 5
0
        protected override void doSetupContent(Graphics g)
        {
            float clanHeight = 0.0f;
            if (clanId != null)
            {
                Clan c = DAOFactoryFactory.DAOFactory.GetClanDAO().FindById(clanId.Value);
                string clan = Clan.formatPrezimeImeBrojDatumRodjAdresaMesto(
                    c.Prezime, c.Ime, c.Broj, c.DatumRodjenja, String.Empty, String.Empty);

                StringFormat format = new StringFormat();
                format.Alignment = StringAlignment.Near;
                clanHeight = g.MeasureString("0", clanFont).Height;
                RectangleF clanRect = new RectangleF(contentBounds.X,
                    contentBounds.Y + clanHeight, contentBounds.Width, clanHeight);

                clanReportText = new ReportText(clan, clanFont,
                    blackBrush, clanRect, format);
            }

            float itemHeight = g.MeasureString("0", itemFont).Height;
            float listaStartOffset;
            if (clanId != null)
            {
                listaStartOffset = 2.5f * clanHeight;
            }
            else
            {
                listaStartOffset = 1f * itemHeight;
            }
            if (listaStartOffset > contentBounds.Height)
                throw new SmallPageSizeException();

            lista.StartY = contentBounds.Y + listaStartOffset;
            lista.setupContent(g, contentBounds);
            lastPageNum = lista.LastPageNum;
        }
        protected override void doSetupContent(Graphics g)
        {
            System.Resources.ResourceManager resourceManager = new
                System.Resources.ResourceManager("Soko.Resources.PreviewResursi", this.GetType().Assembly);

            string ukupnoClanovaText =
                resourceManager.GetString("akt_clan_grupe_izv_uk_clan_caption");
            ukupnoClanovaText += " " + fromDate.ToShortDateString() + " - "
                + toDate.ToShortDateString();

            string ukupnoClanovaBroj = "   " + lista.Items.Count;

            StringFormat format = new StringFormat();
            format.Alignment = StringAlignment.Far;
            float ukupnoClanovaHeight = Math.Max(ukupnoClanovaCaptionFont.GetHeight(g),
                ukupnoClanovaBrojFont.GetHeight(g));
            RectangleF ukupnoClanovaRect = new RectangleF(contentBounds.X,
                contentBounds.Y + ukupnoClanovaHeight, contentBounds.Width, ukupnoClanovaHeight);

            ukupnoClanovaBrojReportText = new ReportText(
                ukupnoClanovaBroj, ukupnoClanovaBrojFont,
                blackBrush, ukupnoClanovaRect, format);

            ukupnoClanovaRect.Width -=
                g.MeasureString(ukupnoClanovaBroj, ukupnoClanovaBrojFont).Width;
            ukupnoClanovaCaptionReportText = new ReportText(
                ukupnoClanovaText, ukupnoClanovaCaptionFont,
                blackBrush, ukupnoClanovaRect, format);

            float listaStartOffset = 3 * ukupnoClanovaHeight;
            if (listaStartOffset > contentBounds.Height)
                throw new SmallPageSizeException();

            lista.StartY = contentBounds.Y + listaStartOffset;
            lista.setupContent(g, contentBounds);
            lastPageNum = lista.LastPageNum;
        }
Ejemplo n.º 7
0
 private void RunToolStripMenuItem_Click(object sender, EventArgs e)
 {
     ReportText.Clear();
     ErrorText.Clear();
     OutputText.Clear();
     try
     {
         File.WriteAllText(ConfigurationManager.AppSettings.Get("ErrorsFile"), string.Empty);
         if (string.IsNullOrEmpty(currFile))
         {
             MessageBox.Show("Збережіть файл перед тим як компілювати");
             return;
         }
         if (!ifSave)
         {
             Save();
         }
         tabControl.SelectedIndex = tabControl.TabPages.IndexOfKey("ReportTab");
         // Отримання і формування мен ввхідних та вихідних файлів
         var inFileName = Path.ChangeExtension(currFile, ".mc");
         if (!File.Exists(inFileName))
         {
             ReportText.AppendText($"Файл за шляхом: {inFileName} не знайдено!\r\n");
             ReportText.AppendText($"Скомпілюйте проект ще раз!\r\n");
         }
         else
         {
             var outFileName = currWay + "\\" + currName + ".mc_report";
             ReportText.AppendText("Запуск проекту почався...\r\n");
             ReportText.AppendText("Вхідний файл " + currName + ".mc.\r\n");
             ReportText.AppendText("Пошук помилок...\r\n");
             bool isError = false;
             try
             {
                 sol = new SSol();
                 sol.Run(inFileName, outFileName);
             }
             catch (MessageException ex)
             {
                 isError = true;
                 File.WriteAllText(ConfigurationManager.AppSettings.Get("ErrorsFile"), ex.Message);
             }
             ErrorText.AppendText(File.ReadAllText(ConfigurationManager.AppSettings.Get("ErrorsFile")));
             if (!isError)
             {
                 tabControl.SelectedIndex = tabControl.TabPages.IndexOfKey("OutputTab");
                 OutputText.AppendText(File.ReadAllText(outFileName));
                 ReportText.AppendText("Помилок не знайдено.\r\n");
                 ReportText.AppendText("Кінець.");
             }
             else
             {
                 tabControl.SelectedIndex = tabControl.TabPages.IndexOfKey("ErrorTab");
                 ReportText.AppendText("Упс.. знайшлись помилки.\r\n");
             }
         }
     }
     catch (Exception ex)
     {
         Logger.Log.Error(ex.Message + " " + ex.StackTrace);
         MessageBox.Show("Ой...щось пішло не так, глянь Error.log", "НЛО", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
        public override void drawHeader(Graphics g, int pageNum)
        {
            System.Resources.ResourceManager resourceManager = new
                System.Resources.ResourceManager("Soko.Resources.SlikeResursi", this.GetType().Assembly);
            Image sokoImage = (Image)resourceManager.GetObject("slika_soko");

            float upperHeight = headerBounds.Height / 2.1f;
            float lowerHeight = headerBounds.Height - upperHeight;
            RectangleF upperHeaderBounds = new RectangleF(headerBounds.Location,
                new SizeF(headerBounds.Width, upperHeight));
            RectangleF lowerHeaderBounds = new RectangleF(new PointF(headerBounds.X, headerBounds.Y + upperHeight),
                new SizeF(headerBounds.Width, lowerHeight));
            using(Pen pen = new Pen(Color.Black, 1/72f * 0.25f))
            {
                g.DrawRectangle(pen, upperHeaderBounds.X, upperHeaderBounds.Y,
                    upperHeaderBounds.Width, upperHeaderBounds.Height);
            }

            float pictureHeight = upperHeaderBounds.Height;
            float pictureWidth = pictureHeight * 1.2f;
            RectangleF pictureBounds = new RectangleF(headerBounds.X, headerBounds.Y, pictureWidth, pictureHeight);
            pictureBounds.Inflate(- 0.05f * pictureWidth, - 0.05f * pictureHeight);
            g.DrawImage(sokoImage, pictureBounds);

            resourceManager = new
                System.Resources.ResourceManager("Soko.Resources.PreviewResursi", this.GetType().Assembly);

            string sokDruVoj = resourceManager.GetString("izvestaj_header_sok_dru_voj");
            float sokDruVojHeight = sokDruVojFont.GetHeight(g);
            RectangleF sokDruVojRect = new RectangleF(headerBounds.X + pictureWidth,
                headerBounds.Y, headerBounds.Width - pictureWidth, sokDruVojHeight);
            ReportText sokDruVojReportText = new ReportText(sokDruVoj, sokDruVojFont,
                blackBrush, sokDruVojRect, sokDruVojFormat);

            string adresa = resourceManager.GetString("izvestaj_header_adresa");
            float adresaHeight = adresaFont.GetHeight(g) * 1.2f;
            RectangleF adresaRect = new RectangleF(sokDruVojRect.X,
                sokDruVojRect.Y + sokDruVojRect.Height, sokDruVojRect.Width, adresaHeight);
            ReportText adresaReportText = new ReportText(adresa, adresaFont,
                blackBrush, adresaRect, adresaFormat);

            string telFaxMail = resourceManager.GetString("izvestaj_header_tel_fax_mail");
            float telFaxMailHeight = telFaxMailFont.GetHeight(g) * 1.2f;
            RectangleF telFaxMailRect = new RectangleF(adresaRect.X,
                adresaRect.Y + adresaRect.Height, adresaRect.Width, telFaxMailHeight);
            ReportText telFaxMailReportText = new ReportText(telFaxMail, telFaxMailFont,
                blackBrush, telFaxMailRect, telFaxMailFormat);

            float titleHeight = titleFont.GetHeight(g);
            if (SubTitle != String.Empty)
                titleHeight += subTitleFont.GetHeight(g) * 1.5f;
            float titleY = lowerHeaderBounds.Y +
                (lowerHeaderBounds.Height - titleHeight);
            RectangleF titleRect = new RectangleF(lowerHeaderBounds.X, titleY,
                lowerHeaderBounds.Width, titleHeight);
            ReportText titleReportText = new ReportText(Title, titleFont,
                blackBrush, titleRect, titleFormat);
            ReportText subTitleReportText = null;
            if (SubTitle != String.Empty)
            {
                subTitleReportText = new ReportText(SubTitle, subTitleFont,
                    blackBrush, titleRect, subTitleFormat);
            }

            sokDruVojReportText.draw(g);
            adresaReportText.draw(g);
            telFaxMailReportText.draw(g);
            titleReportText.draw(g);
            if (subTitleReportText != null)
                subTitleReportText.draw(g);
        }