private void buttonDel_Click(object sender, EventArgs e) { try { if (listViewReady.SelectedItems.Count == 1) { ProjectAccounting projectAccounting = listViewReady.SelectedItems[0].Tag as ProjectAccounting; Program.projectForSinaptic.ProjectAccounting.Remove(projectAccounting); Program.projectForSinaptic.SaveChanges(); ShowlistViewReady(); comboBoxProjects.SelectedItem = null; comboBoxClient.SelectedItem = null; comboBoxType.SelectedItem = null; comboBoxUsers.SelectedItem = null; comboBoxPrice.SelectedItem = null; comboBoxType.SelectedItem = null; comboBoxStatus.SelectedItem = null; } } catch { MessageBox.Show("Невозможно удалить!", "Ошибка!", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void buttonEdit5_Click(object sender, EventArgs e) { if (listViewReady.SelectedItems.Count == 1) { ProjectAccounting projectAccounting = listViewReady.SelectedItems[0].Tag as ProjectAccounting; projectAccounting.IDProject = Convert.ToInt32(comboBoxProjects.SelectedItem.ToString().Split('.')[0]); projectAccounting.IDClient = Convert.ToInt32(comboBoxClient.SelectedItem.ToString().Split('.')[0]); projectAccounting.IDType = Convert.ToInt32(comboBoxType.SelectedItem.ToString().Split('.')[0]); projectAccounting.IDUser = Convert.ToInt32(comboBoxUsers.SelectedItem.ToString().Split('.')[0]); projectAccounting.IDPrice = Convert.ToInt32(comboBoxPrice.SelectedItem.ToString().Split('.')[0]); projectAccounting.Status = comboBoxStatus.SelectedItem.ToString(); Program.projectForSinaptic.SaveChanges(); ShowlistViewReady(); } }
private void buttonReady4_Click(object sender, EventArgs e) { if (listViewTesting.SelectedItems.Count == 1) { ProjectAccounting projectAccounting = listViewTesting.SelectedItems[0].Tag as ProjectAccounting; projectAccounting.Status = "Ready"; Program.projectForSinaptic.SaveChanges(); ShowlistViewTesting(); ShowlistViewReady(); } else { MessageBox.Show("Строчка не выбрана", "Ошибка!", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void listViewReady_SelectedIndexChanged(object sender, EventArgs e) { if (listViewReady.SelectedItems.Count == 1) { ProjectAccounting projectAccounting = listViewReady.SelectedItems[0].Tag as ProjectAccounting; comboBoxProjects.SelectedIndex = comboBoxProjects.FindString(projectAccounting.IDProject.ToString()); comboBoxClient.SelectedIndex = comboBoxClient.FindString(projectAccounting.IDClient.ToString()); comboBoxType.SelectedIndex = comboBoxType.FindString(projectAccounting.IDType.ToString()); comboBoxUsers.SelectedIndex = comboBoxUsers.FindString(projectAccounting.IDUser.ToString()); comboBoxPrice.SelectedIndex = comboBoxPrice.FindString(projectAccounting.IDPrice.ToString()); comboBoxType.SelectedIndex = comboBoxType.FindString(projectAccounting.IDType.ToString()); comboBoxStatus.Text = projectAccounting.Status; } else { comboBoxProjects.SelectedItem = null; comboBoxClient.SelectedItem = null; comboBoxType.SelectedItem = null; comboBoxUsers.SelectedItem = null; comboBoxPrice.SelectedItem = null; comboBoxType.SelectedItem = null; comboBoxStatus.SelectedItem = null; } }
private void buttonAdd_Click(object sender, EventArgs e) { if (comboBoxClient.SelectedItem != null && comboBoxProjects.SelectedItem != null && comboBoxUsers.SelectedItem != null && comboBoxPrice.SelectedItem != null && comboBoxType.SelectedItem != null) { ProjectAccounting projectAccounting = new ProjectAccounting(); projectAccounting.IDProject = Convert.ToInt32(comboBoxProjects.SelectedItem.ToString().Split('.')[0]); projectAccounting.IDUser = Convert.ToInt32(comboBoxUsers.SelectedItem.ToString().Split('.')[0]); projectAccounting.IDPrice = Convert.ToInt32(comboBoxPrice.SelectedItem.ToString().Split('.')[0]); projectAccounting.IDType = Convert.ToInt32(comboBoxType.SelectedItem.ToString().Split('.')[0]); projectAccounting.IDClient = Convert.ToInt32(comboBoxClient.SelectedItem.ToString().Split('.')[0]); projectAccounting.Status = comboBoxStatus.Text; Program.projectForSinaptic.ProjectAccounting.Add(projectAccounting); Program.projectForSinaptic.SaveChanges(); ShowlistViewNewChallenge(); ShowlistViewInWork(); ShowlistViewReview(); ShowlistViewTesting(); ShowlistViewReady(); } else { MessageBox.Show("Данные не выбраны!", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Information); } }