public EditCAAConcessionRequestForm(SmartCore.CAA.ConcessionRequest concessionRequest) : this() { _concessionRequest = concessionRequest; _animatedThreadWorker.DoWork += AnimatedThreadWorkerDoLoad; _animatedThreadWorker.RunWorkerCompleted += BackgroundWorkerRunWorkerLoadCompleted; _animatedThreadWorker.RunWorkerAsync(); foreach (var control in groupBox6.Controls) { var c = control as Control; c.Enabled = _concessionRequest.Status == ConcessionRequestStatus.Open && _concessionRequest.Settings.Type == ConcessionRequestType.CAA; } foreach (var control in groupBox7.Controls) { var c = control as Control; c.Enabled = _concessionRequest.Status == ConcessionRequestStatus.Open && _concessionRequest.Settings.Type == ConcessionRequestType.Operator; } foreach (var control in groupBox5.Controls) { var group = control as GroupBox; foreach (var g in group.Controls) { var c = g as Control; c.Enabled = false; } } }
private void AnimatedThreadWorkerDoLoad(object sender, DoWorkEventArgs e) { _caa.Clear(); _aircaraft.Clear(); if (_concessionRequest.ItemId > 0) { _concessionRequest = GlobalObjects.CaaEnvironment.NewLoader.GetObjectById <ConcessionRequestDTO, SmartCore.CAA.ConcessionRequest>(_concessionRequest.ItemId); } else { _concessionRequest.Settings.Number = $"CR-{GlobalObjects.CaaEnvironment.ObtainId()}"; } _from = GlobalObjects.CaaEnvironment.NewLoader.GetObjectById <CAASpecialistDTO, Specialist>(_concessionRequest.FromId); _caa.AddRange(GlobalObjects.CaaEnvironment.NewLoader.GetObjectListAll <CAASpecialistDTO, Specialist>(new Filter("OperatorId", -1))); _aircaraft.AddRange(GlobalObjects.CaaEnvironment.NewLoader.GetObjectListAll <CAAAircraftDTO, Aircraft>()); }
public EditConcessionRequestForm(SmartCore.CAA.ConcessionRequest concessionRequest) : this() { _concessionRequest = concessionRequest; button1.Enabled = concessionRequest.CurrentId == GlobalObjects.CaaEnvironment.IdentityUser.PersonnelId; if (concessionRequest.CurrentId != GlobalObjects.CaaEnvironment.IdentityUser.PersonnelId) { foreach (var control in this.Controls.OfType <GroupBox>()) { var group = control; foreach (var g in group.Controls) { var c = g as Control; c.Enabled = false; } } } _animatedThreadWorker.DoWork += AnimatedThreadWorkerDoLoad; _animatedThreadWorker.RunWorkerCompleted += BackgroundWorkerRunWorkerLoadCompleted; _animatedThreadWorker.RunWorkerAsync(); }