Exemplo n.º 1
0
        public Text_blocks Select_text_blocks_id(int nid, string nconnection_string)
        {
            SqlConnection conn = new SqlConnection(nconnection_string);

            conn.Open();
            string        z        = "SELECT * FROM Text_blocks WHERE id =" + nid;
            SqlCommand    command2 = new SqlCommand(z, conn);
            SqlDataReader reader   = command2.ExecuteReader();

            //int k = 0;
            //int c = 0;
            reader.Read();


            Text_blocks m = new Text_blocks(Convert.ToInt32(reader.GetValue(0)),
                                            Convert.ToInt32(reader.GetValue(1)),
                                            Convert.ToString(reader.GetValue(2)),
                                            Convert.ToString(reader.GetValue(3)),
                                            Convert.ToInt32(reader.GetValue(4)),
                                            Convert.ToString(reader.GetValue(5)),
                                            Convert.ToString(reader.GetValue(6)),
                                            Convert.ToString(reader.GetValue(7)),
                                            Convert.ToInt32(reader.GetValue(10)),
                                            Convert.ToInt32(reader.GetValue(11)),
                                            Convert.ToInt32(reader.GetValue(8)),
                                            Convert.ToInt32(reader.GetValue(9))
                                            );

            conn.Close();
            return(m);
        }
Exemplo n.º 2
0
        public List <Text_blocks> Select_text_blocks(string nconnection_string, int Maquette_id)
        {
            SqlConnection conn = new SqlConnection(nconnection_string);

            List <Text_blocks> m = new List <Text_blocks>();

            conn.Open();
            string        s       = "SELECT * FROM Text_blocks WHERE id_maquette_fk = " + Maquette_id;
            SqlCommand    command = new SqlCommand(s, conn);
            SqlDataReader reader  = command.ExecuteReader();
            int           k       = 0;

            //int c = 0;
            while (reader.Read())
            {
                Text_blocks maq = new Text_blocks(Convert.ToInt32(reader.GetValue(0)),
                                                  Convert.ToInt32(reader.GetValue(1)),
                                                  Convert.ToString(reader.GetValue(2)),
                                                  Convert.ToString(reader.GetValue(3)),
                                                  Convert.ToInt32(reader.GetValue(4)),
                                                  Convert.ToString(reader.GetValue(5)),
                                                  Convert.ToString(reader.GetValue(6)),
                                                  Convert.ToString(reader.GetValue(7)),
                                                  Convert.ToInt32(reader.GetValue(8)),
                                                  Convert.ToInt32(reader.GetValue(9)),
                                                  Convert.ToInt32(reader.GetValue(10)),
                                                  Convert.ToInt32(reader.GetValue(11))
                                                  );
                m.Add(maq);
                k++;
            }

            return(m);
        }
Exemplo n.º 3
0
        public Text_blocks Select_text_block(int nid, string nconnection_string)
        {
            SqlConnection conn = new SqlConnection(nconnection_string);

            conn.Open();
            string        s       = "SELECT * FROM Text_blocks WHERE id =" + nid;
            SqlCommand    command = new SqlCommand(s, conn);
            SqlDataReader reader  = command.ExecuteReader();
            Text_blocks   m       = null;

            while (reader.Read())
            {
                m = new Text_blocks(Convert.ToInt32(reader.GetValue(0)),
                                    Convert.ToInt32(reader.GetValue(1)),
                                    Convert.ToString(reader.GetValue(2)),
                                    Convert.ToString(reader.GetValue(3)),
                                    Convert.ToInt32(reader.GetValue(4)),
                                    Convert.ToString(reader.GetValue(5)),
                                    Convert.ToString(reader.GetValue(6)),
                                    Convert.ToString(reader.GetValue(7)),
                                    Convert.ToInt32(reader.GetValue(8)),
                                    Convert.ToInt32(reader.GetValue(9)),
                                    Convert.ToInt32(reader.GetValue(10)),
                                    Convert.ToInt32(reader.GetValue(11))
                                    );
            }
            return(m);
        }
Exemplo n.º 4
0
        public Report Create_maquette_fasrreport(int nid)
        {
            Maquette m = new Maquette();

            m = m.Select_maquette_id(nid, connection_string);
            Format f = new Format();

            f = f.Select_format_id(m.id_fk_format, connection_string);
            Add_report_page(f.Width, f.Height);
            report.Pages.Add(page[0]);

            page[0].ReportTitle      = new ReportTitleBand();
            page[0].ReportTitle.Name = "lkjhljkhlhnljkn";
            // set its height to 1.5cm
            page[0].ReportTitle.Height = Units.Millimeters * f.Height;
            PictureObject picture = new PictureObject();
            //picture.ForceLoadImage("C://Users//Svetlana//Desktop//1.jpg");

            float w = Convert.ToSingle(Math.Round(f.Width * 3.8));
            float h = Convert.ToSingle(Math.Round(f.Height * 3.8));

            picture.Bounds = new RectangleF(0, 0, w, h); //Set object bounds
            String s = Environment.CurrentDirectory + "\\Maquette\\" + m.Background_image;

            // Bitmap b1 = new Bitmap(s);
            // Bitmap b2 = new Bitmap(b1, new Size(f.Width*4, f.Height*4));


            // picture.Image = b2; //Set picture

            picture.Image = new Bitmap(s); //Set picture
            page[0].ReportTitle.Objects.Add(picture);


            Text_blocks        t  = new Text_blocks();
            List <Text_blocks> tb = t.Select_text_blocks(connection_string, nid);

            for (int i = 0; i < tb.Count; i++)
            {
                TextObject txt = new TextObject();
                float      wt  = Convert.ToSingle(Math.Round(tb[i].Width * 3.8));
                float      ht  = Convert.ToSingle(Math.Round(tb[i].Height * 3.8));
                txt.Bounds = new RectangleF(tb[i].X, tb[i].Y, wt, ht);
                txt.Text   = tb[i].Content;
                if (tb[i].Alignment_text.Trim() == "По левому краю")
                {
                    txt.HorzAlign = HorzAlign.Left;

                    /*По левому краю*/
                }
                else if (tb[i].Alignment_text.Trim() == "По центру")
                {
                    txt.HorzAlign = HorzAlign.Center; //По центру
                }

                else if (tb[i].Alignment_text.Trim() == "По правому краю")
                {
                    txt.HorzAlign = HorzAlign.Right; //По правому краю
                }

                else if (tb[i].Alignment_text.Trim() == "По ширине")
                {
                    txt.HorzAlign = HorzAlign.Justify; //По ширине
                }


                FontStyle styl = FontStyle.Regular;
                if (tb[i].Mark_text.Trim() == "Bold")
                {
                    styl = FontStyle.Bold;
                }

                else if (tb[i].Mark_text.Trim() == "Italic")
                {
                    styl = FontStyle.Italic;
                }

                else if (tb[i].Mark_text.Trim() == "Underline")
                {
                    styl = FontStyle.Underline;
                }

                else if (tb[i].Mark_text.Trim() == "Regular")
                {
                    styl = FontStyle.Regular;
                }

                else if (tb[i].Mark_text.Trim() == "Strikeout")
                {
                    styl = FontStyle.Strikeout;
                }
                FontFamily fam = new FontFamily(tb[i].Font_type);

                txt.Font = new Font(fam, tb[i].Font_size, styl);
                page[0].ReportTitle.Objects.Add(txt);
            }


            Image_blocks        im = new Image_blocks();
            List <Image_blocks> bl = im.Select_image_blocks(connection_string, nid);

            for (int i = 0; i < bl.Count; i++)
            {
                PictureObject pict = new PictureObject();
                //picture.ForceLoadImage("C://Users//Svetlana//Desktop//1.jpg");

                float wp = Convert.ToSingle(Math.Round(bl[i].Width * 3.8));
                float hp = Convert.ToSingle(Math.Round(bl[i].Height * 3.8));
                pict.Bounds = new RectangleF(0, 0, wp, hp); //Set object bounds
                String sp = Environment.CurrentDirectory + "\\Image_blocks\\" + bl[i].Image_content;
                // Bitmap b1 = new Bitmap(s);
                // Bitmap b2 = new Bitmap(b1, new Size(f.Width*4, f.Height*4));


                // picture.Image = b2; //Set picture

                pict.Image = new Bitmap(sp); //Set picture
                page[0].ReportTitle.Objects.Add(pict);
            }


            return(report);
        }