public FinishTaskForm(TaskModel task) { db = new MyDbConnection(); taskId = task.Id; newStatusId = ++task.Status.Id; List <StatusModel> statuses = db.GetStatuses(); StatusModel newStatus = statuses.FirstOrDefault(x => x.Id == newStatusId); if (newStatus == null) { this.Opacity = 0; MessageBox.Show("Błąd podczas wyznaczania nowego statusu!", "Błąd."); this.Close(); return; } InitializeComponent(); labelTaskManufacturer.Text = task.BikeManufacturer; labelTaskModel.Text = task.BikeModel; labelTaskPhone.Text = task.PhoneNumber; labelTaskStatus.Text = newStatus.Value; }
/// <summary> /// Loads all possible statuses and loads them to ComboBox inside a form. /// </summary> private void InitializeStatuses() { statuses = db.GetStatuses(); bsStatus.DataSource = statuses; }