Example #1
0
        /// <summary>
        /// For the specified table, return a list of input fields
        /// </summary>
        /// <param name="table"></param>
        /// <returns></returns>
        protected List <ICaisisInputControl> GetInputControls(string table)
        {
            // get a list of controls by table
            List <ICaisisInputControl> inputs = CICHelper.GetCaisisInputControlsByTableName(table);

            // cleanup
            foreach (ICaisisInputControl input in inputs)
            {
                // supress labels
                input.ShowLabel = false;

                // trigger calc date on text fields
                if (input is CaisisTextBox && input.Field.EndsWith("DateText"))
                {
                    CaisisTextBox ctb = input as CaisisTextBox;
                    ctb.Attributes["onblur"] = "UpdateDate(this);";
                }
                // cleanup spacer on date fields
                if (input is CaisisHidden)
                {
                    CaisisHidden hiddenInput = input as CaisisHidden;
                    if (hiddenInput.DisplayCalculatedDate)
                    {
                        hiddenInput.ShowSpacer = false;
                    }
                }
            }
            return(inputs);
        }
Example #2
0
        /// <summary>
        /// Populates the status for the current control
        /// </summary>
        /// <param name="container"></param>
        /// <param name="status"></param>
        private void PopulateStatus(Control container, string status)
        {
            HiddenField         StatusIdField = container.FindControl("StatusIdField") as HiddenField;
            ICaisisInputControl Status_Field  = container.FindControl("Status_Field") as ICaisisInputControl;
            ICaisisInputControl StatusDisease = container.FindControl("StatusDisease") as ICaisisInputControl;
            ImageButton         deleteBtn     = container.FindControl("DeleteBtn") as ImageButton;

            // get pri key
            int?statusId = GetStaustId(status);

            // set hidden field
            StatusIdField.Value = statusId + "";

            // populate
            if (statusId.HasValue)
            {
                Status biz = new Status();
                biz.Get(statusId.Value);
                CICHelper.SetFieldValues(container.Controls, biz);
            }
            // set inital values
            else
            {
                CICHelper.ClearCaisisInputControlValues(container);
                // set required values
                StatusDisease.Value = STATUS_DISEASE;
                Status_Field.Value  = status;
            }
            // set delete
            deleteBtn.Visible = statusId.HasValue;
        }
Example #3
0
        protected void SaveClick(object sender, EventArgs e)
        {
            Contact contact = new Contact();
            bool    isNew   = !ContactId.HasValue;

            // edit user
            if (ContactId.HasValue)
            {
                contact.Get(ContactId.Value);
            }
            CICHelper.SetBOValues(EditPanel.Controls, contact, -1);
            if (!contact.IsEmpty)
            {
                contact.Save();

                // associate organization
                string organizationId = Request.QueryString["organizationId"];
                if (isNew && !string.IsNullOrEmpty(organizationId))
                {
                    ProjectOrganization_ProjectContact contactOrg = new ProjectOrganization_ProjectContact();
                    contactOrg[ProjectOrganization_ProjectContact.ContactId]      = (int)contact[contact.PrimaryKeyName];
                    contactOrg[ProjectOrganization_ProjectContact.OrganizationId] = int.Parse(organizationId);
                    contactOrg[ProjectOrganization_ProjectContact.ContactType]    = 0;
                    contactOrg.Save();
                }
                ReloadMain(false);
            }
            else
            {
                Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "errorUpdating", "alert('Please validate all required fields.');", true);
            }
        }
Example #4
0
        protected void addSubSpecimenbtn_Click(object sender, EventArgs e)
        {
            string refNum = CurrentSpecimen[Specimen.SpecimenReferenceNumber].ToString();

            CICHelper.ClearCaisisInputControlValues(this);

            if (!string.IsNullOrEmpty(refNum))
            {
                this.SpecimenReferenceNumber.Value = refNum + "-"; //pattern yet to decide
            }
            else
            {
                this.SpecimenReferenceNumber.Value = "";
            }
            this.SpecimenUnits.Value = CurrentSpecimen[Specimen.SpecimenUnits].ToString();

            this.UpdateBtn.Visible         = false;
            this.SaveBtn.Visible           = true;
            this.addSubSpecimenbtn.Visible = false;
            this.hdrlbl.Visible            = false;
            this.subspeclbl.Visible        = true;

            //get SpecimenReferencNumber
            string    datasetSql = CacheManager.GetDatasetSQL(Session[SessionKey.DatasetId]);
            DataTable dt         = da.GetIdentifier(this.specimenId, _identifierType, datasetSql);
            string    refnum     = dt.Rows[0].ItemArray[3].ToString();

            this.subspeclbl.Text = "Add Sub-Specimen for Specimen : " + refnum.ToString();

            Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "HideProcessingEvents", "HideProcessingEvents();", true);
        }
Example #5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void SaveClick(object sender, EventArgs e)
        {
            // if editing last dirty row, show more
            bool rebindToEdit = dirtyRows.Contains(ReadOnlyLogRptr.Items.Count - 1);

            // update/insert "dirty" records
            foreach (int dirtyRowIndex in dirtyRows)
            {
                RepeaterItem item = ReadOnlyLogRptr.Items[dirtyRowIndex];
                // get pri key
                CaisisHidden            priKeyField = item.FindControl("CommunicationLogIdField") as CaisisHidden;
                ProjectCommunicationLog biz         = new ProjectCommunicationLog();
                // update
                if (!string.IsNullOrEmpty(priKeyField.Value))
                {
                    int priKey = int.Parse(priKeyField.Value);
                    biz.Get(priKey);
                }
                // fill Biz with field values
                CICHelper.SetBOValues(item.Controls, biz, projectId);
                // update/insert
                biz.Save();
            }
            dirtyRows.Clear();

            SetEditState(rebindToEdit);
            // rebind to reflect changes
            BindCommunicationLog();
        }
        /// <summary>
        /// Binds Questions belonging to selected Meta Survey
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void BindQuestionsGrid(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(SurveyList.Value))
            {
                SaveBtn.Visible    = true;
                PreviewBtn.Visible = true;

                int    metaSurveyId   = int.Parse(SurveyList.Value);
                string metaSurveyName = SurveyList.SelectedItem.Text;

                // Set Preview URL
                string previewURL = "~/Plugins/SurveyPlugin/SurveyWizardPage.aspx?surveyType=" + metaSurveyName + "&preview=true";
                PreviewBtn.NavigateUrl = previewURL;

                // set survey fields, title version etc...
                MetadataSurvey biz = new MetadataSurvey();
                biz.Get(metaSurveyId);
                CICHelper.SetFieldValues(SurveyFields.Controls, biz);

                SurveyFields.Visible = true;
                PreviewBtn.Visible   = true;
                DeleteBtn.Visible    = true;
            }
            else
            {
                SurveyFields.Visible = false;
                SaveBtn.Visible      = false;
                PreviewBtn.Visible   = false;
                DeleteBtn.Visible    = false;
            }
        }
Example #7
0
        private void SetFormState(bool isFormEnabled)
        {
            bool _isFormEnabled = isFormEnabled;

            CICHelper.EnableFields(this.Form.Controls, _isFormEnabled);

            if (_selectedJournal == "" || _selectedJournal.Equals(_dropDownNewValue))
            {
                // New
                SetButtonVisibility(true, true, true, true, false, true, true);
                SetButtonStates(false, false, true, true, false, true, false);
            }
            else
            {
                if (_isFormEnabled)
                {
                    // Populated Enabled Unlocked Form
                    SetButtonVisibility(true, true, true, true, false, true, true);
                    SetButtonStates(false, false, true, true, false, true, true);
                }
                else
                {
                    // Populated Disabled Unlocked Form
                    SetButtonVisibility(true, true, true, true, false, true, true);
                    SetButtonStates(true, true, true, false, false, true, false);
                }
            }
        }
        protected void Save(int letterOfIntentId, string strDiseaseState)
        {
            ProjectLetterOfIntent biz = new ProjectLetterOfIntent();

            biz.Get(letterOfIntentId);
            // Only want to save fields that are visible, as non visible fields don't retain their original set values
            List <ICaisisInputControl> cicList = CICHelper.GetCaisisInputControls(this.FindControl("MainTable"));

            foreach (ICaisisInputControl cic in cicList)
            {
                if (cic.Visible)
                {
                    if (cic is CaisisCheckBox)
                    {
                        if ((cic as CaisisCheckBox).Checked)
                        {
                            biz[cic.Field] = "1";
                        }
                        else
                        {
                            biz[cic.Field] = "0";
                        }
                    }
                    else
                    {
                        biz[cic.Field] = cic.Value;
                    }
                }
            }

            biz[ProjectLetterOfIntent.PopulationDiseaseState] = strDiseaseState;

            biz.Save();
        }
        /// <summary>
        /// Builds the data entry interface based on table
        /// </summary>
        protected void BuildUnplannedEvent()
        {
            // Build UI: build column layout based on default metadata
            var inputs   = CICHelper.GetCaisisInputControlsByTableName(QueryTableName, null);
            int colCount = new Caisis.Controller.PatientDataEntryController(null).GetNumDisplayColumns(QueryTableName);

            DataEntryLayout.BuildLayout(inputs, colCount, new string[] { });

            // Populate: populate exising record
            if (!string.IsNullOrEmpty(PriKeyField.Value))
            {
                int priKey = int.Parse(PriKeyField.Value);
                // load record and populate form
                var biz = BusinessObjectFactory.BuildBusinessObject(QueryTableName);
                biz.Get(priKey);
                // populate section with biz
                base.PopulateForm(DataEntryLayout, biz);

                // set related record if exists
                if (!string.IsNullOrEmpty(PatientItemId.Value))
                {
                    int           patientItemId = int.Parse(base.DecrypyValue(PatientItemId.Value));
                    RelatedRecord relatedRecord = Caisis.Controller.RelatedRecordController.GetRelatedRecords("ProtocolMgr_PatientItems", patientItemId, QueryTableName, priKey).FirstOrDefault();
                    if (relatedRecord != null)
                    {
                        RelatedRecordId.Value = relatedRecord[RelatedRecord.RelatedRecordId].ToString();
                    }
                }
            }
        }
Example #10
0
        protected void PopulateLargeFields()
        {
            ProjectLetterOfIntent biz = new ProjectLetterOfIntent();

            biz.Get(Int32.Parse(LetterOfIntentId));
            CICHelper.SetFieldValues(this.Controls, biz);
            List <ICaisisInputControl> cicList = PageUtil.GetCaisisInputControlsInContainer(this);

            foreach (ICaisisInputControl cic in cicList)
            {
                if (cic is CaisisTextArea)
                {
                    string jsDesc = "showFieldDescription(this,'" + cic.Field + "');";

                    CaisisTextArea cicTA = cic as CaisisTextArea;
                    cicTA.Attributes.Add("onfocus", jsDesc);
                    // Locate helper HTML node used for displaying HTML content contained
                    // in TextArea node
                    string             helperHTMLDivId = cicTA.ID + "HTML";
                    HtmlGenericControl helperDIV       = this.FindControl(helperHTMLDivId) as HtmlGenericControl;
                    if (helperDIV != null)
                    {
                        helperDIV.InnerHtml = cic.Value;
                    }
                }
            }
        }
Example #11
0
            /// <summary>
            /// Adds a new instance of controlBase (a CaisisInputControl) to the row's cell
            /// </summary>
            /// <param name="cell"></param>
            /// <param name="rowState"></param>
            protected override void InitializeDataCell(DataControlFieldCell cell, DataControlRowState rowState)
            {
                ICaisisInputControl iCIC = new CaisisTextBox();

                if (BaseCaisisInputControl == null)
                {
                    if (!string.IsNullOrEmpty(CaisisControlTypeName))
                    {
                        //// Create Control, set Field, then set MetaData values
                        //iCIC = CICHelper.InvokeInputControl(CaisisControlTypeName);
                        //iCIC.Field = cicFieldName;
                        //CICHelper.SetCICAttributes(iCIC, CaisisControlMetaTable);
                    }
                }
                else
                {
                    iCIC = CICHelper.CloneCIC(controlBase);
                }
                // Supress FieldLabel
                iCIC.ShowLabel = false;

                // handle binding
                BindControl(this, new CaisisControlEventArgs(iCIC));

                // Add control to cell
                cell.Controls.Add(iCIC as Control);
            }
Example #12
0
        protected string RecordDetails(string tableName, string primaryKey)
        {
            string recordDetails = "";

            if (BOL.BusinessObjectFactory.CanBuildBusinessObject(tableName))
            {
                IBusinessObject biz = BusinessObjectFactory.BuildBusinessObject(tableName);
                biz.Get(int.Parse(primaryKey));

                string tableDisplayName = (biz.TableLabel.Length > 0) ? biz.TableLabel : tableName;

                Dictionary <string, string> HPIRecordDataEntryFields = new Dictionary <string, string>();
                HPIRecordDataEntryFields = CICHelper.GetCaisisInputControlsByTableName(tableName).ToDictionary(i => i.Field, i => pdec.GetFieldLabel(i.Table, i.Field));

                if (HPIRecordDataEntryFields.Keys.Count > 0)
                {
                    recordDetails = "<span id=\"HPIRecordDetailsBubbleContent_" + tableName + "_" + primaryKey + "\" class=\"HPIRecordDetailsBubbleContent\"><table><tr><td colspan=\"2\" class=\"HPIRecordDetailsBubbleTitle\" >" + tableDisplayName + "</td>";
                    foreach (string fieldName in HPIRecordDataEntryFields.Keys)
                    {
                        string fieldLabel = HPIRecordDataEntryFields[fieldName];
                        string fieldValue = biz[fieldName].ToString();

                        if (fieldValue.Length > 0)
                        {
                            recordDetails += "<tr><td>" + fieldLabel + "</td><td>" + fieldValue + "</td></tr>";
                        }
                    }
                    recordDetails += "</table></span>";
                }
            }

            return(recordDetails);
        }
Example #13
0
        /// <summary>
        /// Add event handlers to ICaisisInputControls to mark relevant forms as dirty
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void InitalizeEvents(object sender, EventArgs e)
        {
            // set require fields
            if (!Page.IsPostBack)
            {
                int?toxicityId    = null;
                int?patientItemId = null;
                // get keys
                if (!string.IsNullOrEmpty(QueryPatientItemId))
                {
                    string dpid = base.DecrypyValue(QueryPatientItemId);
                    if (!string.IsNullOrEmpty(dpid))
                    {
                        patientItemId = int.Parse(dpid);
                    }
                }
                if (!string.IsNullOrEmpty(QueryToxicityId))
                {
                    toxicityId = int.Parse(QueryToxicityId);
                }
                // set hidden fields: important, use raw QS for pass through
                PatientItemId.Value   = QueryPatientItemId;
                ToxicityIdField.Value = QueryToxicityId;
                // check if SAE
                if (toxicityId.HasValue)
                {
                    CheckSAEDetails(toxicityId.Value);
                }
            }
            // add "dirty" tracking for forms
            foreach (ICaisisInputControl iCIC in CICHelper.GetCaisisInputControls(this))
            {
                if (iCIC.Table == "Toxicities")
                {
                    iCIC.ValueChanged += new CaisisEventHandler(MarkToxicityDirty);
                }
                else if (iCIC.Table == "SeriousAdverseEvents")
                {
                    iCIC.ValueChanged += new CaisisEventHandler(MarkSAEDirty);
                }
                iCIC.ValueChanged += MarkTableFieldsDirty;
            }

            // query default list of patient MedTxAgents
            if (!string.IsNullOrEmpty(BaseSchemaId))
            {
                int protocolSchemaId        = int.Parse(BaseSchemaId);
                int patientSchemaId         = int.Parse(PatientSchemaId);
                MedicalTherapyDa da         = new MedicalTherapyDa();
                DataTable        trialMedTx = da.GetProtocolSchemaTherapies(protocolSchemaId);
                // combine data
                var trialAgents = trialMedTx.AsEnumerable().Select(m => m[MedicalTherapy.MedTxAgent].ToString()).Distinct().ToArray();
                IEnumerable <MedicalTherapy> patientTherapies = BOL.ProtocolMgmt.GetRecordsByPatientSchema <MedicalTherapy>(patientSchemaId);
                protocolMedTxAgents = from agent in trialAgents
                                      join tx in patientTherapies on agent equals tx[MedicalTherapy.MedTxAgent].ToString() into g
                                      let tx = g.FirstOrDefault()
                                               let txAdmin = tx == null ? new MedTxAdministration[0] : BOL.BusinessObject.GetByParent <MedTxAdministration>((int)tx[MedTxAdministration.MedicalTherapyId])
                                                             select agent;
            }
        }
Example #14
0
        /// <summary>
        /// Updates/inserts group
        /// </summary>
        /// <returns></returns>
        private int?Save()
        {
            Group group = new Group();

            // load existing, otherwise new group
            if (!string.IsNullOrEmpty(QueryGroupId))
            {
                group.Get(int.Parse(QueryGroupId));
            }
            int roleId = int.Parse(GroupRole.Value);

            CICHelper.SetBOValues(GroupFields.Controls, group, roleId);
            // update group access code
            var    selectedTabs = GetRptrSelectedValues(TabsRptr);
            string accessCode   = string.Join(",", selectedTabs.ToArray());

            group[Group.GroupAccessCode] = accessCode;

            // update Group
            group.Save();
            int groupId = (int)group[Group.GroupId];

            // update group datasets
            SaveGroupDatasets(groupId);

            // uddate group users
            SaveGroupUsers(groupId);

            // return updated/inserted group
            return(groupId);
        }
        protected void UpdateButton_Click(object sender, EventArgs e)
        {
            //
            // Save the Funding Info fields
            //
            ProjectFundingSource biz = new ProjectFundingSource();

            if (fundingId != -1)
            {
                biz.Get(fundingId);
            }

            if (projectId != -1)
            {
                CICHelper.SetBOValues(EditFundingPanel.Controls, biz, projectId);
            }
            else
            {
                CICHelper.SetBOValues(EditFundingPanel.Controls, biz, 0);
            }

            biz.Save();

            if (biz["FundingSourceId"].ToString() != "")
            {
                fundingId = Int32.Parse(biz["FundingSourceId"].ToString());
            }

            ProjectInvoiceGridView.Save(fundingId);

            GoToMainList();
        }
Example #16
0
        private void PopulateProtocolInfo()
        {
            Protocol biz = new Protocol();

            if (numProtocolId != -1)
            {
                biz.Get(numProtocolId);
                CICHelper.SetFieldValues(EditView.Controls, biz);
            }

            // set delete button
            if (IsEditMode && numProtocolId != -1)
            {
                bool hasVersions = BOL.BusinessObject.Count <ProtocolVersion>(new Dictionary <string, object> {
                    { PatientProtocol.ProtocolId, numProtocolId }
                }) > 0;
                bool hasPatients = BOL.BusinessObject.Count <PatientProtocol>(new Dictionary <string, object> {
                    { PatientProtocol.ProtocolId, numProtocolId }
                }) > 0;
                // validate no schemas or patients on protocol
                if (!hasVersions && !hasPatients)
                {
                    DeleteButton.Visible = true;
                }
            }
        }
Example #17
0
        private void LoadCollection()
        {
            SpecimenCollection collection = new SpecimenCollection();

            collection.Get(colId);
            CICHelper.SetFieldValues(Page.Controls, collection);

            this.CollectionName.Text       = collection[SpecimenCollection.CollectionName].ToString();
            this.CollectionAssignDate.Text = collection[SpecimenCollection.CollectionAssignDate].ToString();
            this.CollectionAssignDate.Text = GetValidDisplayDate(this.CollectionAssignDate.Text);

            this.CollectionType.Text   = collection[SpecimenCollection.CollectionType].ToString();
            this.CollectionStatus.Text = collection[SpecimenCollection.CollectionStatus].ToString();

            this.CollectionProjectCode.Text = collection[SpecimenCollection.CollectionProjectCode].ToString();
            this.CollectionAssignNotes.Text = collection[SpecimenCollection.CollectionAssignNotes].ToString();

            this.pageTitle.Text = collection[SpecimenCollection.CollectionName].ToString();

            SecurityController sc   = new SecurityController();
            string             user = sc.GetUserName();

            this.printedBy.Text   = user;
            this.printedDate.Text = DateTime.Now.ToString();

            BindSpecimensGrid();
        }
Example #18
0
        protected void SaveButton_Click(object sender, EventArgs e)
        {
            Protocol biz = new Protocol();

            // load exisiting if updating
            if (!IsNew)
            {
                biz.Get(numProtocolId);
            }
            CICHelper.SetBOValues(EditView.Controls, biz, 0);
            // insert/update
            biz.Save();

            int updatedProtocolId = (int)biz[Protocol.ProtocolId];

            // on new records do full outer reload
            if (IsNew)
            {
                DeepRefresh(updatedProtocolId);
            }
            else
            {
                RefreshMainScreen();
            }
        }
Example #19
0
        private void SetFormFieldData(int tempOrgId)
        {
            ProjectOrganization org = new ProjectOrganization();

            org.Get(tempOrgId);

            CICHelper.SetFieldValues(Form.Controls, org);

            // Set Color if needed
            string orgColor = org[ProjectOrganization.ColorCode].ToString();

            if (!string.IsNullOrEmpty(orgColor))
            {
                ColorCodeBox.Style[HtmlTextWriterStyle.BackgroundColor] = orgColor;
            }
            // Set fields in Main table
            // Labels are assigned IDs based on field names in ProjectOrganization table
            OrganizationFullName.Text = org[ProjectOrganization.Name].ToString();
            foreach (string field in org.FieldNames)
            {
                Label fieldValue = DetailsViewLayer.FindControl(field) as Label;
                if (fieldValue != null)
                {
                    fieldValue.Text = org[field].ToString();
                }
            }
        }
Example #20
0
        protected void SaveClick(object sender, EventArgs e)
        {
            // Save Diagnostic Record
            Diagnostic biz = new Diagnostic();

            // load existing record
            if (!IsNew)
            {
                biz.Get(DiagnosticId);
            }
            // important, get current uptake value before setting biz fields
            string currentDBDxResult = biz[Diagnostic.DxResult].ToString();

            // set biz fields from control fields
            CICHelper.SetBOValues(this.Controls, biz, (int.Parse(BaseDecryptedPatientId)));

            // handle tracer uptake, use existing db value andget computed value
            //biz[Diagnostic.DxResult] = GetTracerUptake(currentDBDxResult);

            // finally save diagnostic and child findings
            biz.Save();
            int diagnosticId = (int)biz[Diagnostic.DiagnosticId];

            // Save DxImageFindings
            DxGrid1.Save(diagnosticId);
            DxGrid2.Save(diagnosticId);

            // Re-populate form with new request
            ReloadPage(diagnosticId.ToString());
        }
 public virtual void Save(int toxicityId)
 {
     foreach (GridViewRow row in ToxAttributionGrid.Rows)
     {
         var            inputs   = CICHelper.GetCaisisInputControls(row);
         ToxAttribution biz      = new ToxAttribution();
         bool           notEmpty = CICHelper.InputControlsHaveValue(inputs);
         if (notEmpty)
         {
             string priKey = ToxAttributionGrid.DataKeys[row.RowIndex][BOL.ToxAttribution.ToxAttributionId] + "";
             if (!string.IsNullOrEmpty(priKey))
             {
                 biz.Get(int.Parse(priKey));
             }
             else
             {
                 biz[ToxAttribution.ToxicityId] = toxicityId;
             }
             foreach (var input in inputs)
             {
                 string fieldName = input.Field;
                 string formValue = input.Value;// Request.Form[(input as Control).UniqueID];
                 biz[fieldName] = formValue;
             }
             biz.Save();
         }
     }
 }
Example #22
0
        protected void SaveBtn_Click(object sender, ImageClickEventArgs e)
        {
            if (accessionId != 0)
            {
                //updating existing accession record
                SpecimenAccession accession = new SpecimenAccession();
                accession.Get(accessionId);
                CICHelper.SetBOValues(inputControlsRow.Controls, accession, patientId);
                accession.Save();

                specimensGrid.Save(accessionId);

                LoadAccesssionInfo(accessionId);
                BindSpecimensGrid(accessionId);

                Page.ClientScript.RegisterStartupScript(typeof(Page), "refreshParent", "refreshParent('" + EncryptPatientId(patientId.ToString()) + "','" + accessionId + "');", true);
            }
            else
            {
                //saving new accession
                SpecimenAccession newaccession = new SpecimenAccession();
                CICHelper.SetBOValues(inputControlsRow.Controls, newaccession, patientId);
                newaccession[SpecimenAccession.PatientId] = patientId;
                newaccession.Save();

                newAccessionId = int.Parse(newaccession[SpecimenAccession.SpecimenAccessionId].ToString());
                specimensGrid.Save(newAccessionId);

                LoadAccesssionInfo(newAccessionId);
                BindSpecimensGrid(newAccessionId);

                Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "refreshParent", "refreshParent('" + EncryptPatientId(patientId.ToString()) + "','" + newAccessionId + "');", true);
            }
        }
        private void PopulateManuscriptInfo()
        {
            BOL.ProjectManuscript biz = new BOL.ProjectManuscript();

            biz.Get(manuscriptId);
            CICHelper.SetFieldValues(PanelManuscriptInfo.Controls, biz);
        }
Example #24
0
        /// <summary>
        /// Add a new Lesion (DxImageFindings) record
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void AddLesionClick(object sender, EventArgs e)
        {
            // Get field values for add adding new lesion
            Control             petFields       = NewDxImageFindingPanel.FindControl("DX_PET_Fields");
            Control             ctMRIFields     = NewDxImageFindingPanel.FindControl("DX_CTMRI_Fields");
            Control             shareFields     = NewDxImageFindingPanel.FindControl("DX_SHARED_Fields");
            Control             mainFields      = ImageType == "PET" ? petFields : ctMRIFields;
            ICaisisInputControl diagnosticField = FindInputControl(mainFields, ImageFinding.DiagnosticId);

            string diagnosticId = diagnosticField.Value;

            if (!string.IsNullOrEmpty(diagnosticId))
            {
                int          diagId     = int.Parse(diagnosticId);
                ImageFinding newFinding = new ImageFinding();
                newFinding[ImageFinding.DiagnosticId] = diagId;
                CICHelper.SetBOValues(mainFields.Controls, newFinding, diagId);
                // special fields
                string imgFindTarget   = FindInputControl(mainFields, ImageFinding.ImgFindTarget).Value;
                int    imgFindGroupNum = GetNextGroupNum();
                newFinding[ImageFinding.ImgFindGroupNum] = imgFindGroupNum;
                newFinding[ImageFinding.ImgFindTarget]   = imgFindTarget;
                newFinding.Save();
            }
            // Save Matrix
            MainSaveBtnClick(sender, e);
        }
Example #25
0
        private void PopulatePatient(int patientId)
        {
            Patient patient = new Patient();

            patient.Get(patientId);
            CICHelper.SetFieldValues(this.Controls, patient);
        }
Example #26
0
        /// <summary>
        /// Validate ICaisisInputControl/BusinessObject Fields
        /// </summary>
        /// <returns></returns>
        private bool ValidateRequiredFields()
        {
            bool valid = true;

            foreach (ICaisisInputControl cic in CICHelper.GetCaisisInputControls(this))
            {
                if (cic.Required && cic.Value.Trim() == "")
                {
                    UserMessage.Text     = "Fields named in red are required.";
                    UserMessage.CssClass = "requiredField";
                    valid = false;
                    break;
                }
            }
            //foreach (Control con in Form.Controls)
            //{
            //    if (con is ICaisisInputControl)
            //    {
            //        ICaisisInputControl cic = (ICaisisInputControl)con;
            //        if (cic.Required && cic.Value.Trim() == "")
            //        {
            //            UserMessage.Text = "<span class=requiredField>Fields named in red are required.</span>";
            //            valid = false;
            //        }
            //    }
            //}
            return(valid);
        }
Example #27
0
 protected void SetFieldValues(object sender, GridViewRowEventArgs e)
 {
     if (e.Row.RowType == DataControlRowType.DataRow)
     {
         // set button states
         string  priKey   = DataBinder.Eval(e.Row.DataItem, MedicalTherapy.MedicalTherapyId) + "";
         bool    isLocked = (DataBinder.Eval(e.Row.DataItem, BusinessObject.LockedBy) + "") != "";
         var     exists   = priKey != "";
         Control lockImg  = e.Row.FindControl("LockImage");
         Control clearImg = e.Row.FindControl("ClearImage");
         lockImg.Visible  = isLocked;
         clearImg.Visible = !exists;
         // lock inputs
         if (isLocked)
         {
             var inputs = CICHelper.GetCaisisInputControls(e.Row);
             inputs.ForEach(i => i.Enabled = false);
         }
         // special case: set TxType
         ICaisisInputControl txTypeInput = e.Row.FindControl("MedTxType") as ICaisisInputControl;
         if (string.IsNullOrEmpty(priKey))
         {
             if (!string.IsNullOrEmpty(TxType))
             {
                 txTypeInput.Value = TxType;
             }
         }
         else
         {
             txTypeInput.Value = DataBinder.Eval(e.Row.DataItem, MedicalTherapy.MedTxType).ToString();
         }
     }
 }
        private void PopulateFundingInfo()
        {
            ProjectFundingSource biz = new ProjectFundingSource();

            biz.Get(fundingId);
            CICHelper.SetFieldValues(EditFundingPanel.Controls, biz);
        }
Example #29
0
        protected void BindContactPanel(int contactId)
        {
            Contact biz = new Contact();

            biz.Get(contactId);

            // populate fields
            CICHelper.SetFieldValues(EditPanel.Controls, biz);

            ContactTitle.Text = biz[Contact.FirstName].ToString() + " " + biz[Contact.LastName].ToString();
            foreach (string colName in biz.FieldNames)
            {
                Label field = DisplayContactPanel.FindControl(colName) as Label;
                if (field != null)
                {
                    field.Text = biz[colName].ToString();
                }
            }
            if (!string.IsNullOrEmpty(Department.Text))
            {
                Department.Text = "Department of " + Department.Text;
            }

            // set edit btn
            ShowEditBtn.OnClientClick = "return editContact('" + contactId + "');";
        }
Example #30
0
        private void Save()
        {
            int?questionId = null;
            int surveyId   = int.Parse(MetaSurveyId);
            // save question
            MetadataSurveyQuestion question = new MetadataSurveyQuestion();

            if (!string.IsNullOrEmpty(QuestionId.Value))
            {
                questionId = int.Parse(QuestionId.Value);
                question.Get(questionId.Value);
            }
            else
            {
                question[MetadataSurveyQuestion.MetadataSurveyId] = surveyId;
            }
            CICHelper.SetBOValues(this.Controls, question, surveyId);
            question.Save();
            questionId = (int)question[MetadataSurveyQuestion.MetadataSurveyQuestionId];

            // save responses
            SurveyQuestionResponsesGrid.Save(questionId.Value);

            // rebuild form
            PopulateForm(questionId);
            ReloadMainPage(surveyId.ToString());
        }