Пример #1
0
        ///<summary>Called from Pin_Click and OK_Click.</summary>
        private void SaveRecall()
        {
            int newStatus;

            if (comboStatus.SelectedIndex == 0)
            {
                newStatus = 0;
            }
            else
            {
                newStatus = DefB.Short[(int)DefCat.RecallUnschedStatus][comboStatus.SelectedIndex - 1].DefNum;
            }
            if (newStatus != RecallCur.RecallStatus ||      //if the status has changed
                (RecallCur.Note == "" && textNote.Text != ""))               //or a note was added
            {
                //make a commlog entry
                //unless there is an existing recall commlog entry for today
                bool      recallEntryToday = false;
                Commlog[] CommlogList      = Commlogs.Refresh(PatCur.PatNum);
                for (int i = 0; i < CommlogList.Length; i++)
                {
                    if (CommlogList[i].CommDateTime.Date == DateTime.Today &&
                        CommlogList[i].CommType == CommItemType.Recall)
                    {
                        recallEntryToday = true;
                    }
                }
                if (!recallEntryToday)
                {
                    Commlog CommlogCur = new Commlog();
                    CommlogCur.CommDateTime = DateTime.Now;
                    CommlogCur.CommType     = CommItemType.Recall;
                    CommlogCur.PatNum       = PatCur.PatNum;
                    if (newStatus != RecallCur.RecallStatus)
                    {
                        //Commlogs.Cur.Note+=Lan.g(this,"Status changed to")+" ";
                        if (newStatus == 0)
                        {
                            CommlogCur.Note += Lan.g(this, "Status None");
                        }
                        else
                        {
                            CommlogCur.Note += DefB.GetName(DefCat.RecallUnschedStatus, newStatus);
                        }
                        if (RecallCur.Note == "" && textNote.Text != "")
                        {
                            CommlogCur.Note += ", ";
                        }
                    }
                    if (RecallCur.Note == "" && textNote.Text != "")
                    {
                        CommlogCur.Note += textNote.Text;
                    }
                    CommlogCur.Note += ".  ";
                    FormCommItem FormCI = new FormCommItem(CommlogCur);
                    FormCI.IsNew = true;
                    //forces user to at least consider a commlog entry
                    FormCI.ShowDialog();                    //typically saved in this window.
                }
            }
            RecallCur.RecallStatus = newStatus;
            RecallCur.Note         = textNote.Text;
            Recalls.Update(RecallCur);
            Patient PatOld = PatCur.Copy();

            PatCur.WkPhone            = textWkPhone.Text;
            PatCur.WirelessPhone      = textWirelessPhone.Text;
            PatCur.Email              = textEmail.Text;
            PatCur.PreferRecallMethod = (ContactMethod)comboRecallMethod.SelectedIndex;
            Patients.Update(PatCur, PatOld);
            Patients.UpdatePhoneAndNoteIfNeeded(textHmPhone.Text, textAddrNotes.Text, PatCur.PatNum);
        }