private DataView GetPatientHPIKidneyView(DataTable dataSource) { string childTableColumnName = "ChildTableNames"; // validate column if (!dataSource.Columns.Contains(childTableColumnName)) { DataColumn childTableColumn = new DataColumn(childTableColumnName, typeof(string)); dataSource.Columns.Add(childTableColumn); } // fill child table columns foreach (DataRow row in dataSource.Rows) { string tableName = row["TableName"].ToString(); int priKey = (int)row["PrimaryKey"]; string tableKeyName = BusinessObject.GetPrimaryKeyName(tableName); // get child tables IEnumerable <string> childTables = BusinessObject.GetChildTableNames(tableName); // get child tables with records (i.e, query by ParentKey) IEnumerable <string> childTablesWithRecords = from child in childTables where BusinessObject.Count(child, new Dictionary <string, object> { { tableKeyName, priKey } }) > 0 select child; // create CSV string childTableNames = string.Join(",", childTablesWithRecords.ToArray()); // set child table names row[childTableColumnName] = childTableNames; } return(dataSource.DefaultView); }
protected void SetButtonState() { if (SchemaItemId == -1 || CreateFromTemplate) { CreateButton.Visible = true; SaveButton.Visible = false; DeleteButton.Visible = false; } else { CreateButton.Visible = false; SaveButton.Visible = true; int visitsAssigned = BusinessObject.Count <ItemTimeline>(new Dictionary <string, object> { { ItemTimeline.SchemaItemId, SchemaItemId } }); if (visitsAssigned == 0 && !HavePatientsBeenAssigned()) { DeleteButton.Visible = true; } } }
/// <summary> /// /// </summary> protected void SetBtnStates() { // show admin button for protocol admins if (base.UserType == ProtocolMgmtUsers.ProtocolAdmin) { BtnAdminOptions.Visible = true; BtnAdminOptions.HRef = GetQueryString("AdminProtocol.aspx"); } // set patient registration buttons: display bulk entry when no versions exists bool displayBulkEdit = BusinessObject.Count <ProtocolVersion>(new Dictionary <string, object> { { ProtocolVersion.ProtocolId, BaseProtocolId } }) == 0; BtnAssignPatient.Visible = !displayBulkEdit; BtnAccrualDetails.Visible = displayBulkEdit; }
public virtual async Task <IActionResult> Index(int page = 1, string filter = "", string sort = "", string order = "ASC") { var totalItems = await _businessObject.Count(filter); ViewBag.CurrentPage = page; ViewBag.CurrentFilter = filter; ViewBag.TotalItems = totalItems; ViewBag.HasMore = totalItems > (page * Constants.MAX_ITEMS_PER_PAGE); ViewBag.ItemsPerPage = Constants.MAX_ITEMS_PER_PAGE; ViewBag.Sort = sort; ViewBag.Order = order; if (_message.HasMessage) { ViewBag.Message = _message.Body; ViewBag.MessageType = _message.Type; _message.Clear(); } return(View(await _businessObject.Search(page, filter, sort, order))); }