Esempio n. 1
0
            public static DeletedControlView ConvertTo(DeletedControlManaged iObj)
            {
                if (iObj == null)
                {
                    return(null);
                }

                var newView = new DeletedControlView();

                newView.Object = iObj;

                newView.ControlName          = iObj.ControlName;
                newView.ControlDescription   = iObj.ControlDescription;
                newView.TransfertControlName = iObj.TransfertControlName;
                newView.Message        = iObj.Message;
                newView.ProjectVersion = iObj.ProjectVersion;

                return(newView);
            }
Esempio n. 2
0
        private void cmdOldControlCopy_Click(object sender, System.EventArgs e)
        {
            try
            {
                if (_IsLoading.Value)
                {
                    return;
                }
                using (var locker = new BoolLocker(ref _IsLoading))
                {
                    if (_DeletedControlManaged.Any())
                    {
                        var oldControls = new List <DeletedControlManaged>();

                        //Récupère la liste des controles géré (Différent des controls actuel, aux ajouts pas en fait près)
                        var managedControlList = _Project.GetManagedControls();

                        //Ajout des nouvelles données
                        foreach (DataGridViewRow item in dgvOldControl.Rows)
                        {
                            var newDeletedControlManaged = DeletedControlView.GetFromRow(item);

                            //Validation du transfert
                            if (newDeletedControlManaged.TransfertControlName.IsNotNullAndNotEmpty())
                            {
                                if (managedControlList.Any(x => x.ControlName == newDeletedControlManaged.TransfertControlName) == false)
                                {
                                    throw new Exception("Le transfert de {0} vers {1} est impossible car {1} est introuvable".FormatString(newDeletedControlManaged.ControlName, newDeletedControlManaged.TransfertControlName));
                                }
                            }

                            //Validation control description
                            if (newDeletedControlManaged.ControlDescription.IsNullOrEmpty())
                            {
                                throw new Exception("La description est manquante pour {0}".FormatString(newDeletedControlManaged.ControlName));
                            }

                            //Validation
                            if (newDeletedControlManaged.TransfertControlName.IsNullOrEmpty() && newDeletedControlManaged.Message.IsNullOrEmpty())
                            {
                                throw new Exception("Le controle de transfert ou le message est manquant. Il faut au moins un des deux");
                            }

                            oldControls.Add(newDeletedControlManaged);
                        }

                        _Project.AddToDeletedControlProjectDataTable(oldControls);

                        //modification de la version du projet
                        DriveWorks.Helper.Manager.SettingsManager.UpdateProjectVersionNumber(_Project, NewVersionNumber);

                        LoadData();
                        SaveNeeded = true;

                        MessageBox.Show("Les données sont maintenant ajoutées");
                    }
                }
            }
            catch (Exception ex)
            {
                ex.ShowInMessageBox();
            }
        }
Esempio n. 3
0
        private void LoadData()
        {
            var groupService = _Application.ServiceManager.GetService <IGroupService>();

            var tupleValues = _Project.GetAddedDeletedControlConstant();

            _AddedControlManaged = tupleValues.Item1;
            //bouclage pour définir la bonne version
            foreach (var item in _AddedControlManaged.Enum())
            {
                item.ProjectVersion = NewVersionNumber;
            }

            _DeletedControlManaged = tupleValues.Item2;
            //bouclage pour définir la bonne version
            foreach (var item in _DeletedControlManaged.Enum())
            {
                item.ProjectVersion = NewVersionNumber;
            }

            _AddedConstantManaged = tupleValues.Item3;
            //bouclage pour définir la bonne version
            foreach (var item in _AddedConstantManaged.Enum())
            {
                item.ProjectVersion = NewVersionNumber;
            }

            _DeletedConstantManaged = tupleValues.Item4;
            //bouclage pour définir la bonne version
            foreach (var item in _DeletedConstantManaged.Enum())
            {
                item.ProjectVersion = NewVersionNumber;
            }

            dgvNewControl.DataSource = _AddedControlManaged.Enum().Select(x => AddedControlView.ConvertTo(x)).ToList();
            dgvNewControl.FormatColumns <AddedControlView>("FR");
            if (!_AddedControlManaged.Any())
            {
                cmdNewControlCopy.Enabled = false;
            }

            dgvOldControl.DataSource = _DeletedControlManaged.Enum().Select(x => DeletedControlView.ConvertTo(x)).ToList();
            dgvOldControl.FormatColumns <DeletedControlView>("FR");
            if (!_DeletedControlManaged.Any())
            {
                cmdOldControlCopy.Enabled = false;
            }

            dgvNewConstant.DataSource = _AddedConstantManaged.Enum().Select(x => AddedConstantView.ConvertTo(x)).ToList();
            dgvNewConstant.FormatColumns <AddedConstantView>("FR");
            if (!_AddedConstantManaged.Any())
            {
                cmdNewConstantCopy.Enabled = false;
            }

            dgvOldConstant.DataSource = _DeletedConstantManaged.Enum().Select(x => DeletedConstantView.ConvertTo(x)).ToList();
            dgvOldConstant.FormatColumns <DeletedConstantView>("FR");
            if (!_DeletedConstantManaged.Any())
            {
                cmdOldConstantCopy.Enabled = false;
            }

            lblNewConstantCount.Text = _AddedConstantManaged.Count.ToString();
            lblOldConstantCount.Text = _DeletedConstantManaged.Count.ToString();
            lblNewControlCount.Text  = _AddedControlManaged.Count.ToString();
            lblOldControlCount.Text  = _DeletedControlManaged.Count.ToString();
        }