コード例 #1
0
ファイル: Form2.cs プロジェクト: natz247/FGMIS2
        private void PopulateFields(int activityId)
        {
            Activity0Helper helper    = new Activity0Helper();
            Activity0       activity0 = helper.GetActivityData(2, activityId);
            Activity2       activity  = (Activity2)activity0;


            if (activity != null)
            {
                comboBox1.Text        = activity.Region;
                comboBox2.Text        = activity.Zone;
                textBox1.Text         = activity.Schoolname;
                textBox2.Text         = activity.Clubname;
                comboBox3.Text        = activity.Woreda;
                dateTimePicker1.Value = activity.ActivityDate;
                textBox3.Text         = activity.IssuesRaised;
                textBox4.Text         = activity.AgreedActionPoints;
                textBox7.Text         = activity.FacilitatorName;
                textBox6.Text         = activity.Position;
            }
            List <Participant> participantsList = helper.GetParticpantData(2, activityId);

            for (int i = 0; i < participantsList.Count; i++)
            {
                Participant  participant0 = participantsList[i];
                Participant2 participant  = (Participant2)participant0;
                string       disabled     = "No";
                if (participant.Disabled == 0)
                {
                    disabled = "No";
                }
                else
                {
                    disabled = "Yes";
                }
                string[] row = { dataGridView2.RowCount + "", participant.Name, participant.Gradelevel, participant.Sex, participant.Age.ToString(), disabled };
                dataGridView2.Rows.Add(row);
            }
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: brajpanda/EverestPoC
        private static Observation MakeObservation(string section)
        {
            Observation o = new Observation();

            if (section == "ALLERGIES")
            {
                //It automatically adds class code
                o.MoodCode = new CS<x_ActMoodDocumentObservation>(x_ActMoodDocumentObservation.Eventoccurrence);
                o.TemplateId = new LIST<II>();
                o.TemplateId.Add(new II("2.16.840.1.113883.10.20.22.4.7"));
                o.Id = new SET<II>(new II(new Guid()));
                o.Code = new CD<string>(
                    "ASSERTION",
                    "2.16.840.1.113883.5.4",
                    null,
                    null,
                    null,
                    null);
                o.StatusCode = new CS<ActStatus>(ActStatus.Completed);
                o.EffectiveTime = new IVL<TS>(new TS());
                o.EffectiveTime.Low = new TS(DateTime.Now);
                o.EffectiveTime.Low.NullFlavor = new CS<NullFlavor>(NullFlavor.Unknown);

                o.Value = new CD<string>(
                    "416098002",
                    "2.16.840.1.113883.6.96",
                    "SNOMED CT",
                    null,
                    "drug allergy",
                    new ED(new TEL("#allergy1")));

                Participant2 participant2 = new Participant2();
                participant2.TypeCode = new CS<ParticipationType>(ParticipationType.Consumable);
                participant2.ParticipantRole = new ParticipantRole();
                participant2.ParticipantRole.ClassCode = new CS<string>("MANU");
                PlayingEntity pe = new PlayingEntity(null,
                    new CE<string>("70618", "2.16.840.1.113883.6.88", "RxNorm", null, "Penicillin", null),
                    null,
                    null,
                    null);
                pe.Code.OriginalText = new ED();
                pe.Code.OriginalText.Reference = new TEL("#allergy1");
                pe.ClassCode = new CS<EntityClassRoot>(new EntityClassRoot());

                participant2.ParticipantRole.SetPlayingEntityChoice(pe);
                o.Participant.Add(participant2);

                o.EntryRelationship = new List<EntryRelationship>();
                EntryRelationship er = new EntryRelationship();
                er.TypeCode = new CS<x_ActRelationshipEntryRelationship>(x_ActRelationshipEntryRelationship.MFST);
                er.InversionInd = new BL(true);

                Observation obs = new Observation();
                obs.MoodCode = new CS<x_ActMoodDocumentObservation>(x_ActMoodDocumentObservation.Eventoccurrence);
                obs.TemplateId = new LIST<II>();
                obs.TemplateId.Add(new II("2.16.840.1.113883.10.20.22.4.8"));
                obs.Code = new CD<string>("SEV", "2.16.840.1.113883.5.4", "ActCode", null, null, null);
                obs.Text = new ED();
                obs.Text.Reference = new TEL("#allergy1");
                obs.StatusCode = new CS<ActStatus>();
                obs.StatusCode.Code = new MARC.Everest.DataTypes.Primitives.CodeValue<ActStatus>(ActStatus.Completed);
                obs.Value = new CD<string>(
                    "6736007",
                    "2.16.840.1.113883.6.96",
                    "SNOMED CT",
                    null,
                    "moderate",
                    null);

                er.SetClinicalStatement(obs);
                o.EntryRelationship.Add(er);
            }

            if (section == "SOCIAL HISTORY")
            {
                //It automatically adds class code
                o.MoodCode = new CS<x_ActMoodDocumentObservation>(x_ActMoodDocumentObservation.Eventoccurrence);
                o.TemplateId = new LIST<II>();
                o.TemplateId.Add(new II("2.16.840.1.113883.10.20.22.4.78"));
                o.Id = new SET<II>(new II(new Guid()));
                o.Code = new CD<string>(
                    "ASSERTION",
                    "2.16.840.1.113883.5.4",
                    null,
                    null,
                    null,
                    null);
                o.StatusCode = new CS<ActStatus>(ActStatus.Completed);
                o.EffectiveTime = new IVL<TS>(new TS(DateTime.Now), new TS(DateTime.Now));

                o.Value = new CD<string>(
                    "8517006",
                    "2.16.840.1.113883.6.96",
                    "SNOMED CT",
                    null,
                    "former smoker",
                    null);
            }

            if (section == "PROBLEM LIST")
            {
                //It automatically adds class code
                o.MoodCode = new CS<x_ActMoodDocumentObservation>(x_ActMoodDocumentObservation.Eventoccurrence);
                o.TemplateId = new LIST<II>();
                o.TemplateId.Add(new II("2.16.840.1.113883.10.20.22.4.4"));
                o.Id = new SET<II>(new II(new Guid()));
                o.Code = new CD<string>(
                    "64572001",
                    "2.16.840.1.113883.6.96",
                    "SNOMED CT",
                    null,
                    "Condition",
                    null);
                o.Text = new ED();
                o.Text.Reference = new TEL("#problem1");
                o.StatusCode = new CS<ActStatus>(ActStatus.Completed);
                o.EffectiveTime = new IVL<TS>(new TS(DateTime.Now), null);

                o.Value = new CD<string>(
                    "5962100",
                    "2.16.840.1.113883.6.96",
                    "SNOMED CT",
                    null,
                    "Essential Hypertension",
                    null);
            }

            return o;
        }
コード例 #3
0
ファイル: Form2.cs プロジェクト: natz247/FGMIS2
        private void SaveData(int saveOrUpdate)
        {
            //mainFieldsValid();
            if (mainFieldsValid())
            {
                //MessageBox.Show("All fields valid. Ready to submit data to database.");
                Activity0Helper helper   = new Activity0Helper();
                Activity2       activity = new Activity2();
                //(region, zone, woreda, kebele, activity_date, user_id, facilitator_name, position, localtimestamp, mac)
                activity.Region          = comboBox1.Text;
                activity.Zone            = comboBox2.Text;
                activity.Woreda          = comboBox3.Text;
                activity.Schoolname      = textBox1.Text;
                activity.Clubname        = textBox2.Text;
                activity.ActivityDate    = dateTimePicker1.Value;
                activity.UserId          = Properties.Settings.Default.UID; //change this using property stored id of currently logged in user
                activity.FacilitatorName = textBox7.Text;                   //make name of logged in user available in this field
                activity.Clubleadername  = textBox7.Text;
                activity.Position        = textBox6.Text;
                activity.LocalTimeStamp  = DateTime.Now;
                activity.Mac             = StringCipher.GetMacAddress();

                activity.IssuesRaised       = textBox3.Text;
                activity.AgreedActionPoints = textBox4.Text;


                List <Participant> participantsList = new List <Participant>();
                if (dataGridView2.RowCount > 1)
                {
                    string disabled = "no";
                    for (int i = 0; i < dataGridView2.Rows.Count - 1; i++)//-1 to avoid empty row
                    {
                        Participant2 participant = new Participant2();
                        if (dataGridView2.Rows[i].Cells[1].Value != null)
                        {
                            participant.Name = dataGridView2.Rows[i].Cells[1].Value.ToString();
                        }
                        if (dataGridView2.Rows[i].Cells[2].Value != null)
                        {
                            participant.Gradelevel = dataGridView2.Rows[i].Cells[2].Value.ToString();
                        }
                        if (dataGridView2.Rows[i].Cells[3].Value != null)
                        {
                            participant.Sex = dataGridView2.Rows[i].Cells[3].Value.ToString();
                        }
                        if (dataGridView2.Rows[i].Cells[4].Value != null)
                        {
                            participant.Age = Convert.ToInt32(dataGridView2.Rows[i].Cells[4].Value.ToString());
                        }
                        if (dataGridView2.Rows[i].Cells[5].Value != null)
                        {
                            disabled = dataGridView2.Rows[i].Cells[5].Value.ToString().ToLower();
                            if (disabled.CompareTo("no") == 0)
                            {
                                participant.Disabled = 0;
                            }
                            else
                            {
                                participant.Disabled = 1;
                            }
                        }
                        //participant.Age = 2;
                        participantsList.Add(participant);

                        //MessageBox.Show(dataGridView2.Rows[i].Cells[1].Value.ToString());
                    }
                }
                //MessageBox.Show(activity.Position);
                int id = helper.Insert(2, activity, participantsList);

                if (id > 0)
                {
                    InsertRegionAndKebeleData();
                    //MessageBox.Show("Activity data added successfully!");
                    MessageBox.Show("Activity data added successfully!", "Successfully Addition", MessageBoxButtons.OK, MessageBoxIcon.Information);

                    //check internet connection before syncing data
                    if (saveOrUpdate == 1)//update button clicked
                    {
                        //if (StringCipher.CheckInternet("http://" + Session.Properties.Settings.Default.RemoteDatabaseAddress))
                        SyncData();
                    }
                    //this.Close(); //or Reset fields

                    this.Close();
                }
            }
        }