Beispiel #1
0
        /// <summary>
        /// Creates the AddRequestForm Window and Initializes DB Param.
        /// </summary>
        public BatchPrintWindow(System.Collections.IList items)
        {
            _items  = items;
            pmsutil = new PMSUtil();
            InitializeComponent();
            GetResidingPriests();
            PrintingFee.Value = Convert.ToDouble(pmsutil.GetPrintFee("Baptismal"));
            records           = new ObservableCollection <RecordEntryBaptismal>();

            for (int i = 0; i < items.Count; i++)
            {
                RecordEntryBaptismal recordx = (RecordEntryBaptismal)items[i];
                Console.WriteLine(recordx.RecordID);
                records.Add(new RecordEntryBaptismal()
                {
                    RecordID      = recordx.RecordID,
                    EntryNumber   = recordx.EntryNumber,
                    BaptismalYear = recordx.BaptismalYear,
                    BaptismalDate = recordx.BaptismalDate,
                    FullName      = recordx.FullName,
                    BirthDate     = recordx.BirthDate,
                    Legitimacy    = recordx.Legitimacy,
                    PlaceOfBirth  = recordx.PlaceOfBirth,
                    Parent1       = recordx.Parent1,
                    Parent2       = recordx.Parent2,
                    Godparent1    = recordx.Godparent1,
                    Godparent2    = recordx.Godparent2,
                    Stipend       = recordx.Stipend,
                    Minister      = recordx.Minister
                });
            }
            EntriesHolder.Items.Refresh();
            EntriesHolder.ItemsSource = records;
            EntriesHolder.Items.Refresh();
        }
Beispiel #2
0
        private void SyncFee(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            pmsutil = new PMSUtil();
            NumericUpDown nud = (NumericUpDown)sender;

            nud.Value = Convert.ToDouble(string.Format("{0:N3}", pmsutil.GetPrintFee("Baptismal")));
        }
Beispiel #3
0
        public PrintBurialRecordEntryWindow(string targRecord)
        {
            pmsutil = new PMSUtil();
            InitializeComponent();
            recordID = targRecord;
            GetResidingPriests();
            CheckAccess(targRecord);

            PrintingFee.Value = Convert.ToDouble(pmsutil.GetPrintFee("Burial"));
            Stipend.Value     = FetchBurialStipend();

            dbman = new DBConnectionManager();
            if (dbman.DBConnect().State == ConnectionState.Open)
            {
                MySqlCommand cmd = dbman.DBConnect().CreateCommand();
                cmd.CommandText = "SELECT * FROM burial_records, records WHERE records.record_id = @record_id AND records.record_id = burial_records.record_id LIMIT 1;";
                cmd.Parameters.AddWithValue("@record_id", targRecord);
                cmd.Prepare();
                MySqlDataReader db_reader = cmd.ExecuteReader();
                while (db_reader.Read())
                {
                    EntryNum.Value        = Convert.ToDouble(db_reader.GetString("entry_number"));
                    PageNum.Value         = Convert.ToDouble(db_reader.GetString("page_number"));
                    DeathDate.Text        = db_reader.GetString("record_date");
                    BurialDate.Text       = db_reader.GetString("burial_date");
                    Age.Value             = Convert.ToDouble(db_reader.GetString("age"));
                    FullName.Text         = db_reader.GetString("recordholder_fullname");
                    Age.Value             = Convert.ToDouble(db_reader.GetString("age"));
                    Status.Text           = db_reader.GetString("status");
                    Parent1.Text          = db_reader.GetString("parent1_fullname");
                    Parent2.Text          = db_reader.GetString("parent2_fullname");
                    Residence1.Text       = db_reader.GetString("residence");
                    Residence2.Text       = db_reader.GetString("residence2");
                    Sacrament.Text        = db_reader.GetString("sacrament");
                    CauseOfDeath.Text     = db_reader.GetString("cause_of_death");
                    PlaceOfInterment.Text = db_reader.GetString("place_of_interment");
                    Stipend.Value         = Convert.ToDouble(db_reader.GetString("stipend"));
                    Minister.Text         = db_reader.GetString("minister");
                    Remarks.Text          = db_reader.GetString("remarks");
                }
                //close Connection
                dbman.DBClose();
            }
            else
            {
            }

            Suggestions1.Visibility = Visibility.Hidden;
            Suggestions2.Visibility = Visibility.Hidden;
            Suggestions3.Visibility = Visibility.Hidden;
            Suggestions4.Visibility = Visibility.Hidden;
            Suggestions5.Visibility = Visibility.Hidden;
            Suggestions6.Visibility = Visibility.Hidden;
        }
Beispiel #4
0
        /// <summary>
        /// Creates the AddRequestForm Window and Initializes DB Param.
        /// </summary>
        public BatchPrintWindow2(System.Collections.IList items)
        {
            _items  = items;
            pmsutil = new PMSUtil();
            InitializeComponent();
            GetResidingPriests();
            PrintingFee.Value = Convert.ToDouble(pmsutil.GetPrintFee("Matrimonial"));
            records           = new ObservableCollection <RecordEntryMatrimonial>();

            for (int i = 0; i < items.Count; i++)
            {
                RecordEntryMatrimonial recordx = (RecordEntryMatrimonial)items[i];
                Console.WriteLine(recordx.RecordID);
                records.Add(new RecordEntryMatrimonial()
                {
                    RecordID     = recordx.RecordID,
                    EntryNumber  = recordx.EntryNumber,
                    MarriageYear = recordx.MarriageYear,
                    MarriageDate = recordx.MarriageDate,
                    FullName1    = recordx.FullName1,
                    FullName2    = recordx.FullName2,
                    Age1         = Convert.ToInt32(recordx.Age1),
                    Age2         = Convert.ToInt32(recordx.Age2),
                    Hometown1    = recordx.Hometown1,
                    Hometown2    = recordx.Hometown2,
                    Residence1   = recordx.Residence1,
                    Residence2   = recordx.Residence2,
                    Parent1      = recordx.Parent1,
                    Parent2      = recordx.Parent2,
                    Parent3      = recordx.Parent3,
                    Parent4      = recordx.Parent4,
                    Witness1     = recordx.Witness1,
                    Witness2     = recordx.Witness2,
                    W1Residence  = recordx.W1Residence,
                    W2Residence  = recordx.W2Residence,
                    Stipend      = Convert.ToDouble(recordx.Stipend),
                    Minister     = recordx.Minister
                });
            }
            EntriesHolder.Items.Refresh();
            EntriesHolder.ItemsSource = records;
            EntriesHolder.Items.Refresh();
        }
Beispiel #5
0
        /// <summary>
        /// Creates the AddRequestForm Window and Initializes DB Param.
        /// </summary>
        public BatchPrintWindow3(System.Collections.IList items)
        {
            _items  = items;
            pmsutil = new PMSUtil();
            InitializeComponent();
            GetResidingPriests();
            PrintingFee.Value = Convert.ToDouble(pmsutil.GetPrintFee("Burial"));
            records           = new ObservableCollection <RecordEntryBurial>();

            for (int i = 0; i < items.Count; i++)
            {
                RecordEntryBurial recordx = (RecordEntryBurial)items[i];
                Console.WriteLine(recordx.RecordID);
                records.Add(new RecordEntryBurial()
                {
                    RecordID         = recordx.RecordID,
                    EntryNumber      = recordx.EntryNumber,
                    DeathYear        = recordx.DeathYear,
                    DeathDate        = recordx.DeathDate,
                    BurialYear       = recordx.BurialYear,
                    BurialDate       = recordx.BurialDate,
                    FullName         = recordx.FullName,
                    Age              = Convert.ToInt32(recordx.Age),
                    Status           = recordx.Status,
                    Residence1       = recordx.Residence2,
                    Residence2       = recordx.Residence1,
                    Sacrament        = recordx.Sacrament,
                    CauseOfDeath     = recordx.CauseOfDeath,
                    PlaceOfInterment = recordx.PlaceOfInterment,
                    Parent1          = recordx.Parent1,
                    Parent2          = recordx.Parent2,
                    Stipend          = Convert.ToDouble(recordx.Stipend),
                    Minister         = recordx.Minister
                });
            }
            EntriesHolder.Items.Refresh();
            EntriesHolder.ItemsSource = records;
            EntriesHolder.Items.Refresh();
        }
Beispiel #6
0
        /// <summary>
        /// Creates the AddRequestForm Window and Initializes DB Param.
        /// </summary>
        public BatchPrintWindow1(System.Collections.IList items)
        {
            _items  = items;
            pmsutil = new PMSUtil();
            InitializeComponent();
            GetResidingPriests();
            PrintingFee.Value = Convert.ToDouble(pmsutil.GetPrintFee("Confirmation"));
            records           = new ObservableCollection <RecordEntryConfirmation>();

            for (int i = 0; i < items.Count; i++)
            {
                RecordEntryConfirmation recordx = (RecordEntryConfirmation)items[i];
                Console.WriteLine(recordx.RecordID);
                records.Add(new RecordEntryConfirmation()
                {
                    RecordID         = recordx.RecordID,
                    EntryNumber      = recordx.EntryNumber,
                    ConfirmationYear = recordx.ConfirmationYear,
                    ConfirmationDate = recordx.ConfirmationDate,
                    FullName         = recordx.FullName,
                    Age            = Convert.ToInt32(recordx.Age),
                    Parish         = recordx.Parish,
                    Province       = recordx.Province,
                    PlaceOfBaptism = recordx.PlaceOfBaptism,
                    Parent1        = recordx.Parent1,
                    Parent2        = recordx.Parent2,
                    Sponsor1       = recordx.Sponsor1,
                    Sponsor2       = recordx.Sponsor2,
                    Stipend        = recordx.Stipend,
                    Minister       = recordx.Minister
                });
            }
            EntriesHolder.Items.Refresh();
            EntriesHolder.ItemsSource = records;
            EntriesHolder.Items.Refresh();
        }
Beispiel #7
0
        private void BatchPrint(object sender, DoWorkEventArgs e)
        {
            int    tick      = 0;
            int    total     = _items.Count;
            string signature = "";
            string purpose   = "";
            double fee       = 0d;

            App.Current.Dispatcher.Invoke((Action) delegate            // <--- HERE
            {
                QueueCounter.Content      = tick + "/" + total;
                QueuePBar.IsIndeterminate = true;

                signature = Signatory.Text;
                purpose   = Purpose.Text;
                fee       = Convert.ToDouble(PrintingFee.Value);
            });

            for (int i = 0; i < _items.Count; i++)
            {
                App.Current.Dispatcher.Invoke((Action) delegate                // <--- HERE
                {
                    QueueCounter.Content = tick + "/" + total;
                });
                RecordEntryMatrimonial recordx = (RecordEntryMatrimonial)_items[i];

                string[] bspl  = DateTime.Parse(recordx.MarriageDate + "," + recordx.MarriageYear).ToString("MM/dd/yyyy").Split('/');
                string   bsuff = GetDaySuffix(int.Parse(bspl[1]));
                string   bmon  = PrepMonth(int.Parse(bspl[0]));

                Document doc = new Document();
                doc.LoadFromFile("Data\\temp_marriage.docx");
                doc.Replace("name", recordx.FullName1, true, true);
                doc.Replace("name2", recordx.FullName2, true, true);
                doc.Replace("age", recordx.Age1.ToString(), true, true);
                doc.Replace("age2", recordx.Age2.ToString(), true, true);
                doc.Replace("nationality", "Filipino", true, true);
                doc.Replace("nationality2", "Filipino", true, true);
                doc.Replace("residence", recordx.Residence1, true, true);
                doc.Replace("residence2", recordx.Residence2, true, true);
                doc.Replace("civil", recordx.Status1, true, true);
                doc.Replace("civil2", recordx.Status2, true, true);
                doc.Replace("father", recordx.Parent1, true, true);
                doc.Replace("father2", recordx.Parent3, true, true);
                doc.Replace("mother", recordx.Parent2, true, true);
                doc.Replace("mother2", recordx.Parent4, true, true);
                doc.Replace("witness", recordx.Witness1, true, true);
                doc.Replace("witness2", recordx.Witness2, true, true);
                doc.Replace("place", "St. Raphael Parish", true, true);
                doc.Replace("date", bmon + " " + bspl[1] + bsuff + ", " + bspl[2], true, true);
                doc.Replace("priest", recordx.Minister, true, true);
                doc.Replace("sign", signature, true, true);
                doc.Replace("page", GetPNum(recordx.RecordID).ToString(), true, true);
                doc.Replace("no", GetBNum(recordx.RecordID).ToString(), true, true);
                string[] date = DateTime.Now.ToStrin­g("MMMM,d,yyyy").Spl­it(',');
                doc.Replace("month", date[0], true, true);
                date[1] = date[1] + GetDaySuffix(int.Parse(date[1]));
                doc.Replace("days", date[1], true, true);
                doc.Replace("YY", date[2].Remove(0, 2), true, true);
                doc.SaveToFile("Data\\print-" + i + ".docx", FileFormat.Docx);

                //Load Document
                Document document = new Document();
                document.LoadFromFile(@"Data\\print-" + i + ".docx");

                //Convert Word to PDF
                document.SaveToFile("Output\\print_file-" + i + ".pdf", FileFormat.PDF);

                App.Current.Dispatcher.Invoke((Action) delegate                // <--- HERE
                {
                    if (SkipPreview.IsChecked == true)
                    {
                        Spire.Pdf.PdfDocument docx = new Spire.Pdf.PdfDocument();
                        docx.LoadFromFile(@"Output\\print_file-" + i + ".pdf");
                        docx.PrintDocument.Print();
                    }
                    else
                    {
                        System.Diagnostics.Process.Start("Output\\print_file-" + i + ".pdf");
                    }


                    //Reference
                    string tmp = pmsutil.LogRecord(recordx.RecordID, "LOGC-03");
                });
                pmsutil.InsertTransaction("Matrimonial Cert.", "Paying", recordx.RecordID, Convert.ToDouble(pmsutil.GetPrintFee("Matrimonial")));
                tick++;
            }
        }
Beispiel #8
0
        private void BatchPrint(object sender, DoWorkEventArgs e)
        {
            int    tick      = 0;
            int    total     = _items.Count;
            string signature = "";
            string purpose   = "";
            double fee       = 0d;

            App.Current.Dispatcher.Invoke((Action) delegate            // <--- HERE
            {
                QueueCounter.Content      = tick + "/" + total;
                QueuePBar.IsIndeterminate = true;

                signature = Signatory.Text;
                purpose   = Purpose.Text;
                fee       = Convert.ToDouble(PrintingFee.Value);
            });

            for (int i = 0; i < _items.Count; i++)
            {
                App.Current.Dispatcher.Invoke((Action) delegate                // <--- HERE
                {
                    QueueCounter.Content = tick + "/" + total;
                });
                RecordEntryBurial recordx = (RecordEntryBurial)_items[i];

                string[] bspl = DateTime.Parse(recordx.BurialDate + "," + recordx.BurialYear).ToString("MM/dd/yyyy").Split('/');
                string   bmon = PrepMonth(int.Parse(bspl[0]));

                string[] dspl = DateTime.Parse(recordx.DeathDate + "," + recordx.DeathYear).ToString("MM/dd/yyyy").Split('/');
                string   dmon = PrepMonth(int.Parse(dspl[0]));

                Document doc = new Document();
                doc.LoadFromFile("Data\\temp_death.docx");
                doc.Replace("name", recordx.FullName, true, true);
                doc.Replace("age", Convert.ToString(recordx.Age), true, true);
                doc.Replace("nationality", "Filipino", true, true);
                doc.Replace("residence", recordx.Residence1, true, true);
                doc.Replace("civil", recordx.Status, true, true);

                if (string.IsNullOrEmpty(recordx.Parent2))
                {
                    doc.Replace("father", " ", true, true);
                    doc.Replace("mother", " ", true, true);
                    doc.Replace("spouse", recordx.Parent1, true, true);
                }
                else
                {
                    doc.Replace("father", recordx.Parent1, true, true);
                    doc.Replace("mother", recordx.Parent2, true, true);
                    doc.Replace("spouse", " ", true, true);
                }
                doc.Replace("date_of_birth", bmon + " " + bspl[1] + ", " + bspl[2], true, true);
                doc.Replace("cause_of_death", recordx.CauseOfDeath, true, true);
                doc.Replace("date_of_burial", dmon + " " + dspl[1] + ", " + dspl[2], true, true);
                doc.Replace("place_of_burial", recordx.PlaceOfInterment, true, true);
                doc.Replace("priest", recordx.Minister, true, true);
                doc.Replace("sign", signature, true, true);
                doc.Replace("no", recordx.EntryNumber.ToString(), true, true);
                doc.Replace("page", GetPNum(recordx.RecordID).ToString(), true, true);
                string[] date = DateTime.Now.ToString("MMMM,d,yyyy").Split(',');;
                doc.Replace("month", date[0], true, true);
                doc.Replace("day", date[1], true, true);
                doc.SaveToFile("Data\\print-" + i + ".docx", FileFormat.Docx);

                //Load Document
                Document document = new Document();
                document.LoadFromFile(@"Data\\print-" + i + ".docx");

                //Convert Word to PDF
                document.SaveToFile("Output\\print_file-" + i + ".pdf", FileFormat.PDF);

                App.Current.Dispatcher.Invoke((Action) delegate                // <--- HERE
                {
                    if (SkipPreview.IsChecked == true)
                    {
                        Spire.Pdf.PdfDocument docx = new Spire.Pdf.PdfDocument();
                        docx.LoadFromFile(@"Output\\print_file-" + i + ".pdf");
                        docx.PrintDocument.Print();
                    }
                    else
                    {
                        System.Diagnostics.Process.Start("Output\\print_file-" + i + ".pdf");
                    }


                    //Reference
                    string tmp = pmsutil.LogRecord(recordx.RecordID, "LOGC-03");
                });
                pmsutil.InsertTransaction("Burial Cert.", "Paying", recordx.RecordID, Convert.ToDouble(pmsutil.GetPrintFee("Burial")));

                tick++;
            }
        }
        /// <summary>
        /// Creates the AddRequestForm Window and Initializes DB Param.
        /// </summary>
        public PrintMatrimonialRecordEntryWindow(string targRecord)
        {
            pmsutil  = new PMSUtil();
            recordID = targRecord;
            InitializeComponent();
            GetResidingPriests();
            CheckAccess(targRecord);

            PrintingFee.Value = Convert.ToDouble(pmsutil.GetPrintFee("Matrimonial"));
            recordID          = targRecord;
            Stipend.Value     = FetchMatrimonialStipend();

            dbman = new DBConnectionManager();

            if (dbman.DBConnect().State == ConnectionState.Open)
            {
                MySqlCommand cmd = dbman.DBConnect().CreateCommand();
                cmd.CommandText = "SELECT * FROM matrimonial_records, records WHERE records.record_id = @record_id AND records.record_id = matrimonial_records.record_id LIMIT 1;";
                cmd.Parameters.AddWithValue("@record_id", targRecord);
                cmd.Prepare();
                MySqlDataReader db_reader = cmd.ExecuteReader();
                while (db_reader.Read())
                {
                    bookNum           = db_reader.GetInt32("book_number");
                    EntryNum.Value    = Convert.ToDouble(db_reader.GetString("entry_number"));
                    PageNum.Value     = Convert.ToDouble(db_reader.GetString("page_number"));
                    MarriageDate.Text = db_reader.GetString("record_date");
                    Age1.Value        = Convert.ToDouble(db_reader.GetString("age1"));
                    Age2.Value        = Convert.ToDouble(db_reader.GetString("age2"));
                    Status1.Text      = db_reader.GetString("status1");
                    Status2.Text      = db_reader.GetString("status2");
                    FullName1.Text    = db_reader.GetString("recordholder_fullname");
                    FullName2.Text    = db_reader.GetString("recordholder2_fullname");
                    Hometown1.Text    = db_reader.GetString("place_of_origin1");
                    Hometown2.Text    = db_reader.GetString("place_of_origin2");
                    Residence1.Text   = db_reader.GetString("residence1");
                    Residence2.Text   = db_reader.GetString("residence2");
                    Stipend.Value     = Convert.ToDouble(db_reader.GetString("stipend"));
                    Parent1.Text      = db_reader.GetString("parent1_fullname");
                    Parent2.Text      = db_reader.GetString("parent2_fullname");
                    Parent3.Text      = db_reader.GetString("parent1_fullname2");
                    Parent4.Text      = db_reader.GetString("parent2_fullname2");
                    Sponsor1.Text     = db_reader.GetString("witness1");
                    Sponsor2.Text     = db_reader.GetString("witness2");
                    Residence3.Text   = db_reader.GetString("witness1address");
                    Residence4.Text   = db_reader.GetString("witness2address");
                    Minister.Text     = db_reader.GetString("minister");
                    Remarks.Text      = db_reader.GetString("remarks");
                }
                //close Connection
                dbman.DBClose();
            }
            else
            {
            }

            Suggestions1.Visibility = Visibility.Hidden;
            Suggestions2.Visibility = Visibility.Hidden;
            Suggestions3.Visibility = Visibility.Hidden;
            Suggestions4.Visibility = Visibility.Hidden;
            Suggestions5.Visibility = Visibility.Hidden;
            Suggestions6.Visibility = Visibility.Hidden;
            Suggestions7.Visibility = Visibility.Hidden;
        }
Beispiel #10
0
        private void BatchPrint(object sender, DoWorkEventArgs e)
        {
            int    tick      = 0;
            int    total     = _items.Count;
            string signature = "";
            string purpose   = "";
            double fee       = 0d;

            App.Current.Dispatcher.Invoke((Action) delegate            // <--- HERE
            {
                QueueCounter.Content      = tick + "/" + total;
                QueuePBar.IsIndeterminate = true;

                signature = Signatory.Text;
                purpose   = Purpose.Text;
                fee       = Convert.ToDouble(PrintingFee.Value);
            });

            for (int i = 0; i < _items.Count; i++)
            {
                App.Current.Dispatcher.Invoke((Action) delegate                // <--- HERE
                {
                    QueueCounter.Content = tick + "/" + total;
                });
                RecordEntryConfirmation recordx = (RecordEntryConfirmation)_items[i];

                string x1;

                string[] spl  = DateTime.Parse(recordx.ConfirmationDate + "," + recordx.ConfirmationYear).ToString("MM/dd/yyyy").Split('/');
                string   suff = GetDaySuffix(int.Parse(spl[1]));
                string   mon  = PrepMonth(int.Parse(spl[0]));
                if (int.Parse(spl[2]) > 1999)
                {
                    x1     = "";
                    spl[2] = spl[2].Remove(0, 2);
                }
                else
                {
                    x1 = "X";
                }

                Document doc = new Document();
                doc.LoadFromFile("Data\\temp_confirmation.docx");
                doc.Replace("name", recordx.FullName, true, true);
                doc.Replace("day", int.Parse(spl[1]) + suff, true, true);
                doc.Replace("month", mon, true, true);
                doc.Replace("X", x1, true, true);
                doc.Replace("year", spl[2], true, true);
                doc.Replace("by", recordx.Minister, true, true);
                doc.Replace("no", recordx.EntryNumber.ToString(), true, true);
                doc.Replace("book", GetBNum(recordx.RecordID).ToString(), true, true);
                doc.Replace("page", GetPNum(recordx.RecordID).ToString(), true, true);
                doc.Replace("no", recordx.EntryNumber.ToString(), true, true);
                doc.Replace("priest", recordx.Minister, true, true);
                doc.Replace("purpose", purpose, true, true);
                doc.Replace("date", DateTime.Now.ToString("MMMM d, yyyy"), true, true);
                doc.SaveToFile("Data\\print-" + i + ".docx", FileFormat.Docx);

                //Load Document
                Document document = new Document();
                document.LoadFromFile(@"Data\\print-" + i + ".docx");

                //Convert Word to PDF
                document.SaveToFile("Output\\print_file-" + i + ".pdf", FileFormat.PDF);

                App.Current.Dispatcher.Invoke((Action) delegate                // <--- HERE
                {
                    if (SkipPreview.IsChecked == true)
                    {
                        Spire.Pdf.PdfDocument docx = new Spire.Pdf.PdfDocument();
                        docx.LoadFromFile(@"Output\\print_file-" + i + ".pdf");
                        docx.PrintDocument.Print();
                    }
                    else
                    {
                        System.Diagnostics.Process.Start("Output\\print_file-" + i + ".pdf");
                    }


                    if (Purpose.SelectedIndex == 0)
                    {
                        //Reference
                        string tmp = pmsutil.LogRecord(recordx.RecordID, "LOGC-03");
                    }
                    else
                    {
                        //Marriage
                        string tmp = pmsutil.LogRecord(recordx.RecordID, "LOGC-04");
                    }
                });
                pmsutil.InsertTransaction("Confirmation Cert.", "Paying", recordx.RecordID, Convert.ToDouble(pmsutil.GetPrintFee("Confirmation")));
                tick++;
            }
        }
Beispiel #11
0
        /// <summary>
        /// Creates the AddRequestForm Window and Initializes DB Param.
        /// </summary>
        public PrintConfirmationRecordEntryWindow(string targRecord)
        {
            pmsutil  = new PMSUtil();
            recordID = targRecord;
            InitializeComponent();
            GetResidingPriests();
            CheckAccess(targRecord);

            PrintingFee.Value = Convert.ToDouble(pmsutil.GetPrintFee("Confirmation"));
            dbman             = new DBConnectionManager();
            using (conn = new MySqlConnection(dbman.GetConnStr()))
            {
                conn.Open();
                if (conn.State == ConnectionState.Open)
                {
                    using (MySqlConnection conn2 = new MySqlConnection(dbman.GetConnStr()))
                    {
                        conn2.Open();
                        MySqlCommand cmd = conn2.CreateCommand();
                        cmd.CommandText = "SELECT * FROM records, registers WHERE records.record_id = @rid AND records.book_number = registers.book_number LIMIT 1;";
                        cmd.Parameters.AddWithValue("@rid", recordID);
                        cmd.Prepare();
                        using (MySqlDataReader db_reader = cmd.ExecuteReader())
                        {
                            while (db_reader.Read())
                            {
                                if (db_reader.GetString("status") == "Archived")
                                {
                                    using (MySqlConnection conn3 = new MySqlConnection(dbman.GetConnStr()))
                                    {
                                        conn3.Open();
                                        MySqlCommand cmd2 = conn3.CreateCommand();
                                        cmd2.CommandText = "SELECT * FROM records WHERE records.record_id = @rid ORDER BY records.entry_number ASC;";
                                        cmd2.Parameters.AddWithValue("@rid", recordID);
                                        cmd2.Prepare();
                                        using (MySqlDataReader db_reader2 = cmd2.ExecuteReader())
                                        {
                                            string archiveDrive = "init";
                                            string path         = @"\archive.db";
                                            while (db_reader2.Read())
                                            {
                                                if (pmsutil.CheckArchiveDrive(path) != "dc")
                                                {
                                                    archiveDrive = pmsutil.CheckArchiveDrive(path);
                                                    SQLiteConnectionStringBuilder connectionString = new SQLiteConnectionStringBuilder
                                                    {
                                                        FailIfMissing = true,
                                                        DataSource    = archiveDrive
                                                    };
                                                    using (SQLiteConnection connection = new SQLiteConnection(connectionString.ToString()))
                                                    {
                                                        // open the connection:
                                                        connection.Open();
                                                        string stm = "SELECT * FROM confirmation_records WHERE record_id='" + db_reader2.GetString("record_id") + "';";

                                                        using (SQLiteCommand cmdx = new SQLiteCommand(stm, connection))
                                                        {
                                                            using (SQLiteDataReader rdr = cmdx.ExecuteReader())
                                                            {
                                                                while (rdr.Read())
                                                                {
                                                                    bookNum               = db_reader2.GetInt32("book_number");
                                                                    EntryNum.Value        = db_reader2.GetInt32("entry_number");
                                                                    PageNum.Value         = db_reader2.GetInt32("page_number");
                                                                    ConfirmationDate.Text = db_reader2.GetString("record_date");
                                                                    FullName.Text         = db_reader2.GetString("recordholder_fullname");
                                                                    Age.Value             = Convert.ToInt32(rdr["age"]);
                                                                    PlaceOfBaptism.Text   = rdr["place_of_baptism"].ToString();
                                                                    Parent1.Text          = db_reader2.GetString("parent1_fullname");
                                                                    Parent2.Text          = db_reader2.GetString("parent2_fullname");
                                                                    Sponsor1.Text         = rdr["sponsor"].ToString();
                                                                    Sponsor2.Text         = rdr["sponsor2"].ToString();
                                                                    Minister.Text         = rdr["minister"].ToString();
                                                                    Remarks.Text          = rdr["remarks"].ToString();
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                                else
                                                {
                                                    archiveDrive          = "init";
                                                    bookNum               = db_reader2.GetInt32("book_number");
                                                    EntryNum.Value        = db_reader2.GetInt32("entry_number");
                                                    PageNum.Value         = db_reader2.GetInt32("page_number");
                                                    ConfirmationDate.Text = db_reader2.GetString("record_date");
                                                    FullName.Text         = db_reader2.GetString("recordholder_fullname");
                                                    Age.Value             = db_reader2.GetInt32("age");
                                                    PlaceOfBaptism.Text   = db_reader2.GetString("place_of_baptism");
                                                    Parent1.Text          = db_reader2.GetString("parent1_fullname");
                                                    Parent2.Text          = db_reader2.GetString("parent2_fullname");
                                                    Sponsor1.Text         = db_reader2.GetString("sponsor");
                                                    Sponsor2.Text         = db_reader2.GetString("sponsor2");
                                                    Minister.Text         = db_reader2.GetString("minister");
                                                    Remarks.Text          = db_reader2.GetString("remarks");
                                                }
                                            }
                                        }
                                    }
                                }
                                else
                                {
                                    using (MySqlConnection conn3 = new MySqlConnection(dbman.GetConnStr()))
                                    {
                                        conn3.Open();
                                        MySqlCommand cmd2 = conn3.CreateCommand();
                                        cmd2.CommandText = "SELECT * FROM records, confirmation_records WHERE records.record_id = @rid AND records.record_id = confirmation_records.record_id ORDER BY records.entry_number ASC;";
                                        cmd2.Parameters.AddWithValue("@rid", recordID);
                                        cmd2.Prepare();
                                        using (MySqlDataReader db_reader2 = cmd2.ExecuteReader())
                                        {
                                            while (db_reader2.Read())
                                            {
                                                bookNum               = db_reader2.GetInt32("book_number");
                                                EntryNum.Value        = db_reader2.GetInt32("entry_number");
                                                PageNum.Value         = db_reader2.GetInt32("page_number");
                                                ConfirmationDate.Text = db_reader2.GetString("record_date");
                                                FullName.Text         = db_reader2.GetString("recordholder_fullname");
                                                Age.Value             = db_reader2.GetInt32("age");
                                                PlaceOfBaptism.Text   = db_reader2.GetString("place_of_baptism");
                                                Parent1.Text          = db_reader2.GetString("parent1_fullname");
                                                Parent2.Text          = db_reader2.GetString("parent2_fullname");
                                                Sponsor1.Text         = db_reader2.GetString("sponsor");
                                                Sponsor2.Text         = db_reader2.GetString("sponsor2");
                                                Minister.Text         = db_reader2.GetString("minister");
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }

            Suggestions1.Visibility = Visibility.Hidden;
            Suggestions4.Visibility = Visibility.Hidden;
        }