1 using System
.Collections
;
2 // Copyright 2004-2008 Castle Project - http://www.castleproject.org/
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://www.apache.org/licenses/LICENSE-2.0
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
16 namespace Castle
.Applications
.PestControl
.Model
20 using Bamboo
.Prevalence
;
23 /// Summary description for ProjectCommands.
26 public class CreateProjectCommand
: ICommand
30 string _sourceControl
;
33 IDictionary _sourceControlProperties
;
35 public CreateProjectCommand(bool _isPublic
, string _name
, string _sourceControl
,
36 string _buildSystem
, string _ownerEmail
, IDictionary _sourceControlProperties
)
38 this._isPublic
= _isPublic
;
40 this._sourceControl
= _sourceControl
;
41 this._buildSystem
= _buildSystem
;
42 this._ownerEmail
= _ownerEmail
;
43 this._sourceControlProperties
= _sourceControlProperties
;
46 public object Execute(object system
)
48 PestControlModel model
= (PestControlModel
) system
;
49 User owner
= model
.Users
.FindByEmail(_ownerEmail
);
51 Project project
= new Project(_isPublic
, _name
, _sourceControl
, _buildSystem
, owner
);
53 foreach(DictionaryEntry entry
in _sourceControlProperties
)
55 project
.SourceControlProperties
.Add(entry
.Key
, entry
.Value
);
58 model
.Projects
.Add( project
);