Beispiel #1
0
 ///<summary>Attempts to send a push notificaiton to the given mobileAppDeviceNum so that the device can view treatPlan and PDF.
 ///Returns true if no error occured, otherwise false and errorMsg is set.</summary>
 public static bool CI_SendTreatmentPlan(PdfDocument doc, TreatPlan treatPlan, bool hasPracticeSig, long mobileAppDeviceNum
                                         , out string errorMsg, out long mobileDataByteNum)
 {
     mobileDataByteNum = -1;
     try {
         if (MobileDataBytes.TryInsertPDF(doc, treatPlan.PatNum, null, eActionType.TreatmentPlan, out mobileDataByteNum, out errorMsg,
                                          new List <string>()
         {
             treatPlan.Heading, hasPracticeSig.ToString(), treatPlan.DateTP.Ticks.ToString()
         }))
         {
             SendPushBackground(PushType.CI_TreatmentPlan, mobileAppDeviceNum
                                , listPrimaryKeys: new List <long>()
             {
                 mobileDataByteNum, treatPlan.PatNum, treatPlan.TreatPlanNum
             }
                                , listTags: new List <string>()
             {
                 treatPlan.Heading, hasPracticeSig.ToString(), treatPlan.DateTP.Ticks.ToString()
             }
                                , runAsync: true
                                );
         }
     }
     catch (Exception ex) {
         errorMsg = ex.Message;
     }
     return(errorMsg.IsNullOrEmpty());
 }
Beispiel #2
0
 ///<summary>Verifies the given unlockCode and Invokes _unlockGeneratedFuc before setting the form locked.</summary>
 private void VerifyAndSetUnlockCode(string unlockCode)
 {
     if (unlockCode.IsNullOrEmpty())
     {
         MsgBox.Show(this, "Unlock code is empty.");
         return;
     }
     if (unlockCode.Length != 6)           //Verify that code is valid.
     {
         MsgBox.Show(this, "Unlock code must be 6 characters.");
         return;
     }
     if (MobileDataBytes.IsValidUnlockCode(unlockCode))             //Code alreay in use.
     {
         MsgBox.Show(this, "Please choose another unlock code.");
         return;
     }
     if (!TryInvoke(unlockCode, out _mobileDataByte))
     {
         return;
     }
     if (!MobileDataBytes.IsValidUnlockCode(unlockCode))             //Verify that code made it into db.
     {
         MsgBox.Show(this, "Unlock code invalid.");
         return;
     }
     SetFormLocked(unlockCode);
 }
Beispiel #3
0
 private void FormMobileCode_Shown(object sender, EventArgs e)
 {
     if (PrefC.GetBool(PrefName.MobileAutoUnlockCode))
     {
         VerifyAndSetUnlockCode(MobileDataBytes.GenerateUnlockCode());
     }
     _unlockCodeTimer.Interval = 1000;
     _unlockCodeTimer.Tick    += UnlockCodeTimer_Tick;
 }
Beispiel #4
0
        ///<summary>Once we have a valid Unlock Code in the DB we check to see if the Unlock Code has been used yet.
        ///Once it has we close the form.</summary>
        private void UnlockCodeTimer_Tick(object sender, EventArgs e)
        {
            string unlockCode = GetUiUnlockCode();

            if (_isFormLocked && !MobileDataBytes.IsValidUnlockCode(unlockCode))
            {
                _unlockCodeTimer.Stop();
                DialogResult = DialogResult.OK;
            }
        }
Beispiel #5
0
 ///<summary>When the form closes make sure to delete any MobileDataByte rows.</summary>
 private void FormMobileCode_FormClosing(object sender, FormClosingEventArgs e)
 {
     _unlockCodeTimer.Stop();
     _unlockCodeTimer.Dispose();
     _unlockCodeTimer = null;
     if (_mobileDataByte != null)           //User might have never set a code.
     {
         MobileDataBytes.Delete(_mobileDataByte.MobileDataByteNum);
     }
     picBoxMain.Image?.Dispose();
 }