コード例 #1
0
ファイル: StorageManager.aspx.cs プロジェクト: aomiit/caisis
    private void SetStorageItems(string siteId)
    {
        SiteId.Value      = siteId;
        StorageId.Value   = string.Empty;
        ContainerId.Value = string.Empty;
        BoxId.Value       = string.Empty;
        if (PageUtil.IsInteger(siteId))
        {
            int _siteId = int.Parse(siteId);

            DataView view = BusinessObject.GetByParentAsDataView <SpecimenStorage>(_siteId);

            //SpecimenStorage s = new SpecimenStorage();
            //s.GetByParent(_siteId);
            //if (s.RecordCount > 0)
            if (view.Count > 0)
            {
                //RptStorage.DataSource = s.DataSourceView;
                RptStorage.DataSource = view;
                RptStorage.DataBind();
            }
            else
            {
                RptStorage.DataBind();
                RptContainer.DataBind();
                RptBoxes.DataBind();
            }
        }
    }
コード例 #2
0
        private string GetProjectInfo(string projectId)
        {
            string projectInfo = "";

            if (!string.IsNullOrEmpty(projectId) && PageUtil.IsInteger(projectId))
            {
                Project p = new Project();
                p.Get(int.Parse(projectId));


                projectInfo = p[Project.ProjectNum].ToString() + " : " + p[Project.Title].ToString();

                ProjectManagementDa pmDa          = new ProjectManagementDa();
                DataTable           organizations = pmDa.GetAllOrganizationsSortedByProjectId(int.Parse(projectId));
                string orgList = "";
                foreach (DataRow dr in organizations.Rows)
                {
                    orgList += dr[ProjectOrganization.Name].ToString() + "\n";
                }
                string url         = Page.ResolveUrl("~/Core/Utilities/ModuleContainer.aspx?mod=/ProjectMgmt/Index.aspx");
                string projectPath = "top.window.location = '" + url + "?projectId=" + projectId + "'";
                ProjectIdLink.Attributes.Add("onclick", projectPath);
                ProjectId.ToolTip = orgList;
            }

            return(projectInfo);
        }
コード例 #3
0
ファイル: SeedManagementUtil.cs プロジェクト: aomiit/caisis
        /* 'actual seeds assigned to patient
         * If IsNumeric(txtSeedStrength) Then
         *      If IsNumeric(txtNumSeeds) Then
         *              txtTotalActivity = CSng(txtNumSeeds) * CSng(txtSeedStrength)
         *              blnDosimetrySaved = False
         *      Else
         *              blnComplete = False
         *      End If
         *      'reccommended activity calculated above
         *      'see if actual is greater than recommended, should be about 100-110%
         *      If IsNumeric(txtRecTotActivity) Then
         *              If IsNumeric(txtTotalActivity) And CSng(txtRecTotActivity) > 0 Then
         *                      txtPercentActivity = CSng(txtTotalActivity) / CSng(txtRecTotActivity)
         *                      blnDosimetrySaved = False
         *              Else
         *                      blnComplete = False
         *              End If
         *      Else
         *              blnComplete = False
         *      End If
         * Else
         *      blnComplete = False
         * End If
         */

        /// <summary>
        ///
        /// </summary>
        /// <param name="isotope"></param>
        /// <param name="assayActivity"></param>
        /// <param name="assayDate"></param>
        /// <param name="implantDate"></param>
        /// <returns></returns>
        public static string GetImplantActivity(string isotope, string assayActivity, string assayDate, string implantDate)
        {
            string implantActivity = "";

            if (PageUtil.IsInteger(assayActivity) || PageUtil.IsDecimal(assayActivity))
            {
                if (PageUtil.IsDate(assayDate) && PageUtil.IsDate(implantDate))
                {
                    DateTime d1, d2;

                    d1 = Convert.ToDateTime(implantDate);            //implant date comes from BrachyDate field in Brachy table
                    d2 = Convert.ToDateTime(assayDate);

                    TimeSpan ts = d1 - d2;

                    int days = ts.Days;
                    //GetCurrentActivity = sngAssayActivity * 0.5 ^ ((Date - dAssayDate) / 59.4)
                    if (isotope.Equals("Iodine") || isotope.Equals("I-125") || isotope.Equals("I125"))
                    {
                        double Itotal = Convert.ToDouble(assayActivity) * (Math.Pow(0.5, (days / 59.4)));
                        implantActivity = Math.Round(Itotal, 6).ToString();                        // could remove this to store full value in db and round to six places on output
                    }
                    else if (isotope.Equals("Palladium") || isotope.Equals("Pd-103") || isotope.Equals("Pd103"))
                    {
                        double Ptotal = Convert.ToDouble(assayActivity) * (Math.Pow(0.5, (days / 16.97)));
                        implantActivity = Math.Round(Ptotal, 6).ToString();
                    }
                }
            }

            return(implantActivity);
        }
コード例 #4
0
ファイル: StorageManager.aspx.cs プロジェクト: aomiit/caisis
    private void SetContainerItems(string storageId)
    {
        StorageId.Value   = storageId;
        ContainerId.Value = string.Empty;
        BoxId.Value       = string.Empty;
        if (PageUtil.IsInteger(storageId))
        {
            int _storageId = int.Parse(storageId);

            //SpecimenContainer c = new SpecimenContainer();
            //c.GetByParent(_storageId);
            //if (c.RecordCount > 0)
            DataView view = BusinessObject.GetByParentAsDataView <SpecimenContainer>(_storageId);
            if (view.Count > 0)
            {
                //RptContainer.DataSource = c.DataSourceView;
                RptContainer.DataSource = view;
                RptContainer.DataBind();
            }
            else
            {
                RptContainer.DataBind();
                RptBoxes.DataBind();
            }
        }
    }
コード例 #5
0
ファイル: SeedManagementUtil.cs プロジェクト: aomiit/caisis
        /*Public Function GetImplantActivity(strIsotope As String, vAssayActivity As Variant, vAssayDate As Variant) As Variant
         * Dim dImplantDate As Date
         * GetImplantActivity = Null
         * If IsNumeric(vAssayActivity) Then
         *      If IsDate(vAssayDate) Then
         *              If objPatient.ImplantDate <> vbNullString Then
         *                      dImplantDate = objPatient.ImplantDate
         *                      If dImplantDate <> MISSING_DATE Then
         *                              Select Case strIsotope
         *                              Case "Iodine", "I-125", "I125"
         *                                      'half-life
         *                                      GetImplantActivity = CSng(vAssayActivity) * 0.5 ^ ((dImplantDate - CDate(vAssayDate)) / 59.4)
         *                              Case "Palladium", "Pd-103", "Pd103"
         *                                      GetImplantActivity = CSng(vAssayActivity) * 0.5 ^ ((dImplantDate - CDate(vAssayDate)) / 16.97)
         *                              End Select
         *                      End If
         *              End If
         *      End If
         * End If
         * Exit_Procedure:
         * Exit Function*/

        /// <summary>
        ///
        /// If this is too slow/performance hit, then move function to back end.
        /// </summary>
        /// <param name="isotope"></param>
        /// <param name="assayActivity"></param>
        /// <param name="assayDate"></param>
        /// <returns></returns>
        public static object GetCurrentActivity(string isotope, string assayActivity, string assayDate)
        {
            object currentActivity = System.DBNull.Value;

            if (PageUtil.IsInteger(assayActivity) || PageUtil.IsDecimal(assayActivity))
            {
                if (PageUtil.IsDate(assayDate))
                {
                    DateTime d1, d2;

                    d1 = System.DateTime.Now;
                    d2 = Convert.ToDateTime(assayDate);

                    TimeSpan ts = d1 - d2;

                    int days = ts.Days;
                    //GetCurrentActivity = sngAssayActivity * 0.5 ^ ((Date - dAssayDate) / 59.4)
                    if (isotope.Equals("Iodine") || isotope.Equals("I-125") || isotope.Equals("I125"))
                    {
                        double Itotal = Convert.ToDouble(assayActivity) * (Math.Pow(0.5, (days / 59.4)));
                        currentActivity = Math.Round(Itotal, 6).ToString();                        // could remove this to store full value in db and round to six places on output
                    }
                    else if (isotope.Equals("Palladium") || isotope.Equals("Pd-103") || isotope.Equals("Pd103"))
                    {
                        double Ptotal = Convert.ToDouble(assayActivity) * (Math.Pow(0.5, (days / 16.97)));
                        currentActivity = Math.Round(Ptotal, 6).ToString();
                    }
                }
            }

            return(currentActivity);
        }
コード例 #6
0
ファイル: StorageManager.aspx.cs プロジェクト: aomiit/caisis
 private void RenderBox(string boxId)
 {
     BoxId.Value = boxId;
     if (PageUtil.IsInteger(boxId))
     {
         int _boxId = int.Parse(boxId);
     }
 }
コード例 #7
0
        protected void btnEtAddSelectedColumnsToMetaFields_onClick(object sender, EventArgs e)
        {
            //set create table view
            viewMode = "editTable";
            setViewMode();
            int    tableId   = int.Parse(ddlTableDefs.SelectedValue);
            string tableName = lblEtTableName.Text;


            string fieldName;
            string fieldDataType;
            int    maxLength = -1;
            int    order;

            MetadataNewDa MNDa = new MetadataNewDa();

            if (MNDa.MetaFieldOrderTableHasOrderedFields(tableId))
            {
                order = -1;
            }
            else
            {
                order = 1;
            }
            foreach (DataGridItem i in dgEtFieldsNotUsed.Items)
            {
                CheckBox deleteChkBxItem = (CheckBox)i.FindControl("chkSelection");

                if (deleteChkBxItem.Checked)
                {
                    string strMaxLength;
                    fieldName     = i.Cells[1].Text;
                    fieldDataType = ParseSQLDatatypeToCsharp(i.Cells[2].Text);
                    strMaxLength  = i.Cells[3].Text;
                    if (PageUtil.IsInteger(strMaxLength))
                    {
                        maxLength = int.Parse(strMaxLength);
                    }
                    else
                    {
                        maxLength = -1;
                    }
                    if (order > 0)
                    {
                        MNDa.AddMetaField(tableId, fieldName, fieldDataType, maxLength, false, false, order);
                        order++;
                    }
                    else
                    {
                        MNDa.AddMetaField(tableId, fieldName, fieldDataType, maxLength, false, false);
                    }
                }
            }
            updateEditTableView(tableId, tableName);
        }
コード例 #8
0
ファイル: TabDataEntry.ascx.cs プロジェクト: aomiit/caisis
        /// <summary>
        /// Gets the persisted tab index value during postbacks
        /// </summary>
        /// <returns></returns>
        public virtual int?GetPersistedTabIndex()
        {
            int?   index     = null;
            string formIndex = Request.Form[this.ClientID + "_Index"];

            if (!string.IsNullOrEmpty(formIndex))
            {
                if (PageUtil.IsInteger(formIndex))
                {
                    index = int.Parse(formIndex);
                }
            }
            return(index);
        }
コード例 #9
0
        private int getSelectedFieldId()
        {
            string sFieldId = ddlFieldNames.SelectedValue;
            int    rtrn;

            if (PageUtil.IsInteger(sFieldId))
            {
                rtrn = int.Parse(sFieldId);
            }
            else
            {
                rtrn = -1;
            }
            return(rtrn);
        }
コード例 #10
0
        private int getSelectedTableId()
        {
            string sTableId = ddlTableDefs.SelectedValue;
            int    rtrn;

            if (PageUtil.IsInteger(sTableId))
            {
                rtrn = int.Parse(sTableId);
            }
            else
            {
                rtrn = -1;
            }
            return(rtrn);
        }
コード例 #11
0
        protected void OnCollectionChange(string colId)
        {
            if (PageUtil.IsInteger(colId))
            {
                int _colId           = int.Parse(colId);
                SpecimenManagerDa da = new SpecimenManagerDa();
                DataTable         dt = da.GetBoxesByCollectionId(_colId);
                RptBoxes.DataSource = dt.DefaultView;
                RptBoxes.DataBind();

                // change style of div for current collection
                string s = "highlightItem('Collection', '" + colId + "');";
                Page.RegisterStartupScript("xyz", "<script language=javascript>" + s + "</script>");
            }
        }
コード例 #12
0
 private void SetBoxItems(string containerId)
 {
     if (PageUtil.IsInteger(containerId))
     {
         //SpecimenBox b = new SpecimenBox();
         //b.GetByParent(int.Parse(containerId));
         //Boxes.DataSource = b.DataSourceView;
         Boxes.DataSource     = BusinessObject.GetByParentAsDataView <SpecimenBox>(int.Parse(containerId));
         Boxes.DataTextField  = SpecimenBox.BoxName; // need to display box type?
         Boxes.DataValueField = SpecimenBox.BoxId;
         Boxes.DataBind();
     }
     else
     {
         Boxes.Items.Clear();
     }
 }
コード例 #13
0
 private void SetContainerItems(string storageId)
 {
     if (PageUtil.IsInteger(storageId))
     {
         //SpecimenContainer c = new SpecimenContainer();
         //c.GetByParent(int.Parse(storageId));
         //Containers.DataSource = c.DataSourceView;
         Containers.DataSource     = BusinessObject.GetByParentAsDataView <SpecimenContainer>(int.Parse(storageId));
         Containers.DataTextField  = SpecimenContainer.ContainerName; // need to display storage type?
         Containers.DataValueField = SpecimenContainer.ContainerId;
         Containers.DataBind();
     }
     else
     {
         Containers.Items.Clear();
         Boxes.Items.Clear();
     }
 }
コード例 #14
0
        private bool ValidInputs()
        {
            string ageFrom = txtAgeFrom.Value;
            string ageTo   = txtAgeTo.Value;

            if (ageFrom.Length > 0 && !PageUtil.IsInteger(ageFrom))
            {
                this.lblMsg.Text = "Age must be a number";
                return(false);
            }
            if (ageTo.Length > 0 && !PageUtil.IsInteger(ageTo))
            {
                this.lblMsg.Text = "Age must be a number";
                return(false);
            }
            //if(ageFrom.Length==0)

            return(true);
        }
コード例 #15
0
 private void SetStorageItems(string siteId)
 {
     if (PageUtil.IsInteger(siteId))
     {
         //SpecimenStorage s = new SpecimenStorage();
         //s.GetByParent(int.Parse(siteId));
         //Storages.DataSource = s.DataSourceView;
         Storages.DataSource     = BusinessObject.GetByParentAsDataView <SpecimenStorage>(int.Parse(siteId));
         Storages.DataTextField  = SpecimenStorage.StorageName; // need to display storage type?
         Storages.DataValueField = SpecimenStorage.StorageId;
         Storages.DataBind();
     }
     else
     {
         Storages.Items.Clear();
         Containers.Items.Clear();
         Boxes.Items.Clear();
     }
 }
コード例 #16
0
    /// <summary>
    /// Hides the "save" and "reset" buttons for default docs unless disease, visit type and packet name are populated
    /// </summary>
    private void ShowOrHideDefaultDocButtons()
    {
        if (String.IsNullOrEmpty(this.ddlVisitType.SelectedValue) || String.IsNullOrEmpty(this.ddlDiseaseType.SelectedValue) || String.IsNullOrEmpty(this.ddlPacketName.SelectedValue))
        {
            this.defaultDocBtns.Visible = false;
        }
        else
        {
            this.defaultDocBtns.Visible = true;

            if (PageUtil.IsInteger(ddlPacketName.SelectedValue))
            {
                BtnDeletePacket.Visible = true;
            }
            else
            {
                BtnDeletePacket.Visible = false;
            }
        }
    }
コード例 #17
0
        private bool ValidInputs()
        {
            string ageFrom = this.txtAgeFrom.Value;
            string ageTo   = this.txtAgeTo.Value;

            if (ageFrom.Length > 0 && !PageUtil.IsInteger(ageFrom))
            {
                this.validationMessage.Text    = "Age must be a number";
                this.validationMessage.Visible = true;
                return(false);
            }
            if (ageTo.Length > 0 && !PageUtil.IsInteger(ageTo))
            {
                this.validationMessage.Text    = "Age must be a number";
                this.validationMessage.Visible = true;
                return(false);
            }

            this.validationMessage.Visible = false;
            return(true);
        }
コード例 #18
0
        //custom pager event
        private void pagerLnk_Click(object sender, EventArgs e)
        {
            int        gotopage = 0;
            string     btnId;
            LinkButton lnkbtn = (LinkButton)sender;

            btnId = lnkbtn.ID;

            if (btnId == "lnkPrev")
            {
                gotopage = 0;
            }
            else if (btnId == "lnkNext")
            {
                gotopage = dgAdminReport.PageCount - 1;
            }
            else if (PageUtil.IsInteger(this.ViewState[btnId].ToString()))
            {
                gotopage = int.Parse(this.ViewState[btnId].ToString()) - 1;
            }
            setCurrentPageOnPaging(gotopage);
        }
コード例 #19
0
ファイル: StorageManager.aspx.cs プロジェクト: aomiit/caisis
    private void SetBoxItems(string containerId)
    {
        ContainerId.Value = containerId;
        BoxId.Value       = string.Empty;
        if (PageUtil.IsInteger(containerId))
        {
            int _containerId = int.Parse(containerId);

            //SpecimenBox b = new SpecimenBox();
            //b.GetByParent(_containerId);
            //if (b.RecordCount > 0)
            DataView view = BusinessObject.GetByParentAsDataView <SpecimenBox>(_containerId);
            if (view.Count > 0)
            {
                //RptBoxes.DataSource = b.DataSourceView;
                RptBoxes.DataSource = view;
                RptBoxes.DataBind();
            }
            else
            {
                RptBoxes.DataBind();
            }
        }
    }
コード例 #20
0
    protected void TreeNode_Populate(Object sender, TreeNodeEventArgs e)
    {
        int sectionId         = Int32.Parse(e.Node.Value);
        PatientEducationDa da = new PatientEducationDa();
        DataTable          dt = da.GetTopicsBySection(sectionId);

        List <string> subTopicIds    = new List <string>();
        DataTable     profilePartsDt = new DataTable();
        DataTable     subTopicTable  = new DataTable();

        string loadDocType = "";

        // inside the loop we will want to check off boxes based on a profile or default doc
        if (ProfileId > 0)
        {
            profilePartsDt = da.GetProfileDocPartsByProfileId(ProfileId);
            loadDocType    = "UserProfile";
        }
        else if (PageUtil.IsInteger(_packetId.Value))
        {
            // check off subtopics based on active packet
            subTopicTable   = da.GetDiseaseVisitSubTopicByPacket(int.Parse(_packetId.Value));
            loadDocType     = "DefaultPacket";
            PacketName.Text = _packetName.Value;
        }

        // get subtopics by topic
        foreach (DataRow row in dt.Rows)
        {
            string   topicName = row[PatientEdTopic.TopicName].ToString();
            TreeNode topicNode = new TreeNode("<span onclick='return false;' style='cursor:default;'>" + topicName + "</span>", row[PatientEdTopic.TopicId].ToString());
            topicNode.Expanded     = false;
            topicNode.ToolTip      = topicName;
            topicNode.ImageToolTip = topicName;
            int topicId = Int32.Parse(row[PatientEdTopic.TopicId].ToString());

            DataTable dtSubTopic = da.GetSubTopicsByTopic(topicId);
            foreach (DataRow dr in dtSubTopic.Rows)
            {
                string subTopicId = dr[PatientEdSubTopic.SubTopicId].ToString();
                subTopicIds.Add(subTopicId);

                string   subTopicName = dr[PatientEdSubTopic.SubTopicName].ToString();
                TreeNode subTopicNode = new TreeNode("<span onclick='doNodeCheckboxClick(this);return false;' style='cursor:default;'>" + subTopicName + "</span>", dr[PatientEdSubTopic.SubTopicId].ToString());
                subTopicNode.ToolTip      = subTopicName;
                subTopicNode.ImageToolTip = subTopicName;
                subTopicNode.ShowCheckBox = true;

                //Loading an existing profile, so check off boxes if subtopic is part of the profile doc
                if (loadDocType.Equals("UserProfile"))
                {
                    DataRow[] returnedRows = profilePartsDt.Select("SubTopicId = " + subTopicId + "");
                    if (returnedRows.Length > 0)
                    {
                        subTopicNode.Checked = true;
                        topicNode.Expand();
                    }

                    /* previous, less efficient way
                     * foreach (DataRow pdr in profilePartsDt.Rows)
                     *                  {
                     *                          if (subTopicId == pdr[PatientEdProfileDocPart.SubTopicId].ToString())
                     *                          {
                     *                                  subTopicNode.Checked = true;
                     *                                  topicNode.Expand();
                     *                          }
                     *                  }
                     */
                }
                else if (loadDocType.Equals("DefaultPacket"))                //not for a particular patient
                {
                    // if a the subtopic is part of the default packet, check it off
                    DataRow[] foundRows = subTopicTable.Select("SubTopicId = " + subTopicId + "");
                    if (foundRows.Length > 0)
                    {
                        subTopicNode.Checked = true;
                        topicNode.Expand();
                    }

                    /*foreach (DataRow packetRow in subTopicTable.Rows)
                     * {
                     *  if (subTopicId == packetRow[PatientEdDisease_VisitType_SubTopic.SubTopicId].ToString())
                     *  {
                     *      subTopicNode.Checked = true;
                     *      topicNode.Expand();
                     *      break;
                     *  }
                     * }*/

                    /* Try to check off subtopics based on disease ddl and visit type
                     *                  DataTable dST = da.GetDiseaseVisitSubTopicBySubTopic(Int32.Parse(subTopicId));
                     *                  foreach (DataRow r in dST.Rows)
                     *                  {
                     *                          string sVisitTypeId = "";
                     *                          //if (this._visitTypeId != 0)
                     *                          if (VisitTypeId != 0)
                     *                          {
                     *                                  sVisitTypeId = this._visitTypeId.ToString(); //this._visitTypeStage.Value
                     *                          }
                     *
                     *                          if (r[PatientEdDisease_VisitType_SubTopic.DiseaseId].ToString() == this.ddlDiseaseProfile.SelectedValue
                     *                                  && r[PatientEdDisease_VisitType_SubTopic.VisitTypeId].ToString() == sVisitTypeId)
                     *                          {
                     *                                  subTopicNode.Checked = true;
                     *                                  topicNode.Expand();
                     *                                  break;
                     *                          }
                     *                  }
                     */
                }

                topicNode.ChildNodes.Add(subTopicNode);
            }

            topicNode.ShowCheckBox = false;
            e.Node.ChildNodes.Add(topicNode);
        }

        PatientEdUtil.RegisterStartupSubTopicIds(Page, sectionId, subTopicIds);
    }
コード例 #21
0
ファイル: ExceptionHandler.cs プロジェクト: aomiit/caisis
        /// <summary>
        /// Logs the exception to the Caisis database.
        /// </summary>
        /// <param name="ex">The exception to be published.</param>
        public static void WriteToDatabaseLog(Exception ex)
        {
            string ErrUserName = "";

            HttpRequest      req = HttpContext.Current.Request;
            HttpSessionState ses = HttpContext.Current.Session;

            string ErrURL      = req.Url.ToString();
            string ErrFullPath = req.PhysicalPath.ToString();//.Replace("\\",".");

            string ErrFileName = ErrFullPath.Substring(ErrFullPath.LastIndexOf("\\") + 1);

            string ErrQueryString = req.QueryString.ToString();
            string ErrForm        = req.Form.ToString();

            //Remove viewstate and such
            if (ErrForm.Length > 0)
            {
                string[] aErrForm = ErrForm.Split('&');
                ErrForm = "";
                for (int i = 0; i < aErrForm.Length; i++)
                {
                    if (!aErrForm[i].StartsWith("__"))
                    {
                        ErrForm = ErrForm + aErrForm[i] + "&";
                    }
                }
            }

            string ErrBrowser       = req.Browser.Type.ToString() + " (" + req.Browser.Version.ToString() + ")";
            string ErrPlatform      = req.Browser.Platform.ToString();
            string ErrCookies       = req.Browser.Cookies.ToString();
            string ErrJavascript    = req.Browser.JavaScript.ToString() + " (" + req.Browser.EcmaScriptVersion + ")";
            string ErrIP            = req.UserHostAddress.ToString();
            string ErrAuthenticated = req.IsAuthenticated.ToString();
            string ErrHostName      = req.UserHostName;

            // user Roles
            string ErrPermList = "";

            //session info
            string ErrSessionIsNew   = "";
            int    ErrLoginId        = -1;
            int    ErrSessionTimeOut = -1;
            int    ErrPatientId      = -1;
            int    ErrDatasetId      = -1;

            //TODO: Add tab info

            //path after core
            //to show the section

            DateTime?ErrTicketIssueDate  = null;
            DateTime?ErrTicketExpiration = null;

            DateTime ErrorTime = DateTime.Now;

            string ErrMachineName = HttpContext.Current.Server.MachineName;

            string ErrorName     = "";
            string ErrorMessage  = "";
            string ErrStackTrace = "";

            if (HttpContext.Current.User != null)
            {
                ErrUserName = HttpContext.Current.User.Identity.Name;
            }


            if (req.Cookies["dsPerms"] != null)
            {
                ErrPermList = CustomCryptoHelper.EasyDecrypt(req.Cookies["dsPerms"].Value.ToString());
            }
            else
            {
                ErrPermList = "User permissions cookie does not exist.";
            }

            if (ses != null)
            {
                ErrSessionIsNew = ses.IsNewSession.ToString();

                if (ses[SessionKey.LoginId] != null)
                {
                    if (PageUtil.IsInteger(ses[SessionKey.LoginId].ToString()))
                    {
                        ErrLoginId = int.Parse(ses[SessionKey.LoginId].ToString());
                    }

                    ErrSessionTimeOut = ses.Timeout;

                    if (ses[SessionKey.PatientId] != null)
                    {
                        if (PageUtil.IsInteger(ses[SessionKey.PatientId].ToString()))
                        {
                            ErrPatientId = int.Parse(ses[SessionKey.PatientId].ToString());
                        }
                    }

                    if (ses[SessionKey.DatasetId] != null)
                    {
                        if (PageUtil.IsInteger(ses[SessionKey.DatasetId].ToString()))
                        {
                            ErrDatasetId = int.Parse(ses[SessionKey.DatasetId].ToString());
                        }
                    }
                }
                else
                {
                    //"User does not have a Session.LoginId."
                }
            }
            else
            {
                //"HttpContext.Current.Session is null. No session information available."
            }


            //cookie info
            if (HttpContext.Current.User != null && HttpContext.Current.User.Identity is FormsIdentity)
            {
                FormsAuthenticationTicket ticket = ((FormsIdentity)HttpContext.Current.User.Identity).Ticket;

                ErrTicketIssueDate  = ticket.IssueDate;
                ErrTicketExpiration = ticket.Expiration;
            }

            if (ex != null)
            {
                ErrorName    = ex.GetType().Name;
                ErrorMessage = ex.Message;
                // ErrStackTrace = ex.StackTrace;
                ErrStackTrace = ex.ToString();
            }

            // log error details to db
            ErrorLogDa elda = new ErrorLogDa();

            elda.LogError(ErrLoginId,
                          ErrDatasetId,
                          ErrPatientId,
                          ErrUserName,
                          ErrURL,
                          ErrFullPath,
                          ErrFileName,
                          ErrForm,
                          ErrQueryString,
                          ErrBrowser,
                          ErrPlatform,
                          ErrJavascript,
                          ErrIP,
                          ErrAuthenticated,
                          ErrHostName,
                          ErrPermList,
                          ErrSessionIsNew,
                          ErrSessionTimeOut,
                          ErrTicketIssueDate,
                          ErrTicketExpiration,
                          ErrorTime,
                          ErrMachineName,
                          ErrorName,
                          ErrorMessage,
                          ErrStackTrace
                          );
        }
コード例 #22
0
        protected void dgEtFieldsAttributes_ItemCommand(Object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
        {
            int    attributeId;
            int    tableId   = int.Parse(ddlTableDefs.SelectedValue);
            string tableName = lblEtTableName.Text;

            MetadataNewDa MNDa = new MetadataNewDa();

            switch (e.CommandName)
            {
            case "Delete":

                attributeId = int.Parse(e.Item.Cells[0].Text);
                MNDa.DeleteAttribute(attributeId);

                break;

            case "SaveAttributes":
                DataGrid dgAttributes = (DataGrid)source;
                foreach (DataGridItem dgi in dgAttributes.Items)
                {
                    if (dgi.ItemType == ListItemType.Item || dgi.ItemType == ListItemType.AlternatingItem)
                    {
                        int          fieldAttributeId = int.Parse(dgi.Cells[0].Text);
                        DropDownList ddl = (DropDownList)dgi.FindControl("attDdlAttributeValue");
                        TextBox      txt = (TextBox)dgi.FindControl("attTxtAttributeValue");
                        string       theValue;
                        if (((TextBox)dgi.FindControl("attTxtAttributeValueCtrlUsed")).Text == "txt")
                        {
                            theValue = txt.Text;
                        }
                        else
                        {
                            theValue = ddl.SelectedValue;
                        }

                        theValue = PageUtil.EscapeSingleQuotesForSql(theValue);
                        MNDa.UpdateAttribute(fieldAttributeId, theValue);
                    }
                }
                TextBox txtNewAttributesList = (TextBox)Page.FindControl("attTxtNewAttributesList");

                string[] atts = txtNewAttributesList.Text.Split(char.Parse("@"));
                for (int k = 0; k < atts.Length; k++)
                {
                    string[] anAtt = atts[k].Split(char.Parse(";"));
                    if (anAtt.Length == 3 && PageUtil.IsInteger(anAtt[0]) && PageUtil.IsInteger(anAtt[1]))
                    {
                        string attValue = PageUtil.EscapeSingleQuotesForSql(anAtt[2]);

                        MNDa.DeleteAttribute(int.Parse(anAtt[0]), int.Parse(anAtt[1]));
                        MNDa.AddAttribute(int.Parse(anAtt[0]), int.Parse(anAtt[1]), attValue);
                    }
                }
                txtNewAttributesList.Text = "";
                break;
            }
            viewMode = "editTable";
            setViewMode();
            updateEditTableView(tableId, tableName);
        }
コード例 #23
0
        protected void dgEtFields_ItemCommand(Object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
        {
            bool isVirtual;
            bool fieldSuppress;
            int  fieldOrder;
            int  fieldId;

            try
            {
                fieldId = int.Parse(e.Item.Cells[1].Text);
            }
            catch
            {
                fieldId = -1;
            }
            int           tableId   = int.Parse(ddlTableDefs.SelectedValue);
            string        tableName = lblEtTableName.Text;
            MetadataNewDa MNDa      = new MetadataNewDa();

            switch (e.CommandName)
            {
            case "Expand":
                viewMode = "editTable";
                setViewMode();

                PlaceHolder exp;
                exp         = e.Item.Cells[2].FindControl("Expanded") as PlaceHolder;
                exp.Visible = !exp.Visible;
                break;

            case "Edit":
                string fieldName     = ((TextBox)e.Item.Cells[2].Controls[1]).Text;
                string fieldDataType = ((DropDownList)e.Item.Cells[3].Controls[1]).SelectedValue;
                fieldSuppress = ((CheckBox)e.Item.Cells[5].Controls[1]).Checked;
                isVirtual     = ((CheckBox)e.Item.Cells[4].Controls[1]).Checked;
                try
                {
                    fieldOrder = int.Parse(((DropDownList)e.Item.Cells[6].Controls[1]).SelectedValue);
                }
                catch
                {
                    fieldOrder = -1;
                }
                viewMode = "editTable";
                setViewMode();


                DataRow fieldDr            = MNDa.GetMetadataField(fieldId);
                int     previousFieldOrder = -1;

                if (fieldDr[BOL.MetadataField.FieldOrder] != null && PageUtil.IsInteger(fieldDr[BOL.MetadataField.FieldOrder].ToString()))
                {
                    previousFieldOrder = (int)fieldDr[BOL.MetadataField.FieldOrder];
                }


                // This call updates the field order correctly
                MNDa.UpdateMetaField(fieldId, fieldName, fieldDataType, fieldSuppress, fieldOrder);

                // Resequence fields
                this.UpdateFieldOrders(fieldOrder, previousFieldOrder, tableId, fieldId, fieldSuppress);

                if (isVirtual)
                {
                    // refresh virtual field map
                    //Caisis.BOL.BusinessObjectFactory.RebuildVirtualFieldMap();
                    Caisis.BOL.BusinessObject.RebuildVirtualFields();
                }

                updateEditTableView(tableId, tableName);
                break;

            case "Delete":
                bool okToDelete = true;
                isVirtual = ((CheckBox)e.Item.Cells[4].Controls[1]).Checked;
                fieldId   = int.Parse(e.Item.Cells[1].Text);

                if (isVirtual)
                {
                    okToDelete = !MNDa.VirtualMetaFieldHasSavedData(fieldId);
                }
                if (okToDelete)
                {
                    viewMode = "editTable";
                    setViewMode();

                    MNDa.DeleteMetaField(fieldId);

                    if (isVirtual)
                    {
                        // refresh virtual field map
                        //Caisis.BOL.BusinessObjectFactory.RebuildVirtualFieldMap();
                        Caisis.BOL.BusinessObject.RebuildVirtualFields();
                    }

                    //MNDa.MetaFieldOrderRenumber(tableId);
                    updateEditTableView(tableId, tableName);
                }
                else
                {
                    viewMode = "errorMessage";
                    setViewMode();
                    lblErrorHeading.Text = "Could not delete virtual meta field";
                    lblErrorMessage.Text = "The selected virtual meta field has data saved in virtual table. The virtual meta field was not deleted.";
                }
                break;

            case "AddNewField":
                TextBox      efTxtNewVirtualField;
                DropDownList efDdlNewVirtualFieldDataType;
                CheckBox     efCbxNewFieldIsVirtual;
                CheckBox     efCbxNewFieldSuppress;
                DropDownList efDdlNewFieldOrder;

                efTxtNewVirtualField         = (TextBox)e.Item.FindControl("efTxtNewVirtualField");
                efDdlNewVirtualFieldDataType = (DropDownList)e.Item.FindControl("efDdlNewVirtualFieldDataType");
                efCbxNewFieldIsVirtual       = (CheckBox)e.Item.FindControl("efCbxNewFieldIsVirtual");
                efCbxNewFieldSuppress        = (CheckBox)e.Item.FindControl("efCbxNewFieldSuppress");
                efDdlNewFieldOrder           = (DropDownList)e.Item.FindControl("efDdlNewFieldOrder");

                string newFieldName = efTxtNewVirtualField.Text;
                string dataType     = efDdlNewVirtualFieldDataType.SelectedValue;
                fieldSuppress = ((CheckBox)e.Item.Cells[5].Controls[1]).Checked;
                string strFieldOrder = ((DropDownList)e.Item.Cells[6].Controls[1]).SelectedValue;
                fieldOrder = -1;
                try
                {
                    fieldOrder = int.Parse(((DropDownList)e.Item.Cells[6].Controls[1]).SelectedValue);
                }
                catch {};
                if (fieldOrder > -1)
                {
                    fieldId = MNDa.AddMetaField(tableId, newFieldName, dataType, -1, true, fieldSuppress, fieldOrder);
                    MNDa.MetaFieldOrderRenumber(tableId);
                }
                else
                {
                    fieldId = MNDa.AddMetaField(tableId, newFieldName, dataType, -1, true, fieldSuppress);
                }

                // refresh virtual field map
                //Caisis.BOL.BusinessObjectFactory.RebuildVirtualFieldMap();
                Caisis.BOL.BusinessObject.RebuildVirtualFields();

                viewMode = "editTable";
                setViewMode();
                updateEditTableView(tableId, tableName);
                break;

            case "AddNewFieldCancel":
                viewMode = "editTable";
                setViewMode();
                updateEditTableView(tableId, tableName);
                break;
            }
        }
コード例 #24
0
ファイル: BreastSurvey.ascx.cs プロジェクト: aomiit/caisis
        /// <summary>
        /// Populate the Patient's Procedure details
        /// </summary>
        /// <param name="panel"></param>
        /// <param name="patientId"></param>
        protected void BuildProcesureDetails(Control panel, int patientId)
        {
            Patient patient = new Patient();

            patient.Get(patientId);
            // procedure
            var allProcedures = BusinessObject.GetByFields <Procedure>(new Dictionary <string, object> {
                { Procedure.PatientId, patientId }
            });
            // filter procedures by CPT Codes
            var procedures = from procedure in allProcedures
                             let procName = procedure[Procedure.ProcName].ToString()
                                            let cptCode = procedure[Procedure.ProcCPT_Code].ToString()
                                                          where !string.IsNullOrEmpty(cptCode) && PageUtil.IsInteger(cptCode)
                                                          let cpt = int.Parse(cptCode)
                                                                    where BREASTQ_CPT_CODES.Keys.Contains(cpt)
                                                                    select procedure;

            // procedures
            Label procLabel = panel.FindControl("ProceduresLabel") as Label;

            procLabel.Text = FormatListOutput(Procedure.ProcName, Procedure.ProcDate, procedures.Cast <IBusinessObject>());
            // tox
            var toxicities = BusinessObject.GetByFields <Toxicity>(new Dictionary <string, object> {
                { Toxicity.PatientId, patientId }
            }).Cast <IBusinessObject>();
            Label toxLabel = panel.FindControl("ToxicityLabel") as Label;

            toxLabel.Text = FormatListOutput(Toxicity.ToxName, Toxicity.ToxDate, toxicities);
            // radio
            var radiation = BusinessObject.GetByFields <RadiationTherapy>(new Dictionary <string, object> {
                { RadiationTherapy.PatientId, patientId }
            }).Cast <IBusinessObject>();
            Label radiationLabel = panel.FindControl("RadiationLabel") as Label;

            radiationLabel.Text = FormatListOutput(RadiationTherapy.RadTxType, RadiationTherapy.RadTxDate, radiation);
            // chemo
            var chemo = BusinessObject.GetByFields <MedicalTherapy>(new Dictionary <string, object> {
                { MedicalTherapy.PatientId, patientId }, { MedicalTherapy.MedTxType, "CHEMO" }
            }).Cast <IBusinessObject>();
            Label chemoLabel = panel.FindControl("ChemotherapyLabel") as Label;

            chemoLabel.Text = FormatListOutput(MedicalTherapy.MedTxAgent, MedicalTherapy.MedTxDate, chemo);
        }
コード例 #25
0
        /// <summary>
        /// Builds a list of available MetadataTables
        /// </summary>
        protected override void PopulateAttributeValues()
        {
            if (tableId.HasValue)
            {
                // populate main table attributes
                PopulateTableAttributes();

                // populate table field attributes
                MetadataDa da = new MetadataDa();
                DataTable  dt = da.GetFieldMetadata(tableId.Value, QueryDiseaseId);

                // build a list of unique metadata tables with there associated metadata
                var tableToAttributes = from row in dt.AsEnumerable()
                                        let fieldId = (int)row[MetadataField.FieldId]
                                                      group row by fieldId into groupByField
                                                      let filedName = groupByField.First()[MetadataField.FieldName].ToString()
                                                                      let fieldOrderMetadata = from record in groupByField
                                                                                               let attributeName = record[MetadataFieldAttribute.AttributeName].ToString()
                                                                                                                   let attributeValue = record[MetadataFieldAttributeValue.AttributeValue].ToString()
                                                                                                                                        // filter by FieldOrder attribute
                                                                                                                                        where attributeName.Equals(MetadataField.FieldOrder, StringComparison.OrdinalIgnoreCase) && PageUtil.IsInteger(attributeValue)
                                                                                                                                        // filter by disease (or defaul=NULL)
                                                                                                                                        where (!QueryDiseaseId.HasValue && record.IsNull(Disease.DiseaseId)) || (QueryDiseaseId.HasValue && !record.IsNull(Disease.DiseaseId))
                                                                                                                                        let fieldOrder = int.Parse(attributeValue)
                                                                                                                                                         select fieldOrder
                                                                                                                                                         // sort by field sort order, with null to bottom
                                                                                                                                                         let fieldOrder = fieldOrderMetadata.Count() > 0 ? fieldOrderMetadata.First() : int.MaxValue
                                                                                                                                                         //let sort = !string.IsNullOrEmpty(fieldSort) ? int.Parse(fieldSort) : int.MaxValue
                                                                                                                                                                          orderby fieldOrder ascending, filedName ascending
                    select new
                {
                    TableId    = tableId,
                    FieldId    = groupByField.Key,
                    FieldName  = filedName,
                    FieldOrder = fieldOrder,
                    //FieldSuppress = false,
                    Data = groupByField,
                    DiseaseAttributes = from record in groupByField
                                        where !record.IsNull(DiseaseAttributeValue.DiseaseAttributeValueId)
                                        select record
                };
                MetadataGrid.DataSource = tableToAttributes;
                MetadataGrid.DataBind();

                // build fields without metadata
                MetadataTable biz = new MetadataTable();
                biz.Get(tableId.Value);

                MetadataNewDa MNDa = new MetadataNewDa();
                DataTable     cols = MNDa.GetTableColumns(tableId.Value, biz[MetadataTable.TableName_Field].ToString());
                // build a list of actual fields not yet assigned metadata
                var nonMetadataFields = from row in cols.AsEnumerable()
                                        select new
                {
                    COLUMN_NAME  = row["COLUMN_NAME"].ToString(),
                    DATA_TYPE    = row["DATA_TYPE"].ToString(),
                    CHAR_MAX_LEN = row["CHAR_MAX_LEN"].ToString(),
                    IS_VIRTUAL   = false
                };
                // build blank rows for new virtual fields
                var blankVirtualFields = from i in Enumerable.Range(0, 1)
                                         select new
                {
                    COLUMN_NAME  = string.Empty,
                    DATA_TYPE    = string.Empty,
                    CHAR_MAX_LEN = string.Empty,
                    IS_VIRTUAL   = true
                };
                var dataSource = nonMetadataFields.Concat(blankVirtualFields);
                NonMetadataFields.DataSource = dataSource;
                NonMetadataFields.DataBind();
            }
        }
コード例 #26
0
ファイル: Login.aspx.cs プロジェクト: aomiit/caisis
        /// <summary>
        /// If login url contains datasetId and page name then validate and redirect, otherwise continue on to default splash page
        /// Only works for eforms at the moment; easily generalized
        /// </summary>
        private void RedirectUser()
        {
            //http://localhost/dev4/Login.aspx?redirect=%2fdev4%2fCore%2fEforms%2fIndex.aspx%3feform%3dUro+Pros+FU&status=new&dsId=1&user=admin&epid=791D41350A007063

            if (Request.QueryString["eform"] != null && Request.QueryString["eform"].Length > 0 && Request.QueryString["ptId"] != null && PageUtil.IsInteger(Request.QueryString["ptId"]))
            {
                // need to automatically set purpose, user dataset, and make sure patient is in the dataset
                // reference UserController to SetPermissions and GroupViewCode
                int    loginId     = (int)Session[SessionKey.LoginId];
                string userPurpose = Request.Form["purpose"];
                // int datasetId = int.Parse(Request.QueryString["dsId"]);
                int    patientId = int.Parse(Request.QueryString["ptId"]);
                string eformName = Request.QueryString["eform"];

                // if redirecting to an existing eform, retrive eformId to ensure a new eform will now be created
                string eformId = String.Empty;
                if (Request.QueryString["eformId"] != null)
                {
                    eformId = Request.QueryString["eformId"].ToString();
                }

                int datasetId = 0;

                UserController ct           = new UserController();
                DataSet        userDatasets = ct.GetUserDatasets(userName.Value);
                // DataSet userDatasets = ct.GetUserDatasets();
                PatientController pc    = new PatientController();
                bool isPatientInDataset = false;

                foreach (DataRow dr in userDatasets.Tables[0].Rows)
                {
                    datasetId          = (int)dr[Dataset.DatasetId];
                    isPatientInDataset = pc.IsPatientInDataSet(patientId, datasetId);
                    if (isPatientInDataset)
                    {
                        break;
                    }
                }

                //bool userHasAccessToDataset = ct.VerifyUserAccessToDataset(datasetId);

                if (isPatientInDataset)
                {
                    Session[SessionKey.DatasetId]     = datasetId;
                    Session[SessionKey.GroupViewCode] = ct.SetGroupViewCode(datasetId, userName.Value);
                    // Session[SessionKey.GroupViewCode] = ct.SetGroupViewCode(datasetId);
                    ct.SetPermissions(userPurpose, datasetId, loginId, userName.Value);
                    // ct.SetPermissions(userPurpose, datasetId, loginId);

                    // set session vars for defaulting values when reaching eform
                    if (!string.IsNullOrEmpty(Request.QueryString["apptDate"].ToString()))
                    {
                        // should check that it is a date and culture format
                        Session[SessionKey.CurrentClinicDate] = Request.QueryString["apptDate"].ToString();
                    }
                    if (!string.IsNullOrEmpty(Request.QueryString["surgeon"].ToString()))
                    {
                        Session[SessionKey.CurrentListType] = "Clinic";
                        Session[SessionKey.CurrentListCrit] = Request.QueryString["surgeon"].ToString();
                    }


                    string epid        = CustomCryptoHelper.Encrypt(patientId.ToString());
                    string eformStatus = "new";
                    string baseUrl     = PageUtil.GetBasePath(Request);
                    string referralStr = (Request.QueryString["referral"] != null && Request.QueryString["referral"].ToUpper() == "TRUE") ? "&referral=true&status=Approved" : ("&status=" + eformStatus);

                    string redirectTo = baseUrl + "/Core/Eforms/Index.aspx?eform=" + eformName + "&epid=" + epid + "&eformId=" + eformId + referralStr;
                    // on top of eform name, need to append status=new and the patient epid (does not apply to referrals)

                    Response.Redirect(redirectTo);
                }
                else // we could not determine that this user has access to a dataset with this patient in it display message
                {
                    errorMessage.Text = "The system was unable to automatically direct you to the requested page. Please notify the system admin.";
                }
            }
            else
            {
                // default
                string purpose = Request.Form["purpose"].ToString();
                //Response.Redirect("Core/Utilities/Splash.aspx?login=true&purpose=" + purpose);
                Response.Redirect("Core/Utilities/SetAccessLevel.aspx?login=true&purpose=" + purpose);
            }
        }