Fixing an issue with output parameters that are of type IntPtr
[castle.git] / Samples / PestControl / Castle.Applications.PestControl / Model / Commands / ProjectCommands.cs
blob8e6b1fa0f0ed4970ae88e29a13023024d93daddc
1 using System.Collections;
2 // Copyright 2004-2008 Castle Project - http://www.castleproject.org/
3 //
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
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
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
18 using System;
20 using Bamboo.Prevalence;
22 /// <summary>
23 /// Summary description for ProjectCommands.
24 /// </summary>
25 [Serializable]
26 public class CreateProjectCommand : ICommand
28 bool _isPublic;
29 string _name;
30 string _sourceControl;
31 string _buildSystem;
32 String _ownerEmail;
33 IDictionary _sourceControlProperties;
35 public CreateProjectCommand(bool _isPublic, string _name, string _sourceControl,
36 string _buildSystem, string _ownerEmail, IDictionary _sourceControlProperties)
38 this._isPublic = _isPublic;
39 this._name = _name;
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 );
60 return project;