예제 #1
0
        private async void Save(object sender, EventArgs e)
        {
            _this.Name           = txtName.Text;
            _this.Description    = txtDescription.Text;
            _this.EAN            = txtEAN.Text;
            _this.ProducentsCode = txtProducersCode.Text;
            _this.Symbol         = txtSymbol.Text;
            _this.Destination    = txtDestination.Text;
            _this.Appliance      = txtAppliance.Text;
            _this.UsedOn         = txtUsedOn.Text;
            _this.IsArchived     = cboxArchived.CheckState.CheckboxStateToNullableBool();
            _this.ProducerId     = cmbProducer.GetSelectedValue <Company>();
            _this.SupplierId     = cmbSupplier.GetSelectedValue <Company>();
            string photoPath = null;

            if (img.Items.Any())
            {
                if (img.Items[0].IsUploaded != true)
                {
                    photoPath = img.Items[0].Link;
                }
            }
            try
            {
                Looper.Show(this);
                string res = string.Empty;

                if (mode == 1)
                {
                    _this.CreatedBy = RuntimeSettings.UserId;
                    _this.CreatedOn = DateTime.Now;

                    if (await _this.Add(photoPath))
                    {
                        mode      = 2;
                        this.Text = "Szczegóły części";
                        GenerateQrCode(_this.Token);
                        EnableButtons();
                    }
                }
                else if (mode == 2)
                {
                    res = await _this.Edit(photoPath);
                }
                res = await files.Save($"PartId={_this.PartId}");

                if (res != "OK")
                {
                    MessageBox.Show($"Wystąpiły problemy podczas zapisywania plików. Szczegóły: {res}", "Problemy", buttons: MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Błąd podczas zapisywania", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                Looper.Hide();
            }
        }
예제 #2
0
        private async Task Reload(string query = null)
        {
            looper.Show(this);
            await Keeper.Refresh(query);

            dgItems.DataSource = null;
            dgItems.DataSource = Keeper.Items; //new BindingList<Place>(Keeper.Items);
            looper.Hide();
            page = 1;
        }
예제 #3
0
        private async void Reload()
        {
            looper.Show(this);
            await Keeper.Refresh();

            source.DataSource  = Keeper.Items;
            dgItems.DataSource = source;
            source.ResetBindings(false);
            looper.Hide();
            page = 1;
        }
예제 #4
0
        private async void Reload()
        {
            looper.Show(this);
            if (TypeId != null)
            {
                string connector = QueryParameters == null ? "" : " AND ";

                await Keeper.Refresh($"ActionTypeId={TypeId}{connector}{QueryParameters}", 'p', "GivenTime=true&FinishRate=true&HandlingsLength=true");
            }
            else
            {
                await Keeper.Refresh(query : QueryParameters, parameters : "HandlingsLength=true");
            }

            source.DataSource  = Keeper.Items;
            dgItems.DataSource = source;
            source.ResetBindings(false);
            if (TypeId != null)
            {
                if (TypeId == 2 || TypeId == 24)
                {
                    List <string> Columns = new List <string>()
                    {
                        "ProcessId", "Comment", "Status", "PlannedStart", "PlannedFinish", "PlaceId", "PlaceName", "AssignedUserNames", "StartedOn", "StartedByName", "FinishedOn", "FinishedByName", "Length", "Output", "AbandonReasonNames", "GivenTime", "TimingStatus", "FinishRate", "TimingVsPlan", "HandlingsLength", "ProcessLength"
                    };
                    dgItems.AdjustColumnVisibility(Columns);
                }
                else
                {
                    List <string> Columns = new List <string>()
                    {
                        "PlannedStart", "PlannedFinish", "Comment", "GivenTime", "TimingStatus", "FinishRate", "TimingVsPlan"
                    };
                    dgItems.AdjustColumnVisibility(null, Columns);
                }
            }
            else
            {
                List <string> Columns = new List <string>()
                {
                    "PlannedStart", "PlannedFinish", "Comment", "GivenTime", "TimingStatus", "FinishRate", "TimingVsPlan"
                };
                dgItems.AdjustColumnVisibility(null, Columns);
            }
            looper.Hide();
            page = 1;
            adjustColumnWidths();
        }
예제 #5
0
        private async void FormLoaded(object sender, EventArgs e)
        {
            Looper = new frmLooper(this);
            Looper.Show(this);
            await Sets.Refresh();

            await Areas.Refresh();

            Looper.Hide();
            cmbArea.DataSource    = Areas.Items;
            cmbSet.DataSource     = Sets.Items;
            cmbArea.DisplayMember = "Name";
            cmbArea.ValueMember   = "AreaId";
            cmbSet.DisplayMember  = "Name";
            cmbSet.ValueMember    = "SetId";
            cmbArea.SelectedIndex = cmbArea.FindStringExact(_this.AreaName);
            cmbSet.SelectedIndex  = cmbSet.FindStringExact(_this.SetName);
            InitiailizeButtonContextMenu();
            if (mode > 1)
            {
                GetImage();
                GetBoms();
                GetParts();
                GetComponents();
            }
#if (DEBUG == true)
            pbQrCode.Visible = true;
#endif
            files.Initialize();
        }
        private async void Save(object sender, EventArgs e)
        {
            _this.Name       = txtName.Text;
            _this.IsArchived = cboxArchived.CheckState.CheckboxStateToNullableBool();

            try
            {
                Looper.Show(this);
                if (mode == 1)
                {
                    _this.CreatedBy = RuntimeSettings.UserId;
                    _this.CreatedOn = DateTime.Now;

                    if (await _this.Add())
                    {
                        mode      = 2;
                        this.Text = "Szczegóły powodu niewykonania";
                    }
                }
                else if (mode == 2)
                {
                    _this.Edit();
                }
            }catch (Exception ex)
            {
            }
            finally
            {
                Looper.Hide();
            }
        }
예제 #7
0
        private async void FormLoaded(object sender, EventArgs e)
        {
            Looper = new frmLooper(this);
            Looper.Show(this);
            places = new PlacesKeeper();
            parts  = new PartKeeper();
            await SetComboboxes();

            txtDFrom.CustomFormat = " ";
            txtDTo.CustomFormat   = " ";
            if (mode == 1)
            {
                txtDFrom.Value = DateTime.Today;
            }
            txtAmount.Text = _this.Amount.ToString();
            if (_this.ValidFrom != null)
            {
                txtDFrom.Value = _this.ValidFrom.Value;
            }
            if (_this.ValidTo != null)
            {
                txtDTo.Value = _this.ValidTo.Value;
            }
            Looper.Hide();
        }
예제 #8
0
        private async void Save(object sender, EventArgs e)
        {
            _this.Name        = txtName.Text;
            _this.Description = txtDescription.Text;
            _this.PlaceId     = cmbPlace.GetSelectedValue <Place>();

            try
            {
                Looper.Show(this);
                if (mode == 1)
                {
                    _this.CreatedBy = RuntimeSettings.UserId;
                    _this.CreatedOn = DateTime.Now;

                    if (await _this.Add())
                    {
                        mode      = 2;
                        this.Text = "Szczegóły komponentu";
                    }
                }
                else if (mode == 2)
                {
                    _this.Edit();
                }
            }catch (Exception ex)
            {
            }
            finally
            {
                Looper.Hide();
            }
        }
예제 #9
0
        private async void Save(object sender, EventArgs e)
        {
            _this.Name = txtName.Text;

            try
            {
                Looper.Show(this);
                if (mode == 1)
                {
                    _this.CreatedBy = RuntimeSettings.UserId;
                    _this.CreatedOn = DateTime.Now;
                    if (await _this.Add())
                    {
                        mode      = 2;
                        this.Text = "Szczegóły typu firmy";
                    }
                }
                else if (mode == 2)
                {
                    _this.Edit();
                }
            }catch (Exception ex)
            {
            }
            finally
            {
                Looper.Hide();
            }
        }
예제 #10
0
 private async void FormLoaded(object sender, EventArgs e)
 {
     Looper = new frmLooper(this);
     Looper.Show(this);
     Places = new PlacesKeeper();
     SetComboboxes();
     Looper.Hide();
 }
예제 #11
0
        private async void Save(object sender, EventArgs e)
        {
            _this.Name        = txtName.Text;
            _this.Number1     = txtNumber1.Text;
            _this.Number2     = txtNumber2.Text;
            _this.Description = txtDescription.Text;
            _this.Priority    = txtPriority.Text;
            _this.IsArchived  = cboxArchived.CheckState.CheckboxStateToNullableBool();
            if (cmbArea.SelectedItem != null)
            {
                _this.AreaId = Convert.ToInt32(cmbArea.SelectedValue.ToString());
            }
            if (cmbSet.SelectedItem != null)
            {
                _this.SetId = Convert.ToInt32(cmbSet.SelectedValue.ToString());
            }
            string photoPath = null;

            if (img.Items.Any())
            {
                if (img.Items[0].IsUploaded != true)
                {
                    photoPath = img.Items[0].Link;
                }
            }
            try
            {
                Looper.Show(this);
                if (mode == 1)
                {
                    _this.CreatedBy = RuntimeSettings.UserId;
                    _this.CreatedOn = DateTime.Now;
                    if (await _this.Add(photoPath))
                    {
                        mode      = 2;
                        this.Text = "Szczegóły zasobu";
                        GenerateQrCode(_this.PlaceToken);
                    }
                }
                else if (mode == 2)
                {
                    _this.Edit(photoPath);
                }
                string res = await files.Save($"PlaceId={_this.PlaceId}");

                if (res != "OK")
                {
                    MessageBox.Show($"Wystąpiły problemy podczas zapisywania plików. Szczegóły: {res}", "Problemy", buttons: MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            catch (Exception ex)
            {
            }
            finally
            {
                Looper.Hide();
            }
        }
예제 #12
0
        private async void frmAddComponents_Load(object sender, EventArgs e)
        {
            Looper = new frmLooper(this);
            Looper.Show(this);
            places = new PlacesKeeper();
            await SetComboboxes();

            Looper.Hide();
        }
예제 #13
0
 private async void SaveUser(object sender, EventArgs e)
 {
     try
     {
         Looper.Show(this);
         if (mode == 1)
         {
             ThisUser.CreatedBy  = RuntimeSettings.UserId;
             ThisUser.CreatedOn  = DateTime.Now;
             ThisUser.Name       = txtName.Text;
             ThisUser.Surname    = txtSurname.Text;
             ThisUser.Password   = txtPassword.Text;
             ThisUser.MesLogin   = txtMesLogin.Text;
             ThisUser.IsArchived = cboxArchived.CheckState.CheckboxStateToNullableBool();
             if (cmbMechanic.GetItemText(cmbMechanic.SelectedItem) == "Tak")
             {
                 ThisUser.IsMechanic = true;
             }
             else
             {
                 ThisUser.IsMechanic = false;
             }
             if (await ThisUser.Add())
             {
                 mode          = 2;
                 txtToken.Text = $"[UID={ThisUser.UserId};PASS={ThisUser.Password}]";
                 this.Text     = "Szczegóły użytkownika";
             }
         }
         else if (mode == 2)
         {
             ThisUser.Name       = txtName.Text;
             ThisUser.Surname    = txtSurname.Text;
             ThisUser.Password   = txtPassword.Text;
             ThisUser.MesLogin   = txtMesLogin.Text;
             ThisUser.IsArchived = cboxArchived.CheckState.CheckboxStateToNullableBool();
             if (cmbMechanic.GetItemText(cmbMechanic.SelectedItem) == "Tak")
             {
                 ThisUser.IsMechanic = true;
             }
             else
             {
                 ThisUser.IsMechanic = false;
             }
             ThisUser.Edit();
         }
     }catch (Exception ex)
     {
     }
     finally
     {
         Looper.Hide();
     }
 }
예제 #14
0
 private async void FormLoaded(object sender, EventArgs e)
 {
     Looper = new frmLooper(this);
     Looper.Show(this);
     if (mode > 1)
     {
     }
     else
     {
     }
     Looper.Hide();
 }
예제 #15
0
        private async void Save(object sender, EventArgs e)
        {
            BindToObject();
            try
            {
                Looper.Show(this);
                string res = string.Empty;

                if (mode == 1)
                {
                    _this.CreatedBy = RuntimeSettings.UserId;
                    _this.CreatedOn = DateTime.Now;

                    if (await _this.Add())
                    {
                        string r = await _this.ItemKeeper.AddAll();

                        if (r == "OK")
                        {
                            mode      = 2;
                            this.Text = "Szczegóły zamówienia";
                        }
                        else
                        {
                            MessageBox.Show($"Upps.. Coś poszło nie tak.. Szczegóły: {r}", "Bład zapisu", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                }
                else if (mode == 2)
                {
                    res = await _this.Edit();

                    if (res == "OK")
                    {
                        res = await _this.ItemKeeper.EditAll();

                        if (res == "OK")
                        {
                            MessageBox.Show("Zapis zakończony powodzeniem!", "Sukces", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Błąd podczas zapisywania", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                Looper.Hide();
            }
        }
예제 #16
0
 private async void Save(object sender, EventArgs e)
 {
     try
     {
         Looper.Show(this);
         _this.PartId    = cmbPart.GetSelectedValue <Part>();
         _this.PlaceId   = cmbPlace.GetSelectedValue <Place>();
         _this.Unit      = cmbUnit.SelectedValue.ToString();
         _this.ValidFrom = txtDFrom.Value;
         if (txtDTo.Text == " ")
         {
             _this.ValidTo = null;
         }
         else
         {
             _this.ValidTo = txtDTo.Value;
         }
         float amount;
         bool  convertable = float.TryParse(txtAmount.Text, out amount);
         if (convertable)
         {
             _this.Amount = amount;
             if (mode == 1)
             {
                 _this.CreatedBy = RuntimeSettings.UserId;
                 _this.CreatedOn = DateTime.Now;
                 if (await _this.Add())
                 {
                     mode      = 2;
                     this.Text = "Szczegóły pozycji w Bomie";
                 }
             }
             else if (mode == 2)
             {
                 _this.Edit();
             }
         }
         else
         {
             MessageBox.Show("Wartość w polu Ilość musi być liczbą!");
         }
     }catch (Exception ex)
     {
     }
     finally
     {
         Looper.Hide();
     }
 }
예제 #17
0
        private async void FormLoaded(object sender, EventArgs e)
        {
            Looper = new frmLooper(this);
            Looper.Show(this);
            companyTypes = new CompanyTypesKeeper();
            await companyTypes.Refresh();

            cmbType.DataSource    = companyTypes.Items;
            cmbType.DisplayMember = "Name";
            cmbType.ValueMember   = "CompanyTypeId";
            if (mode != 1)
            {
                cmbType.SelectedIndex = cmbType.FindStringExact(_this.CompanyTypeName);
            }
            Looper.Hide();
        }
예제 #18
0
        private async void FormLoaded(object sender, EventArgs e)
        {
            Looper = new frmLooper(this);
            Looper.Show(this);
            IsLoading = true;

            List <Task> LoadingTasks = new List <Task>();

            LoadingTasks.Add(Task.Run(() => SupplierKeeper.Refresh("TypeId=2")));
            LoadingTasks.Add(Task.Run(() => _this.ItemKeeper.Refresh($"OrderId={_this.OrderId}")));
            await Task.WhenAll(LoadingTasks);

            SetPartFinder();
            new AutoCompleteBehavior <Company>(this.cmbSupplier, SupplierKeeper.Items);
            cmbSupplier.DisplayMember = "Name";
            cmbSupplier.ValueMember   = "CompanyId";
            source.DataSource         = _this.ItemKeeper.Items;
            dgvItems.DataSource       = source;
            AdjustColumns();
            StyleEditable(_this.IsArchived);
            StyleItemsArchived();
            dgvItems.TabAction           = () => Finder.TabPressed();
            dgvItems.TabListeningColumns = new List <string>()
            {
                "PartId"
            };
            dgvItems.EnterAction           = () => Finder.EnterPressed();
            dgvItems.EnterListeningColumns = new List <string>()
            {
                "PartId"
            };
            dgvItems.KeyDownAction = () => Finder.GetFocus();
            dgvItems.EscapeAction  = () => Finder.Hide();

            if (mode > 1)
            {
                BindFromObject();
            }
            else
            {
            }
            IsLoading = false;
            Looper.Hide();
        }
예제 #19
0
        private async void formLoaded(object sender, EventArgs e)
        {
            frmLooper Looper = new frmLooper(this);

            Looper.Show(this);
            try
            {
                await Keeper.Refresh();

                //cmbUsers.DataSource = Keeper.Items;
                //cmbUsers.DisplayMember = "FullName";
                //cmbUsers.ValueMember = "UserId";
                SetComboboxes();
                txtPassword.Text      = "Hasło";
                txtPassword.ForeColor = Color.Gray;
            }
            catch (Exception ex)
            {
                MessageBox.Show(RuntimeSettings.ConnectionUnavailableMessage, "Brak połączenia", MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.Close();
            }
            Looper.Hide();
        }
예제 #20
0
        private async void FormLoaded(object sender, EventArgs e)
        {
            Looper = new frmLooper(this);
            Looper.Show(this);
            producers = new CompaniesKeeper();
            suppliers = new CompaniesKeeper();
            SetComboboxes();
            InitiailizeButtonContextMenu();
            if (mode > 1)
            {
                EnableButtons();
                List <Task> tasks = new List <Task>()
                {
                    Task.Run(() => GetBoms()),
                    Task.Run(() => GetImage()),
                    Task.Run(() => GetUsedParts()),
                    Task.Run(() => GetPrices())
                };
                await Task.WhenAll(tasks);
            }

            files.Initialize();
            Looper.Hide();
        }
예제 #21
0
 private async void Save(object sender, EventArgs e)
 {
     _this.Name       = txtName.Text;
     _this.Street     = txtStreet.Text;
     _this.Street2    = txtStreet2.Text;
     _this.BuildingNo = txtBuildingNo.Text;
     _this.ZipCode    = txtZipCode.Text;
     _this.City       = txtCity.Text;
     _this.Country    = txtCountry.Text;
     _this.TypeId     = Convert.ToInt32(cmbType.SelectedValue.ToString());
     _this.IsArchived = cboxArchived.CheckState.CheckboxStateToNullableBool();
     try
     {
         Looper.Show(this);
         if (mode == 1)
         {
             _this.CreatedBy = RuntimeSettings.UserId;
             _this.CreatedOn = DateTime.Now;
             if (await _this.Add())
             {
                 mode      = 2;
                 this.Text = "Szczegóły firmy";
             }
         }
         else if (mode == 2)
         {
             _this.Edit();
         }
     }catch (Exception ex)
     {
     }
     finally
     {
         Looper.Hide();
     }
 }
예제 #22
0
        private async void Save(object sender, EventArgs e)
        {
            _this.Number     = txtNumber.Text;
            _this.Name       = txtName.Text;
            _this.IsArchived = cboxArchived.CheckState.CheckboxStateToNullableBool();
            try
            {
                Looper.Show(this);
                string res = string.Empty;

                if (mode == 1)
                {
                    _this.CreatedBy = RuntimeSettings.UserId;
                    _this.CreatedOn = DateTime.Now;

                    if (await _this.Add())
                    {
                        mode      = 2;
                        this.Text = "Szczegóły regału magazynowego";
                        GenerateQrCode(_this.Token);
                    }
                }
                else if (mode == 2)
                {
                    res = await _this.Edit();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Błąd podczas zapisywania", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                Looper.Hide();
            }
        }
예제 #23
0
        private async Task <string> Save()
        {
            ForceRefresh           = true;
            _this.Output           = txtOutput.Text;
            _this.InitialDiagnosis = txtInitialDiagnosis.Text;
            _this.RepairActions    = txtRepairActions.Text;
            _this.Comment          = txtComment.Text;
            string _Result = "OK";

            if (IsMesSyncSelected())
            {
                _this.MesId  = txtMesId.Text;
                _this.Reason = txtDescription.Text;
            }
            else
            {
                _this.Description = txtDescription.Text;
            }

            if (txtStartedOn.Text == " ")
            {
                _this.StartedOn = null;
            }
            else
            {
                _this.StartedOn = txtStartedOn.Value;
            }
            if (txtFinishedOn.Text == " ")
            {
                _this.FinishedOn = null;
            }
            else
            {
                _this.FinishedOn = txtFinishedOn.Value;
            }
            if (txtPlannedStart.Text == " ")
            {
                _this.PlannedStart = null;
            }
            else
            {
                _this.PlannedStart = txtPlannedStart.Value;
            }
            if (txtPlannedFinish.Text == " ")
            {
                _this.PlannedFinish = null;
            }
            else
            {
                _this.PlannedFinish = txtPlannedFinish.Value;
            }
            if (cmbPlace.SelectedItem != null)
            {
                _this.PlaceId = (int)cmbPlace.GetSelectedValue <Place>();
            }
            if (cmbActionType.SelectedItem != null)
            {
                _this.ActionTypeId = Convert.ToInt32(cmbActionType.SelectedValue.ToString());
            }
            if (cmbStatus.SelectedItem != null)
            {
                _this.Status = cmbStatus.SelectedItem.ToString();
            }
            if (cmbStartedBy.SelectedItem != null)
            {
                _this.StartedBy = Convert.ToInt32(cmbStartedBy.SelectedValue.ToString());
            }
            if (cmbFinishedBy.SelectedItem != null)
            {
                _this.FinishedBy = Convert.ToInt32(cmbFinishedBy.SelectedValue.ToString());
            }

            try
            {
                Looper.Show(this);
                if (mode == 1)
                {
                    _this.CreatedBy = RuntimeSettings.UserId;
                    _this.CreatedOn = DateTime.Now;
                    if (await _this.Add())
                    {
                        if (assignedUsersHandler.AssignedUsers.Any())
                        {
                            _Result = await _this.AssignUsers(assignedUsersHandler.AssignedUsers);
                        }

                        mode      = 2;
                        this.Text = "Szczegóły zgłoszenia";
                    }
                    else
                    {
                        _Result = "Błąd podczas tworzenia nowego zgłoszenia..";
                    }
                }
                else if (mode == 2)
                {
                    if (await _this.Edit())
                    {
                        if (assignedUsersHandler.AssignedUsers.Any())
                        {
                            _Result = await _this.AssignUsers(assignedUsersHandler.AssignedUsers);
                        }
                    }
                    else
                    {
                        _Result = "Błąd podczas edycji zgłoszenia..";
                    }
                }
                if (_Result == "OK")
                {
                    _Result = await files.Save($"ProcessId={_this.ProcessId}");
                }

                if (_Result != "OK")
                {
                    _Result = $"Wystąpiły problemy podczas zapisywania plików. Szczegóły: {_Result}";
                }
            }
            catch (Exception ex)
            {
                _Result = ex.ToString();
            }
            finally
            {
                Looper.Hide();
            }
            ChangeLook();

            return(_Result);
        }
예제 #24
0
        private async void FormLoaded(object sender, EventArgs e)
        {
            Looper = new frmLooper(this);
            Looper.Show(this);
            var PlaceRefreshTask         = Task.Run(() => Places.Refresh(null, 'a'));
            var StartingUsersRefreshTask = Task.Run(() => StartingUsers.Refresh(null, 'a'));
            var LoadActionTypesTask      = Task.Run(() => ActionTypes.Refresh());
            var LoadAbandonReasonsTask   = Task.Run(() => AbandonReasons.Refresh());
            await Task.WhenAll(PlaceRefreshTask, StartingUsersRefreshTask, LoadActionTypesTask, LoadAbandonReasonsTask);

            FinishingUsers.Items  = new List <User>(StartingUsers.Items);
            AssignableUsers.Items = new List <User>(StartingUsers.Items);
            _this.Handlings       = new HandlingsKeeper();
            _this.Logs            = new LogsKeeper();
            _this.PartUsages      = new PartUsageKeeper();
            _this.ProcessActions  = new ProcessActionsKeeper();
            //await ActionTypes.Refresh();
            if (mode == 1)
            {
                cmbActionType.DataSource = ActionTypes.Items.Where(i => i.ShowInPlanning == true).ToList();
                txtPlannedStart.Enabled  = true;
                txtPlannedFinish.Enabled = true;
                txtPlannedStart.Value    = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 6, 0, 0);
                txtPlannedFinish.Value   = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 14, 0, 0);
            }
            else
            {
                cmbActionType.DataSource = ActionTypes.Items;
                if (_this.PlannedStart == null)
                {
                    txtPlannedStart.CustomFormat  = " ";
                    txtPlannedFinish.CustomFormat = " ";
                    txtPlannedStart.Enabled       = false;
                    txtPlannedFinish.Enabled      = false;
                }
                else
                {
                    txtPlannedStart.Value = (DateTime)_this.PlannedStart;
                    if (_this.PlannedFinish != null)
                    {
                        txtPlannedFinish.Value = (DateTime)_this.PlannedFinish;
                    }
                }
                if (_this.Status == "Planowany")
                {
                    txtPlannedStart.Enabled  = true;
                    txtPlannedFinish.Enabled = true;
                }
                else
                {
                    txtPlannedStart.Enabled  = false;
                    txtPlannedFinish.Enabled = false;
                }
                txtComment.Text = _this.Comment;
                LoadHistory();
                var loadActionsTask        = Task.Run(() => LoadActions());
                var loadProcessAssingsTask = Task.Run(() => assignedUsersHandler.LoadProcessAssigns());
                var loadUsedPartsTask      = Task.Run(() => LoadParts());

                await Task.WhenAll(loadActionsTask, loadProcessAssingsTask, loadUsedPartsTask);

                lblAssignedUsers.Text = assignedUsersHandler.AssignedUserNames;
            }
            cmbStartedBy.DataSource  = StartingUsers.Items;
            cmbFinishedBy.DataSource = FinishingUsers.Items;
            new AutoCompleteBehavior <Place>(this.cmbPlace, Places.Items);
            cmbStartedBy.DisplayMember  = "FullName";
            cmbStartedBy.ValueMember    = "UserId";
            cmbFinishedBy.DisplayMember = "FullName";
            cmbFinishedBy.ValueMember   = "UserId";
            cmbActionType.DisplayMember = "Name";
            cmbActionType.ValueMember   = "ActionTypeId";
            cmbPlace.DisplayMember      = "Name";
            cmbPlace.ValueMember        = "PlaceId";
            cmbActionType.SelectedIndex = cmbActionType.FindStringExact(_this.ActionTypeName);
            cmbPlace.SelectedIndex      = cmbPlace.FindStringExact(_this.PlaceName);
            cmbStartedBy.SelectedIndex  = cmbStartedBy.FindStringExact(_this.StartedByName);
            cmbFinishedBy.SelectedIndex = cmbFinishedBy.FindStringExact(_this.FinishedByName);
            cmbStatus.SelectedIndex     = cmbStatus.FindStringExact(_this.Status);
            if (_this.StartedOn != null)
            {
                LoadHandlings();

                txtStartedOn.Value = (DateTime)_this.StartedOn;
            }
            if (_this.FinishedOn != null)
            {
                txtFinishedOn.Value = (DateTime)_this.FinishedOn;
            }

            ChangeLook();
            if (_this.Status == "Zakończony" || _this.Status == "Zrealizowany")
            {
                try
                {
                    Wait4Reactivation();
                }
                catch (Exception ex)
                {
                }
            }
            files.Initialize();
            Looper.Hide();
        }