private List <AddedConstantManaged> GetAddedConstantList() { var result = new List <AddedConstantManaged>(); var projectTable = _Project.DataTables.SingleOrDefault(x => x.DisplayName == PROJECTADDEDCONSTANTDATATABLENAME); if (projectTable == null) { throw new Exception("La table de projet : " + PROJECTADDEDCONSTANTDATATABLENAME + " 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 newAddedConstant = new AddedConstantManaged(); newAddedConstant.ConstantName = projectTableDataArray[rowIndex, 0].ToString(); if (newAddedConstant.ConstantName.IsNullOrEmpty()) { throw new Exception("Dans la table de projet '{0}', ligne '{1}' le nom du control est invalide".FormatString(PROJECTADDEDCONSTANTDATATABLENAME, rowIndex + 1)); } newAddedConstant.ProjectVersion = Convert.ToDecimal(projectTableDataArray[rowIndex, 1].ToString()); if (newAddedConstant.ProjectVersion < 1) { throw new Exception("Dans la table de projet '{0}', ligne '{1}' la version mineure de projet est invalide".FormatString(PROJECTADDEDCONSTANTDATATABLENAME, rowIndex + 1)); } result.Add(newAddedConstant); } return(result); }
public static AddedConstantManaged GetFromRow(DataGridViewRow iRow) { var control = new AddedConstantManaged(); var viewRow = (AddedConstantView)iRow.DataBoundItem; control.ConstantName = viewRow.Object.ConstantName; control.ProjectVersion = viewRow.Object.ProjectVersion; return(control); }
public static AddedConstantView ConvertTo(AddedConstantManaged iObj) { if (iObj == null) { return(null); } var newView = new AddedConstantView(); newView.Object = iObj; newView.ConstantName = iObj.ConstantName; newView.ProjectVersion = iObj.ProjectVersion; return(newView); }