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,161 @@
using System;
using ProjectTracker.Library.Security;
using System.Web;
using System.Web.Security;
public class PTMembershipProvider : MembershipProvider
{
public override bool ValidateUser(
string username, string password)
{
bool result = PTPrincipal.Login(username, password);
HttpContext.Current.Session["CslaPrincipal"] =
Csla.ApplicationContext.User;
return result;
}
#region Non-Implemented Members
// the following members must be implemented due to the abstract class MembershipProvider,
// but not required to be functional for using the Login control.
public override bool ChangePassword(string username, string oldPassword, string newPassword)
{
throw new NotSupportedException("The method or operation is not implemented.");
}
public override bool ChangePasswordQuestionAndAnswer(string username, string password, string newPasswordQuestion, string newPasswordAnswer)
{
throw new NotSupportedException("The method or operation is not implemented.");
}
public override MembershipUser CreateUser(string username, string password, string email, string passwordQuestion, string passwordAnswer, bool isApproved, object providerUserKey, out MembershipCreateStatus status)
{
throw new NotSupportedException("The method or operation is not implemented.");
}
public override bool DeleteUser(string username, bool deleteAllRelatedData)
{
throw new NotSupportedException("The method or operation is not implemented.");
}
public override bool EnablePasswordReset
{
get { throw new NotSupportedException("The method or operation is not implemented."); }
}
public override bool EnablePasswordRetrieval
{
get { throw new NotSupportedException("The method or operation is not implemented."); }
}
public override MembershipUserCollection FindUsersByEmail(string emailToMatch, int pageIndex, int pageSize, out int totalRecords)
{
throw new NotSupportedException("The method or operation is not implemented.");
}
public override MembershipUserCollection FindUsersByName(string usernameToMatch, int pageIndex, int pageSize, out int totalRecords)
{
throw new NotSupportedException("The method or operation is not implemented.");
}
public override MembershipUserCollection GetAllUsers(int pageIndex, int pageSize, out int totalRecords)
{
throw new NotSupportedException("The method or operation is not implemented.");
}
public override int GetNumberOfUsersOnline()
{
throw new NotSupportedException("The method or operation is not implemented.");
}
public override string GetPassword(string username, string answer)
{
throw new NotSupportedException("The method or operation is not implemented.");
}
public override MembershipUser GetUser(string username, bool userIsOnline)
{
throw new NotSupportedException("The method or operation is not implemented.");
}
public override MembershipUser GetUser(object providerUserKey, bool userIsOnline)
{
throw new NotSupportedException("The method or operation is not implemented.");
}
public override string GetUserNameByEmail(string email)
{
throw new NotSupportedException("The method or operation is not implemented.");
}
public override int MaxInvalidPasswordAttempts
{
get { throw new NotSupportedException("The method or operation is not implemented."); }
}
public override int MinRequiredNonAlphanumericCharacters
{
get { throw new NotSupportedException("The method or operation is not implemented."); }
}
public override int MinRequiredPasswordLength
{
get { throw new NotSupportedException("The method or operation is not implemented."); }
}
public override int PasswordAttemptWindow
{
get { throw new NotSupportedException("The method or operation is not implemented."); }
}
public override MembershipPasswordFormat PasswordFormat
{
get { throw new NotSupportedException("The method or operation is not implemented."); }
}
public override string PasswordStrengthRegularExpression
{
get { throw new NotSupportedException("The method or operation is not implemented."); }
}
public override bool RequiresQuestionAndAnswer
{
get { throw new NotSupportedException("The method or operation is not implemented."); }
}
public override bool RequiresUniqueEmail
{
get { throw new NotSupportedException("The method or operation is not implemented."); }
}
public override string ResetPassword(string username, string answer)
{
throw new NotSupportedException("The method or operation is not implemented.");
}
public override bool UnlockUser(string userName)
{
throw new NotSupportedException("The method or operation is not implemented.");
}
public override void UpdateUser(MembershipUser user)
{
throw new NotSupportedException("The method or operation is not implemented.");
}
public override string ApplicationName
{
get
{
throw new NotSupportedException("The method or operation is not implemented.");
}
set
{
throw new NotSupportedException("The method or operation is not implemented.");
}
}
#endregion
}

View File

@@ -0,0 +1,106 @@
html,body
{
background-color: #DEDEDE;
height: 90%;
}
a
{
color: #000000;
text-decoration: none;
}
a:hover
{
text-decoration: underline;
}
.nav
{
color: #FFFFFF;
text-decoration: none;
}
.nav:hover
{
text-decoration: underline;
}
#mainTable
{
border: solid 1px #000000;
width: 798px;
height: 90%;
min-height: 100%;
padding: 0px;
border-collapse: collapse;
margin-left: auto;
margin-right: auto;
background-color: #FFFFFF;
}
#header
{
background-image: url('images/background.jpg');
background-repeat: no-repeat;
height: 64px;
line-height: 60px;
text-align: left;
color: #FFFFFF;
font-family:
Verdana, Arial, Helvetica, sans-serif;
font-size: 36px;
font-weight: bold;
font-style: italic;
padding-left: 10px
}
#navigation
{
float: left;
width: 150px;
background-color: #000000;
height: 100%
}
#navigationContent
{
color: #FFFFFF;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
font-weight: bold;
font-style: italic;
margin-left: 25px;
white-space: nowrap;
margin-top: 30px;
}
#subnavigation
{
background-color: #DEDEDE;
height: 19px;
background-image: url('images/corner.png');
position: relative;
left: -3px;
background-repeat: no-repeat;
background-position: left top;
line-height: 19px
}
#logout
{
text-align: right;
padding-right: 10px;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 11px;
}
#content
{
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 11px;
float: left;
padding: 10px;
padding-top: 10px;
width: 625px;
}

View File

@@ -0,0 +1,29 @@
<asp:TreeView runat="server">
<NodeStyle CssClass="nav" />
</asp:TreeView>
<asp:GridView runat="server" BackColor="White" BorderColor="#999999" BorderStyle="Solid" BorderWidth="1px" CellPadding="3" ForeColor="Black" GridLines="Vertical">
<FooterStyle BackColor="#CCCCCC" />
<SelectedRowStyle BackColor="#000099" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" />
<HeaderStyle BackColor="Black" Font-Bold="True" ForeColor="White" />
<AlternatingRowStyle BackColor="#DEDEDE" Font-Names="Verdana" Font-Overline="False" Font-Size="9pt" />
<RowStyle Font-Names="Verdana" Font-Size="9pt" Font-Strikeout="False" />
</asp:GridView>
<asp:DetailsView runat="server" BackColor="White" BorderColor="#999999" BorderStyle="Solid" BorderWidth="1px" CellPadding="3" ForeColor="Black" GridLines="Vertical">
<FooterStyle BackColor="#CCCCCC" />
<EditRowStyle BackColor="#FFFFFF" Font-Bold="True" ForeColor="#000000" />
<RowStyle Font-Names="Verdana" Font-Size="8pt" />
<PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" />
<HeaderStyle BackColor="Black" Font-Bold="True" ForeColor="White" />
<AlternatingRowStyle BackColor="#CCCCCC" />
</asp:DetailsView>
<asp:Login runat="server" BackColor="#DEDEDE" BorderColor="Black"
BorderStyle="Solid" BorderWidth="1px" Font-Names="Verdana"
Font-Size="10pt">
<TitleTextStyle BackColor="Black" Font-Bold="True"
Font-Names="Verdana" Font-Size="10pt"
ForeColor="White" />
</asp:Login>

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 336 B

View File

@@ -0,0 +1,5 @@
<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="Default.aspx.cs" Inherits="_Default" title="Project Tracker" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
Welcome to the Project Tracker system.
</asp:Content>

View File

@@ -0,0 +1,14 @@
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class _Default : System.Web.UI.Page
{
}

View File

@@ -0,0 +1,74 @@
<%@ Application Language="C#" %>
<script RunAt="server">
void Application_Start(object sender, EventArgs e)
{
// Code that runs on application startup
}
void Application_End(object sender, EventArgs e)
{
// Code that runs on application shutdown
}
void Application_Error(object sender, EventArgs e)
{
// Code that runs when an unhandled error occurs
}
void Session_Start(object sender, EventArgs e)
{
// Code that runs when a new session is started
}
void Session_End(object sender, EventArgs e)
{
// Code that runs when a session ends.
// Note: The Session_End event is raised only when the sessionstate mode
// is set to InProc in the Web.config file. If session mode is set to StateServer
// or SQLServer, the event is not raised.
}
protected void Application_AuthenticateRequest(object sender, EventArgs e)
{
}
protected void Application_AcquireRequestState(
object sender, EventArgs e)
{
if (Csla.ApplicationContext.AuthenticationType == "Windows")
return;
System.Security.Principal.IPrincipal principal;
try
{
principal = (System.Security.Principal.IPrincipal)
HttpContext.Current.Session["CslaPrincipal"];
}
catch
{
principal = null;
}
if (principal == null)
{
// didn't get a principal from Session, so
// set it to an unauthenticted PTPrincipal
ProjectTracker.Library.Security.PTPrincipal.Logout();
}
else
{
// use the principal from Session
Csla.ApplicationContext.User = principal;
}
}
</script>

View File

@@ -0,0 +1,8 @@
<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="Login.aspx.cs" Inherits="Login" title="Login" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<div>
<br />
<asp:Login ID="Login1" runat="server">
</asp:Login>
</div>
</asp:Content>

View File

@@ -0,0 +1,15 @@
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class Login : System.Web.UI.Page
{
}

View File

@@ -0,0 +1,43 @@
<%@ Master Language="C#" CodeFile="MasterPage.master.cs"
Inherits="MasterPage" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head id="Head1" runat="server">
<title>Untitled Page</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1" />
</head>
<body>
<form id="form1" runat="server">
<div id="mainTable">
<div id="header">
<asp:Label ID="PageTitle" runat="server">
</asp:Label>
</div>
<div id="navigation">
<div id="navigationContent">
<asp:TreeView ID="TreeView1" runat="server"
DataSourceID="SiteMapDataSource1"
ShowExpandCollapse="False" SkipLinkText="" >
<NodeStyle CssClass="nav" />
</asp:TreeView>
</div>
</div>
<div id="subnavigation">
<div id="logout">
<asp:LoginStatus ID="LoginStatus1"
runat="server" OnLoggingOut="LoginStatus1_LoggingOut" />
</div>
</div>
<div id="content">
<asp:ContentPlaceHolder id="ContentPlaceHolder1"
runat="server">
</asp:ContentPlaceHolder>
</div>
</div>
<asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server"
ShowStartingNode="False" />
</form>
</body>
</html>

View File

@@ -0,0 +1,33 @@
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class MasterPage : System.Web.UI.MasterPage
{
//protected void Page_Init(object sender, EventArgs e)
//{
// if (Csla.ApplicationContext.AuthenticationType != "Windows")
// PTSecurity.ReloadPrincipal();
//}
protected void Page_Load(object sender, EventArgs e)
{
PageTitle.Text = Page.Title;
}
protected void LoginStatus1_LoggingOut(
object sender, LoginCancelEventArgs e)
{
ProjectTracker.Library.Security.PTPrincipal.Logout();
Session["CslaPrincipal"] =
Csla.ApplicationContext.User;
System.Web.Security.FormsAuthentication.SignOut();
}
}

View File

@@ -0,0 +1,101 @@
<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true"
CodeFile="ProjectEdit.aspx.cs" Inherits="ProjectEdit" Title="Project Information" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<div>
<asp:MultiView ID="MultiView1" runat="server" ActiveViewIndex="0">
<asp:View ID="MainView" runat="server">
<asp:DetailsView ID="DetailsView1" runat="server" Height="50px" Width="536px" AutoGenerateRows="False"
DataSourceID="ProjectDataSource" DataKeyNames="Id" OnItemDeleted="DetailsView1_ItemDeleted"
OnItemInserted="DetailsView1_ItemInserted" OnItemUpdated="DetailsView1_ItemUpdated" OnItemCreated="DetailsView1_ItemCreated">
<Fields>
<asp:BoundField DataField="Id" HeaderText="Id" ReadOnly="True" SortExpression="Id"
InsertVisible="False" >
<ItemStyle Width="100%" />
</asp:BoundField>
<asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" >
<ControlStyle Width="95%" />
</asp:BoundField>
<asp:BoundField DataField="Started" HeaderText="Started" SortExpression="Started" >
<ControlStyle Width="95%" />
</asp:BoundField>
<asp:BoundField DataField="Ended" HeaderText="Ended" SortExpression="Ended" >
<ControlStyle Width="95%" />
</asp:BoundField>
<asp:TemplateField HeaderText="Description" SortExpression="Description">
<EditItemTemplate>
<asp:TextBox ID="TextBox1" TextMode="MultiLine" Width="95%" runat="server" Text='<%# Bind("Description") %>'></asp:TextBox>
</EditItemTemplate>
<InsertItemTemplate>
<asp:TextBox ID="TextBox1" TextMode="MultiLine" Width="95%" runat="server" Text='<%# Bind("Description") %>'></asp:TextBox>
</InsertItemTemplate>
<ItemTemplate>
<asp:TextBox ID="TextBox1" TextMode="MultiLine" ReadOnly="true" Width="95%" runat="server"
Text='<%# Bind("Description") %>'></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:CommandField ShowDeleteButton="True" ShowEditButton="True" ShowInsertButton="True" />
</Fields>
</asp:DetailsView>
&nbsp;&nbsp;&nbsp;<br />
<asp:GridView ID="GridView1" runat="server" AllowPaging="True" AutoGenerateColumns="False"
DataSourceID="ResourcesDataSource" Width="432px" DataKeyNames="ResourceId">
<Columns>
<asp:BoundField DataField="ResourceId" HeaderText="ResourceId" ReadOnly="True" SortExpression="ResourceId"
Visible="False" />
<asp:HyperLinkField DataNavigateUrlFields="ResourceId" DataNavigateUrlFormatString="ResourceEdit.aspx?id={0}"
DataTextField="FullName" HeaderText="Name" />
<asp:BoundField DataField="Assigned" HeaderText="Assigned" ReadOnly="True" SortExpression="Assigned" />
<asp:TemplateField HeaderText="Role" SortExpression="Role">
<EditItemTemplate>
<asp:DropDownList ID="DropDownList1" runat="server"
DataSourceID="RoleListDataSource"
DataTextField="Value" DataValueField="Key"
SelectedValue='<%# Bind("Role") %>'>
</asp:DropDownList>
</EditItemTemplate>
<ItemTemplate>
<asp:DropDownList ID="DropDownList2" runat="server"
DataSourceID="RoleListDataSource"
DataTextField="Value" DataValueField="Key"
Enabled="False" SelectedValue='<%# Bind("Role") %>'>
</asp:DropDownList>
</ItemTemplate>
</asp:TemplateField>
<asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />
</Columns>
</asp:GridView>
<asp:LinkButton ID="AddResourceButton" runat="server" OnClick="AddResourceButton_Click">Add resource</asp:LinkButton><br />
<br />
&nbsp;
</asp:View>
<asp:View ID="AssignView" runat="server">
<strong>Pick resource:</strong><br />
<asp:GridView ID="GridView2" runat="server" AllowPaging="True" AutoGenerateColumns="False"
DataKeyNames="Id" DataSourceID="ResourceListDataSource" OnSelectedIndexChanged="GridView2_SelectedIndexChanged">
<Columns>
<asp:BoundField DataField="Name" HeaderText="Name" ReadOnly="True" SortExpression="Name" />
<asp:CommandField ShowSelectButton="True" />
</Columns>
</asp:GridView>
<asp:LinkButton ID="CancelAssignButton" runat="server" OnClick="CancelAssignButton_Click">Cancel</asp:LinkButton><br />
<csla:CslaDataSource ID="ResourceListDataSource" runat="server"
TypeName="ProjectTracker.Library.ResourceList, ProjectTracker.Library" OnSelectObject="ResourceListDataSource_SelectObject" TypeSupportsPaging="False" TypeSupportsSorting="False">
</csla:CslaDataSource>
</asp:View>
</asp:MultiView>
<asp:Label ID="ErrorLabel" runat="server" ForeColor="Red"></asp:Label><br />
&nbsp;<csla:CslaDataSource ID="ProjectDataSource" runat="server" TypeName="ProjectTracker.Library.Project, ProjectTracker.Library" OnDeleteObject="ProjectDataSource_DeleteObject"
OnInsertObject="ProjectDataSource_InsertObject" OnSelectObject="ProjectDataSource_SelectObject"
OnUpdateObject="ProjectDataSource_UpdateObject" TypeSupportsPaging="False" TypeSupportsSorting="False">
</csla:CslaDataSource>
<csla:CslaDataSource ID="ResourcesDataSource" runat="server" TypeName="ProjectTracker.Library.ProjectResources, ProjectTracker.Library" OnDeleteObject="ResourcesDataSource_DeleteObject"
OnSelectObject="ResourcesDataSource_SelectObject" OnUpdateObject="ResourcesDataSource_UpdateObject" TypeSupportsPaging="False" TypeSupportsSorting="False">
</csla:CslaDataSource>
<csla:CslaDataSource ID="RoleListDataSource" runat="server" TypeName="ProjectTracker.Library.RoleList, ProjectTracker.Library" OnSelectObject="RoleListDataSource_SelectObject" TypeSupportsPaging="False" TypeSupportsSorting="False">
</csla:CslaDataSource>
<br />
</div>
<br />
&nbsp;
</asp:Content>

View File

@@ -0,0 +1,293 @@
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using ProjectTracker.Library;
public partial class ProjectEdit : System.Web.UI.Page
{
private enum Views
{
MainView = 0,
AssignView = 1
}
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
ApplyAuthorizationRules();
}
else
this.ErrorLabel.Text = string.Empty;
}
private void ApplyAuthorizationRules()
{
Project obj = GetProject();
// project display
if (Project.CanEditObject())
{
if (obj.IsNew)
this.DetailsView1.DefaultMode = DetailsViewMode.Insert;
else
this.DetailsView1.DefaultMode = DetailsViewMode.Edit;
this.AddResourceButton.Visible = !obj.IsNew;
}
else
{
this.DetailsView1.DefaultMode = DetailsViewMode.ReadOnly;
this.AddResourceButton.Visible = false;
}
this.DetailsView1.Rows[
this.DetailsView1.Rows.Count - 1].Visible =
Project.CanEditObject();
// resource display
this.GridView1.Columns[
this.GridView1.Columns.Count - 1].Visible =
Project.CanEditObject();
}
#region Project DetailsView
protected void DetailsView1_ItemCreated(object sender, EventArgs e)
{
if (DetailsView1.DefaultMode == DetailsViewMode.Insert)
{
Project obj = GetProject();
((TextBox)DetailsView1.Rows[1].Cells[1].Controls[0]).Text = obj.Name;
((TextBox)DetailsView1.Rows[2].Cells[1].Controls[0]).Text = obj.Started;
((TextBox)DetailsView1.Rows[3].Cells[1].Controls[0]).Text = obj.Ended;
((TextBox)DetailsView1.FindControl("TextBox1")).Text = obj.Description;
}
}
protected void DetailsView1_ItemInserted(
object sender, DetailsViewInsertedEventArgs e)
{
Project project = GetProject();
if (!project.IsNew)
Response.Redirect("ProjectEdit.aspx?id=" + project.Id.ToString());
}
protected void DetailsView1_ItemUpdated(
object sender, DetailsViewUpdatedEventArgs e)
{
ApplyAuthorizationRules();
}
protected void DetailsView1_ItemDeleted(
object sender, DetailsViewDeletedEventArgs e)
{
Response.Redirect("ProjectList.aspx");
}
#endregion
#region Resource Grid
protected void AddResourceButton_Click(
object sender, EventArgs e)
{
this.MultiView1.ActiveViewIndex =
(int)Views.AssignView;
}
protected void GridView2_SelectedIndexChanged(
object sender, EventArgs e)
{
Project obj = GetProject();
try
{
obj.Resources.Assign(int.Parse(
this.GridView2.SelectedDataKey.Value.ToString()));
if (SaveProject(obj) > 0)
{
this.GridView1.DataBind();
this.MultiView1.ActiveViewIndex = (int)Views.MainView;
}
}
catch (InvalidOperationException ex)
{
ErrorLabel.Text = ex.Message;
}
}
protected void CancelAssignButton_Click(
object sender, EventArgs e)
{
this.MultiView1.ActiveViewIndex =
(int)Views.MainView;
}
#endregion
#region ProjectDataSource
protected void ProjectDataSource_DeleteObject(
object sender, Csla.Web.DeleteObjectArgs e)
{
try
{
Project.DeleteProject(new Guid(e.Keys["Id"].ToString()));
Session["currentObject"] = null;
e.RowsAffected = 1;
}
catch (Csla.DataPortalException ex)
{
this.ErrorLabel.Text = ex.BusinessException.Message;
e.RowsAffected = 0;
}
catch (Exception ex)
{
this.ErrorLabel.Text = ex.Message;
e.RowsAffected = 0;
}
}
protected void ProjectDataSource_InsertObject(
object sender, Csla.Web.InsertObjectArgs e)
{
Project obj = GetProject();
Csla.Data.DataMapper.Map(e.Values, obj, "Id");
e.RowsAffected = SaveProject(obj);
}
protected void ProjectDataSource_SelectObject(
object sender, Csla.Web.SelectObjectArgs e)
{
e.BusinessObject = GetProject();
}
protected void ProjectDataSource_UpdateObject(object sender, Csla.Web.UpdateObjectArgs e)
{
Project obj = GetProject();
Csla.Data.DataMapper.Map(e.Values, obj);
e.RowsAffected = SaveProject(obj);
}
#endregion
#region ResourcesDataSource
protected void ResourcesDataSource_DeleteObject(
object sender, Csla.Web.DeleteObjectArgs e)
{
Project obj = GetProject();
int rid = int.Parse(e.Keys["ResourceId"].ToString());
obj.Resources.Remove(rid);
e.RowsAffected = SaveProject(obj);
}
protected void ResourcesDataSource_SelectObject(
object sender, Csla.Web.SelectObjectArgs e)
{
Project obj = GetProject();
e.BusinessObject = obj.Resources;
}
protected void ResourcesDataSource_UpdateObject(
object sender, Csla.Web.UpdateObjectArgs e)
{
Project obj = GetProject();
int rid = int.Parse(e.Keys["ResourceId"].ToString());
ProjectResource res =
obj.Resources.GetItem(rid);
Csla.Data.DataMapper.Map(e.Values, res);
e.RowsAffected = SaveProject(obj);
}
#endregion
#region ResourceListDataSource
protected void ResourceListDataSource_SelectObject(
object sender, Csla.Web.SelectObjectArgs e)
{
e.BusinessObject =
ProjectTracker.Library.ResourceList.GetResourceList();
}
#endregion
#region RoleListDataSource
protected void RoleListDataSource_SelectObject(
object sender, Csla.Web.SelectObjectArgs e)
{
e.BusinessObject = RoleList.GetList();
}
#endregion
private Project GetProject()
{
object businessObject = Session["currentObject"];
if (businessObject == null ||
!(businessObject is Project))
{
try
{
string idString = Request.QueryString["id"];
if (!string.IsNullOrEmpty(idString))
{
Guid id = new Guid(idString);
businessObject = Project.GetProject(id);
}
else
businessObject = Project.NewProject();
Session["currentObject"] = businessObject;
}
catch (System.Security.SecurityException)
{
Response.Redirect("ProjectList.aspx");
}
}
return (Project)businessObject;
}
private int SaveProject(Project project)
{
int rowsAffected;
try
{
Session["currentObject"] = project.Save();
rowsAffected = 1;
}
catch (Csla.Validation.ValidationException ex)
{
System.Text.StringBuilder message = new System.Text.StringBuilder();
message.AppendFormat("{0}<br/>", ex.Message);
if (project.BrokenRulesCollection.Count == 1)
message.AppendFormat("* {0}: {1}",
project.BrokenRulesCollection[0].Property,
project.BrokenRulesCollection[0].Description);
else
foreach (Csla.Validation.BrokenRule rule in project.BrokenRulesCollection)
message.AppendFormat("* {0}: {1}<br/>", rule.Property, rule.Description);
this.ErrorLabel.Text = message.ToString();
rowsAffected = 0;
}
catch (Csla.DataPortalException ex)
{
this.ErrorLabel.Text = ex.BusinessException.Message;
rowsAffected = 0;
}
catch (Exception ex)
{
this.ErrorLabel.Text = ex.Message;
rowsAffected = 0;
}
return rowsAffected;
}
}

View File

@@ -0,0 +1,34 @@
<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true"
CodeFile="ProjectList.aspx.cs" Inherits="ProjectList" Title="Project List" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<div>
<strong>Projects:<br />
</strong>
<asp:GridView ID="GridView1" runat="server"
AllowPaging="True" AutoGenerateColumns="False"
DataSourceID="ProjectListDataSource" PageSize="4"
DataKeyNames="Id" OnRowDeleted="GridView1_RowDeleted">
<Columns>
<asp:BoundField DataField="Id" HeaderText="Id"
SortExpression="Id" Visible="False" />
<asp:HyperLinkField DataNavigateUrlFields="Id"
DataNavigateUrlFormatString="ProjectEdit.aspx?id={0}"
DataTextField="Name" HeaderText="Name" />
<asp:CommandField ShowDeleteButton="True"
SelectText="Edit" />
</Columns>
</asp:GridView>
<asp:LinkButton ID="NewProjectButton" runat="server"
OnClick="NewProjectButton_Click">New project</asp:LinkButton>
<br />
<br />
<asp:Label ID="ErrorLabel" runat="server" ForeColor="Red"></asp:Label>
<csla:CslaDataSource ID="ProjectListDataSource" runat="server"
TypeName="ProjectTracker.Library.ProjectList, ProjectTracker.Library"
OnDeleteObject="ProjectListDataSource_DeleteObject"
OnSelectObject="ProjectListDataSource_SelectObject" TypeSupportsPaging="False" TypeSupportsSorting="False">
</csla:CslaDataSource>
<br />
</div>
</asp:Content>

View File

@@ -0,0 +1,94 @@
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using ProjectTracker.Library;
public partial class ProjectList : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
Session["currentObject"] = null;
ApplyAuthorizationRules();
}
else
ErrorLabel.Text = string.Empty;
}
private void ApplyAuthorizationRules()
{
this.GridView1.Columns[
this.GridView1.Columns.Count - 1].Visible =
Project.CanDeleteObject();
NewProjectButton.Visible =
ProjectTracker.Library.Project.CanAddObject();
}
#region GridView1
protected void GridView1_RowDeleted(object sender, GridViewDeletedEventArgs e)
{
Session["currentObject"] = null;
GridView1.DataBind();
}
protected void NewProjectButton_Click(object sender, EventArgs e)
{
// allow user to add a new project
Response.Redirect("ProjectEdit.aspx");
}
#endregion
#region ProjectListDataSource
protected void ProjectListDataSource_DeleteObject(
object sender, Csla.Web.DeleteObjectArgs e)
{
try
{
ProjectTracker.Library.Project.DeleteProject(
new Guid(e.Keys["Id"].ToString()));
e.RowsAffected = 1;
}
catch (Csla.DataPortalException ex)
{
this.ErrorLabel.Text = ex.BusinessException.Message;
e.RowsAffected = 0;
}
catch (Exception ex)
{
this.ErrorLabel.Text = ex.Message;
e.RowsAffected = 0;
}
}
protected void ProjectListDataSource_SelectObject(
object sender, Csla.Web.SelectObjectArgs e)
{
e.BusinessObject = GetProjectList();
}
#endregion
private ProjectTracker.Library.ProjectList GetProjectList()
{
object businessObject = Session["currentObject"];
if (businessObject == null ||
!(businessObject is ProjectTracker.Library.ProjectList))
{
businessObject =
ProjectTracker.Library.ProjectList.GetProjectList();
Session["currentObject"] = businessObject;
}
return (ProjectTracker.Library.ProjectList)businessObject;
}
}

View File

@@ -0,0 +1,66 @@
<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="ResourceEdit.aspx.cs" Inherits="ResourceEdit" title="Resource Information" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<div>
<asp:MultiView ID="MultiView1" runat="server" ActiveViewIndex="0">
<asp:View ID="MainView" runat="server">
<asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False"
DataSourceID="ResourceDataSource" Height="50px"
Width="440px" DataKeyNames="Id" OnItemDeleted="DetailsView1_ItemDeleted" OnItemInserted="DetailsView1_ItemInserted" OnItemUpdated="DetailsView1_ItemUpdated">
<Fields>
<asp:BoundField DataField="Id" HeaderText="Id" SortExpression="Id" Visible="False" >
<ControlStyle Width="95%" />
</asp:BoundField>
<asp:BoundField DataField="LastName" HeaderText="LastName" SortExpression="LastName" >
<ControlStyle Width="95%" />
</asp:BoundField>
<asp:BoundField DataField="FirstName" HeaderText="FirstName" SortExpression="FirstName" >
<ControlStyle Width="95%" />
</asp:BoundField>
<asp:CommandField ShowDeleteButton="True" ShowEditButton="True" ShowInsertButton="True" />
</Fields>
</asp:DetailsView>
<br />
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
DataSourceID="AssignmentsDataSource" DataKeyNames="ProjectId">
<FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
<Columns>
<asp:BoundField DataField="ProjectID" HeaderText="ProjectID" SortExpression="ProjectID"
Visible="False" />
<asp:HyperLinkField DataNavigateUrlFields="ProjectId" DataNavigateUrlFormatString="ProjectEdit.aspx?id={0}"
DataTextField="ProjectName" HeaderText="Project Name" />
<asp:BoundField DataField="Assigned" HeaderText="Assigned" SortExpression="Assigned" ReadOnly="True" />
<asp:TemplateField HeaderText="Role" SortExpression="Role">
<EditItemTemplate><asp:DropDownList ID="DropDownList1" runat="server" DataSourceID="RoleListDataSource" DataTextField="Value" DataValueField="Key" SelectedValue='<%# Bind("Role") %>' Width="184px">
</asp:DropDownList>
</EditItemTemplate>
<ItemTemplate>
<asp:DropDownList ID="DropDownList1" runat="server" DataSourceID="RoleListDataSource" DataTextField="Value" DataValueField="Key" Enabled="False" SelectedValue='<%# Bind("Role") %>' Width="184px">
</asp:DropDownList>
</ItemTemplate>
</asp:TemplateField>
<asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />
</Columns>
</asp:GridView>
<asp:LinkButton ID="AssignProjectButton" runat="server" OnClick="AssignProjectButton_Click">Assign to project</asp:LinkButton></asp:View>
<asp:View ID="AssignView" runat="server">
<asp:GridView ID="GridView2" runat="server" AllowPaging="True" AutoGenerateColumns="False"
DataSourceID="ProjectListDataSource" DataKeyNames="Id" OnSelectedIndexChanged="GridView2_SelectedIndexChanged">
<Columns>
<asp:BoundField DataField="Name" HeaderText="Name" ReadOnly="True" SortExpression="Name" />
<asp:CommandField ShowSelectButton="True" />
</Columns>
</asp:GridView>
<asp:LinkButton ID="CancelAssignButton" runat="server" OnClick="CancelAssignButton_Click">Cancel</asp:LinkButton></asp:View>
</asp:MultiView>
<asp:Label ID="ErrorLabel" runat="server" ForeColor="Red"></asp:Label><br />
<csla:CslaDataSource ID="ResourceDataSource" runat="server"
TypeName="ProjectTracker.Library.Resource, ProjectTracker.Library" OnDeleteObject="ResourceDataSource_DeleteObject" OnInsertObject="ResourceDataSource_InsertObject" OnSelectObject="ResourceDataSource_SelectObject" OnUpdateObject="ResourceDataSource_UpdateObject" TypeSupportsPaging="False" TypeSupportsSorting="False"></csla:CslaDataSource>
<csla:CslaDataSource ID="AssignmentsDataSource" runat="server"
TypeName="ProjectTracker.Library.ResourceAssignments, ProjectTracker.Library" OnDeleteObject="AssignmentsDataSource_DeleteObject" OnSelectObject="AssignmentsDataSource_SelectObject" OnUpdateObject="AssignmentsDataSource_UpdateObject" TypeSupportsPaging="False" TypeSupportsSorting="False"></csla:CslaDataSource>
<csla:CslaDataSource ID="RoleListDataSource" runat="server"
TypeName="ProjectTracker.Library.RoleList, ProjectTracker.Library" OnSelectObject="RoleListDataSource_SelectObject" TypeSupportsPaging="False" TypeSupportsSorting="False"></csla:CslaDataSource>
<csla:CslaDataSource ID="ProjectListDataSource" runat="server"
TypeName="ProjectTracker.Library.ProjectList, ProjectTracker.Library" OnSelectObject="ProjectListDataSource_SelectObject" TypeSupportsPaging="False" TypeSupportsSorting="False">
</csla:CslaDataSource>
</div>
</asp:Content>

View File

@@ -0,0 +1,246 @@
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using ProjectTracker.Library;
public partial class ResourceEdit : System.Web.UI.Page
{
private enum Views
{
MainView = 0,
AssignView = 1
}
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
Session["currentObject"] = null;
ApplyAuthorizationRules();
}
else
this.ErrorLabel.Text = "";
}
private void ApplyAuthorizationRules()
{
Resource obj = GetResource();
// Resource display
if (Resource.CanEditObject())
{
if (obj.IsNew)
this.DetailsView1.DefaultMode = DetailsViewMode.Insert;
else
this.DetailsView1.DefaultMode = DetailsViewMode.Edit;
this.AssignProjectButton.Visible = !obj.IsNew;
}
else
{
this.DetailsView1.DefaultMode = DetailsViewMode.ReadOnly;
this.AssignProjectButton.Visible = false;
}
this.DetailsView1.Rows[this.DetailsView1.Rows.Count - 1].Visible = Resource.CanEditObject();
// resources display
this.GridView1.Columns[this.GridView1.Columns.Count - 1].Visible = Resource.CanEditObject();
}
#region DetailsView
protected void DetailsView1_ItemInserted(object sender, DetailsViewInsertedEventArgs e)
{
Resource resource = GetResource();
if (!resource.IsNew)
Response.Redirect("ResourceEdit.aspx?id=" + resource.Id.ToString());
}
protected void DetailsView1_ItemUpdated(object sender, DetailsViewUpdatedEventArgs e)
{
ApplyAuthorizationRules();
}
protected void DetailsView1_ItemDeleted(object sender, DetailsViewDeletedEventArgs e)
{
Response.Redirect("ResourceList.aspx");
}
#endregion
#region Project Grid
protected void AssignProjectButton_Click(object sender, EventArgs e)
{
this.MultiView1.ActiveViewIndex = (int)Views.AssignView;
}
protected void GridView2_SelectedIndexChanged(object sender, EventArgs e)
{
Resource obj = GetResource();
try
{
obj.Assignments.AssignTo(new Guid(this.GridView2.SelectedDataKey.Value.ToString()));
if (SaveResource(obj) > 0)
{
this.GridView1.DataBind();
this.MultiView1.ActiveViewIndex = (int)Views.MainView;
}
}
catch (InvalidOperationException ex)
{
ErrorLabel.Text = ex.Message;
}
}
protected void CancelAssignButton_Click(object sender, EventArgs e)
{
this.MultiView1.ActiveViewIndex = (int)Views.MainView;
}
#endregion
#region RoleListDataSource
protected void RoleListDataSource_SelectObject(object sender, Csla.Web.SelectObjectArgs e)
{
e.BusinessObject = RoleList.GetList();
}
#endregion
#region ResourceDataSource
protected void ResourceDataSource_DeleteObject(object sender, Csla.Web.DeleteObjectArgs e)
{
Resource.DeleteResource(int.Parse(e.Keys["Id"].ToString()));
Session.Remove("currentObject");
e.RowsAffected = 1;
}
protected void ResourceDataSource_InsertObject(object sender, Csla.Web.InsertObjectArgs e)
{
Resource obj = Resource.NewResource();
Csla.Data.DataMapper.Map(e.Values, obj, "Id");
e.RowsAffected = SaveResource(obj);
}
protected void ResourceDataSource_SelectObject(object sender, Csla.Web.SelectObjectArgs e)
{
e.BusinessObject = GetResource();
}
protected void ResourceDataSource_UpdateObject(object sender, Csla.Web.UpdateObjectArgs e)
{
Resource obj = GetResource();
Csla.Data.DataMapper.Map(e.Values, obj);
e.RowsAffected = SaveResource(obj);
}
#endregion
#region AssignmentsDataSource
protected void AssignmentsDataSource_DeleteObject(object sender, Csla.Web.DeleteObjectArgs e)
{
Resource obj = GetResource();
Guid rid = new Guid(e.Keys["ProjectId"].ToString());
obj.Assignments.Remove(rid);
e.RowsAffected = SaveResource(obj);
}
protected void AssignmentsDataSource_SelectObject(object sender, Csla.Web.SelectObjectArgs e)
{
Resource obj = GetResource();
e.BusinessObject = obj.Assignments;
}
protected void AssignmentsDataSource_UpdateObject(object sender, Csla.Web.UpdateObjectArgs e)
{
Resource obj = GetResource();
ResourceAssignment res;
Guid rid = new Guid(e.Keys["ProjectId"].ToString());
res = obj.Assignments[rid];
Csla.Data.DataMapper.Map(e.Values, res);
e.RowsAffected = SaveResource(obj);
}
#endregion
#region ProjectListDataSource
protected void ProjectListDataSource_SelectObject(object sender, Csla.Web.SelectObjectArgs e)
{
e.BusinessObject = ProjectTracker.Library.ProjectList.GetProjectList();
}
#endregion
private Resource GetResource()
{
object businessObject = Session["currentObject"];
if (businessObject == null ||
!(businessObject is Resource))
{
try
{
string idString = Request.QueryString["id"];
if (!string.IsNullOrEmpty(idString))
{
int id = Int32.Parse(idString);
businessObject = Resource.GetResource(id);
}
else
businessObject = Resource.NewResource();
Session["currentObject"] = businessObject;
}
catch (System.Security.SecurityException)
{
Response.Redirect("ResourceList.aspx");
}
}
return (Resource)businessObject;
}
private int SaveResource(Resource resource)
{
int rowsAffected;
try
{
Session["currentObject"] = resource.Save();
rowsAffected = 1;
}
catch (Csla.Validation.ValidationException ex)
{
System.Text.StringBuilder message = new System.Text.StringBuilder();
message.AppendFormat("{0}<br/>", ex.Message);
if (resource.BrokenRulesCollection.Count == 1)
message.AppendFormat("* {0}: {1}",
resource.BrokenRulesCollection[0].Property,
resource.BrokenRulesCollection[0].Description);
else
foreach (Csla.Validation.BrokenRule rule in resource.BrokenRulesCollection)
message.AppendFormat("* {0}: {1}<br/>", rule.Property, rule.Description);
this.ErrorLabel.Text = message.ToString();
rowsAffected = 0;
}
catch (Csla.DataPortalException ex)
{
this.ErrorLabel.Text = ex.BusinessException.Message;
rowsAffected = 0;
}
catch (Exception ex)
{
this.ErrorLabel.Text = ex.Message;
rowsAffected = 0;
}
return rowsAffected;
}
}

View File

@@ -0,0 +1,21 @@
<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="ResourceList.aspx.cs" Inherits="ResourceList" title="Resource List" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<div>
<strong>Resources:</strong><br />
<asp:GridView ID="GridView1" runat="server" AllowPaging="True" AutoGenerateColumns="False" DataSourceID="ResourceListDataSource" DataKeyNames="Id" OnRowDeleted="GridView1_RowDeleted" >
<FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
<Columns>
<asp:BoundField DataField="Id" HeaderText="Id" ReadOnly="True" SortExpression="Id"
Visible="False" />
<asp:HyperLinkField DataNavigateUrlFields="Id" DataNavigateUrlFormatString="ResourceEdit.aspx?id={0}"
DataTextField="Name" HeaderText="Name" />
<asp:CommandField ShowDeleteButton="True" SelectText="Edit" />
</Columns>
</asp:GridView>
<asp:LinkButton ID="NewResourceButton" runat="server" OnClick="NewResourceButton_Click">New resource</asp:LinkButton><br />
<br />
<asp:Label ID="ErrorLabel" runat="server" ForeColor="Red"></asp:Label>
<csla:CslaDataSource ID="ResourceListDataSource" runat="server" TypeName="ProjectTracker.Library.ResourceList, ProjectTracker.Library" OnDeleteObject="ResourceListDataSource_DeleteObject" OnSelectObject="ResourceListDataSource_SelectObject" TypeSupportsPaging="False" TypeSupportsSorting="False">
</csla:CslaDataSource>
&nbsp;</div>
</asp:Content>

View File

@@ -0,0 +1,87 @@
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using ProjectTracker.Library;
public partial class ResourceList : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
Session["currentObject"] = null;
ApplyAuthorizationRules();
}
else
ErrorLabel.Text = string.Empty;
}
private void ApplyAuthorizationRules()
{
this.GridView1.Columns[this.GridView1.Columns.Count - 1].Visible = Resource.CanDeleteObject();
NewResourceButton.Visible = Resource.CanAddObject();
}
#region GridView1
protected void NewResourceButton_Click(object sender, EventArgs e)
{
Response.Redirect("ResourceEdit.aspx");
}
protected void GridView1_RowDeleted(object sender, GridViewDeletedEventArgs e)
{
Session["currentObject"] = null;
GridView1.DataBind();
}
#endregion
#region ResourceListDataSource
protected void ResourceListDataSource_DeleteObject(object sender, Csla.Web.DeleteObjectArgs e)
{
try
{
Resource.DeleteResource(int.Parse(e.Keys["Id"].ToString()));
e.RowsAffected = 1;
}
catch (Csla.DataPortalException ex)
{
this.ErrorLabel.Text = ex.BusinessException.Message;
e.RowsAffected = 0;
}
catch (Exception ex)
{
this.ErrorLabel.Text = ex.Message;
e.RowsAffected = 0;
}
}
protected void ResourceListDataSource_SelectObject(object sender, Csla.Web.SelectObjectArgs e)
{
e.BusinessObject = GetResourceList();
}
#endregion
private ProjectTracker.Library.ResourceList GetResourceList()
{
object businessObject = Session["currentObject"];
if (businessObject == null ||
!(businessObject is ProjectTracker.Library.ResourceList))
{
businessObject =
ProjectTracker.Library.ResourceList.GetResourceList();
Session["currentObject"] = businessObject;
}
return (ProjectTracker.Library.ResourceList)businessObject;
}
}

View File

@@ -0,0 +1,49 @@
<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true"
CodeFile="RolesEdit.aspx.cs" Inherits="RolesEdit" Title="Project Roles" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<div>
<asp:MultiView ID="MultiView1" runat="server" ActiveViewIndex="0">
<asp:View ID="MainView" runat="server">
<asp:GridView ID="GridView1" runat="server"
AutoGenerateColumns="False"
DataSourceID="RolesDataSource"
DataKeyNames="Id">
<Columns>
<asp:BoundField DataField="Id" HeaderText="Id"
ReadOnly="True" SortExpression="Id" />
<asp:BoundField DataField="Name" HeaderText="Name"
SortExpression="Name" />
<asp:CommandField ShowDeleteButton="True"
ShowEditButton="True" />
</Columns>
</asp:GridView>
<asp:LinkButton ID="AddRoleButton" runat="server" OnClick="AddRoleButton_Click">Add role</asp:LinkButton><br />
</asp:View>
<asp:View ID="InsertView" runat="server">
<asp:DetailsView ID="DetailsView1" runat="server"
AutoGenerateRows="False" DataSourceID="RolesDataSource"
DefaultMode="Insert" Height="50px" Width="125px"
DataKeyNames="Id" OnItemInserted="DetailsView1_ItemInserted"
OnModeChanged="DetailsView1_ModeChanged">
<Fields>
<asp:BoundField DataField="Id" HeaderText="Id"
SortExpression="Id" />
<asp:BoundField DataField="Name" HeaderText="Name"
SortExpression="Name" />
<asp:CommandField ShowInsertButton="True" />
</Fields>
</asp:DetailsView>
</asp:View>
</asp:MultiView>
<asp:Label ID="ErrorLabel" runat="server" ForeColor="Red"></asp:Label><br />
&nbsp;&nbsp;
<csla:CslaDataSource ID="RolesDataSource" runat="server"
TypeName="ProjectTracker.Library.Admin.Roles, ProjectTracker.Library"
OnDeleteObject="RolesDataSource_DeleteObject"
OnInsertObject="RolesDataSource_InsertObject"
OnSelectObject="RolesDataSource_SelectObject"
OnUpdateObject="RolesDataSource_UpdateObject" TypeSupportsPaging="False" TypeSupportsSorting="False">
</csla:CslaDataSource>
</div>
</asp:Content>

View File

@@ -0,0 +1,154 @@
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class RolesEdit : System.Web.UI.Page
{
private enum Views
{
MainView = 0,
InsertView = 1
}
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
Session["currentObject"] = null;
ApplyAuthorizationRules();
}
else
this.ErrorLabel.Text = "";
}
private void ApplyAuthorizationRules()
{
this.GridView1.Columns[
this.GridView1.Columns.Count - 1].Visible =
ProjectTracker.Library.Admin.Roles.CanEditObject();
this.AddRoleButton.Visible =
ProjectTracker.Library.Admin.Roles.CanAddObject();
}
protected void AddRoleButton_Click(object sender, EventArgs e)
{
this.DetailsView1.DefaultMode = DetailsViewMode.Insert;
MultiView1.ActiveViewIndex = (int)Views.InsertView;
}
protected void DetailsView1_ItemInserted(
object sender, DetailsViewInsertedEventArgs e)
{
MultiView1.ActiveViewIndex = (int)Views.MainView;
this.GridView1.DataBind();
}
protected void DetailsView1_ModeChanged(
object sender, EventArgs e)
{
MultiView1.ActiveViewIndex = (int)Views.MainView;
}
private ProjectTracker.Library.Admin.Roles GetRoles()
{
object businessObject = Session["currentObject"];
if (businessObject == null ||
!(businessObject is ProjectTracker.Library.Admin.Roles))
{
businessObject =
ProjectTracker.Library.Admin.Roles.GetRoles();
Session["currentObject"] = businessObject;
}
return (ProjectTracker.Library.Admin.Roles)businessObject;
}
#region RolesDataSource
protected void RolesDataSource_DeleteObject(
object sender, Csla.Web.DeleteObjectArgs e)
{
try
{
ProjectTracker.Library.Admin.Roles obj = GetRoles();
int id = (int)e.Keys["Id"];
obj.Remove(id);
Session["currentObject"] = obj.Save();
e.RowsAffected = 1;
}
catch (Csla.DataPortalException ex)
{
this.ErrorLabel.Text = ex.BusinessException.Message;
e.RowsAffected = 0;
}
catch (Exception ex)
{
this.ErrorLabel.Text = ex.Message;
e.RowsAffected = 0;
}
}
protected void RolesDataSource_InsertObject(
object sender, Csla.Web.InsertObjectArgs e)
{
try
{
ProjectTracker.Library.Admin.Roles obj = GetRoles();
ProjectTracker.Library.Admin.Role role = obj.AddNew();
Csla.Data.DataMapper.Map(e.Values, role);
Session["currentObject"] = obj.Save();
e.RowsAffected = 1;
}
catch (Csla.DataPortalException ex)
{
this.ErrorLabel.Text = ex.BusinessException.Message;
e.RowsAffected = 0;
}
catch (Exception ex)
{
this.ErrorLabel.Text = ex.Message;
e.RowsAffected = 0;
}
}
protected void RolesDataSource_SelectObject(
object sender, Csla.Web.SelectObjectArgs e)
{
ProjectTracker.Library.Admin.Roles obj = GetRoles();
e.BusinessObject = obj;
}
protected void RolesDataSource_UpdateObject(
object sender, Csla.Web.UpdateObjectArgs e)
{
ProjectTracker.Library.Admin.Roles obj = GetRoles();
try
{
ProjectTracker.Library.Admin.Role role =
obj.GetRoleById(int.Parse(e.Keys["Id"].ToString()));
role.Name = e.Values["Name"].ToString();
Session["currentObject"] = obj.Save();
e.RowsAffected = 1;
}
catch (Csla.DataPortalException ex)
{
this.ErrorLabel.Text = ex.BusinessException.Message;
e.RowsAffected = 0;
}
catch (Exception ex)
{
this.ErrorLabel.Text = ex.Message;
e.RowsAffected = 0;
}
}
#endregion
}

View File

@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8" ?>
<siteMap
xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
<siteMapNode url="" title="" description="">
<siteMapNode url="~/Default.aspx" title="Home"
description="Main page" />
<siteMapNode url="~/ProjectList.aspx" title="Project list"
description="Project list" />
<siteMapNode url="~/ResourceList.aspx" title="Resource list"
description="Resource list" />
<siteMapNode url="~/RolesEdit.aspx" title="Project roles"
description="Project roles" />
</siteMapNode>
</siteMap>

View File

@@ -0,0 +1,123 @@
<?xml version="1.0"?>
<!--
Note: As an alternative to hand editing this file you can use the
web admin tool to configure settings for your application. Use
the Website->Asp.Net Configuration option in Visual Studio.
A full list of settings and comments can be found in
machine.config.comments usually located in
\Windows\Microsoft.Net\Framework\v2.x\Config
-->
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<appSettings>
<add key="CslaAuthentication" value="Csla" />
<!--<add key="CslaDataPortalProxy"
value="Csla.DataPortalClient.RemotingProxy, Csla"/>
<add key="CslaDataPortalUrl"
value="http://localhost:3187/RemotingHost/RemotingPortal.rem"/>-->
<!--<add key="CslaDataPortalProxy"
value="Csla.DataPortalClient.WebServicesProxy, Csla"/>
<add key="CslaDataPortalUrl"
value="http://localhost:4334/WebServicesHost/WebServicePortal.asmx"/>-->
<add key="CslaDataPortalProxy"
value="EnterpriseServicesHost.EnterpriseServicesProxy, EnterpriseServicesHostcs"/>
</appSettings>
<connectionStrings>
<add name="PTracker"
connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=&quot;C:\Visual Studio Projects\csla20\ProjectTracker20cs\PTracker.mdf&quot;;Integrated Security=True;User Instance=True"
providerName="System.Data.SqlClient" />
<add name="Security"
connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=&quot;C:\Visual Studio Projects\csla20\ProjectTracker20cs\Security.mdf&quot;;Integrated Security=True;User Instance=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
<system.web>
<!--
Set compilation debug="true" to insert debugging
symbols into the compiled page. Because this
affects performance, set this value to true only
during development.
Visual Basic options:
Set strict="true" to disallow all data type conversions
where data loss can occur.
Set explicit="true" to force declaration of all variables.
-->
<compilation debug="true" strict="true" explicit="true">
<assemblies>
<add assembly="System.Runtime.Remoting, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Transactions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
</assemblies>
</compilation>
<pages theme="Basic" styleSheetTheme="Basic">
<!--
Added <controls> block to reference custom
data controls
-->
<controls>
<add tagPrefix="csla" namespace="Csla.Web" assembly="Csla"/>
</controls>
<namespaces>
<clear/>
<add namespace="System"/>
<add namespace="System.Collections"/>
<add namespace="System.Collections.Specialized"/>
<add namespace="System.Configuration"/>
<add namespace="System.Text"/>
<add namespace="System.Text.RegularExpressions"/>
<add namespace="System.Web"/>
<add namespace="System.Web.Caching"/>
<add namespace="System.Web.SessionState"/>
<add namespace="System.Web.Security"/>
<add namespace="System.Web.Profile"/>
<add namespace="System.Web.UI"/>
<add namespace="System.Web.UI.WebControls"/>
<add namespace="System.Web.UI.WebControls.WebParts"/>
<add namespace="System.Web.UI.HtmlControls"/>
</namespaces>
</pages>
<!--
The <authentication> section enables configuration
of the security authentication mode used by
ASP.NET to identify an incoming user.
-->
<authentication mode="Forms">
<forms loginUrl="Login.aspx" name="ptracker"/>
</authentication>
<authorization>
<allow users="*"/>
</authorization>
<!--
The <customErrors> section enables configuration
of what to do if/when an unhandled error occurs
during the execution of a request. Specifically,
it enables developers to configure html error pages
to be displayed in place of a error stack trace.
<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>
-->
<membership defaultProvider="PTMembershipProvider">
<providers>
<add name="PTMembershipProvider"
type="PTMembershipProvider"
enablePasswordRetrieval="false"
enablePasswordReset="false"
requiresQuestionAndAnswer="false"
applicationName="/"
requiresUniqueEmail="false"
passwordFormat="Clear"
description="Stores and retrieves membership
data using CSLA .NET business objects."
/>
</providers>
</membership>
</system.web>
</configuration>

View File

@@ -0,0 +1,8 @@
using System;
using System.Web.Services.Protocols;
public class CslaCredentials : SoapHeader
{
public string Username;
public string Password;
}

View File

@@ -0,0 +1,300 @@
using System;
using System.Web;
using System.Collections;
using System.Collections.Generic;
using System.Web.Services;
using System.Web.Services.Protocols;
using ProjectTracker.Library;
/// <summary>
/// Web Service interface for the ProjectTracker application.
/// </summary>
[WebService(Namespace = "http://ws.lhotka.net/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class PTService : System.Web.Services.WebService
{
/// <summary>
/// Credentials for custom authentication.
/// </summary>
public CslaCredentials Credentials = new CslaCredentials();
#region Projects
[WebMethod(Description="Get a list of projects")]
public ProjectData[] GetProjectList()
{
// anonymous access allowed
Security.UseAnonymous();
try
{
ProjectList list = ProjectList.GetProjectList();
List<ProjectData> result = new List<ProjectData>();
foreach (ProjectInfo item in list)
{
ProjectData info = new ProjectData();
Csla.Data.DataMapper.Map(item, info);
result.Add(info);
}
return result.ToArray();
}
catch (Csla.DataPortalException ex)
{
throw ex.BusinessException;
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}
[WebMethod(Description="Get a project")]
public ProjectData GetProject(ProjectRequest request)
{
// anonymous access allowed
Security.UseAnonymous();
try
{
Project proj = Project.GetProject(request.Id);
ProjectData result = new ProjectData();
Csla.Data.DataMapper.Map(proj, result, "Resources");
foreach (ProjectResource resource in proj.Resources)
{
ProjectResourceData info = new ProjectResourceData();
Csla.Data.DataMapper.Map(resource, info, "FullName");
result.AddResource(info);
}
return result;
}
catch (Csla.DataPortalException ex)
{
throw ex.BusinessException;
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}
[WebMethod(Description="Add a project")]
[SoapHeader("Credentials")]
public ProjectData AddProject(
string name, string started, string ended, string description)
{
// user credentials required
Security.Login(Credentials);
try
{
Project proj = Project.NewProject();
proj.Name = name;
proj.Started = started;
proj.Ended = ended;
proj.Description = description;
proj = proj.Save();
ProjectData result = new ProjectData();
Csla.Data.DataMapper.Map(proj, result, "Resources");
return result;
}
catch (Csla.DataPortalException ex)
{
throw ex.BusinessException;
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}
[WebMethod(Description = "Edit a project")]
[SoapHeader("Credentials")]
public ProjectData EditProject(Guid id, string name,
string started, string ended,
string description)
{
// user credentials required
Security.Login(Credentials);
try
{
Project proj = Project.GetProject(id);
proj.Name = name;
proj.Started = started;
proj.Ended = ended;
proj.Description = description;
proj = proj.Save();
ProjectData result = new ProjectData();
Csla.Data.DataMapper.Map(proj, result, "Resources");
return result;
}
catch (Csla.DataPortalException ex)
{
throw ex.BusinessException;
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}
#endregion
#region Resources
[WebMethod(Description="Get a list of resources")]
public ResourceData[] GetResourceList()
{
// anonymous access allowed
Security.UseAnonymous();
try
{
ResourceList list = ResourceList.GetResourceList();
List<ResourceData> result = new List<ResourceData>();
foreach (ProjectTracker.Library.ResourceInfo item in list)
{
ResourceData info =
new ResourceData();
Csla.Data.DataMapper.Map(item, info);
result.Add(info);
}
return result.ToArray();
}
catch (Csla.DataPortalException ex)
{
throw ex.BusinessException;
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}
[WebMethod(Description="Get a resource")]
public ResourceData GetResource(ResourceRequest request)
{
// anonymous access allowed
Security.UseAnonymous();
try
{
Resource res = Resource.GetResource(request.Id);
ResourceData result = new ResourceData();
result.Id = res.Id;
result.Name = res.FullName;
foreach (ResourceAssignment resource in res.Assignments)
{
ResourceAssignmentData info = new ResourceAssignmentData();
Csla.Data.DataMapper.Map(resource, info);
result.AddProject(info);
}
return result;
}
catch (Csla.DataPortalException ex)
{
throw ex.BusinessException;
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}
[WebMethod(Description="Change a resource's name")]
[SoapHeader("Credentials")]
public ResourceData ChangeResourceName(int id,
string firstName, string lastName)
{
// user credentials required.
Security.Login(Credentials);
try
{
Resource res = Resource.GetResource(id);
res.FirstName = firstName;
res.LastName = lastName;
res = res.Save();
ResourceData result = new ResourceData();
result.Id = res.Id;
result.Name = string.Format("{1}, {0}", res.FirstName, res.LastName);
return result;
}
catch (Csla.DataPortalException ex)
{
throw ex.BusinessException;
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}
#endregion
#region Assign Resource to Project
[WebMethod(Description="Assign resource to a project")]
[SoapHeader("Credentials")]
public void AssignResource(int resourceId, Guid projectId)
{
// user credentials required
Security.Login(Credentials);
try
{
Resource res = Resource.GetResource(resourceId);
res.Assignments.AssignTo(projectId);
res.Save();
}
catch (Csla.DataPortalException ex)
{
throw ex.BusinessException;
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}
#endregion
#region Roles
[WebMethod(Description="Get a list of roles")]
public RoleInfo[] GetRoles()
{
// anonymous access allowed
Security.UseAnonymous();
try
{
RoleList list = RoleList.GetList();
List<RoleInfo> result = new List<RoleInfo>();
foreach (RoleList.NameValuePair role in list)
{
RoleInfo info = new RoleInfo();
info.Id = role.Key;
info.Name = role.Value;
result.Add(info);
}
return result.ToArray();
}
catch (Csla.DataPortalException ex)
{
throw ex.BusinessException;
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}
#endregion
}

View File

@@ -0,0 +1,62 @@
using System;
using System.Collections.Generic;
public class ProjectData
{
private Guid _id;
private string _name;
private string _started;
private string _ended;
private string _description;
private List<ProjectResourceData>
_resources = new List<ProjectResourceData>();
public Guid Id
{
get { return _id; }
set { _id = value; }
}
public string Name
{
get { return _name; }
set { _name = value; }
}
public string Started
{
get { return _started; }
set { _started = value; }
}
public string Ended
{
get { return _ended; }
set { _ended = value; }
}
public string Description
{
get { return _description; }
set { _description = value; }
}
public void AddResource(ProjectResourceData resource)
{
_resources.Add(resource);
}
public ProjectResourceData[] ProjectResources
{
get
{
if (_resources.Count > 0)
return _resources.ToArray();
return null;
}
set
{
_resources = new List<ProjectResourceData>(value);
}
}
}

View File

@@ -0,0 +1,20 @@
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public class ProjectRequest
{
private Guid _id;
public Guid Id
{
get { return _id; }
set { _id = value; }
}
}

View File

@@ -0,0 +1,40 @@
using System;
public class ProjectResourceData
{
private int _resourceId;
private string _firstName;
private string _lastName;
private string _assigned;
private int _role;
public int ResourceId
{
get { return _resourceId; }
set { _resourceId = value; }
}
public string FirstName
{
get { return _firstName; }
set { _firstName = value; }
}
public string LastName
{
get { return _lastName; }
set { _lastName = value; }
}
public string Assigned
{
get { return _assigned; }
set { _assigned = value; }
}
public int Role
{
get { return _role; }
set { _role = value; }
}
}

View File

@@ -0,0 +1,33 @@
using System;
public class ResourceAssignmentData
{
private Guid _projectId;
private string _projectName;
private string _assigned;
private int _role;
public Guid ProjectId
{
get { return _projectId; }
set { _projectId = value; }
}
public string ProjectName
{
get { return _projectName; }
set { _projectName = value; }
}
public string Assigned
{
get { return _assigned; }
set { _assigned = value; }
}
public int Role
{
get { return _role; }
set { _role = value; }
}
}

View File

@@ -0,0 +1,40 @@
using System;
using System.Collections.Generic;
public class ResourceData
{
private int _id;
private string _name;
private List<ResourceAssignmentData> _projects = new List<ResourceAssignmentData>();
public int Id
{
get { return _id; }
set { _id = value; }
}
public string Name
{
get { return _name; }
set { _name = value; }
}
public void AddProject(ResourceAssignmentData project)
{
_projects.Add(project);
}
public ResourceAssignmentData[] ResourceAssignments
{
get
{
if (_projects.Count > 0)
return _projects.ToArray();
return null;
}
set
{
_projects = new List<ResourceAssignmentData>(value);
}
}
}

View File

@@ -0,0 +1,21 @@
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public class ResourceRequest
{
private int _id;
public int Id
{
get { return _id; }
set { _id = value; }
}
}

View File

@@ -0,0 +1,19 @@
using System;
public class RoleInfo
{
private int _id;
private string _name;
public int Id
{
get { return _id; }
set { _id = value; }
}
public string Name
{
get { return _name; }
set { _name = value; }
}
}

View File

@@ -0,0 +1,44 @@
using System;
using System.Web;
using System.Security.Principal;
using ProjectTracker.Library.Security;
public static class Security
{
public static void UseAnonymous()
{
// setting an unauthenticated principal when running
// under the VShost causes serialization issues
// and isn't strictly necessary anyway
if (UrlIsHostedByVS(HttpContext.Current.Request.Url))
return;
ProjectTracker.Library.Security.PTPrincipal.Logout();
}
public static void Login(CslaCredentials credentials)
{
if (string.IsNullOrEmpty(credentials.Username))
throw new System.Security.SecurityException(
"Valid credentials not provided");
// set to unauthenticated principal
PTPrincipal.Logout();
PTPrincipal.Login(credentials.Username, credentials.Password);
if (!Csla.ApplicationContext.User.Identity.IsAuthenticated)
{
// the user is not valid, raise an error
throw
new System.Security.SecurityException(
"Invalid user or password");
}
}
public static bool UrlIsHostedByVS(Uri uri)
{
if (uri.Port >= 1024 && string.Compare(uri.Host, "localhost", StringComparison.OrdinalIgnoreCase) == 0)
return true;
return false;
}
}

View File

@@ -0,0 +1 @@
<%@ WebService Language="C#" CodeBehind="~/App_Code/PTService.cs" Class="PTService" %>

View File

@@ -0,0 +1,64 @@
<?xml version="1.0"?>
<!--
Note: As an alternative to hand editing this file you can use the
web admin tool to configure settings for your application. Use
the Website->Asp.Net Configuration option in Visual Studio.
A full list of settings and comments can be found in
machine.config.comments usually located in
\Windows\Microsoft.Net\Framework\v2.x\Config
-->
<configuration>
<appSettings>
<add key="CslaAuthentication" value="Csla" />
<!--<add key="CslaDataPortalProxy"
value="Csla.DataPortalClient.RemotingProxy, Csla"/>
<add key="CslaDataPortalUrl"
value="http://localhost:3187/RemotingHost/RemotingPortal.rem"/>-->
<add key="CslaDataPortalProxy"
value="Csla.DataPortalClient.WebServicesProxy, Csla"/>
<add key="CslaDataPortalUrl"
value="http://localhost:4334/WebServicesHost/WebServicePortal.asmx"/>
<!--<add key="CslaDataPortalProxy"
value="EnterpriseServicesHost.EnterpriseServicesProxy, EnterpriseServicesHostvb"/>-->
</appSettings>
<connectionStrings>
<add name="PTracker"
connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=&quot;C:\Visual Studio Projects\csla20\ProjectTracker20cs\PTracker.mdf&quot;;Integrated Security=True;User Instance=True"
providerName="System.Data.SqlClient" />
<add name="Security"
connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=&quot;C:\Visual Studio Projects\csla20\ProjectTracker20cs\Security.mdf&quot;;Integrated Security=True;User Instance=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
<system.web>
<!--
Set compilation debug="true" to insert debugging
symbols into the compiled page. Because this
affects performance, set this value to true only
during development.
-->
<compilation debug="false">
<assemblies>
<add assembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Runtime.Remoting, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.Transactions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/></assemblies></compilation>
<!--
The <authentication> section enables configuration
of the security authentication mode used by
ASP.NET to identify an incoming user.
-->
<authentication mode="Windows"/>
<!--
The <customErrors> section enables configuration
of what to do if/when an unhandled error occurs
during the execution of a request. Specifically,
it enables developers to configure html error pages
to be displayed in place of a error stack trace.
<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>
-->
</system.web>
</configuration>

View File

@@ -0,0 +1,73 @@
<?xml version="1.0"?>
<!--
Note: As an alternative to hand editing this file you can use the
web admin tool to configure settings for your application. Use
the Website->Asp.Net Configuration option in Visual Studio.
A full list of settings and comments can be found in
machine.config.comments usually located in
\Windows\Microsoft.Net\Framework\v2.x\Config
-->
<configuration>
<appSettings>
<add key="CslaAuthentication" value="Csla" />
</appSettings>
<connectionStrings>
<add name="PTracker"
connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=&quot;C:\Visual Studio Projects\csla20\ProjectTracker20cs\PTracker.mdf&quot;;Integrated Security=True;User Instance=True"
providerName="System.Data.SqlClient" />
<add name="Security"
connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=&quot;C:\Visual Studio Projects\csla20\ProjectTracker20cs\Security.mdf&quot;;Integrated Security=True;User Instance=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
<system.runtime.remoting>
<application>
<service>
<wellknown mode="SingleCall" objectUri="RemotingPortal.rem"
type="Csla.Server.Hosts.RemotingPortal, Csla"/>
</service>
<channels>
<channel ref="http">
<serverProviders>
<provider ref="wsdl"/>
<formatter ref="soap" typeFilterLevel="Full"/>
<formatter ref="binary" typeFilterLevel="Full"/>
</serverProviders>
</channel>
</channels>
</application>
</system.runtime.remoting>
<system.web>
<!--
Set compilation debug="true" to insert debugging
symbols into the compiled page. Because this
affects performance, set this value to true only
during development.
-->
<compilation debug="false">
<assemblies>
<add assembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Runtime.Remoting, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.Transactions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
</assemblies>
</compilation>
<!--
The <authentication> section enables configuration
of the security authentication mode used by
ASP.NET to identify an incoming user.
-->
<authentication mode="Windows"/>
<!--
The <customErrors> section enables configuration
of what to do if/when an unhandled error occurs
during the execution of a request. Specifically,
it enables developers to configure html error pages
to be displayed in place of a error stack trace.
<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>
-->
</system.web>
</configuration>

View File

@@ -0,0 +1,54 @@
<?xml version="1.0"?>
<!--
Note: As an alternative to hand editing this file you can use the
web admin tool to configure settings for your application. Use
the Website->Asp.Net Configuration option in Visual Studio.
A full list of settings and comments can be found in
machine.config.comments usually located in
\Windows\Microsoft.Net\Framework\v2.x\Config
-->
<configuration>
<appSettings>
<add key="CslaAuthentication" value="Csla" />
</appSettings>
<connectionStrings>
<add name="PTracker"
connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=&quot;C:\Visual Studio Projects\csla20\ProjectTracker20cs\PTracker.mdf&quot;;Integrated Security=True;User Instance=True"
providerName="System.Data.SqlClient" />
<add name="Security"
connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=&quot;C:\Visual Studio Projects\csla20\ProjectTracker20cs\Security.mdf&quot;;Integrated Security=True;User Instance=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
<system.web>
<!--
Set compilation debug="true" to insert debugging
symbols into the compiled page. Because this
affects performance, set this value to true only
during development.
-->
<compilation debug="false">
<assemblies>
<add assembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Runtime.Remoting, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.Transactions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/></assemblies></compilation>
<!--
The <authentication> section enables configuration
of the security authentication mode used by
ASP.NET to identify an incoming user.
-->
<authentication mode="Windows"/>
<!--
The <customErrors> section enables configuration
of what to do if/when an unhandled error occurs
during the execution of a request. Specifically,
it enables developers to configure html error pages
to be displayed in place of a error stack trace.
<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>
-->
</system.web>
</configuration>

View File

@@ -0,0 +1 @@
<%@ WebService Language="C#" Class="Csla.Server.Hosts.WebServicePortal" %>