コード例 #1
0
ファイル: PatientVisit.aspx.cs プロジェクト: aomiit/caisis
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void UpdateStatusClick(object sender, EventArgs e)
        {
            foreach (int dirtyRow in dirtyVisits)
            {
                GridViewRow   row               = PatientVisitsGrid.Rows[dirtyRow];
                CaisisHidden  pItemStatus       = row.FindControl(PatientItem.Status) as CaisisHidden;
                CaisisTextBox pItemSDate        = row.FindControl(PatientItem.ScheduledDate) as CaisisTextBox;
                CaisisHidden  deviationId       = row.FindControl(PatientDeviation.PatientDeviationId) as CaisisHidden;
                int           patientItemId     = int.Parse(PatientVisitsGrid.DataKeys[dirtyRow][PatientItem.PatientItemId].ToString());
                string        patientItemStatus = pItemStatus.Value;
                string        scheduledDate     = pItemSDate.Value;

                PatientItem biz = new PatientItem();
                biz.Get(patientItemId);
                biz[PatientItem.Status]        = patientItemStatus;
                biz[PatientItem.ScheduledDate] = scheduledDate;
                // needs deviation ???


                if (patientItemStatus == "Missed")
                {
                    // do not create deviation

                    /*
                     * PatientDeviation deviation = new PatientDeviation();
                     * if (!string.IsNullOrEmpty(deviationId.Value))
                     * {
                     *  deviation.Get(int.Parse(deviationId.Value));
                     * }
                     * // otherwise set required foreign key
                     * else
                     * {
                     *  deviation[PatientDeviation.PatientItemId] = patientItemId.ToString();
                     * }
                     * deviation[PatientDeviation.DeviationType] = "Missed Visit";
                     * deviation.Save();
                     *
                     * // update hidden deviation field
                     * deviationId.Value = deviation[PatientDeviation.PatientDeviationId].ToString();
                     */
                }
                // if status isn't missed, remove deviation if exists
                else if (!string.IsNullOrEmpty(deviationId.Value))
                {
                    PatientDeviation deviation = new PatientDeviation();
                    deviation.Delete(int.Parse(deviationId.Value));
                    deviationId.Value = string.Empty;
                }
                biz.Save();

                // trigger scheduling for dependent items
                PatientProtocolController.ScheduleDependentItemsByItemStatus(patientItemId, patientItemStatus);
            }
            dirtyVisits.Clear();

            SetVisit(sender, e);

            RegisterReloadPatientLists();
        }
コード例 #2
0
        /// <summary>
        /// Updates the PatientItem record including status and status date.
        /// Also triggers scheduling of dependent events on this item.
        /// </summary>
        private void UpdatePatientItem()
        {
            if (!string.IsNullOrEmpty(PatientItemId))
            {
                // Load Item record and update fields
                int         priKey = int.Parse(PatientItemId);
                PatientItem biz    = new PatientItem();
                biz.Get(priKey);
                biz[PatientItem.Status] = StatusField.Value;
                // ScheduledDate is read only, so values aren't persisted by rumtime, but in Form
                biz[PatientItem.ScheduledDate] = Request.Form[ScheduledDate.UniqueID];
                biz.Save();

                // trigger scheduling for dependent items
                PatientProtocolController.ScheduleDependentItemsByItemStatus(priKey, StatusField.Value);
            }
        }