private void CreateAppointment_Click(object sender, RoutedEventArgs e)
        {
            if (CheckInputs() == true)
            {
                string selTime = SelectedTime.Text;

                if (IsAvailable(DateTime.Parse(SelectedDate.Content.ToString()).ToString("yyyy-MM-dd"), DateTime.Parse(selTime).ToString("HH:mm:ss"), GetPriest(AssignedPriest.Text)) == false)
                {
                    MsgNotAvailable(DateTime.Parse(SelectedDate.Content.ToString()).ToString("MMM dd, yyyy"), DateTime.Parse(selTime).ToString("HH:mm tt"), AssignedPriest.Text);
                    this.Close();
                }
                else
                {
                    dbman   = new DBConnectionManager();
                    pmsutil = new PMSUtil();
                    //TODO
                    try
                    {
                        string       apmID = pmsutil.GenAppointmentID();
                        MySqlCommand cmd   = dbman.DBConnect().CreateCommand();
                        cmd.CommandText =
                            "INSERT INTO appointments(appointment_id, appointment_date, appointment_time, appointment_type, requested_by, placed_by, remarks, status, assigned_priest, venue)" +
                            "VALUES(@appointment_id, @appointment_date, @appointment_time, @appointment_type, @requested_by, @placed_by, @remarks, @status, @a_priest, @venue)";
                        cmd.Parameters.AddWithValue("@appointment_id", apmID);
                        cmd.Parameters.AddWithValue("@appointment_date", DateTime.Parse(SelectedDate.Content.ToString()).ToString("yyyy-MM-dd"));
                        cmd.Parameters.AddWithValue("@appointment_time", DateTime.Parse(selTime).ToString("HH:mm:ss"));
                        cmd.Parameters.AddWithValue("@appointment_type", GetATypeID(TypeHolder.Content.ToString()));
                        cmd.Parameters.AddWithValue("@requested_by", RequestedBy.Text);
                        cmd.Parameters.AddWithValue("@placed_by", Application.Current.Resources["uid"].ToString());
                        cmd.Parameters.AddWithValue("@remarks", Remarks.Text);
                        cmd.Parameters.AddWithValue("@status", 1);
                        cmd.Parameters.AddWithValue("@a_priest", GetPriest(AssignedPriest.Text));
                        cmd.Parameters.AddWithValue("@venue", Venue.Text);
                        cmd.Prepare();
                        int stat_code = cmd.ExecuteNonQuery();
                        dbman.DBClose();
                        if (stat_code > 0)
                        {
                            this.Close();
                            MsgSuccess();
                        }
                        else
                        {
                            MsgFail();
                        }
                        string tmp = pmsutil.LogScheduling(apmID, "LOGC-01");
                        pmsutil.InsertTransaction("Liturgical Service - " + TypeHolder.Content.ToString(), "Unpaid", apmID, Convert.ToDouble(Fee.Value));
                    }
                    catch (MySqlException ex)
                    {
                        Console.WriteLine("Error: {0}", ex.ToString());
                    }
                }
            }
            else
            {
            }
        }
        private int PrintEntry()
        {
            string[] bspl  = MarriageDate.Text.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", FullName1.Text, true, true);
            doc.Replace("name2", FullName2.Text, true, true);
            doc.Replace("age", Age1.Value.ToString(), true, true);
            doc.Replace("age2", Age2.Value.ToString(), true, true);
            doc.Replace("nationality", "Filipino", true, true);
            doc.Replace("nationality2", "Filipino", true, true);
            doc.Replace("residence", Residence1.Text, true, true);
            doc.Replace("residence2", Residence2.Text, true, true);
            doc.Replace("civil", Status1.Text, true, true);
            doc.Replace("civil2", Status2.Text, true, true);
            doc.Replace("father", Parent1.Text, true, true);
            doc.Replace("father2", Parent3.Text, true, true);
            doc.Replace("mother", Parent2.Text, true, true);
            doc.Replace("mother2", Parent4.Text, true, true);
            doc.Replace("witness", Sponsor1.Text, true, true);
            doc.Replace("witness2", Sponsor2.Text, true, true);
            doc.Replace("place", "St. Raphael Parish", true, true);
            doc.Replace("date", bmon + " " + bspl[1] + bsuff + ", " + bspl[2], true, true);
            doc.Replace("priest", Minister.Text, true, true);
            doc.Replace("sign", Signatory.Text, true, true);
            //doc.Replace("no", EntryNum.Value.ToString(), true, true);
            doc.Replace("no", bookNum.ToString(), true, true);
            doc.Replace("page", PageNum.Value.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.docx", FileFormat.Docx);

            //Load Document
            Document document = new Document();

            document.LoadFromFile(@"Data\\print.docx");

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

            System.Diagnostics.Process.Start("Output\\print_file.pdf");

            string tmp = pmsutil.LogRecord(recordID, "LOGC-03");

            pmsutil.InsertTransaction("Matrimonial Cert.", "Unpaid", recordID, Convert.ToDouble(PrintingFee.Value));
            return(1);
        }
Exemple #3
0
        /// <summary>
        /// Inserts the request to the database.
        /// </summary>
        private int PrintEntry()
        {
            string[] bspl = BurialDate.Text.Split('/');
            string   bmon = PrepMonth(int.Parse(bspl[0]));

            string[] dspl = DeathDate.Text.Split('/');
            string   dmon = PrepMonth(int.Parse(dspl[0]));

            Document doc = new Document();

            doc.LoadFromFile("Data\\temp_death.docx");
            doc.Replace("name", fullName, true, true);
            doc.Replace("age", Convert.ToString(age), true, true);
            doc.Replace("nationality", Nationality.Text, true, true);
            doc.Replace("residence", residence1, true, true);
            doc.Replace("civil", status, true, true);
            doc.Replace("father", p1, true, true);
            doc.Replace("mother", p2, true, true);
            doc.Replace("spouse", spouse, true, true);
            doc.Replace("date_of_birth", bmon + " " + bspl[1] + ", " + bspl[2], true, true);
            doc.Replace("cause_of_death", causeOfDeath, true, true);
            doc.Replace("date_of_burial", dmon + " " + dspl[1] + ", " + dspl[2], true, true);
            doc.Replace("place_of_burial", intermentPlace, true, true);
            doc.Replace("priest", minister, true, true);
            doc.Replace("sign", Signatory.Text, true, true);
            doc.Replace("no", Convert.ToString(entryNum), true, true);
            doc.Replace("page", Convert.ToString(pageNum), 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.Replace("YY", date[2].Remove(0, 2), true, true);
            doc.SaveToFile("Data\\print.docx", FileFormat.Docx);

            //Load Document
            Document document = new Document();

            document.LoadFromFile(@"Data\\print.docx");

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

            System.Diagnostics.Process.Start("Output\\print_file.pdf");

            //Reference
            string tmp = pmsutil.LogRecord(recordID, "LOGC-03");

            pmsutil.InsertTransaction("Burial Cert.", "Unpaid", recordID, Convert.ToDouble(PrintingFee.Value));
            return(1);
        }
        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++;
            }
        }
        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++;
            }
        }
        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++;
            }
        }
        private void CreateMassRecord(object sender, RoutedEventArgs e)
        {
            if (TabControl1.SelectedIndex == 0)
            {
                if (CheckInputs() == true)
                {
                    dbman   = new DBConnectionManager();
                    pmsutil = new PMSUtil();
                    //TODO
                    try
                    {
                        string       apmID       = pmsutil.GenAppointmentID();
                        MySqlCommand cmd         = dbman.DBConnect().CreateCommand();
                        string       soulsof_tmp = SoulsOf.Text;
                        if (MassType.Text == "All Souls" || MassType.Text == "Soul/s of")
                        {
                            soulsof_tmp = SoulsOf.Text;
                        }
                        else
                        {
                            soulsof_tmp = "NA.";
                        }
                        cmd.CommandText =
                            "INSERT INTO appointments(appointment_id, appointment_date, appointment_time, appointment_type, requested_by, placed_by, remarks, status)" +
                            "VALUES(@appointment_id, @appointment_date, @appointment_time, @appointment_type, @requested_by, @placed_by, @remarks, @status)";
                        cmd.Parameters.AddWithValue("@appointment_id", apmID);
                        cmd.Parameters.AddWithValue("@appointment_date", DateTime.Parse(SelectedDate1.Text).ToString("yyyy-MM-dd"));
                        cmd.Parameters.AddWithValue("@appointment_time", DateTime.Parse(SelectedTime1.Text).ToString("HH:mm:ss"));
                        cmd.Parameters.AddWithValue("@appointment_type", GetATypeID(MassType.Text));
                        cmd.Parameters.AddWithValue("@requested_by", OfferedBy1.Text);
                        cmd.Parameters.AddWithValue("@placed_by", Application.Current.Resources["uid"].ToString());
                        cmd.Parameters.AddWithValue("@remarks", soulsof_tmp);
                        cmd.Parameters.AddWithValue("@status", 1);
                        cmd.Prepare();
                        int stat_code = cmd.ExecuteNonQuery();
                        dbman.DBClose();
                        if (stat_code > 0)
                        {
                            _caller.SyncEvent2();
                            MsgSuccess();
                            this.Close();
                        }
                        else
                        {
                            MsgFail();
                        }
                        string tmp = pmsutil.LogScheduling(apmID, "LOGC-01");
                        pmsutil.InsertTransaction("Regular Serv. - " + MassType.Text, "Unpaid", apmID, Convert.ToDouble(Fee.Value));
                    }
                    catch (MySqlException ex)
                    {
                    }
                    this.Close();
                }
                else
                {
                }
            }
            else
            {
                if (CheckInputs() == true)
                {
                    string selTime = THours.Text + ":" + TMinutes.Text + " " + TimeMode.Text;

                    if (IsAvailable(DateTime.Parse(SelectedDate2.Text).ToString("yyyy-MM-dd"), DateTime.Parse(selTime).ToString("HH:mm:ss"), GetPriest(AssignedPriest.Text)) == false)
                    {
                        MsgNotAvailable(DateTime.Parse(SelectedDate2.Text).ToString("MMM dd, yyyy"), DateTime.Parse(selTime).ToString("HH:mm tt"), AssignedPriest.Text);
                        this.Close();
                    }
                    else
                    {
                        dbman   = new DBConnectionManager();
                        pmsutil = new PMSUtil();
                        //TODO
                        try
                        {
                            string       apmID = pmsutil.GenAppointmentID();
                            MySqlCommand cmd   = dbman.DBConnect().CreateCommand();
                            cmd.CommandText =
                                "INSERT INTO appointments(appointment_id, appointment_date, appointment_time, appointment_type, requested_by, placed_by, remarks, status, assigned_priest)" +
                                "VALUES(@appointment_id, @appointment_date, @appointment_time, @appointment_type, @requested_by, @placed_by, @remarks, @status, @a_priest)";
                            cmd.Parameters.AddWithValue("@appointment_id", apmID);
                            cmd.Parameters.AddWithValue("@appointment_date", DateTime.Parse(SelectedDate2.Text).ToString("yyyy-MM-dd"));
                            cmd.Parameters.AddWithValue("@appointment_time", DateTime.Parse(selTime).ToString("HH:mm:ss"));
                            cmd.Parameters.AddWithValue("@appointment_type", GetATypeID(EventServiceType.Text));
                            cmd.Parameters.AddWithValue("@requested_by", OfferedBy2.Text);
                            cmd.Parameters.AddWithValue("@placed_by", Application.Current.Resources["uid"].ToString());
                            cmd.Parameters.AddWithValue("@remarks", Remarks.Text);
                            cmd.Parameters.AddWithValue("@status", 1);
                            cmd.Parameters.AddWithValue("@a_priest", GetPriest(AssignedPriest.Text));
                            cmd.Prepare();
                            int stat_code = cmd.ExecuteNonQuery();
                            dbman.DBClose();
                            if (stat_code > 0)
                            {
                                _caller.SyncEvent2();
                                MsgSuccess();
                                this.Close();
                            }
                            else
                            {
                                MsgFail();
                            }
                            string tmp = pmsutil.LogScheduling(apmID, "LOGC-01");
                            pmsutil.InsertTransaction("Special Serv. - " + EventServiceType.Text, "Unpaid", apmID, Convert.ToDouble(Fee2.Value));
                        }
                        catch (MySqlException ex)
                        {
                            Console.WriteLine("Error: {0}", ex.ToString());
                        }
                    }
                }
                else
                {
                }
            }
        }
Exemple #8
0
        /// <summary>
        /// Inserts the request to the database.
        /// </summary>
        private int PrintEntry()
        {
            string x1;

            string[] spl  = ConfirmationDate.Text.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", 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", minister, true, true);
            doc.Replace("no", entryNum.ToString(), true, true);
            doc.Replace("page", pageNum.ToString(), true, true);
            doc.Replace("book", bookNum.ToString(), true, true);
            doc.Replace("priest", Signatory.Text, true, true);
            doc.Replace("purpose", Purpose.Text, true, true);
            doc.Replace("date", DateTime.Now.ToString("MMMM d, yyyy"), true, true);
            doc.SaveToFile("Data\\print.docx", FileFormat.Docx);

            //Load Document
            Document document = new Document();

            document.LoadFromFile(@"Data\\print.docx");

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

            System.Diagnostics.Process.Start("Output\\print_file.pdf");

            if (Purpose.SelectedIndex == 0)
            {
                //Reference
                string tmp = pmsutil.LogRecord(recordID, "LOGC-03");
            }
            else
            {
                //Marriage
                string tmp = pmsutil.LogRecord(recordID, "LOGC-04");
            }
            if (Purpose.SelectedIndex == 0)
            {
                //Reference
                string tmp = pmsutil.LogRecord(recordID, "LOGC-03");
            }
            else
            {
                //Marriage
                string tmp = pmsutil.LogRecord(recordID, "LOGC-04");
            }
            pmsutil.InsertTransaction("Confirmation Cert.", "Unpaid", recordID, Convert.ToDouble(PrintingFee.Value));
            return(1);
        }
Exemple #9
0
        /// <summary>
        /// Inserts the request to the database.
        /// </summary>
        private int PrintEntry()
        {
            string x1, x2;

            string[] bspl  = birthDate.Split('/');
            string   bsuff = GetDaySuffix(int.Parse(bspl[1]));
            string   bmon  = PrepMonth(int.Parse(bspl[0]));

            if (int.Parse(bspl[2]) > 1999)
            {
                x1      = "";
                bspl[2] = bspl[2].Remove(0, 2);
            }
            else
            {
                x1 = "X";
            }

            string[] dspl  = baptismDate.Split('/');
            string   dsuff = GetDaySuffix(int.Parse(dspl[1]));
            string   dmon  = PrepMonth(int.Parse(dspl[0]));

            if (int.Parse(dspl[2]) > 1999)
            {
                x2      = "";
                dspl[2] = dspl[2].Remove(0, 2);
            }
            else
            {
                x2 = "X";
            }

            Document doc = new Document();

            doc.LoadFromFile("Data\\temp_baptismal.docx");
            doc.Replace("name", fullName, true, true);
            doc.Replace("father", parent1, true, true);
            doc.Replace("mother", parent2, true, true);
            doc.Replace("born", birthPlace, true, true);
            doc.Replace("day1", int.Parse(bspl[1]) + bsuff, true, true);
            doc.Replace("month1", bmon, true, true);
            doc.Replace("X1", x1, true, true);
            //doc.Replace("year1", bspl[2], true, true);
            doc.Replace("year1", DateTime.Parse(birthDate).ToString("yyyy"), true, true);
            doc.Replace("day2", int.Parse(dspl[1]) + dsuff, true, true);
            doc.Replace("month2", dmon, true, true);
            doc.Replace("X2", x2, true, true);
            doc.Replace("year2", DateTime.Parse(baptismDate).ToString("yyyy"), true, true);
            doc.Replace("church", pmsutil.GetChurchName(), true, true);
            doc.Replace("by", Signatory.Text, true, true);
            doc.Replace("sponsor1", sponsor1, true, true);
            doc.Replace("sponsor2", sponsor2, true, true);
            doc.Replace("book", bookNum.ToString(), true, true);
            doc.Replace("page", pageNum.ToString(), true, true);
            doc.Replace("no", entryNum.ToString(), true, true);
            doc.Replace("priest", minister, true, true);
            doc.Replace("purpose", Purpose.Text, true, true);
            doc.Replace("date", DateTime.Now.ToString("MMMM d, yyyy"), true, true);
            doc.SaveToFile("Data\\print.docx", FileFormat.Docx);

            //Load Document
            Document document = new Document();

            document.LoadFromFile(@"Data\\print.docx");

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

            System.Diagnostics.Process.Start("Output\\print_file.pdf");


            if (Purpose.SelectedIndex == 0)
            {
                //Reference
                string tmp = pmsutil.LogRecord(recordID, "LOGC-03");
            }
            else
            {
                //Marriage
                string tmp = pmsutil.LogRecord(recordID, "LOGC-04");
            }
            pmsutil.InsertTransaction("Baptismal Cert.", "Unpaid", recordID, Convert.ToDouble(PrintingFee.Value));
            return(1);
        }