Exemple #1
0
        public static void Run(string outputPdfPath)
        {
            // PDF to read form fields from
            PdfDocument pdfDocument = new PdfDocument(Util.GetResourcePath("PDFs/fw9AcroForm_18_filled.pdf"));

            // Create Table to display the form fields and values
            Table2 table = new Table2(0, 0, 512, 676, Font.Helvetica, 12);

            table.Border.Width            = 1;
            table.Border.Color            = RgbColor.Black;
            table.RepeatColumnHeaderCount = 1;
            table.RepeatRowHeaderCount    = 1;
            BuildTable(table);
            CreateList(table, pdfDocument.Form.Fields);

            Document document = new Document();

            AddTableToPage(document, table);

            Table2 overflowRowTable = table.GetOverflowRows();

            while (overflowRowTable != null)
            {
                AddTableToPage(document, overflowRowTable);
                overflowRowTable = overflowRowTable.GetOverflowRows();
            }
            document.Draw(outputPdfPath);
        }
Exemple #2
0
        private void Swap2ndTableElements(int index, int indToRepl)
        {
            Table2 tmp = table2[index];

            table2[index]     = table2[indToRepl];
            table2[indToRepl] = tmp;
        }
 public static void AddColumns(Table2 table, float width)
 {
     for (int i = 0; i < 7; i++)
     {
         table.Columns.Add(width / 7);
     }
 }
Exemple #4
0
        //---------------------------------------------------
        public bool AddParametre(IColumnDeEasyQuery colFromTable1, IColumnDeEasyQuery colFromTable2)
        {
            if (Table1 == null || Table2 == null)
            {
                return(false);
            }
            CDefinitionProprieteDynamique def1 = null;
            CDefinitionProprieteDynamique def2 = null;

            foreach (CDefinitionProprieteDynamique def in Table1.GetDefinitionsChamps(Table1.GetType()))
            {
                if (def.NomProprieteSansCleTypeChamp == colFromTable1.ColumnName)
                {
                    def1 = def;
                    break;
                }
            }
            foreach (CDefinitionProprieteDynamique def in Table2.GetDefinitionsChamps(Table2.GetType()))
            {
                if (def.NomProprieteSansCleTypeChamp == colFromTable2.ColumnName)
                {
                    def2 = def;
                    break;
                }
            }
            if (def1 != null && def2 != null)
            {
                CParametreJointure parametre = new CParametreJointure(
                    new C2iExpressionChamp(def1),
                    new C2iExpressionChamp(def2));
                m_listeParametresJointure.Add(parametre);
                return(true);
            }
            return(false);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            string        connetionString;
            SqlConnection cnn;

            connetionString = WebConfigurationManager.ConnectionStrings["constr"].ConnectionString;
            cnn             = new SqlConnection(connetionString);
            cnn.Open();
            int            vw_id = Convert.ToInt32(Session["ids"]);
            String         sql1  = "Select original_content_id,date,text FROM Comment WHERE Viewer_id=" + "'" + vw_id + "'";
            SqlDataAdapter sda1  = new SqlDataAdapter(sql1, cnn);
            DataTable      t1    = new DataTable();

            sda1.Fill(t1);
            Table1.DataSource = t1;
            Table1.DataBind();

            String         sql2 = "Select  C.*,O.rating From Original_Content O INNER JOIN Content C ON O.ID=C.ID";
            SqlDataAdapter sda2 = new SqlDataAdapter(sql2, cnn);
            DataTable      t2   = new DataTable();

            sda2.Fill(t2);
            Table2.DataSource = t2;
            Table2.DataBind();


            cnn.Close();
        }
Exemple #6
0
        private void LoadTableDemo()
        {
            DataTable dt = new DataTable();

            dt.Columns.Add("Id", typeof(int));
            dt.Columns.Add("Name", typeof(string));
            dt.Columns.Add("Age", typeof(string));

            for (int i = 0; i < 3; i++)
            {
                int     id  = i + 1;
                DataRow row = dt.NewRow();
                row["Id"]   = id;
                row["Name"] = "Name " + id;
                row["Age"]  = id * 10;

                dt.Rows.Add(row);
            }

            Table1.DataSource = dt;
            Table1.DataBind();

            Table2.DataSource = dt;
            Table2.DataBind();

            Table3.DataSource = dt;
            Table3.DataBind();

            Table4.DataSource = dt;
            Table4.DataBind();

            Table5.DataSource = dt;
            Table5.DataBind();
        }
Exemple #7
0
        public ActionResult PersonCourses()
        {
            using (SchoolEntitiesDBContext db = new SchoolEntitiesDBContext())
            {
                List <OnlineCourse> onlineCourses    = new List <OnlineCourse>();
                List <OnsiteCourse> onsiteCourses    = new List <OnsiteCourse>();
                List <PersonCours>  allPersonCourses = new List <PersonCours>();

                onsiteCourses    = db.OnsiteCourses.ToList();
                onlineCourses    = db.OnlineCourses.ToList();
                allPersonCourses = db.PersonCourses.ToList();
                SessionData objSession            = Session["UserData"] as SessionData;
                var         lstAllCoursesOfPerson = from objOnlineCourse in onlineCourses
                                                    join objOnsiteCourse in onsiteCourses
                                                    on objOnlineCourse.CourseID equals objOnsiteCourse.CourseID into Table1
                                                    from objOnsiteCourse in Table1.ToList()
                                                    join objPersonCourses in allPersonCourses
                                                    on objOnsiteCourse.CourseID equals objPersonCourses.CourseID into Table2
                                                    from objPersonCourses in Table2.ToList()
                                                    where objPersonCourses.PersonID == objSession.PersonID
                                                    select new PersonCourses
                {
                    busOnlineCourses = objOnlineCourse,
                    busOnsiteCourses = objOnsiteCourse,
                    busPersonCourses = objPersonCourses
                };
                return(View(lstAllCoursesOfPerson));
            }
        }
        public ActionResult DeleteConfirmed(int id)
        {
            Table2 table2 = db.Table2.Find(id);

            db.Table2.Remove(table2);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemple #9
0
        private static void PlaceByKeyAndIndex(string key, int index)
        {
            int    indToRepl = Array.FindIndex(table2, i => i.Name == key);
            Table2 tmp       = table2[index];

            table2[index]     = table2[indToRepl];
            table2[indToRepl] = tmp;
        }
Exemple #10
0
        /// <summary>
        /// 新しい Table2 オブジェクトを作成します。
        /// </summary>
        /// <param name="id">ID の初期値。</param>
        /// <param name="name">name の初期値。</param>
        public static Table2 CreateTable2(long id, string name)
        {
            Table2 table2 = new Table2();

            table2.ID   = id;
            table2.name = name;
            return(table2);
        }
    static void Main(string[] args)
    {
        ReportDirections reportDirections = new ReportDirections();

        reportDirections.selected = "inbound";
        Times Times = new Times();

        Times.dateRange = "Last5Minutes";
        Filters Filters = new Filters();

        Filters.sdfDips_0 = "in_AC10033A_AC10033A-410";
        DataGranularity DataGranularity = new DataGranularity();

        DataGranularity.selected = "auto";
        ReportDetails ReportDetails = new ReportDetails();

        ReportDetails.reportTypeLang   = "conversations";
        ReportDetails.reportDirections = reportDirections;
        ReportDetails.times            = Times;
        ReportDetails.filters          = Filters;
        ReportDetails.dataGranularity  = DataGranularity;
        //
        QueryLimit QueryLimit = new QueryLimit();

        QueryLimit.offset       = 0;
        QueryLimit.max_num_rows = 1;
        QueryLimit2 QueryLimit2 = new QueryLimit2();

        QueryLimit2.offset       = 0;
        QueryLimit2.max_num_rows = 1;
        Table Table = new Table();

        Table.query_limit = QueryLimit;
        Table2 Table2 = new Table2();

        Table2.query_limit = QueryLimit2;
        Inbound Inbound = new Inbound();

        Inbound.table = Table;
        Outbound Outbound = new Outbound();

        Outbound.table = Table2;
        DataINeed DataINeed = new DataINeed();

        DataINeed.inbound  = Inbound;
        DataINeed.outbound = Outbound;
        WebClient _webClient = new WebClient();

        _webClient.Headers.Add("Content-Type", "application/json");
        string data_requested = HttpUtility.UrlEncode(JsonConvert.SerializeObject(DataINeed));
        string rpt_json       = HttpUtility.UrlEncode(JsonConvert.SerializeObject(ReportDetails));
        string data           = "action=get&rm=report_api&data_requested=" + data_requested + "&rpt_json=" + rpt_json;

        string address      = "http://gh-scr-d01.diti.lr.net/fcgi/scrut_fcgi.fcgi";
        var    responseText = Encoding.Default.GetString(_webClient.UploadData(address, "POST", Encoding.Default.GetBytes(data)));

        Console.WriteLine(responseText);
    }
        static void Main(string[] args)
        {
            var ihost = Host.CreateDefaultBuilder(args)
                        .ConfigureServices((context, services) =>
            {
                services.AddDbContext <ShawnDbContext>(
                    options => options.UseNpgsql(
                        "host=172.16.0.20;database=bank_cqm_test;username=cqm_app;password=SynyiCqm;PersistSecurityInfo=true;Maximum Pool Size=100;Connection Idle Lifetime=5;Connection Pruning Interval=5"));
            }).Build();

            IServiceProvider provider = ihost.Services;


            ihost.Start();


            using (var scope = provider.CreateScope())
            {
                var tt = scope.ServiceProvider.GetRequiredService <ShawnDbContext>();

                using (var trans = tt.Database.BeginTransaction())
                {
                    try
                    {
                        Table1 t1 = new Table1
                        {
                            Id    = 1,
                            Name  = "Shawn1",
                            Score = 99
                        };

                        Table2 t2 = new Table2
                        {
                            Id   = 1,
                            Name = "Shawn1",
                            Age  = 29
                        };

                        tt.Add(t1);

                        tt.Add(t2);

                        tt.SaveChanges();

                        trans.Commit();
                    }
                    catch (Exception e)
                    {
                        trans.Rollback();
                    }
                }
            }



            Console.WriteLine("Hello World!");
        }
 public static void BuildTable(Table2 table)
 {
     CreateColumns(table);
     CreateRowHeadings(table);
     foreach (var data in tableData)
     {
         CreateRow(table, data);
     }
 }
Exemple #14
0
        private static void AddTableToPage(Document document, Table2 table)
        {
            Page page = new Page(PageSize.Letter);

            if (table != null)
            {
                page.Elements.Add(table);
            }
            document.Pages.Add(page);
        }
 public ActionResult Edit([Bind(Include = "cost,Trains,Planes,Rockets")] Table2 table2)
 {
     if (ModelState.IsValid)
     {
         db.Entry(table2).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(table2));
 }
Exemple #16
0
        private static void CreateRowHeadings(Table2 table)
        {
            Row2 row = table.Rows.Add(40, Font.TimesBold, 12, RgbColor.Black, RgbColor.LightGrey);

            row.CellDefault.Align  = TextAlign.Center;
            row.CellDefault.VAlign = VAlign.Top;
            row.Cells.Add("FormField Name");
            row.Cells.Add("FormField Type");
            row.Cells.Add("FormField Value");
        }
 public ActionResult Edit([Bind(Include = "contactno_,phone,customerID")] Table2 table2)
 {
     if (ModelState.IsValid)
     {
         db.Entry(table2).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(table2));
 }
        public static void AddTableToPage(Document document, Table2 table, int currentRow, int currentColumn)
        {
            Page page = new Page(PageSize.Letter);

            if (table != null)
            {
                page.Elements.Add(table);
            }
            page.Elements.Add(new Label("(" + currentRow + "," + currentColumn + ")", 0, page.Dimensions.Body.Height - 12, page.Dimensions.Body.Width, 12, Font.Helvetica, 12, TextAlign.Center));
            document.Pages.Add(page);
        }
        public ActionResult Create([Bind(Include = "contactno_,phone,customerID")] Table2 table2)
        {
            if (ModelState.IsValid)
            {
                db.Table2.Add(table2);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(table2));
        }
        public ActionResult Create([Bind(Include = "cost,Trains,Planes,Rockets")] Table2 table2)
        {
            if (ModelState.IsValid)
            {
                db.Table2.Add(table2);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(table2));
        }
 public ActionResult Edit([Bind(Include = "Number,Gender,Awards,Price")] Table2 table2)
 {
     if (ModelState.IsValid)
     {
         db.Entry(table2).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.Price = new SelectList(db.Table1, "Price", "Songs", table2.Price);
     return(View(table2));
 }
        private void InitData(string databaseName)
        {
            var optionBuilder = new DbContextOptionsBuilder()
                                .UseInMemoryDatabase(databaseName: databaseName)
                                .Options;

            _context = new TestContext(optionBuilder);

            var table1      = _context.Set <Table1>();
            var table3Entry = new Table3()
            {
                Id   = 1,
                Name = "Test2"
            };
            var table2Entry = new Table2()
            {
                Name           = "Test2",
                Id             = "Abc",
                ThirdTableRows = new List <Table3>()
                {
                    table3Entry
                }
            };
            var table1Entry = new Table1()
            {
                Name            = "Test",
                SecondTableRows = new List <Table2>()
                {
                    table2Entry
                },
                Id = Guid.Parse("542c31f0-35e3-4a7d-a939-803f18f94669")
            };

            table1.Add(table1Entry);

            var table1Entry_2 = new Table1()
            {
                Name = "Test",
                Id   = Guid.Parse("642c31f0-35e3-4a7d-a939-803f18f94669")
            };

            table1.Add(table1Entry_2);

            var additionalData = _context.Set <AdditionalData>();

            additionalData.Add(new AdditionalData()
            {
                Name = "TestAdditional",
                Id   = Guid.Parse("cca5e277-77e7-4d70-9eb1-067156222da3"),
            });
            _context.SaveChanges();

            _exportService = new ExportImportService <Table1>(_context);
        }
        public static void CreateDaysOfWeekHeader(Table2 table)
        {
            Row2 row = table.Rows.Add(20, Font.Helvetica, 12);

            row.Cells.Add(DayOfWeek.Sunday.ToString(), Font.HelveticaBold, 12, RgbColor.Red, RgbColor.AliceBlue, 1);
            row.Cells.Add(DayOfWeek.Monday.ToString());
            row.Cells.Add(DayOfWeek.Tuesday.ToString());
            row.Cells.Add(DayOfWeek.Wednesday.ToString());
            row.Cells.Add(DayOfWeek.Thursday.ToString());
            row.Cells.Add(DayOfWeek.Friday.ToString());
            row.Cells.Add(DayOfWeek.Saturday.ToString());
        }
 public static void CreateColumns(Table2 table)
 {
     table.Columns.Add(25);
     table.Columns.Add(150);
     table.Columns.Add(90);
     table.Columns.Add(90);
     table.Columns.Add(120);
     table.Columns.Add(60);
     table.Columns.Add(90);
     table.Columns.Add(90);
     table.Columns.Add(90);
     table.Columns.Add(90);
 }
Exemple #25
0
 private static void CreateList(Table2 table, PdfFormFieldList fieldList)
 {
     for (int i = 0; i < fieldList.Count; i++)
     {
         Row2 row = table.Rows.Add(20);
         row.Cells.Add(fieldList[i].FullName);
         row.Cells.Add(GetFieldType(fieldList[i]));
         row.Cells.Add(fieldList[i].GetValue());
         if (fieldList[i].HasChildFields == true)
         {
             CreateList(table, fieldList[i].ChildFields);
         }
     }
 }
Exemple #26
0
    public void MyMethod()
    {
        Table1 t1 = new Table1();
        Table1 t2 = new Table2();
        Table1 t3 = new Table3();

        t1.UsingMethod2();         // will be called from ITableBaseExtensions
        t1.Method2();              // will be called from ITableBase - must implemented in Table1 class

        t2.Method3(some_argument); //  will be called from ITableBase - must implemented in Table2 class
        t2.GetIdAsString();        // will be called from ITableBaseExtensions

        // etc.
    }
        // GET: Table2/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Table2 table2 = db.Table2.Find(id);

            if (table2 == null)
            {
                return(HttpNotFound());
            }
            return(View(table2));
        }
        public static void CreateRow(Table2 table, TableReportData.Table data)
        {
            Row2 row = table.Rows.Add(20);

            row.Cells.Add(data.ID.ToString(), Font.Helvetica, 12, RgbColor.Black, RgbColor.LightGrey, 1);
            row.Cells.Add(data.ProductName);
            row.Cells.Add(data.SupplierID.ToString());
            row.Cells.Add(data.CategoryID.ToString());
            row.Cells.Add(data.QuantityPerUnit);
            row.Cells.Add(data.UnitPrice.ToString("$0.00"));
            row.Cells.Add(data.UnitInStock.ToString());
            row.Cells.Add(data.UnitsOnOrder.ToString());
            row.Cells.Add(data.ReorderLevel.ToString());
            row.Cells.Add(data.Discontinued.ToString());
        }
        // GET: Table2/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Table2 table2 = db.Table2.Find(id);

            if (table2 == null)
            {
                return(HttpNotFound());
            }
            ViewBag.Price = new SelectList(db.Table1, "Price", "Songs", table2.Price);
            return(View(table2));
        }
Exemple #30
0
        /// <summary>
        /// Converts to string.
        /// </summary>
        /// <returns>
        /// A <see cref="System.String" /> that represents this instance.
        /// </returns>
        public override string ToString()
        {
            List <string> cols = new List <string>();

            for (int i = 0; i < Table1JoinColumns.Count; i++)
            {
                var compare = Compares.ElementAt(i);
                var col1    = Table1JoinColumns.ElementAt(i);
                var col2    = Table2JoinColumns.ElementAt(i);
                if (col1 != null && col2 != null)
                {
                    cols.Add($"{col1.MultiPartIdentifier.GetName()} {compare.ComparisonType} {col2.MultiPartIdentifier.GetName()}");
                }
            }
            return($"{Table1.GetName()} {Table1.Alias?.Value} JOIN {Table2.GetName()} {Table2.Alias?.Value} ON {string.Join(" + ", cols)}");
        }
 /// <summary>
 /// 新しい Table2 オブジェクトを作成します。
 /// </summary>
 /// <param name="id">ID の初期値。</param>
 /// <param name="name">name の初期値。</param>
 public static Table2 CreateTable2(long id, string name)
 {
     Table2 table2 = new Table2();
     table2.ID = id;
     table2.name = name;
     return table2;
 }
 /// <summary>
 /// スキーマの Table2 にはコメントがありません。
 /// </summary>
 public void AddToTable2(Table2 table2)
 {
     base.AddObject("Table2", table2);
 }