Commit for development environment setup

This commit is contained in:
2023-06-19 16:12:33 -04:00
parent be72063a3c
commit bbce2ad0a6
2209 changed files with 1171775 additions and 625 deletions

View File

@@ -0,0 +1,71 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
</configSections>
<log4net>
<appender name="LogFileAppender" type="log4net.Appender.FileAppender">
<param name="File" value="Log4Net.txt" />
<param name="AppendToFile" value="false" />
<layout type="log4net.Layout.PatternLayout">
<param name="Header" value="[Header]\r\n" />
<param name="Footer" value="[Footer]\r\n" />
<param name="ConversionPattern" value="%d [%t] %-5p %c - %m%n" />
</layout>
</appender>
<appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender" >
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="--> %date [%thread] %-5level %logger (%property{log4net:HostName}) [%ndc] - %message%newline" />
</layout>
</appender>
<appender name="EventLogAppender" type="log4net.Appender.EventLogAppender">
<threshold value="WARN" />
<mapping>
<level value="DEBUG" />
<eventLogEntryType value="Information" />
</mapping>
<mapping>
<level value="INFO" />
<eventLogEntryType value="Information" />
</mapping>
<mapping>
<level value="WARN" />
<eventLogEntryType value="Warning" />
</mapping>
<mapping>
<level value="ERROR" />
<eventLogEntryType value="Error" />
</mapping>
<mapping>
<level value="FATAL" />
<eventLogEntryType value="Error" />
</mapping>
<layout type="log4net.Layout.PatternLayout">
<param name="ConversionPattern" value="---> %d [%t] %-5p %c - %m%n" />
</layout>
</appender>
<root>
<level value="ALL" />
<appender-ref ref="ConsoleAppender" />
<appender-ref ref="LogFileAppender" />
<appender-ref ref="EventLogAppender" />
</root>
<logger name="Volian.Object.Library">
<level value="WARN" />
</logger>
</log4net>
<appSettings>
<add key="CslaAuthentication" value="Windows" />
<!-- Active Connection -->
<!-- Inactive Connections
-->
</appSettings>
<connectionStrings>
<!--<add name="VEPROMS"
connectionString="Data Source=rhmdesktop\SQLEXPRESS;AttachDbFilename=&quot;C:\VS2005Projects\VEPROMS_USERS\VEPROMS_Users.mdf&quot;;Integrated Security=True;User Instance=True"
providerName="System.Data.SqlClient" />-->
<add name="VEPROMS"
connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=VEPROMS_Users;Integrated Security=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
</configuration>

View File

@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Windows.Forms;
namespace SimpleTest
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new frmMain());
}
}
}

View File

@@ -0,0 +1,33 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("SimpleTest")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Volian Enterprises, Inc.")]
[assembly: AssemblyProduct("SimpleTest")]
[assembly: AssemblyCopyright("Copyright © Volian Enterprises, Inc. 2006")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("297cf552-63cf-447f-af61-a2301a8d2e93")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is automatically generated by Visual Studio .Net. It is
used to store generic object data source configuration information.
Renaming the file extension or editing the content of this file may
cause the file to be unrecognizable by the program.
-->
<GenericObjectDataSource DisplayName="User" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
<TypeInfo>Volian.Object.Library.User, Volian.Object.Library, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
</GenericObjectDataSource>

View File

@@ -0,0 +1,63 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.42
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace SimpleTest.Properties {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SimpleTest.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
}
}

View File

@@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -0,0 +1,26 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.42
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace SimpleTest.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "8.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
}
}

View File

@@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

View File

@@ -0,0 +1,105 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.50727</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{4D60F98F-D018-4447-B123-E3BDDE9C60F8}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>SimpleTest</RootNamespace>
<AssemblyName>SimpleTest</AssemblyName>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Csla, Version=2.1.4.0, Culture=neutral, PublicKeyToken=93be5fdc093e4c30, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\VEPROMS.CSLA.Library\bin\Debug\Csla.dll</HintPath>
</Reference>
<Reference Include="log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\Log4Net\log4net-1.2.10\bin\net\2.0\release\log4net.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="frmMain.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="frmMain.Designer.cs">
<DependentUpon>frmMain.cs</DependentUpon>
</Compile>
<Compile Include="frmUser.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="frmUser.Designer.cs">
<DependentUpon>frmUser.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="frmMain.resx">
<SubType>Designer</SubType>
<DependentUpon>frmMain.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="frmUser.resx">
<SubType>Designer</SubType>
<DependentUpon>frmUser.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<None Include="App.config" />
<None Include="Properties\DataSources\Volian.Object.Library.User.datasource" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Volian.Object.Library\Volian.Object.Library.csproj">
<Project>{592B86E9-D488-452B-B89B-2BB037793FE3}</Project>
<Name>Volian.Object.Library</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@@ -0,0 +1,104 @@
namespace SimpleTest
{
partial class frmMain
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.users1ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.users2ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.menuStrip1.SuspendLayout();
this.SuspendLayout();
//
// menuStrip1
//
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.fileToolStripMenuItem,
this.users1ToolStripMenuItem,
this.users2ToolStripMenuItem});
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.Size = new System.Drawing.Size(804, 26);
this.menuStrip1.TabIndex = 1;
this.menuStrip1.Text = "menuStrip1";
//
// fileToolStripMenuItem
//
this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.exitToolStripMenuItem});
this.fileToolStripMenuItem.Name = "fileToolStripMenuItem";
this.fileToolStripMenuItem.Size = new System.Drawing.Size(40, 22);
this.fileToolStripMenuItem.Text = "&File";
//
// exitToolStripMenuItem
//
this.exitToolStripMenuItem.Name = "exitToolStripMenuItem";
this.exitToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.exitToolStripMenuItem.Text = "E&xit";
//
// users1ToolStripMenuItem
//
this.users1ToolStripMenuItem.Name = "users1ToolStripMenuItem";
this.users1ToolStripMenuItem.Size = new System.Drawing.Size(70, 22);
this.users1ToolStripMenuItem.Text = "Users 1";
//
// users2ToolStripMenuItem
//
this.users2ToolStripMenuItem.Name = "users2ToolStripMenuItem";
this.users2ToolStripMenuItem.Size = new System.Drawing.Size(70, 22);
this.users2ToolStripMenuItem.Text = "Users 2";
//
// frmMain
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(804, 511);
this.Controls.Add(this.menuStrip1);
this.IsMdiContainer = true;
this.MainMenuStrip = this.menuStrip1;
this.Name = "frmMain";
this.Text = "VE-PROMS Security";
this.Load += new System.EventHandler(this.frmMain_Load);
this.menuStrip1.ResumeLayout(false);
this.menuStrip1.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.MenuStrip menuStrip1;
private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem users1ToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem users2ToolStripMenuItem;
}
}

View File

@@ -0,0 +1,59 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Csla;
using Volian.Object.Library;
[assembly: log4net.Config.XmlConfigurator(Watch = true)]
namespace SimpleTest
{
public partial class frmMain : Form
{
public frmMain()
{
InitializeComponent();
}
private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
private void frmMain_Load(object sender, EventArgs e)
{
// Lets setup the menu
foreach (UserInfo ui in UserInfoList.Get())
{
users1ToolStripMenuItem.DropDownItems.Add(new vlnMenuItem(ui,this));
users2ToolStripMenuItem.DropDownItems.Add(new vlnMenuItem(ui,this));
}
}
private class vlnMenuItem:ToolStripMenuItem
{
private UserInfo _userInfo;
public UserInfo UserInfo
{
get { return _userInfo; }
}
private Form _form;
public Form Form
{
get { return _form; }
}
public vlnMenuItem(UserInfo userInfo,Form form): base(userInfo.FullName)
{
_userInfo = userInfo;
_form = form;
base.Click += new EventHandler(mi_Click);
}
void mi_Click(object sender, EventArgs e)
{
// Open a User Form
vlnMenuItem mi = (vlnMenuItem)sender;
frmUser u = new frmUser(mi.UserInfo.Uid);
u.MdiParent = _form;
u.Show();
}
}
}
}

View File

@@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

View File

@@ -0,0 +1,479 @@
namespace SimpleTest
{
partial class frmUser
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.Windows.Forms.Label cfgNameLabel;
System.Windows.Forms.Label courtesyTitleLabel;
System.Windows.Forms.Label firstNameLabel;
System.Windows.Forms.Label lastNameLabel;
System.Windows.Forms.Label middleNameLabel;
System.Windows.Forms.Label phoneNumberLabel;
System.Windows.Forms.Label suffixLabel;
System.Windows.Forms.Label uidLabel;
System.Windows.Forms.Label useridLabel;
System.Windows.Forms.Label userLoginLabel;
System.Windows.Forms.Label userNameLabel;
System.Windows.Forms.Label configLabel;
this.userBindingSource = new System.Windows.Forms.BindingSource(this.components);
this.panel1 = new System.Windows.Forms.Panel();
this.btnCancel = new System.Windows.Forms.Button();
this.btnSave = new System.Windows.Forms.Button();
this.configTextBox = new System.Windows.Forms.TextBox();
this.cfgNameTextBox = new System.Windows.Forms.TextBox();
this.courtesyTitleTextBox = new System.Windows.Forms.TextBox();
this.firstNameTextBox = new System.Windows.Forms.TextBox();
this.lastNameTextBox = new System.Windows.Forms.TextBox();
this.middleNameTextBox = new System.Windows.Forms.TextBox();
this.phoneNumberTextBox = new System.Windows.Forms.TextBox();
this.suffixTextBox = new System.Windows.Forms.TextBox();
this.useridTextBox = new System.Windows.Forms.TextBox();
this.userLoginTextBox = new System.Windows.Forms.TextBox();
this.userNameTextBox = new System.Windows.Forms.TextBox();
this.uidTextBox = new System.Windows.Forms.TextBox();
this.userMembershipsBindingSource = new System.Windows.Forms.BindingSource(this.components);
this.userMembershipsDataGridView = new System.Windows.Forms.DataGridView();
this.dataGridViewTextBoxColumn3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.dataGridViewTextBoxColumn11 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.dataGridViewTextBoxColumn7 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.dataGridViewTextBoxColumn5 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.dataGridViewTextBoxColumn6 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.panel2 = new System.Windows.Forms.Panel();
cfgNameLabel = new System.Windows.Forms.Label();
courtesyTitleLabel = new System.Windows.Forms.Label();
firstNameLabel = new System.Windows.Forms.Label();
lastNameLabel = new System.Windows.Forms.Label();
middleNameLabel = new System.Windows.Forms.Label();
phoneNumberLabel = new System.Windows.Forms.Label();
suffixLabel = new System.Windows.Forms.Label();
uidLabel = new System.Windows.Forms.Label();
useridLabel = new System.Windows.Forms.Label();
userLoginLabel = new System.Windows.Forms.Label();
userNameLabel = new System.Windows.Forms.Label();
configLabel = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.userBindingSource)).BeginInit();
this.panel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.userMembershipsBindingSource)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.userMembershipsDataGridView)).BeginInit();
this.SuspendLayout();
//
// cfgNameLabel
//
cfgNameLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
cfgNameLabel.AutoSize = true;
cfgNameLabel.Location = new System.Drawing.Point(418, 69);
cfgNameLabel.Name = "cfgNameLabel";
cfgNameLabel.Size = new System.Drawing.Size(74, 17);
cfgNameLabel.TabIndex = 29;
cfgNameLabel.Text = "Cfg Name:";
//
// courtesyTitleLabel
//
courtesyTitleLabel.AutoSize = true;
courtesyTitleLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
courtesyTitleLabel.Location = new System.Drawing.Point(52, 37);
courtesyTitleLabel.Name = "courtesyTitleLabel";
courtesyTitleLabel.Size = new System.Drawing.Size(35, 17);
courtesyTitleLabel.TabIndex = 31;
courtesyTitleLabel.Text = "Title";
//
// firstNameLabel
//
firstNameLabel.AutoSize = true;
firstNameLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
firstNameLabel.Location = new System.Drawing.Point(94, 37);
firstNameLabel.Name = "firstNameLabel";
firstNameLabel.Size = new System.Drawing.Size(35, 17);
firstNameLabel.TabIndex = 33;
firstNameLabel.Text = "First";
//
// lastNameLabel
//
lastNameLabel.AutoSize = true;
lastNameLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
lastNameLabel.Location = new System.Drawing.Point(258, 37);
lastNameLabel.Name = "lastNameLabel";
lastNameLabel.Size = new System.Drawing.Size(35, 17);
lastNameLabel.TabIndex = 35;
lastNameLabel.Text = "Last";
//
// middleNameLabel
//
middleNameLabel.AutoSize = true;
middleNameLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
middleNameLabel.Location = new System.Drawing.Point(173, 37);
middleNameLabel.Name = "middleNameLabel";
middleNameLabel.Size = new System.Drawing.Size(49, 17);
middleNameLabel.TabIndex = 37;
middleNameLabel.Text = "Middle";
//
// phoneNumberLabel
//
phoneNumberLabel.AutoSize = true;
phoneNumberLabel.Location = new System.Drawing.Point(10, 57);
phoneNumberLabel.Name = "phoneNumberLabel";
phoneNumberLabel.Size = new System.Drawing.Size(53, 17);
phoneNumberLabel.TabIndex = 39;
phoneNumberLabel.Text = "Phone:";
//
// suffixLabel
//
suffixLabel.AutoSize = true;
suffixLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
suffixLabel.Location = new System.Drawing.Point(353, 36);
suffixLabel.Name = "suffixLabel";
suffixLabel.Size = new System.Drawing.Size(42, 17);
suffixLabel.TabIndex = 41;
suffixLabel.Text = "Suffix";
//
// uidLabel
//
uidLabel.AutoSize = true;
uidLabel.Location = new System.Drawing.Point(13, 17);
uidLabel.Name = "uidLabel";
uidLabel.Size = new System.Drawing.Size(49, 17);
uidLabel.TabIndex = 43;
uidLabel.Text = "Name:";
//
// useridLabel
//
useridLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
useridLabel.AutoSize = true;
useridLabel.Location = new System.Drawing.Point(420, 99);
useridLabel.Name = "useridLabel";
useridLabel.Size = new System.Drawing.Size(53, 17);
useridLabel.TabIndex = 44;
useridLabel.Text = "Userid:";
//
// userLoginLabel
//
userLoginLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
userLoginLabel.AutoSize = true;
userLoginLabel.Location = new System.Drawing.Point(420, 127);
userLoginLabel.Name = "userLoginLabel";
userLoginLabel.Size = new System.Drawing.Size(81, 17);
userLoginLabel.TabIndex = 46;
userLoginLabel.Text = "User Login:";
//
// userNameLabel
//
userNameLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
userNameLabel.AutoSize = true;
userNameLabel.Location = new System.Drawing.Point(418, 41);
userNameLabel.Name = "userNameLabel";
userNameLabel.Size = new System.Drawing.Size(83, 17);
userNameLabel.TabIndex = 48;
userNameLabel.Text = "User Name:";
//
// configLabel
//
configLabel.AutoSize = true;
configLabel.Location = new System.Drawing.Point(13, 88);
configLabel.Name = "configLabel";
configLabel.Size = new System.Drawing.Size(52, 17);
configLabel.TabIndex = 50;
configLabel.Text = "Config:";
//
// userBindingSource
//
this.userBindingSource.DataSource = typeof(Volian.Object.Library.User);
//
// panel1
//
this.panel1.Controls.Add(this.btnCancel);
this.panel1.Controls.Add(this.btnSave);
this.panel1.Controls.Add(configLabel);
this.panel1.Controls.Add(this.configTextBox);
this.panel1.Controls.Add(cfgNameLabel);
this.panel1.Controls.Add(this.cfgNameTextBox);
this.panel1.Controls.Add(courtesyTitleLabel);
this.panel1.Controls.Add(this.courtesyTitleTextBox);
this.panel1.Controls.Add(firstNameLabel);
this.panel1.Controls.Add(this.firstNameTextBox);
this.panel1.Controls.Add(lastNameLabel);
this.panel1.Controls.Add(this.lastNameTextBox);
this.panel1.Controls.Add(middleNameLabel);
this.panel1.Controls.Add(this.middleNameTextBox);
this.panel1.Controls.Add(phoneNumberLabel);
this.panel1.Controls.Add(this.phoneNumberTextBox);
this.panel1.Controls.Add(suffixLabel);
this.panel1.Controls.Add(this.suffixTextBox);
this.panel1.Controls.Add(uidLabel);
this.panel1.Controls.Add(useridLabel);
this.panel1.Controls.Add(this.useridTextBox);
this.panel1.Controls.Add(userLoginLabel);
this.panel1.Controls.Add(this.userLoginTextBox);
this.panel1.Controls.Add(userNameLabel);
this.panel1.Controls.Add(this.userNameTextBox);
this.panel1.Controls.Add(this.uidTextBox);
this.panel1.Dock = System.Windows.Forms.DockStyle.Top;
this.panel1.Location = new System.Drawing.Point(0, 0);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(721, 158);
this.panel1.TabIndex = 29;
//
// btnCancel
//
this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnCancel.Location = new System.Drawing.Point(634, 38);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(75, 23);
this.btnCancel.TabIndex = 53;
this.btnCancel.Text = "Cancel";
this.btnCancel.UseVisualStyleBackColor = true;
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
//
// btnSave
//
this.btnSave.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnSave.Location = new System.Drawing.Point(634, 10);
this.btnSave.Name = "btnSave";
this.btnSave.Size = new System.Drawing.Size(75, 23);
this.btnSave.TabIndex = 52;
this.btnSave.Text = "Save";
this.btnSave.UseVisualStyleBackColor = true;
this.btnSave.Click += new System.EventHandler(this.btnSave_Click);
//
// configTextBox
//
this.configTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.userBindingSource, "Config", true));
this.configTextBox.Location = new System.Drawing.Point(71, 85);
this.configTextBox.Multiline = true;
this.configTextBox.Name = "configTextBox";
this.configTextBox.Size = new System.Drawing.Size(335, 65);
this.configTextBox.TabIndex = 51;
//
// cfgNameTextBox
//
this.cfgNameTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.cfgNameTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.userBindingSource, "CfgName", true));
this.cfgNameTextBox.Location = new System.Drawing.Point(507, 66);
this.cfgNameTextBox.Name = "cfgNameTextBox";
this.cfgNameTextBox.Size = new System.Drawing.Size(83, 22);
this.cfgNameTextBox.TabIndex = 30;
//
// courtesyTitleTextBox
//
this.courtesyTitleTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.userBindingSource, "CourtesyTitle", true));
this.courtesyTitleTextBox.Location = new System.Drawing.Point(55, 12);
this.courtesyTitleTextBox.Name = "courtesyTitleTextBox";
this.courtesyTitleTextBox.Size = new System.Drawing.Size(36, 22);
this.courtesyTitleTextBox.TabIndex = 32;
//
// firstNameTextBox
//
this.firstNameTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.userBindingSource, "FirstName", true));
this.firstNameTextBox.Location = new System.Drawing.Point(97, 12);
this.firstNameTextBox.Name = "firstNameTextBox";
this.firstNameTextBox.Size = new System.Drawing.Size(73, 22);
this.firstNameTextBox.TabIndex = 34;
//
// lastNameTextBox
//
this.lastNameTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.userBindingSource, "LastName", true));
this.lastNameTextBox.Location = new System.Drawing.Point(261, 12);
this.lastNameTextBox.Name = "lastNameTextBox";
this.lastNameTextBox.Size = new System.Drawing.Size(89, 22);
this.lastNameTextBox.TabIndex = 36;
//
// middleNameTextBox
//
this.middleNameTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.userBindingSource, "MiddleName", true));
this.middleNameTextBox.Location = new System.Drawing.Point(176, 12);
this.middleNameTextBox.Name = "middleNameTextBox";
this.middleNameTextBox.Size = new System.Drawing.Size(79, 22);
this.middleNameTextBox.TabIndex = 38;
//
// phoneNumberTextBox
//
this.phoneNumberTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.userBindingSource, "PhoneNumber", true));
this.phoneNumberTextBox.Location = new System.Drawing.Point(71, 57);
this.phoneNumberTextBox.Name = "phoneNumberTextBox";
this.phoneNumberTextBox.Size = new System.Drawing.Size(145, 22);
this.phoneNumberTextBox.TabIndex = 40;
//
// suffixTextBox
//
this.suffixTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.userBindingSource, "Suffix", true));
this.suffixTextBox.Location = new System.Drawing.Point(356, 11);
this.suffixTextBox.Name = "suffixTextBox";
this.suffixTextBox.Size = new System.Drawing.Size(50, 22);
this.suffixTextBox.TabIndex = 42;
//
// useridTextBox
//
this.useridTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.useridTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.userBindingSource, "Userid", true));
this.useridTextBox.Location = new System.Drawing.Point(507, 94);
this.useridTextBox.Name = "useridTextBox";
this.useridTextBox.Size = new System.Drawing.Size(83, 22);
this.useridTextBox.TabIndex = 45;
//
// userLoginTextBox
//
this.userLoginTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.userLoginTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.userBindingSource, "UserLogin", true));
this.userLoginTextBox.Location = new System.Drawing.Point(507, 124);
this.userLoginTextBox.Name = "userLoginTextBox";
this.userLoginTextBox.Size = new System.Drawing.Size(83, 22);
this.userLoginTextBox.TabIndex = 47;
//
// userNameTextBox
//
this.userNameTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.userNameTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.userBindingSource, "UserName", true));
this.userNameTextBox.Location = new System.Drawing.Point(507, 36);
this.userNameTextBox.Name = "userNameTextBox";
this.userNameTextBox.Size = new System.Drawing.Size(83, 22);
this.userNameTextBox.TabIndex = 49;
//
// uidTextBox
//
this.uidTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.uidTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.userBindingSource, "Uid", true));
this.uidTextBox.Enabled = false;
this.uidTextBox.Location = new System.Drawing.Point(547, 11);
this.uidTextBox.Name = "uidTextBox";
this.uidTextBox.Size = new System.Drawing.Size(40, 22);
this.uidTextBox.TabIndex = 23;
//
// userMembershipsBindingSource
//
this.userMembershipsBindingSource.AllowNew = false;
this.userMembershipsBindingSource.DataMember = "UserMemberships";
this.userMembershipsBindingSource.DataSource = this.userBindingSource;
//
// userMembershipsDataGridView
//
this.userMembershipsDataGridView.AutoGenerateColumns = false;
this.userMembershipsDataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.dataGridViewTextBoxColumn3,
this.dataGridViewTextBoxColumn11,
this.dataGridViewTextBoxColumn7,
this.dataGridViewTextBoxColumn5,
this.dataGridViewTextBoxColumn6});
this.userMembershipsDataGridView.DataSource = this.userMembershipsBindingSource;
this.userMembershipsDataGridView.Dock = System.Windows.Forms.DockStyle.Fill;
this.userMembershipsDataGridView.Location = new System.Drawing.Point(0, 196);
this.userMembershipsDataGridView.Name = "userMembershipsDataGridView";
this.userMembershipsDataGridView.RowTemplate.Height = 24;
this.userMembershipsDataGridView.Size = new System.Drawing.Size(721, 223);
this.userMembershipsDataGridView.TabIndex = 29;
//
// dataGridViewTextBoxColumn3
//
this.dataGridViewTextBoxColumn3.DataPropertyName = "Ugid";
this.dataGridViewTextBoxColumn3.HeaderText = "Ugid";
this.dataGridViewTextBoxColumn3.Name = "dataGridViewTextBoxColumn3";
this.dataGridViewTextBoxColumn3.ReadOnly = true;
this.dataGridViewTextBoxColumn3.Visible = false;
//
// dataGridViewTextBoxColumn11
//
this.dataGridViewTextBoxColumn11.DataPropertyName = "Gid";
this.dataGridViewTextBoxColumn11.HeaderText = "Gid";
this.dataGridViewTextBoxColumn11.Name = "dataGridViewTextBoxColumn11";
this.dataGridViewTextBoxColumn11.Visible = false;
//
// dataGridViewTextBoxColumn7
//
this.dataGridViewTextBoxColumn7.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
this.dataGridViewTextBoxColumn7.DataPropertyName = "Group_GroupName";
this.dataGridViewTextBoxColumn7.HeaderText = "Group";
this.dataGridViewTextBoxColumn7.Name = "dataGridViewTextBoxColumn7";
this.dataGridViewTextBoxColumn7.ReadOnly = true;
//
// dataGridViewTextBoxColumn5
//
this.dataGridViewTextBoxColumn5.DataPropertyName = "StartDate";
this.dataGridViewTextBoxColumn5.HeaderText = "Start";
this.dataGridViewTextBoxColumn5.Name = "dataGridViewTextBoxColumn5";
//
// dataGridViewTextBoxColumn6
//
this.dataGridViewTextBoxColumn6.DataPropertyName = "EndDate";
this.dataGridViewTextBoxColumn6.HeaderText = "End";
this.dataGridViewTextBoxColumn6.Name = "dataGridViewTextBoxColumn6";
//
// panel2
//
this.panel2.Dock = System.Windows.Forms.DockStyle.Top;
this.panel2.Location = new System.Drawing.Point(0, 158);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(721, 38);
this.panel2.TabIndex = 30;
//
// frmUser
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(721, 419);
this.Controls.Add(this.userMembershipsDataGridView);
this.Controls.Add(this.panel2);
this.Controls.Add(this.panel1);
this.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.userBindingSource, "FullName", true));
this.Name = "frmUser";
this.Text = "frmUser";
((System.ComponentModel.ISupportInitialize)(this.userBindingSource)).EndInit();
this.panel1.ResumeLayout(false);
this.panel1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.userMembershipsBindingSource)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.userMembershipsDataGridView)).EndInit();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.BindingSource userBindingSource;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.TextBox cfgNameTextBox;
private System.Windows.Forms.TextBox courtesyTitleTextBox;
private System.Windows.Forms.TextBox firstNameTextBox;
private System.Windows.Forms.TextBox lastNameTextBox;
private System.Windows.Forms.TextBox middleNameTextBox;
private System.Windows.Forms.TextBox phoneNumberTextBox;
private System.Windows.Forms.TextBox suffixTextBox;
private System.Windows.Forms.TextBox useridTextBox;
private System.Windows.Forms.TextBox userLoginTextBox;
private System.Windows.Forms.TextBox userNameTextBox;
private System.Windows.Forms.TextBox uidTextBox;
private System.Windows.Forms.TextBox configTextBox;
private System.Windows.Forms.BindingSource userMembershipsBindingSource;
private System.Windows.Forms.DataGridView userMembershipsDataGridView;
private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn3;
private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn11;
private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn7;
private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn5;
private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn6;
private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.Button btnCancel;
private System.Windows.Forms.Button btnSave;
}
}

View File

@@ -0,0 +1,108 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Csla;
using Volian.Object.Library;
namespace SimpleTest
{
public partial class frmUser : Form
{
User _user;
public User User
{
get { return _user; }
}
private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
public frmUser(int uid)
{
InitializeComponent();
_user = User.Get(uid);
_user.BeginEdit();
//_user.PropertyChanged += new PropertyChangedEventHandler(_user_PropertyChanged);
//_user.UserMemberships.ListChanged += new ListChangedEventHandler(UserMemberships_ListChanged);
userBindingSource.DataSource = _user;
}
void UserMemberships_ListChanged(object sender, ListChangedEventArgs e)
{
LogDirtyStatus("List Changed - " + e.ListChangedType.ToString());
}
void _user_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
LogDirtyStatus("Property Changed - " + e.PropertyName);
}
private void LogDirtyStatus(string s)
{
log.InfoFormat("--------{0}-------",s);
log.InfoFormat("IsDirty = {0}",_user.IsDirty);
foreach(UserMembership um in _user.UserMemberships){
log.InfoFormat("{0} IsDirty = {1}",um.Group_GroupName,um.IsDirty);
}
}
private void Save(bool rebind)
{
this.userBindingSource.RaiseListChangedEvents = false;
this.userMembershipsBindingSource.RaiseListChangedEvents = false;
// do the save
this.userBindingSource.EndEdit();
this.userMembershipsBindingSource.EndEdit();
try
{
User temp = _user.Clone();
_user = temp.Save();
_user.BeginEdit();
if (rebind)
{
// rebind the UI
this.userBindingSource.DataSource = null;
this.userMembershipsBindingSource.DataSource = this.userBindingSource;
this.userBindingSource.DataSource = _user;
// ApplyAuthorizationRules();
}
}
catch (Csla.DataPortalException ex)
{
MessageBox.Show(ex.BusinessException.ToString(),
"Error saving", MessageBoxButtons.OK,
MessageBoxIcon.Exclamation);
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString(),
"Error Saving", MessageBoxButtons.OK,
MessageBoxIcon.Exclamation);
}
finally
{
this.userBindingSource.RaiseListChangedEvents = true;
this.userMembershipsBindingSource.RaiseListChangedEvents = true;
this.userBindingSource.ResetBindings(false);
this.userMembershipsBindingSource.ResetBindings(false);
}
}
private void btnSave_Click(object sender, EventArgs e)
{
LogDirtyStatus("Before Save");
Save(true);
LogDirtyStatus("After Save");
}
private void btnCancel_Click(object sender, EventArgs e)
{
LogDirtyStatus("Before Cancel");
userBindingSource.RaiseListChangedEvents=false;
userBindingSource.CancelEdit();
userBindingSource.RaiseListChangedEvents = true;
// _user.CancelEdit();
_user.BeginEdit();
LogDirtyStatus("After Cancel");
}
}
}

View File

@@ -0,0 +1,162 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="cfgNameLabel.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="courtesyTitleLabel.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="firstNameLabel.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="lastNameLabel.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="middleNameLabel.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="phoneNumberLabel.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="suffixLabel.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="uidLabel.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="useridLabel.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="userLoginLabel.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="userNameLabel.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="configLabel.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="userBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="userMembershipsBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>187, 17</value>
</metadata>
</root>

View File

@@ -0,0 +1,72 @@

Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volian.Object.Library", "Volian.Object.Library\Volian.Object.Library.csproj", "{592B86E9-D488-452B-B89B-2BB037793FE3}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WinApp", "WinApp\WinApp.csproj", "{9912ADA4-5934-4C1D-AF2E-CA8031EBA338}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SimpleTest", "SimpleTest\SimpleTest.csproj", "{4D60F98F-D018-4447-B123-E3BDDE9C60F8}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VEPROMS.CSLA.Library", "..\VEPROMS.CSLA.Library\VEPROMS.CSLA.Library.csproj", "{41B2D786-1C03-4C1A-9247-DA9F0D6B06D5}"
EndProject
Global
GlobalSection(SourceCodeControl) = preSolution
SccNumberOfProjects = 1
SccProjectUniqueName0 = ..\\VEPROMS.CSLA.Library\\VEPROMS.CSLA.Library.csproj
SccProjectName0 = \u0022$/PROMS/VEPROMS.CSLA.Library\u0022,\u0020TPBAAAAA
SccLocalPath0 = ..\\VEPROMS.CSLA.Library
SccProvider0 = MSSCCI:Microsoft\u0020Visual\u0020SourceSafe
EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x86 = Debug|x86
Demo|Any CPU = Demo|Any CPU
Demo|x86 = Demo|x86
Release|Any CPU = Release|Any CPU
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{592B86E9-D488-452B-B89B-2BB037793FE3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{592B86E9-D488-452B-B89B-2BB037793FE3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{592B86E9-D488-452B-B89B-2BB037793FE3}.Debug|x86.ActiveCfg = Debug|Any CPU
{592B86E9-D488-452B-B89B-2BB037793FE3}.Demo|Any CPU.ActiveCfg = Debug|Any CPU
{592B86E9-D488-452B-B89B-2BB037793FE3}.Demo|Any CPU.Build.0 = Debug|Any CPU
{592B86E9-D488-452B-B89B-2BB037793FE3}.Demo|x86.ActiveCfg = Debug|Any CPU
{592B86E9-D488-452B-B89B-2BB037793FE3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{592B86E9-D488-452B-B89B-2BB037793FE3}.Release|Any CPU.Build.0 = Release|Any CPU
{592B86E9-D488-452B-B89B-2BB037793FE3}.Release|x86.ActiveCfg = Release|Any CPU
{9912ADA4-5934-4C1D-AF2E-CA8031EBA338}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9912ADA4-5934-4C1D-AF2E-CA8031EBA338}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9912ADA4-5934-4C1D-AF2E-CA8031EBA338}.Debug|x86.ActiveCfg = Debug|Any CPU
{9912ADA4-5934-4C1D-AF2E-CA8031EBA338}.Demo|Any CPU.ActiveCfg = Debug|Any CPU
{9912ADA4-5934-4C1D-AF2E-CA8031EBA338}.Demo|Any CPU.Build.0 = Debug|Any CPU
{9912ADA4-5934-4C1D-AF2E-CA8031EBA338}.Demo|x86.ActiveCfg = Debug|Any CPU
{9912ADA4-5934-4C1D-AF2E-CA8031EBA338}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9912ADA4-5934-4C1D-AF2E-CA8031EBA338}.Release|Any CPU.Build.0 = Release|Any CPU
{9912ADA4-5934-4C1D-AF2E-CA8031EBA338}.Release|x86.ActiveCfg = Release|Any CPU
{4D60F98F-D018-4447-B123-E3BDDE9C60F8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4D60F98F-D018-4447-B123-E3BDDE9C60F8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4D60F98F-D018-4447-B123-E3BDDE9C60F8}.Debug|x86.ActiveCfg = Debug|Any CPU
{4D60F98F-D018-4447-B123-E3BDDE9C60F8}.Demo|Any CPU.ActiveCfg = Debug|Any CPU
{4D60F98F-D018-4447-B123-E3BDDE9C60F8}.Demo|Any CPU.Build.0 = Debug|Any CPU
{4D60F98F-D018-4447-B123-E3BDDE9C60F8}.Demo|x86.ActiveCfg = Debug|Any CPU
{4D60F98F-D018-4447-B123-E3BDDE9C60F8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4D60F98F-D018-4447-B123-E3BDDE9C60F8}.Release|Any CPU.Build.0 = Release|Any CPU
{4D60F98F-D018-4447-B123-E3BDDE9C60F8}.Release|x86.ActiveCfg = Release|Any CPU
{41B2D786-1C03-4C1A-9247-DA9F0D6B06D5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{41B2D786-1C03-4C1A-9247-DA9F0D6B06D5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{41B2D786-1C03-4C1A-9247-DA9F0D6B06D5}.Debug|x86.ActiveCfg = Debug|x86
{41B2D786-1C03-4C1A-9247-DA9F0D6B06D5}.Debug|x86.Build.0 = Debug|x86
{41B2D786-1C03-4C1A-9247-DA9F0D6B06D5}.Demo|Any CPU.ActiveCfg = Demo|Any CPU
{41B2D786-1C03-4C1A-9247-DA9F0D6B06D5}.Demo|Any CPU.Build.0 = Demo|Any CPU
{41B2D786-1C03-4C1A-9247-DA9F0D6B06D5}.Demo|x86.ActiveCfg = Demo|x86
{41B2D786-1C03-4C1A-9247-DA9F0D6B06D5}.Demo|x86.Build.0 = Demo|x86
{41B2D786-1C03-4C1A-9247-DA9F0D6B06D5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{41B2D786-1C03-4C1A-9247-DA9F0D6B06D5}.Release|Any CPU.Build.0 = Release|Any CPU
{41B2D786-1C03-4C1A-9247-DA9F0D6B06D5}.Release|x86.ActiveCfg = Release|x86
{41B2D786-1C03-4C1A-9247-DA9F0D6B06D5}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,770 @@
// ========================================================================
// Copyright 2006 - Volian Enterprises, Inc. All rights reserved.
// Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
// ------------------------------------------------------------------------
// $Workfile: $ $Revision: $
// $Author: $ $Date: $
//
// $History: $
// ========================================================================
using System;
using System.Data;
using System.Data.SqlClient;
using Csla;
using Csla.Data;
namespace Volian.Object.Library
{
/// <summary>
/// Assignment Generated by MyGeneration using the CSLA Object Mapping template
/// </summary>
[Serializable()]
public partial class Assignment : BusinessBase<Assignment>
{
#region Business Methods
private int _aid;
[System.ComponentModel.DataObjectField(true, true)]
public int Aid
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _aid;
}
}
private int _gid;
[System.ComponentModel.DataObjectField(true, true)]
public int Gid
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _gid;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (_gid != value)
{
_gid = value;
PropertyHasChanged();
}
}
}
private int _rid;
[System.ComponentModel.DataObjectField(true, true)]
public int Rid
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _rid;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (_rid != value)
{
_rid = value;
PropertyHasChanged();
}
}
}
private int _folderid;
[System.ComponentModel.DataObjectField(true, true)]
public int Folderid
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _folderid;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (_folderid != value)
{
_folderid = value;
PropertyHasChanged();
}
}
}
private string _startdate=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string StartDate
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _startdate;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (value == null) value = string.Empty;
_startdate = value;
try
{
DateTime tmp = SmartDate.StringToDate(value);
if (_startdate != tmp.ToShortDateString())
{
_startdate = tmp.ToShortDateString();
// TODO: Any Cross Property Validation
}
}
catch
{
}
PropertyHasChanged();
}
}
private string _enddate=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string EndDate
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _enddate;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (value == null) value = string.Empty;
_enddate = value;
try
{
DateTime tmp = SmartDate.StringToDate(value);
if (_enddate != tmp.ToShortDateString())
{
_enddate = tmp.ToShortDateString();
// TODO: Any Cross Property Validation
}
}
catch
{
}
PropertyHasChanged();
}
}
private DateTime _dts=new DateTime();
[System.ComponentModel.DataObjectField(true, true)]
public DateTime Dts
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _dts;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (_dts != value)
{
_dts = value;
PropertyHasChanged();
}
}
}
private string _usrid=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string Usrid
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _usrid;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (value == null) value = string.Empty;
if (_usrid != value)
{
_usrid = value;
PropertyHasChanged();
}
}
}
private byte[] _lastchanged=new byte[8];//timestamp
// TODO: Replace base Assignment.ToString function as necessary
/// <summary>
/// Overrides Base ToString
/// </summary>
/// <returns>A string representation of current Assignment</returns>
//public override string ToString()
//{
// return base.ToString();
//}
// TODO: Check Assignment.GetIdValue to assure that the ID returned is unique
/// <summary>
/// Overrides Base GetIdValue - Used internally by CSLA to determine equality
/// </summary>
/// <returns>A Unique ID for the current Assignment</returns>
protected override object GetIdValue()
{
return _aid;
}
#endregion
#region ValidationRules
protected override void AddBusinessRules()
{
ValidationRules.AddRule(StartDateValid, "StartDate");
ValidationRules.AddRule(EndDateValid, "EndDate");
ValidationRules.AddRule(
Csla.Validation.CommonRules.StringMaxLength,
new Csla.Validation.CommonRules.MaxLengthRuleArgs("Usrid", 100));
ext.AddValidationRules(ValidationRules);
// TODO: Add other validation rules
// ValidationRules.AddRule(StartDateGTEndDate, "Started");
}
private bool StartDateValid(object target, Csla.Validation.RuleArgs e)
{
try
{
DateTime tmp = SmartDate.StringToDate(_startdate);
}
catch
{
e.Description="Invalid Date";
return false;
}
return true;
}
private bool EndDateValid(object target, Csla.Validation.RuleArgs e)
{
try
{
DateTime tmp = SmartDate.StringToDate(_enddate);
}
catch
{
e.Description="Invalid Date";
return false;
}
return true;
}
// Sample data comparison validation rule
//private bool StartDateGTEndDate(object target, Csla.Validation.RuleArgs e)
//{
// if (_started > _ended)
// {
// e.Description = "Start date can't be after end date";
// return false;
// }
// else
// return true;
//}
#endregion
#region Authorization Rules
protected override void AddAuthorizationRules()
{
//TODO: Who can read/write which fields
//AuthorizationRules.AllowRead(Aid, "<Role(s)>");
//AuthorizationRules.AllowRead(Gid, "<Role(s)>");
//AuthorizationRules.AllowRead(Rid, "<Role(s)>");
//AuthorizationRules.AllowRead(Folderid, "<Role(s)>");
//AuthorizationRules.AllowRead(StartDate, "<Role(s)>");
//AuthorizationRules.AllowRead(EndDate, "<Role(s)>");
//AuthorizationRules.AllowRead(Dts, "<Role(s)>");
//AuthorizationRules.AllowRead(Usrid, "<Role(s)>");
//AuthorizationRules.AllowWrite(Gid, "<Role(s)>");
//AuthorizationRules.AllowWrite(Rid, "<Role(s)>");
//AuthorizationRules.AllowWrite(Folderid, "<Role(s)>");
//AuthorizationRules.AllowWrite(StartDate, "<Role(s)>");
//AuthorizationRules.AllowWrite(EndDate, "<Role(s)>");
//AuthorizationRules.AllowWrite(Dts, "<Role(s)>");
//AuthorizationRules.AllowWrite(Usrid, "<Role(s)>");
ext.AddAuthorizationRules(AuthorizationRules);
}
public static bool CanAddObject()
{
// TODO: Can Add Authorization
//return Csla.ApplicationContext.User.IsInRole("ProjectManager");
return true;
}
public static bool CanGetObject()
{
// TODO: CanGet Authorization
return true;
}
public static bool CanDeleteObject()
{
// TODO: CanDelete Authorization
//bool result = false;
//if (Csla.ApplicationContext.User.IsInRole("ProjectManager"))result = true;
//if (Csla.ApplicationContext.User.IsInRole("Administrator"))result = true;
//return result;
return true;
}
public static bool CanEditObject()
{
// TODO: CanEdit Authorization
//return Csla.ApplicationContext.User.IsInRole("ProjectManager");
return true;
}
#endregion
#region Factory Methods
private Assignment()
{/* require use of factory methods */}
public static Assignment New()
{
if (!CanAddObject())
throw new System.Security.SecurityException("User not authorized to add a Assignment");
return DataPortal.Create<Assignment>();
}
public static Assignment Get(int _aid)
{
if (!CanGetObject())
throw new System.Security.SecurityException("User not authorized to view a Assignment");
return DataPortal.Fetch<Assignment>(new PKCriteria(_aid));
}
public static void Delete(int _aid)
{
if (!CanDeleteObject())
throw new System.Security.SecurityException("User not authorized to remove a Assignment");
DataPortal.Delete(new PKCriteria(_aid));
}
public override Assignment Save()
{
if (IsDeleted && !CanDeleteObject())
throw new System.Security.SecurityException("User not authorized to remove a Assignment");
else if (IsNew && !CanAddObject())
throw new System.Security.SecurityException("User not authorized to add a Assignment");
else if (!CanEditObject())
throw new System.Security.SecurityException("User not authorized to update a Assignment");
return base.Save();
}
#endregion
#region Data Access Portal
[Serializable()]
private class PKCriteria
{
private int _aid;
public int Aid
{ get {return _aid;}}
public PKCriteria(int aid)
{
_aid=aid;
}
}
// If Create needs to access DB - It should not be marked RunLocal
[RunLocal()]
private new void DataPortal_Create(object criteria)
{
// Database Defaults
_startdate = ext.DefaultStartDate;
_dts = ext.DefaultDts;
_usrid = ext.DefaultUsrid;
// TODO: Add any defaults that are necessary
ValidationRules.CheckRules();
}
private void DataPortal_Fetch(PKCriteria criteria)
{
try{
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
{
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "getAssignment";
cm.Parameters.AddWithValue("@aID", criteria.Aid);
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
{
dr.Read();
_aid = dr.GetInt32("AID");
_gid = dr.GetInt32("GID");
_rid = dr.GetInt32("RID");
_folderid = dr.GetInt32("FolderID");
_startdate = dr.GetSmartDate("StartDate").Text;
_enddate = dr.GetSmartDate("EndDate").Text;
_dts = dr.GetDateTime("DTS");
_usrid = dr.GetString("UsrID");
dr.GetBytes("LastChanged", 0, _lastchanged, 0, 8);
}
}
}
}
catch(Exception ex)
{
Database.LogException("Assignment",ex);
}
}
[Transactional(TransactionalTypes.TransactionScope)]
protected override void DataPortal_Insert()
{
try{
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
{
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "addAssignment";
// Input All Fields - Except Calculated Columns
cm.Parameters.AddWithValue("@gID", _gid);
cm.Parameters.AddWithValue("@rID", _rid);
cm.Parameters.AddWithValue("@folderID", _folderid);
cm.Parameters.AddWithValue("@startDate", new SmartDate(_startdate).DBValue);
cm.Parameters.AddWithValue("@endDate", new SmartDate(_enddate).DBValue);
cm.Parameters.AddWithValue("@dTS", _dts);
cm.Parameters.AddWithValue("@usrID", _usrid);
// Output Calculated Columns
SqlParameter param_aid = new SqlParameter("@newAID",SqlDbType.Int);
param_aid.Direction = ParameterDirection.Output;
cm.Parameters.Add(param_aid);
SqlParameter param_lastchanged = new SqlParameter("@newLastChanged",SqlDbType.Timestamp);
param_lastchanged.Direction = ParameterDirection.Output;
cm.Parameters.Add(param_lastchanged);
// TODO: Define any additional output parameters
cm.ExecuteNonQuery();
// Save all values being returned from the Procedure
_aid = (int)cm.Parameters["@newAID"].Value;
_lastchanged = (byte[])cm.Parameters["@newLastChanged"].Value;
}
// update child objects
}
}
catch(Exception ex)
{
Database.LogException("Assignment",ex);
}}
[Transactional(TransactionalTypes.TransactionScope)]
public static byte[] Add(SqlConnection cn,ref int aid, int gid, int rid, int folderid, SmartDate startdate, SmartDate enddate, DateTime dts, string usrid)
{
try{
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "addAssignment";
// Input All Fields - Except Calculated Columns
cm.Parameters.AddWithValue("@gID", gid);
cm.Parameters.AddWithValue("@rID", rid);
cm.Parameters.AddWithValue("@folderID", folderid);
cm.Parameters.AddWithValue("@startDate", startdate.DBValue);
cm.Parameters.AddWithValue("@endDate", enddate.DBValue);
cm.Parameters.AddWithValue("@dTS", dts);
cm.Parameters.AddWithValue("@usrID", usrid);
// Output Calculated Columns
SqlParameter param_aid = new SqlParameter("@newAID",SqlDbType.Int);
param_aid.Direction = ParameterDirection.Output;
cm.Parameters.Add(param_aid);
SqlParameter param_lastchanged = new SqlParameter("@newLastChanged",SqlDbType.Timestamp);
param_lastchanged.Direction = ParameterDirection.Output;
cm.Parameters.Add(param_lastchanged);
// TODO: Define any additional output parameters
cm.ExecuteNonQuery();
// Save all values being returned from the Procedure
aid = (int)cm.Parameters["@newAID"].Value;
return (byte[])cm.Parameters["@newLastChanged"].Value;
}
}
catch(Exception ex)
{
Database.LogException("Assignment",ex);
return null;
}
}
[Transactional(TransactionalTypes.TransactionScope)]
protected override void DataPortal_Update()
{
if (IsDirty)// If this is dirty - open the connection
{
try{
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
{
if(base.IsDirty)
{
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "updateAssignment";
// All Fields including Calculated Fields
cm.Parameters.AddWithValue("@aID", _aid);
cm.Parameters.AddWithValue("@gID", _gid);
cm.Parameters.AddWithValue("@rID", _rid);
cm.Parameters.AddWithValue("@folderID", _folderid);
cm.Parameters.AddWithValue("@startDate", new SmartDate(_startdate).DBValue);
cm.Parameters.AddWithValue("@endDate", new SmartDate(_enddate).DBValue);
cm.Parameters.AddWithValue("@dTS", _dts);
cm.Parameters.AddWithValue("@usrID", _usrid);
cm.Parameters.AddWithValue("@lastChanged", _lastchanged);
// Output Calculated Columns
SqlParameter param_lastchanged = new SqlParameter("@newLastChanged",SqlDbType.Timestamp);
param_lastchanged.Direction = ParameterDirection.Output;
cm.Parameters.Add(param_lastchanged);
// TODO: Define any additional output parameters
cm.ExecuteNonQuery();
// Save all values being returned from the Procedure
_lastchanged = (byte[])cm.Parameters["@newLastChanged"].Value;
}
}
// use the open connection to update child objects
}
}
catch(Exception ex)
{
Database.LogException("Assignment",ex);
}
}
}
[Transactional(TransactionalTypes.TransactionScope)]
public static byte[] Update(SqlConnection cn,ref int aid, int gid, int rid, int folderid, SmartDate startdate, SmartDate enddate, DateTime dts, string usrid, ref byte[] lastchanged)
{
try{
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "updateAssignment";
// Input All Fields - Except Calculated Columns
cm.Parameters.AddWithValue("@aID", aid);
cm.Parameters.AddWithValue("@gID", gid);
cm.Parameters.AddWithValue("@rID", rid);
cm.Parameters.AddWithValue("@folderID", folderid);
cm.Parameters.AddWithValue("@startDate", startdate.DBValue);
cm.Parameters.AddWithValue("@endDate", enddate.DBValue);
cm.Parameters.AddWithValue("@dTS", dts);
cm.Parameters.AddWithValue("@usrID", usrid);
cm.Parameters.AddWithValue("@lastChanged", lastchanged);
// Output Calculated Columns
SqlParameter param_lastchanged = new SqlParameter("@newLastChanged",SqlDbType.Timestamp);
param_lastchanged.Direction = ParameterDirection.Output;
cm.Parameters.Add(param_lastchanged);
// TODO: Define any additional output parameters
cm.ExecuteNonQuery();
// Save all values being returned from the Procedure
return (byte[])cm.Parameters["@newLastChanged"].Value;
}
}
catch(Exception ex)
{
Database.LogException("Assignment",ex);
return null;
}
}
[Transactional(TransactionalTypes.TransactionScope)]
protected override void DataPortal_DeleteSelf()
{
DataPortal_Delete(new PKCriteria(_aid));
}
[Transactional(TransactionalTypes.TransactionScope)]
private void DataPortal_Delete(PKCriteria criteria)
{
try{
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
{
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "deleteAssignment";
cm.Parameters.AddWithValue("@aID", criteria.Aid);
cm.ExecuteNonQuery();
}
}
}
catch(Exception ex)
{
Database.LogException("Assignment",ex);
}
}
[Transactional(TransactionalTypes.TransactionScope)]
public static void Remove(SqlConnection cn,int aid)
{
try{
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "deleteAssignment";
// Input PK Fields
cm.Parameters.AddWithValue("@aID", aid);
// TODO: Define any additional output parameters
cm.ExecuteNonQuery();
}
}
catch(Exception ex)
{
Database.LogException("Assignment",ex);
}
}
#endregion
#region Exists
public static bool Exists(int aid)
{
ExistsCommand result;
result = DataPortal.Execute<ExistsCommand>
(new ExistsCommand(aid));
return result.Exists;
}
[Serializable()]
private class ExistsCommand : CommandBase
{
private int _aid;
private bool _exists;
public bool Exists
{
get { return _exists; }
}
public ExistsCommand(int aid)
{
_aid=aid;
}
protected override void DataPortal_Execute()
{
try{
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
{
cn.Open();
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "existsAssignment";
cm.Parameters.AddWithValue("@aID", _aid);
int count = (int)cm.ExecuteScalar();
_exists = (count > 0);
}
}
}
catch(Exception ex)
{
Database.LogException("Assignment",ex);
}
}
}
#endregion
// Standard Default Code
// #region extension
Extension ext = new Extension();
[Serializable()]
partial class Extension : extensionBase
{
}
[Serializable()]
class extensionBase
{
// Default Values
public virtual string DefaultStartDate
{
get { return DateTime.Now.ToShortDateString(); }
}
public virtual DateTime DefaultDts
{
get { return DateTime.Now; }
}
public virtual string DefaultUsrid
{
get { return Environment.UserName.ToUpper(); }
}
// Authorization Rules
public virtual void AddAuthorizationRules(Csla.Security.AuthorizationRules rules)
{
// Needs to be overriden to add new authorization rules
}
// Validation Rules
public virtual void AddValidationRules(Csla.Validation.ValidationRules rules)
{
// Needs to be overriden to add new validation rules
}
}
//#endregion
// The follwing is a sample Extension File. You can use it to create AssignmentExt.cs
//using System;
//using System.Collections.Generic;
//using System.Text;
//using Csla;
//namespace PatrialClass
//{
// public partial class Assignment
// {
// partial class Extension : extensionBase
// {
// TODO: Override automatic defaults
// public virtual SmartDate DefaultStartDate
// {
// get { return DateTime.Now.ToShortDateString(); }
// }
// public virtual DateTime DefaultDts
// {
// get { return DateTime.Now; }
// }
// public virtual string DefaultUsrid
// {
// get { return Environment.UserName.ToUpper(); }
// }
// public new void AddAuthorizationRules(Csla.Security.AuthorizationRules rules)
// {
// //rules.AllowRead(Dbid, "<Role(s)>");
// }
// public new void AddValidationRules(Csla.Validation.ValidationRules rules)
// {
// rules.AddRule(
// Csla.Validation.CommonRules.StringMaxLength,
// new Csla.Validation.CommonRules.MaxLengthRuleArgs("Name", 100));
// }
// }
// }
//}
} // Class
} // Namespace

View File

@@ -0,0 +1,167 @@
// ========================================================================
// Copyright 2006 - Volian Enterprises, Inc. All rights reserved.
// Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
// ------------------------------------------------------------------------
// $Workfile: $ $Revision: $
// $Author: $ $Date: $
//
// $History: $
// ========================================================================
using System;
using System.Data;
using System.Data.SqlClient;
using Csla;
using Csla.Data;
namespace Volian.Object.Library
{
/// <summary>
/// AssignmentInfo Generated by MyGeneration using the CSLA Object Mapping template
/// </summary>
[Serializable()]
public partial class AssignmentInfo : ReadOnlyBase<AssignmentInfo>
{
#region Business Methods
private int _aid;
[System.ComponentModel.DataObjectField(true, true)]
public int Aid
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _aid;
}
}
private int _gid;
[System.ComponentModel.DataObjectField(true, true)]
public int Gid
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _gid;
}
}
private int _rid;
[System.ComponentModel.DataObjectField(true, true)]
public int Rid
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _rid;
}
}
private int _folderid;
[System.ComponentModel.DataObjectField(true, true)]
public int Folderid
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _folderid;
}
}
private string _startdate=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string StartDate
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _startdate;
}
}
private string _enddate=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string EndDate
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _enddate;
}
}
private DateTime _dts=new DateTime();
[System.ComponentModel.DataObjectField(true, true)]
public DateTime Dts
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _dts;
}
}
private string _usrid=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string Usrid
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _usrid;
}
}
// TODO: Replace base AssignmentInfo.ToString function as necessary
/// <summary>
/// Overrides Base ToString
/// </summary>
/// <returns>A string representation of current AssignmentInfo</returns>
//public override string ToString()
//{
// return base.ToString();
//}
// TODO: Check AssignmentInfo.GetIdValue to assure that the ID returned is unique
/// <summary>
/// Overrides Base GetIdValue - Used internally by CSLA to determine equality
/// </summary>
/// <returns>A Unique ID for the current AssignmentInfo</returns>
protected override object GetIdValue()
{
return _aid;
}
#endregion
#region Factory Methods
private AssignmentInfo()
{ /* require use of factory methods */ }
#endregion
#region Data Access Portal
internal AssignmentInfo(SafeDataReader dr)
{
try
{
_aid = dr.GetInt32("AID");
_gid = dr.GetInt32("GID");
_rid = dr.GetInt32("RID");
_folderid = dr.GetInt32("FolderID");
_startdate = dr.GetSmartDate("StartDate").Text;
_enddate = dr.GetSmartDate("EndDate").Text;
_dts = dr.GetDateTime("DTS");
_usrid = dr.GetString("UsrID");
}
catch(Exception ex)
{
Database.LogException("AssignmentInfo",ex);
}
}
#endregion
} // Class
} // Namespace

View File

@@ -0,0 +1,78 @@
// ========================================================================
// Copyright 2006 - Volian Enterprises, Inc. All rights reserved.
// Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
// ------------------------------------------------------------------------
// $Workfile: $ $Revision: $
// $Author: $ $Date: $
//
// $History: $
// ========================================================================
using System;
using System.Data;
using System.Data.SqlClient;
using Csla;
using Csla.Data;
namespace Volian.Object.Library
{
/// <summary>
/// AssignmentInfoList Generated by MyGeneration using the CSLA Object Mapping template
/// </summary>
[Serializable()]
public partial class AssignmentInfoList : ReadOnlyListBase<AssignmentInfoList,AssignmentInfo>
{
#region Factory Methods
/// <summary>
/// Return a list of all projects.
/// </summary>
public static AssignmentInfoList Get()
{
return DataPortal.Fetch<AssignmentInfoList>(new Criteria());
}
// TODO: Add alternative gets -
//public static AssignmentInfoList Get(<criteria>)
//{
// return DataPortal.Fetch<AssignmentInfoList>(new FilteredCriteria(<criteria>));
//}
private AssignmentInfoList()
{ /* require use of factory methods */ }
#endregion
#region Data Access Portal
[Serializable()]
private class Criteria
{ /* no criteria - retrieve all rows */ }
private void DataPortal_Fetch(Criteria criteria)
{
this.RaiseListChangedEvents = false;
try{
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
{
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "getAssignments";
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
{
IsReadOnly = false;
while (dr.Read())this.Add(new AssignmentInfo(dr));
IsReadOnly = true;
}
}
}
}
catch(Exception ex)
{
Database.LogException("AssignmentInfoList",ex);
}
this.RaiseListChangedEvents = true;
}
#endregion
} // Class
} // Namespace

View File

@@ -0,0 +1,771 @@
// ========================================================================
// Copyright 2006 - Volian Enterprises, Inc. All rights reserved.
// Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
// ------------------------------------------------------------------------
// $Workfile: $ $Revision: $
// $Author: $ $Date: $
//
// $History: $
// ========================================================================
using System;
using System.Data;
using System.Data.SqlClient;
using Csla;
using Csla.Data;
namespace Volian.Object.Library
{
/// <summary>
/// Connection Generated by MyGeneration using the CSLA Object Mapping template
/// </summary>
[Serializable()]
public partial class Connection : BusinessBase<Connection>
{
#region Business Methods
private int _dbid;
[System.ComponentModel.DataObjectField(true, true)]
public int Dbid
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _dbid;
}
}
private string _name=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string Name
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _name;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (value == null) value = string.Empty;
if (_name != value)
{
_name = value;
PropertyHasChanged();
}
}
}
private string _title=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string Title
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _title;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (value == null) value = string.Empty;
if (_title != value)
{
_title = value;
PropertyHasChanged();
}
}
}
private string _connectionstring=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string ConnectionString
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _connectionstring;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (value == null) value = string.Empty;
if (_connectionstring != value)
{
_connectionstring = value;
PropertyHasChanged();
}
}
}
private int _servertype;
/// <summary>
/// 0 SQL Server
/// </summary>
[System.ComponentModel.DataObjectField(true, true)]
public int ServerType
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _servertype;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (_servertype != value)
{
_servertype = value;
PropertyHasChanged();
}
}
}
private string _config=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string Config
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _config;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (value == null) value = string.Empty;
if (_config != value)
{
_config = value;
PropertyHasChanged();
}
}
}
private DateTime _dts=new DateTime();
[System.ComponentModel.DataObjectField(true, true)]
public DateTime Dts
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _dts;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (_dts != value)
{
_dts = value;
PropertyHasChanged();
}
}
}
private string _usrid=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string Usrid
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _usrid;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (value == null) value = string.Empty;
if (_usrid != value)
{
_usrid = value;
PropertyHasChanged();
}
}
}
private byte[] _lastchanged=new byte[8];//timestamp
private ConnectionFolders _connectionfolders = ConnectionFolders.New();
/// <summary>
/// Related Field
/// </summary>
[System.ComponentModel.DataObjectField(true, true)]
public ConnectionFolders ConnectionFolders
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _connectionfolders;
}
}
public override bool IsDirty
{
get { return base.IsDirty || _connectionfolders.IsDirty ; }
}
public override bool IsValid
{
get { return base.IsValid && _connectionfolders.IsValid ; }
}
// TODO: Replace base Connection.ToString function as necessary
/// <summary>
/// Overrides Base ToString
/// </summary>
/// <returns>A string representation of current Connection</returns>
//public override string ToString()
//{
// return base.ToString();
//}
// TODO: Check Connection.GetIdValue to assure that the ID returned is unique
/// <summary>
/// Overrides Base GetIdValue - Used internally by CSLA to determine equality
/// </summary>
/// <returns>A Unique ID for the current Connection</returns>
protected override object GetIdValue()
{
return _dbid;
}
#endregion
#region ValidationRules
protected override void AddBusinessRules()
{
ValidationRules.AddRule(
Csla.Validation.CommonRules.StringMaxLength,
new Csla.Validation.CommonRules.MaxLengthRuleArgs("Name", 100));
ValidationRules.AddRule(
Csla.Validation.CommonRules.StringMaxLength,
new Csla.Validation.CommonRules.MaxLengthRuleArgs("Title", 510));
ValidationRules.AddRule(
Csla.Validation.CommonRules.StringMaxLength,
new Csla.Validation.CommonRules.MaxLengthRuleArgs("ConnectionString", 510));
ValidationRules.AddRule(
Csla.Validation.CommonRules.StringMaxLength,
new Csla.Validation.CommonRules.MaxLengthRuleArgs("Config", 1073741823));
ValidationRules.AddRule(
Csla.Validation.CommonRules.StringMaxLength,
new Csla.Validation.CommonRules.MaxLengthRuleArgs("Usrid", 100));
ext.AddValidationRules(ValidationRules);
// TODO: Add other validation rules
// ValidationRules.AddRule(StartDateGTEndDate, "Started");
}
// Sample data comparison validation rule
//private bool StartDateGTEndDate(object target, Csla.Validation.RuleArgs e)
//{
// if (_started > _ended)
// {
// e.Description = "Start date can't be after end date";
// return false;
// }
// else
// return true;
//}
#endregion
#region Authorization Rules
protected override void AddAuthorizationRules()
{
//TODO: Who can read/write which fields
//AuthorizationRules.AllowRead(Dbid, "<Role(s)>");
//AuthorizationRules.AllowRead(Name, "<Role(s)>");
//AuthorizationRules.AllowRead(Title, "<Role(s)>");
//AuthorizationRules.AllowRead(ConnectionString, "<Role(s)>");
//AuthorizationRules.AllowRead(ServerType, "<Role(s)>");
//AuthorizationRules.AllowRead(Config, "<Role(s)>");
//AuthorizationRules.AllowRead(Dts, "<Role(s)>");
//AuthorizationRules.AllowRead(Usrid, "<Role(s)>");
//AuthorizationRules.AllowWrite(Name, "<Role(s)>");
//AuthorizationRules.AllowWrite(Title, "<Role(s)>");
//AuthorizationRules.AllowWrite(ConnectionString, "<Role(s)>");
//AuthorizationRules.AllowWrite(ServerType, "<Role(s)>");
//AuthorizationRules.AllowWrite(Config, "<Role(s)>");
//AuthorizationRules.AllowWrite(Dts, "<Role(s)>");
//AuthorizationRules.AllowWrite(Usrid, "<Role(s)>");
ext.AddAuthorizationRules(AuthorizationRules);
}
public static bool CanAddObject()
{
// TODO: Can Add Authorization
//return Csla.ApplicationContext.User.IsInRole("ProjectManager");
return true;
}
public static bool CanGetObject()
{
// TODO: CanGet Authorization
return true;
}
public static bool CanDeleteObject()
{
// TODO: CanDelete Authorization
//bool result = false;
//if (Csla.ApplicationContext.User.IsInRole("ProjectManager"))result = true;
//if (Csla.ApplicationContext.User.IsInRole("Administrator"))result = true;
//return result;
return true;
}
public static bool CanEditObject()
{
// TODO: CanEdit Authorization
//return Csla.ApplicationContext.User.IsInRole("ProjectManager");
return true;
}
#endregion
#region Factory Methods
private Connection()
{/* require use of factory methods */}
public static Connection New()
{
if (!CanAddObject())
throw new System.Security.SecurityException("User not authorized to add a Connection");
return DataPortal.Create<Connection>();
}
public static Connection Get(int _dbid)
{
if (!CanGetObject())
throw new System.Security.SecurityException("User not authorized to view a Connection");
return DataPortal.Fetch<Connection>(new PKCriteria(_dbid));
}
public static void Delete(int _dbid)
{
if (!CanDeleteObject())
throw new System.Security.SecurityException("User not authorized to remove a Connection");
DataPortal.Delete(new PKCriteria(_dbid));
}
public override Connection Save()
{
if (IsDeleted && !CanDeleteObject())
throw new System.Security.SecurityException("User not authorized to remove a Connection");
else if (IsNew && !CanAddObject())
throw new System.Security.SecurityException("User not authorized to add a Connection");
else if (!CanEditObject())
throw new System.Security.SecurityException("User not authorized to update a Connection");
return base.Save();
}
#endregion
#region Data Access Portal
[Serializable()]
private class PKCriteria
{
private int _dbid;
public int Dbid
{ get {return _dbid;}}
public PKCriteria(int dbid)
{
_dbid=dbid;
}
}
// If Create needs to access DB - It should not be marked RunLocal
[RunLocal()]
private new void DataPortal_Create(object criteria)
{
// Database Defaults
_servertype = ext.DefaultServerType;
_dts = ext.DefaultDts;
_usrid = ext.DefaultUsrid;
// TODO: Add any defaults that are necessary
ValidationRules.CheckRules();
}
private void DataPortal_Fetch(PKCriteria criteria)
{
try{
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
{
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "getConnection";
cm.Parameters.AddWithValue("@dBID", criteria.Dbid);
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
{
dr.Read();
_dbid = dr.GetInt32("DBID");
_name = dr.GetString("Name");
_title = dr.GetString("Title");
_connectionstring = dr.GetString("ConnectionString");
_servertype = dr.GetInt32("ServerType");
_config = dr.GetString("Config");
_dts = dr.GetDateTime("DTS");
_usrid = dr.GetString("UsrID");
dr.GetBytes("LastChanged", 0, _lastchanged, 0, 8);
// load child objects
dr.NextResult();
_connectionfolders = ConnectionFolders.Get(dr);
}
}
}
}
catch(Exception ex)
{
Database.LogException("Connection",ex);
}
}
[Transactional(TransactionalTypes.TransactionScope)]
protected override void DataPortal_Insert()
{
try{
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
{
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "addConnection";
// Input All Fields - Except Calculated Columns
cm.Parameters.AddWithValue("@name", _name);
cm.Parameters.AddWithValue("@title", _title);
cm.Parameters.AddWithValue("@connectionString", _connectionstring);
cm.Parameters.AddWithValue("@serverType", _servertype);
cm.Parameters.AddWithValue("@config", _config);
cm.Parameters.AddWithValue("@dTS", _dts);
cm.Parameters.AddWithValue("@usrID", _usrid);
// Output Calculated Columns
SqlParameter param_dbid = new SqlParameter("@newDBID",SqlDbType.Int);
param_dbid.Direction = ParameterDirection.Output;
cm.Parameters.Add(param_dbid);
SqlParameter param_lastchanged = new SqlParameter("@newLastChanged",SqlDbType.Timestamp);
param_lastchanged.Direction = ParameterDirection.Output;
cm.Parameters.Add(param_lastchanged);
// TODO: Define any additional output parameters
cm.ExecuteNonQuery();
// Save all values being returned from the Procedure
_dbid = (int)cm.Parameters["@newDBID"].Value;
_lastchanged = (byte[])cm.Parameters["@newLastChanged"].Value;
}
// update child objects
_connectionfolders.Update(this,cn);
}
}
catch(Exception ex)
{
Database.LogException("Connection",ex);
}}
[Transactional(TransactionalTypes.TransactionScope)]
public static byte[] Add(SqlConnection cn,ref int dbid, string name, string title, string connectionstring, int servertype, string config, DateTime dts, string usrid)
{
try{
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "addConnection";
// Input All Fields - Except Calculated Columns
cm.Parameters.AddWithValue("@name", name);
cm.Parameters.AddWithValue("@title", title);
cm.Parameters.AddWithValue("@connectionString", connectionstring);
cm.Parameters.AddWithValue("@serverType", servertype);
cm.Parameters.AddWithValue("@config", config);
cm.Parameters.AddWithValue("@dTS", dts);
cm.Parameters.AddWithValue("@usrID", usrid);
// Output Calculated Columns
SqlParameter param_dbid = new SqlParameter("@newDBID",SqlDbType.Int);
param_dbid.Direction = ParameterDirection.Output;
cm.Parameters.Add(param_dbid);
SqlParameter param_lastchanged = new SqlParameter("@newLastChanged",SqlDbType.Timestamp);
param_lastchanged.Direction = ParameterDirection.Output;
cm.Parameters.Add(param_lastchanged);
// TODO: Define any additional output parameters
cm.ExecuteNonQuery();
// Save all values being returned from the Procedure
dbid = (int)cm.Parameters["@newDBID"].Value;
return (byte[])cm.Parameters["@newLastChanged"].Value;
}
}
catch(Exception ex)
{
Database.LogException("Connection",ex);
return null;
}
}
[Transactional(TransactionalTypes.TransactionScope)]
protected override void DataPortal_Update()
{
if (IsDirty)// If this is dirty - open the connection
{
try{
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
{
if(base.IsDirty)
{
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "updateConnection";
// All Fields including Calculated Fields
cm.Parameters.AddWithValue("@dBID", _dbid);
cm.Parameters.AddWithValue("@name", _name);
cm.Parameters.AddWithValue("@title", _title);
cm.Parameters.AddWithValue("@connectionString", _connectionstring);
cm.Parameters.AddWithValue("@serverType", _servertype);
cm.Parameters.AddWithValue("@config", _config);
cm.Parameters.AddWithValue("@dTS", _dts);
cm.Parameters.AddWithValue("@usrID", _usrid);
cm.Parameters.AddWithValue("@lastChanged", _lastchanged);
// Output Calculated Columns
SqlParameter param_lastchanged = new SqlParameter("@newLastChanged",SqlDbType.Timestamp);
param_lastchanged.Direction = ParameterDirection.Output;
cm.Parameters.Add(param_lastchanged);
// TODO: Define any additional output parameters
cm.ExecuteNonQuery();
// Save all values being returned from the Procedure
_lastchanged = (byte[])cm.Parameters["@newLastChanged"].Value;
}
}
// use the open connection to update child objects
_connectionfolders.Update(this,cn);
}
}
catch(Exception ex)
{
Database.LogException("Connection",ex);
}
}
}
[Transactional(TransactionalTypes.TransactionScope)]
public static byte[] Update(SqlConnection cn,ref int dbid, string name, string title, string connectionstring, int servertype, string config, DateTime dts, string usrid, ref byte[] lastchanged)
{
try{
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "updateConnection";
// Input All Fields - Except Calculated Columns
cm.Parameters.AddWithValue("@dBID", dbid);
cm.Parameters.AddWithValue("@name", name);
cm.Parameters.AddWithValue("@title", title);
cm.Parameters.AddWithValue("@connectionString", connectionstring);
cm.Parameters.AddWithValue("@serverType", servertype);
cm.Parameters.AddWithValue("@config", config);
cm.Parameters.AddWithValue("@dTS", dts);
cm.Parameters.AddWithValue("@usrID", usrid);
cm.Parameters.AddWithValue("@lastChanged", lastchanged);
// Output Calculated Columns
SqlParameter param_lastchanged = new SqlParameter("@newLastChanged",SqlDbType.Timestamp);
param_lastchanged.Direction = ParameterDirection.Output;
cm.Parameters.Add(param_lastchanged);
// TODO: Define any additional output parameters
cm.ExecuteNonQuery();
// Save all values being returned from the Procedure
return (byte[])cm.Parameters["@newLastChanged"].Value;
}
}
catch(Exception ex)
{
Database.LogException("Connection",ex);
return null;
}
}
[Transactional(TransactionalTypes.TransactionScope)]
protected override void DataPortal_DeleteSelf()
{
DataPortal_Delete(new PKCriteria(_dbid));
}
[Transactional(TransactionalTypes.TransactionScope)]
private void DataPortal_Delete(PKCriteria criteria)
{
try{
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
{
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "deleteConnection";
cm.Parameters.AddWithValue("@dBID", criteria.Dbid);
cm.ExecuteNonQuery();
}
}
}
catch(Exception ex)
{
Database.LogException("Connection",ex);
}
}
[Transactional(TransactionalTypes.TransactionScope)]
public static void Remove(SqlConnection cn,int dbid)
{
try{
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "deleteConnection";
// Input PK Fields
cm.Parameters.AddWithValue("@dBID", dbid);
// TODO: Define any additional output parameters
cm.ExecuteNonQuery();
}
}
catch(Exception ex)
{
Database.LogException("Connection",ex);
}
}
#endregion
#region Exists
public static bool Exists(int dbid)
{
ExistsCommand result;
result = DataPortal.Execute<ExistsCommand>
(new ExistsCommand(dbid));
return result.Exists;
}
[Serializable()]
private class ExistsCommand : CommandBase
{
private int _dbid;
private bool _exists;
public bool Exists
{
get { return _exists; }
}
public ExistsCommand(int dbid)
{
_dbid=dbid;
}
protected override void DataPortal_Execute()
{
try{
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
{
cn.Open();
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "existsConnection";
cm.Parameters.AddWithValue("@dBID", _dbid);
int count = (int)cm.ExecuteScalar();
_exists = (count > 0);
}
}
}
catch(Exception ex)
{
Database.LogException("Connection",ex);
}
}
}
#endregion
// Standard Default Code
// #region extension
Extension ext = new Extension();
[Serializable()]
partial class Extension : extensionBase
{
}
[Serializable()]
class extensionBase
{
// Default Values
public virtual int DefaultServerType
{
get { return 1; }
}
public virtual DateTime DefaultDts
{
get { return DateTime.Now; }
}
public virtual string DefaultUsrid
{
get { return Environment.UserName.ToUpper(); }
}
// Authorization Rules
public virtual void AddAuthorizationRules(Csla.Security.AuthorizationRules rules)
{
// Needs to be overriden to add new authorization rules
}
// Validation Rules
public virtual void AddValidationRules(Csla.Validation.ValidationRules rules)
{
// Needs to be overriden to add new validation rules
}
}
//#endregion
// The follwing is a sample Extension File. You can use it to create ConnectionExt.cs
//using System;
//using System.Collections.Generic;
//using System.Text;
//using Csla;
//namespace PatrialClass
//{
// public partial class Connection
// {
// partial class Extension : extensionBase
// {
// TODO: Override automatic defaults
// public virtual int DefaultServerType
// {
// get { return 1; }
// }
// public virtual DateTime DefaultDts
// {
// get { return DateTime.Now; }
// }
// public virtual string DefaultUsrid
// {
// get { return Environment.UserName.ToUpper(); }
// }
// public new void AddAuthorizationRules(Csla.Security.AuthorizationRules rules)
// {
// //rules.AllowRead(Dbid, "<Role(s)>");
// }
// public new void AddValidationRules(Csla.Validation.ValidationRules rules)
// {
// rules.AddRule(
// Csla.Validation.CommonRules.StringMaxLength,
// new Csla.Validation.CommonRules.MaxLengthRuleArgs("Name", 100));
// }
// }
// }
//}
} // Class
} // Namespace

View File

@@ -0,0 +1,444 @@
// ========================================================================
// Copyright 2006 - Volian Enterprises, Inc. All rights reserved.
// Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
// ------------------------------------------------------------------------
// $Workfile: $ $Revision: $
// $Author: $ $Date: $
//
// $History: $
// ========================================================================
using System;
using System.Data;
using System.Data.SqlClient;
using Csla;
using Csla.Data;
namespace Volian.Object.Library
{
/// <summary>
/// ConnectionFolder Generated by MyGeneration using the CSLA Object Mapping template
/// </summary>
[Serializable()]
public partial class ConnectionFolder : BusinessBase<ConnectionFolder>
{
#region Business Methods
private int _folderid;
[System.ComponentModel.DataObjectField(true, true)]
public int Folderid
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _folderid;
}
}
private int _parentid;
[System.ComponentModel.DataObjectField(true, true)]
public int Parentid
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _parentid;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (_parentid != value)
{
_parentid = value;
PropertyHasChanged();
}
}
}
private string _name=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string Name
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _name;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (value == null) value = string.Empty;
if (_name != value)
{
_name = value;
PropertyHasChanged();
}
}
}
private string _title=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string Title
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _title;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (value == null) value = string.Empty;
if (_title != value)
{
_title = value;
PropertyHasChanged();
}
}
}
private string _config=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string Config
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _config;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (value == null) value = string.Empty;
if (_config != value)
{
_config = value;
PropertyHasChanged();
}
}
}
private DateTime _dts=new DateTime();
[System.ComponentModel.DataObjectField(true, true)]
public DateTime Dts
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _dts;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (_dts != value)
{
_dts = value;
PropertyHasChanged();
}
}
}
private string _usrid=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string Usrid
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _usrid;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (value == null) value = string.Empty;
if (_usrid != value)
{
_usrid = value;
PropertyHasChanged();
}
}
}
private byte[] _lastchanged=new byte[8];//timestamp
// TODO: Check ConnectionFolder.GetIdValue to assure that the ID returned is unique
/// <summary>
/// Overrides Base GetIdValue - Used internally by CSLA to determine equality
/// </summary>
/// <returns>A Unique ID for the current ConnectionFolder</returns>
protected override object GetIdValue()
{
return _folderid;
}
// TODO: Replace base ConnectionFolder.ToString function as necessary
/// <summary>
/// Overrides Base ToString
/// </summary>
/// <returns>A string representation of current ConnectionFolder</returns>
//public override string ToString()
//{
// return base.ToString();
//}
#endregion
#region ValidationRules
protected override void AddBusinessRules()
{
ValidationRules.AddRule(
Csla.Validation.CommonRules.StringRequired, "Name");
ValidationRules.AddRule(
Csla.Validation.CommonRules.StringMaxLength,
new Csla.Validation.CommonRules.MaxLengthRuleArgs("Name", 100));
ValidationRules.AddRule(
Csla.Validation.CommonRules.StringMaxLength,
new Csla.Validation.CommonRules.MaxLengthRuleArgs("Title", 510));
ValidationRules.AddRule(
Csla.Validation.CommonRules.StringMaxLength,
new Csla.Validation.CommonRules.MaxLengthRuleArgs("Config", 1073741823));
ValidationRules.AddRule(
Csla.Validation.CommonRules.StringMaxLength,
new Csla.Validation.CommonRules.MaxLengthRuleArgs("Usrid", 100));
// TODO: Add other validation rules
}
// Sample data comparison validation rule
//private bool StartDateGTEndDate(object target, Csla.Validation.RuleArgs e)
//{
// if (_started > _ended)
// {
// e.Description = "Start date can't be after end date";
// return false;
// }
// else
// return true;
//}
#endregion
#region Authorization Rules
protected override void AddAuthorizationRules()
{
//TODO: Who can read/write which fields
//AuthorizationRules.AllowRead(Folderid, "<Role(s)>");
//AuthorizationRules.AllowRead(Parentid, "<Role(s)>");
//AuthorizationRules.AllowWrite(Parentid, "<Role(s)>");
//AuthorizationRules.AllowRead(Name, "<Role(s)>");
//AuthorizationRules.AllowWrite(Name, "<Role(s)>");
//AuthorizationRules.AllowRead(Title, "<Role(s)>");
//AuthorizationRules.AllowWrite(Title, "<Role(s)>");
//AuthorizationRules.AllowRead(Config, "<Role(s)>");
//AuthorizationRules.AllowWrite(Config, "<Role(s)>");
//AuthorizationRules.AllowRead(Dts, "<Role(s)>");
//AuthorizationRules.AllowWrite(Dts, "<Role(s)>");
//AuthorizationRules.AllowRead(Usrid, "<Role(s)>");
//AuthorizationRules.AllowWrite(Usrid, "<Role(s)>");
}
public static bool CanAddObject()
{
// TODO: Can Add Authorization
//return Csla.ApplicationContext.User.IsInRole("ProjectManager");
return true;
}
public static bool CanGetObject()
{
// TODO: CanGet Authorization
return true;
}
public static bool CanDeleteObject()
{
// TODO: CanDelete Authorization
//bool result = false;
//if (Csla.ApplicationContext.User.IsInRole("ProjectManager"))result = true;
//if (Csla.ApplicationContext.User.IsInRole("Administrator"))result = true;
//return result;
return true;
}
public static bool CanEditObject()
{
// TODO: CanEdit Authorization
//return Csla.ApplicationContext.User.IsInRole("ProjectManager");
return true;
}
#endregion
#region Factory Methods
internal static ConnectionFolder New(string name)
{
return new ConnectionFolder(name);
}
internal static ConnectionFolder Get(SafeDataReader dr)
{
return new ConnectionFolder(dr);
}
private ConnectionFolder()
{
MarkAsChild();
_parentid = ext.DefaultParentid;
_dts = ext.DefaultDts;
_usrid = ext.DefaultUsrid;
}
private ConnectionFolder(string name)
{
MarkAsChild();
// TODO: Add any initialization & defaults
_parentid = ext.DefaultParentid;
_dts = ext.DefaultDts;
_usrid = ext.DefaultUsrid;
_name = name;
}
private ConnectionFolder(SafeDataReader dr)
{
MarkAsChild();
Fetch(dr);
}
#endregion
#region Data Access Portal
private void Fetch(SafeDataReader dr)
{
try{
_folderid = dr.GetInt32("FolderID");
_parentid = dr.GetInt32("ParentID");
_name = dr.GetString("Name");
_title = dr.GetString("Title");
_config = dr.GetString("Config");
_dts = dr.GetDateTime("DTS");
_usrid = dr.GetString("UsrID");
dr.GetBytes("LastChanged", 0, _lastchanged, 0, 8);
}
catch(Exception ex)
{
Database.LogException("ConnectionFolder",ex);
}
MarkOld();
}
internal void Insert(Connection connection,SqlConnection cn)
{
// if we're not dirty then don't update the database
if (!this.IsDirty) return;
_lastchanged=Folder.Add(cn, ref _folderid, _parentid, connection.Dbid, _name, _title, _config, _dts, _usrid);
MarkOld();
}
internal void Update(Connection connection,SqlConnection cn)
{
// if we're not dirty then don't update the database
if (!this.IsDirty) return;
_lastchanged=Folder.Update(cn, ref _folderid, _parentid, connection.Dbid, _name, _title, _config, _dts, _usrid, ref _lastchanged);
}
internal void DeleteSelf(Connection connection,SqlConnection cn)
{
// if we're not dirty then don't update the database
if (!this.IsDirty) return;
// if we're new then don't update the database
if (this.IsNew) return;
Folder.Remove(cn,_folderid);
MarkNew();
}
#endregion
// Standard Default Code
// #region extension
Extension ext = new Extension();
[Serializable()]
partial class Extension : extensionBase
{
}
[Serializable()]
class extensionBase
{
// Default Values
public virtual int DefaultParentid
{
get { return 0; }
}
public virtual int DefaultDbid
{
get { return 0; }
}
public virtual DateTime DefaultDts
{
get { return DateTime.Now; }
}
public virtual string DefaultUsrid
{
get { return Environment.UserName.ToUpper(); }
}
// Authorization Rules
public virtual void AddAuthorizationRules(Csla.Security.AuthorizationRules rules)
{
// Needs to be overriden to add new authorization rules
}
// Validation Rules
public virtual void AddValidationRules(Csla.Validation.ValidationRules rules)
{
// Needs to be overriden to add new validation rules
}
}
//#endregion
// The follwing is a sample Extension File. You can use it to create ConnectionFolderExt.cs
//using System;
//using System.Collections.Generic;
//using System.Text;
//using Csla;
//namespace PatrialClass
//{
// public partial class ConnectionFolder
// {
// partial class Extension : extensionBase
// {
// TODO: Override automatic defaults
// public virtual int DefaultParentid
// {
// get { return 0; }
// }
// public virtual int DefaultDbid
// {
// get { return 0; }
// }
// public virtual DateTime DefaultDts
// {
// get { return DateTime.Now; }
// }
// public virtual string DefaultUsrid
// {
// get { return Environment.UserName.ToUpper(); }
// }
// public new void AddAuthorizationRules(Csla.Security.AuthorizationRules rules)
// {
// //rules.AllowRead(Dbid, "<Role(s)>");
// }
// public new void AddValidationRules(Csla.Validation.ValidationRules rules)
// {
// rules.AddRule(
// Csla.Validation.CommonRules.StringMaxLength,
// new Csla.Validation.CommonRules.MaxLengthRuleArgs("Name", 100));
// }
// }
// }
//}
} // Class
} // Namespace

View File

@@ -0,0 +1,85 @@
// ========================================================================
// Copyright 2006 - Volian Enterprises, Inc. All rights reserved.
// Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
// ------------------------------------------------------------------------
// $Workfile: $ $Revision: $
// $Author: $ $Date: $
//
// $History: $
// ========================================================================
using System;
using System.Data;
using System.Data.SqlClient;
using Csla;
using Csla.Data;
namespace Volian.Object.Library
{
/// <summary>
/// ConnectionFolders Generated by MyGeneration using the CSLA Object Mapping template
/// </summary>
[Serializable()]
public partial class ConnectionFolders : BusinessListBase<ConnectionFolders,ConnectionFolder>
{
// No Columns to retrieve
#region Factory Methods
internal static ConnectionFolders New()
{
return new ConnectionFolders();
}
internal static ConnectionFolders Get(SafeDataReader dr)
{
return new ConnectionFolders(dr);
}
private ConnectionFolders()
{
MarkAsChild();
}
private ConnectionFolders(SafeDataReader dr)
{
MarkAsChild();
Fetch(dr);
}
#endregion
#region Data Access Portal
// called to load data from the database
private void Fetch(SafeDataReader dr)
{
this.RaiseListChangedEvents = false;
while (dr.Read())
this.Add(ConnectionFolder.Get(dr));
this.RaiseListChangedEvents = true;
}
internal void Update(Connection connection,SqlConnection cn)
{
this.RaiseListChangedEvents = false;
// update (thus deleting) any deleted child objects
foreach (ConnectionFolder obj in DeletedList)
obj.DeleteSelf(connection,cn);
// now that they are deleted, remove them from memory too
DeletedList.Clear();
// add/update any current child objects
foreach (ConnectionFolder obj in this)
{
if (obj.IsNew)
obj.Insert(connection,cn);
else
obj.Update(connection,cn);
}
this.RaiseListChangedEvents = true;
}
#endregion
} // Class
} // Namespace

View File

@@ -0,0 +1,170 @@
// ========================================================================
// Copyright 2006 - Volian Enterprises, Inc. All rights reserved.
// Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
// ------------------------------------------------------------------------
// $Workfile: $ $Revision: $
// $Author: $ $Date: $
//
// $History: $
// ========================================================================
using System;
using System.Data;
using System.Data.SqlClient;
using Csla;
using Csla.Data;
namespace Volian.Object.Library
{
/// <summary>
/// ConnectionInfo Generated by MyGeneration using the CSLA Object Mapping template
/// </summary>
[Serializable()]
public partial class ConnectionInfo : ReadOnlyBase<ConnectionInfo>
{
#region Business Methods
private int _dbid;
[System.ComponentModel.DataObjectField(true, true)]
public int Dbid
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _dbid;
}
}
private string _name=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string Name
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _name;
}
}
private string _title=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string Title
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _title;
}
}
private string _connectionstring=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string ConnectionString
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _connectionstring;
}
}
private int _servertype;
/// <summary>
/// 0 SQL Server
/// </summary>
[System.ComponentModel.DataObjectField(true, true)]
public int ServerType
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _servertype;
}
}
private string _config=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string Config
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _config;
}
}
private DateTime _dts=new DateTime();
[System.ComponentModel.DataObjectField(true, true)]
public DateTime Dts
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _dts;
}
}
private string _usrid=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string Usrid
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _usrid;
}
}
// TODO: Replace base ConnectionInfo.ToString function as necessary
/// <summary>
/// Overrides Base ToString
/// </summary>
/// <returns>A string representation of current ConnectionInfo</returns>
//public override string ToString()
//{
// return base.ToString();
//}
// TODO: Check ConnectionInfo.GetIdValue to assure that the ID returned is unique
/// <summary>
/// Overrides Base GetIdValue - Used internally by CSLA to determine equality
/// </summary>
/// <returns>A Unique ID for the current ConnectionInfo</returns>
protected override object GetIdValue()
{
return _dbid;
}
#endregion
#region Factory Methods
private ConnectionInfo()
{ /* require use of factory methods */ }
#endregion
#region Data Access Portal
internal ConnectionInfo(SafeDataReader dr)
{
try
{
_dbid = dr.GetInt32("DBID");
_name = dr.GetString("Name");
_title = dr.GetString("Title");
_connectionstring = dr.GetString("ConnectionString");
_servertype = dr.GetInt32("ServerType");
_config = dr.GetString("Config");
_dts = dr.GetDateTime("DTS");
_usrid = dr.GetString("UsrID");
}
catch(Exception ex)
{
Database.LogException("ConnectionInfo",ex);
}
}
#endregion
} // Class
} // Namespace

View File

@@ -0,0 +1,78 @@
// ========================================================================
// Copyright 2006 - Volian Enterprises, Inc. All rights reserved.
// Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
// ------------------------------------------------------------------------
// $Workfile: $ $Revision: $
// $Author: $ $Date: $
//
// $History: $
// ========================================================================
using System;
using System.Data;
using System.Data.SqlClient;
using Csla;
using Csla.Data;
namespace Volian.Object.Library
{
/// <summary>
/// ConnectionInfoList Generated by MyGeneration using the CSLA Object Mapping template
/// </summary>
[Serializable()]
public partial class ConnectionInfoList : ReadOnlyListBase<ConnectionInfoList,ConnectionInfo>
{
#region Factory Methods
/// <summary>
/// Return a list of all projects.
/// </summary>
public static ConnectionInfoList Get()
{
return DataPortal.Fetch<ConnectionInfoList>(new Criteria());
}
// TODO: Add alternative gets -
//public static ConnectionInfoList Get(<criteria>)
//{
// return DataPortal.Fetch<ConnectionInfoList>(new FilteredCriteria(<criteria>));
//}
private ConnectionInfoList()
{ /* require use of factory methods */ }
#endregion
#region Data Access Portal
[Serializable()]
private class Criteria
{ /* no criteria - retrieve all rows */ }
private void DataPortal_Fetch(Criteria criteria)
{
this.RaiseListChangedEvents = false;
try{
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
{
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "getConnections";
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
{
IsReadOnly = false;
while (dr.Read())this.Add(new ConnectionInfo(dr));
IsReadOnly = true;
}
}
}
}
catch(Exception ex)
{
Database.LogException("ConnectionInfoList",ex);
}
this.RaiseListChangedEvents = true;
}
#endregion
} // Class
} // Namespace

View File

@@ -0,0 +1,83 @@
using System;
using System.Configuration;
using Csla;
using System.Data.SqlClient;
using System.IO;
namespace Volian.Object.Library
{
public static class Database
{
#region Log4Net
private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
#endregion
public static string VEPROMS_Connection
{
get
{
DateTime.Today.ToLongDateString();
ConnectionStringSettings cs = ConfigurationManager.ConnectionStrings["VEPROMS"];
if (cs == null)
{
throw new ApplicationException("Database.cs Could not find connection VEPROMS");
}
return cs.ConnectionString;
}
}
public static SqlConnection VEPROMS_SqlConnection
{
get
{
string strConn = VEPROMS_Connection; // If failure - Fail (Don't try to catch)
// Attempt to make a connection
try
{
SqlConnection cn = new SqlConnection(strConn);
cn.Open();
return cn;
}
catch (SqlException exsql)
{
const string strAttachError = "An attempt to attach an auto-named database for file ";
if (exsql.Message.StartsWith(strAttachError))
{// Check to see if the file is missing
string sFile = exsql.Message.Substring(strAttachError.Length);
sFile = sFile.Substring(0, sFile.IndexOf(" failed"));
// "An attempt to attach an auto-named database for file <mdf file> failed"
if (strConn.ToLower().IndexOf("user instance=true") < 0)
{
throw new ApplicationException("Connection String missing attribute: User Instance=True");
}
if (File.Exists(sFile))
{
throw new ApplicationException("Database file " + sFile + " Cannot be opened\r\n", exsql);
}
else
{
throw new FileNotFoundException("Database file " + sFile + " Not Found", exsql);
}
}
else
{
throw new ApplicationException("Failure on Connect", exsql);
}
}
catch (Exception ex)// Throw Application Exception on Failure
{
if (log.IsErrorEnabled) log.Error("Connection Error", ex);
throw new ApplicationException("Failure on Connect", ex);
}
}
}
public static void LogException(string s,Exception ex)
{
log.Error(s,ex);
int i = 0;
Console.WriteLine("Error - {0}", s);
for (; ex != null; ex = ex.InnerException)
{
Console.WriteLine("{0}{1} - {2}", "".PadLeft(i * 2), ex.GetType().ToString(), ex.Message);
}
}
}
}

View File

@@ -0,0 +1,775 @@
// ========================================================================
// Copyright 2006 - Volian Enterprises, Inc. All rights reserved.
// Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
// ------------------------------------------------------------------------
// $Workfile: $ $Revision: $
// $Author: $ $Date: $
//
// $History: $
// ========================================================================
using System;
using System.Data;
using System.Data.SqlClient;
using Csla;
using Csla.Data;
namespace Volian.Object.Library
{
/// <summary>
/// Folder Generated by MyGeneration using the CSLA Object Mapping template
/// </summary>
[Serializable()]
public partial class Folder : BusinessBase<Folder>
{
#region Business Methods
private int _folderid;
[System.ComponentModel.DataObjectField(true, true)]
public int Folderid
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _folderid;
}
}
private int _parentid;
[System.ComponentModel.DataObjectField(true, true)]
public int Parentid
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _parentid;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (_parentid != value)
{
_parentid = value;
PropertyHasChanged();
}
}
}
private int _dbid;
[System.ComponentModel.DataObjectField(true, true)]
public int Dbid
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _dbid;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (_dbid != value)
{
_dbid = value;
PropertyHasChanged();
}
}
}
private string _name=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string Name
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _name;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (value == null) value = string.Empty;
if (_name != value)
{
_name = value;
PropertyHasChanged();
}
}
}
private string _title=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string Title
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _title;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (value == null) value = string.Empty;
if (_title != value)
{
_title = value;
PropertyHasChanged();
}
}
}
private string _config=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string Config
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _config;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (value == null) value = string.Empty;
if (_config != value)
{
_config = value;
PropertyHasChanged();
}
}
}
private DateTime _dts=new DateTime();
[System.ComponentModel.DataObjectField(true, true)]
public DateTime Dts
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _dts;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (_dts != value)
{
_dts = value;
PropertyHasChanged();
}
}
}
private string _usrid=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string Usrid
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _usrid;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (value == null) value = string.Empty;
if (_usrid != value)
{
_usrid = value;
PropertyHasChanged();
}
}
}
private byte[] _lastchanged=new byte[8];//timestamp
private FolderAssignments _folderassignments = FolderAssignments.New();
/// <summary>
/// Related Field
/// </summary>
[System.ComponentModel.DataObjectField(true, true)]
public FolderAssignments FolderAssignments
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _folderassignments;
}
}
public override bool IsDirty
{
get { return base.IsDirty || _folderassignments.IsDirty ; }
}
public override bool IsValid
{
get { return base.IsValid && _folderassignments.IsValid ; }
}
// TODO: Replace base Folder.ToString function as necessary
/// <summary>
/// Overrides Base ToString
/// </summary>
/// <returns>A string representation of current Folder</returns>
//public override string ToString()
//{
// return base.ToString();
//}
// TODO: Check Folder.GetIdValue to assure that the ID returned is unique
/// <summary>
/// Overrides Base GetIdValue - Used internally by CSLA to determine equality
/// </summary>
/// <returns>A Unique ID for the current Folder</returns>
protected override object GetIdValue()
{
return _folderid;
}
#endregion
#region ValidationRules
protected override void AddBusinessRules()
{
ValidationRules.AddRule(
Csla.Validation.CommonRules.StringRequired, "Name");
ValidationRules.AddRule(
Csla.Validation.CommonRules.StringMaxLength,
new Csla.Validation.CommonRules.MaxLengthRuleArgs("Name", 100));
ValidationRules.AddRule(
Csla.Validation.CommonRules.StringMaxLength,
new Csla.Validation.CommonRules.MaxLengthRuleArgs("Title", 510));
ValidationRules.AddRule(
Csla.Validation.CommonRules.StringMaxLength,
new Csla.Validation.CommonRules.MaxLengthRuleArgs("Config", 1073741823));
ValidationRules.AddRule(
Csla.Validation.CommonRules.StringMaxLength,
new Csla.Validation.CommonRules.MaxLengthRuleArgs("Usrid", 100));
ext.AddValidationRules(ValidationRules);
// TODO: Add other validation rules
// ValidationRules.AddRule(StartDateGTEndDate, "Started");
}
// Sample data comparison validation rule
//private bool StartDateGTEndDate(object target, Csla.Validation.RuleArgs e)
//{
// if (_started > _ended)
// {
// e.Description = "Start date can't be after end date";
// return false;
// }
// else
// return true;
//}
#endregion
#region Authorization Rules
protected override void AddAuthorizationRules()
{
//TODO: Who can read/write which fields
//AuthorizationRules.AllowRead(Folderid, "<Role(s)>");
//AuthorizationRules.AllowRead(Parentid, "<Role(s)>");
//AuthorizationRules.AllowRead(Dbid, "<Role(s)>");
//AuthorizationRules.AllowRead(Name, "<Role(s)>");
//AuthorizationRules.AllowRead(Title, "<Role(s)>");
//AuthorizationRules.AllowRead(Config, "<Role(s)>");
//AuthorizationRules.AllowRead(Dts, "<Role(s)>");
//AuthorizationRules.AllowRead(Usrid, "<Role(s)>");
//AuthorizationRules.AllowWrite(Parentid, "<Role(s)>");
//AuthorizationRules.AllowWrite(Dbid, "<Role(s)>");
//AuthorizationRules.AllowWrite(Name, "<Role(s)>");
//AuthorizationRules.AllowWrite(Title, "<Role(s)>");
//AuthorizationRules.AllowWrite(Config, "<Role(s)>");
//AuthorizationRules.AllowWrite(Dts, "<Role(s)>");
//AuthorizationRules.AllowWrite(Usrid, "<Role(s)>");
ext.AddAuthorizationRules(AuthorizationRules);
}
public static bool CanAddObject()
{
// TODO: Can Add Authorization
//return Csla.ApplicationContext.User.IsInRole("ProjectManager");
return true;
}
public static bool CanGetObject()
{
// TODO: CanGet Authorization
return true;
}
public static bool CanDeleteObject()
{
// TODO: CanDelete Authorization
//bool result = false;
//if (Csla.ApplicationContext.User.IsInRole("ProjectManager"))result = true;
//if (Csla.ApplicationContext.User.IsInRole("Administrator"))result = true;
//return result;
return true;
}
public static bool CanEditObject()
{
// TODO: CanEdit Authorization
//return Csla.ApplicationContext.User.IsInRole("ProjectManager");
return true;
}
#endregion
#region Factory Methods
private Folder()
{/* require use of factory methods */}
public static Folder New()
{
if (!CanAddObject())
throw new System.Security.SecurityException("User not authorized to add a Folder");
return DataPortal.Create<Folder>();
}
public static Folder Get(int _folderid)
{
if (!CanGetObject())
throw new System.Security.SecurityException("User not authorized to view a Folder");
return DataPortal.Fetch<Folder>(new PKCriteria(_folderid));
}
public static void Delete(int _folderid)
{
if (!CanDeleteObject())
throw new System.Security.SecurityException("User not authorized to remove a Folder");
DataPortal.Delete(new PKCriteria(_folderid));
}
public override Folder Save()
{
if (IsDeleted && !CanDeleteObject())
throw new System.Security.SecurityException("User not authorized to remove a Folder");
else if (IsNew && !CanAddObject())
throw new System.Security.SecurityException("User not authorized to add a Folder");
else if (!CanEditObject())
throw new System.Security.SecurityException("User not authorized to update a Folder");
return base.Save();
}
#endregion
#region Data Access Portal
[Serializable()]
private class PKCriteria
{
private int _folderid;
public int Folderid
{ get {return _folderid;}}
public PKCriteria(int folderid)
{
_folderid=folderid;
}
}
// If Create needs to access DB - It should not be marked RunLocal
[RunLocal()]
private new void DataPortal_Create(object criteria)
{
// Database Defaults
_parentid = ext.DefaultParentid;
_dbid = ext.DefaultDbid;
_dts = ext.DefaultDts;
_usrid = ext.DefaultUsrid;
// TODO: Add any defaults that are necessary
ValidationRules.CheckRules();
}
private void DataPortal_Fetch(PKCriteria criteria)
{
try{
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
{
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "getFolder";
cm.Parameters.AddWithValue("@folderID", criteria.Folderid);
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
{
dr.Read();
_folderid = dr.GetInt32("FolderID");
_parentid = dr.GetInt32("ParentID");
_dbid = dr.GetInt32("DBID");
_name = dr.GetString("Name");
_title = dr.GetString("Title");
_config = dr.GetString("Config");
_dts = dr.GetDateTime("DTS");
_usrid = dr.GetString("UsrID");
dr.GetBytes("LastChanged", 0, _lastchanged, 0, 8);
// load child objects
dr.NextResult();
_folderassignments = FolderAssignments.Get(dr);
}
}
}
}
catch(Exception ex)
{
Database.LogException("Folder",ex);
}
}
[Transactional(TransactionalTypes.TransactionScope)]
protected override void DataPortal_Insert()
{
try{
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
{
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "addFolder";
// Input All Fields - Except Calculated Columns
cm.Parameters.AddWithValue("@parentID", _parentid);
cm.Parameters.AddWithValue("@dBID", _dbid);
cm.Parameters.AddWithValue("@name", _name);
cm.Parameters.AddWithValue("@title", _title);
cm.Parameters.AddWithValue("@config", _config);
cm.Parameters.AddWithValue("@dTS", _dts);
cm.Parameters.AddWithValue("@usrID", _usrid);
// Output Calculated Columns
SqlParameter param_folderid = new SqlParameter("@newFolderID",SqlDbType.Int);
param_folderid.Direction = ParameterDirection.Output;
cm.Parameters.Add(param_folderid);
SqlParameter param_lastchanged = new SqlParameter("@newLastChanged",SqlDbType.Timestamp);
param_lastchanged.Direction = ParameterDirection.Output;
cm.Parameters.Add(param_lastchanged);
// TODO: Define any additional output parameters
cm.ExecuteNonQuery();
// Save all values being returned from the Procedure
_folderid = (int)cm.Parameters["@newFolderID"].Value;
_lastchanged = (byte[])cm.Parameters["@newLastChanged"].Value;
}
// update child objects
_folderassignments.Update(this,cn);
}
}
catch(Exception ex)
{
Database.LogException("Folder",ex);
}}
[Transactional(TransactionalTypes.TransactionScope)]
public static byte[] Add(SqlConnection cn,ref int folderid, int parentid, int dbid, string name, string title, string config, DateTime dts, string usrid)
{
try{
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "addFolder";
// Input All Fields - Except Calculated Columns
cm.Parameters.AddWithValue("@parentID", parentid);
cm.Parameters.AddWithValue("@dBID", dbid);
cm.Parameters.AddWithValue("@name", name);
cm.Parameters.AddWithValue("@title", title);
cm.Parameters.AddWithValue("@config", config);
cm.Parameters.AddWithValue("@dTS", dts);
cm.Parameters.AddWithValue("@usrID", usrid);
// Output Calculated Columns
SqlParameter param_folderid = new SqlParameter("@newFolderID",SqlDbType.Int);
param_folderid.Direction = ParameterDirection.Output;
cm.Parameters.Add(param_folderid);
SqlParameter param_lastchanged = new SqlParameter("@newLastChanged",SqlDbType.Timestamp);
param_lastchanged.Direction = ParameterDirection.Output;
cm.Parameters.Add(param_lastchanged);
// TODO: Define any additional output parameters
cm.ExecuteNonQuery();
// Save all values being returned from the Procedure
folderid = (int)cm.Parameters["@newFolderID"].Value;
return (byte[])cm.Parameters["@newLastChanged"].Value;
}
}
catch(Exception ex)
{
Database.LogException("Folder",ex);
return null;
}
}
[Transactional(TransactionalTypes.TransactionScope)]
protected override void DataPortal_Update()
{
if (IsDirty)// If this is dirty - open the connection
{
try{
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
{
if(base.IsDirty)
{
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "updateFolder";
// All Fields including Calculated Fields
cm.Parameters.AddWithValue("@folderID", _folderid);
cm.Parameters.AddWithValue("@parentID", _parentid);
cm.Parameters.AddWithValue("@dBID", _dbid);
cm.Parameters.AddWithValue("@name", _name);
cm.Parameters.AddWithValue("@title", _title);
cm.Parameters.AddWithValue("@config", _config);
cm.Parameters.AddWithValue("@dTS", _dts);
cm.Parameters.AddWithValue("@usrID", _usrid);
cm.Parameters.AddWithValue("@lastChanged", _lastchanged);
// Output Calculated Columns
SqlParameter param_lastchanged = new SqlParameter("@newLastChanged",SqlDbType.Timestamp);
param_lastchanged.Direction = ParameterDirection.Output;
cm.Parameters.Add(param_lastchanged);
// TODO: Define any additional output parameters
cm.ExecuteNonQuery();
// Save all values being returned from the Procedure
_lastchanged = (byte[])cm.Parameters["@newLastChanged"].Value;
}
}
// use the open connection to update child objects
_folderassignments.Update(this,cn);
}
}
catch(Exception ex)
{
Database.LogException("Folder",ex);
}
}
}
[Transactional(TransactionalTypes.TransactionScope)]
public static byte[] Update(SqlConnection cn,ref int folderid, int parentid, int dbid, string name, string title, string config, DateTime dts, string usrid, ref byte[] lastchanged)
{
try{
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "updateFolder";
// Input All Fields - Except Calculated Columns
cm.Parameters.AddWithValue("@folderID", folderid);
cm.Parameters.AddWithValue("@parentID", parentid);
cm.Parameters.AddWithValue("@dBID", dbid);
cm.Parameters.AddWithValue("@name", name);
cm.Parameters.AddWithValue("@title", title);
cm.Parameters.AddWithValue("@config", config);
cm.Parameters.AddWithValue("@dTS", dts);
cm.Parameters.AddWithValue("@usrID", usrid);
cm.Parameters.AddWithValue("@lastChanged", lastchanged);
// Output Calculated Columns
SqlParameter param_lastchanged = new SqlParameter("@newLastChanged",SqlDbType.Timestamp);
param_lastchanged.Direction = ParameterDirection.Output;
cm.Parameters.Add(param_lastchanged);
// TODO: Define any additional output parameters
cm.ExecuteNonQuery();
// Save all values being returned from the Procedure
return (byte[])cm.Parameters["@newLastChanged"].Value;
}
}
catch(Exception ex)
{
Database.LogException("Folder",ex);
return null;
}
}
[Transactional(TransactionalTypes.TransactionScope)]
protected override void DataPortal_DeleteSelf()
{
DataPortal_Delete(new PKCriteria(_folderid));
}
[Transactional(TransactionalTypes.TransactionScope)]
private void DataPortal_Delete(PKCriteria criteria)
{
try{
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
{
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "deleteFolder";
cm.Parameters.AddWithValue("@folderID", criteria.Folderid);
cm.ExecuteNonQuery();
}
}
}
catch(Exception ex)
{
Database.LogException("Folder",ex);
}
}
[Transactional(TransactionalTypes.TransactionScope)]
public static void Remove(SqlConnection cn,int folderid)
{
try{
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "deleteFolder";
// Input PK Fields
cm.Parameters.AddWithValue("@folderID", folderid);
// TODO: Define any additional output parameters
cm.ExecuteNonQuery();
}
}
catch(Exception ex)
{
Database.LogException("Folder",ex);
}
}
#endregion
#region Exists
public static bool Exists(int folderid)
{
ExistsCommand result;
result = DataPortal.Execute<ExistsCommand>
(new ExistsCommand(folderid));
return result.Exists;
}
[Serializable()]
private class ExistsCommand : CommandBase
{
private int _folderid;
private bool _exists;
public bool Exists
{
get { return _exists; }
}
public ExistsCommand(int folderid)
{
_folderid=folderid;
}
protected override void DataPortal_Execute()
{
try{
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
{
cn.Open();
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "existsFolder";
cm.Parameters.AddWithValue("@folderID", _folderid);
int count = (int)cm.ExecuteScalar();
_exists = (count > 0);
}
}
}
catch(Exception ex)
{
Database.LogException("Folder",ex);
}
}
}
#endregion
// Standard Default Code
// #region extension
Extension ext = new Extension();
[Serializable()]
partial class Extension : extensionBase
{
}
[Serializable()]
class extensionBase
{
// Default Values
public virtual int DefaultParentid
{
get { return 0; }
}
public virtual int DefaultDbid
{
get { return 0; }
}
public virtual DateTime DefaultDts
{
get { return DateTime.Now; }
}
public virtual string DefaultUsrid
{
get { return Environment.UserName.ToUpper(); }
}
// Authorization Rules
public virtual void AddAuthorizationRules(Csla.Security.AuthorizationRules rules)
{
// Needs to be overriden to add new authorization rules
}
// Validation Rules
public virtual void AddValidationRules(Csla.Validation.ValidationRules rules)
{
// Needs to be overriden to add new validation rules
}
}
//#endregion
// The follwing is a sample Extension File. You can use it to create FolderExt.cs
//using System;
//using System.Collections.Generic;
//using System.Text;
//using Csla;
//namespace PatrialClass
//{
// public partial class Folder
// {
// partial class Extension : extensionBase
// {
// TODO: Override automatic defaults
// public virtual int DefaultParentid
// {
// get { return 0; }
// }
// public virtual int DefaultDbid
// {
// get { return 0; }
// }
// public virtual DateTime DefaultDts
// {
// get { return DateTime.Now; }
// }
// public virtual string DefaultUsrid
// {
// get { return Environment.UserName.ToUpper(); }
// }
// public new void AddAuthorizationRules(Csla.Security.AuthorizationRules rules)
// {
// //rules.AllowRead(Dbid, "<Role(s)>");
// }
// public new void AddValidationRules(Csla.Validation.ValidationRules rules)
// {
// rules.AddRule(
// Csla.Validation.CommonRules.StringMaxLength,
// new Csla.Validation.CommonRules.MaxLengthRuleArgs("Name", 100));
// }
// }
// }
//}
} // Class
} // Namespace

View File

@@ -0,0 +1,588 @@
// ========================================================================
// Copyright 2006 - Volian Enterprises, Inc. All rights reserved.
// Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
// ------------------------------------------------------------------------
// $Workfile: $ $Revision: $
// $Author: $ $Date: $
//
// $History: $
// ========================================================================
using System;
using System.Data;
using System.Data.SqlClient;
using Csla;
using Csla.Data;
namespace Volian.Object.Library
{
/// <summary>
/// FolderAssignment Generated by MyGeneration using the CSLA Object Mapping template
/// </summary>
[Serializable()]
public partial class FolderAssignment : BusinessBase<FolderAssignment>
{
#region Business Methods
private int _aid;
[System.ComponentModel.DataObjectField(true, true)]
public int Aid
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _aid;
}
}
private int _gid;
[System.ComponentModel.DataObjectField(true, true)]
public int Gid
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _gid;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (_gid != value)
{
_gid = value;
PropertyHasChanged();
}
}
}
private int _rid;
[System.ComponentModel.DataObjectField(true, true)]
public int Rid
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _rid;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (_rid != value)
{
_rid = value;
PropertyHasChanged();
}
}
}
private string _startdate=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string StartDate
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _startdate;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (value == null) value = string.Empty;
_startdate = value;
try
{
DateTime tmp = SmartDate.StringToDate(value);
if (_startdate != tmp.ToShortDateString())
{
_startdate = tmp.ToShortDateString();
// TODO: Any Cross Property Validation
}
}
catch
{
}
PropertyHasChanged();
}
}
private string _enddate=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string EndDate
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _enddate;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (value == null) value = string.Empty;
_enddate = value;
try
{
DateTime tmp = SmartDate.StringToDate(value);
if (_enddate != tmp.ToShortDateString())
{
_enddate = tmp.ToShortDateString();
// TODO: Any Cross Property Validation
}
}
catch
{
}
PropertyHasChanged();
}
}
private DateTime _dts=new DateTime();
[System.ComponentModel.DataObjectField(true, true)]
public DateTime Dts
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _dts;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (_dts != value)
{
_dts = value;
PropertyHasChanged();
}
}
}
private string _usrid=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string Usrid
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _usrid;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (value == null) value = string.Empty;
if (_usrid != value)
{
_usrid = value;
PropertyHasChanged();
}
}
}
private byte[] _lastchanged=new byte[8];//timestamp
private string _group_groupname=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string Group_GroupName
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _group_groupname;
}
}
private int _group_grouptype;
[System.ComponentModel.DataObjectField(true, true)]
public int Group_GroupType
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _group_grouptype;
}
}
private string _group_config=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string Group_Config
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _group_config;
}
}
private DateTime _group_dts=new DateTime();
[System.ComponentModel.DataObjectField(true, true)]
public DateTime Group_Dts
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _group_dts;
}
}
private string _group_usrid=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string Group_Usrid
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _group_usrid;
}
}
private string _role_name=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string Role_Name
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _role_name;
}
}
private string _role_title=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string Role_Title
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _role_title;
}
}
private DateTime _role_dts=new DateTime();
[System.ComponentModel.DataObjectField(true, true)]
public DateTime Role_Dts
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _role_dts;
}
}
private string _role_usrid=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string Role_Usrid
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _role_usrid;
}
}
// TODO: Check FolderAssignment.GetIdValue to assure that the ID returned is unique
/// <summary>
/// Overrides Base GetIdValue - Used internally by CSLA to determine equality
/// </summary>
/// <returns>A Unique ID for the current FolderAssignment</returns>
protected override object GetIdValue()
{
return _aid;
}
// TODO: Replace base FolderAssignment.ToString function as necessary
/// <summary>
/// Overrides Base ToString
/// </summary>
/// <returns>A string representation of current FolderAssignment</returns>
//public override string ToString()
//{
// return base.ToString();
//}
#endregion
#region ValidationRules
protected override void AddBusinessRules()
{
ValidationRules.AddRule(StartDateValid, "StartDate");
ValidationRules.AddRule(EndDateValid, "EndDate");
ValidationRules.AddRule(
Csla.Validation.CommonRules.StringMaxLength,
new Csla.Validation.CommonRules.MaxLengthRuleArgs("Usrid", 100));
// TODO: Add other validation rules
}
private bool StartDateValid(object target, Csla.Validation.RuleArgs e)
{
try
{
DateTime tmp = SmartDate.StringToDate(_startdate);
}
catch
{
e.Description="Invalid Date";
return false;
}
return true;
}
private bool EndDateValid(object target, Csla.Validation.RuleArgs e)
{
try
{
DateTime tmp = SmartDate.StringToDate(_enddate);
}
catch
{
e.Description="Invalid Date";
return false;
}
return true;
}
// Sample data comparison validation rule
//private bool StartDateGTEndDate(object target, Csla.Validation.RuleArgs e)
//{
// if (_started > _ended)
// {
// e.Description = "Start date can't be after end date";
// return false;
// }
// else
// return true;
//}
#endregion
#region Authorization Rules
protected override void AddAuthorizationRules()
{
//TODO: Who can read/write which fields
//AuthorizationRules.AllowRead(Aid, "<Role(s)>");
//AuthorizationRules.AllowRead(Gid, "<Role(s)>");
//AuthorizationRules.AllowWrite(Gid, "<Role(s)>");
//AuthorizationRules.AllowRead(Rid, "<Role(s)>");
//AuthorizationRules.AllowWrite(Rid, "<Role(s)>");
//AuthorizationRules.AllowRead(StartDate, "<Role(s)>");
//AuthorizationRules.AllowWrite(StartDate, "<Role(s)>");
//AuthorizationRules.AllowRead(EndDate, "<Role(s)>");
//AuthorizationRules.AllowWrite(EndDate, "<Role(s)>");
//AuthorizationRules.AllowRead(Dts, "<Role(s)>");
//AuthorizationRules.AllowWrite(Dts, "<Role(s)>");
//AuthorizationRules.AllowRead(Usrid, "<Role(s)>");
//AuthorizationRules.AllowWrite(Usrid, "<Role(s)>");
}
public static bool CanAddObject()
{
// TODO: Can Add Authorization
//return Csla.ApplicationContext.User.IsInRole("ProjectManager");
return true;
}
public static bool CanGetObject()
{
// TODO: CanGet Authorization
return true;
}
public static bool CanDeleteObject()
{
// TODO: CanDelete Authorization
//bool result = false;
//if (Csla.ApplicationContext.User.IsInRole("ProjectManager"))result = true;
//if (Csla.ApplicationContext.User.IsInRole("Administrator"))result = true;
//return result;
return true;
}
public static bool CanEditObject()
{
// TODO: CanEdit Authorization
//return Csla.ApplicationContext.User.IsInRole("ProjectManager");
return true;
}
#endregion
#region Factory Methods
internal static FolderAssignment New(int gid, int rid)
{
return new FolderAssignment(Volian.Object.Library.Group.Get(gid), Volian.Object.Library.Role.Get(rid));
}
internal static FolderAssignment Get(SafeDataReader dr)
{
return new FolderAssignment(dr);
}
private FolderAssignment()
{
MarkAsChild();
_startdate = ext.DefaultStartDate;
_dts = ext.DefaultDts;
_usrid = ext.DefaultUsrid;
}
private FolderAssignment(Group group, Role role)
{
MarkAsChild();
// TODO: Add any initialization & defaults
_startdate = ext.DefaultStartDate;
_dts = ext.DefaultDts;
_usrid = ext.DefaultUsrid;
_gid = group.Gid;
_group_groupname = group.GroupName;
_group_grouptype = group.GroupType;
_group_config = group.Config;
_group_dts = group.Dts;
_group_usrid = group.Usrid;
_rid = role.Rid;
_role_name = role.Name;
_role_title = role.Title;
_role_dts = role.Dts;
_role_usrid = role.Usrid;
}
private FolderAssignment(SafeDataReader dr)
{
MarkAsChild();
Fetch(dr);
}
#endregion
#region Data Access Portal
private void Fetch(SafeDataReader dr)
{
try{
_aid = dr.GetInt32("AID");
_gid = dr.GetInt32("GID");
_rid = dr.GetInt32("RID");
_startdate = dr.GetSmartDate("StartDate").Text;
_enddate = dr.GetSmartDate("EndDate").Text;
_dts = dr.GetDateTime("DTS");
_usrid = dr.GetString("UsrID");
dr.GetBytes("LastChanged", 0, _lastchanged, 0, 8);
_group_groupname = dr.GetString("Groups_GroupName");
_group_grouptype = dr.GetInt32("Groups_GroupType");
_group_config = dr.GetString("Groups_Config");
_group_dts = dr.GetDateTime("Groups_DTS");
_group_usrid = dr.GetString("Groups_UsrID");
_role_name = dr.GetString("Roles_Name");
_role_title = dr.GetString("Roles_Title");
_role_dts = dr.GetDateTime("Roles_DTS");
_role_usrid = dr.GetString("Roles_UsrID");
}
catch(Exception ex)
{
Database.LogException("FolderAssignment",ex);
}
MarkOld();
}
internal void Insert(Folder folder,SqlConnection cn)
{
// if we're not dirty then don't update the database
if (!this.IsDirty) return;
_lastchanged=Assignment.Add(cn, ref _aid, _gid, _rid, folder.Folderid, new SmartDate(_startdate), new SmartDate(_enddate), _dts, _usrid);
MarkOld();
}
internal void Update(Folder folder,SqlConnection cn)
{
// if we're not dirty then don't update the database
if (!this.IsDirty) return;
_lastchanged=Assignment.Update(cn, ref _aid, _gid, _rid, folder.Folderid, new SmartDate(_startdate), new SmartDate(_enddate), _dts, _usrid, ref _lastchanged);
}
internal void DeleteSelf(Folder folder,SqlConnection cn)
{
// if we're not dirty then don't update the database
if (!this.IsDirty) return;
// if we're new then don't update the database
if (this.IsNew) return;
Assignment.Remove(cn,_aid);
MarkNew();
}
#endregion
// Standard Default Code
// #region extension
Extension ext = new Extension();
[Serializable()]
partial class Extension : extensionBase
{
}
[Serializable()]
class extensionBase
{
// Default Values
public virtual string DefaultStartDate
{
get { return DateTime.Now.ToShortDateString(); }
}
public virtual DateTime DefaultDts
{
get { return DateTime.Now; }
}
public virtual string DefaultUsrid
{
get { return Environment.UserName.ToUpper(); }
}
// Authorization Rules
public virtual void AddAuthorizationRules(Csla.Security.AuthorizationRules rules)
{
// Needs to be overriden to add new authorization rules
}
// Validation Rules
public virtual void AddValidationRules(Csla.Validation.ValidationRules rules)
{
// Needs to be overriden to add new validation rules
}
}
//#endregion
// The follwing is a sample Extension File. You can use it to create FolderAssignmentExt.cs
//using System;
//using System.Collections.Generic;
//using System.Text;
//using Csla;
//namespace PatrialClass
//{
// public partial class FolderAssignment
// {
// partial class Extension : extensionBase
// {
// TODO: Override automatic defaults
// public virtual SmartDate DefaultStartDate
// {
// get { return DateTime.Now.ToShortDateString(); }
// }
// public virtual DateTime DefaultDts
// {
// get { return DateTime.Now; }
// }
// public virtual string DefaultUsrid
// {
// get { return Environment.UserName.ToUpper(); }
// }
// public new void AddAuthorizationRules(Csla.Security.AuthorizationRules rules)
// {
// //rules.AllowRead(Dbid, "<Role(s)>");
// }
// public new void AddValidationRules(Csla.Validation.ValidationRules rules)
// {
// rules.AddRule(
// Csla.Validation.CommonRules.StringMaxLength,
// new Csla.Validation.CommonRules.MaxLengthRuleArgs("Name", 100));
// }
// }
// }
//}
} // Class
} // Namespace

View File

@@ -0,0 +1,145 @@
// ========================================================================
// Copyright 2006 - Volian Enterprises, Inc. All rights reserved.
// Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
// ------------------------------------------------------------------------
// $Workfile: $ $Revision: $
// $Author: $ $Date: $
//
// $History: $
// ========================================================================
using System;
using System.Data;
using System.Data.SqlClient;
using Csla;
using Csla.Data;
namespace Volian.Object.Library
{
/// <summary>
/// FolderAssignments Generated by MyGeneration using the CSLA Object Mapping template
/// </summary>
[Serializable()]
public partial class FolderAssignments : BusinessListBase<FolderAssignments,FolderAssignment>
{
#region Business Methods
public FolderAssignment this[int gid, int rid]
{
get
{
foreach (FolderAssignment assignment in this)
if (assignment.Gid == gid && assignment.Rid == rid)
return assignment;
return null;
}
}
public FolderAssignment GetItem(int gid, int rid)
{
foreach (FolderAssignment assignment in this)
if (assignment.Gid == gid && assignment.Rid == rid)
return assignment;
return null;
}
public void Add(int gid, int rid)
{
if (!Contains(gid, rid))
{
FolderAssignment assignment =
FolderAssignment.New(gid, rid);
this.Add(assignment);
}
else
throw new InvalidOperationException("assignment already exists");
}
public void Remove(int gid, int rid)
{
foreach (FolderAssignment assignment in this)
{
if (assignment.Gid == gid && assignment.Rid == rid)
{
Remove(assignment);
break;
}
}
}
public bool Contains(int gid, int rid)
{
foreach (FolderAssignment assignment in this)
if (assignment.Gid == gid && assignment.Rid == rid)
return true;
return false;
}
public bool ContainsDeleted(int gid, int rid)
{
foreach (FolderAssignment assignment in DeletedList)
if (assignment.Gid == gid && assignment.Rid == rid)
return true;
return false;
}
#endregion
#region Factory Methods
internal static FolderAssignments New()
{
return new FolderAssignments();
}
internal static FolderAssignments Get(SafeDataReader dr)
{
return new FolderAssignments(dr);
}
private FolderAssignments()
{
MarkAsChild();
}
private FolderAssignments(SafeDataReader dr)
{
MarkAsChild();
Fetch(dr);
}
#endregion
#region Data Access Portal
// called to load data from the database
private void Fetch(SafeDataReader dr)
{
this.RaiseListChangedEvents = false;
while (dr.Read())
this.Add(FolderAssignment.Get(dr));
this.RaiseListChangedEvents = true;
}
internal void Update(Folder folder,SqlConnection cn)
{
this.RaiseListChangedEvents = false;
// update (thus deleting) any deleted child objects
foreach (FolderAssignment obj in DeletedList)
obj.DeleteSelf(folder,cn);
// now that they are deleted, remove them from memory too
DeletedList.Clear();
// add/update any current child objects
foreach (FolderAssignment obj in this)
{
if (obj.IsNew)
obj.Insert(folder,cn);
else
obj.Update(folder,cn);
}
this.RaiseListChangedEvents = true;
}
#endregion
} // Class
} // Namespace

View File

@@ -0,0 +1,167 @@
// ========================================================================
// Copyright 2006 - Volian Enterprises, Inc. All rights reserved.
// Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
// ------------------------------------------------------------------------
// $Workfile: $ $Revision: $
// $Author: $ $Date: $
//
// $History: $
// ========================================================================
using System;
using System.Data;
using System.Data.SqlClient;
using Csla;
using Csla.Data;
namespace Volian.Object.Library
{
/// <summary>
/// FolderInfo Generated by MyGeneration using the CSLA Object Mapping template
/// </summary>
[Serializable()]
public partial class FolderInfo : ReadOnlyBase<FolderInfo>
{
#region Business Methods
private int _folderid;
[System.ComponentModel.DataObjectField(true, true)]
public int Folderid
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _folderid;
}
}
private int _parentid;
[System.ComponentModel.DataObjectField(true, true)]
public int Parentid
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _parentid;
}
}
private int _dbid;
[System.ComponentModel.DataObjectField(true, true)]
public int Dbid
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _dbid;
}
}
private string _name=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string Name
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _name;
}
}
private string _title=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string Title
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _title;
}
}
private string _config=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string Config
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _config;
}
}
private DateTime _dts=new DateTime();
[System.ComponentModel.DataObjectField(true, true)]
public DateTime Dts
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _dts;
}
}
private string _usrid=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string Usrid
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _usrid;
}
}
// TODO: Replace base FolderInfo.ToString function as necessary
/// <summary>
/// Overrides Base ToString
/// </summary>
/// <returns>A string representation of current FolderInfo</returns>
//public override string ToString()
//{
// return base.ToString();
//}
// TODO: Check FolderInfo.GetIdValue to assure that the ID returned is unique
/// <summary>
/// Overrides Base GetIdValue - Used internally by CSLA to determine equality
/// </summary>
/// <returns>A Unique ID for the current FolderInfo</returns>
protected override object GetIdValue()
{
return _folderid;
}
#endregion
#region Factory Methods
private FolderInfo()
{ /* require use of factory methods */ }
#endregion
#region Data Access Portal
internal FolderInfo(SafeDataReader dr)
{
try
{
_folderid = dr.GetInt32("FolderID");
_parentid = dr.GetInt32("ParentID");
_dbid = dr.GetInt32("DBID");
_name = dr.GetString("Name");
_title = dr.GetString("Title");
_config = dr.GetString("Config");
_dts = dr.GetDateTime("DTS");
_usrid = dr.GetString("UsrID");
}
catch(Exception ex)
{
Database.LogException("FolderInfo",ex);
}
}
#endregion
} // Class
} // Namespace

View File

@@ -0,0 +1,78 @@
// ========================================================================
// Copyright 2006 - Volian Enterprises, Inc. All rights reserved.
// Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
// ------------------------------------------------------------------------
// $Workfile: $ $Revision: $
// $Author: $ $Date: $
//
// $History: $
// ========================================================================
using System;
using System.Data;
using System.Data.SqlClient;
using Csla;
using Csla.Data;
namespace Volian.Object.Library
{
/// <summary>
/// FolderInfoList Generated by MyGeneration using the CSLA Object Mapping template
/// </summary>
[Serializable()]
public partial class FolderInfoList : ReadOnlyListBase<FolderInfoList,FolderInfo>
{
#region Factory Methods
/// <summary>
/// Return a list of all projects.
/// </summary>
public static FolderInfoList Get()
{
return DataPortal.Fetch<FolderInfoList>(new Criteria());
}
// TODO: Add alternative gets -
//public static FolderInfoList Get(<criteria>)
//{
// return DataPortal.Fetch<FolderInfoList>(new FilteredCriteria(<criteria>));
//}
private FolderInfoList()
{ /* require use of factory methods */ }
#endregion
#region Data Access Portal
[Serializable()]
private class Criteria
{ /* no criteria - retrieve all rows */ }
private void DataPortal_Fetch(Criteria criteria)
{
this.RaiseListChangedEvents = false;
try{
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
{
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "getFolders";
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
{
IsReadOnly = false;
while (dr.Read())this.Add(new FolderInfo(dr));
IsReadOnly = true;
}
}
}
}
catch(Exception ex)
{
Database.LogException("FolderInfoList",ex);
}
this.RaiseListChangedEvents = true;
}
#endregion
} // Class
} // Namespace

View File

@@ -0,0 +1,719 @@
// ========================================================================
// Copyright 2006 - Volian Enterprises, Inc. All rights reserved.
// Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
// ------------------------------------------------------------------------
// $Workfile: $ $Revision: $
// $Author: $ $Date: $
//
// $History: $
// ========================================================================
using System;
using System.Data;
using System.Data.SqlClient;
using Csla;
using Csla.Data;
namespace Volian.Object.Library
{
/// <summary>
/// Group Generated by MyGeneration using the CSLA Object Mapping template
/// </summary>
[Serializable()]
public partial class Group : BusinessBase<Group>
{
#region Business Methods
private int _gid;
[System.ComponentModel.DataObjectField(true, true)]
public int Gid
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _gid;
}
}
private string _groupname=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string GroupName
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _groupname;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (value == null) value = string.Empty;
if (_groupname != value)
{
_groupname = value;
PropertyHasChanged();
}
}
}
private int _grouptype;
[System.ComponentModel.DataObjectField(true, true)]
public int GroupType
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _grouptype;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (_grouptype != value)
{
_grouptype = value;
PropertyHasChanged();
}
}
}
private string _config=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string Config
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _config;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (value == null) value = string.Empty;
if (_config != value)
{
_config = value;
PropertyHasChanged();
}
}
}
private DateTime _dts=new DateTime();
[System.ComponentModel.DataObjectField(true, true)]
public DateTime Dts
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _dts;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (_dts != value)
{
_dts = value;
PropertyHasChanged();
}
}
}
private string _usrid=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string Usrid
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _usrid;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (value == null) value = string.Empty;
if (_usrid != value)
{
_usrid = value;
PropertyHasChanged();
}
}
}
private byte[] _lastchanged=new byte[8];//timestamp
private GroupAssignments _groupassignments = GroupAssignments.New();
/// <summary>
/// Related Field
/// </summary>
[System.ComponentModel.DataObjectField(true, true)]
public GroupAssignments GroupAssignments
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _groupassignments;
}
}
private GroupMemberships _groupmemberships = GroupMemberships.New();
/// <summary>
/// Related Field
/// </summary>
[System.ComponentModel.DataObjectField(true, true)]
public GroupMemberships GroupMemberships
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _groupmemberships;
}
}
public override bool IsDirty
{
get { return base.IsDirty || _groupassignments.IsDirty || _groupmemberships.IsDirty ; }
}
public override bool IsValid
{
get { return base.IsValid && _groupassignments.IsValid && _groupmemberships.IsValid ; }
}
// TODO: Replace base Group.ToString function as necessary
/// <summary>
/// Overrides Base ToString
/// </summary>
/// <returns>A string representation of current Group</returns>
//public override string ToString()
//{
// return base.ToString();
//}
// TODO: Check Group.GetIdValue to assure that the ID returned is unique
/// <summary>
/// Overrides Base GetIdValue - Used internally by CSLA to determine equality
/// </summary>
/// <returns>A Unique ID for the current Group</returns>
protected override object GetIdValue()
{
return _gid;
}
#endregion
#region ValidationRules
protected override void AddBusinessRules()
{
ValidationRules.AddRule(
Csla.Validation.CommonRules.StringRequired, "GroupName");
ValidationRules.AddRule(
Csla.Validation.CommonRules.StringMaxLength,
new Csla.Validation.CommonRules.MaxLengthRuleArgs("GroupName", 50));
ValidationRules.AddRule(
Csla.Validation.CommonRules.StringMaxLength,
new Csla.Validation.CommonRules.MaxLengthRuleArgs("Config", 1073741823));
ValidationRules.AddRule(
Csla.Validation.CommonRules.StringMaxLength,
new Csla.Validation.CommonRules.MaxLengthRuleArgs("Usrid", 100));
ext.AddValidationRules(ValidationRules);
// TODO: Add other validation rules
// ValidationRules.AddRule(StartDateGTEndDate, "Started");
}
// Sample data comparison validation rule
//private bool StartDateGTEndDate(object target, Csla.Validation.RuleArgs e)
//{
// if (_started > _ended)
// {
// e.Description = "Start date can't be after end date";
// return false;
// }
// else
// return true;
//}
#endregion
#region Authorization Rules
protected override void AddAuthorizationRules()
{
//TODO: Who can read/write which fields
//AuthorizationRules.AllowRead(Gid, "<Role(s)>");
//AuthorizationRules.AllowRead(GroupName, "<Role(s)>");
//AuthorizationRules.AllowRead(GroupType, "<Role(s)>");
//AuthorizationRules.AllowRead(Config, "<Role(s)>");
//AuthorizationRules.AllowRead(Dts, "<Role(s)>");
//AuthorizationRules.AllowRead(Usrid, "<Role(s)>");
//AuthorizationRules.AllowWrite(GroupName, "<Role(s)>");
//AuthorizationRules.AllowWrite(GroupType, "<Role(s)>");
//AuthorizationRules.AllowWrite(Config, "<Role(s)>");
//AuthorizationRules.AllowWrite(Dts, "<Role(s)>");
//AuthorizationRules.AllowWrite(Usrid, "<Role(s)>");
ext.AddAuthorizationRules(AuthorizationRules);
}
public static bool CanAddObject()
{
// TODO: Can Add Authorization
//return Csla.ApplicationContext.User.IsInRole("ProjectManager");
return true;
}
public static bool CanGetObject()
{
// TODO: CanGet Authorization
return true;
}
public static bool CanDeleteObject()
{
// TODO: CanDelete Authorization
//bool result = false;
//if (Csla.ApplicationContext.User.IsInRole("ProjectManager"))result = true;
//if (Csla.ApplicationContext.User.IsInRole("Administrator"))result = true;
//return result;
return true;
}
public static bool CanEditObject()
{
// TODO: CanEdit Authorization
//return Csla.ApplicationContext.User.IsInRole("ProjectManager");
return true;
}
#endregion
#region Factory Methods
private Group()
{/* require use of factory methods */}
public static Group New()
{
if (!CanAddObject())
throw new System.Security.SecurityException("User not authorized to add a Group");
return DataPortal.Create<Group>();
}
public static Group Get(int _gid)
{
if (!CanGetObject())
throw new System.Security.SecurityException("User not authorized to view a Group");
return DataPortal.Fetch<Group>(new PKCriteria(_gid));
}
public static void Delete(int _gid)
{
if (!CanDeleteObject())
throw new System.Security.SecurityException("User not authorized to remove a Group");
DataPortal.Delete(new PKCriteria(_gid));
}
public override Group Save()
{
if (IsDeleted && !CanDeleteObject())
throw new System.Security.SecurityException("User not authorized to remove a Group");
else if (IsNew && !CanAddObject())
throw new System.Security.SecurityException("User not authorized to add a Group");
else if (!CanEditObject())
throw new System.Security.SecurityException("User not authorized to update a Group");
return base.Save();
}
#endregion
#region Data Access Portal
[Serializable()]
private class PKCriteria
{
private int _gid;
public int Gid
{ get {return _gid;}}
public PKCriteria(int gid)
{
_gid=gid;
}
}
// If Create needs to access DB - It should not be marked RunLocal
[RunLocal()]
private new void DataPortal_Create(object criteria)
{
// Database Defaults
_dts = ext.DefaultDts;
_usrid = ext.DefaultUsrid;
// TODO: Add any defaults that are necessary
ValidationRules.CheckRules();
}
private void DataPortal_Fetch(PKCriteria criteria)
{
try{
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
{
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "getGroup";
cm.Parameters.AddWithValue("@gID", criteria.Gid);
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
{
dr.Read();
_gid = dr.GetInt32("GID");
_groupname = dr.GetString("GroupName");
_grouptype = dr.GetInt32("GroupType");
_config = dr.GetString("Config");
_dts = dr.GetDateTime("DTS");
_usrid = dr.GetString("UsrID");
dr.GetBytes("LastChanged", 0, _lastchanged, 0, 8);
// load child objects
dr.NextResult();
_groupassignments = GroupAssignments.Get(dr);
// load child objects
dr.NextResult();
_groupmemberships = GroupMemberships.Get(dr);
}
}
}
}
catch(Exception ex)
{
Database.LogException("Group",ex);
}
}
[Transactional(TransactionalTypes.TransactionScope)]
protected override void DataPortal_Insert()
{
try{
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
{
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "addGroup";
// Input All Fields - Except Calculated Columns
cm.Parameters.AddWithValue("@groupName", _groupname);
cm.Parameters.AddWithValue("@groupType", _grouptype);
cm.Parameters.AddWithValue("@config", _config);
cm.Parameters.AddWithValue("@dTS", _dts);
cm.Parameters.AddWithValue("@usrID", _usrid);
// Output Calculated Columns
SqlParameter param_gid = new SqlParameter("@newGID",SqlDbType.Int);
param_gid.Direction = ParameterDirection.Output;
cm.Parameters.Add(param_gid);
SqlParameter param_lastchanged = new SqlParameter("@newLastChanged",SqlDbType.Timestamp);
param_lastchanged.Direction = ParameterDirection.Output;
cm.Parameters.Add(param_lastchanged);
// TODO: Define any additional output parameters
cm.ExecuteNonQuery();
// Save all values being returned from the Procedure
_gid = (int)cm.Parameters["@newGID"].Value;
_lastchanged = (byte[])cm.Parameters["@newLastChanged"].Value;
}
// update child objects
_groupassignments.Update(this,cn);
_groupmemberships.Update(this,cn);
}
}
catch(Exception ex)
{
Database.LogException("Group",ex);
}}
[Transactional(TransactionalTypes.TransactionScope)]
public static byte[] Add(SqlConnection cn,ref int gid, string groupname, int grouptype, string config, DateTime dts, string usrid)
{
try{
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "addGroup";
// Input All Fields - Except Calculated Columns
cm.Parameters.AddWithValue("@groupName", groupname);
cm.Parameters.AddWithValue("@groupType", grouptype);
cm.Parameters.AddWithValue("@config", config);
cm.Parameters.AddWithValue("@dTS", dts);
cm.Parameters.AddWithValue("@usrID", usrid);
// Output Calculated Columns
SqlParameter param_gid = new SqlParameter("@newGID",SqlDbType.Int);
param_gid.Direction = ParameterDirection.Output;
cm.Parameters.Add(param_gid);
SqlParameter param_lastchanged = new SqlParameter("@newLastChanged",SqlDbType.Timestamp);
param_lastchanged.Direction = ParameterDirection.Output;
cm.Parameters.Add(param_lastchanged);
// TODO: Define any additional output parameters
cm.ExecuteNonQuery();
// Save all values being returned from the Procedure
gid = (int)cm.Parameters["@newGID"].Value;
return (byte[])cm.Parameters["@newLastChanged"].Value;
}
}
catch(Exception ex)
{
Database.LogException("Group",ex);
return null;
}
}
[Transactional(TransactionalTypes.TransactionScope)]
protected override void DataPortal_Update()
{
if (IsDirty)// If this is dirty - open the connection
{
try{
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
{
if(base.IsDirty)
{
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "updateGroup";
// All Fields including Calculated Fields
cm.Parameters.AddWithValue("@gID", _gid);
cm.Parameters.AddWithValue("@groupName", _groupname);
cm.Parameters.AddWithValue("@groupType", _grouptype);
cm.Parameters.AddWithValue("@config", _config);
cm.Parameters.AddWithValue("@dTS", _dts);
cm.Parameters.AddWithValue("@usrID", _usrid);
cm.Parameters.AddWithValue("@lastChanged", _lastchanged);
// Output Calculated Columns
SqlParameter param_lastchanged = new SqlParameter("@newLastChanged",SqlDbType.Timestamp);
param_lastchanged.Direction = ParameterDirection.Output;
cm.Parameters.Add(param_lastchanged);
// TODO: Define any additional output parameters
cm.ExecuteNonQuery();
// Save all values being returned from the Procedure
_lastchanged = (byte[])cm.Parameters["@newLastChanged"].Value;
}
}
// use the open connection to update child objects
_groupassignments.Update(this,cn);
_groupmemberships.Update(this,cn);
}
}
catch(Exception ex)
{
Database.LogException("Group",ex);
}
}
}
[Transactional(TransactionalTypes.TransactionScope)]
public static byte[] Update(SqlConnection cn,ref int gid, string groupname, int grouptype, string config, DateTime dts, string usrid, ref byte[] lastchanged)
{
try{
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "updateGroup";
// Input All Fields - Except Calculated Columns
cm.Parameters.AddWithValue("@gID", gid);
cm.Parameters.AddWithValue("@groupName", groupname);
cm.Parameters.AddWithValue("@groupType", grouptype);
cm.Parameters.AddWithValue("@config", config);
cm.Parameters.AddWithValue("@dTS", dts);
cm.Parameters.AddWithValue("@usrID", usrid);
cm.Parameters.AddWithValue("@lastChanged", lastchanged);
// Output Calculated Columns
SqlParameter param_lastchanged = new SqlParameter("@newLastChanged",SqlDbType.Timestamp);
param_lastchanged.Direction = ParameterDirection.Output;
cm.Parameters.Add(param_lastchanged);
// TODO: Define any additional output parameters
cm.ExecuteNonQuery();
// Save all values being returned from the Procedure
return (byte[])cm.Parameters["@newLastChanged"].Value;
}
}
catch(Exception ex)
{
Database.LogException("Group",ex);
return null;
}
}
[Transactional(TransactionalTypes.TransactionScope)]
protected override void DataPortal_DeleteSelf()
{
DataPortal_Delete(new PKCriteria(_gid));
}
[Transactional(TransactionalTypes.TransactionScope)]
private void DataPortal_Delete(PKCriteria criteria)
{
try{
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
{
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "deleteGroup";
cm.Parameters.AddWithValue("@gID", criteria.Gid);
cm.ExecuteNonQuery();
}
}
}
catch(Exception ex)
{
Database.LogException("Group",ex);
}
}
[Transactional(TransactionalTypes.TransactionScope)]
public static void Remove(SqlConnection cn,int gid)
{
try{
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "deleteGroup";
// Input PK Fields
cm.Parameters.AddWithValue("@gID", gid);
// TODO: Define any additional output parameters
cm.ExecuteNonQuery();
}
}
catch(Exception ex)
{
Database.LogException("Group",ex);
}
}
#endregion
#region Exists
public static bool Exists(int gid)
{
ExistsCommand result;
result = DataPortal.Execute<ExistsCommand>
(new ExistsCommand(gid));
return result.Exists;
}
[Serializable()]
private class ExistsCommand : CommandBase
{
private int _gid;
private bool _exists;
public bool Exists
{
get { return _exists; }
}
public ExistsCommand(int gid)
{
_gid=gid;
}
protected override void DataPortal_Execute()
{
try{
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
{
cn.Open();
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "existsGroup";
cm.Parameters.AddWithValue("@gID", _gid);
int count = (int)cm.ExecuteScalar();
_exists = (count > 0);
}
}
}
catch(Exception ex)
{
Database.LogException("Group",ex);
}
}
}
#endregion
// Standard Default Code
// #region extension
Extension ext = new Extension();
[Serializable()]
partial class Extension : extensionBase
{
}
[Serializable()]
class extensionBase
{
// Default Values
public virtual DateTime DefaultDts
{
get { return DateTime.Now; }
}
public virtual string DefaultUsrid
{
get { return Environment.UserName.ToUpper(); }
}
// Authorization Rules
public virtual void AddAuthorizationRules(Csla.Security.AuthorizationRules rules)
{
// Needs to be overriden to add new authorization rules
}
// Validation Rules
public virtual void AddValidationRules(Csla.Validation.ValidationRules rules)
{
// Needs to be overriden to add new validation rules
}
}
//#endregion
// The follwing is a sample Extension File. You can use it to create GroupExt.cs
//using System;
//using System.Collections.Generic;
//using System.Text;
//using Csla;
//namespace PatrialClass
//{
// public partial class Group
// {
// partial class Extension : extensionBase
// {
// TODO: Override automatic defaults
// public virtual DateTime DefaultDts
// {
// get { return DateTime.Now; }
// }
// public virtual string DefaultUsrid
// {
// get { return Environment.UserName.ToUpper(); }
// }
// public new void AddAuthorizationRules(Csla.Security.AuthorizationRules rules)
// {
// //rules.AllowRead(Dbid, "<Role(s)>");
// }
// public new void AddValidationRules(Csla.Validation.ValidationRules rules)
// {
// rules.AddRule(
// Csla.Validation.CommonRules.StringMaxLength,
// new Csla.Validation.CommonRules.MaxLengthRuleArgs("Name", 100));
// }
// }
// }
//}
} // Class
} // Namespace

View File

@@ -0,0 +1,614 @@
// ========================================================================
// Copyright 2006 - Volian Enterprises, Inc. All rights reserved.
// Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
// ------------------------------------------------------------------------
// $Workfile: $ $Revision: $
// $Author: $ $Date: $
//
// $History: $
// ========================================================================
using System;
using System.Data;
using System.Data.SqlClient;
using Csla;
using Csla.Data;
namespace Volian.Object.Library
{
/// <summary>
/// GroupAssignment Generated by MyGeneration using the CSLA Object Mapping template
/// </summary>
[Serializable()]
public partial class GroupAssignment : BusinessBase<GroupAssignment>
{
#region Business Methods
private int _aid;
[System.ComponentModel.DataObjectField(true, true)]
public int Aid
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _aid;
}
}
private int _rid;
[System.ComponentModel.DataObjectField(true, true)]
public int Rid
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _rid;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (_rid != value)
{
_rid = value;
PropertyHasChanged();
}
}
}
private int _folderid;
[System.ComponentModel.DataObjectField(true, true)]
public int Folderid
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _folderid;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (_folderid != value)
{
_folderid = value;
PropertyHasChanged();
}
}
}
private string _startdate=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string StartDate
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _startdate;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (value == null) value = string.Empty;
_startdate = value;
try
{
DateTime tmp = SmartDate.StringToDate(value);
if (_startdate != tmp.ToShortDateString())
{
_startdate = tmp.ToShortDateString();
// TODO: Any Cross Property Validation
}
}
catch
{
}
PropertyHasChanged();
}
}
private string _enddate=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string EndDate
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _enddate;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (value == null) value = string.Empty;
_enddate = value;
try
{
DateTime tmp = SmartDate.StringToDate(value);
if (_enddate != tmp.ToShortDateString())
{
_enddate = tmp.ToShortDateString();
// TODO: Any Cross Property Validation
}
}
catch
{
}
PropertyHasChanged();
}
}
private DateTime _dts=new DateTime();
[System.ComponentModel.DataObjectField(true, true)]
public DateTime Dts
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _dts;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (_dts != value)
{
_dts = value;
PropertyHasChanged();
}
}
}
private string _usrid=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string Usrid
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _usrid;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (value == null) value = string.Empty;
if (_usrid != value)
{
_usrid = value;
PropertyHasChanged();
}
}
}
private byte[] _lastchanged=new byte[8];//timestamp
private int _folder_parentid;
[System.ComponentModel.DataObjectField(true, true)]
public int Folder_Parentid
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _folder_parentid;
}
}
private int _folder_dbid;
[System.ComponentModel.DataObjectField(true, true)]
public int Folder_Dbid
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _folder_dbid;
}
}
private string _folder_name=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string Folder_Name
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _folder_name;
}
}
private string _folder_title=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string Folder_Title
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _folder_title;
}
}
private string _folder_config=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string Folder_Config
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _folder_config;
}
}
private DateTime _folder_dts=new DateTime();
[System.ComponentModel.DataObjectField(true, true)]
public DateTime Folder_Dts
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _folder_dts;
}
}
private string _folder_usrid=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string Folder_Usrid
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _folder_usrid;
}
}
private string _role_name=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string Role_Name
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _role_name;
}
}
private string _role_title=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string Role_Title
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _role_title;
}
}
private DateTime _role_dts=new DateTime();
[System.ComponentModel.DataObjectField(true, true)]
public DateTime Role_Dts
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _role_dts;
}
}
private string _role_usrid=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string Role_Usrid
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _role_usrid;
}
}
// TODO: Check GroupAssignment.GetIdValue to assure that the ID returned is unique
/// <summary>
/// Overrides Base GetIdValue - Used internally by CSLA to determine equality
/// </summary>
/// <returns>A Unique ID for the current GroupAssignment</returns>
protected override object GetIdValue()
{
return _aid;
}
// TODO: Replace base GroupAssignment.ToString function as necessary
/// <summary>
/// Overrides Base ToString
/// </summary>
/// <returns>A string representation of current GroupAssignment</returns>
//public override string ToString()
//{
// return base.ToString();
//}
#endregion
#region ValidationRules
protected override void AddBusinessRules()
{
ValidationRules.AddRule(StartDateValid, "StartDate");
ValidationRules.AddRule(EndDateValid, "EndDate");
ValidationRules.AddRule(
Csla.Validation.CommonRules.StringMaxLength,
new Csla.Validation.CommonRules.MaxLengthRuleArgs("Usrid", 100));
// TODO: Add other validation rules
}
private bool StartDateValid(object target, Csla.Validation.RuleArgs e)
{
try
{
DateTime tmp = SmartDate.StringToDate(_startdate);
}
catch
{
e.Description="Invalid Date";
return false;
}
return true;
}
private bool EndDateValid(object target, Csla.Validation.RuleArgs e)
{
try
{
DateTime tmp = SmartDate.StringToDate(_enddate);
}
catch
{
e.Description="Invalid Date";
return false;
}
return true;
}
// Sample data comparison validation rule
//private bool StartDateGTEndDate(object target, Csla.Validation.RuleArgs e)
//{
// if (_started > _ended)
// {
// e.Description = "Start date can't be after end date";
// return false;
// }
// else
// return true;
//}
#endregion
#region Authorization Rules
protected override void AddAuthorizationRules()
{
//TODO: Who can read/write which fields
//AuthorizationRules.AllowRead(Aid, "<Role(s)>");
//AuthorizationRules.AllowRead(Rid, "<Role(s)>");
//AuthorizationRules.AllowWrite(Rid, "<Role(s)>");
//AuthorizationRules.AllowRead(Folderid, "<Role(s)>");
//AuthorizationRules.AllowWrite(Folderid, "<Role(s)>");
//AuthorizationRules.AllowRead(StartDate, "<Role(s)>");
//AuthorizationRules.AllowWrite(StartDate, "<Role(s)>");
//AuthorizationRules.AllowRead(EndDate, "<Role(s)>");
//AuthorizationRules.AllowWrite(EndDate, "<Role(s)>");
//AuthorizationRules.AllowRead(Dts, "<Role(s)>");
//AuthorizationRules.AllowWrite(Dts, "<Role(s)>");
//AuthorizationRules.AllowRead(Usrid, "<Role(s)>");
//AuthorizationRules.AllowWrite(Usrid, "<Role(s)>");
}
public static bool CanAddObject()
{
// TODO: Can Add Authorization
//return Csla.ApplicationContext.User.IsInRole("ProjectManager");
return true;
}
public static bool CanGetObject()
{
// TODO: CanGet Authorization
return true;
}
public static bool CanDeleteObject()
{
// TODO: CanDelete Authorization
//bool result = false;
//if (Csla.ApplicationContext.User.IsInRole("ProjectManager"))result = true;
//if (Csla.ApplicationContext.User.IsInRole("Administrator"))result = true;
//return result;
return true;
}
public static bool CanEditObject()
{
// TODO: CanEdit Authorization
//return Csla.ApplicationContext.User.IsInRole("ProjectManager");
return true;
}
#endregion
#region Factory Methods
internal static GroupAssignment New(int rid, int folderid)
{
return new GroupAssignment(Volian.Object.Library.Role.Get(rid), Volian.Object.Library.Folder.Get(folderid));
}
internal static GroupAssignment Get(SafeDataReader dr)
{
return new GroupAssignment(dr);
}
private GroupAssignment()
{
MarkAsChild();
_startdate = ext.DefaultStartDate;
_dts = ext.DefaultDts;
_usrid = ext.DefaultUsrid;
}
private GroupAssignment(Role role, Folder folder)
{
MarkAsChild();
// TODO: Add any initialization & defaults
_startdate = ext.DefaultStartDate;
_dts = ext.DefaultDts;
_usrid = ext.DefaultUsrid;
_folderid = folder.Folderid;
_folder_parentid = folder.Parentid;
_folder_dbid = folder.Dbid;
_folder_name = folder.Name;
_folder_title = folder.Title;
_folder_config = folder.Config;
_folder_dts = folder.Dts;
_folder_usrid = folder.Usrid;
_rid = role.Rid;
_role_name = role.Name;
_role_title = role.Title;
_role_dts = role.Dts;
_role_usrid = role.Usrid;
}
private GroupAssignment(SafeDataReader dr)
{
MarkAsChild();
Fetch(dr);
}
#endregion
#region Data Access Portal
private void Fetch(SafeDataReader dr)
{
try{
_aid = dr.GetInt32("AID");
_rid = dr.GetInt32("RID");
_folderid = dr.GetInt32("FolderID");
_startdate = dr.GetSmartDate("StartDate").Text;
_enddate = dr.GetSmartDate("EndDate").Text;
_dts = dr.GetDateTime("DTS");
_usrid = dr.GetString("UsrID");
dr.GetBytes("LastChanged", 0, _lastchanged, 0, 8);
_folder_parentid = dr.GetInt32("Folders_ParentID");
_folder_dbid = dr.GetInt32("Folders_DBID");
_folder_name = dr.GetString("Folders_Name");
_folder_title = dr.GetString("Folders_Title");
_folder_config = dr.GetString("Folders_Config");
_folder_dts = dr.GetDateTime("Folders_DTS");
_folder_usrid = dr.GetString("Folders_UsrID");
_role_name = dr.GetString("Roles_Name");
_role_title = dr.GetString("Roles_Title");
_role_dts = dr.GetDateTime("Roles_DTS");
_role_usrid = dr.GetString("Roles_UsrID");
}
catch(Exception ex)
{
Database.LogException("GroupAssignment",ex);
}
MarkOld();
}
internal void Insert(Group group,SqlConnection cn)
{
// if we're not dirty then don't update the database
if (!this.IsDirty) return;
_lastchanged=Assignment.Add(cn, ref _aid, group.Gid, _rid, _folderid, new SmartDate(_startdate), new SmartDate(_enddate), _dts, _usrid);
MarkOld();
}
internal void Update(Group group,SqlConnection cn)
{
// if we're not dirty then don't update the database
if (!this.IsDirty) return;
_lastchanged=Assignment.Update(cn, ref _aid, group.Gid, _rid, _folderid, new SmartDate(_startdate), new SmartDate(_enddate), _dts, _usrid, ref _lastchanged);
}
internal void DeleteSelf(Group group,SqlConnection cn)
{
// if we're not dirty then don't update the database
if (!this.IsDirty) return;
// if we're new then don't update the database
if (this.IsNew) return;
Assignment.Remove(cn,_aid);
MarkNew();
}
#endregion
// Standard Default Code
// #region extension
Extension ext = new Extension();
[Serializable()]
partial class Extension : extensionBase
{
}
[Serializable()]
class extensionBase
{
// Default Values
public virtual string DefaultStartDate
{
get { return DateTime.Now.ToShortDateString(); }
}
public virtual DateTime DefaultDts
{
get { return DateTime.Now; }
}
public virtual string DefaultUsrid
{
get { return Environment.UserName.ToUpper(); }
}
// Authorization Rules
public virtual void AddAuthorizationRules(Csla.Security.AuthorizationRules rules)
{
// Needs to be overriden to add new authorization rules
}
// Validation Rules
public virtual void AddValidationRules(Csla.Validation.ValidationRules rules)
{
// Needs to be overriden to add new validation rules
}
}
//#endregion
// The follwing is a sample Extension File. You can use it to create GroupAssignmentExt.cs
//using System;
//using System.Collections.Generic;
//using System.Text;
//using Csla;
//namespace PatrialClass
//{
// public partial class GroupAssignment
// {
// partial class Extension : extensionBase
// {
// TODO: Override automatic defaults
// public virtual SmartDate DefaultStartDate
// {
// get { return DateTime.Now.ToShortDateString(); }
// }
// public virtual DateTime DefaultDts
// {
// get { return DateTime.Now; }
// }
// public virtual string DefaultUsrid
// {
// get { return Environment.UserName.ToUpper(); }
// }
// public new void AddAuthorizationRules(Csla.Security.AuthorizationRules rules)
// {
// //rules.AllowRead(Dbid, "<Role(s)>");
// }
// public new void AddValidationRules(Csla.Validation.ValidationRules rules)
// {
// rules.AddRule(
// Csla.Validation.CommonRules.StringMaxLength,
// new Csla.Validation.CommonRules.MaxLengthRuleArgs("Name", 100));
// }
// }
// }
//}
} // Class
} // Namespace

View File

@@ -0,0 +1,145 @@
// ========================================================================
// Copyright 2006 - Volian Enterprises, Inc. All rights reserved.
// Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
// ------------------------------------------------------------------------
// $Workfile: $ $Revision: $
// $Author: $ $Date: $
//
// $History: $
// ========================================================================
using System;
using System.Data;
using System.Data.SqlClient;
using Csla;
using Csla.Data;
namespace Volian.Object.Library
{
/// <summary>
/// GroupAssignments Generated by MyGeneration using the CSLA Object Mapping template
/// </summary>
[Serializable()]
public partial class GroupAssignments : BusinessListBase<GroupAssignments,GroupAssignment>
{
#region Business Methods
public GroupAssignment this[int folderid, int rid]
{
get
{
foreach (GroupAssignment assignment in this)
if (assignment.Folderid == folderid && assignment.Rid == rid)
return assignment;
return null;
}
}
public GroupAssignment GetItem(int folderid, int rid)
{
foreach (GroupAssignment assignment in this)
if (assignment.Folderid == folderid && assignment.Rid == rid)
return assignment;
return null;
}
public void Add(int rid, int folderid)
{
if (!Contains(folderid, rid))
{
GroupAssignment assignment =
GroupAssignment.New(rid, folderid);
this.Add(assignment);
}
else
throw new InvalidOperationException("assignment already exists");
}
public void Remove(int folderid, int rid)
{
foreach (GroupAssignment assignment in this)
{
if (assignment.Folderid == folderid && assignment.Rid == rid)
{
Remove(assignment);
break;
}
}
}
public bool Contains(int folderid, int rid)
{
foreach (GroupAssignment assignment in this)
if (assignment.Folderid == folderid && assignment.Rid == rid)
return true;
return false;
}
public bool ContainsDeleted(int folderid, int rid)
{
foreach (GroupAssignment assignment in DeletedList)
if (assignment.Folderid == folderid && assignment.Rid == rid)
return true;
return false;
}
#endregion
#region Factory Methods
internal static GroupAssignments New()
{
return new GroupAssignments();
}
internal static GroupAssignments Get(SafeDataReader dr)
{
return new GroupAssignments(dr);
}
private GroupAssignments()
{
MarkAsChild();
}
private GroupAssignments(SafeDataReader dr)
{
MarkAsChild();
Fetch(dr);
}
#endregion
#region Data Access Portal
// called to load data from the database
private void Fetch(SafeDataReader dr)
{
this.RaiseListChangedEvents = false;
while (dr.Read())
this.Add(GroupAssignment.Get(dr));
this.RaiseListChangedEvents = true;
}
internal void Update(Group group,SqlConnection cn)
{
this.RaiseListChangedEvents = false;
// update (thus deleting) any deleted child objects
foreach (GroupAssignment obj in DeletedList)
obj.DeleteSelf(group,cn);
// now that they are deleted, remove them from memory too
DeletedList.Clear();
// add/update any current child objects
foreach (GroupAssignment obj in this)
{
if (obj.IsNew)
obj.Insert(group,cn);
else
obj.Update(group,cn);
}
this.RaiseListChangedEvents = true;
}
#endregion
} // Class
} // Namespace

View File

@@ -0,0 +1,143 @@
// ========================================================================
// Copyright 2006 - Volian Enterprises, Inc. All rights reserved.
// Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
// ------------------------------------------------------------------------
// $Workfile: $ $Revision: $
// $Author: $ $Date: $
//
// $History: $
// ========================================================================
using System;
using System.Data;
using System.Data.SqlClient;
using Csla;
using Csla.Data;
namespace Volian.Object.Library
{
/// <summary>
/// GroupInfo Generated by MyGeneration using the CSLA Object Mapping template
/// </summary>
[Serializable()]
public partial class GroupInfo : ReadOnlyBase<GroupInfo>
{
#region Business Methods
private int _gid;
[System.ComponentModel.DataObjectField(true, true)]
public int Gid
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _gid;
}
}
private string _groupname=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string GroupName
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _groupname;
}
}
private int _grouptype;
[System.ComponentModel.DataObjectField(true, true)]
public int GroupType
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _grouptype;
}
}
private string _config=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string Config
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _config;
}
}
private DateTime _dts=new DateTime();
[System.ComponentModel.DataObjectField(true, true)]
public DateTime Dts
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _dts;
}
}
private string _usrid=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string Usrid
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _usrid;
}
}
// TODO: Replace base GroupInfo.ToString function as necessary
/// <summary>
/// Overrides Base ToString
/// </summary>
/// <returns>A string representation of current GroupInfo</returns>
//public override string ToString()
//{
// return base.ToString();
//}
// TODO: Check GroupInfo.GetIdValue to assure that the ID returned is unique
/// <summary>
/// Overrides Base GetIdValue - Used internally by CSLA to determine equality
/// </summary>
/// <returns>A Unique ID for the current GroupInfo</returns>
protected override object GetIdValue()
{
return _gid;
}
#endregion
#region Factory Methods
private GroupInfo()
{ /* require use of factory methods */ }
#endregion
#region Data Access Portal
internal GroupInfo(SafeDataReader dr)
{
try
{
_gid = dr.GetInt32("GID");
_groupname = dr.GetString("GroupName");
_grouptype = dr.GetInt32("GroupType");
_config = dr.GetString("Config");
_dts = dr.GetDateTime("DTS");
_usrid = dr.GetString("UsrID");
}
catch(Exception ex)
{
Database.LogException("GroupInfo",ex);
}
}
#endregion
} // Class
} // Namespace

View File

@@ -0,0 +1,78 @@
// ========================================================================
// Copyright 2006 - Volian Enterprises, Inc. All rights reserved.
// Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
// ------------------------------------------------------------------------
// $Workfile: $ $Revision: $
// $Author: $ $Date: $
//
// $History: $
// ========================================================================
using System;
using System.Data;
using System.Data.SqlClient;
using Csla;
using Csla.Data;
namespace Volian.Object.Library
{
/// <summary>
/// GroupInfoList Generated by MyGeneration using the CSLA Object Mapping template
/// </summary>
[Serializable()]
public partial class GroupInfoList : ReadOnlyListBase<GroupInfoList,GroupInfo>
{
#region Factory Methods
/// <summary>
/// Return a list of all projects.
/// </summary>
public static GroupInfoList Get()
{
return DataPortal.Fetch<GroupInfoList>(new Criteria());
}
// TODO: Add alternative gets -
//public static GroupInfoList Get(<criteria>)
//{
// return DataPortal.Fetch<GroupInfoList>(new FilteredCriteria(<criteria>));
//}
private GroupInfoList()
{ /* require use of factory methods */ }
#endregion
#region Data Access Portal
[Serializable()]
private class Criteria
{ /* no criteria - retrieve all rows */ }
private void DataPortal_Fetch(Criteria criteria)
{
this.RaiseListChangedEvents = false;
try{
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
{
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "getGroups";
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
{
IsReadOnly = false;
while (dr.Read())this.Add(new GroupInfo(dr));
IsReadOnly = true;
}
}
}
}
catch(Exception ex)
{
Database.LogException("GroupInfoList",ex);
}
this.RaiseListChangedEvents = true;
}
#endregion
} // Class
} // Namespace

View File

@@ -0,0 +1,615 @@
// ========================================================================
// Copyright 2006 - Volian Enterprises, Inc. All rights reserved.
// Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
// ------------------------------------------------------------------------
// $Workfile: $ $Revision: $
// $Author: $ $Date: $
//
// $History: $
// ========================================================================
using System;
using System.Data;
using System.Data.SqlClient;
using Csla;
using Csla.Data;
namespace Volian.Object.Library
{
/// <summary>
/// GroupMembership Generated by MyGeneration using the CSLA Object Mapping template
/// </summary>
[Serializable()]
public partial class GroupMembership : BusinessBase<GroupMembership>
{
#region Business Methods
private int _ugid;
[System.ComponentModel.DataObjectField(true, true)]
public int Ugid
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _ugid;
}
}
private int _uid;
[System.ComponentModel.DataObjectField(true, true)]
public int Uid
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _uid;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (_uid != value)
{
_uid = value;
PropertyHasChanged();
}
}
}
private string _startdate=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string StartDate
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _startdate;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (value == null) value = string.Empty;
_startdate = value;
try
{
DateTime tmp = SmartDate.StringToDate(value);
if (_startdate != tmp.ToShortDateString())
{
_startdate = tmp.ToShortDateString();
// TODO: Any Cross Property Validation
}
}
catch
{
}
PropertyHasChanged();
}
}
private string _enddate=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string EndDate
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _enddate;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (value == null) value = string.Empty;
_enddate = value;
try
{
DateTime tmp = SmartDate.StringToDate(value);
if (_enddate != tmp.ToShortDateString())
{
_enddate = tmp.ToShortDateString();
// TODO: Any Cross Property Validation
}
}
catch
{
}
PropertyHasChanged();
}
}
private DateTime _dts=new DateTime();
[System.ComponentModel.DataObjectField(true, true)]
public DateTime Dts
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _dts;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (_dts != value)
{
_dts = value;
PropertyHasChanged();
}
}
}
private string _usrid=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string Usrid
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _usrid;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (value == null) value = string.Empty;
if (_usrid != value)
{
_usrid = value;
PropertyHasChanged();
}
}
}
private byte[] _lastchanged=new byte[8];//timestamp
private string _user_userid=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string User_Userid
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _user_userid;
}
}
private string _user_firstname=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string User_FirstName
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _user_firstname;
}
}
private string _user_middlename=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string User_MiddleName
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _user_middlename;
}
}
private string _user_lastname=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string User_LastName
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _user_lastname;
}
}
private string _user_suffix=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string User_Suffix
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _user_suffix;
}
}
private string _user_courtesytitle=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string User_CourtesyTitle
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _user_courtesytitle;
}
}
private string _user_phonenumber=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string User_PhoneNumber
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _user_phonenumber;
}
}
private string _user_cfgname=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string User_CfgName
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _user_cfgname;
}
}
private string _user_userlogin=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string User_UserLogin
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _user_userlogin;
}
}
private string _user_username=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string User_UserName
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _user_username;
}
}
private string _user_config=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string User_Config
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _user_config;
}
}
private DateTime _user_dts=new DateTime();
[System.ComponentModel.DataObjectField(true, true)]
public DateTime User_Dts
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _user_dts;
}
}
private string _user_usrid=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string User_Usrid
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _user_usrid;
}
}
// TODO: Check GroupMembership.GetIdValue to assure that the ID returned is unique
/// <summary>
/// Overrides Base GetIdValue - Used internally by CSLA to determine equality
/// </summary>
/// <returns>A Unique ID for the current GroupMembership</returns>
protected override object GetIdValue()
{
return _ugid;
}
// TODO: Replace base GroupMembership.ToString function as necessary
/// <summary>
/// Overrides Base ToString
/// </summary>
/// <returns>A string representation of current GroupMembership</returns>
//public override string ToString()
//{
// return base.ToString();
//}
#endregion
#region ValidationRules
protected override void AddBusinessRules()
{
ValidationRules.AddRule(StartDateValid, "StartDate");
ValidationRules.AddRule(EndDateValid, "EndDate");
ValidationRules.AddRule(
Csla.Validation.CommonRules.StringMaxLength,
new Csla.Validation.CommonRules.MaxLengthRuleArgs("Usrid", 100));
// TODO: Add other validation rules
}
private bool StartDateValid(object target, Csla.Validation.RuleArgs e)
{
try
{
DateTime tmp = SmartDate.StringToDate(_startdate);
}
catch
{
e.Description="Invalid Date";
return false;
}
return true;
}
private bool EndDateValid(object target, Csla.Validation.RuleArgs e)
{
try
{
DateTime tmp = SmartDate.StringToDate(_enddate);
}
catch
{
e.Description="Invalid Date";
return false;
}
return true;
}
// Sample data comparison validation rule
//private bool StartDateGTEndDate(object target, Csla.Validation.RuleArgs e)
//{
// if (_started > _ended)
// {
// e.Description = "Start date can't be after end date";
// return false;
// }
// else
// return true;
//}
#endregion
#region Authorization Rules
protected override void AddAuthorizationRules()
{
//TODO: Who can read/write which fields
//AuthorizationRules.AllowRead(Ugid, "<Role(s)>");
//AuthorizationRules.AllowRead(Uid, "<Role(s)>");
//AuthorizationRules.AllowWrite(Uid, "<Role(s)>");
//AuthorizationRules.AllowRead(StartDate, "<Role(s)>");
//AuthorizationRules.AllowWrite(StartDate, "<Role(s)>");
//AuthorizationRules.AllowRead(EndDate, "<Role(s)>");
//AuthorizationRules.AllowWrite(EndDate, "<Role(s)>");
//AuthorizationRules.AllowRead(Dts, "<Role(s)>");
//AuthorizationRules.AllowWrite(Dts, "<Role(s)>");
//AuthorizationRules.AllowRead(Usrid, "<Role(s)>");
//AuthorizationRules.AllowWrite(Usrid, "<Role(s)>");
}
public static bool CanAddObject()
{
// TODO: Can Add Authorization
//return Csla.ApplicationContext.User.IsInRole("ProjectManager");
return true;
}
public static bool CanGetObject()
{
// TODO: CanGet Authorization
return true;
}
public static bool CanDeleteObject()
{
// TODO: CanDelete Authorization
//bool result = false;
//if (Csla.ApplicationContext.User.IsInRole("ProjectManager"))result = true;
//if (Csla.ApplicationContext.User.IsInRole("Administrator"))result = true;
//return result;
return true;
}
public static bool CanEditObject()
{
// TODO: CanEdit Authorization
//return Csla.ApplicationContext.User.IsInRole("ProjectManager");
return true;
}
#endregion
#region Factory Methods
internal static GroupMembership New(int uid)
{
return new GroupMembership(Volian.Object.Library.User.Get(uid));
}
internal static GroupMembership Get(SafeDataReader dr)
{
return new GroupMembership(dr);
}
private GroupMembership()
{
MarkAsChild();
_startdate = ext.DefaultStartDate;
_dts = ext.DefaultDts;
_usrid = ext.DefaultUsrid;
}
private GroupMembership(User user)
{
MarkAsChild();
// TODO: Add any initialization & defaults
_startdate = ext.DefaultStartDate;
_dts = ext.DefaultDts;
_usrid = ext.DefaultUsrid;
_uid = user.Uid;
_user_userid = user.Userid;
_user_firstname = user.FirstName;
_user_middlename = user.MiddleName;
_user_lastname = user.LastName;
_user_suffix = user.Suffix;
_user_courtesytitle = user.CourtesyTitle;
_user_phonenumber = user.PhoneNumber;
_user_cfgname = user.CfgName;
_user_userlogin = user.UserLogin;
_user_username = user.UserName;
_user_config = user.Config;
_user_dts = user.Dts;
_user_usrid = user.Usrid;
}
private GroupMembership(SafeDataReader dr)
{
MarkAsChild();
Fetch(dr);
}
#endregion
#region Data Access Portal
private void Fetch(SafeDataReader dr)
{
try{
_ugid = dr.GetInt32("UGID");
_uid = dr.GetInt32("UID");
_startdate = dr.GetSmartDate("StartDate").Text;
_enddate = dr.GetSmartDate("EndDate").Text;
_dts = dr.GetDateTime("DTS");
_usrid = dr.GetString("UsrID");
dr.GetBytes("LastChanged", 0, _lastchanged, 0, 8);
_user_userid = dr.GetString("Users_UserID");
_user_firstname = dr.GetString("Users_FirstName");
_user_middlename = dr.GetString("Users_MiddleName");
_user_lastname = dr.GetString("Users_LastName");
_user_suffix = dr.GetString("Users_Suffix");
_user_courtesytitle = dr.GetString("Users_CourtesyTitle");
_user_phonenumber = dr.GetString("Users_PhoneNumber");
_user_cfgname = dr.GetString("Users_CFGName");
_user_userlogin = dr.GetString("Users_UserLogin");
_user_username = dr.GetString("Users_UserName");
_user_config = dr.GetString("Users_Config");
_user_dts = dr.GetDateTime("Users_DTS");
_user_usrid = dr.GetString("Users_UsrID");
}
catch(Exception ex)
{
Database.LogException("GroupMembership",ex);
}
MarkOld();
}
internal void Insert(Group group,SqlConnection cn)
{
// if we're not dirty then don't update the database
if (!this.IsDirty) return;
_lastchanged=Membership.Add(cn, ref _ugid, _uid, group.Gid, new SmartDate(_startdate), new SmartDate(_enddate), _dts, _usrid);
MarkOld();
}
internal void Update(Group group,SqlConnection cn)
{
// if we're not dirty then don't update the database
if (!this.IsDirty) return;
_lastchanged=Membership.Update(cn, ref _ugid, _uid, group.Gid, new SmartDate(_startdate), new SmartDate(_enddate), _dts, _usrid, ref _lastchanged);
}
internal void DeleteSelf(Group group,SqlConnection cn)
{
// if we're not dirty then don't update the database
if (!this.IsDirty) return;
// if we're new then don't update the database
if (this.IsNew) return;
Membership.Remove(cn,_ugid);
MarkNew();
}
#endregion
// Standard Default Code
// #region extension
Extension ext = new Extension();
[Serializable()]
partial class Extension : extensionBase
{
}
[Serializable()]
class extensionBase
{
// Default Values
public virtual string DefaultStartDate
{
get { return DateTime.Now.ToShortDateString(); }
}
public virtual DateTime DefaultDts
{
get { return DateTime.Now; }
}
public virtual string DefaultUsrid
{
get { return Environment.UserName.ToUpper(); }
}
// Authorization Rules
public virtual void AddAuthorizationRules(Csla.Security.AuthorizationRules rules)
{
// Needs to be overriden to add new authorization rules
}
// Validation Rules
public virtual void AddValidationRules(Csla.Validation.ValidationRules rules)
{
// Needs to be overriden to add new validation rules
}
}
//#endregion
// The follwing is a sample Extension File. You can use it to create GroupMembershipExt.cs
//using System;
//using System.Collections.Generic;
//using System.Text;
//using Csla;
//namespace PatrialClass
//{
// public partial class GroupMembership
// {
// partial class Extension : extensionBase
// {
// TODO: Override automatic defaults
// public virtual SmartDate DefaultStartDate
// {
// get { return DateTime.Now.ToShortDateString(); }
// }
// public virtual DateTime DefaultDts
// {
// get { return DateTime.Now; }
// }
// public virtual string DefaultUsrid
// {
// get { return Environment.UserName.ToUpper(); }
// }
// public new void AddAuthorizationRules(Csla.Security.AuthorizationRules rules)
// {
// //rules.AllowRead(Dbid, "<Role(s)>");
// }
// public new void AddValidationRules(Csla.Validation.ValidationRules rules)
// {
// rules.AddRule(
// Csla.Validation.CommonRules.StringMaxLength,
// new Csla.Validation.CommonRules.MaxLengthRuleArgs("Name", 100));
// }
// }
// }
//}
} // Class
} // Namespace

View File

@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Text;
using Csla;
namespace Volian.Object.Library
{
public partial class GroupMembership : BusinessBase<GroupMembership>
{
public string User_FullName
{
get { return User_LastName + ", " + User_FirstName; }
}
}
}

View File

@@ -0,0 +1,145 @@
// ========================================================================
// Copyright 2006 - Volian Enterprises, Inc. All rights reserved.
// Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
// ------------------------------------------------------------------------
// $Workfile: $ $Revision: $
// $Author: $ $Date: $
//
// $History: $
// ========================================================================
using System;
using System.Data;
using System.Data.SqlClient;
using Csla;
using Csla.Data;
namespace Volian.Object.Library
{
/// <summary>
/// GroupMemberships Generated by MyGeneration using the CSLA Object Mapping template
/// </summary>
[Serializable()]
public partial class GroupMemberships : BusinessListBase<GroupMemberships,GroupMembership>
{
#region Business Methods
public new GroupMembership this[int uid]
{
get
{
foreach (GroupMembership membership in this)
if (membership.Uid == uid)
return membership;
return null;
}
}
public GroupMembership GetItem(int uid)
{
foreach (GroupMembership membership in this)
if (membership.Uid == uid)
return membership;
return null;
}
public void Add(int uid)
{
if (!Contains(uid))
{
GroupMembership membership =
GroupMembership.New(uid);
this.Add(membership);
}
else
throw new InvalidOperationException("membership already exists");
}
public void Remove(int uid)
{
foreach (GroupMembership membership in this)
{
if (membership.Uid == uid)
{
Remove(membership);
break;
}
}
}
public bool Contains(int uid)
{
foreach (GroupMembership membership in this)
if (membership.Uid == uid)
return true;
return false;
}
public bool ContainsDeleted(int uid)
{
foreach (GroupMembership membership in DeletedList)
if (membership.Uid == uid)
return true;
return false;
}
#endregion
#region Factory Methods
internal static GroupMemberships New()
{
return new GroupMemberships();
}
internal static GroupMemberships Get(SafeDataReader dr)
{
return new GroupMemberships(dr);
}
private GroupMemberships()
{
MarkAsChild();
}
private GroupMemberships(SafeDataReader dr)
{
MarkAsChild();
Fetch(dr);
}
#endregion
#region Data Access Portal
// called to load data from the database
private void Fetch(SafeDataReader dr)
{
this.RaiseListChangedEvents = false;
while (dr.Read())
this.Add(GroupMembership.Get(dr));
this.RaiseListChangedEvents = true;
}
internal void Update(Group group,SqlConnection cn)
{
this.RaiseListChangedEvents = false;
// update (thus deleting) any deleted child objects
foreach (GroupMembership obj in DeletedList)
obj.DeleteSelf(group,cn);
// now that they are deleted, remove them from memory too
DeletedList.Clear();
// add/update any current child objects
foreach (GroupMembership obj in this)
{
if (obj.IsNew)
obj.Insert(group,cn);
else
obj.Update(group,cn);
}
this.RaiseListChangedEvents = true;
}
#endregion
} // Class
} // Namespace

View File

@@ -0,0 +1,742 @@
// ========================================================================
// Copyright 2006 - Volian Enterprises, Inc. All rights reserved.
// Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
// ------------------------------------------------------------------------
// $Workfile: $ $Revision: $
// $Author: $ $Date: $
//
// $History: $
// ========================================================================
using System;
using System.Data;
using System.Data.SqlClient;
using Csla;
using Csla.Data;
namespace Volian.Object.Library
{
/// <summary>
/// Membership Generated by MyGeneration using the CSLA Object Mapping template
/// </summary>
[Serializable()]
public partial class Membership : BusinessBase<Membership>
{
#region Business Methods
private int _ugid;
[System.ComponentModel.DataObjectField(true, true)]
public int Ugid
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _ugid;
}
}
private int _uid;
[System.ComponentModel.DataObjectField(true, true)]
public int Uid
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _uid;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (_uid != value)
{
_uid = value;
PropertyHasChanged();
}
}
}
private int _gid;
[System.ComponentModel.DataObjectField(true, true)]
public int Gid
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _gid;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (_gid != value)
{
_gid = value;
PropertyHasChanged();
}
}
}
private string _startdate=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string StartDate
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _startdate;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (value == null) value = string.Empty;
_startdate = value;
try
{
DateTime tmp = SmartDate.StringToDate(value);
if (_startdate != tmp.ToShortDateString())
{
_startdate = tmp.ToShortDateString();
// TODO: Any Cross Property Validation
}
}
catch
{
}
PropertyHasChanged();
}
}
private string _enddate=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string EndDate
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _enddate;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (value == null) value = string.Empty;
_enddate = value;
try
{
DateTime tmp = SmartDate.StringToDate(value);
if (_enddate != tmp.ToShortDateString())
{
_enddate = tmp.ToShortDateString();
// TODO: Any Cross Property Validation
}
}
catch
{
}
PropertyHasChanged();
}
}
private DateTime _dts=new DateTime();
[System.ComponentModel.DataObjectField(true, true)]
public DateTime Dts
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _dts;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (_dts != value)
{
_dts = value;
PropertyHasChanged();
}
}
}
private string _usrid=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string Usrid
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _usrid;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (value == null) value = string.Empty;
if (_usrid != value)
{
_usrid = value;
PropertyHasChanged();
}
}
}
private byte[] _lastchanged=new byte[8];//timestamp
// TODO: Replace base Membership.ToString function as necessary
/// <summary>
/// Overrides Base ToString
/// </summary>
/// <returns>A string representation of current Membership</returns>
//public override string ToString()
//{
// return base.ToString();
//}
// TODO: Check Membership.GetIdValue to assure that the ID returned is unique
/// <summary>
/// Overrides Base GetIdValue - Used internally by CSLA to determine equality
/// </summary>
/// <returns>A Unique ID for the current Membership</returns>
protected override object GetIdValue()
{
return _ugid;
}
#endregion
#region ValidationRules
protected override void AddBusinessRules()
{
ValidationRules.AddRule(StartDateValid, "StartDate");
ValidationRules.AddRule(EndDateValid, "EndDate");
ValidationRules.AddRule(
Csla.Validation.CommonRules.StringMaxLength,
new Csla.Validation.CommonRules.MaxLengthRuleArgs("Usrid", 100));
ext.AddValidationRules(ValidationRules);
// TODO: Add other validation rules
// ValidationRules.AddRule(StartDateGTEndDate, "Started");
}
private bool StartDateValid(object target, Csla.Validation.RuleArgs e)
{
try
{
DateTime tmp = SmartDate.StringToDate(_startdate);
}
catch
{
e.Description="Invalid Date";
return false;
}
return true;
}
private bool EndDateValid(object target, Csla.Validation.RuleArgs e)
{
try
{
DateTime tmp = SmartDate.StringToDate(_enddate);
}
catch
{
e.Description="Invalid Date";
return false;
}
return true;
}
// Sample data comparison validation rule
//private bool StartDateGTEndDate(object target, Csla.Validation.RuleArgs e)
//{
// if (_started > _ended)
// {
// e.Description = "Start date can't be after end date";
// return false;
// }
// else
// return true;
//}
#endregion
#region Authorization Rules
protected override void AddAuthorizationRules()
{
//TODO: Who can read/write which fields
//AuthorizationRules.AllowRead(Ugid, "<Role(s)>");
//AuthorizationRules.AllowRead(Uid, "<Role(s)>");
//AuthorizationRules.AllowRead(Gid, "<Role(s)>");
//AuthorizationRules.AllowRead(StartDate, "<Role(s)>");
//AuthorizationRules.AllowRead(EndDate, "<Role(s)>");
//AuthorizationRules.AllowRead(Dts, "<Role(s)>");
//AuthorizationRules.AllowRead(Usrid, "<Role(s)>");
//AuthorizationRules.AllowWrite(Uid, "<Role(s)>");
//AuthorizationRules.AllowWrite(Gid, "<Role(s)>");
//AuthorizationRules.AllowWrite(StartDate, "<Role(s)>");
//AuthorizationRules.AllowWrite(EndDate, "<Role(s)>");
//AuthorizationRules.AllowWrite(Dts, "<Role(s)>");
//AuthorizationRules.AllowWrite(Usrid, "<Role(s)>");
ext.AddAuthorizationRules(AuthorizationRules);
}
public static bool CanAddObject()
{
// TODO: Can Add Authorization
//return Csla.ApplicationContext.User.IsInRole("ProjectManager");
return true;
}
public static bool CanGetObject()
{
// TODO: CanGet Authorization
return true;
}
public static bool CanDeleteObject()
{
// TODO: CanDelete Authorization
//bool result = false;
//if (Csla.ApplicationContext.User.IsInRole("ProjectManager"))result = true;
//if (Csla.ApplicationContext.User.IsInRole("Administrator"))result = true;
//return result;
return true;
}
public static bool CanEditObject()
{
// TODO: CanEdit Authorization
//return Csla.ApplicationContext.User.IsInRole("ProjectManager");
return true;
}
#endregion
#region Factory Methods
private Membership()
{/* require use of factory methods */}
public static Membership New()
{
if (!CanAddObject())
throw new System.Security.SecurityException("User not authorized to add a Membership");
return DataPortal.Create<Membership>();
}
public static Membership Get(int _ugid)
{
if (!CanGetObject())
throw new System.Security.SecurityException("User not authorized to view a Membership");
return DataPortal.Fetch<Membership>(new PKCriteria(_ugid));
}
public static void Delete(int _ugid)
{
if (!CanDeleteObject())
throw new System.Security.SecurityException("User not authorized to remove a Membership");
DataPortal.Delete(new PKCriteria(_ugid));
}
public override Membership Save()
{
if (IsDeleted && !CanDeleteObject())
throw new System.Security.SecurityException("User not authorized to remove a Membership");
else if (IsNew && !CanAddObject())
throw new System.Security.SecurityException("User not authorized to add a Membership");
else if (!CanEditObject())
throw new System.Security.SecurityException("User not authorized to update a Membership");
return base.Save();
}
#endregion
#region Data Access Portal
[Serializable()]
private class PKCriteria
{
private int _ugid;
public int Ugid
{ get {return _ugid;}}
public PKCriteria(int ugid)
{
_ugid=ugid;
}
}
// If Create needs to access DB - It should not be marked RunLocal
[RunLocal()]
private new void DataPortal_Create(object criteria)
{
// Database Defaults
_startdate = ext.DefaultStartDate;
_dts = ext.DefaultDts;
_usrid = ext.DefaultUsrid;
// TODO: Add any defaults that are necessary
ValidationRules.CheckRules();
}
private void DataPortal_Fetch(PKCriteria criteria)
{
try{
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
{
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "getMembership";
cm.Parameters.AddWithValue("@uGID", criteria.Ugid);
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
{
dr.Read();
_ugid = dr.GetInt32("UGID");
_uid = dr.GetInt32("UID");
_gid = dr.GetInt32("GID");
_startdate = dr.GetSmartDate("StartDate").Text;
_enddate = dr.GetSmartDate("EndDate").Text;
_dts = dr.GetDateTime("DTS");
_usrid = dr.GetString("UsrID");
dr.GetBytes("LastChanged", 0, _lastchanged, 0, 8);
}
}
}
}
catch(Exception ex)
{
Database.LogException("Membership",ex);
}
}
[Transactional(TransactionalTypes.TransactionScope)]
protected override void DataPortal_Insert()
{
try{
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
{
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "addMembership";
// Input All Fields - Except Calculated Columns
cm.Parameters.AddWithValue("@uID", _uid);
cm.Parameters.AddWithValue("@gID", _gid);
cm.Parameters.AddWithValue("@startDate", new SmartDate(_startdate).DBValue);
cm.Parameters.AddWithValue("@endDate", new SmartDate(_enddate).DBValue);
cm.Parameters.AddWithValue("@dTS", _dts);
cm.Parameters.AddWithValue("@usrID", _usrid);
// Output Calculated Columns
SqlParameter param_ugid = new SqlParameter("@newUGID",SqlDbType.Int);
param_ugid.Direction = ParameterDirection.Output;
cm.Parameters.Add(param_ugid);
SqlParameter param_lastchanged = new SqlParameter("@newLastChanged",SqlDbType.Timestamp);
param_lastchanged.Direction = ParameterDirection.Output;
cm.Parameters.Add(param_lastchanged);
// TODO: Define any additional output parameters
cm.ExecuteNonQuery();
// Save all values being returned from the Procedure
_ugid = (int)cm.Parameters["@newUGID"].Value;
_lastchanged = (byte[])cm.Parameters["@newLastChanged"].Value;
}
// update child objects
}
}
catch(Exception ex)
{
Database.LogException("Membership",ex);
}}
[Transactional(TransactionalTypes.TransactionScope)]
public static byte[] Add(SqlConnection cn,ref int ugid, int uid, int gid, SmartDate startdate, SmartDate enddate, DateTime dts, string usrid)
{
try{
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "addMembership";
// Input All Fields - Except Calculated Columns
cm.Parameters.AddWithValue("@uID", uid);
cm.Parameters.AddWithValue("@gID", gid);
cm.Parameters.AddWithValue("@startDate", startdate.DBValue);
cm.Parameters.AddWithValue("@endDate", enddate.DBValue);
cm.Parameters.AddWithValue("@dTS", dts);
cm.Parameters.AddWithValue("@usrID", usrid);
// Output Calculated Columns
SqlParameter param_ugid = new SqlParameter("@newUGID",SqlDbType.Int);
param_ugid.Direction = ParameterDirection.Output;
cm.Parameters.Add(param_ugid);
SqlParameter param_lastchanged = new SqlParameter("@newLastChanged",SqlDbType.Timestamp);
param_lastchanged.Direction = ParameterDirection.Output;
cm.Parameters.Add(param_lastchanged);
// TODO: Define any additional output parameters
cm.ExecuteNonQuery();
// Save all values being returned from the Procedure
ugid = (int)cm.Parameters["@newUGID"].Value;
return (byte[])cm.Parameters["@newLastChanged"].Value;
}
}
catch(Exception ex)
{
Database.LogException("Membership",ex);
return null;
}
}
[Transactional(TransactionalTypes.TransactionScope)]
protected override void DataPortal_Update()
{
if (IsDirty)// If this is dirty - open the connection
{
try{
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
{
if(base.IsDirty)
{
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "updateMembership";
// All Fields including Calculated Fields
cm.Parameters.AddWithValue("@uGID", _ugid);
cm.Parameters.AddWithValue("@uID", _uid);
cm.Parameters.AddWithValue("@gID", _gid);
cm.Parameters.AddWithValue("@startDate", new SmartDate(_startdate).DBValue);
cm.Parameters.AddWithValue("@endDate", new SmartDate(_enddate).DBValue);
cm.Parameters.AddWithValue("@dTS", _dts);
cm.Parameters.AddWithValue("@usrID", _usrid);
cm.Parameters.AddWithValue("@lastChanged", _lastchanged);
// Output Calculated Columns
SqlParameter param_lastchanged = new SqlParameter("@newLastChanged",SqlDbType.Timestamp);
param_lastchanged.Direction = ParameterDirection.Output;
cm.Parameters.Add(param_lastchanged);
// TODO: Define any additional output parameters
cm.ExecuteNonQuery();
// Save all values being returned from the Procedure
_lastchanged = (byte[])cm.Parameters["@newLastChanged"].Value;
}
}
// use the open connection to update child objects
}
}
catch(Exception ex)
{
Database.LogException("Membership",ex);
}
}
}
[Transactional(TransactionalTypes.TransactionScope)]
public static byte[] Update(SqlConnection cn,ref int ugid, int uid, int gid, SmartDate startdate, SmartDate enddate, DateTime dts, string usrid, ref byte[] lastchanged)
{
try{
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "updateMembership";
// Input All Fields - Except Calculated Columns
cm.Parameters.AddWithValue("@uGID", ugid);
cm.Parameters.AddWithValue("@uID", uid);
cm.Parameters.AddWithValue("@gID", gid);
cm.Parameters.AddWithValue("@startDate", startdate.DBValue);
cm.Parameters.AddWithValue("@endDate", enddate.DBValue);
cm.Parameters.AddWithValue("@dTS", dts);
cm.Parameters.AddWithValue("@usrID", usrid);
cm.Parameters.AddWithValue("@lastChanged", lastchanged);
// Output Calculated Columns
SqlParameter param_lastchanged = new SqlParameter("@newLastChanged",SqlDbType.Timestamp);
param_lastchanged.Direction = ParameterDirection.Output;
cm.Parameters.Add(param_lastchanged);
// TODO: Define any additional output parameters
cm.ExecuteNonQuery();
// Save all values being returned from the Procedure
return (byte[])cm.Parameters["@newLastChanged"].Value;
}
}
catch(Exception ex)
{
Database.LogException("Membership",ex);
return null;
}
}
[Transactional(TransactionalTypes.TransactionScope)]
protected override void DataPortal_DeleteSelf()
{
DataPortal_Delete(new PKCriteria(_ugid));
}
[Transactional(TransactionalTypes.TransactionScope)]
private void DataPortal_Delete(PKCriteria criteria)
{
try{
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
{
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "deleteMembership";
cm.Parameters.AddWithValue("@uGID", criteria.Ugid);
cm.ExecuteNonQuery();
}
}
}
catch(Exception ex)
{
Database.LogException("Membership",ex);
}
}
[Transactional(TransactionalTypes.TransactionScope)]
public static void Remove(SqlConnection cn,int ugid)
{
try{
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "deleteMembership";
// Input PK Fields
cm.Parameters.AddWithValue("@uGID", ugid);
// TODO: Define any additional output parameters
cm.ExecuteNonQuery();
}
}
catch(Exception ex)
{
Database.LogException("Membership",ex);
}
}
#endregion
#region Exists
public static bool Exists(int ugid)
{
ExistsCommand result;
result = DataPortal.Execute<ExistsCommand>
(new ExistsCommand(ugid));
return result.Exists;
}
[Serializable()]
private class ExistsCommand : CommandBase
{
private int _ugid;
private bool _exists;
public bool Exists
{
get { return _exists; }
}
public ExistsCommand(int ugid)
{
_ugid=ugid;
}
protected override void DataPortal_Execute()
{
try{
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
{
cn.Open();
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "existsMembership";
cm.Parameters.AddWithValue("@uGID", _ugid);
int count = (int)cm.ExecuteScalar();
_exists = (count > 0);
}
}
}
catch(Exception ex)
{
Database.LogException("Membership",ex);
}
}
}
#endregion
// Standard Default Code
// #region extension
Extension ext = new Extension();
[Serializable()]
partial class Extension : extensionBase
{
}
[Serializable()]
class extensionBase
{
// Default Values
public virtual string DefaultStartDate
{
get { return DateTime.Now.ToShortDateString(); }
}
public virtual DateTime DefaultDts
{
get { return DateTime.Now; }
}
public virtual string DefaultUsrid
{
get { return Environment.UserName.ToUpper(); }
}
// Authorization Rules
public virtual void AddAuthorizationRules(Csla.Security.AuthorizationRules rules)
{
// Needs to be overriden to add new authorization rules
}
// Validation Rules
public virtual void AddValidationRules(Csla.Validation.ValidationRules rules)
{
// Needs to be overriden to add new validation rules
}
}
//#endregion
// The follwing is a sample Extension File. You can use it to create MembershipExt.cs
//using System;
//using System.Collections.Generic;
//using System.Text;
//using Csla;
//namespace PatrialClass
//{
// public partial class Membership
// {
// partial class Extension : extensionBase
// {
// TODO: Override automatic defaults
// public virtual SmartDate DefaultStartDate
// {
// get { return DateTime.Now.ToShortDateString(); }
// }
// public virtual DateTime DefaultDts
// {
// get { return DateTime.Now; }
// }
// public virtual string DefaultUsrid
// {
// get { return Environment.UserName.ToUpper(); }
// }
// public new void AddAuthorizationRules(Csla.Security.AuthorizationRules rules)
// {
// //rules.AllowRead(Dbid, "<Role(s)>");
// }
// public new void AddValidationRules(Csla.Validation.ValidationRules rules)
// {
// rules.AddRule(
// Csla.Validation.CommonRules.StringMaxLength,
// new Csla.Validation.CommonRules.MaxLengthRuleArgs("Name", 100));
// }
// }
// }
//}
} // Class
} // Namespace

View File

@@ -0,0 +1,155 @@
// ========================================================================
// Copyright 2006 - Volian Enterprises, Inc. All rights reserved.
// Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
// ------------------------------------------------------------------------
// $Workfile: $ $Revision: $
// $Author: $ $Date: $
//
// $History: $
// ========================================================================
using System;
using System.Data;
using System.Data.SqlClient;
using Csla;
using Csla.Data;
namespace Volian.Object.Library
{
/// <summary>
/// MembershipInfo Generated by MyGeneration using the CSLA Object Mapping template
/// </summary>
[Serializable()]
public partial class MembershipInfo : ReadOnlyBase<MembershipInfo>
{
#region Business Methods
private int _ugid;
[System.ComponentModel.DataObjectField(true, true)]
public int Ugid
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _ugid;
}
}
private int _uid;
[System.ComponentModel.DataObjectField(true, true)]
public int Uid
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _uid;
}
}
private int _gid;
[System.ComponentModel.DataObjectField(true, true)]
public int Gid
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _gid;
}
}
private string _startdate=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string StartDate
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _startdate;
}
}
private string _enddate=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string EndDate
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _enddate;
}
}
private DateTime _dts=new DateTime();
[System.ComponentModel.DataObjectField(true, true)]
public DateTime Dts
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _dts;
}
}
private string _usrid=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string Usrid
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _usrid;
}
}
// TODO: Replace base MembershipInfo.ToString function as necessary
/// <summary>
/// Overrides Base ToString
/// </summary>
/// <returns>A string representation of current MembershipInfo</returns>
//public override string ToString()
//{
// return base.ToString();
//}
// TODO: Check MembershipInfo.GetIdValue to assure that the ID returned is unique
/// <summary>
/// Overrides Base GetIdValue - Used internally by CSLA to determine equality
/// </summary>
/// <returns>A Unique ID for the current MembershipInfo</returns>
protected override object GetIdValue()
{
return _ugid;
}
#endregion
#region Factory Methods
private MembershipInfo()
{ /* require use of factory methods */ }
#endregion
#region Data Access Portal
internal MembershipInfo(SafeDataReader dr)
{
try
{
_ugid = dr.GetInt32("UGID");
_uid = dr.GetInt32("UID");
_gid = dr.GetInt32("GID");
_startdate = dr.GetSmartDate("StartDate").Text;
_enddate = dr.GetSmartDate("EndDate").Text;
_dts = dr.GetDateTime("DTS");
_usrid = dr.GetString("UsrID");
}
catch(Exception ex)
{
Database.LogException("MembershipInfo",ex);
}
}
#endregion
} // Class
} // Namespace

View File

@@ -0,0 +1,78 @@
// ========================================================================
// Copyright 2006 - Volian Enterprises, Inc. All rights reserved.
// Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
// ------------------------------------------------------------------------
// $Workfile: $ $Revision: $
// $Author: $ $Date: $
//
// $History: $
// ========================================================================
using System;
using System.Data;
using System.Data.SqlClient;
using Csla;
using Csla.Data;
namespace Volian.Object.Library
{
/// <summary>
/// MembershipInfoList Generated by MyGeneration using the CSLA Object Mapping template
/// </summary>
[Serializable()]
public partial class MembershipInfoList : ReadOnlyListBase<MembershipInfoList,MembershipInfo>
{
#region Factory Methods
/// <summary>
/// Return a list of all projects.
/// </summary>
public static MembershipInfoList Get()
{
return DataPortal.Fetch<MembershipInfoList>(new Criteria());
}
// TODO: Add alternative gets -
//public static MembershipInfoList Get(<criteria>)
//{
// return DataPortal.Fetch<MembershipInfoList>(new FilteredCriteria(<criteria>));
//}
private MembershipInfoList()
{ /* require use of factory methods */ }
#endregion
#region Data Access Portal
[Serializable()]
private class Criteria
{ /* no criteria - retrieve all rows */ }
private void DataPortal_Fetch(Criteria criteria)
{
this.RaiseListChangedEvents = false;
try{
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
{
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "getMemberships";
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
{
IsReadOnly = false;
while (dr.Read())this.Add(new MembershipInfo(dr));
IsReadOnly = true;
}
}
}
}
catch(Exception ex)
{
Database.LogException("MembershipInfoList",ex);
}
this.RaiseListChangedEvents = true;
}
#endregion
} // Class
} // Namespace

View File

@@ -0,0 +1,847 @@
// ========================================================================
// Copyright 2006 - Volian Enterprises, Inc. All rights reserved.
// Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
// ------------------------------------------------------------------------
// $Workfile: $ $Revision: $
// $Author: $ $Date: $
//
// $History: $
// ========================================================================
using System;
using System.Data;
using System.Data.SqlClient;
using Csla;
using Csla.Data;
namespace Volian.Object.Library
{
/// <summary>
/// Permission Generated by MyGeneration using the CSLA Object Mapping template
/// </summary>
[Serializable()]
public partial class Permission : BusinessBase<Permission>
{
#region Business Methods
private int _pid;
[System.ComponentModel.DataObjectField(true, true)]
public int Pid
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _pid;
}
}
private int _rid;
[System.ComponentModel.DataObjectField(true, true)]
public int Rid
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _rid;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (_rid != value)
{
_rid = value;
PropertyHasChanged();
}
}
}
private int _permlevel;
/// <summary>
/// 0 - Security, 1 - System, 2 - RO, 3 - Procdures, 4 - Sections, 5 - Steps, 6 - Comments
/// </summary>
[System.ComponentModel.DataObjectField(true, true)]
public int PermLevel
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _permlevel;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (_permlevel != value)
{
_permlevel = value;
PropertyHasChanged();
}
}
}
private int _versiontype;
/// <summary>
/// 0 - Working Draft, 1 - Temporary Change, 2 Approved
/// </summary>
[System.ComponentModel.DataObjectField(true, true)]
public int VersionType
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _versiontype;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (_versiontype != value)
{
_versiontype = value;
PropertyHasChanged();
}
}
}
private int _permvalue;
/// <summary>
/// 1 - Read, 2 - Write, 4 - Create, 8 - Delete (15 - All)
/// </summary>
[System.ComponentModel.DataObjectField(true, true)]
public int PermValue
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _permvalue;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (_permvalue != value)
{
_permvalue = value;
PropertyHasChanged();
}
}
}
private int _permad;
/// <summary>
/// 0 - Allow, 1 - Deny
/// </summary>
[System.ComponentModel.DataObjectField(true, true)]
public int Permad
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _permad;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (_permad != value)
{
_permad = value;
PropertyHasChanged();
}
}
}
private string _startdate=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string StartDate
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _startdate;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (value == null) value = string.Empty;
_startdate = value;
try
{
DateTime tmp = SmartDate.StringToDate(value);
if (_startdate != tmp.ToShortDateString())
{
_startdate = tmp.ToShortDateString();
// TODO: Any Cross Property Validation
}
}
catch
{
}
PropertyHasChanged();
}
}
private string _enddate=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string EndDate
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _enddate;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (value == null) value = string.Empty;
_enddate = value;
try
{
DateTime tmp = SmartDate.StringToDate(value);
if (_enddate != tmp.ToShortDateString())
{
_enddate = tmp.ToShortDateString();
// TODO: Any Cross Property Validation
}
}
catch
{
}
PropertyHasChanged();
}
}
private DateTime _dts=new DateTime();
[System.ComponentModel.DataObjectField(true, true)]
public DateTime Dts
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _dts;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (_dts != value)
{
_dts = value;
PropertyHasChanged();
}
}
}
private string _usrid=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string Usrid
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _usrid;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (value == null) value = string.Empty;
if (_usrid != value)
{
_usrid = value;
PropertyHasChanged();
}
}
}
private byte[] _lastchanged=new byte[8];//timestamp
// TODO: Replace base Permission.ToString function as necessary
/// <summary>
/// Overrides Base ToString
/// </summary>
/// <returns>A string representation of current Permission</returns>
//public override string ToString()
//{
// return base.ToString();
//}
// TODO: Check Permission.GetIdValue to assure that the ID returned is unique
/// <summary>
/// Overrides Base GetIdValue - Used internally by CSLA to determine equality
/// </summary>
/// <returns>A Unique ID for the current Permission</returns>
protected override object GetIdValue()
{
return _pid;
}
#endregion
#region ValidationRules
protected override void AddBusinessRules()
{
ValidationRules.AddRule(StartDateValid, "StartDate");
ValidationRules.AddRule(EndDateValid, "EndDate");
ValidationRules.AddRule(
Csla.Validation.CommonRules.StringMaxLength,
new Csla.Validation.CommonRules.MaxLengthRuleArgs("Usrid", 100));
ext.AddValidationRules(ValidationRules);
// TODO: Add other validation rules
// ValidationRules.AddRule(StartDateGTEndDate, "Started");
}
private bool StartDateValid(object target, Csla.Validation.RuleArgs e)
{
try
{
DateTime tmp = SmartDate.StringToDate(_startdate);
}
catch
{
e.Description="Invalid Date";
return false;
}
return true;
}
private bool EndDateValid(object target, Csla.Validation.RuleArgs e)
{
try
{
DateTime tmp = SmartDate.StringToDate(_enddate);
}
catch
{
e.Description="Invalid Date";
return false;
}
return true;
}
// Sample data comparison validation rule
//private bool StartDateGTEndDate(object target, Csla.Validation.RuleArgs e)
//{
// if (_started > _ended)
// {
// e.Description = "Start date can't be after end date";
// return false;
// }
// else
// return true;
//}
#endregion
#region Authorization Rules
protected override void AddAuthorizationRules()
{
//TODO: Who can read/write which fields
//AuthorizationRules.AllowRead(Pid, "<Role(s)>");
//AuthorizationRules.AllowRead(Rid, "<Role(s)>");
//AuthorizationRules.AllowRead(PermLevel, "<Role(s)>");
//AuthorizationRules.AllowRead(VersionType, "<Role(s)>");
//AuthorizationRules.AllowRead(PermValue, "<Role(s)>");
//AuthorizationRules.AllowRead(Permad, "<Role(s)>");
//AuthorizationRules.AllowRead(StartDate, "<Role(s)>");
//AuthorizationRules.AllowRead(EndDate, "<Role(s)>");
//AuthorizationRules.AllowRead(Dts, "<Role(s)>");
//AuthorizationRules.AllowRead(Usrid, "<Role(s)>");
//AuthorizationRules.AllowWrite(Rid, "<Role(s)>");
//AuthorizationRules.AllowWrite(PermLevel, "<Role(s)>");
//AuthorizationRules.AllowWrite(VersionType, "<Role(s)>");
//AuthorizationRules.AllowWrite(PermValue, "<Role(s)>");
//AuthorizationRules.AllowWrite(Permad, "<Role(s)>");
//AuthorizationRules.AllowWrite(StartDate, "<Role(s)>");
//AuthorizationRules.AllowWrite(EndDate, "<Role(s)>");
//AuthorizationRules.AllowWrite(Dts, "<Role(s)>");
//AuthorizationRules.AllowWrite(Usrid, "<Role(s)>");
ext.AddAuthorizationRules(AuthorizationRules);
}
public static bool CanAddObject()
{
// TODO: Can Add Authorization
//return Csla.ApplicationContext.User.IsInRole("ProjectManager");
return true;
}
public static bool CanGetObject()
{
// TODO: CanGet Authorization
return true;
}
public static bool CanDeleteObject()
{
// TODO: CanDelete Authorization
//bool result = false;
//if (Csla.ApplicationContext.User.IsInRole("ProjectManager"))result = true;
//if (Csla.ApplicationContext.User.IsInRole("Administrator"))result = true;
//return result;
return true;
}
public static bool CanEditObject()
{
// TODO: CanEdit Authorization
//return Csla.ApplicationContext.User.IsInRole("ProjectManager");
return true;
}
#endregion
#region Factory Methods
private Permission()
{/* require use of factory methods */}
public static Permission New()
{
if (!CanAddObject())
throw new System.Security.SecurityException("User not authorized to add a Permission");
return DataPortal.Create<Permission>();
}
public static Permission Get(int _pid)
{
if (!CanGetObject())
throw new System.Security.SecurityException("User not authorized to view a Permission");
return DataPortal.Fetch<Permission>(new PKCriteria(_pid));
}
public static void Delete(int _pid)
{
if (!CanDeleteObject())
throw new System.Security.SecurityException("User not authorized to remove a Permission");
DataPortal.Delete(new PKCriteria(_pid));
}
public override Permission Save()
{
if (IsDeleted && !CanDeleteObject())
throw new System.Security.SecurityException("User not authorized to remove a Permission");
else if (IsNew && !CanAddObject())
throw new System.Security.SecurityException("User not authorized to add a Permission");
else if (!CanEditObject())
throw new System.Security.SecurityException("User not authorized to update a Permission");
return base.Save();
}
#endregion
#region Data Access Portal
[Serializable()]
private class PKCriteria
{
private int _pid;
public int Pid
{ get {return _pid;}}
public PKCriteria(int pid)
{
_pid=pid;
}
}
// If Create needs to access DB - It should not be marked RunLocal
[RunLocal()]
private new void DataPortal_Create(object criteria)
{
// Database Defaults
_permad = ext.DefaultPermad;
_startdate = ext.DefaultStartDate;
_dts = ext.DefaultDts;
_usrid = ext.DefaultUsrid;
// TODO: Add any defaults that are necessary
ValidationRules.CheckRules();
}
private void DataPortal_Fetch(PKCriteria criteria)
{
try{
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
{
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "getPermission";
cm.Parameters.AddWithValue("@pID", criteria.Pid);
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
{
dr.Read();
_pid = dr.GetInt32("PID");
_rid = dr.GetInt32("RID");
_permlevel = dr.GetInt32("PermLevel");
_versiontype = dr.GetInt32("VersionType");
_permvalue = dr.GetInt32("PermValue");
_permad = dr.GetInt32("PermAD");
_startdate = dr.GetSmartDate("StartDate").Text;
_enddate = dr.GetSmartDate("EndDate").Text;
_dts = dr.GetDateTime("DTS");
_usrid = dr.GetString("UsrID");
dr.GetBytes("LastChanged", 0, _lastchanged, 0, 8);
}
}
}
}
catch(Exception ex)
{
Database.LogException("Permission",ex);
}
}
[Transactional(TransactionalTypes.TransactionScope)]
protected override void DataPortal_Insert()
{
try{
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
{
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "addPermission";
// Input All Fields - Except Calculated Columns
cm.Parameters.AddWithValue("@rID", _rid);
cm.Parameters.AddWithValue("@permLevel", _permlevel);
cm.Parameters.AddWithValue("@versionType", _versiontype);
cm.Parameters.AddWithValue("@permValue", _permvalue);
cm.Parameters.AddWithValue("@permAD", _permad);
cm.Parameters.AddWithValue("@startDate", new SmartDate(_startdate).DBValue);
cm.Parameters.AddWithValue("@endDate", new SmartDate(_enddate).DBValue);
cm.Parameters.AddWithValue("@dTS", _dts);
cm.Parameters.AddWithValue("@usrID", _usrid);
// Output Calculated Columns
SqlParameter param_pid = new SqlParameter("@newPID",SqlDbType.Int);
param_pid.Direction = ParameterDirection.Output;
cm.Parameters.Add(param_pid);
SqlParameter param_lastchanged = new SqlParameter("@newLastChanged",SqlDbType.Timestamp);
param_lastchanged.Direction = ParameterDirection.Output;
cm.Parameters.Add(param_lastchanged);
// TODO: Define any additional output parameters
cm.ExecuteNonQuery();
// Save all values being returned from the Procedure
_pid = (int)cm.Parameters["@newPID"].Value;
_lastchanged = (byte[])cm.Parameters["@newLastChanged"].Value;
}
// update child objects
}
}
catch(Exception ex)
{
Database.LogException("Permission",ex);
}}
[Transactional(TransactionalTypes.TransactionScope)]
public static byte[] Add(SqlConnection cn,ref int pid, int rid, int permlevel, int versiontype, int permvalue, int permad, SmartDate startdate, SmartDate enddate, DateTime dts, string usrid)
{
try{
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "addPermission";
// Input All Fields - Except Calculated Columns
cm.Parameters.AddWithValue("@rID", rid);
cm.Parameters.AddWithValue("@permLevel", permlevel);
cm.Parameters.AddWithValue("@versionType", versiontype);
cm.Parameters.AddWithValue("@permValue", permvalue);
cm.Parameters.AddWithValue("@permAD", permad);
cm.Parameters.AddWithValue("@startDate", startdate.DBValue);
cm.Parameters.AddWithValue("@endDate", enddate.DBValue);
cm.Parameters.AddWithValue("@dTS", dts);
cm.Parameters.AddWithValue("@usrID", usrid);
// Output Calculated Columns
SqlParameter param_pid = new SqlParameter("@newPID",SqlDbType.Int);
param_pid.Direction = ParameterDirection.Output;
cm.Parameters.Add(param_pid);
SqlParameter param_lastchanged = new SqlParameter("@newLastChanged",SqlDbType.Timestamp);
param_lastchanged.Direction = ParameterDirection.Output;
cm.Parameters.Add(param_lastchanged);
// TODO: Define any additional output parameters
cm.ExecuteNonQuery();
// Save all values being returned from the Procedure
pid = (int)cm.Parameters["@newPID"].Value;
return (byte[])cm.Parameters["@newLastChanged"].Value;
}
}
catch(Exception ex)
{
Database.LogException("Permission",ex);
return null;
}
}
[Transactional(TransactionalTypes.TransactionScope)]
protected override void DataPortal_Update()
{
if (IsDirty)// If this is dirty - open the connection
{
try{
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
{
if(base.IsDirty)
{
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "updatePermission";
// All Fields including Calculated Fields
cm.Parameters.AddWithValue("@pID", _pid);
cm.Parameters.AddWithValue("@rID", _rid);
cm.Parameters.AddWithValue("@permLevel", _permlevel);
cm.Parameters.AddWithValue("@versionType", _versiontype);
cm.Parameters.AddWithValue("@permValue", _permvalue);
cm.Parameters.AddWithValue("@permAD", _permad);
cm.Parameters.AddWithValue("@startDate", new SmartDate(_startdate).DBValue);
cm.Parameters.AddWithValue("@endDate", new SmartDate(_enddate).DBValue);
cm.Parameters.AddWithValue("@dTS", _dts);
cm.Parameters.AddWithValue("@usrID", _usrid);
cm.Parameters.AddWithValue("@lastChanged", _lastchanged);
// Output Calculated Columns
SqlParameter param_lastchanged = new SqlParameter("@newLastChanged",SqlDbType.Timestamp);
param_lastchanged.Direction = ParameterDirection.Output;
cm.Parameters.Add(param_lastchanged);
// TODO: Define any additional output parameters
cm.ExecuteNonQuery();
// Save all values being returned from the Procedure
_lastchanged = (byte[])cm.Parameters["@newLastChanged"].Value;
}
}
// use the open connection to update child objects
}
}
catch(Exception ex)
{
Database.LogException("Permission",ex);
}
}
}
[Transactional(TransactionalTypes.TransactionScope)]
public static byte[] Update(SqlConnection cn,ref int pid, int rid, int permlevel, int versiontype, int permvalue, int permad, SmartDate startdate, SmartDate enddate, DateTime dts, string usrid, ref byte[] lastchanged)
{
try{
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "updatePermission";
// Input All Fields - Except Calculated Columns
cm.Parameters.AddWithValue("@pID", pid);
cm.Parameters.AddWithValue("@rID", rid);
cm.Parameters.AddWithValue("@permLevel", permlevel);
cm.Parameters.AddWithValue("@versionType", versiontype);
cm.Parameters.AddWithValue("@permValue", permvalue);
cm.Parameters.AddWithValue("@permAD", permad);
cm.Parameters.AddWithValue("@startDate", startdate.DBValue);
cm.Parameters.AddWithValue("@endDate", enddate.DBValue);
cm.Parameters.AddWithValue("@dTS", dts);
cm.Parameters.AddWithValue("@usrID", usrid);
cm.Parameters.AddWithValue("@lastChanged", lastchanged);
// Output Calculated Columns
SqlParameter param_lastchanged = new SqlParameter("@newLastChanged",SqlDbType.Timestamp);
param_lastchanged.Direction = ParameterDirection.Output;
cm.Parameters.Add(param_lastchanged);
// TODO: Define any additional output parameters
cm.ExecuteNonQuery();
// Save all values being returned from the Procedure
return (byte[])cm.Parameters["@newLastChanged"].Value;
}
}
catch(Exception ex)
{
Database.LogException("Permission",ex);
return null;
}
}
[Transactional(TransactionalTypes.TransactionScope)]
protected override void DataPortal_DeleteSelf()
{
DataPortal_Delete(new PKCriteria(_pid));
}
[Transactional(TransactionalTypes.TransactionScope)]
private void DataPortal_Delete(PKCriteria criteria)
{
try{
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
{
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "deletePermission";
cm.Parameters.AddWithValue("@pID", criteria.Pid);
cm.ExecuteNonQuery();
}
}
}
catch(Exception ex)
{
Database.LogException("Permission",ex);
}
}
[Transactional(TransactionalTypes.TransactionScope)]
public static void Remove(SqlConnection cn,int pid)
{
try{
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "deletePermission";
// Input PK Fields
cm.Parameters.AddWithValue("@pID", pid);
// TODO: Define any additional output parameters
cm.ExecuteNonQuery();
}
}
catch(Exception ex)
{
Database.LogException("Permission",ex);
}
}
#endregion
#region Exists
public static bool Exists(int pid)
{
ExistsCommand result;
result = DataPortal.Execute<ExistsCommand>
(new ExistsCommand(pid));
return result.Exists;
}
[Serializable()]
private class ExistsCommand : CommandBase
{
private int _pid;
private bool _exists;
public bool Exists
{
get { return _exists; }
}
public ExistsCommand(int pid)
{
_pid=pid;
}
protected override void DataPortal_Execute()
{
try{
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
{
cn.Open();
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "existsPermission";
cm.Parameters.AddWithValue("@pID", _pid);
int count = (int)cm.ExecuteScalar();
_exists = (count > 0);
}
}
}
catch(Exception ex)
{
Database.LogException("Permission",ex);
}
}
}
#endregion
// Standard Default Code
// #region extension
Extension ext = new Extension();
[Serializable()]
partial class Extension : extensionBase
{
}
[Serializable()]
class extensionBase
{
// Default Values
public virtual int DefaultPermad
{
get { return 0; }
}
public virtual string DefaultStartDate
{
get { return DateTime.Now.ToShortDateString(); }
}
public virtual DateTime DefaultDts
{
get { return DateTime.Now; }
}
public virtual string DefaultUsrid
{
get { return Environment.UserName.ToUpper(); }
}
// Authorization Rules
public virtual void AddAuthorizationRules(Csla.Security.AuthorizationRules rules)
{
// Needs to be overriden to add new authorization rules
}
// Validation Rules
public virtual void AddValidationRules(Csla.Validation.ValidationRules rules)
{
// Needs to be overriden to add new validation rules
}
}
//#endregion
// The follwing is a sample Extension File. You can use it to create PermissionExt.cs
//using System;
//using System.Collections.Generic;
//using System.Text;
//using Csla;
//namespace PatrialClass
//{
// public partial class Permission
// {
// partial class Extension : extensionBase
// {
// TODO: Override automatic defaults
// public virtual int DefaultPermad
// {
// get { return 0; }
// }
// public virtual SmartDate DefaultStartDate
// {
// get { return DateTime.Now.ToShortDateString(); }
// }
// public virtual DateTime DefaultDts
// {
// get { return DateTime.Now; }
// }
// public virtual string DefaultUsrid
// {
// get { return Environment.UserName.ToUpper(); }
// }
// public new void AddAuthorizationRules(Csla.Security.AuthorizationRules rules)
// {
// //rules.AllowRead(Dbid, "<Role(s)>");
// }
// public new void AddValidationRules(Csla.Validation.ValidationRules rules)
// {
// rules.AddRule(
// Csla.Validation.CommonRules.StringMaxLength,
// new Csla.Validation.CommonRules.MaxLengthRuleArgs("Name", 100));
// }
// }
// }
//}
} // Class
} // Namespace

View File

@@ -0,0 +1,91 @@
using System;
using System.Collections.Generic;
using System.Text;
using Csla;
namespace Volian.Object.Library
{
public partial class Permission
{
private static List<vlnValueKey> _permADLookup;
private static List<vlnValueKey> _permLevelLookup;
private static void setupLookup()
{
if (_permADLookup == null)
{
_permADLookup = new List<vlnValueKey>();
_permADLookup.Add(new vlnValueKey(0,"Allow"));
_permADLookup.Add(new vlnValueKey(1, "Deny"));
}
if (_permLevelLookup == null)
{
_permLevelLookup = new List<vlnValueKey>();
_permLevelLookup.Add(new vlnValueKey(0, "Security"));
_permLevelLookup.Add(new vlnValueKey(1, "System"));
_permLevelLookup.Add(new vlnValueKey(2, "RO"));
_permLevelLookup.Add(new vlnValueKey(3, "Procedure"));
_permLevelLookup.Add(new vlnValueKey(4, "Sections"));
_permLevelLookup.Add(new vlnValueKey(5, "Steps"));
_permLevelLookup.Add(new vlnValueKey(6, "Comments"));
}
}
public static List<vlnValueKey> PermADLookup
{
get { setupLookup(); return _permADLookup; }
}
public static List<vlnValueKey> PermLevelLookup
{
get { setupLookup(); return _permLevelLookup; }
}
public bool ReadAccess
{
get { return ((PermValue & 1) == 1); }
set { PermValue = (value?PermValue|1:PermValue^(PermValue&1));}
}
public bool WriteAccess
{
get { return ((PermValue & 2) == 2); }
set { PermValue = (value ? PermValue | 2 : PermValue ^ (PermValue & 2)); }
}
public bool CreateAccess
{
get { return ((PermValue & 4) == 4); }
set { PermValue = (value ? PermValue | 4 : PermValue ^ (PermValue & 4)); }
}
public bool DeleteAccess
{
get { return ((PermValue & 8) == 8); }
set { PermValue = (value ? PermValue | 8 : PermValue ^ (PermValue & 8)); }
}
// partial class Extension : extensionBase
// {
// TODO: Override automatic defaults
// public virtual int DefaultPermad
// {
// get { return 0; }
// }
// public virtual SmartDate DefaultStartDate
// {
// get { return DateTime.Now.ToShortDateString(); }
// }
// public virtual DateTime DefaultDts
// {
// get { return DateTime.Now; }
// }
// public virtual string DefaultUsrid
// {
// get { return Environment.UserName.ToUpper(); }
// }
// public new void AddAuthorizationRules(Csla.Security.AuthorizationRules rules)
// {
// //rules.AllowRead(Dbid, "<Role(s)>");
// }
// public new void AddValidationRules(Csla.Validation.ValidationRules rules)
// {
// rules.AddRule(
// Csla.Validation.CommonRules.StringMaxLength,
// new Csla.Validation.CommonRules.MaxLengthRuleArgs("Name", 100));
// }
// }
}
}

View File

@@ -0,0 +1,203 @@
// ========================================================================
// Copyright 2006 - Volian Enterprises, Inc. All rights reserved.
// Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
// ------------------------------------------------------------------------
// $Workfile: $ $Revision: $
// $Author: $ $Date: $
//
// $History: $
// ========================================================================
using System;
using System.Data;
using System.Data.SqlClient;
using Csla;
using Csla.Data;
namespace Volian.Object.Library
{
/// <summary>
/// PermissionInfo Generated by MyGeneration using the CSLA Object Mapping template
/// </summary>
[Serializable()]
public partial class PermissionInfo : ReadOnlyBase<PermissionInfo>
{
#region Business Methods
private int _pid;
[System.ComponentModel.DataObjectField(true, true)]
public int Pid
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _pid;
}
}
private int _rid;
[System.ComponentModel.DataObjectField(true, true)]
public int Rid
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _rid;
}
}
private int _permlevel;
/// <summary>
/// 0 - Security, 1 - System, 2 - RO, 3 - Procdures, 4 - Sections, 5 - Steps, 6 - Comments
/// </summary>
[System.ComponentModel.DataObjectField(true, true)]
public int PermLevel
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _permlevel;
}
}
private int _versiontype;
/// <summary>
/// 0 - Working Draft, 1 - Temporary Change, 2 Approved
/// </summary>
[System.ComponentModel.DataObjectField(true, true)]
public int VersionType
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _versiontype;
}
}
private int _permvalue;
/// <summary>
/// 1 - Read, 2 - Write, 4 - Create, 8 - Delete (15 - All)
/// </summary>
[System.ComponentModel.DataObjectField(true, true)]
public int PermValue
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _permvalue;
}
}
private int _permad;
/// <summary>
/// 0 - Allow, 1 - Deny
/// </summary>
[System.ComponentModel.DataObjectField(true, true)]
public int Permad
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _permad;
}
}
private string _startdate=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string StartDate
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _startdate;
}
}
private string _enddate=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string EndDate
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _enddate;
}
}
private DateTime _dts=new DateTime();
[System.ComponentModel.DataObjectField(true, true)]
public DateTime Dts
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _dts;
}
}
private string _usrid=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string Usrid
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _usrid;
}
}
// TODO: Replace base PermissionInfo.ToString function as necessary
/// <summary>
/// Overrides Base ToString
/// </summary>
/// <returns>A string representation of current PermissionInfo</returns>
//public override string ToString()
//{
// return base.ToString();
//}
// TODO: Check PermissionInfo.GetIdValue to assure that the ID returned is unique
/// <summary>
/// Overrides Base GetIdValue - Used internally by CSLA to determine equality
/// </summary>
/// <returns>A Unique ID for the current PermissionInfo</returns>
protected override object GetIdValue()
{
return _pid;
}
#endregion
#region Factory Methods
private PermissionInfo()
{ /* require use of factory methods */ }
#endregion
#region Data Access Portal
internal PermissionInfo(SafeDataReader dr)
{
try
{
_pid = dr.GetInt32("PID");
_rid = dr.GetInt32("RID");
_permlevel = dr.GetInt32("PermLevel");
_versiontype = dr.GetInt32("VersionType");
_permvalue = dr.GetInt32("PermValue");
_permad = dr.GetInt32("PermAD");
_startdate = dr.GetSmartDate("StartDate").Text;
_enddate = dr.GetSmartDate("EndDate").Text;
_dts = dr.GetDateTime("DTS");
_usrid = dr.GetString("UsrID");
}
catch(Exception ex)
{
Database.LogException("PermissionInfo",ex);
}
}
#endregion
} // Class
} // Namespace

View File

@@ -0,0 +1,78 @@
// ========================================================================
// Copyright 2006 - Volian Enterprises, Inc. All rights reserved.
// Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
// ------------------------------------------------------------------------
// $Workfile: $ $Revision: $
// $Author: $ $Date: $
//
// $History: $
// ========================================================================
using System;
using System.Data;
using System.Data.SqlClient;
using Csla;
using Csla.Data;
namespace Volian.Object.Library
{
/// <summary>
/// PermissionInfoList Generated by MyGeneration using the CSLA Object Mapping template
/// </summary>
[Serializable()]
public partial class PermissionInfoList : ReadOnlyListBase<PermissionInfoList,PermissionInfo>
{
#region Factory Methods
/// <summary>
/// Return a list of all projects.
/// </summary>
public static PermissionInfoList Get()
{
return DataPortal.Fetch<PermissionInfoList>(new Criteria());
}
// TODO: Add alternative gets -
//public static PermissionInfoList Get(<criteria>)
//{
// return DataPortal.Fetch<PermissionInfoList>(new FilteredCriteria(<criteria>));
//}
private PermissionInfoList()
{ /* require use of factory methods */ }
#endregion
#region Data Access Portal
[Serializable()]
private class Criteria
{ /* no criteria - retrieve all rows */ }
private void DataPortal_Fetch(Criteria criteria)
{
this.RaiseListChangedEvents = false;
try{
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
{
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "getPermissions";
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
{
IsReadOnly = false;
while (dr.Read())this.Add(new PermissionInfo(dr));
IsReadOnly = true;
}
}
}
}
catch(Exception ex)
{
Database.LogException("PermissionInfoList",ex);
}
this.RaiseListChangedEvents = true;
}
#endregion
} // Class
} // Namespace

View File

@@ -0,0 +1,377 @@
// ========================================================================
// Copyright 2006 - Volian Enterprises, Inc. All rights reserved.
// Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
// ------------------------------------------------------------------------
// $Workfile: $ $Revision: $
// $Author: $ $Date: $
//
// $History: $
// ========================================================================
using System;
using System.Data;
using System.Data.SqlClient;
using Csla;
using Csla.Data;
namespace Volian.Object.Library
{
/// <summary>
/// PermissionRole Generated by MyGeneration using the CSLA Object Mapping template
/// </summary>
[Serializable()]
public partial class PermissionRole : BusinessBase<PermissionRole>
{
#region Business Methods
private int _rid;
[System.ComponentModel.DataObjectField(true, true)]
public int Rid
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _rid;
}
}
private string _name=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string Name
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _name;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (value == null) value = string.Empty;
if (_name != value)
{
_name = value;
PropertyHasChanged();
}
}
}
private string _title=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string Title
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _title;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (value == null) value = string.Empty;
if (_title != value)
{
_title = value;
PropertyHasChanged();
}
}
}
private DateTime _dts=new DateTime();
[System.ComponentModel.DataObjectField(true, true)]
public DateTime Dts
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _dts;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (_dts != value)
{
_dts = value;
PropertyHasChanged();
}
}
}
private string _usrid=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string Usrid
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _usrid;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (value == null) value = string.Empty;
if (_usrid != value)
{
_usrid = value;
PropertyHasChanged();
}
}
}
private byte[] _lastchanged=new byte[8];//timestamp
// TODO: Check PermissionRole.GetIdValue to assure that the ID returned is unique
/// <summary>
/// Overrides Base GetIdValue - Used internally by CSLA to determine equality
/// </summary>
/// <returns>A Unique ID for the current PermissionRole</returns>
protected override object GetIdValue()
{
return _rid;
}
// TODO: Replace base PermissionRole.ToString function as necessary
/// <summary>
/// Overrides Base ToString
/// </summary>
/// <returns>A string representation of current PermissionRole</returns>
//public override string ToString()
//{
// return base.ToString();
//}
#endregion
#region ValidationRules
protected override void AddBusinessRules()
{
ValidationRules.AddRule(
Csla.Validation.CommonRules.StringRequired, "Name");
ValidationRules.AddRule(
Csla.Validation.CommonRules.StringMaxLength,
new Csla.Validation.CommonRules.MaxLengthRuleArgs("Name", 50));
ValidationRules.AddRule(
Csla.Validation.CommonRules.StringRequired, "Title");
ValidationRules.AddRule(
Csla.Validation.CommonRules.StringMaxLength,
new Csla.Validation.CommonRules.MaxLengthRuleArgs("Title", 250));
ValidationRules.AddRule(
Csla.Validation.CommonRules.StringMaxLength,
new Csla.Validation.CommonRules.MaxLengthRuleArgs("Usrid", 100));
// TODO: Add other validation rules
}
// Sample data comparison validation rule
//private bool StartDateGTEndDate(object target, Csla.Validation.RuleArgs e)
//{
// if (_started > _ended)
// {
// e.Description = "Start date can't be after end date";
// return false;
// }
// else
// return true;
//}
#endregion
#region Authorization Rules
protected override void AddAuthorizationRules()
{
//TODO: Who can read/write which fields
//AuthorizationRules.AllowRead(Rid, "<Role(s)>");
//AuthorizationRules.AllowRead(Name, "<Role(s)>");
//AuthorizationRules.AllowWrite(Name, "<Role(s)>");
//AuthorizationRules.AllowRead(Title, "<Role(s)>");
//AuthorizationRules.AllowWrite(Title, "<Role(s)>");
//AuthorizationRules.AllowRead(Dts, "<Role(s)>");
//AuthorizationRules.AllowWrite(Dts, "<Role(s)>");
//AuthorizationRules.AllowRead(Usrid, "<Role(s)>");
//AuthorizationRules.AllowWrite(Usrid, "<Role(s)>");
}
public static bool CanAddObject()
{
// TODO: Can Add Authorization
//return Csla.ApplicationContext.User.IsInRole("ProjectManager");
return true;
}
public static bool CanGetObject()
{
// TODO: CanGet Authorization
return true;
}
public static bool CanDeleteObject()
{
// TODO: CanDelete Authorization
//bool result = false;
//if (Csla.ApplicationContext.User.IsInRole("ProjectManager"))result = true;
//if (Csla.ApplicationContext.User.IsInRole("Administrator"))result = true;
//return result;
return true;
}
public static bool CanEditObject()
{
// TODO: CanEdit Authorization
//return Csla.ApplicationContext.User.IsInRole("ProjectManager");
return true;
}
#endregion
#region Factory Methods
internal static PermissionRole New(string name, string title)
{
return new PermissionRole(name, title);
}
internal static PermissionRole Get(SafeDataReader dr)
{
return new PermissionRole(dr);
}
private PermissionRole()
{
MarkAsChild();
_dts = ext.DefaultDts;
_usrid = ext.DefaultUsrid;
}
private PermissionRole(string name, string title)
{
MarkAsChild();
// TODO: Add any initialization & defaults
_dts = ext.DefaultDts;
_usrid = ext.DefaultUsrid;
_name = name;
_title = title;
}
private PermissionRole(SafeDataReader dr)
{
MarkAsChild();
Fetch(dr);
}
#endregion
#region Data Access Portal
private void Fetch(SafeDataReader dr)
{
try{
_rid = dr.GetInt32("RID");
_name = dr.GetString("Name");
_title = dr.GetString("Title");
_dts = dr.GetDateTime("DTS");
_usrid = dr.GetString("UsrID");
dr.GetBytes("LastChanged", 0, _lastchanged, 0, 8);
}
catch(Exception ex)
{
Database.LogException("PermissionRole",ex);
}
MarkOld();
}
internal void Insert(Permission permission,SqlConnection cn)
{
// if we're not dirty then don't update the database
if (!this.IsDirty) return;
_lastchanged=Role.Add(cn, ref _rid, _name, _title, _dts, _usrid);
MarkOld();
}
internal void Update(Permission permission,SqlConnection cn)
{
// if we're not dirty then don't update the database
if (!this.IsDirty) return;
_lastchanged=Role.Update(cn, ref _rid, _name, _title, _dts, _usrid, ref _lastchanged);
}
internal void DeleteSelf(Permission permission,SqlConnection cn)
{
// if we're not dirty then don't update the database
if (!this.IsDirty) return;
// if we're new then don't update the database
if (this.IsNew) return;
Role.Remove(cn,_rid);
MarkNew();
}
#endregion
// Standard Default Code
// #region extension
Extension ext = new Extension();
[Serializable()]
partial class Extension : extensionBase
{
}
[Serializable()]
class extensionBase
{
// Default Values
public virtual DateTime DefaultDts
{
get { return DateTime.Now; }
}
public virtual string DefaultUsrid
{
get { return Environment.UserName.ToUpper(); }
}
// Authorization Rules
public virtual void AddAuthorizationRules(Csla.Security.AuthorizationRules rules)
{
// Needs to be overriden to add new authorization rules
}
// Validation Rules
public virtual void AddValidationRules(Csla.Validation.ValidationRules rules)
{
// Needs to be overriden to add new validation rules
}
}
//#endregion
// The follwing is a sample Extension File. You can use it to create PermissionRoleExt.cs
//using System;
//using System.Collections.Generic;
//using System.Text;
//using Csla;
//namespace PatrialClass
//{
// public partial class PermissionRole
// {
// partial class Extension : extensionBase
// {
// TODO: Override automatic defaults
// public virtual DateTime DefaultDts
// {
// get { return DateTime.Now; }
// }
// public virtual string DefaultUsrid
// {
// get { return Environment.UserName.ToUpper(); }
// }
// public new void AddAuthorizationRules(Csla.Security.AuthorizationRules rules)
// {
// //rules.AllowRead(Dbid, "<Role(s)>");
// }
// public new void AddValidationRules(Csla.Validation.ValidationRules rules)
// {
// rules.AddRule(
// Csla.Validation.CommonRules.StringMaxLength,
// new Csla.Validation.CommonRules.MaxLengthRuleArgs("Name", 100));
// }
// }
// }
//}
} // Class
} // Namespace

View File

@@ -0,0 +1,85 @@
// ========================================================================
// Copyright 2006 - Volian Enterprises, Inc. All rights reserved.
// Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
// ------------------------------------------------------------------------
// $Workfile: $ $Revision: $
// $Author: $ $Date: $
//
// $History: $
// ========================================================================
using System;
using System.Data;
using System.Data.SqlClient;
using Csla;
using Csla.Data;
namespace Volian.Object.Library
{
/// <summary>
/// PermissionRoles Generated by MyGeneration using the CSLA Object Mapping template
/// </summary>
[Serializable()]
public partial class PermissionRoles : BusinessListBase<PermissionRoles,PermissionRole>
{
// No Columns to retrieve
#region Factory Methods
internal static PermissionRoles New()
{
return new PermissionRoles();
}
internal static PermissionRoles Get(SafeDataReader dr)
{
return new PermissionRoles(dr);
}
private PermissionRoles()
{
MarkAsChild();
}
private PermissionRoles(SafeDataReader dr)
{
MarkAsChild();
Fetch(dr);
}
#endregion
#region Data Access Portal
// called to load data from the database
private void Fetch(SafeDataReader dr)
{
this.RaiseListChangedEvents = false;
while (dr.Read())
this.Add(PermissionRole.Get(dr));
this.RaiseListChangedEvents = true;
}
internal void Update(Permission permission,SqlConnection cn)
{
this.RaiseListChangedEvents = false;
// update (thus deleting) any deleted child objects
foreach (PermissionRole obj in DeletedList)
obj.DeleteSelf(permission,cn);
// now that they are deleted, remove them from memory too
DeletedList.Clear();
// add/update any current child objects
foreach (PermissionRole obj in this)
{
if (obj.IsNew)
obj.Insert(permission,cn);
else
obj.Update(permission,cn);
}
this.RaiseListChangedEvents = true;
}
#endregion
} // Class
} // Namespace

View File

@@ -0,0 +1,35 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Volian.Object.Library")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Volian Enterprises, Inc.")]
[assembly: AssemblyProduct("Volian.Object.Library")]
[assembly: AssemblyCopyright("Copyright © Volian Enterprises, Inc. 2006")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("d6450c32-46ad-4f6f-9609-ad3a96730bfe")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -0,0 +1,693 @@
// ========================================================================
// Copyright 2006 - Volian Enterprises, Inc. All rights reserved.
// Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
// ------------------------------------------------------------------------
// $Workfile: $ $Revision: $
// $Author: $ $Date: $
//
// $History: $
// ========================================================================
using System;
using System.Data;
using System.Data.SqlClient;
using Csla;
using Csla.Data;
namespace Volian.Object.Library
{
/// <summary>
/// Role Generated by MyGeneration using the CSLA Object Mapping template
/// </summary>
[Serializable()]
public partial class Role : BusinessBase<Role>
{
#region Business Methods
private int _rid;
[System.ComponentModel.DataObjectField(true, true)]
public int Rid
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _rid;
}
}
private string _name=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string Name
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _name;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (value == null) value = string.Empty;
if (_name != value)
{
_name = value;
PropertyHasChanged();
}
}
}
private string _title=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string Title
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _title;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (value == null) value = string.Empty;
if (_title != value)
{
_title = value;
PropertyHasChanged();
}
}
}
private DateTime _dts=new DateTime();
[System.ComponentModel.DataObjectField(true, true)]
public DateTime Dts
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _dts;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (_dts != value)
{
_dts = value;
PropertyHasChanged();
}
}
}
private string _usrid=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string Usrid
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _usrid;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (value == null) value = string.Empty;
if (_usrid != value)
{
_usrid = value;
PropertyHasChanged();
}
}
}
private byte[] _lastchanged=new byte[8];//timestamp
private RoleAssignments _roleassignments = RoleAssignments.New();
/// <summary>
/// Related Field
/// </summary>
[System.ComponentModel.DataObjectField(true, true)]
public RoleAssignments RoleAssignments
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _roleassignments;
}
}
private RolePermissions _rolepermissions = RolePermissions.New();
/// <summary>
/// Related Field
/// </summary>
[System.ComponentModel.DataObjectField(true, true)]
public RolePermissions RolePermissions
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _rolepermissions;
}
}
public override bool IsDirty
{
get { return base.IsDirty || _roleassignments.IsDirty || _rolepermissions.IsDirty ; }
}
public override bool IsValid
{
get { return base.IsValid && _roleassignments.IsValid && _rolepermissions.IsValid ; }
}
// TODO: Replace base Role.ToString function as necessary
/// <summary>
/// Overrides Base ToString
/// </summary>
/// <returns>A string representation of current Role</returns>
//public override string ToString()
//{
// return base.ToString();
//}
// TODO: Check Role.GetIdValue to assure that the ID returned is unique
/// <summary>
/// Overrides Base GetIdValue - Used internally by CSLA to determine equality
/// </summary>
/// <returns>A Unique ID for the current Role</returns>
protected override object GetIdValue()
{
return _rid;
}
#endregion
#region ValidationRules
protected override void AddBusinessRules()
{
ValidationRules.AddRule(
Csla.Validation.CommonRules.StringRequired, "Name");
ValidationRules.AddRule(
Csla.Validation.CommonRules.StringMaxLength,
new Csla.Validation.CommonRules.MaxLengthRuleArgs("Name", 50));
ValidationRules.AddRule(
Csla.Validation.CommonRules.StringRequired, "Title");
ValidationRules.AddRule(
Csla.Validation.CommonRules.StringMaxLength,
new Csla.Validation.CommonRules.MaxLengthRuleArgs("Title", 250));
ValidationRules.AddRule(
Csla.Validation.CommonRules.StringMaxLength,
new Csla.Validation.CommonRules.MaxLengthRuleArgs("Usrid", 100));
ext.AddValidationRules(ValidationRules);
// TODO: Add other validation rules
// ValidationRules.AddRule(StartDateGTEndDate, "Started");
}
// Sample data comparison validation rule
//private bool StartDateGTEndDate(object target, Csla.Validation.RuleArgs e)
//{
// if (_started > _ended)
// {
// e.Description = "Start date can't be after end date";
// return false;
// }
// else
// return true;
//}
#endregion
#region Authorization Rules
protected override void AddAuthorizationRules()
{
//TODO: Who can read/write which fields
//AuthorizationRules.AllowRead(Rid, "<Role(s)>");
//AuthorizationRules.AllowRead(Name, "<Role(s)>");
//AuthorizationRules.AllowRead(Title, "<Role(s)>");
//AuthorizationRules.AllowRead(Dts, "<Role(s)>");
//AuthorizationRules.AllowRead(Usrid, "<Role(s)>");
//AuthorizationRules.AllowWrite(Name, "<Role(s)>");
//AuthorizationRules.AllowWrite(Title, "<Role(s)>");
//AuthorizationRules.AllowWrite(Dts, "<Role(s)>");
//AuthorizationRules.AllowWrite(Usrid, "<Role(s)>");
ext.AddAuthorizationRules(AuthorizationRules);
}
public static bool CanAddObject()
{
// TODO: Can Add Authorization
//return Csla.ApplicationContext.User.IsInRole("ProjectManager");
return true;
}
public static bool CanGetObject()
{
// TODO: CanGet Authorization
return true;
}
public static bool CanDeleteObject()
{
// TODO: CanDelete Authorization
//bool result = false;
//if (Csla.ApplicationContext.User.IsInRole("ProjectManager"))result = true;
//if (Csla.ApplicationContext.User.IsInRole("Administrator"))result = true;
//return result;
return true;
}
public static bool CanEditObject()
{
// TODO: CanEdit Authorization
//return Csla.ApplicationContext.User.IsInRole("ProjectManager");
return true;
}
#endregion
#region Factory Methods
private Role()
{/* require use of factory methods */}
public static Role New()
{
if (!CanAddObject())
throw new System.Security.SecurityException("User not authorized to add a Role");
return DataPortal.Create<Role>();
}
public static Role Get(int _rid)
{
if (!CanGetObject())
throw new System.Security.SecurityException("User not authorized to view a Role");
return DataPortal.Fetch<Role>(new PKCriteria(_rid));
}
public static void Delete(int _rid)
{
if (!CanDeleteObject())
throw new System.Security.SecurityException("User not authorized to remove a Role");
DataPortal.Delete(new PKCriteria(_rid));
}
public override Role Save()
{
if (IsDeleted && !CanDeleteObject())
throw new System.Security.SecurityException("User not authorized to remove a Role");
else if (IsNew && !CanAddObject())
throw new System.Security.SecurityException("User not authorized to add a Role");
else if (!CanEditObject())
throw new System.Security.SecurityException("User not authorized to update a Role");
return base.Save();
}
#endregion
#region Data Access Portal
[Serializable()]
private class PKCriteria
{
private int _rid;
public int Rid
{ get {return _rid;}}
public PKCriteria(int rid)
{
_rid=rid;
}
}
// If Create needs to access DB - It should not be marked RunLocal
[RunLocal()]
private new void DataPortal_Create(object criteria)
{
// Database Defaults
_dts = ext.DefaultDts;
_usrid = ext.DefaultUsrid;
// TODO: Add any defaults that are necessary
ValidationRules.CheckRules();
}
private void DataPortal_Fetch(PKCriteria criteria)
{
try{
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
{
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "getRole";
cm.Parameters.AddWithValue("@rID", criteria.Rid);
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
{
dr.Read();
_rid = dr.GetInt32("RID");
_name = dr.GetString("Name");
_title = dr.GetString("Title");
_dts = dr.GetDateTime("DTS");
_usrid = dr.GetString("UsrID");
dr.GetBytes("LastChanged", 0, _lastchanged, 0, 8);
// load child objects
dr.NextResult();
_roleassignments = RoleAssignments.Get(dr);
// load child objects
dr.NextResult();
_rolepermissions = RolePermissions.Get(dr);
}
}
}
}
catch(Exception ex)
{
Database.LogException("Role",ex);
}
}
[Transactional(TransactionalTypes.TransactionScope)]
protected override void DataPortal_Insert()
{
try{
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
{
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "addRole";
// Input All Fields - Except Calculated Columns
cm.Parameters.AddWithValue("@name", _name);
cm.Parameters.AddWithValue("@title", _title);
cm.Parameters.AddWithValue("@dTS", _dts);
cm.Parameters.AddWithValue("@usrID", _usrid);
// Output Calculated Columns
SqlParameter param_rid = new SqlParameter("@newRID",SqlDbType.Int);
param_rid.Direction = ParameterDirection.Output;
cm.Parameters.Add(param_rid);
SqlParameter param_lastchanged = new SqlParameter("@newLastChanged",SqlDbType.Timestamp);
param_lastchanged.Direction = ParameterDirection.Output;
cm.Parameters.Add(param_lastchanged);
// TODO: Define any additional output parameters
cm.ExecuteNonQuery();
// Save all values being returned from the Procedure
_rid = (int)cm.Parameters["@newRID"].Value;
_lastchanged = (byte[])cm.Parameters["@newLastChanged"].Value;
}
// update child objects
_roleassignments.Update(this,cn);
_rolepermissions.Update(this,cn);
}
}
catch(Exception ex)
{
Database.LogException("Role",ex);
}}
[Transactional(TransactionalTypes.TransactionScope)]
public static byte[] Add(SqlConnection cn,ref int rid, string name, string title, DateTime dts, string usrid)
{
try{
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "addRole";
// Input All Fields - Except Calculated Columns
cm.Parameters.AddWithValue("@name", name);
cm.Parameters.AddWithValue("@title", title);
cm.Parameters.AddWithValue("@dTS", dts);
cm.Parameters.AddWithValue("@usrID", usrid);
// Output Calculated Columns
SqlParameter param_rid = new SqlParameter("@newRID",SqlDbType.Int);
param_rid.Direction = ParameterDirection.Output;
cm.Parameters.Add(param_rid);
SqlParameter param_lastchanged = new SqlParameter("@newLastChanged",SqlDbType.Timestamp);
param_lastchanged.Direction = ParameterDirection.Output;
cm.Parameters.Add(param_lastchanged);
// TODO: Define any additional output parameters
cm.ExecuteNonQuery();
// Save all values being returned from the Procedure
rid = (int)cm.Parameters["@newRID"].Value;
return (byte[])cm.Parameters["@newLastChanged"].Value;
}
}
catch(Exception ex)
{
Database.LogException("Role",ex);
return null;
}
}
[Transactional(TransactionalTypes.TransactionScope)]
protected override void DataPortal_Update()
{
if (IsDirty)// If this is dirty - open the connection
{
try{
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
{
if(base.IsDirty)
{
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "updateRole";
// All Fields including Calculated Fields
cm.Parameters.AddWithValue("@rID", _rid);
cm.Parameters.AddWithValue("@name", _name);
cm.Parameters.AddWithValue("@title", _title);
cm.Parameters.AddWithValue("@dTS", _dts);
cm.Parameters.AddWithValue("@usrID", _usrid);
cm.Parameters.AddWithValue("@lastChanged", _lastchanged);
// Output Calculated Columns
SqlParameter param_lastchanged = new SqlParameter("@newLastChanged",SqlDbType.Timestamp);
param_lastchanged.Direction = ParameterDirection.Output;
cm.Parameters.Add(param_lastchanged);
// TODO: Define any additional output parameters
cm.ExecuteNonQuery();
// Save all values being returned from the Procedure
_lastchanged = (byte[])cm.Parameters["@newLastChanged"].Value;
}
}
// use the open connection to update child objects
_roleassignments.Update(this,cn);
_rolepermissions.Update(this,cn);
}
}
catch(Exception ex)
{
Database.LogException("Role",ex);
}
}
}
[Transactional(TransactionalTypes.TransactionScope)]
public static byte[] Update(SqlConnection cn,ref int rid, string name, string title, DateTime dts, string usrid, ref byte[] lastchanged)
{
try{
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "updateRole";
// Input All Fields - Except Calculated Columns
cm.Parameters.AddWithValue("@rID", rid);
cm.Parameters.AddWithValue("@name", name);
cm.Parameters.AddWithValue("@title", title);
cm.Parameters.AddWithValue("@dTS", dts);
cm.Parameters.AddWithValue("@usrID", usrid);
cm.Parameters.AddWithValue("@lastChanged", lastchanged);
// Output Calculated Columns
SqlParameter param_lastchanged = new SqlParameter("@newLastChanged",SqlDbType.Timestamp);
param_lastchanged.Direction = ParameterDirection.Output;
cm.Parameters.Add(param_lastchanged);
// TODO: Define any additional output parameters
cm.ExecuteNonQuery();
// Save all values being returned from the Procedure
return (byte[])cm.Parameters["@newLastChanged"].Value;
}
}
catch(Exception ex)
{
Database.LogException("Role",ex);
return null;
}
}
[Transactional(TransactionalTypes.TransactionScope)]
protected override void DataPortal_DeleteSelf()
{
DataPortal_Delete(new PKCriteria(_rid));
}
[Transactional(TransactionalTypes.TransactionScope)]
private void DataPortal_Delete(PKCriteria criteria)
{
try{
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
{
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "deleteRole";
cm.Parameters.AddWithValue("@rID", criteria.Rid);
cm.ExecuteNonQuery();
}
}
}
catch(Exception ex)
{
Database.LogException("Role",ex);
}
}
[Transactional(TransactionalTypes.TransactionScope)]
public static void Remove(SqlConnection cn,int rid)
{
try{
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "deleteRole";
// Input PK Fields
cm.Parameters.AddWithValue("@rID", rid);
// TODO: Define any additional output parameters
cm.ExecuteNonQuery();
}
}
catch(Exception ex)
{
Database.LogException("Role",ex);
}
}
#endregion
#region Exists
public static bool Exists(int rid)
{
ExistsCommand result;
result = DataPortal.Execute<ExistsCommand>
(new ExistsCommand(rid));
return result.Exists;
}
[Serializable()]
private class ExistsCommand : CommandBase
{
private int _rid;
private bool _exists;
public bool Exists
{
get { return _exists; }
}
public ExistsCommand(int rid)
{
_rid=rid;
}
protected override void DataPortal_Execute()
{
try{
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
{
cn.Open();
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "existsRole";
cm.Parameters.AddWithValue("@rID", _rid);
int count = (int)cm.ExecuteScalar();
_exists = (count > 0);
}
}
}
catch(Exception ex)
{
Database.LogException("Role",ex);
}
}
}
#endregion
// Standard Default Code
// #region extension
Extension ext = new Extension();
[Serializable()]
partial class Extension : extensionBase
{
}
[Serializable()]
class extensionBase
{
// Default Values
public virtual DateTime DefaultDts
{
get { return DateTime.Now; }
}
public virtual string DefaultUsrid
{
get { return Environment.UserName.ToUpper(); }
}
// Authorization Rules
public virtual void AddAuthorizationRules(Csla.Security.AuthorizationRules rules)
{
// Needs to be overriden to add new authorization rules
}
// Validation Rules
public virtual void AddValidationRules(Csla.Validation.ValidationRules rules)
{
// Needs to be overriden to add new validation rules
}
}
//#endregion
// The follwing is a sample Extension File. You can use it to create RoleExt.cs
//using System;
//using System.Collections.Generic;
//using System.Text;
//using Csla;
//namespace PatrialClass
//{
// public partial class Role
// {
// partial class Extension : extensionBase
// {
// TODO: Override automatic defaults
// public virtual DateTime DefaultDts
// {
// get { return DateTime.Now; }
// }
// public virtual string DefaultUsrid
// {
// get { return Environment.UserName.ToUpper(); }
// }
// public new void AddAuthorizationRules(Csla.Security.AuthorizationRules rules)
// {
// //rules.AllowRead(Dbid, "<Role(s)>");
// }
// public new void AddValidationRules(Csla.Validation.ValidationRules rules)
// {
// rules.AddRule(
// Csla.Validation.CommonRules.StringMaxLength,
// new Csla.Validation.CommonRules.MaxLengthRuleArgs("Name", 100));
// }
// }
// }
//}
} // Class
} // Namespace

View File

@@ -0,0 +1,627 @@
// ========================================================================
// Copyright 2006 - Volian Enterprises, Inc. All rights reserved.
// Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
// ------------------------------------------------------------------------
// $Workfile: $ $Revision: $
// $Author: $ $Date: $
//
// $History: $
// ========================================================================
using System;
using System.Data;
using System.Data.SqlClient;
using Csla;
using Csla.Data;
namespace Volian.Object.Library
{
/// <summary>
/// RoleAssignment Generated by MyGeneration using the CSLA Object Mapping template
/// </summary>
[Serializable()]
public partial class RoleAssignment : BusinessBase<RoleAssignment>
{
#region Business Methods
private int _aid;
[System.ComponentModel.DataObjectField(true, true)]
public int Aid
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _aid;
}
}
private int _gid;
[System.ComponentModel.DataObjectField(true, true)]
public int Gid
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _gid;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (_gid != value)
{
_gid = value;
PropertyHasChanged();
}
}
}
private int _folderid;
[System.ComponentModel.DataObjectField(true, true)]
public int Folderid
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _folderid;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (_folderid != value)
{
_folderid = value;
PropertyHasChanged();
}
}
}
private string _startdate=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string StartDate
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _startdate;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (value == null) value = string.Empty;
_startdate = value;
try
{
DateTime tmp = SmartDate.StringToDate(value);
if (_startdate != tmp.ToShortDateString())
{
_startdate = tmp.ToShortDateString();
// TODO: Any Cross Property Validation
}
}
catch
{
}
PropertyHasChanged();
}
}
private string _enddate=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string EndDate
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _enddate;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (value == null) value = string.Empty;
_enddate = value;
try
{
DateTime tmp = SmartDate.StringToDate(value);
if (_enddate != tmp.ToShortDateString())
{
_enddate = tmp.ToShortDateString();
// TODO: Any Cross Property Validation
}
}
catch
{
}
PropertyHasChanged();
}
}
private DateTime _dts=new DateTime();
[System.ComponentModel.DataObjectField(true, true)]
public DateTime Dts
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _dts;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (_dts != value)
{
_dts = value;
PropertyHasChanged();
}
}
}
private string _usrid=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string Usrid
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _usrid;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (value == null) value = string.Empty;
if (_usrid != value)
{
_usrid = value;
PropertyHasChanged();
}
}
}
private byte[] _lastchanged=new byte[8];//timestamp
private int _folder_parentid;
[System.ComponentModel.DataObjectField(true, true)]
public int Folder_Parentid
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _folder_parentid;
}
}
private int _folder_dbid;
[System.ComponentModel.DataObjectField(true, true)]
public int Folder_Dbid
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _folder_dbid;
}
}
private string _folder_name=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string Folder_Name
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _folder_name;
}
}
private string _folder_title=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string Folder_Title
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _folder_title;
}
}
private string _folder_config=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string Folder_Config
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _folder_config;
}
}
private DateTime _folder_dts=new DateTime();
[System.ComponentModel.DataObjectField(true, true)]
public DateTime Folder_Dts
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _folder_dts;
}
}
private string _folder_usrid=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string Folder_Usrid
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _folder_usrid;
}
}
private string _group_groupname=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string Group_GroupName
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _group_groupname;
}
}
private int _group_grouptype;
[System.ComponentModel.DataObjectField(true, true)]
public int Group_GroupType
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _group_grouptype;
}
}
private string _group_config=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string Group_Config
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _group_config;
}
}
private DateTime _group_dts=new DateTime();
[System.ComponentModel.DataObjectField(true, true)]
public DateTime Group_Dts
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _group_dts;
}
}
private string _group_usrid=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string Group_Usrid
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _group_usrid;
}
}
// TODO: Check RoleAssignment.GetIdValue to assure that the ID returned is unique
/// <summary>
/// Overrides Base GetIdValue - Used internally by CSLA to determine equality
/// </summary>
/// <returns>A Unique ID for the current RoleAssignment</returns>
protected override object GetIdValue()
{
return _aid;
}
// TODO: Replace base RoleAssignment.ToString function as necessary
/// <summary>
/// Overrides Base ToString
/// </summary>
/// <returns>A string representation of current RoleAssignment</returns>
//public override string ToString()
//{
// return base.ToString();
//}
#endregion
#region ValidationRules
protected override void AddBusinessRules()
{
ValidationRules.AddRule(StartDateValid, "StartDate");
ValidationRules.AddRule(EndDateValid, "EndDate");
ValidationRules.AddRule(
Csla.Validation.CommonRules.StringMaxLength,
new Csla.Validation.CommonRules.MaxLengthRuleArgs("Usrid", 100));
// TODO: Add other validation rules
}
private bool StartDateValid(object target, Csla.Validation.RuleArgs e)
{
try
{
DateTime tmp = SmartDate.StringToDate(_startdate);
}
catch
{
e.Description="Invalid Date";
return false;
}
return true;
}
private bool EndDateValid(object target, Csla.Validation.RuleArgs e)
{
try
{
DateTime tmp = SmartDate.StringToDate(_enddate);
}
catch
{
e.Description="Invalid Date";
return false;
}
return true;
}
// Sample data comparison validation rule
//private bool StartDateGTEndDate(object target, Csla.Validation.RuleArgs e)
//{
// if (_started > _ended)
// {
// e.Description = "Start date can't be after end date";
// return false;
// }
// else
// return true;
//}
#endregion
#region Authorization Rules
protected override void AddAuthorizationRules()
{
//TODO: Who can read/write which fields
//AuthorizationRules.AllowRead(Aid, "<Role(s)>");
//AuthorizationRules.AllowRead(Gid, "<Role(s)>");
//AuthorizationRules.AllowWrite(Gid, "<Role(s)>");
//AuthorizationRules.AllowRead(Folderid, "<Role(s)>");
//AuthorizationRules.AllowWrite(Folderid, "<Role(s)>");
//AuthorizationRules.AllowRead(StartDate, "<Role(s)>");
//AuthorizationRules.AllowWrite(StartDate, "<Role(s)>");
//AuthorizationRules.AllowRead(EndDate, "<Role(s)>");
//AuthorizationRules.AllowWrite(EndDate, "<Role(s)>");
//AuthorizationRules.AllowRead(Dts, "<Role(s)>");
//AuthorizationRules.AllowWrite(Dts, "<Role(s)>");
//AuthorizationRules.AllowRead(Usrid, "<Role(s)>");
//AuthorizationRules.AllowWrite(Usrid, "<Role(s)>");
}
public static bool CanAddObject()
{
// TODO: Can Add Authorization
//return Csla.ApplicationContext.User.IsInRole("ProjectManager");
return true;
}
public static bool CanGetObject()
{
// TODO: CanGet Authorization
return true;
}
public static bool CanDeleteObject()
{
// TODO: CanDelete Authorization
//bool result = false;
//if (Csla.ApplicationContext.User.IsInRole("ProjectManager"))result = true;
//if (Csla.ApplicationContext.User.IsInRole("Administrator"))result = true;
//return result;
return true;
}
public static bool CanEditObject()
{
// TODO: CanEdit Authorization
//return Csla.ApplicationContext.User.IsInRole("ProjectManager");
return true;
}
#endregion
#region Factory Methods
internal static RoleAssignment New(int gid, int folderid)
{
return new RoleAssignment(Volian.Object.Library.Group.Get(gid), Volian.Object.Library.Folder.Get(folderid));
}
internal static RoleAssignment Get(SafeDataReader dr)
{
return new RoleAssignment(dr);
}
private RoleAssignment()
{
MarkAsChild();
_startdate = ext.DefaultStartDate;
_dts = ext.DefaultDts;
_usrid = ext.DefaultUsrid;
}
private RoleAssignment(Group group, Folder folder)
{
MarkAsChild();
// TODO: Add any initialization & defaults
_startdate = ext.DefaultStartDate;
_dts = ext.DefaultDts;
_usrid = ext.DefaultUsrid;
_folderid = folder.Folderid;
_folder_parentid = folder.Parentid;
_folder_dbid = folder.Dbid;
_folder_name = folder.Name;
_folder_title = folder.Title;
_folder_config = folder.Config;
_folder_dts = folder.Dts;
_folder_usrid = folder.Usrid;
_gid = group.Gid;
_group_groupname = group.GroupName;
_group_grouptype = group.GroupType;
_group_config = group.Config;
_group_dts = group.Dts;
_group_usrid = group.Usrid;
}
private RoleAssignment(SafeDataReader dr)
{
MarkAsChild();
Fetch(dr);
}
#endregion
#region Data Access Portal
private void Fetch(SafeDataReader dr)
{
try{
_aid = dr.GetInt32("AID");
_gid = dr.GetInt32("GID");
_folderid = dr.GetInt32("FolderID");
_startdate = dr.GetSmartDate("StartDate").Text;
_enddate = dr.GetSmartDate("EndDate").Text;
_dts = dr.GetDateTime("DTS");
_usrid = dr.GetString("UsrID");
dr.GetBytes("LastChanged", 0, _lastchanged, 0, 8);
_folder_parentid = dr.GetInt32("Folders_ParentID");
_folder_dbid = dr.GetInt32("Folders_DBID");
_folder_name = dr.GetString("Folders_Name");
_folder_title = dr.GetString("Folders_Title");
_folder_config = dr.GetString("Folders_Config");
_folder_dts = dr.GetDateTime("Folders_DTS");
_folder_usrid = dr.GetString("Folders_UsrID");
_group_groupname = dr.GetString("Groups_GroupName");
_group_grouptype = dr.GetInt32("Groups_GroupType");
_group_config = dr.GetString("Groups_Config");
_group_dts = dr.GetDateTime("Groups_DTS");
_group_usrid = dr.GetString("Groups_UsrID");
}
catch(Exception ex)
{
Database.LogException("RoleAssignment",ex);
}
MarkOld();
}
internal void Insert(Role role,SqlConnection cn)
{
// if we're not dirty then don't update the database
if (!this.IsDirty) return;
_lastchanged=Assignment.Add(cn, ref _aid, _gid, role.Rid, _folderid, new SmartDate(_startdate), new SmartDate(_enddate), _dts, _usrid);
MarkOld();
}
internal void Update(Role role,SqlConnection cn)
{
// if we're not dirty then don't update the database
if (!this.IsDirty) return;
_lastchanged=Assignment.Update(cn, ref _aid, _gid, role.Rid, _folderid, new SmartDate(_startdate), new SmartDate(_enddate), _dts, _usrid, ref _lastchanged);
}
internal void DeleteSelf(Role role,SqlConnection cn)
{
// if we're not dirty then don't update the database
if (!this.IsDirty) return;
// if we're new then don't update the database
if (this.IsNew) return;
Assignment.Remove(cn,_aid);
MarkNew();
}
#endregion
// Standard Default Code
// #region extension
Extension ext = new Extension();
[Serializable()]
partial class Extension : extensionBase
{
}
[Serializable()]
class extensionBase
{
// Default Values
public virtual string DefaultStartDate
{
get { return DateTime.Now.ToShortDateString(); }
}
public virtual DateTime DefaultDts
{
get { return DateTime.Now; }
}
public virtual string DefaultUsrid
{
get { return Environment.UserName.ToUpper(); }
}
// Authorization Rules
public virtual void AddAuthorizationRules(Csla.Security.AuthorizationRules rules)
{
// Needs to be overriden to add new authorization rules
}
// Validation Rules
public virtual void AddValidationRules(Csla.Validation.ValidationRules rules)
{
// Needs to be overriden to add new validation rules
}
}
//#endregion
// The follwing is a sample Extension File. You can use it to create RoleAssignmentExt.cs
//using System;
//using System.Collections.Generic;
//using System.Text;
//using Csla;
//namespace PatrialClass
//{
// public partial class RoleAssignment
// {
// partial class Extension : extensionBase
// {
// TODO: Override automatic defaults
// public virtual SmartDate DefaultStartDate
// {
// get { return DateTime.Now.ToShortDateString(); }
// }
// public virtual DateTime DefaultDts
// {
// get { return DateTime.Now; }
// }
// public virtual string DefaultUsrid
// {
// get { return Environment.UserName.ToUpper(); }
// }
// public new void AddAuthorizationRules(Csla.Security.AuthorizationRules rules)
// {
// //rules.AllowRead(Dbid, "<Role(s)>");
// }
// public new void AddValidationRules(Csla.Validation.ValidationRules rules)
// {
// rules.AddRule(
// Csla.Validation.CommonRules.StringMaxLength,
// new Csla.Validation.CommonRules.MaxLengthRuleArgs("Name", 100));
// }
// }
// }
//}
} // Class
} // Namespace

View File

@@ -0,0 +1,145 @@
// ========================================================================
// Copyright 2006 - Volian Enterprises, Inc. All rights reserved.
// Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
// ------------------------------------------------------------------------
// $Workfile: $ $Revision: $
// $Author: $ $Date: $
//
// $History: $
// ========================================================================
using System;
using System.Data;
using System.Data.SqlClient;
using Csla;
using Csla.Data;
namespace Volian.Object.Library
{
/// <summary>
/// RoleAssignments Generated by MyGeneration using the CSLA Object Mapping template
/// </summary>
[Serializable()]
public partial class RoleAssignments : BusinessListBase<RoleAssignments,RoleAssignment>
{
#region Business Methods
public RoleAssignment this[int folderid, int gid]
{
get
{
foreach (RoleAssignment assignment in this)
if (assignment.Folderid == folderid && assignment.Gid == gid)
return assignment;
return null;
}
}
public RoleAssignment GetItem(int folderid, int gid)
{
foreach (RoleAssignment assignment in this)
if (assignment.Folderid == folderid && assignment.Gid == gid)
return assignment;
return null;
}
public void Add(int gid, int folderid)
{
if (!Contains(folderid, gid))
{
RoleAssignment assignment =
RoleAssignment.New(gid, folderid);
this.Add(assignment);
}
else
throw new InvalidOperationException("assignment already exists");
}
public void Remove(int folderid, int gid)
{
foreach (RoleAssignment assignment in this)
{
if (assignment.Folderid == folderid && assignment.Gid == gid)
{
Remove(assignment);
break;
}
}
}
public bool Contains(int folderid, int gid)
{
foreach (RoleAssignment assignment in this)
if (assignment.Folderid == folderid && assignment.Gid == gid)
return true;
return false;
}
public bool ContainsDeleted(int folderid, int gid)
{
foreach (RoleAssignment assignment in DeletedList)
if (assignment.Folderid == folderid && assignment.Gid == gid)
return true;
return false;
}
#endregion
#region Factory Methods
internal static RoleAssignments New()
{
return new RoleAssignments();
}
internal static RoleAssignments Get(SafeDataReader dr)
{
return new RoleAssignments(dr);
}
private RoleAssignments()
{
MarkAsChild();
}
private RoleAssignments(SafeDataReader dr)
{
MarkAsChild();
Fetch(dr);
}
#endregion
#region Data Access Portal
// called to load data from the database
private void Fetch(SafeDataReader dr)
{
this.RaiseListChangedEvents = false;
while (dr.Read())
this.Add(RoleAssignment.Get(dr));
this.RaiseListChangedEvents = true;
}
internal void Update(Role role,SqlConnection cn)
{
this.RaiseListChangedEvents = false;
// update (thus deleting) any deleted child objects
foreach (RoleAssignment obj in DeletedList)
obj.DeleteSelf(role,cn);
// now that they are deleted, remove them from memory too
DeletedList.Clear();
// add/update any current child objects
foreach (RoleAssignment obj in this)
{
if (obj.IsNew)
obj.Insert(role,cn);
else
obj.Update(role,cn);
}
this.RaiseListChangedEvents = true;
}
#endregion
} // Class
} // Namespace

View File

@@ -0,0 +1,131 @@
// ========================================================================
// Copyright 2006 - Volian Enterprises, Inc. All rights reserved.
// Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
// ------------------------------------------------------------------------
// $Workfile: $ $Revision: $
// $Author: $ $Date: $
//
// $History: $
// ========================================================================
using System;
using System.Data;
using System.Data.SqlClient;
using Csla;
using Csla.Data;
namespace Volian.Object.Library
{
/// <summary>
/// RoleInfo Generated by MyGeneration using the CSLA Object Mapping template
/// </summary>
[Serializable()]
public partial class RoleInfo : ReadOnlyBase<RoleInfo>
{
#region Business Methods
private int _rid;
[System.ComponentModel.DataObjectField(true, true)]
public int Rid
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _rid;
}
}
private string _name=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string Name
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _name;
}
}
private string _title=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string Title
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _title;
}
}
private DateTime _dts=new DateTime();
[System.ComponentModel.DataObjectField(true, true)]
public DateTime Dts
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _dts;
}
}
private string _usrid=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string Usrid
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _usrid;
}
}
// TODO: Replace base RoleInfo.ToString function as necessary
/// <summary>
/// Overrides Base ToString
/// </summary>
/// <returns>A string representation of current RoleInfo</returns>
//public override string ToString()
//{
// return base.ToString();
//}
// TODO: Check RoleInfo.GetIdValue to assure that the ID returned is unique
/// <summary>
/// Overrides Base GetIdValue - Used internally by CSLA to determine equality
/// </summary>
/// <returns>A Unique ID for the current RoleInfo</returns>
protected override object GetIdValue()
{
return _rid;
}
#endregion
#region Factory Methods
private RoleInfo()
{ /* require use of factory methods */ }
#endregion
#region Data Access Portal
internal RoleInfo(SafeDataReader dr)
{
try
{
_rid = dr.GetInt32("RID");
_name = dr.GetString("Name");
_title = dr.GetString("Title");
_dts = dr.GetDateTime("DTS");
_usrid = dr.GetString("UsrID");
}
catch(Exception ex)
{
Database.LogException("RoleInfo",ex);
}
}
#endregion
} // Class
} // Namespace

View File

@@ -0,0 +1,78 @@
// ========================================================================
// Copyright 2006 - Volian Enterprises, Inc. All rights reserved.
// Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
// ------------------------------------------------------------------------
// $Workfile: $ $Revision: $
// $Author: $ $Date: $
//
// $History: $
// ========================================================================
using System;
using System.Data;
using System.Data.SqlClient;
using Csla;
using Csla.Data;
namespace Volian.Object.Library
{
/// <summary>
/// RoleInfoList Generated by MyGeneration using the CSLA Object Mapping template
/// </summary>
[Serializable()]
public partial class RoleInfoList : ReadOnlyListBase<RoleInfoList,RoleInfo>
{
#region Factory Methods
/// <summary>
/// Return a list of all projects.
/// </summary>
public static RoleInfoList Get()
{
return DataPortal.Fetch<RoleInfoList>(new Criteria());
}
// TODO: Add alternative gets -
//public static RoleInfoList Get(<criteria>)
//{
// return DataPortal.Fetch<RoleInfoList>(new FilteredCriteria(<criteria>));
//}
private RoleInfoList()
{ /* require use of factory methods */ }
#endregion
#region Data Access Portal
[Serializable()]
private class Criteria
{ /* no criteria - retrieve all rows */ }
private void DataPortal_Fetch(Criteria criteria)
{
this.RaiseListChangedEvents = false;
try{
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
{
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "getRoles";
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
{
IsReadOnly = false;
while (dr.Read())this.Add(new RoleInfo(dr));
IsReadOnly = true;
}
}
}
}
catch(Exception ex)
{
Database.LogException("RoleInfoList",ex);
}
this.RaiseListChangedEvents = true;
}
#endregion
} // Class
} // Namespace

View File

@@ -0,0 +1,39 @@
using System;
using System.Collections.Generic;
using System.Text;
using Csla;
namespace Volian.Object.Library
{
public partial class RolePermission : BusinessBase<RolePermission>
{
public bool ReadAccess
{
get { return ((PermValue & 1) == 1); }
set { PermValue = (value ? PermValue | 1 : PermValue ^ (PermValue & 1)); }
}
public bool WriteAccess
{
get { return ((PermValue & 2) == 2); }
set { PermValue = (value ? PermValue | 2 : PermValue ^ (PermValue & 2)); }
}
public bool CreateAccess
{
get { return ((PermValue & 4) == 4); }
set { PermValue = (value ? PermValue | 4 : PermValue ^ (PermValue & 4)); }
}
public bool DeleteAccess
{
get { return ((PermValue & 8) == 8); }
set { PermValue = (value ? PermValue | 8 : PermValue ^ (PermValue & 8)); }
}
public List<vlnValueKey> PermADLookup
{
get { return Permission.PermADLookup; }
}
public List<vlnValueKey> PermLevelLookup
{
get { return Permission.PermLevelLookup; }
}
}
}

View File

@@ -0,0 +1,541 @@
// ========================================================================
// Copyright 2006 - Volian Enterprises, Inc. All rights reserved.
// Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
// ------------------------------------------------------------------------
// $Workfile: $ $Revision: $
// $Author: $ $Date: $
//
// $History: $
// ========================================================================
using System;
using System.Data;
using System.Data.SqlClient;
using Csla;
using Csla.Data;
namespace Volian.Object.Library
{
/// <summary>
/// RolePermission Generated by MyGeneration using the CSLA Object Mapping template
/// </summary>
[Serializable()]
public partial class RolePermission : BusinessBase<RolePermission>
{
#region Business Methods
private int _pid;
[System.ComponentModel.DataObjectField(true, true)]
public int Pid
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _pid;
}
}
private int _permlevel;
/// <summary>
/// 0 - Security, 1 - System, 2 - RO, 3 - Procdures, 4 - Sections, 5 - Steps, 6 - Comments
/// </summary>
[System.ComponentModel.DataObjectField(true, true)]
public int PermLevel
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _permlevel;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (_permlevel != value)
{
_permlevel = value;
PropertyHasChanged();
}
}
}
private int _versiontype;
/// <summary>
/// 0 - Working Draft, 1 - Temporary Change, 2 Approved
/// </summary>
[System.ComponentModel.DataObjectField(true, true)]
public int VersionType
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _versiontype;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (_versiontype != value)
{
_versiontype = value;
PropertyHasChanged();
}
}
}
private int _permvalue;
/// <summary>
/// 1 - Read, 2 - Write, 4 - Create, 8 - Delete (15 - All)
/// </summary>
[System.ComponentModel.DataObjectField(true, true)]
public int PermValue
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _permvalue;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (_permvalue != value)
{
_permvalue = value;
PropertyHasChanged();
}
}
}
private int _permad;
/// <summary>
/// 0 - Allow, 1 - Deny
/// </summary>
[System.ComponentModel.DataObjectField(true, true)]
public int Permad
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _permad;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (_permad != value)
{
_permad = value;
PropertyHasChanged();
}
}
}
private string _startdate=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string StartDate
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _startdate;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (value == null) value = string.Empty;
_startdate = value;
try
{
DateTime tmp = SmartDate.StringToDate(value);
if (_startdate != tmp.ToShortDateString())
{
_startdate = tmp.ToShortDateString();
// TODO: Any Cross Property Validation
}
}
catch
{
}
PropertyHasChanged();
}
}
private string _enddate=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string EndDate
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _enddate;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (value == null) value = string.Empty;
_enddate = value;
try
{
DateTime tmp = SmartDate.StringToDate(value);
if (_enddate != tmp.ToShortDateString())
{
_enddate = tmp.ToShortDateString();
// TODO: Any Cross Property Validation
}
}
catch
{
}
PropertyHasChanged();
}
}
private DateTime _dts=new DateTime();
[System.ComponentModel.DataObjectField(true, true)]
public DateTime Dts
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _dts;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (_dts != value)
{
_dts = value;
PropertyHasChanged();
}
}
}
private string _usrid=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string Usrid
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _usrid;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (value == null) value = string.Empty;
if (_usrid != value)
{
_usrid = value;
PropertyHasChanged();
}
}
}
private byte[] _lastchanged=new byte[8];//timestamp
// TODO: Check RolePermission.GetIdValue to assure that the ID returned is unique
/// <summary>
/// Overrides Base GetIdValue - Used internally by CSLA to determine equality
/// </summary>
/// <returns>A Unique ID for the current RolePermission</returns>
protected override object GetIdValue()
{
return _pid;
}
// TODO: Replace base RolePermission.ToString function as necessary
/// <summary>
/// Overrides Base ToString
/// </summary>
/// <returns>A string representation of current RolePermission</returns>
//public override string ToString()
//{
// return base.ToString();
//}
#endregion
#region ValidationRules
protected override void AddBusinessRules()
{
ValidationRules.AddRule(StartDateValid, "StartDate");
ValidationRules.AddRule(EndDateValid, "EndDate");
ValidationRules.AddRule(
Csla.Validation.CommonRules.StringMaxLength,
new Csla.Validation.CommonRules.MaxLengthRuleArgs("Usrid", 100));
// TODO: Add other validation rules
}
private bool StartDateValid(object target, Csla.Validation.RuleArgs e)
{
try
{
DateTime tmp = SmartDate.StringToDate(_startdate);
}
catch
{
e.Description="Invalid Date";
return false;
}
return true;
}
private bool EndDateValid(object target, Csla.Validation.RuleArgs e)
{
try
{
DateTime tmp = SmartDate.StringToDate(_enddate);
}
catch
{
e.Description="Invalid Date";
return false;
}
return true;
}
// Sample data comparison validation rule
//private bool StartDateGTEndDate(object target, Csla.Validation.RuleArgs e)
//{
// if (_started > _ended)
// {
// e.Description = "Start date can't be after end date";
// return false;
// }
// else
// return true;
//}
#endregion
#region Authorization Rules
protected override void AddAuthorizationRules()
{
//TODO: Who can read/write which fields
//AuthorizationRules.AllowRead(Pid, "<Role(s)>");
//AuthorizationRules.AllowRead(PermLevel, "<Role(s)>");
//AuthorizationRules.AllowWrite(PermLevel, "<Role(s)>");
//AuthorizationRules.AllowRead(VersionType, "<Role(s)>");
//AuthorizationRules.AllowWrite(VersionType, "<Role(s)>");
//AuthorizationRules.AllowRead(PermValue, "<Role(s)>");
//AuthorizationRules.AllowWrite(PermValue, "<Role(s)>");
//AuthorizationRules.AllowRead(Permad, "<Role(s)>");
//AuthorizationRules.AllowWrite(Permad, "<Role(s)>");
//AuthorizationRules.AllowRead(StartDate, "<Role(s)>");
//AuthorizationRules.AllowWrite(StartDate, "<Role(s)>");
//AuthorizationRules.AllowRead(EndDate, "<Role(s)>");
//AuthorizationRules.AllowWrite(EndDate, "<Role(s)>");
//AuthorizationRules.AllowRead(Dts, "<Role(s)>");
//AuthorizationRules.AllowWrite(Dts, "<Role(s)>");
//AuthorizationRules.AllowRead(Usrid, "<Role(s)>");
//AuthorizationRules.AllowWrite(Usrid, "<Role(s)>");
}
public static bool CanAddObject()
{
// TODO: Can Add Authorization
//return Csla.ApplicationContext.User.IsInRole("ProjectManager");
return true;
}
public static bool CanGetObject()
{
// TODO: CanGet Authorization
return true;
}
public static bool CanDeleteObject()
{
// TODO: CanDelete Authorization
//bool result = false;
//if (Csla.ApplicationContext.User.IsInRole("ProjectManager"))result = true;
//if (Csla.ApplicationContext.User.IsInRole("Administrator"))result = true;
//return result;
return true;
}
public static bool CanEditObject()
{
// TODO: CanEdit Authorization
//return Csla.ApplicationContext.User.IsInRole("ProjectManager");
return true;
}
#endregion
#region Factory Methods
internal static RolePermission New(int permlevel, int versiontype, int permvalue)
{
return new RolePermission(permlevel, versiontype, permvalue);
}
internal static RolePermission Get(SafeDataReader dr)
{
return new RolePermission(dr);
}
private RolePermission()
{
MarkAsChild();
_permad = ext.DefaultPermad;
_startdate = ext.DefaultStartDate;
_dts = ext.DefaultDts;
_usrid = ext.DefaultUsrid;
}
private RolePermission(int permlevel, int versiontype, int permvalue)
{
MarkAsChild();
// TODO: Add any initialization & defaults
_permad = ext.DefaultPermad;
_startdate = ext.DefaultStartDate;
_dts = ext.DefaultDts;
_usrid = ext.DefaultUsrid;
_permlevel = permlevel;
_versiontype = versiontype;
_permvalue = permvalue;
}
private RolePermission(SafeDataReader dr)
{
MarkAsChild();
Fetch(dr);
}
#endregion
#region Data Access Portal
private void Fetch(SafeDataReader dr)
{
try{
_pid = dr.GetInt32("PID");
_permlevel = dr.GetInt32("PermLevel");
_versiontype = dr.GetInt32("VersionType");
_permvalue = dr.GetInt32("PermValue");
_permad = dr.GetInt32("PermAD");
_startdate = dr.GetSmartDate("StartDate").Text;
_enddate = dr.GetSmartDate("EndDate").Text;
_dts = dr.GetDateTime("DTS");
_usrid = dr.GetString("UsrID");
dr.GetBytes("LastChanged", 0, _lastchanged, 0, 8);
}
catch(Exception ex)
{
Database.LogException("RolePermission",ex);
}
MarkOld();
}
internal void Insert(Role role,SqlConnection cn)
{
// if we're not dirty then don't update the database
if (!this.IsDirty) return;
_lastchanged=Permission.Add(cn, ref _pid, role.Rid, _permlevel, _versiontype, _permvalue, _permad, new SmartDate(_startdate), new SmartDate(_enddate), _dts, _usrid);
MarkOld();
}
internal void Update(Role role,SqlConnection cn)
{
// if we're not dirty then don't update the database
if (!this.IsDirty) return;
_lastchanged=Permission.Update(cn, ref _pid, role.Rid, _permlevel, _versiontype, _permvalue, _permad, new SmartDate(_startdate), new SmartDate(_enddate), _dts, _usrid, ref _lastchanged);
}
internal void DeleteSelf(Role role,SqlConnection cn)
{
// if we're not dirty then don't update the database
if (!this.IsDirty) return;
// if we're new then don't update the database
if (this.IsNew) return;
Permission.Remove(cn,_pid);
MarkNew();
}
#endregion
// Standard Default Code
// #region extension
Extension ext = new Extension();
[Serializable()]
partial class Extension : extensionBase
{
}
[Serializable()]
class extensionBase
{
// Default Values
public virtual int DefaultPermad
{
get { return 0; }
}
public virtual string DefaultStartDate
{
get { return DateTime.Now.ToShortDateString(); }
}
public virtual DateTime DefaultDts
{
get { return DateTime.Now; }
}
public virtual string DefaultUsrid
{
get { return Environment.UserName.ToUpper(); }
}
// Authorization Rules
public virtual void AddAuthorizationRules(Csla.Security.AuthorizationRules rules)
{
// Needs to be overriden to add new authorization rules
}
// Validation Rules
public virtual void AddValidationRules(Csla.Validation.ValidationRules rules)
{
// Needs to be overriden to add new validation rules
}
}
//#endregion
// The follwing is a sample Extension File. You can use it to create RolePermissionExt.cs
//using System;
//using System.Collections.Generic;
//using System.Text;
//using Csla;
//namespace PatrialClass
//{
// public partial class RolePermission
// {
// partial class Extension : extensionBase
// {
// TODO: Override automatic defaults
// public virtual int DefaultPermad
// {
// get { return 0; }
// }
// public virtual SmartDate DefaultStartDate
// {
// get { return DateTime.Now.ToShortDateString(); }
// }
// public virtual DateTime DefaultDts
// {
// get { return DateTime.Now; }
// }
// public virtual string DefaultUsrid
// {
// get { return Environment.UserName.ToUpper(); }
// }
// public new void AddAuthorizationRules(Csla.Security.AuthorizationRules rules)
// {
// //rules.AllowRead(Dbid, "<Role(s)>");
// }
// public new void AddValidationRules(Csla.Validation.ValidationRules rules)
// {
// rules.AddRule(
// Csla.Validation.CommonRules.StringMaxLength,
// new Csla.Validation.CommonRules.MaxLengthRuleArgs("Name", 100));
// }
// }
// }
//}
} // Class
} // Namespace

View File

@@ -0,0 +1,54 @@
using System;
using System.Collections.Generic;
using System.Text;
using Csla;
namespace Volian.Object.Library
{
public partial class RolePermission : BusinessBase<RolePermission>
{
public static RolePermission New()
{
return new RolePermission(1, 1, 1);
}
public bool ReadAccess
{
get { return ((PermValue & 1) == 1); }
set { PermValue = (value ? PermValue | 1 : PermValue ^ (PermValue & 1)); }
}
public bool WriteAccess
{
get { return ((PermValue & 2) == 2); }
set { PermValue = (value ? PermValue | 2 : PermValue ^ (PermValue & 2)); }
}
public bool CreateAccess
{
get { return ((PermValue & 4) == 4); }
set { PermValue = (value ? PermValue | 4 : PermValue ^ (PermValue & 4)); }
}
public bool DeleteAccess
{
get { return ((PermValue & 8) == 8); }
set { PermValue = (value ? PermValue | 8 : PermValue ^ (PermValue & 8)); }
}
public List<vlnValueKey> PermADLookup
{
get { return Permission.PermADLookup; }
}
public List<vlnValueKey> PermLevelLookup
{
get { return Permission.PermLevelLookup; }
}
}
public class PermLookup
{
public List<vlnValueKey> PermADLookup
{
get { return Permission.PermADLookup; }
}
public List<vlnValueKey> PermLevelLookup
{
get { return Permission.PermLevelLookup; }
}
}
}

View File

@@ -0,0 +1,85 @@
// ========================================================================
// Copyright 2006 - Volian Enterprises, Inc. All rights reserved.
// Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
// ------------------------------------------------------------------------
// $Workfile: $ $Revision: $
// $Author: $ $Date: $
//
// $History: $
// ========================================================================
using System;
using System.Data;
using System.Data.SqlClient;
using Csla;
using Csla.Data;
namespace Volian.Object.Library
{
/// <summary>
/// RolePermissions Generated by MyGeneration using the CSLA Object Mapping template
/// </summary>
[Serializable()]
public partial class RolePermissions : BusinessListBase<RolePermissions,RolePermission>
{
// No Columns to retrieve
#region Factory Methods
internal static RolePermissions New()
{
return new RolePermissions();
}
internal static RolePermissions Get(SafeDataReader dr)
{
return new RolePermissions(dr);
}
private RolePermissions()
{
MarkAsChild();
}
private RolePermissions(SafeDataReader dr)
{
MarkAsChild();
Fetch(dr);
}
#endregion
#region Data Access Portal
// called to load data from the database
private void Fetch(SafeDataReader dr)
{
this.RaiseListChangedEvents = false;
while (dr.Read())
this.Add(RolePermission.Get(dr));
this.RaiseListChangedEvents = true;
}
internal void Update(Role role,SqlConnection cn)
{
this.RaiseListChangedEvents = false;
// update (thus deleting) any deleted child objects
foreach (RolePermission obj in DeletedList)
obj.DeleteSelf(role,cn);
// now that they are deleted, remove them from memory too
DeletedList.Clear();
// add/update any current child objects
foreach (RolePermission obj in this)
{
if (obj.IsNew)
obj.Insert(role,cn);
else
obj.Update(role,cn);
}
this.RaiseListChangedEvents = true;
}
#endregion
} // Class
} // Namespace

View File

@@ -0,0 +1,963 @@
// ========================================================================
// Copyright 2006 - Volian Enterprises, Inc. All rights reserved.
// Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
// ------------------------------------------------------------------------
// $Workfile: $ $Revision: $
// $Author: $ $Date: $
//
// $History: $
// ========================================================================
using System;
using System.Data;
using System.Data.SqlClient;
using Csla;
using Csla.Data;
namespace Volian.Object.Library
{
/// <summary>
/// User Generated by MyGeneration using the CSLA Object Mapping template
/// </summary>
[Serializable()]
public partial class User : BusinessBase<User>
{
#region Business Methods
private int _uid;
[System.ComponentModel.DataObjectField(true, true)]
public int Uid
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _uid;
}
}
private string _userid=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string Userid
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _userid;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (value == null) value = string.Empty;
if (_userid != value)
{
_userid = value;
PropertyHasChanged();
}
}
}
private string _firstname=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string FirstName
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _firstname;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (value == null) value = string.Empty;
if (_firstname != value)
{
_firstname = value;
PropertyHasChanged();
}
}
}
private string _middlename=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string MiddleName
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _middlename;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (value == null) value = string.Empty;
if (_middlename != value)
{
_middlename = value;
PropertyHasChanged();
}
}
}
private string _lastname=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string LastName
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _lastname;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (value == null) value = string.Empty;
if (_lastname != value)
{
_lastname = value;
PropertyHasChanged();
}
}
}
private string _suffix=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string Suffix
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _suffix;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (value == null) value = string.Empty;
if (_suffix != value)
{
_suffix = value;
PropertyHasChanged();
}
}
}
private string _courtesytitle=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string CourtesyTitle
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _courtesytitle;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (value == null) value = string.Empty;
if (_courtesytitle != value)
{
_courtesytitle = value;
PropertyHasChanged();
}
}
}
private string _phonenumber=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string PhoneNumber
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _phonenumber;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (value == null) value = string.Empty;
if (_phonenumber != value)
{
_phonenumber = value;
PropertyHasChanged();
}
}
}
private string _cfgname=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string CfgName
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _cfgname;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (value == null) value = string.Empty;
if (_cfgname != value)
{
_cfgname = value;
PropertyHasChanged();
}
}
}
private string _userlogin=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string UserLogin
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _userlogin;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (value == null) value = string.Empty;
if (_userlogin != value)
{
_userlogin = value;
PropertyHasChanged();
}
}
}
private string _username=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string UserName
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _username;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (value == null) value = string.Empty;
if (_username != value)
{
_username = value;
PropertyHasChanged();
}
}
}
private string _config=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string Config
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _config;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (value == null) value = string.Empty;
if (_config != value)
{
_config = value;
PropertyHasChanged();
}
}
}
private DateTime _dts=new DateTime();
[System.ComponentModel.DataObjectField(true, true)]
public DateTime Dts
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _dts;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (_dts != value)
{
_dts = value;
PropertyHasChanged();
}
}
}
private string _usrid=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string Usrid
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _usrid;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (value == null) value = string.Empty;
if (_usrid != value)
{
_usrid = value;
PropertyHasChanged();
}
}
}
private byte[] _lastchanged=new byte[8];//timestamp
private UserMemberships _usermemberships = UserMemberships.New();
/// <summary>
/// Related Field
/// </summary>
[System.ComponentModel.DataObjectField(true, true)]
public UserMemberships UserMemberships
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _usermemberships;
}
}
public override bool IsDirty
{
get { return base.IsDirty || _usermemberships.IsDirty ; }
}
public override bool IsValid
{
get { return base.IsValid && _usermemberships.IsValid ; }
}
// TODO: Replace base User.ToString function as necessary
/// <summary>
/// Overrides Base ToString
/// </summary>
/// <returns>A string representation of current User</returns>
//public override string ToString()
//{
// return base.ToString();
//}
// TODO: Check User.GetIdValue to assure that the ID returned is unique
/// <summary>
/// Overrides Base GetIdValue - Used internally by CSLA to determine equality
/// </summary>
/// <returns>A Unique ID for the current User</returns>
protected override object GetIdValue()
{
return _uid;
}
#endregion
#region ValidationRules
protected override void AddBusinessRules()
{
ValidationRules.AddRule(
Csla.Validation.CommonRules.StringMaxLength,
new Csla.Validation.CommonRules.MaxLengthRuleArgs("Userid", 100));
ValidationRules.AddRule(
Csla.Validation.CommonRules.StringMaxLength,
new Csla.Validation.CommonRules.MaxLengthRuleArgs("FirstName", 50));
ValidationRules.AddRule(
Csla.Validation.CommonRules.StringMaxLength,
new Csla.Validation.CommonRules.MaxLengthRuleArgs("MiddleName", 50));
ValidationRules.AddRule(
Csla.Validation.CommonRules.StringMaxLength,
new Csla.Validation.CommonRules.MaxLengthRuleArgs("LastName", 50));
ValidationRules.AddRule(
Csla.Validation.CommonRules.StringMaxLength,
new Csla.Validation.CommonRules.MaxLengthRuleArgs("Suffix", 10));
ValidationRules.AddRule(
Csla.Validation.CommonRules.StringMaxLength,
new Csla.Validation.CommonRules.MaxLengthRuleArgs("CourtesyTitle", 10));
ValidationRules.AddRule(
Csla.Validation.CommonRules.StringMaxLength,
new Csla.Validation.CommonRules.MaxLengthRuleArgs("PhoneNumber", 30));
ValidationRules.AddRule(
Csla.Validation.CommonRules.StringMaxLength,
new Csla.Validation.CommonRules.MaxLengthRuleArgs("CfgName", 8));
ValidationRules.AddRule(
Csla.Validation.CommonRules.StringMaxLength,
new Csla.Validation.CommonRules.MaxLengthRuleArgs("UserLogin", 10));
ValidationRules.AddRule(
Csla.Validation.CommonRules.StringMaxLength,
new Csla.Validation.CommonRules.MaxLengthRuleArgs("UserName", 32));
ValidationRules.AddRule(
Csla.Validation.CommonRules.StringMaxLength,
new Csla.Validation.CommonRules.MaxLengthRuleArgs("Config", 1073741823));
ValidationRules.AddRule(
Csla.Validation.CommonRules.StringMaxLength,
new Csla.Validation.CommonRules.MaxLengthRuleArgs("Usrid", 100));
ext.AddValidationRules(ValidationRules);
// TODO: Add other validation rules
// ValidationRules.AddRule(StartDateGTEndDate, "Started");
}
// Sample data comparison validation rule
//private bool StartDateGTEndDate(object target, Csla.Validation.RuleArgs e)
//{
// if (_started > _ended)
// {
// e.Description = "Start date can't be after end date";
// return false;
// }
// else
// return true;
//}
#endregion
#region Authorization Rules
protected override void AddAuthorizationRules()
{
//TODO: Who can read/write which fields
//AuthorizationRules.AllowRead(Uid, "<Role(s)>");
//AuthorizationRules.AllowRead(Userid, "<Role(s)>");
//AuthorizationRules.AllowRead(FirstName, "<Role(s)>");
//AuthorizationRules.AllowRead(MiddleName, "<Role(s)>");
//AuthorizationRules.AllowRead(LastName, "<Role(s)>");
//AuthorizationRules.AllowRead(Suffix, "<Role(s)>");
//AuthorizationRules.AllowRead(CourtesyTitle, "<Role(s)>");
//AuthorizationRules.AllowRead(PhoneNumber, "<Role(s)>");
//AuthorizationRules.AllowRead(CfgName, "<Role(s)>");
//AuthorizationRules.AllowRead(UserLogin, "<Role(s)>");
//AuthorizationRules.AllowRead(UserName, "<Role(s)>");
//AuthorizationRules.AllowRead(Config, "<Role(s)>");
//AuthorizationRules.AllowRead(Dts, "<Role(s)>");
//AuthorizationRules.AllowRead(Usrid, "<Role(s)>");
//AuthorizationRules.AllowWrite(Userid, "<Role(s)>");
//AuthorizationRules.AllowWrite(FirstName, "<Role(s)>");
//AuthorizationRules.AllowWrite(MiddleName, "<Role(s)>");
//AuthorizationRules.AllowWrite(LastName, "<Role(s)>");
//AuthorizationRules.AllowWrite(Suffix, "<Role(s)>");
//AuthorizationRules.AllowWrite(CourtesyTitle, "<Role(s)>");
//AuthorizationRules.AllowWrite(PhoneNumber, "<Role(s)>");
//AuthorizationRules.AllowWrite(CfgName, "<Role(s)>");
//AuthorizationRules.AllowWrite(UserLogin, "<Role(s)>");
//AuthorizationRules.AllowWrite(UserName, "<Role(s)>");
//AuthorizationRules.AllowWrite(Config, "<Role(s)>");
//AuthorizationRules.AllowWrite(Dts, "<Role(s)>");
//AuthorizationRules.AllowWrite(Usrid, "<Role(s)>");
ext.AddAuthorizationRules(AuthorizationRules);
}
public static bool CanAddObject()
{
// TODO: Can Add Authorization
//return Csla.ApplicationContext.User.IsInRole("ProjectManager");
return true;
}
public static bool CanGetObject()
{
// TODO: CanGet Authorization
return true;
}
public static bool CanDeleteObject()
{
// TODO: CanDelete Authorization
//bool result = false;
//if (Csla.ApplicationContext.User.IsInRole("ProjectManager"))result = true;
//if (Csla.ApplicationContext.User.IsInRole("Administrator"))result = true;
//return result;
return true;
}
public static bool CanEditObject()
{
// TODO: CanEdit Authorization
//return Csla.ApplicationContext.User.IsInRole("ProjectManager");
return true;
}
#endregion
#region Factory Methods
private User()
{/* require use of factory methods */}
public static User New()
{
if (!CanAddObject())
throw new System.Security.SecurityException("User not authorized to add a User");
return DataPortal.Create<User>();
}
public static User Get(int _uid)
{
if (!CanGetObject())
throw new System.Security.SecurityException("User not authorized to view a User");
return DataPortal.Fetch<User>(new PKCriteria(_uid));
}
public static void Delete(int _uid)
{
if (!CanDeleteObject())
throw new System.Security.SecurityException("User not authorized to remove a User");
DataPortal.Delete(new PKCriteria(_uid));
}
public override User Save()
{
if (IsDeleted && !CanDeleteObject())
throw new System.Security.SecurityException("User not authorized to remove a User");
else if (IsNew && !CanAddObject())
throw new System.Security.SecurityException("User not authorized to add a User");
else if (!CanEditObject())
throw new System.Security.SecurityException("User not authorized to update a User");
return base.Save();
}
#endregion
#region Data Access Portal
[Serializable()]
private class PKCriteria
{
private int _uid;
public int Uid
{ get {return _uid;}}
public PKCriteria(int uid)
{
_uid=uid;
}
}
// If Create needs to access DB - It should not be marked RunLocal
[RunLocal()]
private new void DataPortal_Create(object criteria)
{
// Database Defaults
_userid = ext.DefaultUserid;
_dts = ext.DefaultDts;
_usrid = ext.DefaultUsrid;
// TODO: Add any defaults that are necessary
ValidationRules.CheckRules();
}
private void DataPortal_Fetch(PKCriteria criteria)
{
try{
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
{
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "getUser";
cm.Parameters.AddWithValue("@uID", criteria.Uid);
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
{
dr.Read();
_uid = dr.GetInt32("UID");
_userid = dr.GetString("UserID");
_firstname = dr.GetString("FirstName");
_middlename = dr.GetString("MiddleName");
_lastname = dr.GetString("LastName");
_suffix = dr.GetString("Suffix");
_courtesytitle = dr.GetString("CourtesyTitle");
_phonenumber = dr.GetString("PhoneNumber");
_cfgname = dr.GetString("CFGName");
_userlogin = dr.GetString("UserLogin");
_username = dr.GetString("UserName");
_config = dr.GetString("Config");
_dts = dr.GetDateTime("DTS");
_usrid = dr.GetString("UsrID");
dr.GetBytes("LastChanged", 0, _lastchanged, 0, 8);
// load child objects
dr.NextResult();
_usermemberships = UserMemberships.Get(dr);
}
}
}
}
catch(Exception ex)
{
Database.LogException("User",ex);
}
}
[Transactional(TransactionalTypes.TransactionScope)]
protected override void DataPortal_Insert()
{
try{
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
{
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "addUser";
// Input All Fields - Except Calculated Columns
cm.Parameters.AddWithValue("@userID", _userid);
cm.Parameters.AddWithValue("@firstName", _firstname);
cm.Parameters.AddWithValue("@middleName", _middlename);
cm.Parameters.AddWithValue("@lastName", _lastname);
cm.Parameters.AddWithValue("@suffix", _suffix);
cm.Parameters.AddWithValue("@courtesyTitle", _courtesytitle);
cm.Parameters.AddWithValue("@phoneNumber", _phonenumber);
cm.Parameters.AddWithValue("@cFGName", _cfgname);
cm.Parameters.AddWithValue("@userLogin", _userlogin);
cm.Parameters.AddWithValue("@userName", _username);
cm.Parameters.AddWithValue("@config", _config);
cm.Parameters.AddWithValue("@dTS", _dts);
cm.Parameters.AddWithValue("@usrID", _usrid);
// Output Calculated Columns
SqlParameter param_uid = new SqlParameter("@newUID",SqlDbType.Int);
param_uid.Direction = ParameterDirection.Output;
cm.Parameters.Add(param_uid);
SqlParameter param_lastchanged = new SqlParameter("@newLastChanged",SqlDbType.Timestamp);
param_lastchanged.Direction = ParameterDirection.Output;
cm.Parameters.Add(param_lastchanged);
// TODO: Define any additional output parameters
cm.ExecuteNonQuery();
// Save all values being returned from the Procedure
_uid = (int)cm.Parameters["@newUID"].Value;
_lastchanged = (byte[])cm.Parameters["@newLastChanged"].Value;
}
// update child objects
_usermemberships.Update(this,cn);
}
}
catch(Exception ex)
{
Database.LogException("User",ex);
}}
[Transactional(TransactionalTypes.TransactionScope)]
public static byte[] Add(SqlConnection cn,ref int uid, string userid, string firstname, string middlename, string lastname, string suffix, string courtesytitle, string phonenumber, string cfgname, string userlogin, string username, string config, DateTime dts, string usrid)
{
try{
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "addUser";
// Input All Fields - Except Calculated Columns
cm.Parameters.AddWithValue("@userID", userid);
cm.Parameters.AddWithValue("@firstName", firstname);
cm.Parameters.AddWithValue("@middleName", middlename);
cm.Parameters.AddWithValue("@lastName", lastname);
cm.Parameters.AddWithValue("@suffix", suffix);
cm.Parameters.AddWithValue("@courtesyTitle", courtesytitle);
cm.Parameters.AddWithValue("@phoneNumber", phonenumber);
cm.Parameters.AddWithValue("@cFGName", cfgname);
cm.Parameters.AddWithValue("@userLogin", userlogin);
cm.Parameters.AddWithValue("@userName", username);
cm.Parameters.AddWithValue("@config", config);
cm.Parameters.AddWithValue("@dTS", dts);
cm.Parameters.AddWithValue("@usrID", usrid);
// Output Calculated Columns
SqlParameter param_uid = new SqlParameter("@newUID",SqlDbType.Int);
param_uid.Direction = ParameterDirection.Output;
cm.Parameters.Add(param_uid);
SqlParameter param_lastchanged = new SqlParameter("@newLastChanged",SqlDbType.Timestamp);
param_lastchanged.Direction = ParameterDirection.Output;
cm.Parameters.Add(param_lastchanged);
// TODO: Define any additional output parameters
cm.ExecuteNonQuery();
// Save all values being returned from the Procedure
uid = (int)cm.Parameters["@newUID"].Value;
return (byte[])cm.Parameters["@newLastChanged"].Value;
}
}
catch(Exception ex)
{
Database.LogException("User",ex);
return null;
}
}
[Transactional(TransactionalTypes.TransactionScope)]
protected override void DataPortal_Update()
{
if (IsDirty)// If this is dirty - open the connection
{
try{
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
{
if(base.IsDirty)
{
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "updateUser";
// All Fields including Calculated Fields
cm.Parameters.AddWithValue("@uID", _uid);
cm.Parameters.AddWithValue("@userID", _userid);
cm.Parameters.AddWithValue("@firstName", _firstname);
cm.Parameters.AddWithValue("@middleName", _middlename);
cm.Parameters.AddWithValue("@lastName", _lastname);
cm.Parameters.AddWithValue("@suffix", _suffix);
cm.Parameters.AddWithValue("@courtesyTitle", _courtesytitle);
cm.Parameters.AddWithValue("@phoneNumber", _phonenumber);
cm.Parameters.AddWithValue("@cFGName", _cfgname);
cm.Parameters.AddWithValue("@userLogin", _userlogin);
cm.Parameters.AddWithValue("@userName", _username);
cm.Parameters.AddWithValue("@config", _config);
cm.Parameters.AddWithValue("@dTS", _dts);
cm.Parameters.AddWithValue("@usrID", _usrid);
cm.Parameters.AddWithValue("@lastChanged", _lastchanged);
// Output Calculated Columns
SqlParameter param_lastchanged = new SqlParameter("@newLastChanged",SqlDbType.Timestamp);
param_lastchanged.Direction = ParameterDirection.Output;
cm.Parameters.Add(param_lastchanged);
// TODO: Define any additional output parameters
cm.ExecuteNonQuery();
// Save all values being returned from the Procedure
_lastchanged = (byte[])cm.Parameters["@newLastChanged"].Value;
}
}
// use the open connection to update child objects
_usermemberships.Update(this,cn);
}
}
catch(Exception ex)
{
Database.LogException("User",ex);
}
}
}
[Transactional(TransactionalTypes.TransactionScope)]
public static byte[] Update(SqlConnection cn,ref int uid, string userid, string firstname, string middlename, string lastname, string suffix, string courtesytitle, string phonenumber, string cfgname, string userlogin, string username, string config, DateTime dts, string usrid, ref byte[] lastchanged)
{
try{
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "updateUser";
// Input All Fields - Except Calculated Columns
cm.Parameters.AddWithValue("@uID", uid);
cm.Parameters.AddWithValue("@userID", userid);
cm.Parameters.AddWithValue("@firstName", firstname);
cm.Parameters.AddWithValue("@middleName", middlename);
cm.Parameters.AddWithValue("@lastName", lastname);
cm.Parameters.AddWithValue("@suffix", suffix);
cm.Parameters.AddWithValue("@courtesyTitle", courtesytitle);
cm.Parameters.AddWithValue("@phoneNumber", phonenumber);
cm.Parameters.AddWithValue("@cFGName", cfgname);
cm.Parameters.AddWithValue("@userLogin", userlogin);
cm.Parameters.AddWithValue("@userName", username);
cm.Parameters.AddWithValue("@config", config);
cm.Parameters.AddWithValue("@dTS", dts);
cm.Parameters.AddWithValue("@usrID", usrid);
cm.Parameters.AddWithValue("@lastChanged", lastchanged);
// Output Calculated Columns
SqlParameter param_lastchanged = new SqlParameter("@newLastChanged",SqlDbType.Timestamp);
param_lastchanged.Direction = ParameterDirection.Output;
cm.Parameters.Add(param_lastchanged);
// TODO: Define any additional output parameters
cm.ExecuteNonQuery();
// Save all values being returned from the Procedure
return (byte[])cm.Parameters["@newLastChanged"].Value;
}
}
catch(Exception ex)
{
Database.LogException("User",ex);
return null;
}
}
[Transactional(TransactionalTypes.TransactionScope)]
protected override void DataPortal_DeleteSelf()
{
DataPortal_Delete(new PKCriteria(_uid));
}
[Transactional(TransactionalTypes.TransactionScope)]
private void DataPortal_Delete(PKCriteria criteria)
{
try{
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
{
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "deleteUser";
cm.Parameters.AddWithValue("@uID", criteria.Uid);
cm.ExecuteNonQuery();
}
}
}
catch(Exception ex)
{
Database.LogException("User",ex);
}
}
[Transactional(TransactionalTypes.TransactionScope)]
public static void Remove(SqlConnection cn,int uid)
{
try{
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "deleteUser";
// Input PK Fields
cm.Parameters.AddWithValue("@uID", uid);
// TODO: Define any additional output parameters
cm.ExecuteNonQuery();
}
}
catch(Exception ex)
{
Database.LogException("User",ex);
}
}
#endregion
#region Exists
public static bool Exists(int uid)
{
ExistsCommand result;
result = DataPortal.Execute<ExistsCommand>
(new ExistsCommand(uid));
return result.Exists;
}
[Serializable()]
private class ExistsCommand : CommandBase
{
private int _uid;
private bool _exists;
public bool Exists
{
get { return _exists; }
}
public ExistsCommand(int uid)
{
_uid=uid;
}
protected override void DataPortal_Execute()
{
try{
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
{
cn.Open();
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "existsUser";
cm.Parameters.AddWithValue("@uID", _uid);
int count = (int)cm.ExecuteScalar();
_exists = (count > 0);
}
}
}
catch(Exception ex)
{
Database.LogException("User",ex);
}
}
}
#endregion
// Standard Default Code
// #region extension
Extension ext = new Extension();
[Serializable()]
partial class Extension : extensionBase
{
}
[Serializable()]
class extensionBase
{
// Default Values
public virtual string DefaultUserid
{
get { return Environment.UserName.ToUpper(); }
}
public virtual DateTime DefaultDts
{
get { return DateTime.Now; }
}
public virtual string DefaultUsrid
{
get { return Environment.UserName.ToUpper(); }
}
// Authorization Rules
public virtual void AddAuthorizationRules(Csla.Security.AuthorizationRules rules)
{
// Needs to be overriden to add new authorization rules
}
// Validation Rules
public virtual void AddValidationRules(Csla.Validation.ValidationRules rules)
{
// Needs to be overriden to add new validation rules
}
}
//#endregion
// The follwing is a sample Extension File. You can use it to create UserExt.cs
//using System;
//using System.Collections.Generic;
//using System.Text;
//using Csla;
//namespace PatrialClass
//{
// public partial class User
// {
// partial class Extension : extensionBase
// {
// TODO: Override automatic defaults
// public virtual string DefaultUserid
// {
// get { return Environment.UserName.ToUpper(); }
// }
// public virtual DateTime DefaultDts
// {
// get { return DateTime.Now; }
// }
// public virtual string DefaultUsrid
// {
// get { return Environment.UserName.ToUpper(); }
// }
// public new void AddAuthorizationRules(Csla.Security.AuthorizationRules rules)
// {
// //rules.AllowRead(Dbid, "<Role(s)>");
// }
// public new void AddValidationRules(Csla.Validation.ValidationRules rules)
// {
// rules.AddRule(
// Csla.Validation.CommonRules.StringMaxLength,
// new Csla.Validation.CommonRules.MaxLengthRuleArgs("Name", 100));
// }
// }
// }
//}
} // Class
} // Namespace

View File

@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Text;
using Csla;
namespace Volian.Object.Library
{
public partial class User : BusinessBase<User>
{
public string FullName
{
get { return LastName + ", " + FirstName; }
}
}
}

View File

@@ -0,0 +1,239 @@
// ========================================================================
// Copyright 2006 - Volian Enterprises, Inc. All rights reserved.
// Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
// ------------------------------------------------------------------------
// $Workfile: $ $Revision: $
// $Author: $ $Date: $
//
// $History: $
// ========================================================================
using System;
using System.Data;
using System.Data.SqlClient;
using Csla;
using Csla.Data;
namespace Volian.Object.Library
{
/// <summary>
/// UserInfo Generated by MyGeneration using the CSLA Object Mapping template
/// </summary>
[Serializable()]
public partial class UserInfo : ReadOnlyBase<UserInfo>
{
#region Business Methods
private int _uid;
[System.ComponentModel.DataObjectField(true, true)]
public int Uid
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _uid;
}
}
private string _userid=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string Userid
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _userid;
}
}
private string _firstname=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string FirstName
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _firstname;
}
}
private string _middlename=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string MiddleName
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _middlename;
}
}
private string _lastname=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string LastName
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _lastname;
}
}
private string _suffix=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string Suffix
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _suffix;
}
}
private string _courtesytitle=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string CourtesyTitle
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _courtesytitle;
}
}
private string _phonenumber=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string PhoneNumber
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _phonenumber;
}
}
private string _cfgname=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string CfgName
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _cfgname;
}
}
private string _userlogin=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string UserLogin
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _userlogin;
}
}
private string _username=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string UserName
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _username;
}
}
private string _config=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string Config
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _config;
}
}
private DateTime _dts=new DateTime();
[System.ComponentModel.DataObjectField(true, true)]
public DateTime Dts
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _dts;
}
}
private string _usrid=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string Usrid
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _usrid;
}
}
// TODO: Replace base UserInfo.ToString function as necessary
/// <summary>
/// Overrides Base ToString
/// </summary>
/// <returns>A string representation of current UserInfo</returns>
//public override string ToString()
//{
// return base.ToString();
//}
// TODO: Check UserInfo.GetIdValue to assure that the ID returned is unique
/// <summary>
/// Overrides Base GetIdValue - Used internally by CSLA to determine equality
/// </summary>
/// <returns>A Unique ID for the current UserInfo</returns>
protected override object GetIdValue()
{
return _uid;
}
#endregion
#region Factory Methods
private UserInfo()
{ /* require use of factory methods */ }
#endregion
#region Data Access Portal
internal UserInfo(SafeDataReader dr)
{
try
{
_uid = dr.GetInt32("UID");
_userid = dr.GetString("UserID");
_firstname = dr.GetString("FirstName");
_middlename = dr.GetString("MiddleName");
_lastname = dr.GetString("LastName");
_suffix = dr.GetString("Suffix");
_courtesytitle = dr.GetString("CourtesyTitle");
_phonenumber = dr.GetString("PhoneNumber");
_cfgname = dr.GetString("CFGName");
_userlogin = dr.GetString("UserLogin");
_username = dr.GetString("UserName");
_config = dr.GetString("Config");
_dts = dr.GetDateTime("DTS");
_usrid = dr.GetString("UsrID");
}
catch(Exception ex)
{
Database.LogException("UserInfo",ex);
}
}
#endregion
} // Class
} // Namespace

View File

@@ -0,0 +1,78 @@
// ========================================================================
// Copyright 2006 - Volian Enterprises, Inc. All rights reserved.
// Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
// ------------------------------------------------------------------------
// $Workfile: $ $Revision: $
// $Author: $ $Date: $
//
// $History: $
// ========================================================================
using System;
using System.Data;
using System.Data.SqlClient;
using Csla;
using Csla.Data;
namespace Volian.Object.Library
{
/// <summary>
/// UserInfoList Generated by MyGeneration using the CSLA Object Mapping template
/// </summary>
[Serializable()]
public partial class UserInfoList : ReadOnlyListBase<UserInfoList,UserInfo>
{
#region Factory Methods
/// <summary>
/// Return a list of all projects.
/// </summary>
public static UserInfoList Get()
{
return DataPortal.Fetch<UserInfoList>(new Criteria());
}
// TODO: Add alternative gets -
//public static UserInfoList Get(<criteria>)
//{
// return DataPortal.Fetch<UserInfoList>(new FilteredCriteria(<criteria>));
//}
private UserInfoList()
{ /* require use of factory methods */ }
#endregion
#region Data Access Portal
[Serializable()]
private class Criteria
{ /* no criteria - retrieve all rows */ }
private void DataPortal_Fetch(Criteria criteria)
{
this.RaiseListChangedEvents = false;
try{
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
{
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "getUsers";
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
{
IsReadOnly = false;
while (dr.Read())this.Add(new UserInfo(dr));
IsReadOnly = true;
}
}
}
}
catch(Exception ex)
{
Database.LogException("UserInfoList",ex);
}
this.RaiseListChangedEvents = true;
}
#endregion
} // Class
} // Namespace

View File

@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Text;
using Csla;
namespace Volian.Object.Library
{
/// <summary>
/// Extensions
/// </summary>
public partial class UserInfo : ReadOnlyBase<UserInfo>
{
public string FullName
{
get { return LastName + ", " + FirstName; }
}
}
}

View File

@@ -0,0 +1,512 @@
// ========================================================================
// Copyright 2006 - Volian Enterprises, Inc. All rights reserved.
// Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
// ------------------------------------------------------------------------
// $Workfile: $ $Revision: $
// $Author: $ $Date: $
//
// $History: $
// ========================================================================
using System;
using System.Data;
using System.Data.SqlClient;
using Csla;
using Csla.Data;
namespace Volian.Object.Library
{
/// <summary>
/// UserMembership Generated by MyGeneration using the CSLA Object Mapping template
/// </summary>
[Serializable()]
public partial class UserMembership : BusinessBase<UserMembership>
{
#region Business Methods
private int _ugid;
[System.ComponentModel.DataObjectField(true, true)]
public int Ugid
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _ugid;
}
}
private int _gid;
[System.ComponentModel.DataObjectField(true, true)]
public int Gid
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _gid;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (_gid != value)
{
_gid = value;
PropertyHasChanged();
}
}
}
private string _startdate=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string StartDate
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _startdate;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (value == null) value = string.Empty;
_startdate = value;
try
{
DateTime tmp = SmartDate.StringToDate(value);
if (_startdate != tmp.ToShortDateString())
{
_startdate = tmp.ToShortDateString();
// TODO: Any Cross Property Validation
}
}
catch
{
}
PropertyHasChanged();
}
}
private string _enddate=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string EndDate
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _enddate;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (value == null) value = string.Empty;
_enddate = value;
try
{
DateTime tmp = SmartDate.StringToDate(value);
if (_enddate != tmp.ToShortDateString())
{
_enddate = tmp.ToShortDateString();
// TODO: Any Cross Property Validation
}
}
catch
{
}
PropertyHasChanged();
}
}
private DateTime _dts=new DateTime();
[System.ComponentModel.DataObjectField(true, true)]
public DateTime Dts
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _dts;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (_dts != value)
{
_dts = value;
PropertyHasChanged();
}
}
}
private string _usrid=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string Usrid
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _usrid;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (value == null) value = string.Empty;
if (_usrid != value)
{
_usrid = value;
PropertyHasChanged();
}
}
}
private byte[] _lastchanged=new byte[8];//timestamp
private string _group_groupname=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string Group_GroupName
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _group_groupname;
}
}
private int _group_grouptype;
[System.ComponentModel.DataObjectField(true, true)]
public int Group_GroupType
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _group_grouptype;
}
}
private string _group_config=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string Group_Config
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _group_config;
}
}
private DateTime _group_dts=new DateTime();
[System.ComponentModel.DataObjectField(true, true)]
public DateTime Group_Dts
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _group_dts;
}
}
private string _group_usrid=string.Empty;
[System.ComponentModel.DataObjectField(true, true)]
public string Group_Usrid
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _group_usrid;
}
}
// TODO: Check UserMembership.GetIdValue to assure that the ID returned is unique
/// <summary>
/// Overrides Base GetIdValue - Used internally by CSLA to determine equality
/// </summary>
/// <returns>A Unique ID for the current UserMembership</returns>
protected override object GetIdValue()
{
return _ugid;
}
// TODO: Replace base UserMembership.ToString function as necessary
/// <summary>
/// Overrides Base ToString
/// </summary>
/// <returns>A string representation of current UserMembership</returns>
//public override string ToString()
//{
// return base.ToString();
//}
#endregion
#region ValidationRules
protected override void AddBusinessRules()
{
ValidationRules.AddRule(StartDateValid, "StartDate");
ValidationRules.AddRule(EndDateValid, "EndDate");
ValidationRules.AddRule(
Csla.Validation.CommonRules.StringMaxLength,
new Csla.Validation.CommonRules.MaxLengthRuleArgs("Usrid", 100));
// TODO: Add other validation rules
}
private bool StartDateValid(object target, Csla.Validation.RuleArgs e)
{
try
{
DateTime tmp = SmartDate.StringToDate(_startdate);
}
catch
{
e.Description="Invalid Date";
return false;
}
return true;
}
private bool EndDateValid(object target, Csla.Validation.RuleArgs e)
{
try
{
DateTime tmp = SmartDate.StringToDate(_enddate);
}
catch
{
e.Description="Invalid Date";
return false;
}
return true;
}
// Sample data comparison validation rule
//private bool StartDateGTEndDate(object target, Csla.Validation.RuleArgs e)
//{
// if (_started > _ended)
// {
// e.Description = "Start date can't be after end date";
// return false;
// }
// else
// return true;
//}
#endregion
#region Authorization Rules
protected override void AddAuthorizationRules()
{
//TODO: Who can read/write which fields
//AuthorizationRules.AllowRead(Ugid, "<Role(s)>");
//AuthorizationRules.AllowRead(Gid, "<Role(s)>");
//AuthorizationRules.AllowWrite(Gid, "<Role(s)>");
//AuthorizationRules.AllowRead(StartDate, "<Role(s)>");
//AuthorizationRules.AllowWrite(StartDate, "<Role(s)>");
//AuthorizationRules.AllowRead(EndDate, "<Role(s)>");
//AuthorizationRules.AllowWrite(EndDate, "<Role(s)>");
//AuthorizationRules.AllowRead(Dts, "<Role(s)>");
//AuthorizationRules.AllowWrite(Dts, "<Role(s)>");
//AuthorizationRules.AllowRead(Usrid, "<Role(s)>");
//AuthorizationRules.AllowWrite(Usrid, "<Role(s)>");
}
public static bool CanAddObject()
{
// TODO: Can Add Authorization
//return Csla.ApplicationContext.User.IsInRole("ProjectManager");
return true;
}
public static bool CanGetObject()
{
// TODO: CanGet Authorization
return true;
}
public static bool CanDeleteObject()
{
// TODO: CanDelete Authorization
//bool result = false;
//if (Csla.ApplicationContext.User.IsInRole("ProjectManager"))result = true;
//if (Csla.ApplicationContext.User.IsInRole("Administrator"))result = true;
//return result;
return true;
}
public static bool CanEditObject()
{
// TODO: CanEdit Authorization
//return Csla.ApplicationContext.User.IsInRole("ProjectManager");
return true;
}
#endregion
#region Factory Methods
internal static UserMembership New(int gid)
{
return new UserMembership(Volian.Object.Library.Group.Get(gid));
}
internal static UserMembership Get(SafeDataReader dr)
{
return new UserMembership(dr);
}
private UserMembership()
{
MarkAsChild();
_startdate = ext.DefaultStartDate;
_dts = ext.DefaultDts;
_usrid = ext.DefaultUsrid;
}
private UserMembership(Group group)
{
MarkAsChild();
// TODO: Add any initialization & defaults
_startdate = ext.DefaultStartDate;
_dts = ext.DefaultDts;
_usrid = ext.DefaultUsrid;
_gid = group.Gid;
_group_groupname = group.GroupName;
_group_grouptype = group.GroupType;
_group_config = group.Config;
_group_dts = group.Dts;
_group_usrid = group.Usrid;
}
private UserMembership(SafeDataReader dr)
{
MarkAsChild();
Fetch(dr);
}
#endregion
#region Data Access Portal
private void Fetch(SafeDataReader dr)
{
try{
_ugid = dr.GetInt32("UGID");
_gid = dr.GetInt32("GID");
_startdate = dr.GetSmartDate("StartDate").Text;
_enddate = dr.GetSmartDate("EndDate").Text;
_dts = dr.GetDateTime("DTS");
_usrid = dr.GetString("UsrID");
dr.GetBytes("LastChanged", 0, _lastchanged, 0, 8);
_group_groupname = dr.GetString("Groups_GroupName");
_group_grouptype = dr.GetInt32("Groups_GroupType");
_group_config = dr.GetString("Groups_Config");
_group_dts = dr.GetDateTime("Groups_DTS");
_group_usrid = dr.GetString("Groups_UsrID");
}
catch(Exception ex)
{
Database.LogException("UserMembership",ex);
}
MarkOld();
}
internal void Insert(User user,SqlConnection cn)
{
// if we're not dirty then don't update the database
if (!this.IsDirty) return;
_lastchanged=Membership.Add(cn, ref _ugid, user.Uid, _gid, new SmartDate(_startdate), new SmartDate(_enddate), _dts, _usrid);
MarkOld();
}
internal void Update(User user,SqlConnection cn)
{
// if we're not dirty then don't update the database
if (!this.IsDirty) return;
_lastchanged=Membership.Update(cn, ref _ugid, user.Uid, _gid, new SmartDate(_startdate), new SmartDate(_enddate), _dts, _usrid, ref _lastchanged);
MarkClean();
}
internal void DeleteSelf(User user,SqlConnection cn)
{
// if we're not dirty then don't update the database
if (!this.IsDirty) return;
// if we're new then don't update the database
if (this.IsNew) return;
Membership.Remove(cn,_ugid);
MarkNew();
}
#endregion
// Standard Default Code
// #region extension
Extension ext = new Extension();
[Serializable()]
partial class Extension : extensionBase
{
}
[Serializable()]
class extensionBase
{
// Default Values
public virtual string DefaultStartDate
{
get { return DateTime.Now.ToShortDateString(); }
}
public virtual DateTime DefaultDts
{
get { return DateTime.Now; }
}
public virtual string DefaultUsrid
{
get { return Environment.UserName.ToUpper(); }
}
// Authorization Rules
public virtual void AddAuthorizationRules(Csla.Security.AuthorizationRules rules)
{
// Needs to be overriden to add new authorization rules
}
// Validation Rules
public virtual void AddValidationRules(Csla.Validation.ValidationRules rules)
{
// Needs to be overriden to add new validation rules
}
}
//#endregion
// The follwing is a sample Extension File. You can use it to create UserMembershipExt.cs
//using System;
//using System.Collections.Generic;
//using System.Text;
//using Csla;
//namespace PatrialClass
//{
// public partial class UserMembership
// {
// partial class Extension : extensionBase
// {
// TODO: Override automatic defaults
// public virtual SmartDate DefaultStartDate
// {
// get { return DateTime.Now.ToShortDateString(); }
// }
// public virtual DateTime DefaultDts
// {
// get { return DateTime.Now; }
// }
// public virtual string DefaultUsrid
// {
// get { return Environment.UserName.ToUpper(); }
// }
// public new void AddAuthorizationRules(Csla.Security.AuthorizationRules rules)
// {
// //rules.AllowRead(Dbid, "<Role(s)>");
// }
// public new void AddValidationRules(Csla.Validation.ValidationRules rules)
// {
// rules.AddRule(
// Csla.Validation.CommonRules.StringMaxLength,
// new Csla.Validation.CommonRules.MaxLengthRuleArgs("Name", 100));
// }
// }
// }
//}
} // Class
} // Namespace

View File

@@ -0,0 +1,145 @@
// ========================================================================
// Copyright 2006 - Volian Enterprises, Inc. All rights reserved.
// Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
// ------------------------------------------------------------------------
// $Workfile: $ $Revision: $
// $Author: $ $Date: $
//
// $History: $
// ========================================================================
using System;
using System.Data;
using System.Data.SqlClient;
using Csla;
using Csla.Data;
namespace Volian.Object.Library
{
/// <summary>
/// UserMemberships Generated by MyGeneration using the CSLA Object Mapping template
/// </summary>
[Serializable()]
public partial class UserMemberships : BusinessListBase<UserMemberships,UserMembership>
{
#region Business Methods
public new UserMembership this[int gid]
{
get
{
foreach (UserMembership membership in this)
if (membership.Gid == gid)
return membership;
return null;
}
}
public UserMembership GetItem(int gid)
{
foreach (UserMembership membership in this)
if (membership.Gid == gid)
return membership;
return null;
}
public void Add(int gid)
{
if (!Contains(gid))
{
UserMembership membership =
UserMembership.New(gid);
this.Add(membership);
}
else
throw new InvalidOperationException("membership already exists");
}
public void Remove(int gid)
{
foreach (UserMembership membership in this)
{
if (membership.Gid == gid)
{
Remove(membership);
break;
}
}
}
public bool Contains(int gid)
{
foreach (UserMembership membership in this)
if (membership.Gid == gid)
return true;
return false;
}
public bool ContainsDeleted(int gid)
{
foreach (UserMembership membership in DeletedList)
if (membership.Gid == gid)
return true;
return false;
}
#endregion
#region Factory Methods
internal static UserMemberships New()
{
return new UserMemberships();
}
internal static UserMemberships Get(SafeDataReader dr)
{
return new UserMemberships(dr);
}
private UserMemberships()
{
MarkAsChild();
}
private UserMemberships(SafeDataReader dr)
{
MarkAsChild();
Fetch(dr);
}
#endregion
#region Data Access Portal
// called to load data from the database
private void Fetch(SafeDataReader dr)
{
this.RaiseListChangedEvents = false;
while (dr.Read())
this.Add(UserMembership.Get(dr));
this.RaiseListChangedEvents = true;
}
internal void Update(User user,SqlConnection cn)
{
this.RaiseListChangedEvents = false;
// update (thus deleting) any deleted child objects
foreach (UserMembership obj in DeletedList)
obj.DeleteSelf(user,cn);
// now that they are deleted, remove them from memory too
DeletedList.Clear();
// add/update any current child objects
foreach (UserMembership obj in this)
{
if (obj.IsNew)
obj.Insert(user,cn);
else
obj.Update(user,cn);
}
this.RaiseListChangedEvents = true;
}
#endregion
} // Class
} // Namespace

View File

@@ -0,0 +1,102 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.50727</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{592B86E9-D488-452B-B89B-2BB037793FE3}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Volian.Object.Library</RootNamespace>
<AssemblyName>Volian.Object.Library</AssemblyName>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Csla, Version=2.0.3.0, Culture=neutral, PublicKeyToken=93be5fdc093e4c30, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\csla20cs\csla20cs\Csla\bin\Debug\Csla.dll</HintPath>
</Reference>
<Reference Include="log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\Log4Net\log4net-1.2.10\bin\net\2.0\release\log4net.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.configuration" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Assignment.cs" />
<Compile Include="AssignmentInfo.cs" />
<Compile Include="AssignmentInfoList.cs" />
<Compile Include="Connection.cs" />
<Compile Include="ConnectionFolder.cs" />
<Compile Include="ConnectionFolders.cs" />
<Compile Include="ConnectionInfo.cs" />
<Compile Include="ConnectionInfoList.cs" />
<Compile Include="Database.cs" />
<Compile Include="Folder.cs" />
<Compile Include="FolderAssignment.cs" />
<Compile Include="FolderAssignments.cs" />
<Compile Include="FolderInfo.cs" />
<Compile Include="FolderInfoList.cs" />
<Compile Include="Group.cs" />
<Compile Include="GroupAssignment.cs" />
<Compile Include="GroupAssignments.cs" />
<Compile Include="GroupInfo.cs" />
<Compile Include="GroupInfoList.cs" />
<Compile Include="GroupMembership.cs" />
<Compile Include="GroupMembershipExt.cs" />
<Compile Include="GroupMemberships.cs" />
<Compile Include="Membership.cs" />
<Compile Include="MembershipInfo.cs" />
<Compile Include="MembershipInfoList.cs" />
<Compile Include="Permission.cs" />
<Compile Include="PermissionExt.cs" />
<Compile Include="PermissionInfo.cs" />
<Compile Include="PermissionInfoList.cs" />
<Compile Include="PermissionRole.cs" />
<Compile Include="PermissionRoles.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Role.cs" />
<Compile Include="RoleAssignment.cs" />
<Compile Include="RoleAssignments.cs" />
<Compile Include="RoleInfo.cs" />
<Compile Include="RoleInfoList.cs" />
<Compile Include="RolePermissionExt.cs" />
<Compile Include="RolePermission.cs" />
<Compile Include="RolePermissions.cs" />
<Compile Include="User.cs" />
<Compile Include="UserExt.cs" />
<Compile Include="UserInfo.cs" />
<Compile Include="UserInfoList.cs" />
<Compile Include="UserInfoListExt.cs" />
<Compile Include="UserMembership.cs" />
<Compile Include="UserMemberships.cs" />
<Compile Include="vlnValueKey.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@@ -0,0 +1,30 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Volian.Object.Library
{
public class vlnValueKey
{
public vlnValueKey() { ;}
public vlnValueKey(int key, string value)
{
_key = key;
_value = value;
}
private int _key;
public int Key
{
get { return _key; }
}
private string _value;
public string Value
{
get { return _value; }
}
public override string ToString()
{
return _value;
}
}
}

View File

@@ -0,0 +1,138 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="VEPROMS.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
<section name="UISampleNetBar1.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
</configSections>
<log4net>
<appender name="LogFileAppender" type="log4net.Appender.FileAppender">
<param name="File" value="${USERPROFILE}/My Documents/VEPROMS/ErrorLog.txt" />
<!--<param name="File" value="${APPDATA}/Volian/Proms2010/ErrorLog.txt" />-->
<!--<param name="File" value="${LOCALAPPDATA}/Temp/VEPROMS/ErrorLog.txt" />-->
<param name="AppendToFile" value="true" />
<layout type="log4net.Layout.PatternLayout">
<!--<param name="Header" value="[Header]\r\n" />-->
<!--<param name="Footer" value="[Footer]\r\n" />-->
<param name="ConversionPattern" value="%d [%t] %-5p %c - %m%n" />
</layout>
</appender>
<appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender" >
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="--&gt; %date [%thread] %-5level %logger (%property{log4net:HostName}) [%ndc] - %message%newline"/>
</layout>
</appender>
<appender name="EventLogAppender" type="log4net.Appender.EventLogAppender">
<threshold value="WARN" />
<mapping>
<level value="DEBUG" />
<eventLogEntryType value="Information" />
</mapping>
<mapping>
<level value="INFO" />
<eventLogEntryType value="Information" />
</mapping>
<mapping>
<level value="WARN" />
<eventLogEntryType value="Warning" />
</mapping>
<mapping>
<level value="ERROR" />
<eventLogEntryType value="Error" />
</mapping>
<mapping>
<level value="FATAL" />
<eventLogEntryType value="Error" />
</mapping>
<layout type="log4net.Layout.PatternLayout">
<param name="ConversionPattern" value="---&gt; %d [%t] %-5p %c - %m%n"/>
</layout>
</appender>
<root>
<level value="ALL" />
<appender-ref ref="ConsoleAppender" />
<appender-ref ref="LogFileAppender" />
<appender-ref ref="EventLogAppender" />
</root>
<logger name="VEPROMS.CSLA.Library">
<level value="INFO" />
</logger>
<logger name="Volian.Controls.Library">
<level value="INFO" />
</logger>
</log4net>
<appSettings>
<add key="OperatingMode" value="Debug" />
<add key="CslaAuthentication" value="Windows" />
<!--
<add key="CslaDataPortalProxy"
value="Csla.DataPortalClient.RemotingProxy, Csla"/>
<add key="CslaDataPortalUrl"
value="http://localhost/Proms2010RemotingHost/RemotingPortal.rem"/>
<add key="CslaDataPortalProxy"
value="Csla.DataPortalClient.RemotingProxy, Csla"/>
<add key="CslaDataPortalUrl"
value="http://rhmdesktop/Proms2010Remoting/RemotingPortal.rem"/>
<add key="CslaDataPortalProxy"
value="Csla.DataPortalClient.WebServicesProxy, Csla"/>
<add key="CslaDataPortalUrl"
value="http://localhost/VEPROMS_WebService/WebServicePortal.asmx"/>
<add key="CslaDataPortalProxy"
value="EnterpriseServicesHost.EnterpriseServicesProxy,
EnterpriseServicesHost"/>
-->
</appSettings>
<connectionStrings>
<add name="VEPROMS" connectionString="Data Source=VOLIAN-SERVER;User Id=proms2010;password=proms2010;Initial Catalog=VEPROMS" providerName="System.Data.SqlClient" />
<add name="VEPROMS_LOCAL" connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=VEPROMS;Integrated Security=True" providerName="System.Data.SqlClient" />
<add name="VEPROMS_RMARK_DEBUG" connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=VEPROMS;Integrated Security=True" providerName="System.Data.SqlClient" />
<add name="VEPROMS_RMARK_DEMO" connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=VEPROMS;Integrated Security=True" providerName="System.Data.SqlClient" />
</connectionStrings>
<userSettings>
<VEPROMS.Properties.Settings>
<setting name="ShowDefaultFolderProp" serializeAs="String">
<value>False</value>
</setting>
<setting name="PropPageStyle" serializeAs="String">
<value>1</value>
</setting>
<setting name="SystemColor" serializeAs="String">
<value>2</value>
</setting>
<setting name="TransitionRangeColor" serializeAs="String">
<value>192, 255, 255</value>
</setting>
<setting name="UseNameOnTreeNode" serializeAs="String">
<value>True</value>
</setting>
<setting name="UseTitleOnTreeNode" serializeAs="String">
<value>False</value>
</setting>
<setting name="WindowState" serializeAs="String">
<value>Normal</value>
</setting>
<setting name="AutoPopUpAnnotations" serializeAs="String">
<value>True</value>
</setting>
<setting name="StepTypeToolTip" serializeAs="String">
<value>False</value>
</setting>
<setting name="TreeviewExpanded" serializeAs="String">
<value>False</value>
</setting>
<setting name="SaveTreeviewExpanded" serializeAs="String">
<value>True</value>
</setting>
</VEPROMS.Properties.Settings>
<UISampleNetBar1.Properties.Settings>
<setting name="ShowDefaultFolderProp" serializeAs="String">
<value>False</value>
</setting>
<setting name="PropPageStyle" serializeAs="String">
<value>1</value>
</setting>
</UISampleNetBar1.Properties.Settings>
</userSettings>
</configuration>

View File

@@ -0,0 +1,71 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
</configSections>
<log4net>
<appender name="LogFileAppender" type="log4net.Appender.FileAppender">
<param name="File" value="Log4Net.txt" />
<param name="AppendToFile" value="false" />
<layout type="log4net.Layout.PatternLayout">
<param name="Header" value="[Header]\r\n" />
<param name="Footer" value="[Footer]\r\n" />
<param name="ConversionPattern" value="%d [%t] %-5p %c - %m%n" />
</layout>
</appender>
<appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender" >
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="--> %date [%thread] %-5level %logger (%property{log4net:HostName}) [%ndc] - %message%newline" />
</layout>
</appender>
<appender name="EventLogAppender" type="log4net.Appender.EventLogAppender">
<threshold value="WARN" />
<mapping>
<level value="DEBUG" />
<eventLogEntryType value="Information" />
</mapping>
<mapping>
<level value="INFO" />
<eventLogEntryType value="Information" />
</mapping>
<mapping>
<level value="WARN" />
<eventLogEntryType value="Warning" />
</mapping>
<mapping>
<level value="ERROR" />
<eventLogEntryType value="Error" />
</mapping>
<mapping>
<level value="FATAL" />
<eventLogEntryType value="Error" />
</mapping>
<layout type="log4net.Layout.PatternLayout">
<param name="ConversionPattern" value="---> %d [%t] %-5p %c - %m%n" />
</layout>
</appender>
<root>
<level value="ALL" />
<appender-ref ref="ConsoleAppender" />
<appender-ref ref="LogFileAppender" />
<appender-ref ref="EventLogAppender" />
</root>
<logger name="Volian.Object.Library">
<level value="WARN" />
</logger>
</log4net>
<appSettings>
<add key="CslaAuthentication" value="Windows" />
<!-- Active Connection -->
<!-- Inactive Connections
-->
</appSettings>
<connectionStrings>
<!--<add name="VEPROMS"
connectionString="Data Source=rhmdesktop\SQLEXPRESS;AttachDbFilename=&quot;C:\VS2005Projects\VEPROMS_USERS\VEPROMS_Users.mdf&quot;;Integrated Security=True;User Instance=True"
providerName="System.Data.SqlClient" />-->
<add name="VEPROMS"
connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=VEPROMS_Users;Integrated Security=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
</configuration>

View File

@@ -0,0 +1,86 @@
using System;
using System.Collections.Generic;
using System.Text;
using VEPROMS.CSLA.Library;
using Csla;
using System.Windows.Forms;
namespace WinApp
{
public class FolderTreeNode : TreeNode
{
FolderTreeNode(string s) : base(s)
{
this.Name="ID:" + s;
}
FolderTreeNode(FolderInfo folderinfo)
: base(folderinfo.Name)
{
_folderinfo = folderinfo;
this.Name = "ID:" + folderinfo.FolderID.ToString();
}
private FolderInfo _folderinfo;
public FolderInfo FolderInfo
{
get { return _folderinfo; }
set
{
_folderinfo = value;
}
}
private Dictionary<int, FolderTreeNode> _findTree = null;
private Dictionary<int, FolderTreeNode> FindTree
{
get { return _findTree; }
set { _findTree = value; }
}
public FolderTreeNode FindTreeNode(int folderID)
{
if (_findTree != null) return _findTree[folderID];
return null;
}
public static FolderTreeNode BuildTreeList()
{
FolderTreeNode root = null;
FolderInfoList fil = FolderInfoList.Get();
Dictionary<int, FolderTreeNode> dicMissing = new Dictionary<int, FolderTreeNode>();
Dictionary<int, FolderTreeNode> dicExists = new Dictionary<int, FolderTreeNode>();
foreach (FolderInfo fi in fil)
{
FolderTreeNode ftp = null;
if (dicExists.ContainsKey(fi.ParentID))
{
ftp = dicExists[fi.ParentID];
}
else
{
if (fi.ParentID != 0)
{
ftp = new FolderTreeNode(fi.ParentID.ToString());
dicMissing.Add(fi.ParentID, ftp);
dicExists.Add(fi.ParentID, ftp);
}
}
FolderTreeNode ft = null;
if (dicMissing.ContainsKey(fi.FolderID))
{
ft = dicMissing[fi.FolderID];
ft.FolderInfo = fi;
dicMissing.Remove(fi.FolderID);
}
else
{
ft = new FolderTreeNode(fi);
dicExists.Add(fi.FolderID, ft);
}
if (fi.ParentID == 0)
root = ft;
else
ftp.Nodes.Add(ft);
}
root.FindTree = dicExists;
return root;
}
}
}

View File

@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Windows.Forms;
namespace WinApp
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new frmUser());
}
}
}

View File

@@ -0,0 +1,33 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("WinApp")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Volian Enterprises, Inc.")]
[assembly: AssemblyProduct("WinApp")]
[assembly: AssemblyCopyright("Copyright © Volian Enterprises, Inc. 2006")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("e47b4096-8f91-4c73-9f15-2130d983fd08")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is automatically generated by Visual Studio .Net. It is
used to store generic object data source configuration information.
Renaming the file extension or editing the content of this file may
cause the file to be unrecognizable by the program.
-->
<GenericObjectDataSource DisplayName="Group" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
<TypeInfo>Volian.Object.Library.Group, Volian.Object.Library, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
</GenericObjectDataSource>

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is automatically generated by Visual Studio .Net. It is
used to store generic object data source configuration information.
Renaming the file extension or editing the content of this file may
cause the file to be unrecognizable by the program.
-->
<GenericObjectDataSource DisplayName="GroupAssignments" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
<TypeInfo>Volian.Object.Library.GroupAssignments, Volian.Object.Library, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
</GenericObjectDataSource>

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is automatically generated by Visual Studio .Net. It is
used to store generic object data source configuration information.
Renaming the file extension or editing the content of this file may
cause the file to be unrecognizable by the program.
-->
<GenericObjectDataSource DisplayName="GroupInfoList" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
<TypeInfo>Volian.Object.Library.GroupInfoList, Volian.Object.Library, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
</GenericObjectDataSource>

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is automatically generated by Visual Studio .Net. It is
used to store generic object data source configuration information.
Renaming the file extension or editing the content of this file may
cause the file to be unrecognizable by the program.
-->
<GenericObjectDataSource DisplayName="Membership" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
<TypeInfo>Volian.Object.Library.Membership, Volian.Object.Library, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
</GenericObjectDataSource>

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is automatically generated by Visual Studio .Net. It is
used to store generic object data source configuration information.
Renaming the file extension or editing the content of this file may
cause the file to be unrecognizable by the program.
-->
<GenericObjectDataSource DisplayName="MembershipInfoList" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
<TypeInfo>Volian.Object.Library.MembershipInfoList, Volian.Object.Library, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
</GenericObjectDataSource>

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is automatically generated by Visual Studio .Net. It is
used to store generic object data source configuration information.
Renaming the file extension or editing the content of this file may
cause the file to be unrecognizable by the program.
-->
<GenericObjectDataSource DisplayName="PermLookup" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
<TypeInfo>Volian.Object.Library.PermLookup, Volian.Object.Library, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
</GenericObjectDataSource>

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is automatically generated by Visual Studio .Net. It is
used to store generic object data source configuration information.
Renaming the file extension or editing the content of this file may
cause the file to be unrecognizable by the program.
-->
<GenericObjectDataSource DisplayName="Role" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
<TypeInfo>Volian.Object.Library.Role, Volian.Object.Library, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
</GenericObjectDataSource>

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is automatically generated by Visual Studio .Net. It is
used to store generic object data source configuration information.
Renaming the file extension or editing the content of this file may
cause the file to be unrecognizable by the program.
-->
<GenericObjectDataSource DisplayName="RoleInfoList" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
<TypeInfo>Volian.Object.Library.RoleInfoList, Volian.Object.Library, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
</GenericObjectDataSource>

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is automatically generated by Visual Studio .Net. It is
used to store generic object data source configuration information.
Renaming the file extension or editing the content of this file may
cause the file to be unrecognizable by the program.
-->
<GenericObjectDataSource DisplayName="User" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
<TypeInfo>Volian.Object.Library.User, Volian.Object.Library, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
</GenericObjectDataSource>

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is automatically generated by Visual Studio .Net. It is
used to store generic object data source configuration information.
Renaming the file extension or editing the content of this file may
cause the file to be unrecognizable by the program.
-->
<GenericObjectDataSource DisplayName="UserInfoList" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
<TypeInfo>Volian.Object.Library.UserInfoList, Volian.Object.Library, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
</GenericObjectDataSource>

View File

@@ -0,0 +1,71 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.42
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace WinApp.Properties
{
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources
{
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources()
{
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager
{
get
{
if ((resourceMan == null))
{
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("WinApp.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
}
}

View File

@@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -0,0 +1,30 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.42
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace WinApp.Properties
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "8.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default
{
get
{
return defaultInstance;
}
}
}
}

View File

@@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

View File

@@ -0,0 +1,164 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.50727</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{9912ADA4-5934-4C1D-AF2E-CA8031EBA338}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>WinApp</RootNamespace>
<AssemblyName>WinApp</AssemblyName>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Csla, Version=2.1.4.0, Culture=neutral, PublicKeyToken=93be5fdc093e4c30, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\VEPROMS.CSLA.Library\bin\Debug\Csla.dll</HintPath>
</Reference>
<Reference Include="log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\Log4Net\log4net-1.2.10\bin\net\2.0\release\log4net.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="FolderTreeNode.cs" />
<Compile Include="frmAssignmentSelect.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="frmAssignmentSelect.Designer.cs">
<DependentUpon>frmAssignmentSelect.cs</DependentUpon>
</Compile>
<Compile Include="frmGroups.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="frmGroups.Designer.cs">
<DependentUpon>frmGroups.cs</DependentUpon>
</Compile>
<Compile Include="frmGroupSelect.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="frmGroupSelect.Designer.cs">
<DependentUpon>frmGroupSelect.cs</DependentUpon>
</Compile>
<Compile Include="frmMembership.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="frmMembership.Designer.cs">
<DependentUpon>frmMembership.cs</DependentUpon>
</Compile>
<Compile Include="frmRoles.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="frmRoles.Designer.cs">
<DependentUpon>frmRoles.cs</DependentUpon>
</Compile>
<Compile Include="frmUser.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="frmUser.Designer.cs">
<DependentUpon>frmUser.cs</DependentUpon>
</Compile>
<Compile Include="frmUserSelect.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="frmUserSelect.Designer.cs">
<DependentUpon>frmUserSelect.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="frmAssignmentSelect.resx">
<SubType>Designer</SubType>
<DependentUpon>frmAssignmentSelect.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="frmGroups.resx">
<SubType>Designer</SubType>
<DependentUpon>frmGroups.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="frmGroupSelect.resx">
<SubType>Designer</SubType>
<DependentUpon>frmGroupSelect.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="frmMembership.resx">
<SubType>Designer</SubType>
<DependentUpon>frmMembership.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="frmRoles.resx">
<SubType>Designer</SubType>
<DependentUpon>frmRoles.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="frmUser.resx">
<SubType>Designer</SubType>
<DependentUpon>frmUser.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="frmUserSelect.resx">
<SubType>Designer</SubType>
<DependentUpon>frmUserSelect.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<None Include="App.config" />
<None Include="Properties\DataSources\Volian.Object.Library.Group.datasource" />
<None Include="Properties\DataSources\Volian.Object.Library.GroupAssignments.datasource" />
<None Include="Properties\DataSources\Volian.Object.Library.GroupInfoList.datasource" />
<None Include="Properties\DataSources\Volian.Object.Library.Membership.datasource" />
<None Include="Properties\DataSources\Volian.Object.Library.MembershipInfoList.datasource" />
<None Include="Properties\DataSources\Volian.Object.Library.PermLookup.datasource" />
<None Include="Properties\DataSources\Volian.Object.Library.Role.datasource" />
<None Include="Properties\DataSources\Volian.Object.Library.RoleInfoList.datasource" />
<None Include="Properties\DataSources\Volian.Object.Library.User.datasource" />
<None Include="Properties\DataSources\Volian.Object.Library.UserInfoList.datasource" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\VEPROMS.CSLA.Library\VEPROMS.CSLA.Library.csproj">
<Project>{41B2D786-1C03-4C1A-9247-DA9F0D6B06D5}</Project>
<Name>VEPROMS.CSLA.Library</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@@ -0,0 +1,172 @@
namespace WinApp
{
partial class frmAssignmentSelect
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.roleInfoListBindingSource = new System.Windows.Forms.BindingSource(this.components);
this.panel1 = new System.Windows.Forms.Panel();
this.btnRoles = new System.Windows.Forms.Button();
this.btnOK = new System.Windows.Forms.Button();
this.btnCancel = new System.Windows.Forms.Button();
this.tvFolder = new System.Windows.Forms.TreeView();
this.panel2 = new System.Windows.Forms.Panel();
this.cmbRoles = new System.Windows.Forms.ComboBox();
this.label1 = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.roleInfoListBindingSource)).BeginInit();
this.panel1.SuspendLayout();
this.panel2.SuspendLayout();
this.SuspendLayout();
//
// roleInfoListBindingSource
//
this.roleInfoListBindingSource.DataSource = typeof(VEPROMS.CSLA.Library.RoleInfo);
//
// panel1
//
this.panel1.AutoScroll = true;
this.panel1.Controls.Add(this.btnRoles);
this.panel1.Controls.Add(this.btnOK);
this.panel1.Controls.Add(this.btnCancel);
this.panel1.Dock = System.Windows.Forms.DockStyle.Bottom;
this.panel1.Location = new System.Drawing.Point(0, 478);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(557, 29);
this.panel1.TabIndex = 2;
//
// btnRoles
//
this.btnRoles.Dock = System.Windows.Forms.DockStyle.Left;
this.btnRoles.Location = new System.Drawing.Point(0, 0);
this.btnRoles.Name = "btnRoles";
this.btnRoles.Size = new System.Drawing.Size(75, 29);
this.btnRoles.TabIndex = 2;
this.btnRoles.Text = "Roles";
this.btnRoles.UseVisualStyleBackColor = true;
this.btnRoles.Click += new System.EventHandler(this.btnRoles_Click);
//
// btnOK
//
this.btnOK.Dock = System.Windows.Forms.DockStyle.Right;
this.btnOK.Location = new System.Drawing.Point(407, 0);
this.btnOK.Name = "btnOK";
this.btnOK.Size = new System.Drawing.Size(75, 29);
this.btnOK.TabIndex = 1;
this.btnOK.Text = "OK";
this.btnOK.UseVisualStyleBackColor = true;
this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
//
// btnCancel
//
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnCancel.Dock = System.Windows.Forms.DockStyle.Right;
this.btnCancel.Location = new System.Drawing.Point(482, 0);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(75, 29);
this.btnCancel.TabIndex = 0;
this.btnCancel.Text = "Cancel";
this.btnCancel.UseVisualStyleBackColor = true;
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
//
// tvFolder
//
this.tvFolder.CheckBoxes = true;
this.tvFolder.Dock = System.Windows.Forms.DockStyle.Fill;
this.tvFolder.Location = new System.Drawing.Point(0, 25);
this.tvFolder.Name = "tvFolder";
this.tvFolder.Size = new System.Drawing.Size(557, 453);
this.tvFolder.TabIndex = 3;
this.tvFolder.BeforeCheck += new System.Windows.Forms.TreeViewCancelEventHandler(this.tvFolder_BeforeCheck);
//
// panel2
//
this.panel2.Controls.Add(this.cmbRoles);
this.panel2.Controls.Add(this.label1);
this.panel2.Dock = System.Windows.Forms.DockStyle.Top;
this.panel2.Location = new System.Drawing.Point(0, 0);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(557, 25);
this.panel2.TabIndex = 6;
//
// cmbRoles
//
this.cmbRoles.DataSource = this.roleInfoListBindingSource;
this.cmbRoles.DisplayMember = "Name";
this.cmbRoles.Dock = System.Windows.Forms.DockStyle.Fill;
this.cmbRoles.FormattingEnabled = true;
this.cmbRoles.Location = new System.Drawing.Point(41, 0);
this.cmbRoles.Name = "cmbRoles";
this.cmbRoles.Size = new System.Drawing.Size(516, 24);
this.cmbRoles.TabIndex = 6;
this.cmbRoles.ValueMember = "Rid";
this.cmbRoles.SelectedValueChanged += new System.EventHandler(this.cmbRoles_SelectedValueChanged);
//
// label1
//
this.label1.AutoSize = true;
this.label1.Dock = System.Windows.Forms.DockStyle.Left;
this.label1.Location = new System.Drawing.Point(0, 0);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(41, 17);
this.label1.TabIndex = 0;
this.label1.Text = "Role:";
//
// frmAssignmentSelect
//
this.AcceptButton = this.btnOK;
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.btnCancel;
this.ClientSize = new System.Drawing.Size(557, 507);
this.Controls.Add(this.tvFolder);
this.Controls.Add(this.panel2);
this.Controls.Add(this.panel1);
this.Name = "frmAssignmentSelect";
this.Text = "Assignment Selection";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.BeforeFormClosing);
((System.ComponentModel.ISupportInitialize)(this.roleInfoListBindingSource)).EndInit();
this.panel1.ResumeLayout(false);
this.panel2.ResumeLayout(false);
this.panel2.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.BindingSource roleInfoListBindingSource;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Button btnRoles;
private System.Windows.Forms.Button btnOK;
private System.Windows.Forms.Button btnCancel;
private System.Windows.Forms.TreeView tvFolder;
private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.ComboBox cmbRoles;
private System.Windows.Forms.Label label1;
}
}

View File

@@ -0,0 +1,109 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using VEPROMS.CSLA.Library;
namespace WinApp
{
public partial class frmAssignmentSelect : Form
{
Group _grp;
FolderTreeNode _topnode;
public frmAssignmentSelect(Group grp)
{
InitializeComponent();
_grp = grp;
this.Text = grp.GroupName + " Assignments";
//_grp.BeginEdit();// Push
_topnode = FolderTreeNode.BuildTreeList();
tvFolder.Nodes.Add(_topnode);
tvFolder.Nodes[0].Expand();
roleInfoListBindingSource.DataSource = RoleInfoList.Get();
//Initialize cmbRoles
if (grp.GroupAssignments.Count > 0)
{
int rid = grp.GroupAssignments[0].RID;
cmbRoles.SelectedValue = rid;
SetupFolders(rid);
}
}
private void BeforeFormClosing(object sender, FormClosingEventArgs e)
{
e.Cancel = (SaveAsNeeded() == DialogResult.Cancel);
}
private DialogResult SaveAsNeeded()
{
return DialogResult.Yes;
}
private void btnOK_Click(object sender, EventArgs e)
{
// This should save the changes to _grp.GroupAssignments
_grp.ApplyEdit(); //Apply
}
private void btnCancel_Click(object sender, EventArgs e)
{
// This should throw away any changes to _grp.GroupAssignments
_grp.CancelEdit();// Pop
}
private void btnRoles_Click(object sender, EventArgs e)
{
// TODO: Maybe should not be able to do this if unsaved data
frmRoles fr = new frmRoles();
fr.ShowDialog();
roleInfoListBindingSource.DataSource = RoleInfoList.Get();
}
private void tvFolder_BeforeCheck(object sender, TreeViewCancelEventArgs e)
{
if(!bSetup)
{
FolderTreeNode ftn = (FolderTreeNode)e.Node;
if (!ftn.Checked)
{
MessageBox.Show("Conversion Error");
//_grp.GroupAssignments.Add(int.Parse(cmbRoles.SelectedValue.ToString()), ftn.FolderInfo.FolderID);
}
else
{
MessageBox.Show("Conversion Error");
//TODO: KBR _grp.GroupAssignments.Remove(ftn.FolderInfo.FolderID, int.Parse(cmbRoles.SelectedValue.ToString()));
}
}
}
private void cmbRoles_SelectedValueChanged(object sender, EventArgs e)
{
if (cmbRoles.SelectedIndex >= 0)
{
int rid = int.Parse(cmbRoles.SelectedValue.ToString());
SetupFolders(rid);
}
}
private bool bSetup = false;
private void ResetTree(TreeNodeCollection tc)
{
foreach(TreeNode tn in tc)
{
tn.Checked=false;
if(tn.Nodes != null)ResetTree(tn.Nodes);
}
}
private void SetupFolders(int rid)
{
bSetup=true;
ResetTree(tvFolder.Nodes);
foreach(GroupAssignment ga in _grp.GroupAssignments)
{
if (ga.RID == rid)
_topnode.FindTreeNode(ga.FolderID).Checked = true;
}
bSetup=false;
}
}
}

View File

@@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="roleInfoListBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

View File

@@ -0,0 +1,117 @@
namespace WinApp
{
partial class frmGroupSelect
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.lbGroups = new System.Windows.Forms.ListBox();
this.groupInfoListBindingSource = new System.Windows.Forms.BindingSource(this.components);
this.btnCancel = new System.Windows.Forms.Button();
this.panel1 = new System.Windows.Forms.Panel();
this.btnOK = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.groupInfoListBindingSource)).BeginInit();
this.panel1.SuspendLayout();
this.SuspendLayout();
//
// lbGroups
//
this.lbGroups.DataSource = this.groupInfoListBindingSource;
this.lbGroups.DisplayMember = "GroupName";
this.lbGroups.Dock = System.Windows.Forms.DockStyle.Fill;
this.lbGroups.FormattingEnabled = true;
this.lbGroups.ItemHeight = 16;
this.lbGroups.Location = new System.Drawing.Point(0, 0);
this.lbGroups.Name = "lbGroups";
this.lbGroups.Size = new System.Drawing.Size(298, 292);
this.lbGroups.TabIndex = 3;
this.lbGroups.ValueMember = "Gid";
//
// groupInfoListBindingSource
//
this.groupInfoListBindingSource.DataSource = typeof(VEPROMS.CSLA.Library.GroupInfo);
//
// btnCancel
//
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnCancel.Dock = System.Windows.Forms.DockStyle.Left;
this.btnCancel.Location = new System.Drawing.Point(79, 0);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(76, 35);
this.btnCancel.TabIndex = 1;
this.btnCancel.Text = "Cancel";
this.btnCancel.UseVisualStyleBackColor = true;
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
//
// panel1
//
this.panel1.Controls.Add(this.btnCancel);
this.panel1.Controls.Add(this.btnOK);
this.panel1.Dock = System.Windows.Forms.DockStyle.Bottom;
this.panel1.Location = new System.Drawing.Point(0, 293);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(298, 35);
this.panel1.TabIndex = 2;
//
// btnOK
//
this.btnOK.Dock = System.Windows.Forms.DockStyle.Left;
this.btnOK.Location = new System.Drawing.Point(0, 0);
this.btnOK.Name = "btnOK";
this.btnOK.Size = new System.Drawing.Size(79, 35);
this.btnOK.TabIndex = 0;
this.btnOK.Text = "OK";
this.btnOK.UseVisualStyleBackColor = true;
this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
//
// frmGroupSelect
//
this.AcceptButton = this.btnOK;
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.btnCancel;
this.ClientSize = new System.Drawing.Size(298, 328);
this.Controls.Add(this.lbGroups);
this.Controls.Add(this.panel1);
this.Name = "frmGroupSelect";
this.Text = "frmGroupSelect";
this.Load += new System.EventHandler(this.frmGroupSelect_Load);
((System.ComponentModel.ISupportInitialize)(this.groupInfoListBindingSource)).EndInit();
this.panel1.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.ListBox lbGroups;
private System.Windows.Forms.Button btnCancel;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Button btnOK;
private System.Windows.Forms.BindingSource groupInfoListBindingSource;
}
}

View File

@@ -0,0 +1,37 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using VEPROMS.CSLA.Library;
using Csla;
namespace WinApp
{
public partial class frmGroupSelect : Form
{
public frmGroupSelect()
{
InitializeComponent();
}
private void frmGroupSelect_Load(object sender, EventArgs e)
{
groupInfoListBindingSource.DataSource = GroupInfoList.Get();
}
public int GID
{
get { return (int)lbGroups.SelectedValue; }
}
private void btnOK_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.OK;
}
private void btnCancel_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.Cancel;
}
}
}

View File

@@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="groupInfoListBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

View File

@@ -0,0 +1,523 @@
namespace WinApp
{
partial class frmGroups
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.Windows.Forms.Label configLabel;
System.Windows.Forms.Label groupNameLabel;
System.Windows.Forms.Label groupTypeLabel;
this.btnNew = new System.Windows.Forms.Button();
this.btnCancel = new System.Windows.Forms.Button();
this.btnSave = new System.Windows.Forms.Button();
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.lbGroups = new System.Windows.Forms.ListBox();
this.groupInfoListBindingSource = new System.Windows.Forms.BindingSource(this.components);
this.tabControl1 = new System.Windows.Forms.TabControl();
this.tabPage1 = new System.Windows.Forms.TabPage();
this.groupMembershipsDataGridView = new System.Windows.Forms.DataGridView();
this.Uid = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.User_FullName = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.dataGridViewTextBoxColumn4 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.dataGridViewTextBoxColumn8 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.groupMembershipsBindingSource = new System.Windows.Forms.BindingSource(this.components);
this.groupBindingSource = new System.Windows.Forms.BindingSource(this.components);
this.panel1 = new System.Windows.Forms.Panel();
this.btnRemoveGA = new System.Windows.Forms.Button();
this.btnNewGA = new System.Windows.Forms.Button();
this.tabPage2 = new System.Windows.Forms.TabPage();
this.groupAssignmentsDataGridView = new System.Windows.Forms.DataGridView();
this.Aid = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.folderNameDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.roleNameDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.startDateDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.endDateDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.groupAssignmentsBindingSource = new System.Windows.Forms.BindingSource(this.components);
this.panel2 = new System.Windows.Forms.Panel();
this.btnRemoveAssign = new System.Windows.Forms.Button();
this.btnNewAssign = new System.Windows.Forms.Button();
this.configTextBox = new System.Windows.Forms.TextBox();
this.gidTextBox = new System.Windows.Forms.TextBox();
this.groupNameTextBox = new System.Windows.Forms.TextBox();
this.groupTypeTextBox = new System.Windows.Forms.TextBox();
this.userInfoListBindingSource = new System.Windows.Forms.BindingSource(this.components);
configLabel = new System.Windows.Forms.Label();
groupNameLabel = new System.Windows.Forms.Label();
groupTypeLabel = new System.Windows.Forms.Label();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.groupInfoListBindingSource)).BeginInit();
this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.groupMembershipsDataGridView)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.groupMembershipsBindingSource)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.groupBindingSource)).BeginInit();
this.panel1.SuspendLayout();
this.tabPage2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.groupAssignmentsDataGridView)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.groupAssignmentsBindingSource)).BeginInit();
this.panel2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.userInfoListBindingSource)).BeginInit();
this.SuspendLayout();
//
// configLabel
//
configLabel.AutoSize = true;
configLabel.Location = new System.Drawing.Point(14, 92);
configLabel.Name = "configLabel";
configLabel.Size = new System.Drawing.Size(52, 17);
configLabel.TabIndex = 5;
configLabel.Text = "Config:";
//
// groupNameLabel
//
groupNameLabel.AutoSize = true;
groupNameLabel.Location = new System.Drawing.Point(14, 36);
groupNameLabel.Name = "groupNameLabel";
groupNameLabel.Size = new System.Drawing.Size(93, 17);
groupNameLabel.TabIndex = 11;
groupNameLabel.Text = "Group Name:";
//
// groupTypeLabel
//
groupTypeLabel.AutoSize = true;
groupTypeLabel.Location = new System.Drawing.Point(14, 64);
groupTypeLabel.Name = "groupTypeLabel";
groupTypeLabel.Size = new System.Drawing.Size(88, 17);
groupTypeLabel.TabIndex = 13;
groupTypeLabel.Text = "Group Type:";
//
// btnNew
//
this.btnNew.Location = new System.Drawing.Point(505, 61);
this.btnNew.Name = "btnNew";
this.btnNew.Size = new System.Drawing.Size(75, 23);
this.btnNew.TabIndex = 5;
this.btnNew.Text = "New";
this.btnNew.UseVisualStyleBackColor = true;
this.btnNew.Click += new System.EventHandler(this.btnNew_Click);
//
// btnCancel
//
this.btnCancel.Location = new System.Drawing.Point(505, 32);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(75, 23);
this.btnCancel.TabIndex = 4;
this.btnCancel.Text = "Cancel";
this.btnCancel.UseVisualStyleBackColor = true;
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
//
// btnSave
//
this.btnSave.Location = new System.Drawing.Point(505, 3);
this.btnSave.Name = "btnSave";
this.btnSave.Size = new System.Drawing.Size(75, 23);
this.btnSave.TabIndex = 3;
this.btnSave.Text = "Save";
this.btnSave.UseVisualStyleBackColor = true;
this.btnSave.Click += new System.EventHandler(this.btnSave_Click);
//
// splitContainer1
//
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer1.Location = new System.Drawing.Point(0, 0);
this.splitContainer1.Name = "splitContainer1";
//
// splitContainer1.Panel1
//
this.splitContainer1.Panel1.Controls.Add(this.lbGroups);
//
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.AutoScroll = true;
this.splitContainer1.Panel2.Controls.Add(this.tabControl1);
this.splitContainer1.Panel2.Controls.Add(configLabel);
this.splitContainer1.Panel2.Controls.Add(this.configTextBox);
this.splitContainer1.Panel2.Controls.Add(this.gidTextBox);
this.splitContainer1.Panel2.Controls.Add(groupNameLabel);
this.splitContainer1.Panel2.Controls.Add(this.groupNameTextBox);
this.splitContainer1.Panel2.Controls.Add(groupTypeLabel);
this.splitContainer1.Panel2.Controls.Add(this.groupTypeTextBox);
this.splitContainer1.Panel2.Controls.Add(this.btnNew);
this.splitContainer1.Panel2.Controls.Add(this.btnCancel);
this.splitContainer1.Panel2.Controls.Add(this.btnSave);
this.splitContainer1.Size = new System.Drawing.Size(892, 488);
this.splitContainer1.SplitterDistance = 296;
this.splitContainer1.TabIndex = 1;
//
// lbGroups
//
this.lbGroups.DataSource = this.groupInfoListBindingSource;
this.lbGroups.DisplayMember = "GroupName";
this.lbGroups.Dock = System.Windows.Forms.DockStyle.Fill;
this.lbGroups.FormattingEnabled = true;
this.lbGroups.ItemHeight = 16;
this.lbGroups.Location = new System.Drawing.Point(0, 0);
this.lbGroups.Name = "lbGroups";
this.lbGroups.Size = new System.Drawing.Size(296, 484);
this.lbGroups.TabIndex = 0;
this.lbGroups.ValueMember = "Gid";
this.lbGroups.SelectedValueChanged += new System.EventHandler(this.lbGroup_SelectedValueChanged);
//
// groupInfoListBindingSource
//
this.groupInfoListBindingSource.DataSource = typeof(VEPROMS.CSLA.Library.GroupInfo);
//
// tabControl1
//
this.tabControl1.Controls.Add(this.tabPage1);
this.tabControl1.Controls.Add(this.tabPage2);
this.tabControl1.Location = new System.Drawing.Point(23, 213);
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(557, 260);
this.tabControl1.TabIndex = 15;
//
// tabPage1
//
this.tabPage1.AutoScroll = true;
this.tabPage1.Controls.Add(this.groupMembershipsDataGridView);
this.tabPage1.Controls.Add(this.panel1);
this.tabPage1.Location = new System.Drawing.Point(4, 25);
this.tabPage1.Name = "tabPage1";
this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
this.tabPage1.Size = new System.Drawing.Size(549, 231);
this.tabPage1.TabIndex = 0;
this.tabPage1.Text = "Members";
this.tabPage1.UseVisualStyleBackColor = true;
//
// groupMembershipsDataGridView
//
this.groupMembershipsDataGridView.AutoGenerateColumns = false;
this.groupMembershipsDataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.Uid,
this.User_FullName,
this.dataGridViewTextBoxColumn4,
this.dataGridViewTextBoxColumn8});
this.groupMembershipsDataGridView.DataSource = this.groupMembershipsBindingSource;
this.groupMembershipsDataGridView.Dock = System.Windows.Forms.DockStyle.Fill;
this.groupMembershipsDataGridView.Location = new System.Drawing.Point(3, 35);
this.groupMembershipsDataGridView.Name = "groupMembershipsDataGridView";
this.groupMembershipsDataGridView.RowTemplate.Height = 24;
this.groupMembershipsDataGridView.Size = new System.Drawing.Size(543, 193);
this.groupMembershipsDataGridView.TabIndex = 0;
//
// Uid
//
this.Uid.DataPropertyName = "Uid";
this.Uid.HeaderText = "Uid";
this.Uid.Name = "Uid";
this.Uid.ReadOnly = true;
this.Uid.Visible = false;
//
// User_FullName
//
this.User_FullName.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
this.User_FullName.DataPropertyName = "User_FullName";
this.User_FullName.HeaderText = "User";
this.User_FullName.Name = "User_FullName";
this.User_FullName.ReadOnly = true;
//
// dataGridViewTextBoxColumn4
//
this.dataGridViewTextBoxColumn4.DataPropertyName = "StartDate";
this.dataGridViewTextBoxColumn4.HeaderText = "StartDate";
this.dataGridViewTextBoxColumn4.Name = "dataGridViewTextBoxColumn4";
//
// dataGridViewTextBoxColumn8
//
this.dataGridViewTextBoxColumn8.DataPropertyName = "EndDate";
this.dataGridViewTextBoxColumn8.HeaderText = "EndDate";
this.dataGridViewTextBoxColumn8.Name = "dataGridViewTextBoxColumn8";
//
// groupMembershipsBindingSource
//
this.groupMembershipsBindingSource.DataMember = "GroupMemberships";
this.groupMembershipsBindingSource.DataSource = this.groupBindingSource;
this.groupMembershipsBindingSource.CurrentItemChanged += new System.EventHandler(this.CurrentItemChanged);
//
// groupBindingSource
//
this.groupBindingSource.DataSource = typeof(VEPROMS.CSLA.Library.Group);
this.groupBindingSource.CurrentItemChanged += new System.EventHandler(this.CurrentItemChanged);
//
// panel1
//
this.panel1.Controls.Add(this.btnRemoveGA);
this.panel1.Controls.Add(this.btnNewGA);
this.panel1.Dock = System.Windows.Forms.DockStyle.Top;
this.panel1.Location = new System.Drawing.Point(3, 3);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(543, 32);
this.panel1.TabIndex = 1;
//
// btnRemoveGA
//
this.btnRemoveGA.AutoSize = true;
this.btnRemoveGA.Dock = System.Windows.Forms.DockStyle.Left;
this.btnRemoveGA.Location = new System.Drawing.Point(72, 0);
this.btnRemoveGA.Name = "btnRemoveGA";
this.btnRemoveGA.Size = new System.Drawing.Size(75, 32);
this.btnRemoveGA.TabIndex = 37;
this.btnRemoveGA.TabStop = false;
this.btnRemoveGA.Text = "Remove";
this.btnRemoveGA.UseVisualStyleBackColor = true;
this.btnRemoveGA.Click += new System.EventHandler(this.btnRemoveGA_Click);
//
// btnNewGA
//
this.btnNewGA.AutoSize = true;
this.btnNewGA.Dock = System.Windows.Forms.DockStyle.Left;
this.btnNewGA.Location = new System.Drawing.Point(0, 0);
this.btnNewGA.Name = "btnNewGA";
this.btnNewGA.Size = new System.Drawing.Size(72, 32);
this.btnNewGA.TabIndex = 36;
this.btnNewGA.TabStop = false;
this.btnNewGA.Text = "New";
this.btnNewGA.UseVisualStyleBackColor = true;
this.btnNewGA.Click += new System.EventHandler(this.btnNewGA_Click);
//
// tabPage2
//
this.tabPage2.AutoScroll = true;
this.tabPage2.Controls.Add(this.groupAssignmentsDataGridView);
this.tabPage2.Controls.Add(this.panel2);
this.tabPage2.Location = new System.Drawing.Point(4, 25);
this.tabPage2.Name = "tabPage2";
this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
this.tabPage2.Size = new System.Drawing.Size(549, 231);
this.tabPage2.TabIndex = 1;
this.tabPage2.Text = "Assignments";
this.tabPage2.UseVisualStyleBackColor = true;
//
// groupAssignmentsDataGridView
//
this.groupAssignmentsDataGridView.AutoGenerateColumns = false;
this.groupAssignmentsDataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.Aid,
this.folderNameDataGridViewTextBoxColumn,
this.roleNameDataGridViewTextBoxColumn,
this.startDateDataGridViewTextBoxColumn,
this.endDateDataGridViewTextBoxColumn});
this.groupAssignmentsDataGridView.DataSource = this.groupAssignmentsBindingSource;
this.groupAssignmentsDataGridView.Dock = System.Windows.Forms.DockStyle.Fill;
this.groupAssignmentsDataGridView.Location = new System.Drawing.Point(3, 35);
this.groupAssignmentsDataGridView.Name = "groupAssignmentsDataGridView";
this.groupAssignmentsDataGridView.RowTemplate.Height = 24;
this.groupAssignmentsDataGridView.Size = new System.Drawing.Size(543, 193);
this.groupAssignmentsDataGridView.TabIndex = 0;
//
// Aid
//
this.Aid.DataPropertyName = "Aid";
this.Aid.HeaderText = "Aid";
this.Aid.Name = "Aid";
this.Aid.ReadOnly = true;
this.Aid.Visible = false;
//
// folderNameDataGridViewTextBoxColumn
//
this.folderNameDataGridViewTextBoxColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
this.folderNameDataGridViewTextBoxColumn.DataPropertyName = "Folder_Name";
this.folderNameDataGridViewTextBoxColumn.HeaderText = "Folder";
this.folderNameDataGridViewTextBoxColumn.Name = "folderNameDataGridViewTextBoxColumn";
this.folderNameDataGridViewTextBoxColumn.ReadOnly = true;
//
// roleNameDataGridViewTextBoxColumn
//
this.roleNameDataGridViewTextBoxColumn.DataPropertyName = "Role_Name";
this.roleNameDataGridViewTextBoxColumn.HeaderText = "Role";
this.roleNameDataGridViewTextBoxColumn.Name = "roleNameDataGridViewTextBoxColumn";
this.roleNameDataGridViewTextBoxColumn.ReadOnly = true;
//
// startDateDataGridViewTextBoxColumn
//
this.startDateDataGridViewTextBoxColumn.DataPropertyName = "StartDate";
this.startDateDataGridViewTextBoxColumn.HeaderText = "Start";
this.startDateDataGridViewTextBoxColumn.Name = "startDateDataGridViewTextBoxColumn";
//
// endDateDataGridViewTextBoxColumn
//
this.endDateDataGridViewTextBoxColumn.DataPropertyName = "EndDate";
this.endDateDataGridViewTextBoxColumn.HeaderText = "End";
this.endDateDataGridViewTextBoxColumn.Name = "endDateDataGridViewTextBoxColumn";
//
// groupAssignmentsBindingSource
//
this.groupAssignmentsBindingSource.DataMember = "GroupAssignments";
this.groupAssignmentsBindingSource.DataSource = this.groupBindingSource;
//
// panel2
//
this.panel2.Controls.Add(this.btnRemoveAssign);
this.panel2.Controls.Add(this.btnNewAssign);
this.panel2.Dock = System.Windows.Forms.DockStyle.Top;
this.panel2.Location = new System.Drawing.Point(3, 3);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(543, 32);
this.panel2.TabIndex = 2;
//
// btnRemoveAssign
//
this.btnRemoveAssign.AutoSize = true;
this.btnRemoveAssign.Dock = System.Windows.Forms.DockStyle.Left;
this.btnRemoveAssign.Location = new System.Drawing.Point(72, 0);
this.btnRemoveAssign.Name = "btnRemoveAssign";
this.btnRemoveAssign.Size = new System.Drawing.Size(83, 32);
this.btnRemoveAssign.TabIndex = 37;
this.btnRemoveAssign.TabStop = false;
this.btnRemoveAssign.Text = "Remove";
this.btnRemoveAssign.UseVisualStyleBackColor = true;
this.btnRemoveAssign.Click += new System.EventHandler(this.btnRemoveAssign_Click);
//
// btnNewAssign
//
this.btnNewAssign.AutoSize = true;
this.btnNewAssign.Dock = System.Windows.Forms.DockStyle.Left;
this.btnNewAssign.Location = new System.Drawing.Point(0, 0);
this.btnNewAssign.Name = "btnNewAssign";
this.btnNewAssign.Size = new System.Drawing.Size(72, 32);
this.btnNewAssign.TabIndex = 36;
this.btnNewAssign.TabStop = false;
this.btnNewAssign.Text = "New";
this.btnNewAssign.UseVisualStyleBackColor = true;
this.btnNewAssign.Click += new System.EventHandler(this.btnNewAssign_Click);
//
// configTextBox
//
this.configTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.groupBindingSource, "Config", true));
this.configTextBox.Location = new System.Drawing.Point(113, 89);
this.configTextBox.Multiline = true;
this.configTextBox.Name = "configTextBox";
this.configTextBox.Size = new System.Drawing.Size(381, 108);
this.configTextBox.TabIndex = 6;
//
// gidTextBox
//
this.gidTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.groupBindingSource, "Gid", true));
this.gidTextBox.Enabled = false;
this.gidTextBox.Location = new System.Drawing.Point(2, 0);
this.gidTextBox.Name = "gidTextBox";
this.gidTextBox.Size = new System.Drawing.Size(34, 22);
this.gidTextBox.TabIndex = 10;
//
// groupNameTextBox
//
this.groupNameTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.groupBindingSource, "GroupName", true));
this.groupNameTextBox.Location = new System.Drawing.Point(113, 33);
this.groupNameTextBox.Name = "groupNameTextBox";
this.groupNameTextBox.Size = new System.Drawing.Size(381, 22);
this.groupNameTextBox.TabIndex = 12;
//
// groupTypeTextBox
//
this.groupTypeTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.groupBindingSource, "GroupType", true));
this.groupTypeTextBox.Location = new System.Drawing.Point(113, 61);
this.groupTypeTextBox.Name = "groupTypeTextBox";
this.groupTypeTextBox.Size = new System.Drawing.Size(381, 22);
this.groupTypeTextBox.TabIndex = 14;
//
// userInfoListBindingSource
//
this.userInfoListBindingSource.DataSource = typeof(VEPROMS.CSLA.Library.UserInfo);
//
// frmGroups
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(892, 488);
this.Controls.Add(this.splitContainer1);
this.Name = "frmGroups";
this.Text = "frmGroups";
this.Load += new System.EventHandler(this.frmGroup_Load);
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.BeforeFormClosing);
this.splitContainer1.Panel1.ResumeLayout(false);
this.splitContainer1.Panel2.ResumeLayout(false);
this.splitContainer1.Panel2.PerformLayout();
this.splitContainer1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.groupInfoListBindingSource)).EndInit();
this.tabControl1.ResumeLayout(false);
this.tabPage1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.groupMembershipsDataGridView)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.groupMembershipsBindingSource)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.groupBindingSource)).EndInit();
this.panel1.ResumeLayout(false);
this.panel1.PerformLayout();
this.tabPage2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.groupAssignmentsDataGridView)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.groupAssignmentsBindingSource)).EndInit();
this.panel2.ResumeLayout(false);
this.panel2.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.userInfoListBindingSource)).EndInit();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Button btnNew;
private System.Windows.Forms.Button btnCancel;
private System.Windows.Forms.Button btnSave;
private System.Windows.Forms.SplitContainer splitContainer1;
private System.Windows.Forms.ListBox lbGroups;
private System.Windows.Forms.TextBox configTextBox;
private System.Windows.Forms.BindingSource groupBindingSource;
private System.Windows.Forms.TextBox gidTextBox;
private System.Windows.Forms.TextBox groupNameTextBox;
private System.Windows.Forms.TextBox groupTypeTextBox;
private System.Windows.Forms.BindingSource groupInfoListBindingSource;
private System.Windows.Forms.TabControl tabControl1;
private System.Windows.Forms.TabPage tabPage1;
private System.Windows.Forms.TabPage tabPage2;
private System.Windows.Forms.BindingSource groupMembershipsBindingSource;
private System.Windows.Forms.DataGridView groupMembershipsDataGridView;
private System.Windows.Forms.BindingSource userInfoListBindingSource;
private System.Windows.Forms.DataGridView groupAssignmentsDataGridView;
// private System.Windows.Forms.BindingSource groupPermissionsBindingSource;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Button btnRemoveGA;
private System.Windows.Forms.Button btnNewGA;
private System.Windows.Forms.DataGridViewTextBoxColumn Uid;
private System.Windows.Forms.DataGridViewTextBoxColumn User_FullName;
private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn4;
private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn8;
private System.Windows.Forms.BindingSource groupAssignmentsBindingSource;
// private System.Windows.Forms.DataGridViewTextBoxColumn roleGidDataGridViewTextBoxColumn;
private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.Button btnRemoveAssign;
private System.Windows.Forms.Button btnNewAssign;
private System.Windows.Forms.DataGridViewTextBoxColumn Aid;
private System.Windows.Forms.DataGridViewTextBoxColumn ridDataGridViewTextBoxColumn;
private System.Windows.Forms.DataGridViewTextBoxColumn folderidDataGridViewTextBoxColumn;
private System.Windows.Forms.DataGridViewTextBoxColumn folderNameDataGridViewTextBoxColumn;
private System.Windows.Forms.DataGridViewTextBoxColumn roleNameDataGridViewTextBoxColumn;
private System.Windows.Forms.DataGridViewTextBoxColumn startDateDataGridViewTextBoxColumn;
private System.Windows.Forms.DataGridViewTextBoxColumn endDateDataGridViewTextBoxColumn;
}
}

View File

@@ -0,0 +1,200 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using VEPROMS.CSLA.Library;
namespace WinApp
{
public partial class frmGroups : Form
{
public frmGroups(int gid)
{
InitializeComponent();
_gid = gid;
}
private int _gid;
private Group _group;
private void frmGroup_Load(object sender, EventArgs e)
{
groupInfoListBindingSource.DataSource = GroupInfoList.Get();
userInfoListBindingSource.DataSource = UserInfoList.Get();
lbGroups.SelectedValue = _gid;
SetupDetail();
SetupButtons();
}
private void BeforeFormClosing(object sender, FormClosingEventArgs e)
{
e.Cancel = (SaveAsNeeded() == DialogResult.Cancel);
}
private DialogResult SaveAsNeeded()
{
if (_group != null && _group.IsSavable)
{
DialogResult dr = MessageBox.Show("Do you want to save changes", "Save Changes", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (dr == DialogResult.Yes) Save();
if (dr == DialogResult.No) Cancel();
// TODO: Need a Cancel
return dr;
}
return DialogResult.Yes;
}
private void SetupDetail()
{
if (lbGroups.SelectedValue != null)
{
int gid = (int)lbGroups.SelectedValue;
if (_group == null || _group.GID != gid)
{
if (SaveAsNeeded() != DialogResult.Cancel)
{
_group = Group.Get(gid);
groupBindingSource.DataSource = _group;
groupMembershipsBindingSource.DataSource = _group.GroupMemberships;
groupAssignmentsBindingSource.DataSource = _group.GroupAssignments;
}
}
}
}
private void lbGroup_SelectedValueChanged(object sender, EventArgs e)
{
SetupDetail();
}
private void SetupButtons()
{
if (_group != null)
{
btnSave.Enabled = _group.IsSavable;
btnCancel.Enabled = _group.IsDirty;
btnNew.Enabled = _group.IsValid;
}
else
{
btnSave.Enabled = false;
btnCancel.Enabled = false;
btnNew.Enabled = true;
}
}
private void CurrentItemChanged(object sender, EventArgs e)
{
SetupButtons();
}
private void btnCancel_Click(object sender, EventArgs e)
{
Cancel();
}
private void btnSave_Click(object sender, EventArgs e)
{
Save();
}
private void btnNew_Click(object sender, EventArgs e)
{
New();
}
private void Cancel()
{
_group.CancelEdit();
_group.BeginEdit();
}
private void Save()
{
groupBindingSource.RaiseListChangedEvents = false;
groupMembershipsBindingSource.RaiseListChangedEvents = false;
groupBindingSource.EndEdit();
groupMembershipsBindingSource.EndEdit();
try
{
Group temp = _group.Clone();
_group = temp.Save();
_group.BeginEdit();
groupBindingSource.DataSource = null;
groupMembershipsBindingSource.DataSource = null;
int gid = _group.GID;
groupInfoListBindingSource.DataSource = GroupInfoList.Get();
lbGroups.SelectedValue = gid;
groupBindingSource.DataSource = _group;
groupMembershipsBindingSource.DataSource = _group.GroupMemberships;
}
catch (Csla.DataPortalException ex)
{
MessageBox.Show(ex.BusinessException.ToString(),
"Error saving", MessageBoxButtons.OK,
MessageBoxIcon.Exclamation);
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString(), "Error saving",
MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
finally
{
groupBindingSource.RaiseListChangedEvents = true;
groupMembershipsBindingSource.RaiseListChangedEvents = true;
groupBindingSource.ResetBindings(false);
groupMembershipsBindingSource.ResetBindings(false);
}
SetupButtons();
}
public void New()
{
if (SaveAsNeeded() != DialogResult.Cancel)
{
_group = Group.New();
groupBindingSource.DataSource = _group;
groupMembershipsBindingSource.DataSource = _group.GroupMemberships;
}
}
private void btnNewGA_Click(object sender, EventArgs e)
{
using (frmUserSelect f = new frmUserSelect())
{
f.ShowDialog();
if (f.DialogResult == DialogResult.OK)
{
_group.GroupMemberships.Add(User.Get(f.UID)); // KBR using?
SetupButtons();
}
}
}
private void btnRemoveGA_Click(object sender, EventArgs e)
{
if (this.groupMembershipsDataGridView.SelectedRows.Count > 0)
{
int uid = int.Parse(
this.groupMembershipsDataGridView.SelectedRows[0].Cells[0].Value.ToString());
MessageBox.Show("Conversion error");
//TODO KBR: _group.GroupMemberships.Remove(uid);
}
}
private void btnRemoveAssign_Click(object sender, EventArgs e)
{
if (this.groupAssignmentsDataGridView.SelectedRows.Count > 0)
{
int rid = int.Parse(
this.groupAssignmentsDataGridView.SelectedRows[0].Cells[1].Value.ToString());
int folderid = int.Parse(
this.groupAssignmentsDataGridView.SelectedRows[0].Cells[2].Value.ToString());
MessageBox.Show("Conversion error");
//TODO KBR: _group.GroupAssignments.Remove(folderid, rid);
}
}
private void btnNewAssign_Click(object sender, EventArgs e)
{
using (frmAssignmentSelect f = new frmAssignmentSelect(_group))
{
f.ShowDialog();
if (f.DialogResult == DialogResult.OK)
{
//TODO: Do I need to refresh Assignments?
}
}
}
}
}

View File

@@ -0,0 +1,153 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="configLabel.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="groupNameLabel.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="groupTypeLabel.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="groupInfoListBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="Uid.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="User_FullName.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="groupMembershipsBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>424, 17</value>
</metadata>
<metadata name="groupBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>244, 17</value>
</metadata>
<metadata name="Aid.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="groupAssignmentsBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 57</value>
</metadata>
<metadata name="userInfoListBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>687, 17</value>
</metadata>
</root>

View File

@@ -0,0 +1,317 @@
namespace WinApp
{
partial class frmMembership
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.Windows.Forms.Label dtsLabel;
System.Windows.Forms.Label endDateLabel;
System.Windows.Forms.Label gidLabel;
System.Windows.Forms.Label startDateLabel;
System.Windows.Forms.Label ugidLabel;
System.Windows.Forms.Label uidLabel;
System.Windows.Forms.Label usridLabel;
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.lbMembers = new System.Windows.Forms.ListBox();
this.membershipInfoListBindingSource = new System.Windows.Forms.BindingSource(this.components);
this.membershipBindingSource = new System.Windows.Forms.BindingSource(this.components);
this.dtsTextBox = new System.Windows.Forms.TextBox();
this.endDateTextBox = new System.Windows.Forms.TextBox();
this.gidTextBox = new System.Windows.Forms.TextBox();
this.startDateTextBox = new System.Windows.Forms.TextBox();
this.ugidTextBox = new System.Windows.Forms.TextBox();
this.uidTextBox = new System.Windows.Forms.TextBox();
this.usridTextBox = new System.Windows.Forms.TextBox();
this.btnNew = new System.Windows.Forms.Button();
this.btnCancel = new System.Windows.Forms.Button();
this.btnSave = new System.Windows.Forms.Button();
this.errorProvider1 = new System.Windows.Forms.ErrorProvider(this.components);
dtsLabel = new System.Windows.Forms.Label();
endDateLabel = new System.Windows.Forms.Label();
gidLabel = new System.Windows.Forms.Label();
startDateLabel = new System.Windows.Forms.Label();
ugidLabel = new System.Windows.Forms.Label();
uidLabel = new System.Windows.Forms.Label();
usridLabel = new System.Windows.Forms.Label();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.membershipInfoListBindingSource)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.membershipBindingSource)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.errorProvider1)).BeginInit();
this.SuspendLayout();
//
// splitContainer1
//
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer1.Location = new System.Drawing.Point(0, 0);
this.splitContainer1.Name = "splitContainer1";
//
// splitContainer1.Panel1
//
this.splitContainer1.Panel1.Controls.Add(this.lbMembers);
//
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.Controls.Add(this.btnNew);
this.splitContainer1.Panel2.Controls.Add(this.btnCancel);
this.splitContainer1.Panel2.Controls.Add(this.btnSave);
this.splitContainer1.Panel2.Controls.Add(dtsLabel);
this.splitContainer1.Panel2.Controls.Add(this.dtsTextBox);
this.splitContainer1.Panel2.Controls.Add(endDateLabel);
this.splitContainer1.Panel2.Controls.Add(this.endDateTextBox);
this.splitContainer1.Panel2.Controls.Add(gidLabel);
this.splitContainer1.Panel2.Controls.Add(this.gidTextBox);
this.splitContainer1.Panel2.Controls.Add(startDateLabel);
this.splitContainer1.Panel2.Controls.Add(this.startDateTextBox);
this.splitContainer1.Panel2.Controls.Add(ugidLabel);
this.splitContainer1.Panel2.Controls.Add(this.ugidTextBox);
this.splitContainer1.Panel2.Controls.Add(uidLabel);
this.splitContainer1.Panel2.Controls.Add(this.uidTextBox);
this.splitContainer1.Panel2.Controls.Add(usridLabel);
this.splitContainer1.Panel2.Controls.Add(this.usridTextBox);
this.splitContainer1.Size = new System.Drawing.Size(685, 409);
this.splitContainer1.SplitterDistance = 228;
this.splitContainer1.TabIndex = 0;
//
// lbMembers
//
this.lbMembers.DataSource = this.membershipInfoListBindingSource;
this.lbMembers.DisplayMember = "Ugid";
this.lbMembers.Dock = System.Windows.Forms.DockStyle.Fill;
this.lbMembers.FormattingEnabled = true;
this.lbMembers.ItemHeight = 16;
this.lbMembers.Location = new System.Drawing.Point(0, 0);
this.lbMembers.Name = "lbMembers";
this.lbMembers.Size = new System.Drawing.Size(228, 404);
this.lbMembers.TabIndex = 0;
this.lbMembers.ValueMember = "Ugid";
this.lbMembers.SelectedValueChanged += new System.EventHandler(this.lbMembers_SelectedValueChanged);
//
// membershipInfoListBindingSource
//
this.membershipInfoListBindingSource.DataSource = typeof(VEPROMS.CSLA.Library.MembershipInfo);
//
// membershipBindingSource
//
this.membershipBindingSource.DataSource = typeof(VEPROMS.CSLA.Library.Membership);
this.membershipBindingSource.CurrentItemChanged += new System.EventHandler(this.CurrentItemChanged);
//
// dtsLabel
//
dtsLabel.AutoSize = true;
dtsLabel.Location = new System.Drawing.Point(20, 15);
dtsLabel.Name = "dtsLabel";
dtsLabel.Size = new System.Drawing.Size(33, 17);
dtsLabel.TabIndex = 0;
dtsLabel.Text = "Dts:";
//
// dtsTextBox
//
this.dtsTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.membershipBindingSource, "Dts", true));
this.dtsTextBox.Location = new System.Drawing.Point(102, 12);
this.dtsTextBox.Name = "dtsTextBox";
this.dtsTextBox.Size = new System.Drawing.Size(100, 22);
this.dtsTextBox.TabIndex = 1;
//
// endDateLabel
//
endDateLabel.AutoSize = true;
endDateLabel.Location = new System.Drawing.Point(20, 43);
endDateLabel.Name = "endDateLabel";
endDateLabel.Size = new System.Drawing.Size(71, 17);
endDateLabel.TabIndex = 2;
endDateLabel.Text = "End Date:";
//
// endDateTextBox
//
this.endDateTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.membershipBindingSource, "EndDate", true));
this.endDateTextBox.Location = new System.Drawing.Point(102, 40);
this.endDateTextBox.Name = "endDateTextBox";
this.endDateTextBox.Size = new System.Drawing.Size(100, 22);
this.endDateTextBox.TabIndex = 3;
//
// gidLabel
//
gidLabel.AutoSize = true;
gidLabel.Location = new System.Drawing.Point(20, 71);
gidLabel.Name = "gidLabel";
gidLabel.Size = new System.Drawing.Size(34, 17);
gidLabel.TabIndex = 4;
gidLabel.Text = "Gid:";
//
// gidTextBox
//
this.gidTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.membershipBindingSource, "Gid", true));
this.gidTextBox.Location = new System.Drawing.Point(102, 68);
this.gidTextBox.Name = "gidTextBox";
this.gidTextBox.Size = new System.Drawing.Size(100, 22);
this.gidTextBox.TabIndex = 5;
//
// startDateLabel
//
startDateLabel.AutoSize = true;
startDateLabel.Location = new System.Drawing.Point(20, 99);
startDateLabel.Name = "startDateLabel";
startDateLabel.Size = new System.Drawing.Size(76, 17);
startDateLabel.TabIndex = 6;
startDateLabel.Text = "Start Date:";
//
// startDateTextBox
//
this.startDateTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.membershipBindingSource, "StartDate", true));
this.startDateTextBox.Location = new System.Drawing.Point(102, 96);
this.startDateTextBox.Name = "startDateTextBox";
this.startDateTextBox.Size = new System.Drawing.Size(100, 22);
this.startDateTextBox.TabIndex = 7;
//
// ugidLabel
//
ugidLabel.AutoSize = true;
ugidLabel.Location = new System.Drawing.Point(20, 127);
ugidLabel.Name = "ugidLabel";
ugidLabel.Size = new System.Drawing.Size(41, 17);
ugidLabel.TabIndex = 8;
ugidLabel.Text = "Ugid:";
//
// ugidTextBox
//
this.ugidTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.membershipBindingSource, "Ugid", true));
this.ugidTextBox.Location = new System.Drawing.Point(102, 124);
this.ugidTextBox.Name = "ugidTextBox";
this.ugidTextBox.Size = new System.Drawing.Size(100, 22);
this.ugidTextBox.TabIndex = 9;
//
// uidLabel
//
uidLabel.AutoSize = true;
uidLabel.Location = new System.Drawing.Point(20, 155);
uidLabel.Name = "uidLabel";
uidLabel.Size = new System.Drawing.Size(33, 17);
uidLabel.TabIndex = 10;
uidLabel.Text = "Uid:";
//
// uidTextBox
//
this.uidTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.membershipBindingSource, "Uid", true));
this.uidTextBox.Location = new System.Drawing.Point(102, 152);
this.uidTextBox.Name = "uidTextBox";
this.uidTextBox.Size = new System.Drawing.Size(100, 22);
this.uidTextBox.TabIndex = 11;
//
// usridLabel
//
usridLabel.AutoSize = true;
usridLabel.Location = new System.Drawing.Point(20, 183);
usridLabel.Name = "usridLabel";
usridLabel.Size = new System.Drawing.Size(45, 17);
usridLabel.TabIndex = 12;
usridLabel.Text = "Usrid:";
//
// usridTextBox
//
this.usridTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.membershipBindingSource, "Usrid", true));
this.usridTextBox.Location = new System.Drawing.Point(102, 180);
this.usridTextBox.Name = "usridTextBox";
this.usridTextBox.Size = new System.Drawing.Size(100, 22);
this.usridTextBox.TabIndex = 13;
//
// btnNew
//
this.btnNew.Location = new System.Drawing.Point(366, 67);
this.btnNew.Name = "btnNew";
this.btnNew.Size = new System.Drawing.Size(75, 23);
this.btnNew.TabIndex = 33;
this.btnNew.Text = "New";
this.btnNew.UseVisualStyleBackColor = true;
this.btnNew.Click += new System.EventHandler(this.btnNew_Click);
//
// btnCancel
//
this.btnCancel.Location = new System.Drawing.Point(366, 38);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(75, 23);
this.btnCancel.TabIndex = 32;
this.btnCancel.Text = "Cancel";
this.btnCancel.UseVisualStyleBackColor = true;
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
//
// btnSave
//
this.btnSave.Location = new System.Drawing.Point(366, 9);
this.btnSave.Name = "btnSave";
this.btnSave.Size = new System.Drawing.Size(75, 23);
this.btnSave.TabIndex = 31;
this.btnSave.Text = "Save";
this.btnSave.UseVisualStyleBackColor = true;
this.btnSave.Click += new System.EventHandler(this.btnSave_Click);
//
// errorProvider1
//
this.errorProvider1.ContainerControl = this;
this.errorProvider1.DataSource = this.membershipBindingSource;
//
// frmMembership
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(685, 409);
this.Controls.Add(this.splitContainer1);
this.Name = "frmMembership";
this.Text = "frmMembership";
this.Load += new System.EventHandler(this.frmMembership_Load);
this.splitContainer1.Panel1.ResumeLayout(false);
this.splitContainer1.Panel2.ResumeLayout(false);
this.splitContainer1.Panel2.PerformLayout();
this.splitContainer1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.membershipInfoListBindingSource)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.membershipBindingSource)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.errorProvider1)).EndInit();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.SplitContainer splitContainer1;
private System.Windows.Forms.ListBox lbMembers;
private System.Windows.Forms.BindingSource membershipInfoListBindingSource;
private System.Windows.Forms.TextBox dtsTextBox;
private System.Windows.Forms.BindingSource membershipBindingSource;
private System.Windows.Forms.TextBox endDateTextBox;
private System.Windows.Forms.TextBox gidTextBox;
private System.Windows.Forms.TextBox startDateTextBox;
private System.Windows.Forms.TextBox ugidTextBox;
private System.Windows.Forms.TextBox uidTextBox;
private System.Windows.Forms.TextBox usridTextBox;
private System.Windows.Forms.Button btnNew;
private System.Windows.Forms.Button btnCancel;
private System.Windows.Forms.Button btnSave;
private System.Windows.Forms.ErrorProvider errorProvider1;
}
}

View File

@@ -0,0 +1,137 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using VEPROMS.CSLA.Library;
namespace WinApp
{
public partial class frmMembership : Form
{
public frmMembership()
{
InitializeComponent();
}
Membership _mem;
private void frmMembership_Load(object sender, EventArgs e)
{
membershipInfoListBindingSource.DataSource = MembershipInfoList.Get();
SetupDetail();
SetupButtons();
}
private DialogResult SaveAsNeeded()
{
if (_mem != null && _mem.IsSavable)
{
DialogResult dr = MessageBox.Show("Do you want to save changes", "Save Changes", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (dr == DialogResult.Yes) Save();
if (dr == DialogResult.No) Cancel();
// TODO: Need a Cancel
return dr;
}
return DialogResult.Yes;
}
private void SetupDetail()
{
if (lbMembers.SelectedIndex != -1)
{
int ugid = (int)lbMembers.SelectedValue;
if (_mem == null || _mem.UGID != ugid)
{
if (SaveAsNeeded() != DialogResult.Cancel)
{
_mem = Membership.Get(ugid);
membershipBindingSource.DataSource = _mem;
}
}
}
}
private void lbMembers_SelectedValueChanged(object sender, EventArgs e)
{
SetupDetail();
}
private void SetupButtons()
{
if (_mem != null)
{
btnSave.Enabled = _mem.IsSavable;
btnCancel.Enabled = _mem.IsDirty;
btnNew.Enabled = _mem.IsValid;
}
else
{
btnSave.Enabled = false;
btnCancel.Enabled = false;
btnNew.Enabled = true;
}
}
private void CurrentItemChanged(object sender, EventArgs e)
{
SetupButtons();
}
private void btnCancel_Click(object sender, EventArgs e)
{
Cancel();
}
private void btnSave_Click(object sender, EventArgs e)
{
Save();
}
private void btnNew_Click(object sender, EventArgs e)
{
New();
}
private void Cancel()
{
_mem.CancelEdit();
_mem.BeginEdit();
}
private void Save()
{
membershipBindingSource.RaiseListChangedEvents = false;
membershipBindingSource.EndEdit();
try
{
Membership temp = _mem.Clone();
_mem = temp.Save();
_mem.BeginEdit();
membershipBindingSource.DataSource = null;
int ugid = _mem.UID;
if (lbMembers.SelectedIndex == -1)
lbMembers.SelectedValue = ugid;
membershipBindingSource.DataSource = _mem;
}
catch (Csla.DataPortalException ex)
{
MessageBox.Show(ex.BusinessException.ToString(),
"Error saving", MessageBoxButtons.OK,
MessageBoxIcon.Exclamation);
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString(), "Error saving",
MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
finally
{
membershipBindingSource.RaiseListChangedEvents = true;
membershipBindingSource.ResetBindings(false);
}
SetupButtons();
}
public void New()
{
if (SaveAsNeeded() != DialogResult.Cancel)
{
_mem = Membership.New();
membershipBindingSource.DataSource = _mem;
lbMembers.SelectedIndex = -1;
}
}
}
}

View File

@@ -0,0 +1,156 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="membershipInfoListBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="dtsLabel.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="membershipBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>285, 17</value>
</metadata>
<metadata name="endDateLabel.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="gidLabel.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="startDateLabel.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="ugidLabel.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="uidLabel.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="usridLabel.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="membershipInfoListBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="membershipBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>285, 17</value>
</metadata>
<metadata name="errorProvider1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>506, 17</value>
</metadata>
</root>

View File

@@ -0,0 +1,555 @@
namespace WinApp
{
partial class frmRoles
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.Windows.Forms.Label nameLabel;
System.Windows.Forms.Label titleLabel;
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.lbRoles = new System.Windows.Forms.ListBox();
this.roleInfoListBindingSource = new System.Windows.Forms.BindingSource(this.components);
this.tabControl1 = new System.Windows.Forms.TabControl();
this.tabPage1 = new System.Windows.Forms.TabPage();
this.roleAssignmentsDataGridView = new System.Windows.Forms.DataGridView();
this.StartDate = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.EndDate = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.roleAssignmentsBindingSource = new System.Windows.Forms.BindingSource(this.components);
this.panel3 = new System.Windows.Forms.Panel();
this.btnRemoveAssign = new System.Windows.Forms.Button();
this.btnNewAssign = new System.Windows.Forms.Button();
this.tabPage2 = new System.Windows.Forms.TabPage();
this.rolePermissionsDataGridView = new System.Windows.Forms.DataGridView();
this.Pid = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.permADLookupBindingSource = new System.Windows.Forms.BindingSource(this.components);
this.dataGridViewTextBoxColumn13 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.dataGridViewTextBoxColumn19 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.dataGridViewTextBoxColumn7 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.dataGridViewCheckBoxColumn2 = new System.Windows.Forms.DataGridViewCheckBoxColumn();
this.dataGridViewCheckBoxColumn4 = new System.Windows.Forms.DataGridViewCheckBoxColumn();
this.dataGridViewCheckBoxColumn1 = new System.Windows.Forms.DataGridViewCheckBoxColumn();
this.dataGridViewCheckBoxColumn3 = new System.Windows.Forms.DataGridViewCheckBoxColumn();
this.dataGridViewTextBoxColumn16 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.dataGridViewTextBoxColumn12 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.rolePermissionsBindingSource = new System.Windows.Forms.BindingSource(this.components);
this.roleBindingSource = new System.Windows.Forms.BindingSource(this.components);
this.panel2 = new System.Windows.Forms.Panel();
this.button1 = new System.Windows.Forms.Button();
this.btnNewPermission = new System.Windows.Forms.Button();
this.panel1 = new System.Windows.Forms.Panel();
this.nameTextBox = new System.Windows.Forms.TextBox();
this.ridTextBox = new System.Windows.Forms.TextBox();
this.titleTextBox = new System.Windows.Forms.TextBox();
this.btnNew = new System.Windows.Forms.Button();
this.btnCancel = new System.Windows.Forms.Button();
this.btnSave = new System.Windows.Forms.Button();
this.dataGridViewTextBoxColumn10 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.errorProvider1 = new System.Windows.Forms.ErrorProvider(this.components);
nameLabel = new System.Windows.Forms.Label();
titleLabel = new System.Windows.Forms.Label();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.roleInfoListBindingSource)).BeginInit();
this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.roleAssignmentsDataGridView)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.roleAssignmentsBindingSource)).BeginInit();
this.panel3.SuspendLayout();
this.tabPage2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.rolePermissionsDataGridView)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.permADLookupBindingSource)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.rolePermissionsBindingSource)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.roleBindingSource)).BeginInit();
this.panel2.SuspendLayout();
this.panel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.errorProvider1)).BeginInit();
this.SuspendLayout();
//
// nameLabel
//
nameLabel.AutoSize = true;
nameLabel.Location = new System.Drawing.Point(69, 11);
nameLabel.Name = "nameLabel";
nameLabel.Size = new System.Drawing.Size(49, 17);
nameLabel.TabIndex = 21;
nameLabel.Text = "Name:";
//
// titleLabel
//
titleLabel.AutoSize = true;
titleLabel.Location = new System.Drawing.Point(6, 38);
titleLabel.Name = "titleLabel";
titleLabel.Size = new System.Drawing.Size(39, 17);
titleLabel.TabIndex = 24;
titleLabel.Text = "Title:";
//
// splitContainer1
//
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer1.Location = new System.Drawing.Point(0, 0);
this.splitContainer1.Name = "splitContainer1";
//
// splitContainer1.Panel1
//
this.splitContainer1.Panel1.Controls.Add(this.lbRoles);
//
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.AutoScroll = true;
this.splitContainer1.Panel2.Controls.Add(this.tabControl1);
this.splitContainer1.Panel2.Controls.Add(this.panel1);
this.splitContainer1.Size = new System.Drawing.Size(863, 550);
this.splitContainer1.SplitterDistance = 225;
this.splitContainer1.TabIndex = 0;
//
// lbRoles
//
this.lbRoles.DataSource = this.roleInfoListBindingSource;
this.lbRoles.DisplayMember = "Name";
this.lbRoles.Dock = System.Windows.Forms.DockStyle.Fill;
this.lbRoles.FormattingEnabled = true;
this.lbRoles.ItemHeight = 16;
this.lbRoles.Location = new System.Drawing.Point(0, 0);
this.lbRoles.Name = "lbRoles";
this.lbRoles.Size = new System.Drawing.Size(225, 548);
this.lbRoles.TabIndex = 0;
this.lbRoles.ValueMember = "Rid";
this.lbRoles.SelectedValueChanged += new System.EventHandler(this.lbRole_SelectedValueChanged);
//
// roleInfoListBindingSource
//
this.roleInfoListBindingSource.DataSource = typeof(VEPROMS.CSLA.Library.RoleInfo);
//
// tabControl1
//
this.tabControl1.Controls.Add(this.tabPage1);
this.tabControl1.Controls.Add(this.tabPage2);
this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tabControl1.Location = new System.Drawing.Point(0, 102);
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(634, 448);
this.tabControl1.TabIndex = 18;
//
// tabPage1
//
this.tabPage1.Controls.Add(this.roleAssignmentsDataGridView);
this.tabPage1.Controls.Add(this.panel3);
this.tabPage1.Location = new System.Drawing.Point(4, 25);
this.tabPage1.Name = "tabPage1";
this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
this.tabPage1.Size = new System.Drawing.Size(626, 419);
this.tabPage1.TabIndex = 0;
this.tabPage1.Text = "Assignments";
this.tabPage1.UseVisualStyleBackColor = true;
//
// roleAssignmentsDataGridView
//
this.roleAssignmentsDataGridView.AutoGenerateColumns = false;
this.roleAssignmentsDataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.StartDate,
this.EndDate});
this.roleAssignmentsDataGridView.DataSource = this.roleAssignmentsBindingSource;
this.roleAssignmentsDataGridView.Dock = System.Windows.Forms.DockStyle.Fill;
this.roleAssignmentsDataGridView.Location = new System.Drawing.Point(3, 35);
this.roleAssignmentsDataGridView.Name = "roleAssignmentsDataGridView";
this.roleAssignmentsDataGridView.RowTemplate.Height = 24;
this.roleAssignmentsDataGridView.Size = new System.Drawing.Size(620, 381);
this.roleAssignmentsDataGridView.TabIndex = 18;
//
// StartDate
//
this.StartDate.DataPropertyName = "StartDate";
this.StartDate.HeaderText = "StartDate";
this.StartDate.Name = "StartDate";
//
// EndDate
//
this.EndDate.DataPropertyName = "EndDate";
this.EndDate.HeaderText = "EndDate";
this.EndDate.Name = "EndDate";
//
// roleAssignmentsBindingSource
//
this.roleAssignmentsBindingSource.CurrentItemChanged += new System.EventHandler(this.CurrentItemChanged);
//
// panel3
//
this.panel3.AutoScroll = true;
this.panel3.Controls.Add(this.btnRemoveAssign);
this.panel3.Controls.Add(this.btnNewAssign);
this.panel3.Dock = System.Windows.Forms.DockStyle.Top;
this.panel3.Location = new System.Drawing.Point(3, 3);
this.panel3.Name = "panel3";
this.panel3.Size = new System.Drawing.Size(620, 32);
this.panel3.TabIndex = 19;
//
// btnRemoveAssign
//
this.btnRemoveAssign.AutoSize = true;
this.btnRemoveAssign.Dock = System.Windows.Forms.DockStyle.Left;
this.btnRemoveAssign.Location = new System.Drawing.Point(75, 0);
this.btnRemoveAssign.Name = "btnRemoveAssign";
this.btnRemoveAssign.Size = new System.Drawing.Size(75, 32);
this.btnRemoveAssign.TabIndex = 20;
this.btnRemoveAssign.Text = "Remove";
this.btnRemoveAssign.UseVisualStyleBackColor = true;
//
// btnNewAssign
//
this.btnNewAssign.AutoSize = true;
this.btnNewAssign.Dock = System.Windows.Forms.DockStyle.Left;
this.btnNewAssign.Location = new System.Drawing.Point(0, 0);
this.btnNewAssign.Name = "btnNewAssign";
this.btnNewAssign.Size = new System.Drawing.Size(75, 32);
this.btnNewAssign.TabIndex = 19;
this.btnNewAssign.Text = "New";
this.btnNewAssign.UseVisualStyleBackColor = true;
//
// tabPage2
//
this.tabPage2.AutoScroll = true;
this.tabPage2.Controls.Add(this.rolePermissionsDataGridView);
this.tabPage2.Controls.Add(this.panel2);
this.tabPage2.Location = new System.Drawing.Point(4, 25);
this.tabPage2.Name = "tabPage2";
this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
this.tabPage2.Size = new System.Drawing.Size(626, 419);
this.tabPage2.TabIndex = 1;
this.tabPage2.Text = "Permissions";
this.tabPage2.UseVisualStyleBackColor = true;
//
// rolePermissionsDataGridView
//
this.rolePermissionsDataGridView.AutoGenerateColumns = false;
this.rolePermissionsDataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.Pid,
this.dataGridViewTextBoxColumn13,
this.dataGridViewTextBoxColumn19,
this.dataGridViewTextBoxColumn7,
this.dataGridViewCheckBoxColumn2,
this.dataGridViewCheckBoxColumn4,
this.dataGridViewCheckBoxColumn1,
this.dataGridViewCheckBoxColumn3,
this.dataGridViewTextBoxColumn16,
this.dataGridViewTextBoxColumn12});
this.rolePermissionsDataGridView.DataSource = this.rolePermissionsBindingSource;
this.rolePermissionsDataGridView.Dock = System.Windows.Forms.DockStyle.Fill;
this.rolePermissionsDataGridView.Location = new System.Drawing.Point(3, 37);
this.rolePermissionsDataGridView.Name = "rolePermissionsDataGridView";
this.rolePermissionsDataGridView.RowTemplate.Height = 24;
this.rolePermissionsDataGridView.Size = new System.Drawing.Size(620, 379);
this.rolePermissionsDataGridView.TabIndex = 20;
//
// Pid
//
this.Pid.DataPropertyName = "Pid";
this.Pid.HeaderText = "Pid";
this.Pid.MinimumWidth = 2;
this.Pid.Name = "Pid";
this.Pid.ReadOnly = true;
this.Pid.Visible = false;
this.Pid.Width = 2;
//
// permADLookupBindingSource
//
this.permADLookupBindingSource.DataSource = typeof(VEPROMS.CSLA.Library.vlnValueKey);
//
// dataGridViewTextBoxColumn13
//
this.dataGridViewTextBoxColumn13.DataPropertyName = "VersionType";
this.dataGridViewTextBoxColumn13.HeaderText = "VersionType";
this.dataGridViewTextBoxColumn13.Name = "dataGridViewTextBoxColumn13";
//
// dataGridViewTextBoxColumn19
//
this.dataGridViewTextBoxColumn19.DataPropertyName = "PermLevel";
this.dataGridViewTextBoxColumn19.HeaderText = "PermLevel";
this.dataGridViewTextBoxColumn19.Name = "dataGridViewTextBoxColumn19";
this.dataGridViewTextBoxColumn19.Resizable = System.Windows.Forms.DataGridViewTriState.True;
//
// dataGridViewTextBoxColumn7
//
this.dataGridViewTextBoxColumn7.DataPropertyName = "PermValue";
this.dataGridViewTextBoxColumn7.HeaderText = "PermValue";
this.dataGridViewTextBoxColumn7.Name = "dataGridViewTextBoxColumn7";
this.dataGridViewTextBoxColumn7.Visible = false;
//
// dataGridViewCheckBoxColumn2
//
this.dataGridViewCheckBoxColumn2.DataPropertyName = "ReadAccess";
this.dataGridViewCheckBoxColumn2.HeaderText = "R";
this.dataGridViewCheckBoxColumn2.Name = "dataGridViewCheckBoxColumn2";
this.dataGridViewCheckBoxColumn2.ToolTipText = "Read Access";
this.dataGridViewCheckBoxColumn2.Width = 30;
//
// dataGridViewCheckBoxColumn4
//
this.dataGridViewCheckBoxColumn4.DataPropertyName = "WriteAccess";
this.dataGridViewCheckBoxColumn4.HeaderText = "W";
this.dataGridViewCheckBoxColumn4.Name = "dataGridViewCheckBoxColumn4";
this.dataGridViewCheckBoxColumn4.ToolTipText = "Write Access";
this.dataGridViewCheckBoxColumn4.Width = 30;
//
// dataGridViewCheckBoxColumn1
//
this.dataGridViewCheckBoxColumn1.DataPropertyName = "CreateAccess";
this.dataGridViewCheckBoxColumn1.HeaderText = "C";
this.dataGridViewCheckBoxColumn1.Name = "dataGridViewCheckBoxColumn1";
this.dataGridViewCheckBoxColumn1.ToolTipText = "Create Access";
this.dataGridViewCheckBoxColumn1.Width = 30;
//
// dataGridViewCheckBoxColumn3
//
this.dataGridViewCheckBoxColumn3.DataPropertyName = "DeleteAccess";
this.dataGridViewCheckBoxColumn3.HeaderText = "D";
this.dataGridViewCheckBoxColumn3.Name = "dataGridViewCheckBoxColumn3";
this.dataGridViewCheckBoxColumn3.ToolTipText = "Delete Access";
this.dataGridViewCheckBoxColumn3.Width = 30;
//
// dataGridViewTextBoxColumn16
//
this.dataGridViewTextBoxColumn16.DataPropertyName = "EndDate";
this.dataGridViewTextBoxColumn16.HeaderText = "EndDate";
this.dataGridViewTextBoxColumn16.Name = "dataGridViewTextBoxColumn16";
//
// dataGridViewTextBoxColumn12
//
this.dataGridViewTextBoxColumn12.DataPropertyName = "StartDate";
this.dataGridViewTextBoxColumn12.HeaderText = "StartDate";
this.dataGridViewTextBoxColumn12.Name = "dataGridViewTextBoxColumn12";
//
// rolePermissionsBindingSource
//
this.rolePermissionsBindingSource.DataMember = "RolePermissions";
this.rolePermissionsBindingSource.DataSource = this.roleBindingSource;
this.rolePermissionsBindingSource.CurrentItemChanged += new System.EventHandler(this.CurrentItemChanged);
//
// roleBindingSource
//
this.roleBindingSource.DataSource = typeof(VEPROMS.CSLA.Library.Role);
this.roleBindingSource.CurrentItemChanged += new System.EventHandler(this.CurrentItemChanged);
//
// panel2
//
this.panel2.Controls.Add(this.button1);
this.panel2.Controls.Add(this.btnNewPermission);
this.panel2.Dock = System.Windows.Forms.DockStyle.Top;
this.panel2.Location = new System.Drawing.Point(3, 3);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(620, 34);
this.panel2.TabIndex = 20;
//
// button1
//
this.button1.AutoSize = true;
this.button1.Dock = System.Windows.Forms.DockStyle.Left;
this.button1.Location = new System.Drawing.Point(75, 0);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 34);
this.button1.TabIndex = 20;
this.button1.Text = "Remove";
this.button1.UseVisualStyleBackColor = true;
//
// btnNewPermission
//
this.btnNewPermission.AutoSize = true;
this.btnNewPermission.Dock = System.Windows.Forms.DockStyle.Left;
this.btnNewPermission.Location = new System.Drawing.Point(0, 0);
this.btnNewPermission.Name = "btnNewPermission";
this.btnNewPermission.Size = new System.Drawing.Size(75, 34);
this.btnNewPermission.TabIndex = 19;
this.btnNewPermission.Text = "New";
this.btnNewPermission.UseVisualStyleBackColor = true;
this.btnNewPermission.Click += new System.EventHandler(this.btnNewPermission_Click);
//
// panel1
//
this.panel1.AutoScroll = true;
this.panel1.Controls.Add(nameLabel);
this.panel1.Controls.Add(this.nameTextBox);
this.panel1.Controls.Add(this.ridTextBox);
this.panel1.Controls.Add(titleLabel);
this.panel1.Controls.Add(this.titleTextBox);
this.panel1.Controls.Add(this.btnNew);
this.panel1.Controls.Add(this.btnCancel);
this.panel1.Controls.Add(this.btnSave);
this.panel1.Dock = System.Windows.Forms.DockStyle.Top;
this.panel1.Location = new System.Drawing.Point(0, 0);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(634, 102);
this.panel1.TabIndex = 19;
//
// nameTextBox
//
this.nameTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.roleBindingSource, "Name", true));
this.nameTextBox.Location = new System.Drawing.Point(124, 6);
this.nameTextBox.Name = "nameTextBox";
this.nameTextBox.Size = new System.Drawing.Size(417, 22);
this.nameTextBox.TabIndex = 22;
//
// ridTextBox
//
this.ridTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.roleBindingSource, "Rid", true));
this.ridTextBox.Enabled = false;
this.ridTextBox.Location = new System.Drawing.Point(7, 5);
this.ridTextBox.Name = "ridTextBox";
this.ridTextBox.Size = new System.Drawing.Size(47, 22);
this.ridTextBox.TabIndex = 23;
//
// titleTextBox
//
this.titleTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.roleBindingSource, "Title", true));
this.titleTextBox.Location = new System.Drawing.Point(61, 35);
this.titleTextBox.Multiline = true;
this.titleTextBox.Name = "titleTextBox";
this.titleTextBox.Size = new System.Drawing.Size(480, 51);
this.titleTextBox.TabIndex = 25;
//
// btnNew
//
this.btnNew.Location = new System.Drawing.Point(547, 62);
this.btnNew.Name = "btnNew";
this.btnNew.Size = new System.Drawing.Size(75, 23);
this.btnNew.TabIndex = 20;
this.btnNew.Text = "New";
this.btnNew.UseVisualStyleBackColor = true;
this.btnNew.Click += new System.EventHandler(this.btnNew_Click);
//
// btnCancel
//
this.btnCancel.Location = new System.Drawing.Point(547, 33);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(75, 23);
this.btnCancel.TabIndex = 19;
this.btnCancel.Text = "Cancel";
this.btnCancel.UseVisualStyleBackColor = true;
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
//
// btnSave
//
this.btnSave.Location = new System.Drawing.Point(547, 4);
this.btnSave.Name = "btnSave";
this.btnSave.Size = new System.Drawing.Size(75, 23);
this.btnSave.TabIndex = 18;
this.btnSave.Text = "Save";
this.btnSave.UseVisualStyleBackColor = true;
this.btnSave.Click += new System.EventHandler(this.btnSave_Click);
//
// dataGridViewTextBoxColumn10
//
this.dataGridViewTextBoxColumn10.DataPropertyName = "Pid";
this.dataGridViewTextBoxColumn10.HeaderText = "Pid";
this.dataGridViewTextBoxColumn10.Name = "dataGridViewTextBoxColumn10";
this.dataGridViewTextBoxColumn10.ReadOnly = true;
this.dataGridViewTextBoxColumn10.Visible = false;
//
// errorProvider1
//
this.errorProvider1.ContainerControl = this;
this.errorProvider1.DataSource = this.roleBindingSource;
//
// frmRoles
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(863, 550);
this.Controls.Add(this.splitContainer1);
this.Name = "frmRoles";
this.Text = "Roles";
this.Load += new System.EventHandler(this.frmRoles_Load);
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.BeforeFormClosing);
this.splitContainer1.Panel1.ResumeLayout(false);
this.splitContainer1.Panel2.ResumeLayout(false);
this.splitContainer1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.roleInfoListBindingSource)).EndInit();
this.tabControl1.ResumeLayout(false);
this.tabPage1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.roleAssignmentsDataGridView)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.roleAssignmentsBindingSource)).EndInit();
this.panel3.ResumeLayout(false);
this.panel3.PerformLayout();
this.tabPage2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.rolePermissionsDataGridView)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.permADLookupBindingSource)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.rolePermissionsBindingSource)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.roleBindingSource)).EndInit();
this.panel2.ResumeLayout(false);
this.panel2.PerformLayout();
this.panel1.ResumeLayout(false);
this.panel1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.errorProvider1)).EndInit();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.SplitContainer splitContainer1;
private System.Windows.Forms.ListBox lbRoles;
private System.Windows.Forms.BindingSource roleInfoListBindingSource;
private System.Windows.Forms.BindingSource roleAssignmentsBindingSource;
private System.Windows.Forms.BindingSource roleBindingSource;
private System.Windows.Forms.TabControl tabControl1;
private System.Windows.Forms.TabPage tabPage1;
private System.Windows.Forms.DataGridView roleAssignmentsDataGridView;
private System.Windows.Forms.DataGridViewTextBoxColumn StartDate;
private System.Windows.Forms.DataGridViewTextBoxColumn EndDate;
private System.Windows.Forms.TabPage tabPage2;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.TextBox nameTextBox;
private System.Windows.Forms.TextBox ridTextBox;
private System.Windows.Forms.TextBox titleTextBox;
private System.Windows.Forms.Button btnNew;
private System.Windows.Forms.Button btnCancel;
private System.Windows.Forms.Button btnSave;
private System.Windows.Forms.Panel panel3;
private System.Windows.Forms.Button btnRemoveAssign;
private System.Windows.Forms.Button btnNewAssign;
private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn10;
private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button btnNewPermission;
private System.Windows.Forms.DataGridView rolePermissionsDataGridView;
private System.Windows.Forms.BindingSource rolePermissionsBindingSource;
private System.Windows.Forms.ErrorProvider errorProvider1;
private System.Windows.Forms.BindingSource permADLookupBindingSource;
private System.Windows.Forms.DataGridViewTextBoxColumn Pid;
private System.Windows.Forms.DataGridViewComboBoxColumn dataGridViewTextBoxColumn15;
private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn13;
private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn19;
private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn7;
private System.Windows.Forms.DataGridViewCheckBoxColumn dataGridViewCheckBoxColumn2;
private System.Windows.Forms.DataGridViewCheckBoxColumn dataGridViewCheckBoxColumn4;
private System.Windows.Forms.DataGridViewCheckBoxColumn dataGridViewCheckBoxColumn1;
private System.Windows.Forms.DataGridViewCheckBoxColumn dataGridViewCheckBoxColumn3;
private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn16;
private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn12;
}
}

View File

@@ -0,0 +1,211 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using VEPROMS.CSLA.Library;
namespace WinApp
{
public partial class frmRoles : Form
{
Role _role;
private PermLookup _pl=new PermLookup();
public frmRoles()
{
InitializeComponent();
roleInfoListBindingSource.DataSource = RoleInfoList.Get();
permADLookupBindingSource.DataSource = _pl.PermADLookup;
SetupDetail();
SetupButtons();
}
private DialogResult SaveAsNeeded()
{
if (_role != null && _role.IsSavable)
{
DialogResult dr = MessageBox.Show("Do you want to save changes", "Save Changes", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (dr == DialogResult.Yes) Save();
if (dr == DialogResult.No) Cancel();
// TODO: Need a Cancel
return dr;
}
return DialogResult.Yes;
}
private void SetupDetail()
{
if (lbRoles.SelectedValue != null)
{
int rid = (int)lbRoles.SelectedValue;
if (_role == null || _role.RID != rid)
{
if (SaveAsNeeded() != DialogResult.Cancel)
{
_role = Role.Get(rid);
roleBindingSource.DataSource = _role;
roleAssignmentsBindingSource.DataSource = _role.RoleAssignments;
rolePermissionsBindingSource.DataSource = _role.RolePermissions;
}
}
}
}
private void lbRole_SelectedValueChanged(object sender, EventArgs e)
{
SetupDetail();
}
private void SetupButtons()
{
if (_role != null)
{
btnSave.Enabled = _role.IsSavable;
btnCancel.Enabled = _role.IsDirty;
btnNew.Enabled = _role.IsValid;
}
else
{
btnSave.Enabled = false;
btnCancel.Enabled = false;
btnNew.Enabled = true;
}
}
private void CurrentItemChanged(object sender, EventArgs e)
{
SetupButtons();
}
private void btnCancel_Click(object sender, EventArgs e)
{
Cancel();
}
private void btnSave_Click(object sender, EventArgs e)
{
Save();
}
private void btnNew_Click(object sender, EventArgs e)
{
New();
}
private void Cancel()
{
_role.CancelEdit();
_role.BeginEdit();
}
private void Save()
{
roleBindingSource.RaiseListChangedEvents = false;
roleAssignmentsBindingSource.RaiseListChangedEvents = false;
rolePermissionsBindingSource.RaiseListChangedEvents = false;
roleBindingSource.EndEdit();
roleAssignmentsBindingSource.EndEdit();
rolePermissionsBindingSource.EndEdit();
try
{
Role temp = _role.Clone();
_role = temp.Save();
_role.BeginEdit();
roleBindingSource.DataSource = null;
roleAssignmentsBindingSource.DataSource = null;
rolePermissionsBindingSource.DataSource = null;
int rid = _role.RID;
roleInfoListBindingSource.DataSource = RoleInfoList.Get();
if (lbRoles.SelectedIndex == -1)
lbRoles.SelectedValue = rid;
roleBindingSource.DataSource = _role;
roleAssignmentsBindingSource.DataSource = _role.RoleAssignments;
rolePermissionsBindingSource.DataSource = _role.RolePermissions;
}
catch (Csla.DataPortalException ex)
{
MessageBox.Show(ex.BusinessException.ToString(),
"Error saving", MessageBoxButtons.OK,
MessageBoxIcon.Exclamation);
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString(), "Error saving",
MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
finally
{
roleBindingSource.RaiseListChangedEvents = true;
roleAssignmentsBindingSource.RaiseListChangedEvents = true;
rolePermissionsBindingSource.RaiseListChangedEvents = true;
roleBindingSource.ResetBindings(false);
roleAssignmentsBindingSource.ResetBindings(false);
rolePermissionsBindingSource.ResetBindings(false);
}
SetupButtons();
}
public void New()
{
if (SaveAsNeeded() != DialogResult.Cancel)
{
_role = Role.New();
roleBindingSource.DataSource = _role;
roleAssignmentsBindingSource.DataSource = _role.RoleAssignments;
rolePermissionsBindingSource.DataSource = _role.RolePermissions;
}
}
private void BeforeFormClosing(object sender, FormClosingEventArgs e)
{
e.Cancel = (SaveAsNeeded() == DialogResult.Cancel);
}
private void btnNewPermission_Click(object sender, EventArgs e)
{
_role.RolePermissions.Add(RolePermission.New());
}
private void frmRoles_Load(object sender, EventArgs e)
{
}
//private void btnNewGA_Click(object sender, EventArgs e)
//{
// using (frmUserSelect f = new frmUserSelect())
// {
// f.ShowDialog();
// if (f.DialogResult == DialogResult.OK)
// {
// _group.GroupMemberships.Add(f.UID);
// SetupButtons();
// }
// }
//}
//private void btnRemoveGA_Click(object sender, EventArgs e)
//{
// if (this.groupMembershipsDataGridView.SelectedRows.Count > 0)
// {
// int uid = int.Parse(
// this.groupMembershipsDataGridView.SelectedRows[0].Cells[0].Value.ToString());
// _group.GroupMemberships.Remove(uid);
// }
//}
//private void btnRemoveAssign_Click(object sender, EventArgs e)
//{
// if (this.groupPermissionsDataGridView.SelectedRows.Count > 0)
// {
// int folderid = int.Parse(
// this.groupMembershipsDataGridView.SelectedRows[1].Cells[0].Value.ToString());
// int rid = int.Parse(
// this.groupMembershipsDataGridView.SelectedRows[2].Cells[0].Value.ToString());
// _group.GroupAssignments.Remove(folderid, rid);
// }
//}
//private void btnNewAssign_Click(object sender, EventArgs e)
//{
// using (frmAssignmentSelect f = new frmAssignmentSelect(_group))
// {
// f.ShowDialog();
// if (f.DialogResult == DialogResult.OK)
// {
// //TODO: Do I need to refresh Assignments?
// }
// }
//}
}
}

Some files were not shown because too many files have changed in this diff Show More