Beispiel #1
0
        /// <summary>
        /// If page is invoked from a POSTed AJAX request (methodName), build output list
        /// </summary>
        /// <returns></returns>
        private bool ProcessAjaxRequest()
        {
            string method         = Request.Form["methodName"];
            string destTableName  = Request.Form["destTableName"];
            string destPrimaryKey = Request.Form["destTablePrimaryKey"];

            switch (method)
            {
            case ("GetRelatedRecords"):
                if (!string.IsNullOrEmpty(destTableName) && !string.IsNullOrEmpty(destPrimaryKey))
                {
                    SessionHandler sh              = new SessionHandler(Session);
                    int            patientId       = sh.GetPatientId();
                    int            destTablePriKey = int.Parse(destPrimaryKey);
                    DataView       relatedRecords  = rc.GetRelatedRecordsByTableAndKey(patientId, destTableName, destTablePriKey);
                    relatedRecords.Sort = "SrcTableSortField ASC";

                    RelatedRecordsRptr.DataSource = relatedRecords;
                    RelatedRecordsRptr.DataBind();
                    return(true);
                }
                break;

            default:
                break;
            }
            return(false);
        }
Beispiel #2
0
    /// <summary>
    /// For the given table, show a list of related records as well as available tables to relate
    /// </summary>
    /// <param name="tableName"></param>
    /// <param name="primaryKeyValue"></param>
    /// <param name="parentKeyValue"></param>
    /// <param name="isParentRecordLocked"></param>
    protected void ShowRelatedRecords(string tableName, int primaryKeyValue, int parentKeyValue, bool isParentRecordLocked)
    {
        if (primaryKeyValue > 0)
        {
            // set url
            RelatedRecordsFrame.Attributes["src"] = "RelatedRecords.aspx?destTableName=" + tableName + "&destTablePrimaryKey=" + primaryKeyValue;
            // build existing related records
            DataView relatedRecords = RelatedRecordController.GetRelatedRecords(tableName, primaryKeyValue).AsDataView <RelatedRecord>();

            RelatedRecordsRptr.DataSource = relatedRecords;
            RelatedRecordsRptr.DataBind();

            // show related records container
            RelatedRecordsContainer.Visible = true;
            RelatedRecordsPopup.Visible     = true;
        }
        else
        {
            RelatedRecordsContainer.Visible = false;
            RelatedRecordsPopup.Visible     = false;
        }
    }