public SDTM_New_Variable_Form(SDTM_Domain domain, SDTM_Domain_Form parent)
        {
            InitializeComponent();
            Domain = domain;
            Parent = parent;
            //Populate listbox with unused domains
            using (StreamReader file = File.OpenText("SDTM_Variable_Template.statds"))
            {
                JsonSerializer serializer = new JsonSerializer();
                dt = (DataTable)serializer.Deserialize(file, typeof(DataTable));
                var rows = from row in dt.AsEnumerable()
                           where row.Field<string>("Domain_Prefix") == domain.Domain_Name
                           select row;
                dt = rows.CopyToDataTable();
            }
            foreach (SDTM_Variable variable in domain.Domain_Variables)
            {
                varsInStudy.Add(variable.Variable_Name);
            }
            List<string> allSDTMvariables = dt.AsEnumerable().Select(x => x["Variable_Name"].ToString()).ToList();

            IEnumerable<string> notAlreadyInDomain = allSDTMvariables.Except(varsInStudy).Distinct();
            foreach (string s in notAlreadyInDomain)
            {
                lst_Variables.Items.Add(s);
            }
            //end populate listboxs
            lst_Variables.SetSelected(0, true);
        }
Beispiel #2
0
 private void button1_Click(object sender, EventArgs e)
 {
     var obj = Instance.study.workingSDTM.All_Domains.FirstOrDefault(x => x.Domain_Name == checkedListBox1.SelectedItem.ToString());
     if (obj != null) //Update current record in list
     {
         SDTM_Domain_Form form = new SDTM_Domain_Form(obj);
         form.Show(theDockpanel);
     }
     else
     {
         MessageBox.Show("Must select 1 domain to edit from list");
     }
 }