Exemple #1
0
            public static AddedControlManaged GetFromRow(DataGridViewRow iRow)
            {
                var addedControl = new AddedControlManaged();
                var viewRow      = (AddedControlView)iRow.DataBoundItem;

                addedControl.ControlName    = viewRow.Object.ControlName;
                addedControl.ProjectVersion = viewRow.Object.ProjectVersion;
                addedControl.Message        = viewRow.Message;

                return(addedControl);
            }
Exemple #2
0
            public static AddedControlView ConvertTo(AddedControlManaged iObj)
            {
                if (iObj == null)
                {
                    return(null);
                }

                var newView = new AddedControlView();

                newView.Object = iObj;

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

                return(newView);
            }
Exemple #3
0
        private static List <AddedControlManaged> GetAddedControlList(this Project iProject)
        {
            var result       = new List <AddedControlManaged>();
            var projectTable = iProject.DataTables.SingleOrDefault(x => x.DisplayName == PROJECTADDDEDCONTROLATATABLENAME);

            if (projectTable == null)
            {
                throw new Exception("La table de projet : " + PROJECTADDDEDCONTROLATATABLENAME + " est inexistante");
            }

            var projectTableDataArray = projectTable.GetCachedTableData();

            //Bouclage sur les lignes, mais ne tient pas compte de la première qui est l'entete
            for (int rowIndex = 1; rowIndex <= projectTableDataArray.GetLength(0) - 1; rowIndex++)
            {
                var newAddedControl = new AddedControlManaged();

                var controlName = projectTableDataArray[rowIndex, 0];
                newAddedControl.ControlName = controlName?.ToString();
                if (newAddedControl.ControlName.IsNullOrEmpty())
                {
                    throw new Exception("Dans la table de projet '{0}', ligne '{1}' le nom du control est invalide".FormatString(PROJECTADDDEDCONTROLATATABLENAME, rowIndex + 1));
                }

                var projectVersion = projectTableDataArray[rowIndex, 1];
                newAddedControl.ProjectVersion = (projectVersion != null) ? ((projectVersion.ToString() != "") ? Convert.ToDecimal(projectVersion.ToString()):0) : 0;
                if (newAddedControl.ProjectVersion < 1)
                {
                    throw new Exception("Dans la table de projet '{0}', ligne '{1}' la version de projet est invalide".FormatString(PROJECTADDDEDCONTROLATATABLENAME, rowIndex + 1));
                }

                var message = projectTableDataArray[rowIndex, 2];
                newAddedControl.Message = message?.ToString();

                result.Add(newAddedControl);
            }

            return(result);
        }