Пример #1
0
        /// <summary>
        /// Build a list of available User Datasets and set optional selected value
        /// </summary>
        /// <param name="datasetId"></param>
        private void BuildUserDatasets(int?datasetId)
        {
            Security.SecurityController sc = new Caisis.Security.SecurityController();
            DataSetDa da       = new DataSetDa();
            DataTable datasets = da.GetByUser(sc.GetUserName()).Tables[0];
            // encrypted datasetid
            DataColumn encDatasetId = new DataColumn("EncDatasetId", typeof(string));

            datasets.Columns.Add(encDatasetId);
            foreach (DataRow row in datasets.Rows)
            {
                row[encDatasetId] = Security.CustomCryptoHelper.Encrypt(row[BOL.Dataset.DatasetId].ToString());
            }

            var datasetsView = datasets.DefaultView;

            datasetsView.Sort       = BOL.Dataset.DatasetName + " ASC";
            UserDataSets.DataSource = datasetsView;
            UserDataSets.DataBind();

            // select current
            if (datasetId.HasValue)
            {
                string currentEncDatasetId = Security.CustomCryptoHelper.Encrypt(datasetId.ToString());
                UserDataSets.SelectedValue = currentEncDatasetId;
            }

            // hide selector on single dataset
            if (datasets.Rows.Count < 2)
            {
                UserDataSets.Visible      = false;
                UserDataSetsLabel.Visible = false;
            }
        }
Пример #2
0
        /// <summary>
        /// Get the active disease view the user is working within
        /// </summary>
        /// <returns></returns>
        public string GetDiseaseView()
        {
            Caisis.Security.SecurityController sc = new Caisis.Security.SecurityController();
            string currentDiseaseView             = sc.GetViewMode();

            return(currentDiseaseView);
        }
Пример #3
0
        private void SetSessionDataset(int datasetId)
        {
            // validate
            Session[SessionKey.DatasetId] = datasetId;
            // get username
            Caisis.Security.SecurityController sc = new Caisis.Security.SecurityController();
            string username = sc.GetUserName();
            // get purpose
            int loginId = int.Parse(Session[SessionKey.LoginId].ToString());
            var udv     = BOL.BusinessObject.GetByFields <BOL.UserDatasetView>(new Dictionary <string, object>
            {
                { BOL.UserDatasetView.UserLoginId, loginId },
                { BOL.UserDatasetView.DatasetId, datasetId }
            });
            string purpose = udv.Count() > 0 ? udv.First()[BOL.UserDatasetView.Purpose].ToString() : "Research";

            // set permission
            UserController _uc = new UserController();

            _uc.SetPermissions(purpose, datasetId, loginId, username);
            // set view code
            Session[SessionKey.GroupViewCode] = _uc.SetGroupViewCode(datasetId);
            // set default view mode
            SetViewMode(datasetId);
        }
Пример #4
0
        protected void UpdateButtonClick(object sender, CommandEventArgs e)
        {
            if (Request.Form["UserPassword"] != null && !Request.Form["UserPassword"].Equals("") && Request.Form["SelectSubmitted"].Equals("false"))
            {
                //update password
                if (ValidateUserPassword(Request.Form["UserPassword"]))
                {
                    int    userId = int.Parse(Request.Form["SelectUserName"]);
                    string pswd   = Request.Form["UserPassword"];

                    string hashedPassword = FormsAuthentication.HashPasswordForStoringInConfigFile(pswd, "MD5");
                    Caisis.Security.SecurityController sc = new Caisis.Security.SecurityController();
                    UserDa da = new UserDa();
                    da.UpdateUserPassword(userId, hashedPassword, sc.GetUserName());
                    // no need to email user if using ldap
                    if (UseLDAP)
                    {
                        valMsg.Text = "User Password has been updated.<br /> <a href=\"AdminUpdatePassword.aspx\">Update Another User?</a>";
                    }
                    else
                    {
                        valMsg.Text = "User Password has been updated. Would like to email it to them? <a href=\"AdminEmailUser.aspx?userId=" + userId + "&pswd=" + pswd + "\">Yes</a>&nbsp;&nbsp;&nbsp;<a href=\"AdminUpdatePassword.aspx\">No</a>";
                    }
                }
            }
        }
Пример #5
0
        protected void FixSinglePatientSchedule(object sender, CommandEventArgs e)
        {
            int patientSchemaId = int.Parse(e.CommandArgument.ToString());

            Caisis.Security.SecurityController sc = new Caisis.Security.SecurityController();
            string username = sc.GetUserName();

            // fix schedule
            FixPatientSchedule(patientSchemaId, username);
        }
Пример #6
0
        protected void FixAllPatientSchedules(object sender, EventArgs e)
        {
            int protocolSchemaId = int.Parse(BaseSchemaId);

            Caisis.Security.SecurityController sc = new Caisis.Security.SecurityController();
            string username = sc.GetUserName();

            FixEverything(protocolSchemaId, username);
            Message.Visible = true;
        }
Пример #7
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected override void Page_Load(object sender, EventArgs e)
        {
            base.Page_Load(sender, e);

            if (!Page.IsPostBack)
            {
                DataView projectsList = new DataView();
                // If filtering by user, determine which project a user belongs
                if (FilterByUser)
                {
                    ProjectManagementDa da = new ProjectManagementDa();
                    string uName           = new Caisis.Security.SecurityController().GetUserName();
                    UserDa uda             = new UserDa();
                    int    uId             = uda.GetUserId(uName);
                    projectsList = da.GetAllProjectsByUserId(uId).DefaultView;
                }
                // Else, user has access to all projects
                else
                {
                    //Project biz = new Project();
                    if (String.IsNullOrEmpty(OrganizationId) || OrganizationId.Equals("-1"))
                    {
                        //biz.GetAll();
                        //projectsList = biz.DataSourceView;
                        projectsList = BusinessObject.GetAllAsDataView <Project>();
                    }
                    else
                    {
                        ProjectManagementDa da = new ProjectManagementDa();
                        projectsList = da.GetAllProjectsForOrg(Int32.Parse(OrganizationId)).DefaultView;
                    }
                }
                // Force default sort to earliest records first
                //projectsList.Sort = Project.ProjectId + " ASC";

                // default sort
                projectsList.Sort = "Title";

                // SORTING DISABLED
                recordCount = projectsList.Count;

                // Bind projects to user's view
                BindProjectList(projectsList);
            }
        }
Пример #8
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void HandleSurveyUpdated(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(SurveyIdField.Value))
            {
                int newPrimaryKey = int.Parse(SurveyIdField.Value);
                int itemid        = int.Parse(PatientItemId);
                int patientid     = ProtocolMgmtDa.GetPatientIdByPatientItemId(itemid);

                Caisis.Security.SecurityController sc = new Caisis.Security.SecurityController();
                string username = sc.GetUserName();
                Dictionary <string, IEnumerable <int> > updateKeys = new Dictionary <string, IEnumerable <int> >();
                updateKeys.Add(new Survey().TableName, new int[] { newPrimaryKey });
                ProtocolMgmtDa.UpdateProtocolMgrPatientFieldsWithPKey(itemid, updateKeys, username);
                //Reload new request
                string encryptedItemId = EncryptValue(PatientItemId);
                GoToPage(encryptedItemId);
            }
        }
Пример #9
0
        /// <summary>
        /// Renders the CusotmMenu Control to the specified HtmlTextWriter
        /// </summary>
        /// <param name="output">Output writer</param>
        protected override void Render(HtmlTextWriter output)
        {
            EnsureDataBindings(this.Controls);
            this.EnableViewState = false;
            MenuList menu;
            string   viewMode = new Caisis.Security.SecurityController().GetViewMode();

            // special case
            if (!string.IsNullOrEmpty(CaisisConfigurationType) && CaisisConfigurationType == "PatientDataEntryConfig")
            {
                xDoc = CaisisConfiguration.GetPatientDataConfig();
                menu = LoadMenusFromXml();
            }
            else
            {
                xDoc.Load(this.MapPathSecure(this.XMLMenuFile));
                if (CacheManager.IsInCache(this.XMLMenuFile + "XmlDoc") && CacheManager.IsInCache(this.XMLMenuFile + viewMode))
                {
                    XmlDocument cachedXml = (XmlDocument)CacheManager.GetFromCache(this.XMLMenuFile + "XmlDoc");
                    if (xDoc.InnerXml == cachedXml.InnerXml)
                    {
                        menu = (MenuList)CacheManager.GetFromCache(this.XMLMenuFile + viewMode);
                    }
                    else
                    {
                        menu = LoadMenusFromXml();
                        CacheManager.InsertIntoCache(this.XMLMenuFile + viewMode, menu, 10);
                        CacheManager.InsertIntoCache(this.XMLMenuFile + "XmlDoc", xDoc, 10);
                    }
                }
                else
                {
                    menu = LoadMenusFromXml();
                    CacheManager.InsertIntoCache(this.XMLMenuFile + viewMode, menu, 10);
                    CacheManager.InsertIntoCache(this.XMLMenuFile + "XmlDoc", xDoc, 10);
                }
            }
            menu.RenderControl(output);
            Literal l = new Literal();

            l.Text = "<script type='text/javascript' language='javascript'>if(InitMenu) { InitMenu(); }</script>";
            l.RenderControl(output);
        }
Пример #10
0
        /// <summary>
        ///
        /// </summary>
        private void UpdatePatientItemFields()
        {
            if (itemEntryControl != null)
            {
                int itemid    = int.Parse(PatientItemId);
                int patientid = ProtocolMgmtDa.GetPatientIdByPatientItemId(itemid);

                // save patient items
                var updatedTableKeys = itemEntryControl.Save();

                // update survey plugin key
                HandleSurveyPlugin(updatedTableKeys);

                // update patient item fields
                Caisis.Security.SecurityController sc = new Caisis.Security.SecurityController();
                string username = sc.GetUserName();
                ProtocolMgmtDa.UpdateProtocolMgrPatientFieldsWithPKey(itemid, updatedTableKeys, username);

                //ProtocolMgmtDa.UpdateProtocolMgrPatientFieldsWithPKey(itemid, newPrimaryKey);
            }
        }
Пример #11
0
        /// <summary>
        /// Gets the table of search results
        /// </summary>
        /// <returns></returns>
        public HtmlGenericControl GetCallbackResult()
        {
            ProjectManagementDa da = new ProjectManagementDa();

            // Determine if need to filter by user id
            DataView projectsList = new DataView();

            if (FilterByUser)
            {
                string uName = new Caisis.Security.SecurityController().GetUserName();
                UserDa uda   = new UserDa();
                int    uId   = uda.GetUserId(uName);

                projectsList = da.ProjectMgmtSearch(callbackSearchValue, uId).DefaultView;
            }
            else
            {
                projectsList = da.ProjectMgmtSearch(callbackSearchValue).DefaultView;
            }

            BindProjectList(projectsList);

            return(ContentTableHolder);
        }
Пример #12
0
        protected void DeleteSchemaItemRow(object sender, CommandEventArgs e)
        {
            Button   btn                 = sender as Button;
            int      schemaItemId        = int.Parse(e.CommandArgument.ToString());
            Repeater schemaItemFieldRptr = btn.NamingContainer.FindControl("ChildTableColRptr") as Repeater;

            // step 1: for each schema item field in row, delete
            foreach (RepeaterItem itemField in schemaItemFieldRptr.Items)
            {
                string sifid = (itemField.FindControl("SchemaItemFieldId") as ICaisisInputControl).Value;
                if (!string.IsNullOrEmpty(sifid))
                {
                    int schemaItemFieldId = int.Parse(sifid);
                    ProtocolMgmtDa.DeleteSchemaItemField(schemaItemFieldId);
                }
            }
            // step 2: fix indexes
            string username = new Caisis.Security.SecurityController().GetUserName();

            ProtocolMgmtDa.FixSchemaItemIndexes(schemaItemId, username);
            // step 3: rebuild form
            // TODO: cleaner way of doing
            Response.Redirect(Request.RawUrl);
        }