Example #1
0
        private async void dgvPUM_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (listPUM.Count(x => x.Status == null) != 0)
            {
                if (dgvPUM.Columns[e.ColumnIndex].HeaderText == "Update Status")
                {
                    status   = "PUM";
                    personID = int.Parse(dgvPUM.CurrentRow.Cells[2].Value.ToString());

                    frmPUMstatus obj = new frmPUMstatus();
                    obj.ShowDialog();
                }

                if (dgvPUM.Columns[e.ColumnIndex].HeaderText == "Delete")
                {
                    personID = int.Parse(dgvPUM.CurrentRow.Cells[2].Value.ToString());
                    DialogResult dr = MessageBox.Show("Are you sure to delete selected Person Under Monitoring?", "Warning!", MessageBoxButtons.OKCancel);
                    if (dr == DialogResult.OK)
                    {
                        PUM pum = listPUM.SingleOrDefault(x => x.PersonID == personID);

                        await repository.DeletePUMAsync(pum.ID);

                        await repository.DeletePersonAsync(personID);
                        await LoadPUM();
                    }
                }
            }
        }
        public async Task <PUM> UpdatePUMAsync(PUM pum)
        {
            _db.Entry(pum).State = EntityState.Modified;
            await _db.SaveChangesAsync();

            return(pum);
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="pum"></param>
        /// <returns></returns>
        public async Task <PUM> AddPUMAsync(PUM pum)
        {
            _db.PUMs.Add(pum);
            await _db.SaveChangesAsync();

            return(pum);
        }
        public async Task <PUM> DeletePUMAsync(int id)
        {
            PUM pum = await _db.PUMs.FindAsync(id);

            _db.PUMs.Remove(pum);
            await _db.SaveChangesAsync();

            return(pum);
        }
Example #5
0
        private async void btnUpdate_Click(object sender, EventArgs e)
        {
            PUM pum = listPUM.SingleOrDefault(x => x.PersonID == frmViewPUM.personID);

            pum.Status           = cbPUMstatus.Text;
            pum.StatusUpdateDate = dtpDateUpdated.Value.Date;

            DialogResult dr = MessageBox.Show("Updating the status of " + pum.Person.FirstName + " " + pum.Person.LastName + " to " + cbPUMstatus.Text + ".", "Confirmation!", MessageBoxButtons.OKCancel);

            if (dr == DialogResult.OK)
            {
                await repository.UpdatePUMAsync(pum);

                MessageBox.Show("Status Updated...", "Success!");

                frmViewPUM list = (frmViewPUM)Application.OpenForms["frmListPUM"];
                await list.LoadPUM();

                this.Close();
            }
        }
Example #6
0
    public void FinalDestruction(float delayStep)
    {
        float mem      = delayStep;
        float maxDelay = .0f;

        foreach (RingManager rm in rings)
        {
            //Debug.Log ("final destruction called, segment controllers : " + rm.segmentControlers.Count);
            delayStep = mem;
            foreach (SegmentController sc in rm.segmentControlers)
            {
                StartCoroutine(sc.DestroySegmentAFter(delayStep / rm.segmentControlers.Count));
                delayStep += mem;
                if ((delayStep / rm.segmentControlers.Count) > maxDelay)
                {
                    maxDelay = delayStep / rm.segmentControlers.Count;
                }
            }
        }
        foreach (PowerUpManager PUM in activePowerUps)
        {
            StartCoroutine(PUM.DestroyPowerUpAfter(maxDelay));
        }
    }
Example #7
0
        private async void btnSubmit_Click(object sender, EventArgs e)
        {
            if (AddValidated())
            {
                try
                {
                    Person person = new Person();
                    btnSubmit.Enabled  = false;
                    person.FirstName   = txtFirstName.Text.Trim();
                    person.MiddleName  = txtMiddleName.Text.Trim();
                    person.LastName    = txtLastName.Text.Trim();
                    person.Age         = int.Parse(txtAge.Text);
                    person.Gender      = cbGender.Text;
                    person.CivilStatus = cbCivilStatus.Text;
                    person.Nationality = txtNationality.Text.Trim();
                    person.HouseNo     = txtHouseNo.Text.Trim();
                    person.Street      = txtStreet.Text.Trim();
                    person.BrgyID      = listBarangay.Where(x => x.BrgyName == cbBarangay.Text).Select(x => x.ID).SingleOrDefault();
                    person.Mobile      = txtMobile.Text.Trim();

                    await repository.AddPersonAsync(person);

                    if (lvSymptoms.CheckedItems.Count == 0)
                    {
                        string Places = "";
                        PUM    pum    = new PUM();
                        pum.Bus         = txtBus.Text;
                        pum.PersonID    = person.ID;
                        pum.DateArrived = dtpArrived.Value.Date;
                        pum.Time        = txtTime.Text.Trim();

                        for (int i = 0; i < lvPlaces.CheckedItems.Count; i++)
                        {
                            Places += lvPlaces.CheckedItems[i].SubItems[1].Text + " ";
                        }

                        pum.PlaceOfOrigin = Places;

                        await repository.AddPUMAsync(pum);

                        MessageBox.Show(person.FirstName + " " + person.LastName + " has been added to list of PUMs");
                        FindControls <TextBox>(this).Where(x => x.Text != string.Empty).ToList().ForEach(x => x.Clear());
                        FindControls <ComboBox>(this).Where(x => x.SelectedItem != null).ToList().ForEach(x => x.SelectedItem = null);
                        dtpArrived.Value = DateTime.Today;

                        await LoadPlaces();
                    }

                    else
                    {
                        string symptoms = "";
                        string Places   = "";
                        PUI    pui      = new PUI();
                        pui.PersonID    = person.ID;
                        pui.Bus         = txtBus.Text;
                        pui.DateArrived = dtpArrived.Value.Date;
                        pui.Time        = txtTime.Text.Trim();

                        for (int i = 0; i < lvSymptoms.CheckedItems.Count; i++)
                        {
                            symptoms += lvSymptoms.CheckedItems[i].SubItems[1].Text + " ";
                        }

                        for (int i = 0; i < lvPlaces.CheckedItems.Count; i++)
                        {
                            Places += lvPlaces.CheckedItems[i].SubItems[1].Text + " ";
                        }

                        pui.Symptoms      = symptoms;
                        pui.PlaceOfOrigin = Places;
                        pui.Onset         = dtpOnset.Value.Date;

                        await repository.AddPUIAsync(pui);

                        MessageBox.Show(person.FirstName + " " + person.LastName + " has been added to list of PUIs");
                        FindControls <TextBox>(this).Where(x => x.Text != string.Empty).ToList().ForEach(x => x.Clear());
                        FindControls <ComboBox>(this).Where(x => x.SelectedItem != null).ToList().ForEach(x => x.SelectedItem = null);
                        dtpArrived.Value = DateTime.Today;
                        await LoadPlaces();
                        await LoadSymptoms();
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                }
                btnSubmit.Enabled = true;
            }
        }