Beispiel #1
0
        private void signatureBoxWrapper_SignTopazClicked(object sender, EventArgs e)
        {
            if (gridMain.SelectedCell.Y == -1)
            {
                return;
            }
            DateTime orthoDate = GetOrthoDate(gridMain.SelectedCell.Y);

            if (OrthoSignature.GetSigString(GetValueFromDict(orthoDate, _sigTableOrthoColIdx)) != "")
            {
                _hasChanged = true;
            }
            SetValueInDict("", orthoDate, _sigTableOrthoColIdx);
            string sigColumnName = _listOrthDisplayFields.FirstOrDefault(x => x.InternalName == "Signature").Description;

            _prevRow         = gridMain.SelectedCell.Y;
            _topazNeedsSaved = true;
        }
Beispiel #2
0
        private bool CanEditRow(DateTime orthoDate)
        {
            if (_dictCanEditDay.ContainsKey(orthoDate))
            {
                return(_dictCanEditDay[orthoDate]);
            }
            if (Security.IsAuthorized(Permissions.OrthoChartEditFull, orthoDate, true))
            {
                _dictCanEditDay[orthoDate] = true;
                return(true);
            }
            if (!Security.IsAuthorized(Permissions.OrthoChartEditUser, orthoDate, true))
            {
                _dictCanEditDay[orthoDate] = false;
                return(false);               //User doesn't have any permission.
            }
            //User has permission to edit the ones that they have signed or ones that no one has signed.
            if (!_showSigBox)
            {
                _dictCanEditDay[orthoDate] = true;
                return(true);
            }
            OrthoChart sigChart = _dictOrthoCharts[orthoDate].Find(x => x.FieldName == _listDisplayFieldNames[_sigTableOrthoColIdx]);

            if (sigChart == null || sigChart.UserNum == Security.CurUser.UserNum)
            {
                _dictCanEditDay[orthoDate] = true;
                return(true);
            }
            bool           canEditRow;
            OrthoSignature sig = new OrthoSignature(sigChart.FieldValue);

            canEditRow = string.IsNullOrEmpty(sig.SigString);          //User has partial permission and somebody else signed it.
            _dictCanEditDay[orthoDate] = canEditRow;
            return(canEditRow);
        }
Beispiel #3
0
        ///<summary>Saves the signature to the dictionary. The signature is hashed using the patient name, the date of service, and all ortho chart fields
        ///(even the ones not showing).</summary>
        private void SaveSignatureToDict(int gridRow)
        {
            if (!_showSigBox || gridRow < 0)
            {
                return;
            }
            DateTime orthoDate = GetOrthoDate(gridRow);

            if (!CanEditRow(orthoDate))
            {
                return;
            }
            if (!signatureBoxWrapper.GetSigChanged() || !signatureBoxWrapper.IsValid)
            {
                return;
            }
            string keyData;
            //Get the "translated" name for the signature column.
            string            sigColumnName = _listOrthDisplayFields.FirstOrDefault(x => x.InternalName == "Signature").Description;
            List <OrthoChart> listCharts    = _dictOrthoCharts[orthoDate].FindAll(x => x.DateService == orthoDate && x.FieldValue != "" && x.FieldName != sigColumnName);

            keyData = OrthoCharts.GetKeyDataForSignatureSaving(listCharts, orthoDate);
            OrthoSignature sig = new OrthoSignature();

            sig.IsTopaz   = signatureBoxWrapper.GetSigIsTopaz();
            sig.SigString = signatureBoxWrapper.GetSignature(keyData);
            if (sig.IsTopaz && !_topazNeedsSaved)
            {
                return;
            }
            if (OrthoSignature.GetSigString(GetValueFromDict(orthoDate, sigColumnName)) != sig.SigString)
            {
                _hasChanged = true;
                SetValueInDict(sig.ToString(), orthoDate, sigColumnName);
            }
        }
Beispiel #4
0
        ///<summary>Displays the signature that is saved in the dictionary in the signature box. Colors the grid row green if the signature is valid,
        ///red if invalid, or white if blank. Puts "Valid" or "Invalid" in the grid's signature column.</summary>
        private void DisplaySignature(int gridRow, bool hasRefresh = true)
        {
            if (!_showSigBox || gridRow < 0)
            {
                return;
            }
            DateTime          orthoDate       = GetOrthoDate(gridRow);
            List <OrthoChart> listOrthoCharts = _dictOrthoCharts[orthoDate];
            //Get the "translated" name for the signature column.
            string sigColumnName = _listOrthDisplayFields.FirstOrDefault(x => x.InternalName == "Signature").Description;

            if (!listOrthoCharts.Exists(x => x.FieldName == sigColumnName))
            {
                signatureBoxWrapper.ClearSignature();
                return;
            }
            OrthoSignature sig = new OrthoSignature(listOrthoCharts.Find(x => x.FieldName == sigColumnName).FieldValue);

            if (sig.SigString == "")
            {
                signatureBoxWrapper.ClearSignature();
                gridMain.Rows[gridRow].ColorBackG = SystemColors.Window;
                //Empty out the signature column displaying to the user.
                if (_sigColIdx > 0)                 //User might be vieweing a tab that does not have the signature column.  Greater than 0 because index 0 is a Date column.
                {
                    gridMain.Rows[gridRow].Cells[_sigColIdx].Text = "";
                }
                if (hasRefresh)
                {
                    gridMain.Refresh();
                }
                return;
            }
            string keyData = OrthoCharts.GetKeyDataForSignatureHash(_patCur, listOrthoCharts
                                                                    .FindAll(x => x.DateService == orthoDate && x.FieldValue != "" && x.FieldName != sigColumnName), orthoDate);

            signatureBoxWrapper.FillSignature(sig.IsTopaz, keyData, sig.SigString);
            if (!signatureBoxWrapper.IsValid)
            {
                //This ortho chart may have been signed when we were using the patient name in the hash. Try hashing the signature with the patient name.
                keyData = OrthoCharts.GetKeyDataForSignatureHash(_patCur, listOrthoCharts
                                                                 .FindAll(x => x.DateService == orthoDate && x.FieldValue != "" && x.FieldName != sigColumnName), orthoDate, doUsePatName: true);
                signatureBoxWrapper.FillSignature(sig.IsTopaz, keyData, sig.SigString);
            }
            if (signatureBoxWrapper.IsValid)
            {
                gridMain.Rows[gridRow].ColorBackG = Color.FromArgb(0, 245, 165); //A lighter version of Color.MediumSpringGreen
                if (_sigColIdx > 0)                                              //User might be vieweing a tab that does not have the signature column.  Greater than 0 because index 0 is a Date column.
                {
                    gridMain.Rows[gridRow].Cells[_sigColIdx].Text = Lan.g(this, "Valid");
                }
            }
            else
            {
                gridMain.Rows[gridRow].ColorBackG = Color.FromArgb(255, 140, 143); //A darker version of Color.LightPink
                if (_sigColIdx > 0)                                                //User might be vieweing a tab that does not have the signature column.  Greater than 0 because index 0 is a Date column.
                {
                    gridMain.Rows[gridRow].Cells[_sigColIdx].Text = Lan.g(this, "Invalid");
                }
            }
            if (hasRefresh)
            {
                gridMain.Refresh();
            }
        }