Exemplo n.º 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;
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Returns a list of user datasets
        /// </summary>
        /// <returns></returns>
        public DataSet GetUserDatasets()
        {
            SecurityController sc = new SecurityController();
            DataSetDa          da = new DataSetDa();

            return(da.GetByUser(sc.GetUserName()));
        }
Exemplo n.º 3
0
        protected override void Page_Load(object sender, System.EventArgs e)
        {
            DataAccess.DataSetDa dsd = new DataSetDa();
            DataSet AllDataSets      = dsd.GetDatasets();
            Dataset pda = new Dataset();

            DataSetsList.DataSource     = AllDataSets;
            DataSetsList.DataTextField  = "DataSetName";
            DataSetsList.DataValueField = "DataSetId";
            DataSetsList.DataBind();
            //ResultsPanel.Visible = false;
            //AddPanel.Visible = true;

            //DataSet dataset = new DataSet();
            //if (Page.IsPostBack && SearchField.Text != "")
            //{
            //    DataSetDa Inst = new DataSetDa();
            //    DataRowCollection InstIds = Inst.GetDatasets().Tables[0].Rows;


            //    Caisis.Controller.SearchController sc = new Caisis.Controller.SearchController();
            //    string search = SearchField.Text;
            //    foreach (DataRow DRow in InstIds)
            //    {
            //        DataSet local;
            //        CacheManager.ResetDatasetSqlCache();
            //        int dsID = int.Parse(DRow[0].ToString());
            //        string datasetSQL = CacheManager.GetDatasetSQL(dsID);
            //        local = sc.FindPatient(search, datasetSQL);
            //        dataset.Merge(local);
            //    }
            //    if (dataset.Tables[0].Rows.Count > 0)
            //    {
            //        AddPanel.Visible = false;
            //        ResultsPanel.Visible = true;
            //        ResultsGrid.DataSource = dataset;
            //        ResultsGrid.DataBind();
            //    }
            //}
            //// Put user code to initialize the page here
            //DataSetDa datasets = new DataSetDa();
            //PatientInstitutionDa pi = new PatientInstitutionDa();
            //PatientInstitution pio = new Caisis.BOL.PatientInstitution();
            //DataRow row = pio.Tables[PatientInstitution.Table_PatientInstitutions].NewRow();
            //DataSet ds = datasets.GetDatasets();
            //DataSetsList.DataSource = ds;
            //DataSetsList.DataTextField = "DatasetName";
            //DataSetsList.DataValueField = "DatasetId";
            //DataSetsList.DataBind();
            //			if (PatientID.Text != "" && DataSetsList.SelectedValue != null)
            //			{
            //				row[PatientInstitution.InstitutionId] = DataSetsList.SelectedValue;
            //				row[PatientInstitution.PatientId] = PatientID.Text;
            //				row[PatientInstitution.EnteredTime] = System.DateTime.Now;
            //
            //				//int i = pi.InsertRecord(row);
            //			}
        }
Exemplo n.º 4
0
        protected void ShowDatasetList()
        {
            RepeaterDiv.Visible      = true;
            AddDatasetsTable.Visible = false;
            XmlPanel.Visible         = false;

            DataSetDa da = new DataSetDa();
            DataSet   ds = da.GetDatasets();

            rptDatasets.DataSource = ds.Tables[0].DefaultView;
            rptDatasets.DataBind();
        }
Exemplo n.º 5
0
        /// <summary>
        /// For the specified dataset, build stats
        /// </summary>
        /// <param name="datasetId"></param>
        private void BuildDataSetStats(int datasetId)
        {
            BOL.Dataset biz = new Caisis.BOL.Dataset();
            biz.Get(datasetId);
            string    datsetsName = biz[BOL.Dataset.DatasetName].ToString();
            string    datasetSql  = CacheManager.GetDatasetSQL(datasetId);
            DataSetDa da          = new DataSetDa();
            DataTable stats       = da.GetDataSetStatsPastYear(datasetSql);
            // create friendly label
            DataColumn displayColumn        = new DataColumn("Label", typeof(string));
            DataColumn displayColumnTooltip = new DataColumn("LabelTooltip", typeof(string));

            stats.Columns.Add(displayColumn);
            stats.Columns.Add(displayColumnTooltip);

            var series = DataSetChart.Series[0];

            series.Name = string.Format("{0}", datsetsName);

            // get max and min values
            var values = from r in stats.AsEnumerable()
                         select(int) r["TotalCount"];

            if (values.Count() > 0)
            {
                double max = values.Max();
                double min = values.Min();
                if (max > 10)
                {
                    int max10    = SmoothInterval(max, 10);
                    int min10    = SmoothInterval(min, 10);
                    int maxValue = max10 > max ? max10 : max10 + 10;
                    int minValue = min10 < min ? min10 : min10 - 10;
                    DataSetChart.ChartAreas["MainArea"].AxisY.Maximum = maxValue;
                    DataSetChart.ChartAreas["MainArea"].AxisY.Minimum = minValue;
                }
            }

            // build chart
            foreach (DataRow row in stats.Rows)
            {
                int    count        = (int)row["Count"];
                int    month        = (int)row["Month"];
                int    displayYear  = (int)row["Year"];
                string displayMonth = new DateTime(displayYear, month, 1).ToString("MMM"); //System.Globalization.DateTimeFormatInfo.CurrentInfo.GetMonthName(month);
                row[displayColumn]        = string.Format("{0} {1}", displayMonth, displayYear);
                row[displayColumnTooltip] = string.Format("{0} {1} : {2} Patient(s) Added", displayMonth, displayYear, count);
            }

            series.Points.DataBind(stats.DefaultView, "Label", "TotalCount", "Tooltip=LabelTooltip, Label=TotalCount");

            DataSetChart.DataBind();
        }
Exemplo n.º 6
0
        public bool VerifyUserAccessToDataset(int datasetId, string userName)
        {
            DataSetDa dsDa = new DataSetDa();
            DataSet   ds   = dsDa.GetByUser(userName);

            if (ds.Tables[0].Rows.Count > 0)
            {
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    if (dr["DatasetId"].ToString().Equals(datasetId.ToString()))
                    {
                        return(true);
                    }
                }
            }
            return(false);
        }
Exemplo n.º 7
0
        override protected void Page_Load(object sender, System.EventArgs e)
        {
            base.Page_Load(sender, e);

            valMsg.Text         = "";
            datasetMessage.Text = "";
            AddBtn.ImageUrl     = "../Images/AdminImages/submit.gif";
            AddBtn.Width        = 65;
            AddBtn.Height       = 21;

            SelectDatasetName.Attributes.Add("onchange", "this.form." + SelectSubmitted.ClientID + ".value = 'true'; this.form.submit();");

            if (Page.IsPostBack)
            {
                //check if form is submitted from select box or to update password
                if (!Request.Form["SelectDatasetName"].Equals("") && Request.Form["SelectSubmitted"] != null && Request.Form["SelectSubmitted"].Equals("true"))
                {
                    this.ShowGroupSelect(int.Parse(Request.Form["SelectDatasetName"]));
                }
            }
            else
            {
                DataSetDa das = new DataSetDa();
                DataSet   ds  = das.GetDatasets();
                SelectDatasetName.DataSource     = ds.Tables[0].DefaultView;
                SelectDatasetName.DataValueField = "DatasetId";
                SelectDatasetName.DataTextField  = "DatasetName";
                SelectDatasetName.DataBind();
                SelectDatasetName.Items.Insert(0, new ListItem(""));

                //SelectDatasetTable.Visible = false;

                //adding new dataset
                if (Request.QueryString["newDataset"] != null && Request.QueryString["newDataset"].Equals("yes"))
                {
                    SelectDatasetName.Value = Request.QueryString["datasetId"];

                    this.ShowGroupSelect(int.Parse(Request.QueryString["datasetId"]));
                }
            }
        }        //end page_load