Пример #1
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());
                }
            }
Пример #2
0
        private void btnSave_Click_1(object sender, EventArgs e)
        {
            try
            {
                companyaddress   ca   = new companyaddress();
                CompanyAddressDB cadb = new CompanyAddressDB();

                ca.CompanyID   = Convert.ToInt32(((Structures.ComboBoxItem)cmbCompanyId.SelectedItem).HiddenValue);
                ca.AddressType = getAddressTypeCode(cmbAddressType.SelectedItem.ToString());
                ca.Address     = txtAddress.Text.Trim();
                ca.Status      = getStatusCode(cmbStatus.SelectedItem.ToString());
                ca.RowID       = prevca.RowID;
                System.Windows.Forms.Button btn = sender as System.Windows.Forms.Button;
                string btnText = btn.Text;
                if (cadb.validateCompanyAdd(ca))
                {
                    if (btnText.Equals("Update"))
                    {
                        if (cadb.updateCompAddress(ca))
                        {
                            MessageBox.Show("Company Address updated");
                            closeAllPanels();
                            ListCompanyAddress();
                        }
                        else
                        {
                            MessageBox.Show("Failed to update Company Address");
                        }
                    }
                    else if (btnText.Equals("Save"))
                    {
                        if (cadb.insertCompAddress(ca))
                        {
                            MessageBox.Show("Company Address Added");
                            closeAllPanels();
                            ListCompanyAddress();
                        }
                        else
                        {
                            MessageBox.Show("Failed to Insert Company Address");
                        }
                    }
                }
                else
                {
                    MessageBox.Show("Company Address Data Validation failed");
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Failed Adding / Editing Company Address");
            }
        }
Пример #3
0
 public void clearUserData()
 {
     try
     {
         cmbCompanyId.SelectedIndex   = -1;
         cmbAddressType.SelectedIndex = -1;
         txtAddress.Text         = "";
         cmbStatus.SelectedIndex = 0;
         prevca = new companyaddress();
     }
     catch (Exception)
     {
     }
 }
Пример #4
0
 public void clearUserData()
 {
     try
     {
         cmbCompany.SelectedIndex = -1;
         cmbBank.SelectedIndex    = -1;
         txtAccCode.Text          = "";
         cmbAccType.SelectedIndex = -1;
         cmbBranch.SelectedIndex  = -1;
         cmbStatus.SelectedIndex  = 0;
         selectedRow = 0;
         prevca      = new companyaddress();
     }
     catch (Exception)
     {
     }
 }