コード例 #1
0
        private void FormWebMailMessageEdit_Load(object sender, EventArgs e)
        {
            _webMailMode = WebMailMode.View;
            if (_emailMessage == null)
            {
                _webMailMode = WebMailMode.Compose;
            }
            string error = "";

            if (_patCur == null)
            {
                error += "Cannot send Web Mail to an invalid patient. ";
            }
            else
            {
                _listPatsForPHI = Patients.GetPatientsForPhi(_patCur.PatNum);
                if (_listPatsForPHI.Count == 0)               //Every patient should have at least one guarantor.
                {
                    error += "Patient family not setup properly.  Make sure guarantor is valid. ";
                }
            }
            //Webmail notification email address.  One notification email per database (not clinic specific).
            _emailAddressSender = EmailAddresses.GetOne(PrefC.GetLong(PrefName.EmailNotifyAddressNum));
            if (_emailAddressSender == null ||
                _emailAddressSender.EmailAddressNum == 0 ||
                _emailAddressSender.EmailUsername == "")
            {
                //No valid "Notify" email setup for this practice yet.
                error += "Invalid Web Mail Notify email.  Configure a Web Mail Notify email address in E-mail Setup. ";
            }
            List <Userod> listUsers = Userods.GetUsersWithProviders();

            if (listUsers.Count < 1)
            {
                error += "Cannot send Web Mail until there is at least one User associated to a Provider. ";
            }
            if (error != "")
            {
                MsgBox.Show(this, error);
                DialogResult = DialogResult.Abort;
                return;
            }
            if (_emailMessage != null)
            {
                _patRegarding = Patients.GetLim(_emailMessage.PatNumSubj);
            }
            if (Security.CurUser != null)
            {
                _provUserCur = Providers.GetProv(Security.CurUser.ProvNum);
            }
            List <long> listProvNums = listUsers.Select(x => x.ProvNum).Distinct().ToList();

            _listProviders = Providers.GetProvsByProvNums(listProvNums);
            FillFields();
        }