private void PopulateSurveyTypeList(int timelineid)
        {
            var surveyTypes = ProtocolMgmtDa.GetSurveyTypesByTimelineId(timelineid);

            /*
             * SurveyTypeList.DataSource = surveyTypes;
             * SurveyTypeList.DataBind();
             *
             * PreRender += new EventHandler(
             *  (o, e) =>
             *  {
             *      foreach (ListItem i in SurveyTypeList.Items)
             *      {
             *          i.Selected = true;
             *      }
             *  });
             */

            // encode values
            var selectedSurveys = GetSelectedSurveyTypes();
            var dataSource      = from survey in surveyTypes
                                  select new
            {
                SurveyType = Server.HtmlEncode(survey),
                Selected   = selectedSurveys.Contains(survey)
            };
            var encodedSurveyTypes = dataSource;

            SurveyTypeListRptr.DataSource = encodedSurveyTypes;
            SurveyTypeListRptr.DataBind();
        }
Exemple #2
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        private DataView GetTreatmentArms()
        {
            int       versionId       = int.Parse(QuereyVersionId);
            DataTable dtTreatmentArms = ProtocolMgmtDa.GetSchemasByProtocolVersion(versionId);

            return(dtTreatmentArms.DefaultView);
        }
Exemple #3
0
        /// <summary>
        /// Init data sources
        /// </summary>
        private void BuildLists()
        {
            int protocolId = int.Parse(BaseProtocolId);

            allVersions    = BusinessObject.GetByParentAsDataView <ProtocolVersion>(protocolId);
            allVersionArms = ProtocolMgmtDa.GetSchemasByProtocol(protocolId).DefaultView;
        }
        private void BuildBulkEdit()
        {
            string   datasetSQL = CacheManager.GetDatasetSQL(Session[SessionKey.DatasetId]);
            DataView ppSummary  = ProtocolMgmtDa.GetProtocolPatientSummary(protocolId, datasetSQL).DefaultView;

            if (ReadOnly)
            {
                PatientPortalHeaderBar.Visible = false;
                BulkPatientReadOnly.Visible    = true;
                InstitutionHeader.Visible      = true;
                StudyIdHeader.Visible          = true;
                BulkPatientEdit.Visible        = false;
                AddBtn.Visible                   = false;
                UpdateBtn.Visible                = false;
                BulkPatientEdit.BlankRows        = 0;
                BulkPatientEdit.VisibleBlankRows = 0;
                BulkPatientReadOnly.DataSource   = ppSummary;
                BulkPatientReadOnly.DataBind();
            }
            else
            {
                PatientPortalHeaderBar.Visible = true;
                BulkPatientReadOnly.Visible    = false;
                InstitutionHeader.Visible      = false;
                StudyIdHeader.Visible          = false;
                BulkPatientEdit.Visible        = true;
                AddBtn.Visible                   = true;
                UpdateBtn.Visible                = true;
                BulkPatientEdit.BlankRows        = 10;
                BulkPatientEdit.VisibleBlankRows = 5;
                BulkPatientEdit.DataSource       = ppSummary;
                BulkPatientEdit.DataBind();
            }
        }
Exemple #5
0
        private void BuildStats(int protocolId)
        {
            var      protocolStats      = ProtocolMgmtDa.GetProtocolAccrual(protocolId);
            DataView statsByYear        = protocolStats.Tables[0].DefaultView;
            DataView statsByInstitution = protocolStats.Tables[1].DefaultView;

            ProjectAccrualByYearGrid.RowDataBound += (o, ee) =>
            {
                if (ee.Row.RowType == DataControlRowType.Footer)
                {
                    IEnumerable <int> indexes = Enumerable.Range(2, 1);
                    var sums = ColumnsToSum(statsByYear, indexes);
                    SetFooterSums(ee.Row, sums, statsByYear.Count);
                }
            };
            ProjectAccrualByYearGrid.DataSource = statsByYear;
            ProjectAccrualByYearGrid.DataBind();

            ProjectAccrualByInstitutionGrid.RowDataBound += (o, ee) =>
            {
                if (ee.Row.RowType == DataControlRowType.Footer)
                {
                    IEnumerable <int> indexes = Enumerable.Range(3, statsByInstitution.Table.Columns.Count - 3);
                    var sums = ColumnsToSum(statsByInstitution, indexes);
                    SetFooterSums(ee.Row, sums, statsByInstitution.Count);
                }
            };
            ProjectAccrualByInstitutionGrid.DataSource = statsByInstitution;
            ProjectAccrualByInstitutionGrid.DataBind();

            bool hasStatus = statsByYear.Count > 0 || statsByInstitution.Count > 0;

            ErrorText.Visible    = !hasStatus;
            DetailsPanel.Visible = hasStatus;
        }
Exemple #6
0
        private DataView LoadProtocols()
        {
            DataView protocolsList = new DataView();

            // If filtering by user, determine which project a user belongs

            /*if (FilterByUser)
             * {
             *  string uName = new Caisis.Security.SecurityController().GetUserName();
             *  UserDa uda = new UserDa();
             *  int uId = uda.GetUserId(uName);
             *  projectsList = ProtocolMgmtDa.GetAllProtocolsByUserId(uId).DefaultView;
             * }
             * // Else, user has access to all projects
             * else*/
            {
                // load first page of records
                protocolsList = ProtocolMgmtDa.GetAllProtocols(FIRST_PAGE_INDEX, GetLastRecordIndexByPage(FIRST_PAGE_INDEX), Protocol.ProtocolNum, "ASC", UserId).DefaultView;
            }

            TrimColumn(protocolsList.Table, Protocol.ProtocolTitle);

            // Force default sort to earliest records first
            //protocolsList.Sort = SortString;

            return(protocolsList);
        }
Exemple #7
0
        /// <summary>
        /// Returns a filtered list of patient items by visit (TimelineId)
        /// </summary>
        /// <param name="timelineId">The visit TimelineId</param>
        /// <returns></returns>
        private DataView GetFilteredVisitList(int timelineId)
        {
            int       patientSchemaId = int.Parse(PatientSchemaId);
            DataTable visitItems      = ProtocolMgmtDa.GetPatientVisitSchedulingSummary(patientSchemaId, timelineId);

            return(visitItems.DefaultView);
        }
Exemple #8
0
        protected void PopulateChildTable(string tableName, string schemaItemId, bool bParentTable)
        {
            if (String.IsNullOrEmpty(tableName))
            {
                return;
            }

            int nSchemaItemId = -1;

            if (Int32.TryParse(schemaItemId, out nSchemaItemId))
            {
                DataTable dtChildRows = ProtocolMgmtDa.GetChildRowsBySchemaItemId(nSchemaItemId, tableName, bParentTable);

                for (int i = 0; i < BLANK_ROWS; i++)
                {
                    DataRow dr = dtChildRows.NewRow();
                    if (i == 0 &&
                        dtChildRows.Rows.Count == 0)
                    {
                        dr["FieldRowIndex"] = 0;
                    }
                    dtChildRows.Rows.Add(dr);
                }
                ChildTableGridView.DataSource = dtChildRows;
                ChildTableGridView.DataBind();
            }
        }
Exemple #9
0
        /// <summary>
        /// Builds treatment arm filter
        /// </summary>
        protected void BuildTreatmentArmFilter()
        {
            // get list of treatment arms
            DataTable dtSchemas = ProtocolMgmtDa.GetSchemasByProtocol(int.Parse(BaseProtocolId));
            DataRow   dr        = dtSchemas.NewRow();

            // insert "All" selection as first item
            dr[ProtocolSchema.ProtocolArmDescription] = "All Patients";
            dr[ProtocolSchema.ProtocolSchemaId]       = -1;
            dtSchemas.Rows.InsertAt(dr, 0);

            // no need to build filter
            // hide the treatment arm selector if there is only one arm, i.e., 0 or 1 items, plus 'All'
            if (dtSchemas.Rows.Count <= 2)
            {
                TreatmentArmSection.Visible = false;
            }
            else
            {
                TreatmentArmSection.Visible = true;
                // build arm filter
                TreatmentArms.DataSource = dtSchemas;
                TreatmentArms.DataBind();
            }
        }
        private DataTable GetReport()
        {
            string    datasetSQL = base.GetSpecimenPatientsDatasetSQL();
            DataTable results    = ProtocolMgmtDa.GetProtocolSpecimenReport(datasetSQL);

            return(results);
        }
        /// <summary>
        /// Update Patient's Study Id and/or warn if already exits.
        /// </summary>
        /// <param name="e"></param>
        protected void UpdateStudyId(CaisisAjaxEventArgs e)
        {
            string newStudyId = e.ClientParam;

            if (PatientPage != null && !string.IsNullOrEmpty(newStudyId) && !string.IsNullOrEmpty(PatientPage.PatientProtocolId))
            {
                // ok to update when study id doesn't exits
                if (!ProtocolMgmtDa.StudyIdExists(newStudyId, int.Parse(PatientPage.BaseProtocolId)))
                {
                    int             ptProtocolId = int.Parse(PatientPage.PatientProtocolId);
                    PatientProtocol biz          = new PatientProtocol();
                    biz.Get(ptProtocolId);
                    biz[PatientProtocol.PtProtocolStudyId] = newStudyId;
                    biz.Save();

                    // CREATE STUDY ID IDENTIFIER
                    PatientProtocolController.CreateStudyIdIdentifier(biz);

                    // echo back value to client
                    e.ReturnValue = newStudyId;
                }
                // otherwise exists, and warn
                else
                {
                    // echo back to client study id exits
                    e.ReturnValue = "The StudyId entered already exits in the system.";
                }
            }
            else
            {
                // echo to client there were issues
                e.ReturnValue = "Please Enter a valid StudyId.";
            }
        }
        private void BuildContacts(int organizationId)
        {
            // build contacts
            ContactsDa da = new ContactsDa();
            var        contactAndUsers = da.GetAllContactsAndUser(organizationId).DefaultView;

            contactAndUsers.RowFilter = "OrganizationContactId IS NOT NULL";
            ContactsRptr.DataSource   = contactAndUsers;
            ContactsRptr.DataBind();

            NoContacsMessage.Visible = contactAndUsers.Count == 0;

            // build projects
            ProjectManagementDa projectDa = new ProjectManagementDa();
            DataView            projects  = projectDa.GetAllProjectsForOrg(organizationId).DefaultView;

            projects.Sort           = Project.Title + " ASC";
            ProjectsRptr.DataSource = projects;
            ProjectsRptr.DataBind();

            NoProjectsMessage.Visible = projects.Count == 0;

            // build protocols
            DataView protocols = ProtocolMgmtDa.GetProtocolsByOrganization(organizationId).DefaultView;

            protocols.Sort          = Protocol.ProtocolNum + " ASC";
            ProtocolRptr.DataSource = protocols;
            ProtocolRptr.DataBind();

            NoProtocolsMessage.Visible = protocols.Count == 0;
        }
Exemple #13
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="metaSurveyId"></param>
        protected void BuildEligibilityQuestionnaire(int metaSurveyId)
        {
            QuestionsGrid.Visible  = true;
            MetadataSurveyId.Value = metaSurveyId.ToString();

            MetadataSurvey biz = new MetadataSurvey();

            biz.Get(metaSurveyId);
            SurveyType.Value = biz[MetadataSurvey.SurveyType].ToString();

            //MetadataSurveyQuestion questionsBiz = new MetadataSurveyQuestion();
            //questionsBiz.GetByParent(metaSurveyId);
            //QuestionsGrid.DataSource = questionsBiz.DataSourceView;
            QuestionsGrid.DataSource = BusinessObject.GetByParentAsDataView <MetadataSurveyQuestion>(metaSurveyId);
            QuestionsGrid.DataBind();

            DataEntryPanel.Visible = true;

            // Detmerine if assoication exits
            DataTable versionsToSurvey = ProtocolMgmtDa.GetProtocolVersionsBySurvey(metaSurveyId);
            // can edit survey when 0 associations or 1 association exists
            bool isGridEditable = !(versionsToSurvey.Rows.Count > 1);

            // Grid is disabled, as well as text fields and buttons for data entry
            QuestionsGrid.Enabled   = isGridEditable;
            SurveyType.Enabled      = isGridEditable;
            SaveBtn.Visible         = isGridEditable;
            AddRowBtn.Visible       = isGridEditable;
            ReadOnlyMessage.Visible = !isGridEditable;
        }
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        private DataView GetFilteredNavigation()
        {
            DataTable visitItems = null;

            if (!string.IsNullOrEmpty(PatientSchemaId))
            {
                int patientSchemaId = int.Parse(PatientSchemaId);
                int?timelineId      = null;
                // restrict to timeline
                if (!string.IsNullOrEmpty(QueryPatientItem))
                {
                    string decrypteItemId      = DecrypyValue(QueryPatientItem);
                    int    parsedPatientItemId = int.Parse(decrypteItemId);
                    timelineId = ProtocolMgmtDa.GetPatientTimelineId(parsedPatientItemId);
                }
                // get visit items, restricted by optional timeline
                visitItems = ProtocolMgmtDa.GetPatientVisitSchedulingSummary(patientSchemaId, timelineId);
            }
            else
            {
                visitItems = new DataTable();
            }


            return(visitItems.DefaultView);
        }
        protected void PopulateValues(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                // Show only records where DestTable equals to the parent table
                string strParentTable       = DataBinder.Eval(e.Item.DataItem, "DestTable").ToString();
                string strCurrentSchemaItem = DataBinder.Eval(e.Item.DataItem, "SchemaItemId").ToString();

                var schemaItemFielsdMetadata = from row in dtPresetValues.AsEnumerable()
                                               where row["SchemaItemId"].ToString() == strCurrentSchemaItem && row["DestTable"].ToString() == strParentTable
                                               let field = new
                {
                    FieldName  = row["DestField"].ToString(),
                    FieldLabel = row["FieldLabel"].ToString(),
                    DestValue  = row["DestValue"].ToString(),
                    FieldOrder = row.IsNull("FieldOrder") ? int.MaxValue : (int)row["FieldOrder"]
                }
                orderby field.FieldOrder ascending
                select field;
                // a list of pre selected fields and values
                var presetSchemaItemFields = schemaItemFielsdMetadata.Where(f => f.DestValue != "[enter]");
                // a list of field and values collected at visit
                var collectSchemaItemFields = schemaItemFielsdMetadata.Except(presetSchemaItemFields);

                Repeater presetListRptr = e.Item.FindControl("PresetListRptr") as Repeater;
                if (presetListRptr != null)
                {
                    presetListRptr.DataSource = presetSchemaItemFields;
                    presetListRptr.DataBind();
                }

                Repeater collectListRptr = e.Item.FindControl("CollectVisitRepeater") as Repeater;
                if (collectListRptr != null)
                {
                    collectListRptr.DataSource = collectSchemaItemFields;
                    collectListRptr.DataBind();
                }

                Label lblChildTables = e.Item.FindControl("ChildTablesList") as Label;

                if (lblChildTables != null)
                {
                    DataTable dtAllTables     = ProtocolMgmtDa.GetUniqueTableNamesBySchema(int.Parse(strCurrentSchemaItem));
                    var       childTableNames = dtAllTables.AsEnumerable().Select(r => r["DestTable"].ToString()).Where(t => t != strParentTable);
                    // if there are child tables
                    if (childTableNames.Count() > 0)
                    {
                        lblChildTables.Text = string.Join(", ", childTableNames.ToArray());
                    }
                    // otherwise "None"
                    else
                    {
                        lblChildTables.Text = "None";
                    }
                }
            }
        }
        private void BuildSubjects()
        {
            int protocolId = int.Parse(BaseProtocolId);
            string datasetSQL = CacheManager.GetDatasetSQL(Session[SessionKey.DatasetId]) + "";
            DataTable patients = ProtocolMgmtDa.GetPatientsByProtocol(protocolId, datasetSQL, base.ShowPatientIdentifiers(), true);

            SubjectSelection.DataSource = patients;
            SubjectSelection.DataBind();
        }
Exemple #17
0
        private void BuildPatientSchedule(int patientId)
        {
            string    datasetSQL      = CacheManager.GetDatasetSQL(Session[SessionKey.DatasetId]);
            string    visitDatasetSQL = base.GetPatientVisitsDataset();
            int       protocolId      = int.Parse(BaseProtocolId);
            DataTable patientTimeline = ProtocolMgmtDa.GetPatientTimelineVisits(protocolId, patientId, datasetSQL, visitDatasetSQL, true, true);

            PatientVisits.DataSource = patientTimeline;
            PatientVisits.DataBind();
        }
Exemple #18
0
        /// <summary>
        /// Populates visit dropdown
        /// </summary>
        private void PopulateVisitList()
        {
            int       protocolId      = int.Parse(BaseProtocolId);
            int       patientId       = int.Parse(BaseDecryptedPatientId);
            string    datasetSQL      = CacheManager.GetDatasetSQL(Session[SessionKey.DatasetId]);
            string    visitDatasetSQL = base.GetPatientVisitsDataset();
            DataTable visits          = ProtocolMgmtDa.GetPatientTimelineVisits(protocolId, patientId, datasetSQL, visitDatasetSQL, false, false);

            VisitsDropDown.DataSource = visits;
            VisitsDropDown.DataBind();
        }
        private void GetTemplates()
        {
            TemplatesRptr.DataSource = ProtocolMgmtDa.GetAllTemplates();
            TemplatesRptr.DataBind();

            int       schemaId = int.Parse(BaseSchemaId);
            DataTable dt       = ProtocolMgmtDa.GetDistinctSchemaItems(schemaId);

            SchemaItemsRptr.DataSource = dt;
            SchemaItemsRptr.DataBind();
        }
        private void BuildSchemaItemsListing(int schemaId)
        {
            dtPresetValues = ProtocolMgmtDa.GetAllSchemaPresetValues(schemaId);

            DataTable dt = GetParentSchemaItems(schemaId);

            SchemaItemsListRptr.DataSource = dt;
            SchemaItemsListRptr.DataBind();

            // reset
            dirtySchemaItems.Clear();
        }
Exemple #21
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void ShiftPatientSchedule(object sender, EventArgs e)
        {
            SecurityController ct       = new SecurityController();
            string             userName = ct.GetUserName();
            int      ptSchemaId         = int.Parse(PatientSchemaId);
            int      shiftNumDays       = Int32.Parse(ShiftNumOfDays.Value);
            DateTime shiftDate          = DateTime.Parse(ShiftDate.Value);

            // shift schedule with user provided values
            ProtocolMgmtDa.SaveShiftData(ptSchemaId, shiftDate, shiftNumDays, userName, DateTime.Now);
            // reload page to reflect new schedule
            Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "ReloadPage", "reloadPage();", true);
        }
        /// <summary>
        /// Gets all Child Tables which belong to a ProtocolSchema
        /// </summary>
        /// <param name="protocolSchemaId"></param>
        /// <returns></returns>
        private List <string> GetSchemaChildTableNames()
        {
            DataTable dtChildTables = ProtocolMgmtDa.GetChildTablesBySchema(SchemaItemId);

            List <string> childList = new List <string>();

            foreach (DataRow dr in dtChildTables.Rows)
            {
                childList.Add(dr[SchemaItemField.DestTable].ToString());
            }

            return(childList);
        }
Exemple #23
0
        protected bool HasTimelineBeenCreated(string schemaItemId)
        {
            int nSchemaitemId;

            bool TimelineCreated = true;

            if (Int32.TryParse(schemaItemId, out nSchemaitemId))
            {
                TimelineCreated = ProtocolMgmtDa.HasTimelineBeenCreated(nSchemaitemId);
            }

            return(TimelineCreated);
        }
Exemple #24
0
        protected bool HavePatientsBeenAssigned(string schemaItemId)
        {
            int nSchemaitemId;

            bool PatientsAssigned = true;

            if (Int32.TryParse(schemaItemId, out nSchemaitemId))
            {
                PatientsAssigned = ProtocolMgmtDa.HavePatientsBeenAssignedToSchema(nSchemaitemId);
            }

            return(PatientsAssigned);
        }
        /// <summary>
        /// Initalizes public properties used for getting Patient specific ids
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void InitalizeParams(object sender, EventArgs e)
        {
            // Patient Protocol and StudyId
            string queryPatientProtocolId = GetURLValue(QUERY_PATIENT_PROTOCOL_ID_KEY);

            if (!string.IsNullOrEmpty(queryPatientProtocolId))
            {
                PatientProtocol biz = new PatientProtocol();
                biz.Get(int.Parse(queryPatientProtocolId));
                patientProtocolId = biz[PatientProtocol.PatientProtocolId].ToString();
                patientStudyId    = biz[PatientProtocol.PtProtocolStudyId].ToString();
            }
            else if (!string.IsNullOrEmpty(BaseProtocolId) && !string.IsNullOrEmpty(BaseDecryptedPatientId))
            {
                PatientProtocolDa da = new PatientProtocolDa();
                DataTable         patientProtocolRecords = da.GetPatientProtocol(int.Parse(BaseDecryptedPatientId), int.Parse(BaseProtocolId));
                if (patientProtocolRecords.Rows.Count > 0)
                {
                    patientProtocolId = patientProtocolRecords.Rows[0][PatientProtocol.PatientProtocolId].ToString();
                    patientStudyId    = patientProtocolRecords.Rows[0][PatientProtocol.PtProtocolStudyId].ToString();
                }
                else
                {
                    patientProtocolId = string.Empty;
                    patientStudyId    = string.Empty;
                }
            }
            else
            {
                patientProtocolId = string.Empty;
                patientStudyId    = string.Empty;
            }

            // Patient Schema
            if (!string.IsNullOrEmpty(BaseSchemaId) && !string.IsNullOrEmpty(BaseDecryptedPatientId))
            {
                DataTable dt = ProtocolMgmtDa.GetPatientProtocolSchema(int.Parse(BaseSchemaId), int.Parse(BaseDecryptedPatientId));
                if (dt.Rows.Count > 0)
                {
                    patientSchemaId = dt.Rows[0][PatientSchema.PatientSchemaId].ToString();
                }
                else
                {
                    patientSchemaId = string.Empty;
                }
            }
            else
            {
                patientSchemaId = string.Empty;
            }
        }
Exemple #26
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void DeleteTreatment(object sender, CommandEventArgs e)
        {
            int schemaId = int.Parse(e.CommandArgument.ToString());

            //ProtocolSchema biz = new ProtocolSchema();
            //biz.Delete(schemaId);
            ProtocolMgmtDa.DeleteTreatmentArm(schemaId);
            PopulateTreatmentArms();
            // refresh when no arms available
            if (noTreatmentArmsMsg.Visible)
            {
                Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "refreshParent", "window.parent.location = window.parent.location", true);
            }
        }
        private void UpdateItemTimelines(string username)
        {
            // update itemtimeline
            bool scheduleNewItems = false;

            foreach (int timelineIndex in dirtyItemTimelineIndexes.Keys)
            {
                foreach (int schemaItemIndex in dirtyItemTimelineIndexes[timelineIndex])
                {
                    RepeaterItem schemaItemRptrItem   = SchemaItemsRptr.Items[schemaItemIndex];
                    RepeaterItem itemTimelineRptrItem = (schemaItemRptrItem.FindControl("ItemTimelineRptr") as Repeater).Items[timelineIndex];
                    // checkbox
                    CheckBox cb = itemTimelineRptrItem.FindControl("ItemTimelineCheckBox") as CheckBox;
                    // item timeline id
                    string itemTimelineId = (itemTimelineRptrItem.FindControl("ItemTimelineId") as HiddenField).Value;
                    // timeline id
                    string timelineId = (itemTimelineRptrItem.FindControl("TimelineId") as CaisisHidden).Value;
                    // schema item id
                    string schemaItemId = (schemaItemRptrItem.FindControl("SchemaItemId") as CaisisHidden).Value;
                    // add
                    if (cb.Checked)
                    {
                        if (string.IsNullOrEmpty(itemTimelineId))
                        {
                            ItemTimeline biz = new ItemTimeline();
                            biz[ItemTimeline.TimelineId]   = int.Parse(timelineId);
                            biz[ItemTimeline.SchemaItemId] = int.Parse(schemaItemId);
                            biz.Save();

                            // require scheduling
                            scheduleNewItems = true;
                        }
                    }
                    // remove
                    {
                        if (!string.IsNullOrEmpty(itemTimelineId))
                        {
                            int itemTimelineIdValue = int.Parse(itemTimelineId);
                            ProtocolMgmtDa.DeleteItemTimeline(itemTimelineIdValue);
                        }
                    }
                }
            }
            if (scheduleNewItems)
            {
                int schemaId = int.Parse(SchemaSelection.Value);
                ProtocolMgmtDa.ScheduleNewPatientItems(schemaId, username);
            }
        }
        private void PopulateSchemaList(int protocolid)
        {
            DataTable dt         = ProtocolMgmtDa.GetSchemasByProtocol(protocolid);
            var       datasource =
                from row in dt.AsEnumerable()
                let schemaid                       = row["ProtocolSchemaId"]
                                          let desc = row["ProtocolArmDescription"].ToString()
                                                     select new
            {
                Id   = schemaid,
                Text = desc.Substring(0, Math.Min(25, desc.Length))
            };

            PopulateDropDownList(SchemaList, datasource, "Text", "Id");
        }
 protected override void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         int protocolId = int.Parse(BaseProtocolId);
         SchemaSelection.DataSource = from row in ProtocolMgmtDa.GetSchemasByProtocol(protocolId).AsEnumerable()
                                      // ProtocolSchemaId, ProtocolArmDescription, ProtocolVersionId, VersionNumber
                                      select new
         {
             ItemText  = string.Format("{0} (v{1})", row["ProtocolArmDescription"], row["VersionNumber"]),
             ItemValue = string.Format("{0}", row["ProtocolSchemaId"])
         };
         SchemaSelection.DataBind();
     }
 }
Exemple #30
0
        /// <summary>
        /// Saves the status in the current control
        /// </summary>
        /// <param name="container"></param>
        private void SaveStatus(Control container)
        {
            HiddenField         StatusIdField  = container.FindControl("StatusIdField") as HiddenField;
            ICaisisInputControl Status_Field   = container.FindControl("Status_Field") as ICaisisInputControl;
            ICaisisInputControl StatusDateText = container.FindControl("StatusDateText") as ICaisisInputControl;
            // get pri key
            int?statusId = null;

            if (!string.IsNullOrEmpty(StatusIdField.Value))
            {
                statusId = int.Parse(StatusIdField.Value);
            }

            // validate
            if (string.IsNullOrEmpty(StatusDateText.Value))
            {
                return;
            }

            // create/edit entry
            Status status = new Status();

            // load existing
            if (statusId.HasValue)
            {
                status.Get(statusId.Value);
            }
            // create new entry
            else
            {
                status[Status.PatientId] = patientId;
                // required
                status[Status.StatusDisease] = STATUS_DISEASE;
                status[Status.Status_Field]  = Status_Field.Value;
            }
            CICHelper.SetBOValues(container.Controls, status, patientId);
            status.Save();

            // update pri key field
            statusId            = (int)status[Status.StatusId];
            StatusIdField.Value = statusId.Value.ToString();

            // run dependency scheduling
            int    patientSchemaId = int.Parse(PatientSchemaId);
            string username        = new Security.SecurityController().GetUserName();

            ProtocolMgmtDa.ScheduleDependentPatientItemsByStatus(patientSchemaId, username);
        }