Changeset 107

User picture

Author: marisic.net

(2009/02/15 21:44) Almost 3 years ago


  

Affected files

Updated StructuredWeb/StructuredWeb/Common/BusinessConversation.cs Download diff

106107
66
                    break;
66
                    break;
67
                case ConversationMode.Rollback:
67
                case ConversationMode.Rollback:
68
                    conversation.Abort();
68
                    conversation.Abort();
69
                    break;                               
69
                    break;
70
                default:
70
                default:
71
                    throw new ArgumentOutOfRangeException();
71
                    throw new ArgumentOutOfRangeException();
72
            }
72
            }

Updated StructuredWeb/StructuredWeb/Domain/Business/Category.cs Download diff

106107
1
#region Using Statements
2
3
using System;
4
using System.Diagnostics;
5
6
#endregion
7
1
namespace StructuredWeb.Domain.Business
8
namespace StructuredWeb.Domain.Business
2
{
9
{
10
    [Serializable]
11
    [DebuggerDisplay("Id = {Id}, Name = {Name}, Description = {Description}")]
3
    public class Category
12
    public class Category
4
    {
13
    {
5
        public int Id { get; set; }
14
        public int Id { get; set; }

Updated StructuredWeb/StructuredWeb/Domain/Business/Component/Address.cs Download diff

106107
1
#region Using Statements
1
#region Using Statements
2
2
3
#endregion
4
5
#region Using Statements
6
7
using System;
3
using System;
8
using System.Diagnostics;
4
using System.Diagnostics;
9
5

Updated StructuredWeb/StructuredWeb/Domain/Business/Component/Person.cs Download diff

106107
1
using System;
1
#region Using Statements
2
using System.Collections.Generic;
3
using System.Linq;
4
using System.Text;
5
2
3
using System;
4
using System.Diagnostics;
5
6
#endregion
7
6
namespace StructuredWeb.Domain.Business.Component
8
namespace StructuredWeb.Domain.Business.Component
7
{
9
{
10
    [Serializable]
11
    [DebuggerDisplay("FirstName = {FirstName}, LastName = {LastName}")]
8
    public class Person
12
    public class Person
9
    {
13
    {
10
        public string FirstName { get; set; }
14
        public string FirstName { get; set; }
11
        public string LastName { get; set; }
15
        public string LastName { get; set; }
12
    }
16
    }
13
}
17
}

Updated StructuredWeb/StructuredWeb/Domain/Business/Customer.cs Download diff

106107
1
#region Using Statements
1
#region Using Statements
2
2
3
using System;
3
using System;
4
using System.Collections.Generic;
5
using System.Diagnostics;
4
using System.Diagnostics;
6
using Iesi.Collections.Generic;
7
using StructuredWeb.Domain.Business.Component;
5
using StructuredWeb.Domain.Business.Component;
8
6
9
#endregion
7
#endregion

Updated StructuredWeb/StructuredWeb/Domain/Business/CustomerDemographic.cs Download diff

106107
1
namespace StructuredWeb.Domain.Business
1
#region Using Statements
2
3
using System;
4
using System.Diagnostics;
5
6
#endregion
7
8
namespace StructuredWeb.Domain.Business
2
{
9
{
10
    [Serializable]
11
    [DebuggerDisplay("Id = {Id}, CustomerDesc = {CustomerDesc}")]
3
    public class CustomerDemographic
12
    public class CustomerDemographic
4
    {
13
    {
5
        public string Id { get; set; }
14
        public string Id { get; set; }

Updated StructuredWeb/StructuredWeb/Domain/Business/Order.cs Download diff

106107
1
#region Using Statements
1
#region Using Statements
2
2
3
using System;
3
using System;
4
using System.Diagnostics;
4
using StructuredWeb.Domain.Business.Component;
5
using StructuredWeb.Domain.Business.Component;
5
6
6
#endregion
7
#endregion
7
8
8
namespace StructuredWeb.Domain.Business
9
namespace StructuredWeb.Domain.Business
9
{
10
{
11
    [Serializable]
12
    [DebuggerDisplay("Id = {Id}, Customer = {Customer.Person.LastName}, Employee = {Employee.Person.LastName}")]
10
    public class Order
13
    public class Order
11
    {
14
    {
12
        private Address _address;
15
        private Address _address;

Updated StructuredWeb/StructuredWeb/Domain/Business/Product.cs Download diff

106107
1
namespace StructuredWeb.Domain.Business
1
#region Using Statements
2
3
using System;
4
using System.Diagnostics;
5
6
#endregion
7
8
namespace StructuredWeb.Domain.Business
2
{
9
{
10
    [Serializable]
11
    [DebuggerDisplay("Id = {Id}, ProductName = {ProductName}, Discontinued = {Discontinued}")]
3
    public class Product
12
    public class Product
4
    {
13
    {
5
        public int Id { get; set; }
14
        public int Id { get; set; }

Updated StructuredWeb/StructuredWeb/Domain/Business/Shipper.cs Download diff

106107
1
namespace StructuredWeb.Domain.Business
1
#region Using Statements
2
3
using System;
4
using System.Diagnostics;
5
6
#endregion
7
8
namespace StructuredWeb.Domain.Business
2
{
9
{
10
    [Serializable]
11
    [DebuggerDisplay("Id = {Id}, CompanyName = {CompanyName}, Phone = {Phone}")]
3
    public class Shipper
12
    public class Shipper
4
    {
13
    {
5
        public int Id { get; set; }
14
        public int Id { get; set; }

Updated StructuredWeb/StructuredWeb/Domain/Business/Supplier.cs Download diff

106107
1
namespace StructuredWeb.Domain.Business
1
#region Using Statements
2
3
using System;
4
using System.Diagnostics;
5
6
#endregion
7
8
namespace StructuredWeb.Domain.Business
2
{
9
{
10
    [Serializable]
11
    [DebuggerDisplay("Id = {Id}, CompanyName = {CompanyName}, ContactName = {ContactName}")]
3
    public class Supplier
12
    public class Supplier
4
    {
13
    {
5
        public int Id { get; set; }
14
        public int Id { get; set; }

Updated StructuredWeb/StructuredWeb/Domain/Business/Territory.cs Download diff

106107
9
namespace StructuredWeb.Domain.Business
9
namespace StructuredWeb.Domain.Business
10
{
10
{
11
    [Serializable]
11
    [Serializable]
12
    [DebuggerDisplay("Id = {Id}, Description = {Description}")]
12
    [DebuggerDisplay("Id = {Id}, Description = {Description}, Region = {Region}")]
13
    public class Territory
13
    public class Territory
14
    {
14
    {
15
        public string Id { get; set; }
15
        public string Id { get; set; }

Updated StructuredWeb/StructuredWeb/Repository/NHibernateDataAccess/NHibernateSessionManager.cs Download diff

106107
71
                                                                                 m.LazyLoad();
71
                                                                                 m.LazyLoad();
72
                                                                             };
72
                                                                             };
73
                                    }
73
                                    }
74
                )                
74
                )
75
                .ForTypesThatDeriveFrom<Employee>(autoMap =>
75
                .ForTypesThatDeriveFrom<Employee>(autoMap =>
76
                                                      {
76
                                                      {
77
                                                          autoMap.Map(p => p.JobTitle, "Title");
77
                                                          autoMap.Map(p => p.JobTitle, "Title");

Updated StructuredWeb/StructuredWeb/Repository/NHibernateDataAccess/Providers/EmployeeDataProvider.cs Download diff

106107
5
using StructuredWeb.Domain.Business;
5
using StructuredWeb.Domain.Business;
6
using StructuredWeb.Repository.NHibernateDataAccess.Conversation;
6
using StructuredWeb.Repository.NHibernateDataAccess.Conversation;
7
using StructuredWeb.Repository.NHibernateDataAccess.Providers.Interfaces;
7
using StructuredWeb.Repository.NHibernateDataAccess.Providers.Interfaces;
8
using Order = NHibernate.Criterion.Order;
8
using Order=NHibernate.Criterion.Order;
9
9
10
#endregion
10
#endregion
11
11
...
...
61
61
62
        IList<Territory> IEmployeeDataProvider.GetTerritories()
62
        IList<Territory> IEmployeeDataProvider.GetTerritories()
63
        {
63
        {
64
            return _conversation.Session.CreateCriteria(typeof(Territory)).List<Territory>();
64
            return _conversation.Session.CreateCriteria(typeof (Territory)).List<Territory>();
65
        }
65
        }
66
66
67
        #endregion
67
        #endregion

Updated StructuredWeb/StructuredWeb/Repository/NHibernateDataAccess/SessionConstraint.cs Download diff

106107
36
            }
36
            }
37
        }
37
        }
38
38
39
        /// These are the methods that return the physical boolean out of the extension method
40
41
        #region Public Boolean Methods
39
        #region Public Boolean Methods
42
40
43
        /// <summary>
41
        /// <summary>
...
...
94
92
95
        #endregion
93
        #endregion
96
94
97
        /// These are the methods that do the actual lifting
98
99
        #region Private Static Methods
95
        #region Private Static Methods
100
96
101
        /// <summary>
97
        /// <summary>
...
...
135
        }
131
        }
136
132
137
        #endregion
133
        #endregion
134
135
        /// These are the methods that return the physical boolean out of the extension method
136
137
        /// These are the methods that do the actual lifting
138
    }
138
    }
139
}
139
}

Updated StructuredWeb/StructuredWeb/Repository/Test/RepositoryTest/CustomerDataProviderTest.cs Download diff

106107
62
            id = id.Substring(0, 5);
62
            id = id.Substring(0, 5);
63
63
64
            var customer = new Customer
64
            var customer = new Customer
65
            {
65
                               {
66
                Id = id,
66
                                   Id = id,
67
                //Address = "address1",
67
                                   //Address = "address1",
68
                //City = "city",
68
                                   //City = "city",
69
                CompanyName = "company",
69
                                   CompanyName = "company",
70
                ContactName = "Maria Anders",
70
                                   ContactName = "Maria Anders",
71
                ContactTitle = "hi",
71
                                   ContactTitle = "hi",
72
                //Country = "America",
72
                                   //Country = "America",
73
                Fax = "123-234-4456",
73
                                   Fax = "123-234-4456",
74
                Phone = "123-444-5555",
74
                                   Phone = "123-444-5555",
75
                //PostalCode = "12345"
75
                                   //PostalCode = "12345"
76
            };
76
                               };
77
            _provider.Add(customer);
77
            _provider.Add(customer);
78
78
79
            Assert.AreEqual(id, customer.Id);
79
            Assert.AreEqual(id, customer.Id);

Updated StructuredWeb/StructuredWeb/StructuredWeb/Default.aspx Download diff

106107
63
                    </a>
63
                    </a>
64
                </td>
64
                </td>
65
                <td>
65
                <td>
66
                    <%# Eval("FirstName")%>
66
                    <%# Eval("Person.FirstName")%>
67
                </td>
67
                </td>
68
                <td>
68
                <td>
69
                    <%# Eval("LastName")%>
69
                    <%# Eval("Person.LastName")%>
70
                </td>
70
                </td>
71
                <td>
71
                <td>
72
                    <%# Eval("JobTitle")%>
72
                    <%# Eval("JobTitle")%>

Updated StructuredWeb/StructuredWeb/StructuredWeb/Default.aspx.cs Download diff

106107
2
2
3
using System;
3
using System;
4
using System.Collections.Generic;
4
using System.Collections.Generic;
5
using System.Linq;
6
using System.Web.UI;
7
using StructuredWeb.Domain.Business;
5
using StructuredWeb.Domain.Business;
8
using StructuredWeb.Modules.EmployeeManagement.View;
6
using StructuredWeb.Modules.EmployeeManagement.View;
9
using StructureMap;
10
7
11
#endregion
8
#endregion
12
9
13
namespace StructuredWeb
10
namespace StructuredWeb
14
{
11
{
15
    public partial class _Default : Page, IEmployeeView
12
    public partial class _Default : ViewBasePage<EmployeePresenter, IEmployeeView>, IEmployeeView
16
    {
13
    {
17
        private EmployeePresenter _presenter;
18
19
        public EmployeePresenter Presenter
20
        {
21
            get
22
            {
23
                if (_presenter == null)
24
                {
25
                    ObjectFactory.BuildUp(this);
26
                }
27
28
                return _presenter;
29
            }
30
            set
31
            {
32
                _presenter = value;
33
                _presenter.View = this;
34
            }
35
        }
36
37
        protected void Page_Load(object sender, EventArgs e)
14
        protected void Page_Load(object sender, EventArgs e)
38
        {
15
        {
39
            if (!Page.IsPostBack)
16
            if (!Page.IsPostBack)
40
            {
17
            {
41
                Presenter.OnViewInitialized();
18
                _presenter.OnViewInitialized();
42
            }
19
            }
43
20
44
            Presenter.OnViewLoaded();
21
            _presenter.OnViewLoaded();
45
            Page.DataBind();
22
            Page.DataBind();
46
        }
23
        }
47
24

Updated StructuredWeb/StructuredWeb/StructuredWeb/Default.aspx.designer.cs Download diff

106107
9
//------------------------------------------------------------------------------
9
//------------------------------------------------------------------------------
10
10
11
namespace StructuredWeb {
11
namespace StructuredWeb {
12
    
12
13
    
13
14
    public partial class _Default {
14
    public partial class _Default
15
    {
15
        
16
        
16
        /// <summary>
17
        /// <summary>
17
        /// Head1 control.
18
        /// Head1 control.

Updated StructuredWeb/StructuredWeb/StructuredWeb/StructuredWeb.csproj Download diff

106107
73
    <Compile Include="Global.asax.cs">
73
    <Compile Include="Global.asax.cs">
74
      <DependentUpon>Global.asax</DependentUpon>
74
      <DependentUpon>Global.asax</DependentUpon>
75
    </Compile>
75
    </Compile>
76
    <Compile Include="ViewBasePage.cs">
77
      <SubType>ASPXCodeBehind</SubType>
78
    </Compile>
76
  </ItemGroup>
79
  </ItemGroup>
77
  <ItemGroup>
80
  <ItemGroup>
78
    <Content Include="Config\ConnectionString.config" />
81
    <Content Include="Config\ConnectionString.config" />

Added StructuredWeb/StructuredWeb/StructuredWeb/ViewBasePage.cs

Show contents

Updated StructuredWeb/StructuredWeb/Validation/Test/ValidationFrameworkTest/EmployeeValidatorTest.cs Download diff

106107
36
        #region Test Methods
36
        #region Test Methods
37
37
38
        [Test]
38
        [Test]
39
        public void ValidEmployeeTest()
39
        public void InvalidEmployeeTest()
40
        {
40
        {
41
            var employee = new Employee {Person = new Person {FirstName = "Bob", LastName = "Bob"}};
41
            var employee = new Employee {Person = new Person {FirstName = string.Empty, LastName = string.Empty}};
42
42
43
            var results = ValidationFactory.Validate(employee);
43
            var results = ValidationFactory.Validate(employee);
44
44
45
            Assert.IsNotNull(results);
45
            Assert.IsNotNull(results);
46
            Assert.IsTrue(results.Valid);
46
            Assert.IsFalse(results.Valid);
47
            Assert.IsTrue(results.Messages.Count == 0);
47
            Assert.IsTrue(results.Messages.Count > 0);
48
        }
48
        }
49
49
50
        [Test]
50
        [Test]
51
        public void ValidEmployeeWithWarningsTest()
51
        public void ValidEmployeeTest()
52
        {
52
        {
53
            var employee = new Employee {Person = new Person {FirstName = "Bob", LastName = "Bob"}, HireDate = new DateTime(3112, 3, 12)};
53
            var employee = new Employee {Person = new Person {FirstName = "Bob", LastName = "Bob"}};
54
54
55
            var results = ValidationFactory.Validate(employee);
55
            var results = ValidationFactory.Validate(employee);
56
56
57
            Assert.IsNotNull(results);
57
            Assert.IsNotNull(results);
58
            Assert.IsTrue(results.Valid);
58
            Assert.IsTrue(results.Valid);
59
            Assert.IsTrue(results.Messages.Count > 0);
59
            Assert.IsTrue(results.Messages.Count == 0);
60
        }
60
        }
61
61
62
63
        [Test]
62
        [Test]
64
        public void InvalidEmployeeTest()
63
        public void ValidEmployeeWithWarningsTest()
65
        {
64
        {
66
            var employee = new Employee {Person = new Person {FirstName = string.Empty, LastName = string.Empty}};
65
            var employee = new Employee {Person = new Person {FirstName = "Bob", LastName = "Bob"}, HireDate = new DateTime(3112, 3, 12)};
67
66
68
            var results = ValidationFactory.Validate(employee);
67
            var results = ValidationFactory.Validate(employee);
69
68
70
            Assert.IsNotNull(results);
69
            Assert.IsNotNull(results);
71
            Assert.IsFalse(results.Valid);
70
            Assert.IsTrue(results.Valid);
72
            Assert.IsTrue(results.Messages.Count > 0);
71
            Assert.IsTrue(results.Messages.Count > 0);
73
        }
72
        }
74
73

Updated StructuredWeb/StructuredWeb/Validation/Test/ValidationFrameworkTest/Properties/AssemblyInfo.cs Download diff

106107
1
using System.Reflection;
1
#region Using Statements
2
using System.Runtime.CompilerServices;
2
3
using System.Reflection;
3
using System.Runtime.InteropServices;
4
using System.Runtime.InteropServices;
4
5
6
#endregion
7
5
// General Information about an assembly is controlled through the following 
8
// General Information about an assembly is controlled through the following 
6
// set of attributes. Change these attribute values to modify the information
9
// set of attributes. Change these attribute values to modify the information
7
// associated with an assembly.
10
// associated with an assembly.
11
8
[assembly: AssemblyTitle("ValidationFrameworkTest")]
12
[assembly: AssemblyTitle("ValidationFrameworkTest")]
9
[assembly: AssemblyDescription("")]
13
[assembly: AssemblyDescription("")]
10
[assembly: AssemblyConfiguration("")]
14
[assembly: AssemblyConfiguration("")]
...
...
17
// Setting ComVisible to false makes the types in this assembly not visible 
21
// Setting ComVisible to false makes the types in this assembly not visible 
18
// to COM components.  If you need to access a type in this assembly from 
22
// to COM components.  If you need to access a type in this assembly from 
19
// COM, set the ComVisible attribute to true on that type.
23
// COM, set the ComVisible attribute to true on that type.
24
20
[assembly: ComVisible(false)]
25
[assembly: ComVisible(false)]
21
26
22
// The following GUID is for the ID of the typelib if this project is exposed to COM
27
// The following GUID is for the ID of the typelib if this project is exposed to COM
28
23
[assembly: Guid("418644ba-5dc9-4af1-8b12-973b6d2463db")]
29
[assembly: Guid("418644ba-5dc9-4af1-8b12-973b6d2463db")]
24
30
25
// Version information for an assembly consists of the following four values:
31
// Version information for an assembly consists of the following four values:
...
...
32
// You can specify all the values or you can default the Build and Revision Numbers 
38
// You can specify all the values or you can default the Build and Revision Numbers 
33
// by using the '*' as shown below:
39
// by using the '*' as shown below:
34
// [assembly: AssemblyVersion("1.0.*")]
40
// [assembly: AssemblyVersion("1.0.*")]
41
35
[assembly: AssemblyVersion("1.0.0.0")]
42
[assembly: AssemblyVersion("1.0.0.0")]
36
[assembly: AssemblyFileVersion("1.0.0.0")]
43
[assembly: AssemblyFileVersion("1.0.0.0")]

Updated StructuredWeb/StructuredWeb/Validation/ValidationFramework/Properties/AssemblyInfo.cs Download diff

106107
1
using System.Reflection;
1
#region Using Statements
2
using System.Runtime.CompilerServices;
2
3
using System.Reflection;
3
using System.Runtime.InteropServices;
4
using System.Runtime.InteropServices;
4
5
6
#endregion
7
5
// General Information about an assembly is controlled through the following 
8
// General Information about an assembly is controlled through the following 
6
// set of attributes. Change these attribute values to modify the information
9
// set of attributes. Change these attribute values to modify the information
7
// associated with an assembly.
10
// associated with an assembly.
11
8
[assembly: AssemblyTitle("ValidationFramework")]
12
[assembly: AssemblyTitle("ValidationFramework")]
9
[assembly: AssemblyDescription("")]
13
[assembly: AssemblyDescription("")]
10
[assembly: AssemblyConfiguration("")]
14
[assembly: AssemblyConfiguration("")]
...
...
17
// Setting ComVisible to false makes the types in this assembly not visible 
21
// Setting ComVisible to false makes the types in this assembly not visible 
18
// to COM components.  If you need to access a type in this assembly from 
22
// to COM components.  If you need to access a type in this assembly from 
19
// COM, set the ComVisible attribute to true on that type.
23
// COM, set the ComVisible attribute to true on that type.
24
20
[assembly: ComVisible(false)]
25
[assembly: ComVisible(false)]
21
26
22
// The following GUID is for the ID of the typelib if this project is exposed to COM
27
// The following GUID is for the ID of the typelib if this project is exposed to COM
28
23
[assembly: Guid("d3b10a08-b978-461e-916a-eb22fdf33dcc")]
29
[assembly: Guid("d3b10a08-b978-461e-916a-eb22fdf33dcc")]
24
30
25
// Version information for an assembly consists of the following four values:
31
// Version information for an assembly consists of the following four values:
...
...
32
// You can specify all the values or you can default the Build and Revision Numbers 
38
// You can specify all the values or you can default the Build and Revision Numbers 
33
// by using the '*' as shown below:
39
// by using the '*' as shown below:
34
// [assembly: AssemblyVersion("1.0.*")]
40
// [assembly: AssemblyVersion("1.0.*")]
41
35
[assembly: AssemblyVersion("1.0.0.0")]
42
[assembly: AssemblyVersion("1.0.0.0")]
36
[assembly: AssemblyFileVersion("1.0.0.0")]
43
[assembly: AssemblyFileVersion("1.0.0.0")]

Updated StructuredWeb/StructuredWeb/Validation/ValidationFramework/Result/ValidationMessage.cs Download diff

106107
2
{
2
{
3
    public sealed class ValidationMessage
3
    public sealed class ValidationMessage
4
    {
4
    {
5
        internal ValidationMessage()
6
        {
7
        }
8
5
        public string Message { get; internal set; }
9
        public string Message { get; internal set; }
6
        public bool Warning { get; internal set; }
10
        public bool Warning { get; internal set; }
7
11
8
        //Only allow creation internally or by ValidationResult class.
12
        //Only allow creation internally or by ValidationResult class.
9
        internal ValidationMessage()
10
        {
11
        }
12
    }
13
    }
13
}
14
}

Updated StructuredWeb/StructuredWeb/Validation/ValidationFramework/Result/ValidationResult.cs Download diff

106107
12
        private bool _dirty = true;
12
        private bool _dirty = true;
13
        private bool _valid;
13
        private bool _valid;
14
14
15
        public ValidationResult()
16
        {
17
            Messages = new List<ValidationMessage>();
18
        }
19
15
        public bool Valid
20
        public bool Valid
16
        {
21
        {
17
            get
22
            get
...
...
28
            }
33
            }
29
        }
34
        }
30
35
31
        public ValidationResult()
32
        {
33
            Messages = new List<ValidationMessage>();
34
        }
35
36
        public IList<ValidationMessage> Messages { get; internal set; }
36
        public IList<ValidationMessage> Messages { get; internal set; }
37
37
38
        /// <summary>
38
        /// <summary>

Updated StructuredWeb/StructuredWeb/Validation/ValidationFramework/Validators/EmployeeValidator.cs Download diff

106107
27
            if (employee != null)
27
            if (employee != null)
28
            {
28
            {
29
                if (!suppressWarnings && employee.HireDate > DateTime.Now)
29
                if (!suppressWarnings && employee.HireDate > DateTime.Now)
30
                    result.Messages.Add(new ValidationMessage {
30
                    result.Messages.Add(new ValidationMessage
31
                        Message = string.Format("Employee hire date: {0} is set in the future.", employee.HireDate), 
31
                                            {
32
                        Warning = true});
32
                                                Message = string.Format("Employee hire date: {0} is set in the future.", employee.HireDate),
33
                                                Warning = true
34
                                            });
33
35
34
                if (employee.Person != null)
36
                if (employee.Person != null)
35
                {
37
                {