Exemplo n.º 1
0
        private void showSignature(int newUID)
        {
            sigPadInputCtrl1.Visible = false;
            btnResetSig.Visible      = false;
            sigPadInputCtrl1.Visible = true;
            btnResetSig.Visible      = true;
            FamilyCardSig clsFCSig = new FamilyCardSig(CCFBGlobal.connectionString);

            clsFCSig.LoadImage(newUID, clsHH.ID);
            if (clsFCSig.HaveSignature == true)
            {
                sigPadInputCtrl1.Signature = clsFCSig.SigString;
            }
        }
Exemplo n.º 2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            int    newTrxId    = 0;
            object osavename   = savePath + idText + ".pdf";
            object oFileFormat = Microsoft.Office.Interop.Word.WdSaveFormat.wdFormatPDF;

            if (okToSave() == true)
            {
                btnSave.Enabled = false;
                if (sigPadInputCtrl1.Visible == true)
                {
                    if (sigPadInputCtrl1.IsSigned == true)
                    {
                        if (sigPadInputCtrl1.SaveSigImage(constSigFile))
                        {
                            oWord.Selection.EndKey(WdUnits.wdStory, WdMovementType.wdExtend);
                            oWord.Selection.MoveRight(WdUnits.wdCharacter, 1);
                            oWord.Selection.InlineShapes.AddPicture(constSigFile, false, true);
                            oWordDoc.Save();
                            filename = oWordDoc.FullName;

                            if (chkPrintOnSave.Checked == true)
                            {
                                CCFBGlobal.appendErrorToErrorReport(osavename.ToString(), "Sign and Print Family Card");
                                oWord.Options.PrintBackground = false;
                                oWordDoc.PrintOut(ref oFalse, ref oFalse, ref oMissing,
                                                  ref oMissing, ref oMissing, ref oMissing,
                                                  ref oMissing, ref oMissing, ref oMissing,
                                                  ref oMissing, ref oMissing, ref oMissing,
                                                  ref oMissing, ref oMissing, ref oMissing,
                                                  ref oMissing, ref oMissing, ref oMissing);
                                System.Windows.Forms.Application.DoEvents();
                                System.Threading.Thread.Sleep(100);
                            }
                            oWordDoc.SaveAs2(ref osavename, ref oFileFormat);
                            ((_Application)oWord).Quit(SaveChanges: true, OriginalFormat: false, RouteDocument: false);
                            System.Runtime.InteropServices.Marshal.ReleaseComObject(oWord);
                            if (chkCloseOnSave.Checked == false)
                            {
                                CCFBGlobal.openDocumentOutsideCCFB(osavename.ToString());
                            }
                            CCFBGlobal.DeleteFile(filename);
                        }

                        //picSignature.Visible = true;
                        ////cmsLog.Visible = false;
                        //MessageBox.Show(this, "Close Signature Display");
                        //picSignature.Visible = false;

                        FamilyCardSig clsFCSig = new FamilyCardSig(CCFBGlobal.connectionString);
                        clsFCSig.LoadImage(newTrxId, clsHH.ID);
                        clsFCSig.UID       = newTrxId;
                        clsFCSig.HhID      = clsHH.ID;
                        clsFCSig.SigDate   = Convert.ToDateTime(sigPadInputCtrl1.GetSigDate());
                        clsFCSig.DocPath   = osavename.ToString();
                        clsFCSig.SigImage  = sigPadInputCtrl1.GetImage();
                        clsFCSig.SigString = sigPadInputCtrl1.GetSignature();
                        if (clsFCSig.HaveSignature == true)
                        {
                            clsFCSig.Update();
                        }
                        else
                        {
                            clsFCSig.Insert();
                        }
                    }
                    sigPadInputCtrl1.ResetTablet();
                }
                this.Close();
            }
            else
            {
                MessageBox.Show("Signature is missing", "Saqve Signature");
            }
            btnSave.Enabled = true;
        }