//public int? GetIndexOf(string name, FindMode findMode = FindMode.Exact) { // var item = FindByName(name, findMode); // if (item != null) { // return MyItems.IndexOf(item); // } // return null; //} public override bool ImportFromExistingElement(DBBase item, Simulator dstSim) { if (item == null) { throw new LPGException("Null-Item tried to import an empty item. This is a bug!"); } var type = item.GetType(); var info = type.GetMethod("ImportFromItem"); if (info == null) { throw new LPGException("Type " + type + " is missing the ImportFromItem-Function. This is a bug!"); } object[] parameters = { item, dstSim }; Logger.Info("Processing type " + type + " now."); var newItem = (DBBase)info.Invoke(item, parameters); if (newItem == null) { throw new LPGException( "Missing Type in the import-function. This is a bug. Please contact the programmer:" + item.GetType()); } newItem.SaveToDB(); var d = (T)newItem; AddItemToList(d); Logger.Info("Imported " + newItem.Name); return(true); }
public void Init() { var connStr = System.Configuration.ConfigurationManager.AppSettings["ConntionString"].ToString(); DBBase dbbase = new DBBase(); DataBaseHelper = DBHelperFactory.GetSqlDataClassHelper(SqlPrividerType.SqlClient, connStr, GetNameSpaceName(dbbase.GetType())); }