Exemplo n.º 1
0
    /// <summary>
    /// US:912
    /// Abstract save control method
    /// </summary>
    /// <returns></returns>
    public override CStatus SaveControl()
    {
        //update the checklist item states...
        CPatChecklistItemDataItem diCLItem = null;
        CPatChecklistItemData     cid      = new CPatChecklistItemData(BaseMstr.BaseData);
        CStatus status = cid.GetPatCLItemDI(PatientChecklistID, ItemID, out diCLItem);

        if (!status.Status)
        {
            return(status);
        }

        //per customer we only override decision state
        if (diCLItem.DSID != Convert.ToInt64(ddlDS.SelectedValue))
        {
            diCLItem.IsOverridden = k_TRUE_FALSE_ID.True;
            diCLItem.OverrideDate = DateTime.Now;
        }

        diCLItem.DSID = CDropDownList.GetSelectedLongID(ddlDS);

        //update
        status = cid.UpdatePatChecklistItem(diCLItem);
        if (!status.Status)
        {
            return(status);
        }

        //keep a history of the ds override with comment
        if (diCLItem.IsOverridden == k_TRUE_FALSE_ID.True)
        {
            cid.OverridePatChecklistItem(diCLItem, txtComment.Text);
        }

        //TODO: this is obsolete, will delete after testing
        //we now keep a history of ds overrides with comment
        //using OverridePatChecklistItem above
        //
        //if (!string.IsNullOrEmpty(txtComment.Text))
        //{
        //CPatChecklistItemData item = new CPatChecklistItemData(BaseMstr.BaseData);
        //status = item.InsertPatientItemComment(
        //    PatientChecklistID,
        //     ChecklistID,
        //     ItemID,
        //     txtComment.Text);
        // if (!status.Status)
        // {
        //     return status;
        // }
        // }

        return(new CStatus());
    }
    /// <summary>
    ///US:1883 Abstract save control method
    /// </summary>
    /// <returns></returns>
    public override CStatus SaveControl()
    {
        CPatientItemData itemData   = new CPatientItemData(BaseMstr.BaseData);
        CStatus          status     = new CStatus();
        long             lPatItemID = -1;

        if (ddlItems.SelectedItem.Text == "[New Result]")
        {
            //load an item for insert
            CPatientItemDataItem di = new CPatientItemDataItem();
            di.PatientID    = PatientID;
            di.ItemID       = ItemID;
            di.SourceTypeID = (long)k_SOURCE_TYPE_ID.VAPPCT;

            //get the date time, which is a combination of the 2 controls
            di.EntryDate = CDataUtils.GetDate(txtEntryDate.Text, ucTimePicker.HH, ucTimePicker.MM, ucTimePicker.SS);

            // build a list of all the item components in the grid view
            CPatientItemCompList PatItemCompList = null;
            status = BuildPatItemCompList(out PatItemCompList);
            if (!status.Status)
            {
                return(status);
            }

            // insert the patient item and all of its item components
            status = itemData.InsertPatientItem(di, PatItemCompList, out lPatItemID);
            if (!status.Status)
            {
                return(status);
            }
        }
        else
        {
            lPatItemID = CDropDownList.GetSelectedLongID(ddlItems);
        }

        // update the comments if there is a new one
        if (!string.IsNullOrEmpty(txtComment.Text))
        {
            status = itemData.InsertPatientItemComment(lPatItemID, ItemID, txtComment.Text);
            if (!status.Status)
            {
                return(status);
            }
        }

        //show status
        return(new CStatus());
    }