private async void dgvPUI_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (listPUI.Count(x => x.Status == null) != 0) { if (dgvPUI.Columns[e.ColumnIndex].HeaderText == "Update Status") { status = "PUI"; personID = int.Parse(dgvPUI.CurrentRow.Cells[2].Value.ToString()); frmPUIstatus obj = new frmPUIstatus(); obj.ShowDialog(); } if (dgvPUI.Columns[e.ColumnIndex].HeaderText == "Delete") { personID = int.Parse(dgvPUI.CurrentRow.Cells[2].Value.ToString()); DialogResult dr = MessageBox.Show("Are you sure to delete selected Person Under Invistigation?", "Warning!", MessageBoxButtons.OKCancel); if (dr == DialogResult.OK) { PUI pui = listPUI.SingleOrDefault(x => x.PersonID == personID); await repository.DeletePUIAsync(personID); await repository.DeletePersonAsync(personID); await LoadPUI(); } } } }
public async Task <PUI> DeletePUIAsync(int id) { PUI pui = await _db.PUIs.FindAsync(id); _db.PUIs.Remove(pui); await _db.SaveChangesAsync(); return(pui); }
private void Init() { stats = PlayerParameters.Instance; m_PInput = gameObject.AddComponent <PInput>(); m_PInput.Init(this); m_PMove = gameObject.AddComponent <PMove>(); m_PMove.Init(this); m_PCamera = gameObject.AddComponent <PCamera>(); m_PCamera.Init(this); m_PShoot = gameObject.AddComponent <PShoot>(); m_PShoot.Init(this); m_PUI = gameObject.AddComponent <PUI>(); m_PUI.Init(this); }
private async void btnUpdate_Click(object sender, EventArgs e) { PUI pui = listPUI.SingleOrDefault(x => x.PersonID == frmViewPUI.personID); pui.Status = cbPUIstatus.Text; pui.StatusUpdateDate = dtpDateUpdated.Value.Date; DialogResult dr = MessageBox.Show("Updating the status of " + pui.Person.FirstName + " " + pui.Person.LastName + " to " + cbPUIstatus.Text + ".", "Confirmation!", MessageBoxButtons.OKCancel); if (dr == DialogResult.OK) { await repository.UpdatePUIAsync(pui); MessageBox.Show("Status Updated...", "Success!"); frmViewPUI list = (frmViewPUI)Application.OpenForms["frmListPUI"]; await list.LoadPUI(); this.Close(); } }
public static ProjectDetailsDto MapToDetailsDto(ProjectDto dto) { return(new ProjectDetailsDto { Id = dto.Id, Active = dto.Active, Description = dto.Description, EndDate = dto.EndDate, IsAccepted = dto.IsAccepted, IsDone = dto.IsDone, IsFixedPrice = dto.IsFixedPrice, Price = dto.Price, ESTdriving = dto.ESTdriving, StartDate = dto.StartDate, Rowversion = dto.Rowversion, CustomerId = dto.CustomerId, Customer = dto.CustomerDto, ProjectDrivings = dto.ProjectDrivingDtos.GroupBy(PD => PD.UnitPrice) .Select(PD => new ProjectDrivingDto { Amount = PD.Sum(a => a.Amount), EmployeeId = PD.First().EmployeeId, Employee = PD.First().Employee, ProjectId = PD.First().ProjectId, UnitPrice = PD.First().UnitPrice }).ToList(), TotalUsedDriving = dto.ProjectDrivingDtos.Sum(UI => UI.Amount * UI.UnitPrice), ProjectEmployees = dto.ProjectEmployeeDtos.GroupBy(PE => PE.Employee.Id) .Select(PE => new ProjectEmployeeDto { EstWorkingHours = PE.Sum(a => a.EstWorkingHours), EmployeeID = PE.First().EmployeeID, Employee = PE.First().Employee, ProjectId = PE.First().ProjectId }).ToList(), TotalAssignedHours = dto.ProjectEmployeeDtos.Sum(PE => (PE.Employee.Type.HourlyPrice + PE.Employee.Specialty.Bonus) * PE.EstWorkingHours), //working hours summed up by employee WorkingHours = dto.WorkingHoursDtos .GroupBy(WH => WH.EmployeeId) .Select(WH => new WorkingHoursDto { Amount = WH.Sum(a => a.Amount), EmployeeId = WH.First().EmployeeId, Employee = WH.First().Employee, ProjectId = WH.First().ProjectId, HourlyPrice = WH.First().Employee.Type.HourlyPrice + WH.First().Employee.Specialty.Bonus }).ToList(), TotalUsedHours = dto.WorkingHoursDtos.Sum(WH => WH.Amount * WH.HourlyPrice), //assigned items summed up AssignedItems = dto.AssignedItemDtos.GroupBy(PAI => PAI.ItemID) .Select(PAI => new ProjectAssignedItemDto { Amount = PAI.Sum(c => c.Amount), Item = PAI.First().Item, Price = PAI.First().Price, ProjectId = PAI.First().ProjectId }).ToList(), TotalAssignedItems = dto.AssignedItemDtos.Sum(UI => UI.Amount * UI.Price), //used items summed up UsedItems = dto.UsedItemsDtos.GroupBy(PUI => PUI.ItemID) .Select(PUI => new ProjectUsedItemDto { Amount = PUI.Sum(c => c.Amount), Item = PUI.First().Item, Price = PUI.First().Price, ProjectId = PUI.First().ProjectId }).ToList(), TotalUsedItems = dto.UsedItemsDtos.Sum(UI => UI.Amount * UI.Price) }); }
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; } }