示例#1
0
    public bool PatientContactSave(int patientId, string employee, string whatHappened, string notes, bool isDND, bool isIneligible, bool isCallback, bool isApptMade, DateTime? callBackDateTime, DateTime? apptDateTime)
    {
        try
        {

            chsi.dat.CHSIEntities db = new chsi.dat.CHSIEntities();

            string details = "";

            chsi.dat.payNewPatientContacts c = new chsi.dat.payNewPatientContacts();
            c.payNewPatientId = patientId;
            c.ContactDate = DateTime.Now;
            c.EmployeeName = employee;

            switch (whatHappened.ToLower().Trim())
            {
                case "phonenoanswer": c.isPhoneNoAnswer = true; break;
                case "phoneanswer": c.isPhoneAnswered = true; break;
                case "phoneleftmessage": c.isPhoneLeftMessage = true; break;
                case "phonebusy": c.isPhoneBusy = true; break;
                case "phonewrongnumber": c.isPhoneWrongNumber = true; break;
                case "phonedisconnected": c.isPhoneDisconnected = true; break;
                case "postcardsent": c.isPostCardSent = true; break;

            }

            c.isDoNotDisturbRequested = isDND;
            c.isIneligible = isIneligible;
            c.isRequestCallBack = isCallback;
            c.isApptMade = isApptMade;

            if (isCallback)
            {
                c.CallBack = callBackDateTime;
                DateTime dt = (DateTime)callBackDateTime;
                details = string.Format("Callback requested for {0} {1}{2}", dt.ToShortDateString(), (dt.Hour > 0 ? dt.ToShortTimeString() : ""), Environment.NewLine);

            }

            if (isApptMade)
            {
                c.Appt = apptDateTime;
                DateTime dt = (DateTime)apptDateTime;
                details = string.Format("Appointment made for {0} {1}{2}", dt.ToShortDateString(), (dt.Hour > 0 ? dt.ToShortTimeString() : ""), Environment.NewLine);
            }

            if (isDND)
            {
                details += "Patient requests Do Not Disturb" + Environment.NewLine;
            }

            if (isIneligible)
            {
                details += "Patient is inelibible" + Environment.NewLine;
            }

            details += notes;
            c.Details = details;

            db.AddTopayNewPatientContacts(c);
            db.SaveChanges();

            return true;
        }
        catch (Exception e)
        {

        }

        return false;
    }