/// <summary> /// The object factory for a particular data collection instance. /// </summary> public virtual void CreateObjectsFromData(BaseDataTypes basedatatypes, System.Data.DataSet data) { // Do nothing if we have nothing if (data == null || data.Tables.Count == 0 || data.Tables[0].Rows.Count == 0) { return; } // Create a local variable for the new instance. BaseDataType newobj = null; // Create a local variable for the data row instance. System.Data.DataRow dr = null; // Iterate through the table rows for (int i = 0; i < data.Tables[0].Rows.Count; i++) { // Get a reference to the data row dr = data.Tables[0].Rows[i]; // Create a new object instance newobj = System.Activator.CreateInstance(basedatatypes.ContainsType[0]) as BaseDataType; // Let the instance set its own members newobj.SetMembers(ref dr); // Add the new object to the collection instance basedatatypes.Add(newobj); } }
/// <summary> /// Fill method for populating an entire collection of BaseDataTypes /// </summary> public virtual void Fill(BaseDataTypes baseDataTypes) { // create the connection to use SqlConnection cnn = new SqlConnection(BaseDataType.GetConnectionString()); try { using (cnn) { // open the connection cnn.Open(); // create an instance of the reader to fill. SqlDataReader datareader = SqlHelper.ExecuteReader(cnn, "gsp_SelectBaseDataTypes"); // Send the collection and data to the object factory CreateObjectsFromData(baseDataTypes, datareader); // close the connection cnn.Close(); } // nullify the connection cnn = null; } catch (SqlException sqlex) { throw sqlex; } }
public bool LoadFromFile(string filename) { if (File.Exists(filename)) { Clear(); XElement xroot = XElement.Load(filename); XElement xmlApp = xroot.Element("AUTOSARTAPP"); BaseDataTypes.Clear(); LoadProperties(xroot); Enums.LoadFromXML(xroot); systemErrors.LoadFromXML(xroot); BaseDataTypes.LoadFromXML(xroot); SimpleDataTypes.LoadFromXML(xroot); ComplexDataTypes.LoadFromXML(xroot); SenderReceiverInterfaces.LoadFromXML(xroot); ClientServerInterfaces.LoadFromXML(xroot); ComponentDefenitionsList.LoadFromXML(xroot); Compositions.LoadFromXML(xroot); OsTasks.LoadFromXML(xroot); arrayDataTypes.LoadFromXML(xroot); MCUType.LoadFromXML(xroot); BaseDataTypes.CheckBaseDataTypes(); SyncronizeRunnables(null, true); UpdateConnections(); FileName = filename; return(true); } else { return(false); } }
public void CreateNewProject() { CompositionInstance mainComposition = new CompositionInstance(); mainComposition.Name = CompositionInstancesList.MainCompositionName; ActiveComposition = mainComposition; compositions.Add(mainComposition); BaseDataTypes.CheckBaseDataTypes(); }
/// <summary> /// Gets all the available objects. /// </summary> public virtual BaseDataTypes GetAll() { // create a new instance of the return object BaseDataTypes objects = new BaseDataTypes(); // fill the objects this.Fill(objects); // return the filled object from the service return(objects); }
public void Clear() { SimpleDataTypes.Clear(); ComplexDataTypes.Clear(); ClientServerInterfaces.Clear(); SenderReceiverInterfaces.Clear(); Compositions.ClearCompositions(); ComponentDefenitionsList.Clear(); Enums.Clear(); systemErrors.Clear(); BaseDataTypes.Clear(); OsTasks.Clear(); arrayDataTypes.Clear(); FileName = ""; CleanProperties(); }
public String GetDataTypeName(Guid GUID) { ArrayDataType arrayDatatype = ArrayDataTypes.FindObject(GUID); if (arrayDatatype != null) { return(arrayDatatype.Name); } BaseDataType baseDatatype = BaseDataTypes.FindObject(GUID); if (baseDatatype != null) { return(baseDatatype.Name); } SimpleDataType simpleDataType = SimpleDataTypes.FindObject(GUID); if (simpleDataType != null) { return(simpleDataType.Name); } ComplexDataType complexDataType = ComplexDataTypes.FindObject(GUID); if (complexDataType != null) { return(complexDataType.Name); } EnumDataType enumDataType = Enums.FindObject(GUID); if (enumDataType != null) { return(enumDataType.Name); } return(ErrorDataType); }
public IGUID GetDataType(Guid GUID) { BaseDataType baseDatatype = BaseDataTypes.FindObject(GUID); if (baseDatatype != null) { return(baseDatatype); } SimpleDataType simpleDataType = SimpleDataTypes.FindObject(GUID); if (simpleDataType != null) { return(simpleDataType); } ComplexDataType complexDataType = ComplexDataTypes.FindObject(GUID); if (complexDataType != null) { return(complexDataType); } EnumDataType enumDataType = Enums.FindObject(GUID); if (enumDataType != null) { return(enumDataType); } ArrayDataType arrayDataType = ArrayDataTypes.FindObject(GUID); if (arrayDataType != null) { return(arrayDataType); } return(null); }
public bool SaveToFile(string filename) { XDocument xdoc = new XDocument(); XElement root = new XElement("AUTOSARTAPP"); xdoc.Add(root); SaveProperties(root); BaseDataTypes.WriteToXML(root); SimpleDataTypes.WriteToXML(root); arrayDataTypes.WriteToXML(root); ComplexDataTypes.WriteToXML(root); SenderReceiverInterfaces.WriteToXML(root); ClientServerInterfaces.WriteToXML(root); ComponentDefenitionsList.WriteToXML(root); Enums.WriteToXML(root); systemErrors.WriteToXML(root); OsTasks.WriteToXML(root); Compositions.WriteToXML(root); MCUType.WriteToXML(root); xdoc.Save(filename); return(true); }
/// <summary> /// The object factory for a particular data collection instance. /// </summary> public virtual void CreateObjectsFromData(BaseDataTypes basedatatypes, System.Data.SqlClient.SqlDataReader data) { // Do nothing if we have nothing if (data == null) { return; } // Create a local variable for the new instance. BaseDataType newobj = null; // Iterate through the data reader while (data.Read()) { // Create a new object instance newobj = System.Activator.CreateInstance(basedatatypes.ContainsType[0]) as BaseDataType; // Let the instance set its own members newobj.SetMembers(ref data); // Add the new object to the collection instance basedatatypes.Add(newobj); } }
private AutosarApplication() { BaseDataTypes.CheckBaseDataTypes(); }