Exemplo n.º 1
0
        private void FillComboBox()
        {
            comboBox1.Items.Clear();
            FullAddressesLog themelogobj = FullAddressesLog.Create;

            foreach (var x in themelogobj.ThemeList)
            {
                comboBox1.Items.Add(x.Key);
            }
        }
Exemplo n.º 2
0
        public void Print()
        {
            richTextBox1.Text = "";
            FullAddressesLog log = FullAddressesLog.Create;

            foreach (KeyValuePair <string, FullAdress> i in log.ThemeList)
            {
                foreach (var x in i.Value.AdressLines)
                {
                    richTextBox1.Text += x.DocumentType + "\n";
                }
            }
        }
Exemplo n.º 3
0
        private void button4_Click(object sender, EventArgs e)
        {
            if (listView1.Items.Count == 0)
            {
                MessageBox.Show("Kindly Find the adresses in PDF");
                return;
            }
            FullAddressesLog log   = FullAddressesLog.Create;
            FullAdress       theme = new FullAdress();
            var x = listView1.Items;

            foreach (ListViewItem i in x)
            {
                Tempadress              = new ItextSharp.SinglePdfLine();
                Tempadress.Address      = i.SubItems[0].Text;
                Tempadress.FontSize     = float.Parse(i.SubItems[1].Text);
                Tempadress.FontFamily   = i.SubItems[2].Text;
                Tempadress.Bold         = bool.Parse(i.SubItems[3].Text);
                Tempadress.Italic       = bool.Parse(i.SubItems[4].Text);
                Tempadress.Color        = i.SubItems[5].Text;
                Tempadress.DocumentType = textBoxDocumentType.Text;
                Tempadress.PageNo       = (int)numericUpDown1.Value;

                if (i.Selected == true)
                {
                    Tempadress.LLX = (int)numericUpDown4.Value;
                    Tempadress.LLY = (int)numericUpDown5.Value;
                    Tempadress.URX = (int)numericUpDown2.Value;
                    Tempadress.URY = (int)numericUpDown3.Value;
                }
                else
                {
                    Tempadress.URX = float.Parse(i.SubItems[6].Text);
                    Tempadress.URY = float.Parse(i.SubItems[7].Text);
                    Tempadress.LLX = float.Parse(i.SubItems[8].Text);
                    Tempadress.LLY = float.Parse(i.SubItems[9].Text);
                }

                theme.AdressLines.Add(Tempadress);
            }
            theme.FullAdressID = Tempadress.DocumentType;
            if (log.ThemeList.ContainsKey(theme.FullAdressID))
            {
                log.ThemeList.Remove(theme.FullAdressID);
            }
            log.ThemeList.Add(theme.FullAdressID, theme);
            MessageBox.Show("Saved Successfully");
        }
Exemplo n.º 4
0
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            FullAddressesLog log = FullAddressesLog.Create;

            Tempadress = new FullAdress();

            string key = comboBox1.SelectedItem.ToString();

            if (log.ThemeList.ContainsKey(key))
            {
                Tempadress = log.ThemeList[key];
            }
            else
            {
                MessageBox.Show("Serious Error");
            }
        }
Exemplo n.º 5
0
        //public string SerializeAddress()
        //{
        //    string Result = null;
        //    AddressesLog log = AddressesLog.Create;
        //    if (log.adressList.Count == 0)
        //    {
        //        Result = "Trace: Nothing to Serialize \n";
        //    }
        //    try
        //    {
        //        using (Stream stream = File.Open(AdressLogFileName, FileMode.Create))
        //        {
        //            BinaryFormatter bin = new BinaryFormatter();
        //            bin.Serialize(stream, log.adressList);
        //        }
        //    }
        //    catch (IOException ex)
        //    {
        //        Result = "Exception:While Serializing Adress Log -" + ex.Message + "\n";
        //    }
        //    return Result;
        //}

        public string DecryptFullAddress()
        {
            string Result = null;

            try
            {
                if (File.Exists(AdressLogFileName) == false)
                {
                    Result = "Error:  Can not Find File to Deserialize\n";
                    return(Result);
                }
                else
                {
                    using (Stream stream = File.Open(AdressLogFileName, FileMode.Open))
                    {
                        FullAddressesLog log = FullAddressesLog.Create;
                        BinaryFormatter  bin = new BinaryFormatter();
                        try
                        {
                            var profiles = (Dictionary <string, FullAdress>)bin.Deserialize(stream);
                            foreach (var x in profiles)
                            {
                                if (log.ThemeList.ContainsKey(x.Key) == false)
                                {
                                    log.ThemeList.Add(x.Key, x.Value);
                                }
                            }
                        }
                        catch (Exception e)
                        {
                            Result = "Exception: While Deserializing Address";
                            return(Result);
                        }

                        return(Result);
                    }
                }
            }
            catch (IOException ex)
            {
                throw new Exception(ex.Message);
            }
        }
Exemplo n.º 6
0
        public string EncryptFullAddress()
        {
            string           Result = null;
            FullAddressesLog log    = FullAddressesLog.Create;

            if (log.ThemeList.Count == 0)
            {
                Result = "Trace: Nothing to Serialize \n";
            }
            try
            {
                using (Stream stream = File.Open(AdressLogFileName, FileMode.Create))
                {
                    BinaryFormatter bin = new BinaryFormatter();
                    bin.Serialize(stream, log.ThemeList);
                }
            }
            catch (IOException ex)
            {
                Result = "Exception:While Serializing Full Adress Log -" + ex.Message + "\n";
            }
            return(Result);
        }