コード例 #1
0
        private void createCaseButton_Click(object sender, EventArgs e)
        {
            if (_dumbcheck < 2 || noOfJurorsTextBox.Text == "" || caseNameTextbox.Text == "")
            {
                MessageBox.Show(this, "Please Fill in the Case Name and Number of Jurors",
                                "Not All Informatin Given", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            else
            {
                List <Info> i = new List <Info>();
                foreach (CheckBox cb in checkboxes)
                {
                    if (cb.Checked)
                    {
                        i.Add(new Info(cb.Text));
                    }
                }
                Case     theCase     = new Case(caseNameTextbox.Text, Convert.ToInt32(noOfJurorsTextBox.Text));
                CaseForm theCaseForm = new CaseForm(theCase, i);
                theCaseForm.Location      = Location;
                theCaseForm.Size          = Size;
                theCaseForm.StartPosition = FormStartPosition.WindowsDefaultLocation;
                this.Hide();
                theCaseForm.Show();
            }
        }
コード例 #2
0
        private void loadCaseButton_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.InitialDirectory = System.Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\JurySelectionHelper";
            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                Case     theCase     = new Case(openFileDialog.FileName);
                CaseForm theCaseForm = new CaseForm(theCase, null);
                theCaseForm.Location      = Location;
                theCaseForm.Size          = Size;
                theCaseForm.StartPosition = FormStartPosition.WindowsDefaultLocation;
                this.Hide();
                theCaseForm.Show();
            }
        }
コード例 #3
0
        private XElement RebuildCaseRecords()
        {
            XElement newData = new XElement("Data");

            XElement oldData = CaseForm.Element("Data");

            Dictionary <string, XElement> recordDictionary = new Dictionary <string, XElement>();

            foreach (XElement record in oldData.Elements("Record"))
            {
                string guid = record.Attribute("Id").Value;

                if (recordDictionary.ContainsKey(guid))
                {
                    foreach (XElement field in record.Elements())
                    {
                        recordDictionary[guid].Add(new XElement(field.Name, field.Value));
                    }
                }
                else
                {
                    XElement newElement = new XElement("Record");

                    newElement.Add(new XAttribute("Id", guid),
                                   new XAttribute("FKEY", record.Attribute("FKEY").Value),
                                   new XAttribute("FirstSaveUserId", record.Attribute("FirstSaveUserId").Value),
                                   new XAttribute("LastSaveUserId", record.Attribute("LastSaveUserId").Value),
                                   new XAttribute("FirstSaveTime", record.Attribute("FirstSaveTime").Value),
                                   new XAttribute("LastSaveTime", record.Attribute("LastSaveTime").Value),
                                   new XAttribute("RecStatus", record.Attribute("RecStatus").Value));

                    foreach (XElement field in record.Elements())
                    {
                        newElement.Add(new XElement(field.Name, field.Value));
                    }

                    recordDictionary.Add(guid, newElement);
                }
            }

            foreach (KeyValuePair <string, XElement> kvp in recordDictionary)
            {
                newData.Add(kvp.Value);
            }

            return(newData);
        }
コード例 #4
0
        /// <summary>
        /// 获取单个表单(定义/实例)
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="isCase"></param>
        /// <param name="masterID"></param>
        /// <param name="formID"></param>
        /// <returns></returns>
        public T GetForm <T>(int isCase, Guid masterID, Guid formID)
        {
            IForm  former = null;
            object form   = null;

            if (isCase == 1)
            {
                former = new CaseForm();
                form   = former.GetForm(formID);
            }
            else if (isCase == 0)
            {
                former = new RepoForm();
                form   = former.GetForm(formID);
            }
            return((T)form);
        }
コード例 #5
0
        public void LoadSyncFile(XElement doc)
        {
            SyncFile = doc;

            SourceDatabase = String.Empty;

            if (doc.Attribute("SourceDbType") != null)
            {
                SourceDatabase = doc.Attribute("SourceDbType").Value;
            }
            if (doc.Attribute("CreatedDate") != null)
            {
                DateGenerated = doc.Attribute("CreatedDate").Value;
            }
            if (doc.Attribute("CreatedUtc") != null)
            {
                DateGeneratedUtc = doc.Attribute("CreatedUtc").Value;
            }
            if (doc.Attribute("Version") != null)
            {
                EpiVersion = doc.Attribute("Version").Value;
            }
            if (doc.Attribute("VhfVersion") != null)
            {
                VhfVersion = doc.Attribute("VhfVersion").Value;
            }
            if (doc.Attribute("Id") != null)
            {
                FileID = doc.Attribute("Id").Value;
            }
            if (doc.Attribute("Region") != null)
            {
                Region = doc.Attribute("Region").Value;
            }

            if (doc.Attribute("StartDate") != null)
            {
                StartDate = doc.Attribute("StartDate").Value;
            }
            if (doc.Attribute("EndDate") != null)
            {
                EndDate = doc.Attribute("EndDate").Value;
            }

            foreach (XElement element in doc.Elements("Form"))
            {
                if (element.Attribute("Name").Value.Equals("CaseInformationForm", StringComparison.OrdinalIgnoreCase))
                {
                    CaseForm = element;

                    // because sync files created from MDB-based projects have <record>s broken up by page it's necessary to rebuild them here

                    if (SyncFile.Attribute("SourceDbType") != null && SyncFile.Attribute("SourceDbType").Value.Equals("Access"))
                    {
                        CaseData = RebuildCaseRecords();
                    }
                    else
                    {
                        CaseData = CaseForm.Element("Data");
                    }
                }
                else if (element.Attribute("Name").Value.Equals("ContactEntryForm", StringComparison.OrdinalIgnoreCase))
                {
                    ContactForm = element;
                    ContactData = ContactForm.Element("Data");
                }
                else if (element.Attribute("Name").Value.Equals("LaboratoryResultsForm", StringComparison.OrdinalIgnoreCase))
                {
                    LabForm = element;
                    LabData = LabForm.Element("Data");
                }
            }

            LinksData = doc.Element("Links");

            FollowUpsData = doc.Element("ContactFollowUps");

            AnalysisViewModel = new AnalysisViewModel(SyncFile);
        }