Example #1
0
        /// <summary>
        /// Returns the SQL string required to retrieve the patient records defined in a patient dataset.  The SQL is only
        /// created on the first attempt, after this the SQL string is stored in cache.
        /// </summary>
        /// <param name="dsId">DataSetId identifying the dataset for which sql is to be retrieved.</param>
        /// <returns>SQL string.</returns>
        public static string GetDatasetSQL(object dsId)
        {
            int datasetId = 0;

            datasetId = (int)dsId;

            string key   = "dataset" + datasetId.ToString();
            Cache  c     = HttpContext.Current.Cache;
            object dsSQL = c.Get(key);

            if (dsSQL != null)
            {
                return((string)dsSQL);
            }
            else
            {
                DataSetController ct = new DataSetController();
                dsSQL = ct.GetDatasetSQL(datasetId);

                string pathToXMLFile = AppDomain.CurrentDomain.BaseDirectory.Replace("/", "\\") + "App_Data\\Datasets.xml";

                CreateCacheDependency(key, dsSQL, DATASET_SQL_REFRESH_TIME, pathToXMLFile);

                return((string)dsSQL);
            }
        }
Example #2
0
        public DataSetView(Action <string> on_closing)
        {
            InitializeComponent();
            StartPosition        = FormStartPosition.CenterScreen;
            _data_set_controller = new DataSetController(this);
            _on_closing          = on_closing;

            tb_data_set_path.ReadOnly = true;
            tb_graph_path.ReadOnly    = true;
        }
Example #3
0
 public PatientScreening()
     : base()
 {
     // set require insitution dataset bool
     this.Init += (o, e) =>
     {
         int datasetId          = int.Parse(Session[SessionKey.DatasetId].ToString());
         DataSetController dsCt = new DataSetController();
         var dataSet            = dsCt.FindDatasetNode(datasetId);
         if (dataSet != null)
         {
             var all = dataSet.SelectSingleNode("dimension[@type='All']");
             if (all == null)
             {
                 var dimensions = dataSet.SelectNodes("dimension[@type='Institution']");
                 // Institutional dataset required
                 hasInstitutionDataset = dimensions.Count > 0;
             }
         }
     };
 }
        protected override void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                if (!string.IsNullOrEmpty(BaseSchemaId))
                {
                    ProtocolSchema biz = new ProtocolSchema();
                    biz.Get(int.Parse(BaseSchemaId));
                    TreatmentArmTitle.Text = biz[ProtocolSchema.ProtocolArmDescription].ToString().ToUpper();
                }
                BuildSchemaPatients();

                // delete via QS
                string queryAction          = Request.QueryString["action"];
                string queryPatientSchemaId = Request.QueryString["patientSchemaId"];
                if (queryAction == "delete" && !string.IsNullOrEmpty(queryPatientSchemaId))
                {
                    int           patientSchemaId = int.Parse(queryPatientSchemaId);
                    PatientSchema ps = new PatientSchema();
                    ps.Get(patientSchemaId);
                    if (!ps.IsEmpty)
                    {
                        string            dataset = CacheManager.GetDatasetSQL(Session[SessionKey.DatasetId]);
                        DataSetController dsc     = new DataSetController();
                        int patientId             = (int)ps[PatientSchema.PatientId];
                        if (dsc.IsPatientInDataset(patientId, dataset))
                        {
                            DeletePatient(patientSchemaId);
                            Response.Redirect("AdminSchemaPatients.aspx?scid=" + BaseSchemaId);
                        }
                    }
                }
            }

            Message.Visible = false;
        }