예제 #1
0
        protected void SetUpStudents()
        {
            if (Request.IsMobileDevice())
            {
                mfbIlOfflineEndorsements.Columns = 1;
            }
            mfuOfflineEndorsements.Class = MyFlightbook.Image.MFBImageInfo.ImageClass.OfflineEndorsement;
            mfbIlOfflineEndorsements.Key = Page.User.Identity.Name;
            mfbIlOfflineEndorsements.Refresh();
            byte[] rgbDefaultScribble = CFIStudentMap.DefaultScribbleForInstructor(m_pf);
            mvDefaultSig.SetActiveView(vwCurrentSig);
            if (rgbDefaultScribble == null || rgbDefaultScribble.Length == 0)
            {
                lnkEditDefaultSig.Text = Resources.LocalizedText.StudentSigningDefaultScribbleAdd;
                imgCurrSig.Src         = string.Empty;
            }
            else
            {
                imgCurrSig.Src = ScribbleImage.DataLinkForByteArray(rgbDefaultScribble);
            }

            Profile pf = Profile.GetUser(Page.User.Identity.Name);

            pnlCertificate.Visible          = String.IsNullOrEmpty(pf.Certificate);
            txtCertificate.Text             = pf.Certificate;
            mfbTypeInDateCFIExpiration.Date = pf.CertificateExpiration;

            mfbScribbleSignature.WatermarkRef = ResolveClientUrl("~/images/rubberstamp.png");
        }
 protected void btnSaveDefaultSig_Click(object sender, EventArgs e)
 {
     byte[] rgbSig = mfbScribbleSignature.Base64Data();
     CFIStudentMap.SetDefaultScribbleForInstructor(m_pf, rgbSig);
     imgCurrSig.Src         = ScribbleImage.DataLinkForByteArray(rgbSig);
     imgCurrSig.Visible     = (rgbSig.Length != 0);
     lnkEditDefaultSig.Text = (rgbSig.Length == 0) ? Resources.LocalizedText.StudentSigningDefaultScribbleAdd : Resources.LocalizedText.StudentSigningDefaultScribbleEdit;
     mvDefaultSig.SetActiveView(vwCurrentSig);
 }
    protected void valSignature_ServerValidate(object source, ServerValidateEventArgs args)
    {
        if (args == null)
        {
            throw new ArgumentNullException(nameof(args));
        }

        if (Enabled && !ScribbleImage.IsValidDataURL(hdnSigData.Value))
        {
            args.IsValid = false;
        }
    }
    public byte[] Base64Data()
    {
        byte[] rgbSignature;
        try
        {
            rgbSignature = ScribbleImage.FromDataLinkURL(hdnSigData.Value);
        }
        catch (MyFlightbookException ex)
        {
            lblSigErr.Text = ex.Message;
            return(null);
        }

        return(rgbSignature);
    }