예제 #1
0
        private async void btnAdd_Click(object sender, EventArgs e)
        {
            if (btnAdd.Text == "Add")
            {
                if (AddValidated())
                {
                    Place place = new Place();
                    place.PlaceOfOrigin = txtPlace.Text;
                    await repository.AddPlaceAsync(place);
                    await LoadPlace();

                    if (frmSettings.addFrom == "Setting")
                    {
                        frmSettings setting = (frmSettings)Application.OpenForms["frmSettings"];
                        await setting.LoadPlace();
                    }

                    if (frmSettings.addFrom == "Checklist")
                    {
                        frmCheckList check = (frmCheckList)Application.OpenForms["frmCheckList"];
                        await check.LoadPlaces();
                    }
                    this.Close();
                }
            }

            if (btnAdd.Text == "Update")
            {
                if (UpdateValidated())
                {
                    Place place = await repository.GetPlaceByIdAsync(frmSettings.placeID);

                    place.PlaceOfOrigin = txtPlace.Text;
                    await repository.UpdatePlaceAsync(place);
                    await LoadPlace();

                    frmSettings setting = (frmSettings)Application.OpenForms["frmSettings"];
                    await setting.LoadPlace();

                    btnAdd.Text = "Add";
                    this.Close();
                }
            }
        }
예제 #2
0
        private async void btnAdd_Click(object sender, EventArgs e)
        {
            if (btnAdd.Text == "Add")
            {
                if (AddValidated())
                {
                    Symptom symptom = new Symptom();
                    symptom.Indication = txtSymptom.Text;
                    await repository.AddSymptomAsync(symptom);
                    await LoadSymptom();

                    if (frmSettings.addFrom == "Setting")
                    {
                        frmSettings setting = (frmSettings)Application.OpenForms["frmSettings"];
                        await setting.LoadSymptom();
                    }
                    if (frmSettings.addFrom == "Checklist")
                    {
                        frmCheckList check = (frmCheckList)Application.OpenForms["frmCheckList"];
                        await check.LoadSymptoms();
                    }

                    this.Close();
                }
            }

            if (btnAdd.Text == "Update")
            {
                if (UpdateValidated())
                {
                    Symptom symptom = await repository.GetSymptomByIdAsync(frmSettings.symptomID);

                    symptom.Indication = txtSymptom.Text;
                    await repository.UpdateSymptomAsync(symptom);
                    await LoadSymptom();

                    frmSettings setting = (frmSettings)Application.OpenForms["frmSettings"];
                    await setting.LoadSymptom();

                    btnAdd.Text = "Add";
                    this.Close();
                }
            }
        }
예제 #3
0
        private async void btnAdd_Click(object sender, EventArgs e)
        {
            if (btnAdd.Text == "Add")
            {
                if (AddValidated())
                {
                    Barangay brgy = new Barangay();
                    brgy.BrgyName = txtBarangay.Text;
                    await repository.AddBarangayAsync(brgy);
                    await LoadBarangay();

                    frmSettings setting = (frmSettings)Application.OpenForms["frmSettings"];
                    await setting.LoadBarangay();

                    this.Close();
                }
            }

            if (btnAdd.Text == "Update")
            {
                if (UpdateValidated())
                {
                    Barangay brgy = await repository.GetBarangayByIdAsync(frmSettings.barangayID);

                    brgy.BrgyName = txtBarangay.Text;
                    await repository.UpdateBarangayAsync(brgy);
                    await LoadBarangay();

                    frmSettings setting = (frmSettings)Application.OpenForms["frmSettings"];
                    await setting.LoadBarangay();

                    btnAdd.Text = "Add";
                    this.Close();
                }
            }
        }