Exemple #1
0
        public CreateStructureRetval CreateStructure(Structure structure, Location location)
        {
            try
            {
                DBStructure DBStruct = new DBStructure();
                structure.Sync(DBStruct);

                db.DBStructures.InsertOnSubmit(DBStruct);

                DBLocation DBLoc = new DBLocation();
                location.Sync(DBLoc);
                DBLoc.DBStructure = DBStruct;

                db.DBLocations.InsertOnSubmit(DBLoc);

                db.SubmitChanges();

                //Return new ID's to the caller
                CreateStructureRetval retval = new CreateStructureRetval(new Structure(DBStruct, false), new Location(DBLoc));
                return retval;
            }
            finally
            {
                if (db != null)
                    db.Connection.Close();
            }

            return null;
        }