private void butOK_Click(object sender, System.EventArgs e) { if (textDateTP.errorProvider1.GetError(textDateTP) != "" ) { MsgBox.Show(this, "Please fix data entry errors first."); return; } if (textDateTP.Text == "") { MsgBox.Show(this, "Please enter a date first."); return; } PlanCur.DateTP = PIn.Date(textDateTP.Text); PlanCur.Heading = textHeading.Text; PlanCur.Note = textNote.Text; if (_presenterCur != null) { PlanCur.UserNumPresenter = _presenterCur.UserNum; } else { PlanCur.UserNumPresenter = 0; } //PlanCur.SecUserNumEntry is updated automatically by MySQL. TreatPlans.Update(PlanCur); SecurityLogs.MakeLogEntry(Permissions.TreatPlanEdit, PlanCur.PatNum, "Edit TP: " + PlanCur.DateTP.ToShortDateString()); if (_presenterCur != null && (_presenterOld == null || _presenterCur.UserNum != _presenterOld.UserNum)) { SecurityLogs.MakeLogEntry(Permissions.TreatPlanPresenterEdit, PlanCur.PatNum, "TP Presenter Changed from " + (_presenterOld == null?"\"null\"":_presenterOld.UserName) + " to " + _presenterCur.UserName + "."); } DialogResult = DialogResult.OK; }
private void butOK_Click(object sender, EventArgs e) { SaveSignature(); TreatPlans.Update(TPcur); SecurityLogs.MakeLogEntry(Permissions.TreatPlanEdit, TPcur.PatNum, "Sign TP"); DialogResult = DialogResult.OK; }
private void butOK_Click(object sender, EventArgs e) { SaveSignature(); //"saves" signature to TPCur, does not save to DB. TreatPlans.Update(TPcur); //save signature to DB. TPcur.ListProcTPs = ProcTPs.RefreshForTP(TPcur.TreatPlanNum); if (DoPrintUsingSheets) { SheetParameter.SetParameter(SheetTP, "TreatPlan", TPcur); //update TP on sheet to have new signature for generating pdfs } if (TPcur.Signature.Length > 0 && TPcur.DocNum == 0 && PrefC.GetBool(PrefName.TreatPlanSaveSignedToPdf)) { SigChanged = true; } else if (TPcur.DocNum > 0 && !Documents.DocExists(TPcur.DocNum) && PrefC.GetBool(PrefName.TreatPlanSaveSignedToPdf)) { //Setting SigChanged to True will resave document below. SigChanged = MsgBox.Show(this, MsgBoxButtons.YesNo, "Cannot find saved copy of signed PDF, would you like to resave the document?"); } if (PrefC.GetBool(PrefName.TreatPlanSaveSignedToPdf) && SaveDocDelegate != null && SigChanged && TPcur.Signature.Length > 0) { List <Document> docs = SaveDocDelegate(true, SheetTP); if (docs.Count > 0) { TPcur.DocNum = docs[0].DocNum; //attach first Doc to TP. TreatPlans.Update(TPcur); //update docnum. must be called after signature is updated. } } SecurityLogs.MakeLogEntry(Permissions.TreatPlanEdit, TPcur.PatNum, "Sign TP"); DialogResult = DialogResult.OK; }
private void FormTPsign_Load(object sender, System.EventArgs e) { //this window never comes up for new TP. Always saved ahead of time. if (!Security.IsAuthorized(Permissions.TreatPlanSign, TPcur.DateTP)) { butOK.Enabled = false; signatureBoxWrapper.Enabled = false; } LayoutToolBar(); ToolBarMain.Buttons["FullPage"].Pushed = true; previewContr.Location = new Point(0, ToolBarMain.Bottom); previewContr.Size = new Size(ClientRectangle.Width, ClientRectangle.Height - ToolBarMain.Height - panelSig.Height); if (Document.DefaultPageSettings.PrintableArea.Height == 0) { Document.DefaultPageSettings.PaperSize = new PaperSize("default", 850, 1100); } SetSize(); previewContr.Document = Document; ToolBarMain.Buttons["PageNum"].Text = (previewContr.StartPage + 1).ToString() + " / " + TotalPages.ToString(); proctpList = ProcTPs.RefreshForTP(TPcur.TreatPlanNum); signatureBoxWrapper.SignatureMode = UI.SignatureBoxWrapper.SigMode.TreatPlan; string keyData = TreatPlans.GetKeyDataForSignatureHash(TPcur, proctpList); signatureBoxWrapper.FillSignature(TPcur.SigIsTopaz, keyData, TPcur.Signature); }
private void SaveSignature() { if (SigChanged) { string keyData = TreatPlans.GetKeyDataForSignatureSaving(TPcur, proctpList); TPcur.Signature = signatureBoxWrapper.GetSignature(keyData); TPcur.SigIsTopaz = signatureBoxWrapper.GetSigIsTopaz(); } }
public void RefreshData(Patient pat, SheetField sheetField) { long patNum = pat?.PatNum ?? 0; _sheetField = sheetField; TreatPlan treatPlan = TreatPlans.GetActiveForPat(patNum); Image imgToothChart = GetToothChart(patNum, treatPlan); _imgToothChart?.Dispose(); _imgToothChart = imgToothChart; }
private void butDelete_Click(object sender, System.EventArgs e) { //if(IsNew){ // DialogResult=DialogResult.Cancel; // return; //} ProcTPs.DeleteForTP(PlanCur.TreatPlanNum); try{ TreatPlans.Delete(PlanCur); } catch (ApplicationException ex) { MessageBox.Show(ex.Message); return; } SecurityLogs.MakeLogEntry(Permissions.TreatPlanEdit, PlanCur.PatNum, "Delete TP: " + PlanCur.DateTP.ToShortDateString()); DialogResult = DialogResult.OK; }
private void butDelete_Click(object sender, System.EventArgs e) { //if(IsNew){ // DialogResult=DialogResult.Cancel; // return; //} ProcTPs.DeleteForTP(PlanCur.TreatPlanNum); try{ TreatPlans.Delete(PlanCur); } catch (ApplicationException ex) { MessageBox.Show(ex.Message); return; } TreatPlans.Delete(PlanCur); DialogResult = DialogResult.OK; }
private void butDelete_Click(object sender, EventArgs e) { if (TreatPlanCur.TPStatus == TreatPlanStatus.Active) { MsgBox.Show(this, "Cannot delete active treatment plan."); //Should never happen. return; } if (TreatPlanCur.TreatPlanNum != 0) { try { TreatPlans.Delete(TreatPlanCur); } catch (Exception ex) { MessageBox.Show(ex.Message); return; } } DialogResult = DialogResult.OK; }
private void butOK_Click(object sender, System.EventArgs e) { if (textDateTP.errorProvider1.GetError(textDateTP) != "" ) { MsgBox.Show(this, "Please fix data entry errors first."); return; } if (textDateTP.Text == "") { MsgBox.Show(this, "Please enter a date first."); return; } PlanCur.DateTP = PIn.PDate(textDateTP.Text); PlanCur.Heading = textHeading.Text; PlanCur.Note = textNote.Text; TreatPlans.InsertOrUpdate(PlanCur, false); //IsNew not applicable here. DialogResult = DialogResult.OK; }
private void SaveSignature() { //We need to set the typed signature name to the Tpcur object for both signature boxes before we get the GetKeyDataForSignatureSaving(...). //SignatureText and SignaturePracticeText are used to get the hash string. TPcur.SignatureText = textTypeSig.Text; TPcur.SignaturePracticeText = textTypeSigPractice.Text; SheetField sheetField; if (_sigChanged) { string keyData = TreatPlans.GetKeyDataForSignatureSaving(TPcur, proctpList); TPcur.Signature = signatureBoxWrapper.GetSignature(keyData); TPcur.SigIsTopaz = signatureBoxWrapper.GetSigIsTopaz(); TPcur.DateTSigned = MiscData.GetNowDateTime(); sheetField = SheetTP?.GetSheetFieldByName("SignatureText"); if (sheetField != null) { sheetField.FieldValue = TPcur.SignatureText; } sheetField = SheetTP?.GetSheetFieldByName("DateTSigned"); if (sheetField != null) { sheetField.FieldValue = TPcur.DateTSigned.ToShortDateString(); } } if (_hasSigPractice && _hasSigPracticeChanged) { string keyData = TreatPlans.GetKeyDataForSignatureSaving(TPcur, proctpList); TPcur.SignaturePractice = signatureBoxWrapperPractice.GetSignature(keyData); TPcur.SigIsTopaz = signatureBoxWrapperPractice.GetSigIsTopaz(); TPcur.DateTPracticeSigned = MiscData.GetNowDateTime(); sheetField = SheetTP.GetSheetFieldByName("SignaturePracticeText"); if (sheetField != null) { sheetField.FieldValue = TPcur.SignaturePracticeText; } sheetField = SheetTP.GetSheetFieldByName("DateTPracticeSigned"); if (sheetField != null) { sheetField.FieldValue = TPcur.DateTPracticeSigned.ToShortDateString(); } } }
private void butOK_Click(object sender, System.EventArgs e) { if (textDateTP.errorProvider1.GetError(textDateTP) != "" ) { MsgBox.Show(this, "Please fix data entry errors first."); return; } if (textDateTP.Text == "") { MsgBox.Show(this, "Please enter a date first."); return; } PlanCur.DateTP = PIn.Date(textDateTP.Text); PlanCur.Heading = textHeading.Text; PlanCur.Note = textNote.Text; TreatPlans.Update(PlanCur); SecurityLogs.MakeLogEntry(Permissions.TreatPlanEdit, PlanCur.PatNum, "Edit TP: " + PlanCur.DateTP.ToShortDateString()); DialogResult = DialogResult.OK; }
private void SaveSignature() { if (SigChanged) { //This check short-circuits so that sigBoxTopaz.Visible will not be checked in MONO ever. //if(allowTopaz && sigBoxTopaz.Visible) { if (sigBoxTopaz.Visible) { TPcur.SigIsTopaz = true; if (CodeBase.TopazWrapper.GetTopazNumberOfTabletPoints(sigBoxTopaz) == 0) { TPcur.Signature = ""; return; } CodeBase.TopazWrapper.SetTopazCompressionMode(sigBoxTopaz, 0); CodeBase.TopazWrapper.SetTopazEncryptionMode(sigBoxTopaz, 0); CodeBase.TopazWrapper.SetTopazKeyString(sigBoxTopaz, TreatPlans.GetHashString(TPcur, proctpList)); CodeBase.TopazWrapper.SetTopazEncryptionMode(sigBoxTopaz, 2); CodeBase.TopazWrapper.SetTopazCompressionMode(sigBoxTopaz, 2); TPcur.Signature = CodeBase.TopazWrapper.GetTopazString(sigBoxTopaz); } else { TPcur.SigIsTopaz = false; if (sigBox.NumberOfTabletPoints() == 0) { TPcur.Signature = ""; return; } //sigBox.SetSigCompressionMode(0); //sigBox.SetEncryptionMode(0); sigBox.SetKeyString(TreatPlans.GetHashString(TPcur, proctpList)); //"0000000000000000"); //sigBox.SetAutoKeyData(ProcCur.Note+ProcCur.UserNum.ToString()); //sigBox.SetEncryptionMode(2); //sigBox.SetSigCompressionMode(2); TPcur.Signature = sigBox.GetSigString(); } } }
private void FormTreatPlanCurEdit_Load(object sender, EventArgs e) { if (TreatPlanCur == null || (TreatPlanCur.TPStatus != TreatPlanStatus.Active && TreatPlanCur.TPStatus != TreatPlanStatus.Inactive)) { throw new Exception("No treatment plan loaded."); } _treatPlanUnassigned = TreatPlans.GetUnassigned(TreatPlanCur.PatNum); this.Text = TreatPlanCur.Heading + " - {" + Lans.g(this, TreatPlanCur.TPStatus.ToString()) + "}"; _listTpAttachesAll = TreatPlanAttaches.GetAllForPatNum(TreatPlanCur.PatNum); _listTpAttachesCur = _listTpAttachesAll.FindAll(x => x.TreatPlanNum == TreatPlanCur.TreatPlanNum); _listTpProcsAll = Procedures.GetProcsByStatusForPat(TreatPlanCur.PatNum, new[] { ProcStat.TP, ProcStat.TPi }); ProcedureLogic.SortProcedures(ref _listTpProcsAll); _listTpProcsCur = _listTpProcsAll.FindAll(x => _listTpAttachesCur.Any(y => x.ProcNum == y.ProcNum) || (TreatPlanCur.TPStatus == TreatPlanStatus.Active && (x.AptNum > 0 || x.PlannedAptNum > 0))); _listAppointments = Appointments.GetMultApts(_listTpProcsAll.SelectMany(x => new[] { x.AptNum, x.PlannedAptNum }).Distinct().Where(x => x > 0).ToList()); textHeading.Text = TreatPlanCur.Heading; textNote.Text = TreatPlanCur.Note; FillGrids(); if (TreatPlanCur.TPStatus == TreatPlanStatus.Inactive && TreatPlanCur.Heading == Lan.g("TreatPlan", "Unassigned")) { gridTP.Title = Lan.g("TreatPlan", "Unassigned Procedures"); labelHeading.Visible = false; textHeading.Visible = false; labelNote.Visible = false; textNote.Visible = false; gridAll.Visible = false; butLeft.Visible = false; butRight.Visible = false; butOK.Enabled = false; butDelete.Visible = false; } if (TreatPlanCur.TPStatus == TreatPlanStatus.Active) { butMakeActive.Enabled = false; butDelete.Enabled = false; } comboPlanType.Items.AddRange(Enum.GetNames(typeof(TreatPlanType))); comboPlanType.SelectedIndex = (int)TreatPlanCur.TPType; }
private void butOK_Click(object sender, EventArgs e) { TreatPlanCur.Heading = textHeading.Text; TreatPlanCur.Note = textNote.Text; TreatPlanCur.UserNumPresenter = 0; TreatPlanCur.TPType = (TreatPlanType)comboPlanType.SelectedIndex; if (TreatPlanCur.TreatPlanNum == 0) { TreatPlanCur.TreatPlanNum = TreatPlans.Insert(TreatPlanCur); } else { TreatPlans.Update(TreatPlanCur); } //get all TPAttaches for this TP where there is either a procedure with a TPAttach linking it to this TP //or, if this TP is active, a procedure linked to an appt by AptNum or PlannedAptNun List <TreatPlanAttach> listNew = _listTpAttachesCur.FindAll(x => _listTpProcsCur.Any(y => x.ProcNum == y.ProcNum)); _listTpProcsCur.FindAll(x => !listNew.Any(y => x.ProcNum == y.ProcNum)) .ForEach(x => listNew.Add(new TreatPlanAttach() { TreatPlanNum = TreatPlanCur.TreatPlanNum, ProcNum = x.ProcNum, Priority = 0 })); TreatPlanAttaches.Sync(listNew, TreatPlanCur.TreatPlanNum); if (_makeActive) { TreatPlans.SetOtherActiveTPsToInactive(TreatPlanCur); } if (TreatPlanCur.TPStatus == TreatPlanStatus.Active) { //we have to this whether we just made this the active or it was already active, otherwise any procs we move off of the active plan will //retain the TP status and AuditPlans will throw them back on this TP. //Changing the status to TPi of any procs that are not on this plan prevents that from happening. Procedures.SetTPActive(TreatPlanCur.PatNum, listNew.Select(x => x.ProcNum).ToList()); } DialogResult = DialogResult.OK; }
private void FormTPsign_Load(object sender, System.EventArgs e) { //this window never comes up for new TP. Always saved ahead of time. if (!Security.IsAuthorized(Permissions.TreatPlanSign, TPcur.DateTP)) { butOK.Enabled = false; signatureBoxWrapper.Enabled = false; signatureBoxWrapperPractice.Enabled = false; textTypeSig.Enabled = false; textTypeSigPractice.Enabled = false; } _hasSigPractice = (SheetTP == null ? false : (SheetTP.SheetFields.Any(x => x.FieldType == SheetFieldType.SigBoxPractice) && DoPrintUsingSheets)); LayoutToolBar(); ToolBarMain.Buttons["FullPage"].Pushed = true; previewContr.Location = new Point(0, ToolBarMain.Bottom); previewContr.Size = new Size(ClientRectangle.Width, ClientRectangle.Height - ToolBarMain.Height - panelSig.Height); if (Document == null) //Only set when not pringing using sheets, shet via a MigraDoc. //TODO:Implement ODprintout pattern - MigraDoc //Just signing the TP, there is no way to print a Treat' Plan from the Sign TP window so suppress the printer dialogs. //Users will click the Print TP button from the Treat' Plan module when they want to print. { PrinterL.ControlPreviewOverride = previewContr; //Sets the printdoc to previewContr.Document after validation. Otherwise shows error. SheetPrinting.Print(SheetTP, isPrintDocument: false, isPreviewMode: true); if (ODprintout.CurPrintout.SettingsErrorCode != PrintoutErrorCode.Success) { DialogResult = DialogResult.Cancel; return; } Document = ODprintout.CurPrintout.PrintDoc; } else //MigraDoc { if (Document.DefaultPageSettings.PrintableArea.Height == 0) { Document.DefaultPageSettings.PaperSize = new PaperSize("default", 850, 1100); } previewContr.Document = Document; } SetSize(); ToolBarMain.Buttons["PageNum"].Text = (previewContr.StartPage + 1).ToString() + " / " + TotalPages.ToString(); proctpList = ProcTPs.RefreshForTP(TPcur.TreatPlanNum); //Fill TP signature signatureBoxWrapper.SignatureMode = UI.SignatureBoxWrapper.SigMode.TreatPlan; string keyData = TreatPlans.GetKeyDataForSignatureHash(TPcur, proctpList); signatureBoxWrapper.FillSignature(TPcur.SigIsTopaz, keyData, TPcur.Signature); SheetField sheetField; if (SheetTP != null) { sheetField = SheetTP.SheetFields.FirstOrDefault(x => x.FieldType == SheetFieldType.SigBox); if (sheetField != null && !string.IsNullOrEmpty(sheetField.FieldName)) { labelSig.Text = $"{sheetField.FieldName} sign here --->"; } sheetField = SheetTP.GetSheetFieldByName("SignatureText"); if (sheetField != null) { textTypeSig.Text = TPcur.SignatureText; labelTypeSig.Visible = true; textTypeSig.Visible = true; } } //Fill TP practice signature if printing using sheets if (_hasSigPractice) { signatureBoxWrapperPractice.Visible = true; labelSigPractice.Visible = true; signatureBoxWrapperPractice.SignatureMode = UI.SignatureBoxWrapper.SigMode.TreatPlan; signatureBoxWrapperPractice.FillSignature(TPcur.SigIsTopaz, keyData, TPcur.SignaturePractice); sheetField = SheetTP.SheetFields.FirstOrDefault(x => x.FieldType == SheetFieldType.SigBoxPractice); if (sheetField != null && !string.IsNullOrEmpty(sheetField.FieldName)) { labelSigPractice.Text = $"{sheetField.FieldName} sign here --->"; } sheetField = SheetTP.GetSheetFieldByName("SignaturePracticeText"); if (sheetField != null) { textTypeSigPractice.Text = TPcur.SignaturePracticeText; labelTypeSigPractice.Visible = true; //defaulted to be hidden textTypeSigPractice.Visible = true; } } }
private void FormTPsign_Load(object sender, System.EventArgs e) { //this window never comes up for new TP. Always saved ahead of time. if (!Security.IsAuthorized(Permissions.TreatPlanEdit, TPcur.DateTP)) { butOK.Enabled = false; sigBox.Enabled = false; butClearSig.Enabled = false; butTopazSign.Enabled = false; } LayoutToolBar(); ToolBarMain.Buttons["FullPage"].Pushed = true; previewContr.Location = new Point(0, ToolBarMain.Bottom); previewContr.Size = new Size(ClientRectangle.Width, ClientRectangle.Height - ToolBarMain.Height - panelSig.Height); if (Document.DefaultPageSettings.PrintableArea.Height == 0) { Document.DefaultPageSettings.PaperSize = new PaperSize("default", 850, 1100); } SetSize(); previewContr.Document = Document; ToolBarMain.Buttons["PageNum"].Text = (previewContr.StartPage + 1).ToString() + " / " + TotalPages.ToString(); labelInvalidSig.Visible = false; sigBox.Visible = true; proctpList = ProcTPs.RefreshForTP(TPcur.TreatPlanNum); if (TPcur.SigIsTopaz) { if (TPcur.Signature != "") { //if(allowTopaz) { sigBox.Visible = false; sigBoxTopaz.Visible = true; CodeBase.TopazWrapper.ClearTopaz(sigBoxTopaz); CodeBase.TopazWrapper.SetTopazCompressionMode(sigBoxTopaz, 0); CodeBase.TopazWrapper.SetTopazEncryptionMode(sigBoxTopaz, 0); string keystring = TreatPlans.GetHashString(TPcur, proctpList); CodeBase.TopazWrapper.SetTopazKeyString(sigBoxTopaz, keystring); CodeBase.TopazWrapper.SetTopazEncryptionMode(sigBoxTopaz, 2); //high encryption CodeBase.TopazWrapper.SetTopazCompressionMode(sigBoxTopaz, 2); //high encryption CodeBase.TopazWrapper.SetTopazSigString(sigBoxTopaz, TPcur.Signature); sigBoxTopaz.Refresh(); //If sig is not showing, then try encryption mode 3 for signatures signed with old SigPlusNet.dll. if (CodeBase.TopazWrapper.GetTopazNumberOfTabletPoints(sigBoxTopaz) == 0) { CodeBase.TopazWrapper.SetTopazEncryptionMode(sigBoxTopaz, 3); //Unknown mode (told to use via TopazSystems) CodeBase.TopazWrapper.SetTopazSigString(sigBoxTopaz, TPcur.Signature); } if (CodeBase.TopazWrapper.GetTopazNumberOfTabletPoints(sigBoxTopaz) == 0) { labelInvalidSig.Visible = true; } //} } } else { if (TPcur.Signature != "") { sigBox.Visible = true; sigBoxTopaz.Visible = false; sigBox.ClearTablet(); //sigBox.SetSigCompressionMode(0); //sigBox.SetEncryptionMode(0); sigBox.SetKeyString(TreatPlans.GetHashString(TPcur, proctpList)); //"0000000000000000"); //sigBox.SetAutoKeyData(ProcCur.Note+ProcCur.UserNum.ToString()); //sigBox.SetEncryptionMode(2);//high encryption //sigBox.SetSigCompressionMode(2);//high compression sigBox.SetSigString(TPcur.Signature); if (sigBox.NumberOfTabletPoints() == 0) { labelInvalidSig.Visible = true; } sigBox.SetTabletState(0); //not accepting input. To accept input, change the note, or clear the sig. } } }