Ejemplo n.º 1
0
        private void ListCompanyAddress()
        {
            try
            {
                grdList.Rows.Clear();
                CompanyAddressDB      cadb   = new CompanyAddressDB();
                List <companyaddress> caList = cadb.getCompAddList();
                //BindingSource src = new BindingSource();
                //src.DataSource = caList;
                //grdList.DataSource = caList;
                foreach (companyaddress ca in caList)
                {
                    //grdList.Rows.Add(ca.CompanyID, ca.CompanyName, ca.AddressType, ca.Address,
                    //     getStatusString(ca.Status), ca.CreateTime, ca.CreateUser);

                    grdList.Rows.Add();
                    grdList.Rows[grdList.RowCount - 1].Cells["RowID"].Value       = ca.RowID;
                    grdList.Rows[grdList.RowCount - 1].Cells["CompanyID"].Value   = ca.CompanyID;
                    grdList.Rows[grdList.RowCount - 1].Cells["CompanyName"].Value = ca.CompanyName;
                    grdList.Rows[grdList.RowCount - 1].Cells["Address"].Value     = ca.Address;
                    grdList.Rows[grdList.RowCount - 1].Cells["AddressType"].Value = getAddressTypeString(ca.AddressType);
                    grdList.Rows[grdList.RowCount - 1].Cells["Status"].Value      = getStatusString(ca.Status);
                    grdList.Rows[grdList.RowCount - 1].Cells["CreateTime"].Value  = ca.CreateTime;
                    grdList.Rows[grdList.RowCount - 1].Cells["CreateUser"].Value  = ca.CreateUser;
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Error in Company Address listing");
            }
            enableBottomButtons();
            pnlStateList.Visible = true;
        }
Ejemplo n.º 2
0
            public override void OnEndPage(PdfWriter writer, iTextSharp.text.Document document)
            {
                PdfPTable table  = new PdfPTable(3);
                PdfPTable regAdd = new PdfPTable(1);

                try
                {
                    CompanyAddressDB compDb = new CompanyAddressDB();
                    companyaddress   com    = compDb.getCompAddList().FirstOrDefault(c => c.AddressType == 3);
                    string           RegAdd = "";
                    if (com != null)
                    {
                        RegAdd = "Registered Address : " + com.Address;
                    }
                    PdfPCell cell23 = new PdfPCell(new Phrase(RegAdd.Replace("\n", " "), FontFactory.GetFont("Arial", 6, iTextSharp.text.Font.NORMAL, BaseColor.BLACK)));
                    cell23.HorizontalAlignment = PdfPCell.ALIGN_CENTER;
                    cell23.Border = 0;
                    regAdd.AddCell(cell23);
                    regAdd.TotalWidth = document.PageSize.Width
                                        - document.LeftMargin - document.RightMargin;
                    regAdd.WriteSelectedRows(0, -1, document.LeftMargin,
                                             document.BottomMargin + 6, writer.DirectContent);


                    table.SetWidths(new int[] { 20, 5, 20 });
                    table.DefaultCell.FixedHeight = 10;
                    table.DefaultCell.Border      = 0;
                    table.DefaultCell.Border      = Rectangle.NO_BORDER;
                    PdfPCell cell = new PdfPCell();
                    cell.Border = 0;
                    cell.HorizontalAlignment = Element.ALIGN_LEFT;
                    cell.Phrase = new Phrase("");
                    table.AddCell(cell);


                    cell        = new PdfPCell();
                    cell.Border = 0;
                    cell.HorizontalAlignment = Element.ALIGN_RIGHT;
                    cell.Phrase = new Phrase(String.Format("Page " + document.PageNumber.ToString() + " of"), font2);
                    table.AddCell(cell);
                    Image  img = Image.GetInstance(total);
                    string alt = img.Alt;
                    cell        = new PdfPCell(Image.GetInstance(total));
                    cell.Border = 0;
                    cell.HorizontalAlignment = Element.ALIGN_LEFT;
                    table.AddCell(cell);
                    table.TotalWidth = document.PageSize.Width
                                       - document.LeftMargin - document.RightMargin;
                    table.WriteSelectedRows(0, -1, document.LeftMargin,
                                            document.BottomMargin - 15, writer.DirectContent);
                }
                catch (DocumentException ex)
                {
                    MessageBox.Show("Failed to Save 5 : " + ex.ToString());
                }
            }