You can subscribe to this list here.
2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(3) |
Oct
(1) |
Nov
(2) |
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2010 |
Jan
(1) |
Feb
(29) |
Mar
(2) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <all...@us...> - 2010-03-25 21:49:07
|
Revision: 38 http://cronoscontrol.svn.sourceforge.net/cronoscontrol/?rev=38&view=rev Author: allancascante Date: 2010-03-25 21:49:00 +0000 (Thu, 25 Mar 2010) Log Message: ----------- Ticket #9: Added support to list, view and view edit form (missing new and save edited data) for companies. +Business.cs: Fixed an error on generic get method. +Companies.cs: Added the support for the list methods. +CompaniesController.cs: Added controller methods. +Views/Companies/Details.aspx, Edit.aspx, List.aspx: Added the new views for the maintenance. Ticket #10: Added some new files for the task tracking functioanlity and modified some of the methods, this functionality is still under development. +Tasks.cs: Added some methods to list the tasks for different scenarios. +DateTimeExtensions.cs: Added some extensions to get week start and end dates. +TasksController.cs: Added controller methods for the views on Task Tracking. +Site.Master: Added a section for custom css files +TaskTracking.aspx: Added the custom css section an other changes. Ticket #8: +TimeCategoryController.cs: Added some changes to the controller methods. TimeCategoryList.aspx: Added some minor changes to the list view. Modified Paths: -------------- source/trunk/CronosControl/CronosControlBusinessClassLibrary/Business/Business.cs source/trunk/CronosControl/CronosControlBusinessClassLibrary/Business/Companies.cs source/trunk/CronosControl/CronosControlBusinessClassLibrary/Business/Tasks.cs source/trunk/CronosControl/CronosControlBusinessClassLibrary/CronosControlBusinessClassLibrary.csproj source/trunk/CronosControl/CronosControlWeb/Controllers/TimeCategoryController.cs source/trunk/CronosControl/CronosControlWeb/CronosControlWeb.csproj source/trunk/CronosControl/CronosControlWeb/Views/Shared/Site.Master source/trunk/CronosControl/CronosControlWeb/Views/TimeCategory/TimeCategoryList.aspx Added Paths: ----------- source/trunk/CronosControl/CronosControlBusinessClassLibrary/Business/Util/ExtensionMethods/ source/trunk/CronosControl/CronosControlBusinessClassLibrary/Business/Util/ExtensionMethods/DateTimeExtensions.cs source/trunk/CronosControl/CronosControlWeb/Content/TasksTracking.css source/trunk/CronosControl/CronosControlWeb/Controllers/CompaniesController.cs source/trunk/CronosControl/CronosControlWeb/Controllers/TasksController.cs source/trunk/CronosControl/CronosControlWeb/Views/Companies/ source/trunk/CronosControl/CronosControlWeb/Views/Companies/Details.aspx source/trunk/CronosControl/CronosControlWeb/Views/Companies/Edit.aspx source/trunk/CronosControl/CronosControlWeb/Views/Companies/List.aspx source/trunk/CronosControl/CronosControlWeb/Views/Tasks/ source/trunk/CronosControl/CronosControlWeb/Views/Tasks/TasksTracking.aspx Modified: source/trunk/CronosControl/CronosControlBusinessClassLibrary/Business/Business.cs =================================================================== --- source/trunk/CronosControl/CronosControlBusinessClassLibrary/Business/Business.cs 2010-03-16 17:28:50 UTC (rev 37) +++ source/trunk/CronosControl/CronosControlBusinessClassLibrary/Business/Business.cs 2010-03-25 21:49:00 UTC (rev 38) @@ -59,7 +59,6 @@ Object savedEntity = null; if (entity.EntityKey != null && cronosControlEntities.TryGetObjectByKey(entity.EntityKey, out savedEntity)) { - CronosControlEntitiesContext.Detach(savedEntity); return (T)savedEntity; } else Modified: source/trunk/CronosControl/CronosControlBusinessClassLibrary/Business/Companies.cs =================================================================== --- source/trunk/CronosControl/CronosControlBusinessClassLibrary/Business/Companies.cs 2010-03-16 17:28:50 UTC (rev 37) +++ source/trunk/CronosControl/CronosControlBusinessClassLibrary/Business/Companies.cs 2010-03-25 21:49:00 UTC (rev 38) @@ -26,14 +26,31 @@ } #region Business<Company> abstract methods + + /// <summary> + /// Get the list of all Companies in the system + /// </summary> + /// <returns>A List of all Companies</returns> public override List<Company> List() { - throw new NotImplementedException(); + using (CronosControlEntitiesContext) + { + return CronosControlEntitiesContext.Company.ToList(); + } } + /// <summary> + /// Get a sub set of all companies on the system. + /// </summary> + /// <param name="page">The page to get</param> + /// <param name="elements">The number of elements by page</param> + /// <returns>The page for the given parameters</returns> public override List<Company> List(int page, int elements) { - throw new NotImplementedException(); + using (CronosControlEntitiesContext) + { + return CronosControlEntitiesContext.Company.Skip(elements * (page - 1)).Take(elements).ToList(); + } } #endregion } Modified: source/trunk/CronosControl/CronosControlBusinessClassLibrary/Business/Tasks.cs =================================================================== --- source/trunk/CronosControl/CronosControlBusinessClassLibrary/Business/Tasks.cs 2010-03-16 17:28:50 UTC (rev 37) +++ source/trunk/CronosControl/CronosControlBusinessClassLibrary/Business/Tasks.cs 2010-03-25 21:49:00 UTC (rev 38) @@ -18,9 +18,9 @@ /// <returns>A list with all taks</returns> public override List<Task> List() { - using (CronosControlEntities cronosControlEntities = new CronosControlEntities()) + using (CronosControlEntitiesContext) { - return cronosControlEntities.Task.ToList(); + return CronosControlEntitiesContext.Task.ToList(); } } @@ -32,9 +32,9 @@ /// <returns>The page for the given parameters</returns> public override List<Task> List(int page, int elements) { - using (CronosControlEntities cronosControlEntities = new CronosControlEntities()) + using (CronosControlEntitiesContext) { - return cronosControlEntities.Task.Skip(elements * (page - 1)).Take(elements).ToList(); + return CronosControlEntitiesContext.Task.Skip(elements * (page - 1)).Take(elements).ToList(); } } @@ -45,9 +45,9 @@ /// <returns>The list of tasks for the user</returns> public List<Task> UserTasks(User user) { - using (CronosControlEntities cronosControlEntities = new CronosControlEntities()) + using (CronosControlEntitiesContext) { - return (from u in cronosControlEntities.TaskUser + return (from u in CronosControlEntitiesContext.TaskUser where u.User == user select u.Task).ToList<Task>(); } @@ -62,9 +62,9 @@ /// <returns>The list of tasks on the given range for the user</returns> public List<Task> UserTasks(User user, int page, int elements) { - using (CronosControlEntities cronosControlEntities = new CronosControlEntities()) + using (CronosControlEntitiesContext) { - return (from u in cronosControlEntities.TaskUser + return (from u in CronosControlEntitiesContext.TaskUser where u.User == user select u.Task).Skip(elements * (page - 1)).Take(elements).ToList<Task>(); } @@ -85,9 +85,9 @@ { throw new ArgumentException("The provided start and end dates are not correct."); } - using (CronosControlEntities cronosControlEntities = new CronosControlEntities()) + using (CronosControlEntitiesContext) { - return (from u in cronosControlEntities.TaskUser + return (from u in CronosControlEntitiesContext.TaskUser where u.User == user && u.StartDate >= startDate && u.EndDate <= endDate select u.Task).Skip(elements * (page - 1)).Take(elements).ToList<Task>(); } Added: source/trunk/CronosControl/CronosControlBusinessClassLibrary/Business/Util/ExtensionMethods/DateTimeExtensions.cs =================================================================== --- source/trunk/CronosControl/CronosControlBusinessClassLibrary/Business/Util/ExtensionMethods/DateTimeExtensions.cs (rev 0) +++ source/trunk/CronosControl/CronosControlBusinessClassLibrary/Business/Util/ExtensionMethods/DateTimeExtensions.cs 2010-03-25 21:49:00 UTC (rev 38) @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace CronosControl.Business.Util.ExtensionMethods +{ + public static class DateTimeExtensions + { + public static DateTime StartOfWeek(this DateTime dt) + { + DayOfWeek startOfWeek = DayOfWeek.Monday; + int diff = dt.DayOfWeek - startOfWeek; + if (diff < 0) + { + diff += 7; + } + + return dt.AddDays(-1 * diff).Date; + } + + public static DateTime EndOfWeek(this DateTime dt) + { + DayOfWeek endOfWeek = DayOfWeek.Sunday; + int diff = endOfWeek - dt.DayOfWeek; + if (diff < 7) + { + diff += 7; + } + + return dt.AddDays(diff).Date; + } + } +} + + Modified: source/trunk/CronosControl/CronosControlBusinessClassLibrary/CronosControlBusinessClassLibrary.csproj =================================================================== --- source/trunk/CronosControl/CronosControlBusinessClassLibrary/CronosControlBusinessClassLibrary.csproj 2010-03-16 17:28:50 UTC (rev 37) +++ source/trunk/CronosControl/CronosControlBusinessClassLibrary/CronosControlBusinessClassLibrary.csproj 2010-03-25 21:49:00 UTC (rev 38) @@ -76,6 +76,7 @@ <Compile Include="Business\Users.cs" /> <Compile Include="Business\Util\ErrorHandling\ExceptionBusinessError.cs" /> <Compile Include="Business\Util\ErrorHandling\IBusinessError.cs" /> + <Compile Include="Business\Util\ExtensionMethods\DateTimeExtensions.cs" /> <Compile Include="Business\Util\Helpers\EntityHelperUtil.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> </ItemGroup> Added: source/trunk/CronosControl/CronosControlWeb/Content/TasksTracking.css =================================================================== --- source/trunk/CronosControl/CronosControlWeb/Content/TasksTracking.css (rev 0) +++ source/trunk/CronosControl/CronosControlWeb/Content/TasksTracking.css 2010-03-25 21:49:00 UTC (rev 38) @@ -0,0 +1,7 @@ + +/* Task Tracking Forms */ + +.task-date +{ + width: 20px; +} \ No newline at end of file Added: source/trunk/CronosControl/CronosControlWeb/Controllers/CompaniesController.cs =================================================================== --- source/trunk/CronosControl/CronosControlWeb/Controllers/CompaniesController.cs (rev 0) +++ source/trunk/CronosControl/CronosControlWeb/Controllers/CompaniesController.cs 2010-03-25 21:49:00 UTC (rev 38) @@ -0,0 +1,96 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.Mvc; +using System.Web.Mvc.Ajax; +using CronosControl.Business; +using CronosControl.Model; + +namespace CronosControlWeb.Controllers +{ + public class CompaniesController : Controller + { + // + // GET: /Companies/ + + public ActionResult Index() + { + Companies companies = new Companies(); + //ViewData.Model = companies.List(new User(), startDate, endDate, 0, 10); + ViewData.Model = companies.List(); + + return View("List"); + } + + // + // GET: /Companies/Details/5 + + public ActionResult Details(int id) + { + Companies companies = new Companies(); + //ViewData.Model = companies.List(new User(), startDate, endDate, 0, 10); + Company company = new CronosControl.Model.Company() { IdCompany = id }; + companies.setEntityKey(company); + ViewData.Model = companies.Get(company); + return View(); + } + + // + // GET: /Companies/Create + + public ActionResult Create() + { + return View(); + } + + // + // POST: /Companies/Create + + [AcceptVerbs(HttpVerbs.Post)] + public ActionResult Create(FormCollection collection) + { + try + { + // TODO: Add insert logic here + + return RedirectToAction("Index"); + } + catch + { + return View(); + } + } + + // + // GET: /Companies/Edit/5 + + public ActionResult Edit(int id) + { + Companies companies = new Companies(); + //ViewData.Model = companies.List(new User(), startDate, endDate, 0, 10); + Company company = new CronosControl.Model.Company() { IdCompany = id }; + companies.setEntityKey(company); + ViewData.Model = companies.Get(company); + return View(); + } + + // + // POST: /Companies/Edit/5 + + [AcceptVerbs(HttpVerbs.Post)] + public ActionResult Edit(int id, FormCollection collection) + { + try + { + // TODO: Add update logic here + + return RedirectToAction("Index"); + } + catch + { + return View(); + } + } + } +} Added: source/trunk/CronosControl/CronosControlWeb/Controllers/TasksController.cs =================================================================== --- source/trunk/CronosControl/CronosControlWeb/Controllers/TasksController.cs (rev 0) +++ source/trunk/CronosControl/CronosControlWeb/Controllers/TasksController.cs 2010-03-25 21:49:00 UTC (rev 38) @@ -0,0 +1,103 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.Mvc; +using System.Web.Mvc.Ajax; +using CronosControl.Business; +using CronosControl.Business.Util.ExtensionMethods; +using CronosControl.Model; + +namespace CronosControlWeb.Controllers +{ + public class TasksController : Controller + { + // + // GET: /Tasks/ + + public ActionResult Index() + { + List<DateTime> dateRange = new List<DateTime>(); + + DateTime startDate = DateTime.Now.StartOfWeek(); + DateTime endDate = DateTime.Now.EndOfWeek(); + + for (DateTime date = startDate.Date; date <= endDate.Date; date = date.AddDays(1)) + { + DateTime newDate = new DateTime(); + newDate = Convert.ToDateTime(date); + dateRange.Add(newDate); + } + + Tasks tasks = new Tasks(); + //ViewData.Model = tasks.UserTasks(new User(), startDate, endDate, 0, 10); + ViewData.Model = tasks.List(); + + ViewData.Add("dateRange", dateRange); + + //TODO: Create a time sheet or get a time sheet(s) for the current time frame + + return View("TasksTracking"); + } + + // + // GET: /Tasks/Details/5 + + public ActionResult Details(int id) + { + return View(); + } + + // + // GET: /Tasks/Create + + public ActionResult Create() + { + return View(); + } + + // + // POST: /Tasks/Create + + [AcceptVerbs(HttpVerbs.Post)] + public ActionResult Create(FormCollection collection) + { + try + { + // TODO: Add insert logic here + + return RedirectToAction("Index"); + } + catch + { + return View(); + } + } + + // + // GET: /Tasks/Edit/5 + + public ActionResult Edit(int id) + { + return View(); + } + + // + // POST: /Tasks/Edit/5 + + [AcceptVerbs(HttpVerbs.Post)] + public ActionResult Edit(int id, FormCollection collection) + { + try + { + // TODO: Add update logic here + + return RedirectToAction("Index"); + } + catch + { + return View(); + } + } + } +} Modified: source/trunk/CronosControl/CronosControlWeb/Controllers/TimeCategoryController.cs =================================================================== --- source/trunk/CronosControl/CronosControlWeb/Controllers/TimeCategoryController.cs 2010-03-16 17:28:50 UTC (rev 37) +++ source/trunk/CronosControl/CronosControlWeb/Controllers/TimeCategoryController.cs 2010-03-25 21:49:00 UTC (rev 38) @@ -54,10 +54,6 @@ { TimeCategories categories = new TimeCategories(); Company company = CronosControlContext.Current.CurrentCompany; - company = new Company();//FIXME: REMOVE THIS GET THE LOGGED USER SESSION - company.IdCompany = 1;//FIXME: REMOVE THIS GET THE LOGGED USER SESSION - new Companies().setEntityKey(company); - company = new Companies().Get(company); //FIXME: REMOVE THIS GET THE LOGGED USER SESSION TimeCategory timeCategory = new TimeCategory() { Modified: source/trunk/CronosControl/CronosControlWeb/CronosControlWeb.csproj =================================================================== --- source/trunk/CronosControl/CronosControlWeb/CronosControlWeb.csproj 2010-03-16 17:28:50 UTC (rev 37) +++ source/trunk/CronosControl/CronosControlWeb/CronosControlWeb.csproj 2010-03-25 21:49:00 UTC (rev 38) @@ -59,8 +59,10 @@ </ItemGroup> <ItemGroup> <Compile Include="Controllers\AccountController.cs" /> + <Compile Include="Controllers\CompaniesController.cs" /> <Compile Include="Controllers\HomeController.cs" /> <Compile Include="Controllers\ProjectsController.cs" /> + <Compile Include="Controllers\TasksController.cs" /> <Compile Include="Controllers\TimeCategoryController.cs" /> <Compile Include="Default.aspx.cs"> <DependentUpon>Default.aspx</DependentUpon> @@ -83,6 +85,7 @@ <Content Include="Content\images\logo.png" /> <Content Include="Content\images\top.gif" /> <Content Include="Content\SiteMaster.css" /> + <Content Include="Content\TasksTracking.css" /> <Content Include="Default.aspx" /> <Content Include="Global.asax" /> <Content Include="Scripts\images\ui-bg_flat_0_aaaaaa_40x100.png" /> @@ -94,7 +97,11 @@ <Content Include="Scripts\images\ui-icons_f9bd01_256x240.png" /> <Content Include="Scripts\jquery-ui-1.7.2.custom.css" /> <Content Include="Scripts\jquery-ui-1.7.2.custom.min.js" /> + <Content Include="Views\Companies\Details.aspx" /> + <Content Include="Views\Companies\Edit.aspx" /> + <Content Include="Views\Companies\List.aspx" /> <Content Include="Views\Projects\ProjectsList.aspx" /> + <Content Include="Views\Tasks\TasksTracking.aspx" /> <Content Include="Views\TimeCategory\TimeCategoryCreate.aspx" /> <Content Include="Views\TimeCategory\TimeCategoryList.aspx" /> <Content Include="Web.config" /> Added: source/trunk/CronosControl/CronosControlWeb/Views/Companies/Details.aspx =================================================================== --- source/trunk/CronosControl/CronosControlWeb/Views/Companies/Details.aspx (rev 0) +++ source/trunk/CronosControl/CronosControlWeb/Views/Companies/Details.aspx 2010-03-25 21:49:00 UTC (rev 38) @@ -0,0 +1,48 @@ +<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<CronosControl.Model.Company>" %> + +<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server"> + Company Details +</asp:Content> + +<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"> + + <h2>Company Details</h2> + + <fieldset> + <legend><%= Html.Encode(Model.Name) %></legend> + <p> + Id Company: + <%= Html.Encode(Model.IdCompany) %> + </p> + <p> + Name: + <%= Html.Encode(Model.Name) %> + </p> + <p> + Description: + <%= Html.Encode(Model.Description) %> + </p> + <p> + CreatedAt: + <%= Html.Encode(String.Format("{0:g}", Model.CreatedAt)) %> + </p> + <p> + UpdatedAt: + <%= Html.Encode(String.Format("{0:g}", Model.UpdatedAt)) %> + </p> + <p> + Enabled: + <%= Html.Encode(Model.Enabled) %> + </p> + </fieldset> + <p> + + <%=Html.ActionLink("Edit", "Edit", new { id=Model.IdCompany }) %> | + <%=Html.ActionLink("Back to List", "Index") %> + </p> + +</asp:Content> + +<asp:Content ID="Content3" ContentPlaceHolderID="CustomCSS" runat="server"> +</asp:Content> + Added: source/trunk/CronosControl/CronosControlWeb/Views/Companies/Edit.aspx =================================================================== --- source/trunk/CronosControl/CronosControlWeb/Views/Companies/Edit.aspx (rev 0) +++ source/trunk/CronosControl/CronosControlWeb/Views/Companies/Edit.aspx 2010-03-25 21:49:00 UTC (rev 38) @@ -0,0 +1,62 @@ +<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<CronosControl.Model.Company>" %> + +<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server"> + Edit Companies +</asp:Content> + +<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"> + + <h2>Edit</h2> + + <%= Html.ValidationSummary("Edit was unsuccessful. Please correct the errors and try again.") %> + + <% using (Html.BeginForm()) {%> + + <fieldset> + <legend><%= Html.Encode(Model.Name) %></legend> + <p> + <label for="IdCompany">Id Company:</label> + <%= Html.Hidden("IdCompany", Model.IdCompany) %> + <%= Html.Encode(Model.IdCompany) %> + </p> + <p> + <label for="Name">Name:</label> + <%= Html.TextBox("Name", Model.Name) %> + <%= Html.ValidationMessage("Name", "*") %> + </p> + <p> + <label for="Description">Description:</label> + <%= Html.TextBox("Description", Model.Description) %> + <%= Html.ValidationMessage("Description", "*") %> + </p> + <p> + <label for="CreatedAt">Created At:</label> + <%= Html.TextBox("CreatedAt", String.Format("{0:g}", Model.CreatedAt)) %> + <%= Html.ValidationMessage("CreatedAt", "*") %> + </p> + <p> + <label for="UpdatedAt">Updated At:</label> + <%= Html.TextBox("UpdatedAt", String.Format("{0:g}", Model.UpdatedAt)) %> + <%= Html.ValidationMessage("UpdatedAt", "*") %> + </p> + <p> + <label for="Enabled">Enabled:</label> + <%= Html.TextBox("Enabled", Model.Enabled) %> + <%= Html.ValidationMessage("Enabled", "*") %> + </p> + <p> + <input type="submit" value="Save" /> + </p> + </fieldset> + + <% } %> + + <div> + <%=Html.ActionLink("Back to List", "Index") %> + </div> + +</asp:Content> + +<asp:Content ID="Content3" ContentPlaceHolderID="CustomCSS" runat="server"> +</asp:Content> + Added: source/trunk/CronosControl/CronosControlWeb/Views/Companies/List.aspx =================================================================== --- source/trunk/CronosControl/CronosControlWeb/Views/Companies/List.aspx (rev 0) +++ source/trunk/CronosControl/CronosControlWeb/Views/Companies/List.aspx 2010-03-25 21:49:00 UTC (rev 38) @@ -0,0 +1,73 @@ +<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<CronosControl.Model.Company>>" %> + +<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server"> + Companies List +</asp:Content> + +<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"> + + <h2>Companies List</h2> + + <table> + <tr> + <th></th> + <th> + Id Company + </th> + <th> + Name + </th> + <th> + Description + </th> + <th> + Created At + </th> + <th> + Updated At + </th> + <th> + Enabled + </th> + </tr> + + <% foreach (var item in Model) { %> + + <tr> + <td> + <%= Html.ActionLink("Edit", "Edit", new { id=item.IdCompany }) %> | + <%= Html.ActionLink("Details", "Details", new { id=item.IdCompany })%> + </td> + <td> + <%= Html.Encode(item.IdCompany) %> + </td> + <td> + <%= Html.Encode(item.Name) %> + </td> + <td> + <%= Html.Encode(item.Description) %> + </td> + <td> + <%= Html.Encode(String.Format("{0:g}", item.CreatedAt)) %> + </td> + <td> + <%= Html.Encode(String.Format("{0:g}", item.UpdatedAt)) %> + </td> + <td> + <%= Html.Encode(item.Enabled) %> + </td> + </tr> + + <% } %> + + </table> + + <p> + <%= Html.ActionLink("Create New", "Create") %> + </p> + +</asp:Content> + +<asp:Content ID="Content3" ContentPlaceHolderID="CustomCSS" runat="server"> +</asp:Content> + Modified: source/trunk/CronosControl/CronosControlWeb/Views/Shared/Site.Master =================================================================== --- source/trunk/CronosControl/CronosControlWeb/Views/Shared/Site.Master 2010-03-16 17:28:50 UTC (rev 37) +++ source/trunk/CronosControl/CronosControlWeb/Views/Shared/Site.Master 2010-03-25 21:49:00 UTC (rev 38) @@ -9,6 +9,9 @@ <link href="/Content/Site.css" rel="stylesheet" type="text/css" /> <link href="/Content/SiteMaster.css" rel="stylesheet" type="text/css" /> <link href="/Scripts/jquery-ui-1.7.2.custom.css" rel="stylesheet" type="text/css" /> + <!-- page custom css --> + <asp:ContentPlaceHolder ID="CustomCSS" runat="server" /> + <!-- end page custom css --> <script src="/Scripts/jquery-1.3.2.min.js" type="text/javascript"></script> <script src="/Scripts/jquery-ui-1.7.2.custom.min.js" type="text/javascript"></script> </head> Added: source/trunk/CronosControl/CronosControlWeb/Views/Tasks/TasksTracking.aspx =================================================================== --- source/trunk/CronosControl/CronosControlWeb/Views/Tasks/TasksTracking.aspx (rev 0) +++ source/trunk/CronosControl/CronosControlWeb/Views/Tasks/TasksTracking.aspx 2010-03-25 21:49:00 UTC (rev 38) @@ -0,0 +1,89 @@ +<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<CronosControl.Model.Task>>" %> + +<asp:Content ID="Content3" ContentPlaceHolderID="CustomCSS" runat="server"> + <link href="/Content/TasksTracking.css" rel="stylesheet" type="text/css" /> +</asp:Content> + +<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server"> + Tracking +</asp:Content> + +<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"> + + <h2>Tracking</h2> + <table> + <thead> + <tr> + <th> + Code + </th> + <th> + Name + </th> + <th> + Project + </th> + <th> + Description + </th> + <th> + Start Date + </th> + <th> + End Date + </th> + <% foreach (var item in (List<DateTime>)ViewData["dateRange"]) + { %> + <th> + <%= item.ToShortDateString() %> + </th> + <% } %> + <th> + Save Tracking + </th> + </tr> + </thead> + <tbody> + <% foreach (var task in Model) { %> + <tr> + <td> + JobCode + </td> + <td> + <%= task.Name %> + </td> + <td> + TD + </td> + <td> + <%= task.Description %> + </td> + <td> + <%= task.StartDate.ToShortDateString()%> + </td> + <td> + <%= task.EndDate.ToShortDateString()%> + </td> + <% foreach (var item in (List<DateTime>)ViewData["dateRange"]) + { %> + <td> + <input class="task-date" id="<%= item.ToShortDateString() %>" type="text" /> + </td> + <% } %> + <td> + <%= Html.ActionLink("Save", "Save", new { /*id=item.PrimaryKey */ }) %> + </td> + <td> + TOTAL + </td> + </tr> + <% } %> + </tbody> + </table> + + <p> + <%= Html.ActionLink("Create New", "Create") %> + </p> + +</asp:Content> + Modified: source/trunk/CronosControl/CronosControlWeb/Views/TimeCategory/TimeCategoryList.aspx =================================================================== --- source/trunk/CronosControl/CronosControlWeb/Views/TimeCategory/TimeCategoryList.aspx 2010-03-16 17:28:50 UTC (rev 37) +++ source/trunk/CronosControl/CronosControlWeb/Views/TimeCategory/TimeCategoryList.aspx 2010-03-25 21:49:00 UTC (rev 38) @@ -1,5 +1,9 @@ <%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<CronosControl.Model.TimeCategory>>" %> +<asp:Content ID="customCSSContent" ContentPlaceHolderID="customCSS" runat="server"> + <link href="/Content/TaskTracking.css" rel="stylesheet" type="text/css" /> +</asp:Content> + <asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server"> TimeCategoryList </asp:Content> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <all...@us...> - 2010-03-16 17:28:59
|
Revision: 37 http://cronoscontrol.svn.sourceforge.net/cronoscontrol/?rev=37&view=rev Author: allancascante Date: 2010-03-16 17:28:50 +0000 (Tue, 16 Mar 2010) Log Message: ----------- Ticket #8: Added support for to create tickets and list, missing the edit and details functioanlity. Some mods where made to the bussiness and DAL to support the save functionality required. Modified Paths: -------------- source/trunk/CronosControl/CronosControlBusinessClassLibrary/Business/Business.cs source/trunk/CronosControl/CronosControlBusinessClassLibrary/Business/Companies.cs source/trunk/CronosControl/CronosControlBusinessClassLibrary/Business/IBusiness.cs source/trunk/CronosControl/CronosControlBusinessClassLibrary/Business/Projects.cs source/trunk/CronosControl/CronosControlBusinessClassLibrary/Business/Tasks.cs source/trunk/CronosControl/CronosControlBusinessClassLibrary/Business/TimeCategories.cs source/trunk/CronosControl/CronosControlBusinessClassLibrary/Business/Users.cs source/trunk/CronosControl/CronosControlBusinessClassLibrary/Business/Util/ErrorHandling/ExceptionBusinessError.cs source/trunk/CronosControl/CronosControlBusinessClassLibrary/CronosControlBusinessClassLibrary.csproj source/trunk/CronosControl/CronosControlClassLibrary/CronosControlModel.Designer.cs source/trunk/CronosControl/CronosControlClassLibrary/CronosControlModel.edmx source/trunk/CronosControl/CronosControlClassLibrary/app.config source/trunk/CronosControl/CronosControlWeb/CronosControlWeb.csproj source/trunk/CronosControl/CronosControlWeb/Web.config Added Paths: ----------- source/trunk/CronosControl/CronosControlBusinessClassLibrary/Business/Util/Helpers/ source/trunk/CronosControl/CronosControlBusinessClassLibrary/Business/Util/Helpers/EntityHelperUtil.cs source/trunk/CronosControl/CronosControlWeb/Controllers/TimeCategoryController.cs source/trunk/CronosControl/CronosControlWeb/Views/TimeCategory/ source/trunk/CronosControl/CronosControlWeb/Views/TimeCategory/TimeCategoryCreate.aspx source/trunk/CronosControl/CronosControlWeb/Views/TimeCategory/TimeCategoryList.aspx Modified: source/trunk/CronosControl/CronosControlBusinessClassLibrary/Business/Business.cs =================================================================== --- source/trunk/CronosControl/CronosControlBusinessClassLibrary/Business/Business.cs 2010-02-19 23:36:14 UTC (rev 36) +++ source/trunk/CronosControl/CronosControlBusinessClassLibrary/Business/Business.cs 2010-03-16 17:28:50 UTC (rev 37) @@ -6,17 +6,27 @@ using CronosControl.Business.Util.ErrorHandling; using Microsoft.Practices.EnterpriseLibrary.ExceptionHandling; using System.Data.Objects.DataClasses; +using CronosControl.Business.Util.Helpers; namespace CronosControl.Business { - public abstract class Business<T> : IBusiness<T> where T : IEntityWithKey + public abstract class Business<T> : IBusiness<T> where T : EntityObject { private CronosControlEntities cronosControlEntities; - public CronosControlEntities CronosControlEntities + public CronosControlEntities CronosControlEntitiesContext { - get { return cronosControlEntities; } - set { cronosControlEntities = value; } + get { + if (cronosControlEntities != null) + { + return cronosControlEntities; + } + else + { + return cronosControlEntities = new CronosControlEntities(); + } + + } } #region IBusiness<User> Members @@ -25,22 +35,14 @@ { List<IBusinessError> errors = new List<IBusinessError>(); try - { - cronosControlEntities = new CronosControlEntities(); + { Object savedEntity = null; - - if (entity.EntityKey != null && cronosControlEntities.TryGetObjectByKey(entity.EntityKey, out savedEntity)) + using (CronosControlEntitiesContext) { - CronosControlEntities.Attach(entity); - CronosControlEntities.SaveChanges(); + EntityHelperUtil.AddObjectOrAttach(CronosControlEntitiesContext, entity.GetType().Name, entity); + CronosControlEntitiesContext.SaveChanges(); return errors; } - else - { - cronosControlEntities.AddObject(entity.GetType().Name, entity); - CronosControlEntities.SaveChanges(); - return errors; - } } catch (Exception ex) { @@ -52,30 +54,35 @@ public virtual T Get(T entity) { - cronosControlEntities = new CronosControlEntities(); - Object savedEntity = null; - if (entity.EntityKey != null && cronosControlEntities.TryGetObjectByKey(entity.EntityKey, out savedEntity)) + using (CronosControlEntitiesContext) { - return (T)savedEntity; + Object savedEntity = null; + if (entity.EntityKey != null && cronosControlEntities.TryGetObjectByKey(entity.EntityKey, out savedEntity)) + { + CronosControlEntitiesContext.Detach(savedEntity); + return (T)savedEntity; + } + else + { + return entity; + } } - else - { - return entity; - } } public virtual bool Find(T entity) { - cronosControlEntities = new CronosControlEntities(); - Object savedEntity = null; - if (entity.EntityKey != null && cronosControlEntities.TryGetObjectByKey(entity.EntityKey, out savedEntity)) + using (CronosControlEntitiesContext) { - return true; + Object savedEntity = null; + if (entity.EntityKey != null && CronosControlEntitiesContext.TryGetObjectByKey(entity.EntityKey, out savedEntity)) + { + return true; + } + else + { + return false; + } } - else - { - return false; - } } public abstract List<T> List(); Modified: source/trunk/CronosControl/CronosControlBusinessClassLibrary/Business/Companies.cs =================================================================== --- source/trunk/CronosControl/CronosControlBusinessClassLibrary/Business/Companies.cs 2010-02-19 23:36:14 UTC (rev 36) +++ source/trunk/CronosControl/CronosControlBusinessClassLibrary/Business/Companies.cs 2010-03-16 17:28:50 UTC (rev 37) @@ -3,6 +3,7 @@ using System.Linq; using System.Text; using CronosControl.Model; +using System.Data; namespace CronosControl.Business { @@ -11,6 +12,19 @@ /// </summary> public class Companies : Business<Company>, ICompanies { + /// <summary> + /// Sets the entity id for a given company with the id company attribute from the entity. All entites should be calling this method when invoking get on new entities having only the id set. + /// </summary> + /// <param name="company">the company to set the entity to</param> + public void setEntityKey(Company company) + { + // Create the key that represents the order. + EntityKey key = new EntityKey("CronosControlEntities.Company", "IdCompany", company.IdCompany); + + // Create an order that we can attach. + company.EntityKey = key; + } + #region Business<Company> abstract methods public override List<Company> List() { Modified: source/trunk/CronosControl/CronosControlBusinessClassLibrary/Business/IBusiness.cs =================================================================== --- source/trunk/CronosControl/CronosControlBusinessClassLibrary/Business/IBusiness.cs 2010-02-19 23:36:14 UTC (rev 36) +++ source/trunk/CronosControl/CronosControlBusinessClassLibrary/Business/IBusiness.cs 2010-03-16 17:28:50 UTC (rev 37) @@ -9,9 +9,13 @@ { public interface IBusiness<T> { - CronosControlEntities CronosControlEntities { get; set; } /// <summary> + /// The context used for all objects. + /// </summary> + CronosControlEntities CronosControlEntitiesContext {get;} + + /// <summary> /// Saves or updates the given entity, if it was saved before it will be updated if is a new instance it will saved as a new entry /// </summary> /// <param name="entity">The entity to save</param> @@ -22,6 +26,7 @@ /// Get an entity for the given entity, the provided entity only needs to provide the key value for the entity to get. /// </summary> /// <param name="entity">The entity with the key value set to get</param> + /// <param name="cronosControlEntities">the context to get from</param> /// <returns>The entity found null otherwise</returns> T Get(T entity); Modified: source/trunk/CronosControl/CronosControlBusinessClassLibrary/Business/Projects.cs =================================================================== --- source/trunk/CronosControl/CronosControlBusinessClassLibrary/Business/Projects.cs 2010-02-19 23:36:14 UTC (rev 36) +++ source/trunk/CronosControl/CronosControlBusinessClassLibrary/Business/Projects.cs 2010-03-16 17:28:50 UTC (rev 37) @@ -12,19 +12,23 @@ /// </summary> public class Projects : Business<Project>, IProjects { - CronosControlEntities cronosControlEntities; - #region Bussiness Abstract Methods public override List<Project> List() { - cronosControlEntities = new CronosControlEntities(); - return cronosControlEntities.Project.ToList(); + using (CronosControlEntities cronosControlEntities = new CronosControlEntities()) + { + return cronosControlEntities.Project.ToList(); + } } public override List<Project> List(int page, int elements) { - throw new NotImplementedException(); + using (CronosControlEntities cronosControlEntities = new CronosControlEntities()) + { + return cronosControlEntities.Project.Skip(elements * (page - 1)).Take(elements).ToList(); + } } + #endregion } } Modified: source/trunk/CronosControl/CronosControlBusinessClassLibrary/Business/Tasks.cs =================================================================== --- source/trunk/CronosControl/CronosControlBusinessClassLibrary/Business/Tasks.cs 2010-02-19 23:36:14 UTC (rev 36) +++ source/trunk/CronosControl/CronosControlBusinessClassLibrary/Business/Tasks.cs 2010-03-16 17:28:50 UTC (rev 37) @@ -12,15 +12,87 @@ public class Tasks : Business<Task>, ITasks { #region Business<Task> + /// <summary> + /// Get the list of all task in the system. + /// </summary> + /// <returns>A list with all taks</returns> public override List<Task> List() { - throw new NotImplementedException(); + using (CronosControlEntities cronosControlEntities = new CronosControlEntities()) + { + return cronosControlEntities.Task.ToList(); + } } + /// <summary> + /// Get a sub set of all tasks on the system. + /// </summary> + /// <param name="page">The page to get</param> + /// <param name="elements">The number of elements by page</param> + /// <returns>The page for the given parameters</returns> public override List<Task> List(int page, int elements) { - throw new NotImplementedException(); + using (CronosControlEntities cronosControlEntities = new CronosControlEntities()) + { + return cronosControlEntities.Task.Skip(elements * (page - 1)).Take(elements).ToList(); + } } + + /// <summary> + /// Get the list of all User's Tasks on the system for a given user + /// </summary> + /// <param name="user">The user to search the tasks for</param> + /// <returns>The list of tasks for the user</returns> + public List<Task> UserTasks(User user) + { + using (CronosControlEntities cronosControlEntities = new CronosControlEntities()) + { + return (from u in cronosControlEntities.TaskUser + where u.User == user + select u.Task).ToList<Task>(); + } + } + + /// <summary> + /// Gets a sub list of User's Tasks on the system for the given user + /// </summary> + /// <param name="user">The user to search the tasks for</param> + /// <param name="page">The page to get</param> + /// <param name="elements">The number of elements by page</param> + /// <returns>The list of tasks on the given range for the user</returns> + public List<Task> UserTasks(User user, int page, int elements) + { + using (CronosControlEntities cronosControlEntities = new CronosControlEntities()) + { + return (from u in cronosControlEntities.TaskUser + where u.User == user + select u.Task).Skip(elements * (page - 1)).Take(elements).ToList<Task>(); + } + } + + /// <summary> + /// Get the a sub list of User's Tasks on the system for a given date range + /// </summary> + /// <param name="user">The user to search the tasks for</param> + /// <param name="startDate">The start date in the range</param> + /// <param name="endDate">The end date in the range</param> + /// <param name="page">The page number to get</param> + /// <param name="elements">The elements t</param> + /// <returns></returns> + public List<Task> UserTasks(User user, DateTime startDate, DateTime endDate, int page, int elements) + { + if (startDate == null || endDate == null || startDate.CompareTo(endDate) > 0) + { + throw new ArgumentException("The provided start and end dates are not correct."); + } + using (CronosControlEntities cronosControlEntities = new CronosControlEntities()) + { + return (from u in cronosControlEntities.TaskUser + where u.User == user && u.StartDate >= startDate && u.EndDate <= endDate + select u.Task).Skip(elements * (page - 1)).Take(elements).ToList<Task>(); + } + } + #endregion } } Modified: source/trunk/CronosControl/CronosControlBusinessClassLibrary/Business/TimeCategories.cs =================================================================== --- source/trunk/CronosControl/CronosControlBusinessClassLibrary/Business/TimeCategories.cs 2010-02-19 23:36:14 UTC (rev 36) +++ source/trunk/CronosControl/CronosControlBusinessClassLibrary/Business/TimeCategories.cs 2010-03-16 17:28:50 UTC (rev 37) @@ -3,6 +3,9 @@ using System.Linq; using System.Text; using CronosControl.Model; +using CronosControl.Business.Util.ErrorHandling; +using Microsoft.Practices.EnterpriseLibrary.ExceptionHandling; +using CronosControl.Business.Util.Helpers; namespace CronosControl.Business { @@ -11,15 +14,24 @@ /// </summary> public class TimeCategories : Business<TimeCategory>, ITimeCategories { + #region Business<TimeCategory> abstract methods + + public override List<IBusinessError> Save(TimeCategory entity) + { + entity.CreatedAt = DateTime.Now; + return base.Save(entity); + } + public override List<TimeCategory> List() { - throw new NotImplementedException(); + return CronosControlEntitiesContext.TimeCategory.ToList(); } public override List<TimeCategory> List(int page, int elements) { - throw new NotImplementedException(); + + return CronosControlEntitiesContext.TimeCategory.Skip(elements * (page - 1)).Take(elements).ToList(); } #endregion } Modified: source/trunk/CronosControl/CronosControlBusinessClassLibrary/Business/Users.cs =================================================================== --- source/trunk/CronosControl/CronosControlBusinessClassLibrary/Business/Users.cs 2010-02-19 23:36:14 UTC (rev 36) +++ source/trunk/CronosControl/CronosControlBusinessClassLibrary/Business/Users.cs 2010-03-16 17:28:50 UTC (rev 37) @@ -13,16 +13,19 @@ { public override List<IBusinessError> Save(User entity) { - if (this.Find(entity)) + using(CronosControlEntitiesContext) { - entity.UpdatedAt = DateTime.Now; + if (this.Find(entity)) + { + entity.UpdatedAt = DateTime.Now; + } + else + { + entity.CreatedAt = DateTime.Now; + entity.Enabled = true; + } + return base.Save(entity); } - else - { - entity.CreatedAt = DateTime.Now; - entity.Enabled = true; - } - return base.Save(entity); } #region Business<User> abstract methods Modified: source/trunk/CronosControl/CronosControlBusinessClassLibrary/Business/Util/ErrorHandling/ExceptionBusinessError.cs =================================================================== --- source/trunk/CronosControl/CronosControlBusinessClassLibrary/Business/Util/ErrorHandling/ExceptionBusinessError.cs 2010-02-19 23:36:14 UTC (rev 36) +++ source/trunk/CronosControl/CronosControlBusinessClassLibrary/Business/Util/ErrorHandling/ExceptionBusinessError.cs 2010-03-16 17:28:50 UTC (rev 37) @@ -14,5 +14,10 @@ { this.ex = ex; } + + public override String ToString() + { + return ex.Message; + } } } Added: source/trunk/CronosControl/CronosControlBusinessClassLibrary/Business/Util/Helpers/EntityHelperUtil.cs =================================================================== --- source/trunk/CronosControl/CronosControlBusinessClassLibrary/Business/Util/Helpers/EntityHelperUtil.cs (rev 0) +++ source/trunk/CronosControl/CronosControlBusinessClassLibrary/Business/Util/Helpers/EntityHelperUtil.cs 2010-03-16 17:28:50 UTC (rev 37) @@ -0,0 +1,232 @@ +using System; +using System.ComponentModel; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Data; +using System.Data.Objects; +using System.Data.Objects.DataClasses; +using System.Text; +using System.Reflection; + +namespace CronosControl.Business.Util.Helpers +{ + + /// <summary> + /// Attach helper for entity framework + /// </summary> + public static class EntityHelperUtil + { + /// <summary> + /// Adds or attaches an entity object to the context + /// </summary> + public static void AddObjectOrAttach(ObjectContext context, string entitySetName, EntityObject entity) + { + if (entity.EntityKey == null) + { + AddObject(context, entitySetName, entity); + } + else + { + Attach(context, entity); + } + } + + /// <summary> + /// Adds an entity object to the context + /// </summary> + public static void AddObject(ObjectContext context, string entitySetName, IEntityWithRelationships entity) + { + // remove all relations + List<RelationsShipMapping> map = new List<RelationsShipMapping>(); + RemoveRelationships(map, entity, -1); + + // add the entity + context.AddObject(entitySetName, entity); + + // recreate all relationships + AddRelationships(context, map); + } + + /// <summary> + /// Attaches an entity object to the context + /// </summary> + public static void Attach(ObjectContext context, EntityObject entity) + { + // remove all relations + List<RelationsShipMapping> map = new List<RelationsShipMapping>(); + RemoveRelationships(map, entity, -1); + + // attach the entity + context.Attach(entity); + + // recreate all relationships + AddRelationships(context, map); + } + + /// <summary> + /// Attaches all related entity object and recreates all relationships + /// </summary> + static void AddRelationships(ObjectContext context, List<RelationsShipMapping> map) + { + int layer = -1; + + // loop through all layers + do + { + layer++; + + // return all entity object from a specific layer + IEnumerable<RelationsShipMapping> rs = from r in map + where r.Layer == layer + select r; + + // check if there are no further related entity objects + if (rs.Count<RelationsShipMapping>() == 0) + break; + + // move through the remembered mappings of the current layer + foreach (RelationsShipMapping mapping in rs) + { + // check if we need to attach the related entity object + IEntityWithKey entityWithKey = mapping.TargetEntity as IEntityWithKey; + if (entityWithKey != null && entityWithKey.EntityKey != null) + context.Attach(entityWithKey); + + // check if it´s a EntityCollection or EntityReference relationship + if (!mapping.IsReference) + { + // add the related collection entity object + MethodInfo mi = typeof(RelationshipManager).GetMethod("GetRelatedCollection").MakeGenericMethod(mapping.TargetEntity.GetType()); + object col = mi.Invoke( + mapping.Entity.RelationshipManager, + new object[]{ mapping.RelationshipName, mapping.TargetRole }); + MethodInfo miAdd = col.GetType().GetMethod("Add"); + miAdd.Invoke(col, new object[] { mapping.TargetEntity }); + } + else + { + // set the related reference entity object + MethodInfo mi = typeof(RelationshipManager).GetMethod("GetRelatedReference").MakeGenericMethod(mapping.TargetEntity.GetType()); + + EntityReference er = (EntityReference)mi.Invoke( + mapping.Entity.RelationshipManager, + new object[]{ mapping.RelationshipName, mapping.TargetRole }); + er.GetType().GetProperty("Value").SetValue(er, mapping.TargetEntity, null); + } + } + } + while (true); + } + + + + /// <summary> + /// Removes all related entity objects + /// </summary> + static void RemoveRelationships(List<RelationsShipMapping> map, IEntityWithRelationships entity, int layer) + { + // the layer represents the stack in the relationships + // for example: the related entities to main entity object is layer 0, + // and the related entites to the related entites is layer 1, etc... + layer++; + // get a collection of all related conceptual entities. + IEnumerable<IRelatedEnd> en = entity.RelationshipManager.GetAllRelatedEnds(); + + foreach (IRelatedEnd end in en) + { + // check if the relation is an EntityCollection + IEnumerable col = end as IEnumerable; + if (col != null) + { + string colRelationshipName = (string)col.GetType().GetProperty("RelationshipName").GetValue(col, null); + string colSourceRoleName = (string)col.GetType().GetProperty("SourceRoleName").GetValue(col, null); + string colTargetRoleName = (string)col.GetType().GetProperty("TargetRoleName").GetValue(col, null); + + IEnumerator enu = col.GetEnumerator(); + + List<IEntityWithRelationships> mem = new List<IEntityWithRelationships>(); + while (enu.MoveNext()) + { + IEntityWithRelationships item = (IEntityWithRelationships)enu.Current; + + // check if the relationship is already added the map + int alreadyExists = (from c in map + where c.RelationshipName == colRelationshipName && c.TargetRole == colSourceRoleName + select c).Count(); + if (alreadyExists > 0) + continue; + + // remember the relationships and add it to the map + RelationsShipMapping mapping = new RelationsShipMapping(); + mapping.Layer = layer; + mapping.RelationshipName = colRelationshipName; + mapping.TargetRole = colTargetRoleName; + mapping.Entity = entity; + mapping.TargetEntity = item; + mapping.IsReference = false; + + map.Add(mapping); + + mem.Add(item); + + RemoveRelationships(map, item, layer); + } + + // remove the entity collection relationships + foreach(IEntityWithRelationships item in mem) + { + end.Remove(item); + } + } + + // check if the relation is an EntityReference + EntityReference er = end as EntityReference; + if (er != null) + { + System.Reflection.PropertyInfo pValue = er.GetType().GetProperty("Value"); + IEntityWithRelationships value = (IEntityWithRelationships)pValue.GetValue(er, null); + if (value == null) + continue; + + if (er != null) + { + // check if the reference is already added the map + int alreadyExists = (from c in map + where c.RelationshipName == er.RelationshipName && c.TargetRole == er.SourceRoleName + select c).Count(); + + if (alreadyExists > 0) + continue; + // remember the relationships and add it to the map + RelationsShipMapping mapping = new RelationsShipMapping(); + mapping.Layer = layer; + mapping.RelationshipName = er.RelationshipName; + mapping.TargetRole = er.TargetRoleName; + mapping.Entity = entity; + mapping.TargetEntity = value; + mapping.IsReference = true; + map.Add(mapping); + + // remove the entity reference relationships + pValue.SetValue(er, null, null); + RemoveRelationships(map, value, layer); + } + } + } + } + + /// <summary> + /// Used to remember relationships in the entity object + /// </summary> + class RelationsShipMapping + { + public int Layer; + public string RelationshipName; + public string TargetRole; + public IEntityWithRelationships Entity; + public IEntityWithRelationships TargetEntity; + public bool IsReference; + } + } +} Modified: source/trunk/CronosControl/CronosControlBusinessClassLibrary/CronosControlBusinessClassLibrary.csproj =================================================================== --- source/trunk/CronosControl/CronosControlBusinessClassLibrary/CronosControlBusinessClassLibrary.csproj 2010-02-19 23:36:14 UTC (rev 36) +++ source/trunk/CronosControl/CronosControlBusinessClassLibrary/CronosControlBusinessClassLibrary.csproj 2010-03-16 17:28:50 UTC (rev 37) @@ -76,6 +76,7 @@ <Compile Include="Business\Users.cs" /> <Compile Include="Business\Util\ErrorHandling\ExceptionBusinessError.cs" /> <Compile Include="Business\Util\ErrorHandling\IBusinessError.cs" /> + <Compile Include="Business\Util\Helpers\EntityHelperUtil.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> </ItemGroup> <ItemGroup> Modified: source/trunk/CronosControl/CronosControlClassLibrary/CronosControlModel.Designer.cs =================================================================== --- source/trunk/CronosControl/CronosControlClassLibrary/CronosControlModel.Designer.cs 2010-02-19 23:36:14 UTC (rev 36) +++ source/trunk/CronosControl/CronosControlClassLibrary/CronosControlModel.Designer.cs 2010-03-16 17:28:50 UTC (rev 37) @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. -// Runtime Version:2.0.50727.3053 +// Runtime Version:2.0.50727.3603 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -37,9 +37,12 @@ [assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("CronosControl.Model", "FK_UserProjectRole_User", "User", global::System.Data.Metadata.Edm.RelationshipMultiplicity.One, typeof(CronosControl.Model.User), "UserProjectRole", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(CronosControl.Model.UserProjectRole))] [assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("CronosControl.Model", "FK_UserSession_User", "User", global::System.Data.Metadata.Edm.RelationshipMultiplicity.One, typeof(CronosControl.Model.User), "UserSession", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(CronosControl.Model.UserSession))] [assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("CronosControl.Model", "FK_IdUserProjectRoleDocument_UserProjectRole", "UserProjectRole", global::System.Data.Metadata.Edm.RelationshipMultiplicity.One, typeof(CronosControl.Model.UserProjectRole), "UserProjectRoleDocument", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(CronosControl.Model.UserProjectRoleDocument))] +[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("CronosControl.Model", "FK_TaskUser_Task", "Task", global::System.Data.Metadata.Edm.RelationshipMultiplicity.One, typeof(CronosControl.Model.Task), "TaskUser", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(CronosControl.Model.TaskUser))] +[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("CronosControl.Model", "FK_TaskUser_TimeCategory", "TimeCategory", global::System.Data.Metadata.Edm.RelationshipMultiplicity.ZeroOrOne, typeof(CronosControl.Model.TimeCategory), "TaskUser", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(CronosControl.Model.TaskUser))] +[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("CronosControl.Model", "FK_TaskUser_User", "User", global::System.Data.Metadata.Edm.RelationshipMultiplicity.One, typeof(CronosControl.Model.User), "TaskUser", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(CronosControl.Model.TaskUser))] // Original file name: -// Generation date: 2/15/2010 5:38:48 PM +// Generation date: 3/16/2010 11:21:21 AM namespace CronosControl.Model { @@ -374,6 +377,21 @@ } private global::System.Data.Objects.ObjectQuery<UserSession> _UserSession; /// <summary> + /// There are no comments for TaskUser in the schema. + /// </summary> + public global::System.Data.Objects.ObjectQuery<TaskUser> TaskUser + { + get + { + if ((this._TaskUser == null)) + { + this._TaskUser = base.CreateQuery<TaskUser>("[TaskUser]"); + } + return this._TaskUser; + } + } + private global::System.Data.Objects.ObjectQuery<TaskUser> _TaskUser; + /// <summary> /// There are no comments for Calendar in the schema. /// </summary> public void AddToCalendar(Calendar calendar) @@ -513,6 +531,13 @@ { base.AddObject("UserSession", userSession); } + /// <summary> + /// There are no comments for TaskUser in the schema. + /// </summary> + public void AddToTaskUser(TaskUser taskUser) + { + base.AddObject("TaskUser", taskUser); + } } /// <summary> /// There are no comments for CronosControl.Model.Calendar in the schema. @@ -3074,6 +3099,27 @@ } } } + /// <summary> + /// There are no comments for TaskUser in the schema. + /// </summary> + [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("CronosControl.Model", "FK_TaskUser_Task", "TaskUser")] + [global::System.Xml.Serialization.XmlIgnoreAttribute()] + [global::System.Xml.Serialization.SoapIgnoreAttribute()] + [global::System.Runtime.Serialization.DataMemberAttribute()] + public global::System.Data.Objects.DataClasses.EntityCollection<TaskUser> TaskUser + { + get + { + return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedCollection<TaskUser>("CronosControl.Model.FK_TaskUser_Task", "TaskUser"); + } + set + { + if ((value != null)) + { + ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedCollection<TaskUser>("CronosControl.Model.FK_TaskUser_Task", "TaskUser", value); + } + } + } } /// <summary> /// There are no comments for CronosControl.Model.TimeCategory in the schema. @@ -3344,6 +3390,27 @@ } } } + /// <summary> + /// There are no comments for TaskUser in the schema. + /// </summary> + [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("CronosControl.Model", "FK_TaskUser_TimeCategory", "TaskUser")] + [global::System.Xml.Serialization.XmlIgnoreAttribute()] + [global::System.Xml.Serialization.SoapIgnoreAttribute()] + [global::System.Runtime.Serialization.DataMemberAttribute()] + public global::System.Data.Objects.DataClasses.EntityCollection<TaskUser> TaskUser + { + get + { + return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedCollection<TaskUser>("CronosControl.Model.FK_TaskUser_TimeCategory", "TaskUser"); + } + set + { + if ((value != null)) + { + ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedCollection<TaskUser>("CronosControl.Model.FK_TaskUser_TimeCategory", "TaskUser", value); + } + } + } } /// <summary> /// There are no comments for CronosControl.Model.TimeSheet in the schema. @@ -4688,6 +4755,27 @@ } } } + /// <summary> + /// There are no comments for TaskUser in the schema. + /// </summary> + [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("CronosControl.Model", "FK_TaskUser_User", "TaskUser")] + [global::System.Xml.Serialization.XmlIgnoreAttribute()] + [global::System.Xml.Serialization.SoapIgnoreAttribute()] + [global::System.Runtime.Serialization.DataMemberAttribute()] + public global::System.Data.Objects.DataClasses.EntityCollection<TaskUser> TaskUser + { + get + { + return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedCollection<TaskUser>("CronosControl.Model.FK_TaskUser_User", "TaskUser"); + } + set + { + if ((value != null)) + { + ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedCollection<TaskUser>("CronosControl.Model.FK_TaskUser_User", "TaskUser", value); + } + } + } } /// <summary> /// There are no comments for CronosControl.Model.UserProjectRole in the schema. @@ -5193,4 +5281,231 @@ } } } + /// <summary> + /// There are no comments for CronosControl.Model.TaskUser in the schema. + /// </summary> + /// <KeyProperties> + /// IdTaskUser + /// </KeyProperties> + [global::System.Data.Objects.DataClasses.EdmEntityTypeAttribute(NamespaceName="CronosControl.Model", Name="TaskUser")] + [global::System.Runtime.Serialization.DataContractAttribute(IsReference=true)] + [global::System.Serializable()] + public partial class TaskUser : global::System.Data.Objects.DataClasses.EntityObject + { + /// <summary> + /// Create a new TaskUser object. + /// </summary> + /// <param name="idTaskUser">Initial value of IdTaskUser.</param> + /// <param name="assigment">Initial value of Assigment.</param> + public static TaskUser CreateTaskUser(int idTaskUser, short assigment) + { + TaskUser taskUser = new TaskUser(); + taskUser.IdTaskUser = idTaskUser; + taskUser.Assigment = assigment; + return taskUser; + } + /// <summary> + /// There are no comments for Property IdTaskUser in the schema. + /// </summary> + [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)] + [global::System.Runtime.Serialization.DataMemberAttribute()] + public int IdTaskUser + { + get + { + return this._IdTaskUser; + } + set + { + this.OnIdTaskUserChanging(value); + this.ReportPropertyChanging("IdTaskUser"); + this._IdTaskUser = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value); + this.ReportPropertyChanged("IdTaskUser"); + this.OnIdTaskUserChanged(); + } + } + private int _IdTaskUser; + partial void OnIdTaskUserChanging(int value); + partial void OnIdTaskUserChanged(); + /// <summary> + /// There are no comments for Property Assigment in the schema. + /// </summary> + [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(IsNullable=false)] + [global::System.Runtime.Serialization.DataMemberAttribute()] + public short Assigment + { + get + { + return this._Assigment; + } + set + { + this.OnAssigmentChanging(value); + this.ReportPropertyChanging("Assigment"); + this._Assigment = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value); + this.ReportPropertyChanged("Assigment"); + this.OnAssigmentChanged(); + } + } + private short _Assigment; + partial void OnAssigmentChanging(short value); + partial void OnAssigmentChanged(); + /// <summary> + /// There are no comments for Property StartDate in the schema. + /// </summary> + [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()] + [global::System.Runtime.Serialization.DataMemberAttribute()] + public global::System.Nullable<global::System.DateTime> StartDate + { + get + { + return this._StartDate; + } + set + { + this.OnStartDateChanging(value); + this.ReportPropertyChanging("StartDate"); + this._StartDate = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value); + this.ReportPropertyChanged("StartDate"); + this.OnStartDateChanged(); + } + } + private global::System.Nullable<global::System.DateTime> _StartDate; + partial void OnStartDateChanging(global::System.Nullable<global::System.DateTime> value); + partial void OnStartDateChanged(); + /// <summary> + /// There are no comments for Property EndDate in the schema. + /// </summary> + [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()] + [global::System.Runtime.Serialization.DataMemberAttribute()] + public global::System.Nullable<global::System.DateTime> EndDate + { + get + { + return this._EndDate; + } + set + { + this.OnEndDateChanging(value); + this.ReportPropertyChanging("EndDate"); + this._EndDate = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value); + this.ReportPropertyChanged("EndDate"); + this.OnEndDateChanged(); + } + } + private global::System.Nullable<global::System.DateTime> _EndDate; + partial void OnEndDateChanging(global::System.Nullable<global::System.DateTime> value); + partial void OnEndDateChanged(); + /// <summary> + /// There are no comments for Task in the schema. + /// </summary> + [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("CronosControl.Model", "FK_TaskUser_Task", "Task")] + [global::System.Xml.Serialization.XmlIgnoreAttribute()] + [global::System.Xml.Serialization.SoapIgnoreAttribute()] + [global::System.Runtime.Serialization.DataMemberAttribute()] + public Task Task + { + get + { + return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<Task>("CronosControl.Model.FK_TaskUser_Task", "Task").Value; + } + set + { + ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<Task>("CronosControl.Model.FK_TaskUser_Task", "Task").Value = value; + } + } + /// <summary> + /// There are no comments for Task in the schema. + /// </summary> + [global::System.ComponentModel.BrowsableAttribute(false)] + [global::System.Runtime.Serialization.DataMemberAttribute()] + public global::System.Data.Objects.DataClasses.EntityReference<Task> TaskReference + { + get + { + return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<Task>("CronosControl.Model.FK_TaskUser_Task", "Task"); + } + set + { + if ((value != null)) + { + ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedReference<Task>("CronosControl.Model.FK_TaskUser_Task", "Task", value); + } + } + } + /// <summary> + /// There are no comments for TimeCategory in the schema. + /// </summary> + [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("CronosControl.Model", "FK_TaskUser_TimeCategory", "TimeCategory")] + [global::System.Xml.Serialization.XmlIgnoreAttribute()] + [global::System.Xml.Serialization.SoapIgnoreAttribute()] + [global::System.Runtime.Serialization.DataMemberAttribute()] + public TimeCategory TimeCategory + { + get + { + return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<TimeCategory>("CronosControl.Model.FK_TaskUser_TimeCategory", "TimeCategory").Value; + } + set + { + ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<TimeCategory>("CronosControl.Model.FK_TaskUser_TimeCategory", "TimeCategory").Value = value; + } + } + /// <summary> + /// There are no comments for TimeCategory in the schema. + /// </summary> + [global::System.ComponentModel.BrowsableAttribute(false)] + [global::System.Runtime.Serialization.DataMemberAttribute()] + public global::System.Data.Objects.DataClasses.EntityReference<TimeCategory> TimeCategoryReference + { + get + { + return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<TimeCategory>("CronosControl.Model.FK_TaskUser_TimeCategory", "TimeCategory"); + } + set + { + if ((value != null)) + { + ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedReference<TimeCategory>("CronosControl.Model.FK_TaskUser_TimeCategory", "TimeCategory", value); + } + } + } + /// <summary> + /// There are no comments for User in the schema. + /// </summary> + [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("CronosControl.Model", "FK_TaskUser_User", "User")] + [global::System.Xml.Serialization.XmlIgnoreAttribute()] + [global::System.Xml.Serialization.SoapIgnoreAttribute()] + [global::System.Runtime.Serialization.DataMemberAttribute()] + public User User + { + get + { + return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<User>("CronosControl.Model.FK_TaskUser_User", "User").Value; + } + set + { + ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<User>("CronosControl.Model.FK_TaskUser_User", "User").Value = value; + } + } + /// <summary> + /// There are no comments for User in the schema. + /// </summary> + [global::System.ComponentModel.BrowsableAttribute(false)] + [global::System.Runtime.Serialization.DataMemberAttribute()] + public global::System.Data.Objects.DataClasses.EntityReference<User> UserReference + { + get + { + return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<User>("CronosControl.Model.FK_TaskUser_User", "User"); + } + set + { + if ((value != null)) + { + ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedReference<User>("CronosControl.Model.FK_TaskUser_User", "User", value); + } + } + } + } } Modified: source/trunk/CronosControl/CronosControlClassLibrary/CronosControlModel.edmx =================================================================== --- source/trunk/CronosControl/CronosControlClassLibrary/CronosControlModel.edmx 2010-02-19 23:36:14 UTC (rev 36) +++ source/trunk/CronosControl/CronosControlClassLibrary/CronosControlModel.edmx 2010-03-16 17:28:50 UTC (rev 37) @@ -4,7 +4,7 @@ <edmx:Runtime> <!-- SSDL content --> <edmx:StorageModels> - <Schema Namespace="CronosControl.Model.Store" Alias="Self" Provider="System.Data.SqlClient" ProviderManifestToken="2005" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" xmlns="http://schemas.microsoft.com/ado/2006/04/edm/ssdl"> + <Schema Namespace="CronosControl.Model.Store" Alias="Self" Provider="System.Data.SqlClient" ProviderManifestToken="2008" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" xmlns="http://schemas.microsoft.com/ado/2006/04/edm/ssdl"> <EntityContainer Name="CronosControlModelStoreContainer"> <EntitySet Name="Calendar" EntityType="CronosControl.Model.Store.Calendar" store:Type="Tables" Schema="dbo" /> <EntitySet Name="Client" EntityType="CronosControl.Model.Store.Client" store:Type="Tables" Schema="dbo" /> @@ -17,6 +17,7 @@ <EntitySet Name="ProjectDocument" EntityType="CronosControl.Model.Store.ProjectDocument" store:Type="Tables" Schema="dbo" /> <EntitySet Name="Role" EntityType="CronosControl.Model.Store.Role" store:Type="Tables" Schema="dbo" /> <EntitySet Name="Task" EntityType="CronosControl.Model.Store.Task" store:Type="Tables" Schema="dbo" /> + <EntitySet Name="TaskUser" EntityType="CronosControl.Model.Store.TaskUser" store:Type="Tables" Schema="dbo" /> <EntitySet Name="TimeCategory" EntityType="CronosControl.Model.Store.TimeCategory" store:Type="Tables" Schema="dbo" /> <EntitySet Name="TimeSheet" EntityType="CronosControl.Model.Store.TimeSheet" store:Type="Tables" Schema="dbo" /> <EntitySet Name="TimeSheetCostCenter" EntityType="CronosControl.Model.Store.TimeSheetCostCenter" store:Type="Tables" Schema="dbo" /> @@ -85,6 +86,18 @@ <End Role="Project" EntitySet="Project" /> <End Role="Task" EntitySet="Task" /> </AssociationSet> + <AssociationSet Name="FK_TaskUser_Task" Association="CronosControl.Model.Store.FK_TaskUser_Task"> + <End Role="Task" EntitySet="Task" /> + <End Role="TaskUser" EntitySet="TaskUser" /> + </AssociationSet> + <AssociationSet Name="FK_TaskUser_TimeCategory" Association="CronosControl.Model.Store.FK_TaskUser_TimeCategory"> + <End Role="TimeCategory" EntitySet="TimeCategory" /> + <End Role="TaskUser" EntitySet="TaskUser" /> + </AssociationSet> + <AssociationSet Name="FK_TaskUser_User" Association="CronosControl.Model.Store.FK_TaskUser_User"> + <End Role="User" EntitySet="User" /> + <End Role="TaskUser" EntitySet="TaskUser" /> + </AssociationSet> <AssociationSet Name="FK_TimeCategory_Company" Association="CronosControl.Model.Store.FK_TimeCategory_Company"> <End Role="Company" EntitySet="Company" /> <End Role="TimeCategory" EntitySet="TimeCategory" /> @@ -277,6 +290,18 @@ <Property Name="CreatedAt" Type="datetime" /> <Property Name="UpdatedAt" Type="datetime" /> </EntityType> + <EntityType Name="TaskUser"> + <Key> + <PropertyRef Name="IdTaskUser" /> + </Key> + <Property Name="IdTaskUser" Type="int" Nullable="false" StoreGeneratedPattern="Identity" /> + <Property Name="IdTask" Type="int" Nullable="false" /> + <Property Name="IdUser" Type="int" Nullable="false" /> + <Property Name="Assigment" Type="smallint" Nullable="false" /> + <Property Name="StartDate" Type="date" /> + <Property Name="EndDate" Type="date" /> + <Property Name="IdTimeCategory" Type="int" /> + </EntityType> <EntityType Name="TimeCategory"> <Key> <PropertyRef Name="IdTimeCategory" /> @@ -373,7 +398,7 @@ <Property Name="Price" Type="smallint" /> </EntityType> <!--Errors Found During Generation: - warning 6002: The table/view 'G:\MARIO\DEVELOPER-SVN\CRONOS CONTROL\SOURCE\TRUNK\CRONOSCONTROL\CRONOSCONTROLWEB\APP_DATA\CRONOSCONTROL.MDF.dbo.UserSession' does not have a primary key defined. The key has been inferred and the definition was created as a read-only table/view. + warning 6002: The table/view '40C78158E1169A71FA85F9BB1B227439_ DOCUMENTS\CRONOSCONTROL\SOURCE\TRUNK\CRONOSCONTROL\CRONOSCONTROLWEB\APP_DATA\CRONOSCONTROL.MDF.dbo.UserSession' does not have a primary key defined. The key has been inferred and the definition was created as a read-only table/view. --> <EntityType Name="UserSession"> <Key> @@ -563,6 +588,42 @@ </Dependent> </ReferentialConstraint> </Association> + <Association Name="FK_TaskUser_Task"> + <End Role="Task" Type="CronosControl.Model.Store.Task" Multiplicity="1" /> + <End Role="TaskUser" Type="CronosControl.Model.Store.TaskUser" Multiplicity="*" /> + <ReferentialConstraint> + <Principal Role="Task"> + <PropertyRef Name="IdTask" /> + </Principal> + <Dependent Role="TaskUser"> + <PropertyRef Name="IdTask" /> + </Dependent> + </ReferentialConstraint> + </Association> + <Association Name="FK_TaskUser_TimeCategory"> + <End Role="TimeCategory" Type="CronosControl.Model.Store.TimeCategory" Multiplicity="0..1" /> + <End Role="TaskUser" Type="CronosControl.Model.Store.TaskUser" Multiplicity="*" /> + <ReferentialConstraint> + <Principal Role="TimeCategory"> + <PropertyRef Name="IdTimeCategory" /> + </Principal> + <Dependent Role="TaskUser"> + <PropertyRef Name="IdTimeCategory" /> + </Dependent> + </ReferentialConstraint> + </Association> + <Association Name="FK_TaskUser_User"> + <End Role="User" Type="CronosControl.Model.Store.User" Multiplicity="1" /> + <End Role="TaskUser" Type="CronosControl.Model.Store.TaskUser" Multiplicity="*" /> + <ReferentialConstraint> + <Principal Role="User"> + <PropertyRef Name="IdUser" /> + </Principal> + <Dependent Role="TaskUser"> + <PropertyRef Name="IdUser" /> + </Dependent> + </ReferentialConstraint> + </Association> <Association Name="FK_TimeCategory_Company"> <End Role="Company" Type="CronosControl.Model.Store.Company" Multiplicity="1" /> <End Role="TimeCategory" Type="CronosControl.Model.Store.TimeCategory" Multiplicity="*" /> @@ -772,8 +833,7 @@ </Dependent> </ReferentialConstraint> </Association>--> - </Schema> - </edmx:StorageModels> + </Schema></edmx:StorageModels> <!-- CSDL content --> <edmx:ConceptualModels> <Schema Namespace="CronosControl.Model" Alias="Self" xmlns="http://schemas.microsoft.com/ado/2006/04/edm"> @@ -910,7 +970,16 @@ <End Role="UserProjectRole" EntitySet="UserProjectRole" /> <End Role="UserProjectRoleDocument" EntitySet="UserProjectRoleDocument" /> </AssociationSet> - </EntityContainer> + <EntitySet Name="TaskUser" EntityType="CronosControl.Model.TaskUser" /> + <AssociationSet Name="FK_TaskUser_Task" Association="CronosControl.Model.FK_TaskUser_Task"> + <End Role="Task" EntitySet="Task" /> + <End Role="TaskUser" EntitySet="TaskUser" /></AssociationSet> + <AssociationSet Name="FK_TaskUser_TimeCategory" Association="CronosControl.Model.FK_TaskUser_TimeCategory"> + <End Role="TimeCategory" EntitySet="TimeCategory" /> + <End Role="TaskUser" EntitySet="TaskUser" /></AssociationSet> + <AssociationSet Name="FK_TaskUser_User" Association="CronosControl.Model.FK_TaskUser_User"> + <End Role="User" EntitySet="User" /> + <End Role="TaskUser" EntitySet="TaskUser" /></AssociationSet></EntityContainer> <EntityType Name="Calendar"> <Key> <PropertyRef Name="IdCalendar" /> @@ -1058,7 +1127,7 @@ <Property Name="UpdatedAt" Type="DateTime" /> <NavigationProperty Name="Project" Relationship="CronosControl.Model.FK_Tasks_Project" FromRole="Task" ToRole="Project" /> <NavigationProperty Name="TimeSheetHour" Relationship="CronosControl.Model.FK_TimeSheetHour_Tasks" FromRole="Task" ToRole="TimeSheetHour" /> - </EntityType> + <NavigationProperty Name="TaskUser" Relationship="CronosControl.Model.FK_TaskUser_Task" FromRole="Task" ToRole="TaskUser" /></EntityType> <EntityType Name="TimeCategory"> <Key> <PropertyRef Name="IdTimeCategory" /> @@ -1073,7 +1142,7 @@ <NavigationProperty Name="Company" Relationship="CronosControl.Model.FK_TimeCategory_Company" FromRole="TimeCategory" ToRole="Company" /> <NavigationProperty Name="TimeSheetHour" Relationship="CronosControl.Model.FK_TimeSheetHour_TimeCategory" FromRole="TimeCategory" ToRole="TimeSheetHour" /> <NavigationProperty Name="TimeSheetHourTimeCategory" Relationship="CronosControl.Model.FK_TimeSheetHourTimeCategory_TimeCategory" FromRole="TimeCategory" ToRole="TimeSheetHourTimeCategory" /> - </EntityType> + <NavigationProperty Name="TaskUser" Relationship="CronosControl.Model.FK_TaskUser_TimeCategory" FromRole="TimeCategory" ToRole="TaskUser" /></EntityType> <EntityType Name="TimeSheet"> <Key> <PropertyRef Name="IdTimeSheet" /> @@ -1146,7 +1215,7 @@ <NavigationProperty Name="TimeSheetHour" Relationship="CronosControl.Model.FK_TimeSheetHour_User" FromRole="User" ToRole="TimeSheetHour" /> <NavigationProperty Name="UserProjectRole" Relationship="CronosControl.Model.FK_UserProjectRole_User" FromRole="User" ToRole="UserProjectRole" /> <NavigationProperty Name="UserSession" Relationship="CronosControl.Model.FK_UserSession_User" FromRole="User" ToRole="UserSession" /> - </EntityType> + <NavigationProperty Name="TaskUser" Relationship="CronosControl.Model.FK_TaskUser_User" FromRole="User" ToRole="TaskUser" /></EntityType> <EntityType Name="UserProjectRole"> <Key> <PropertyRef Name="IdUserProjectRole" /> @@ -1350,7 +1419,25 @@ <End Role="UserProjectRole" Type="CronosControl.Model.UserProjectRole" Multiplicity="1" /> <End Role="UserProjectRoleDocument" Type="CronosControl.Model.UserProjectRoleDocument" Multiplicity="*" /> </Association> - </Schema> + <EntityType Name="TaskUser"> + <Key> + <PropertyRef Name="IdTaskUser" /></Key> + <Property Name="IdTaskUser" Type="Int32" Nullable="false" /> + <Property Name="Assigment" Type="Int16" Nullable="false" /> + <Property Name="StartDate" Type="DateTime" Nullable="true" /> + <Property... [truncated message content] |
From: <mar...@us...> - 2010-02-19 23:36:20
|
Revision: 36 http://cronoscontrol.svn.sourceforge.net/cronoscontrol/?rev=36&view=rev Author: marioarce Date: 2010-02-19 23:36:14 +0000 (Fri, 19 Feb 2010) Log Message: ----------- removed hard-wired code Modified Paths: -------------- source/trunk/CronosControl/Libraries/BusinessLogic/ProjectUser/ProjectUserManager.cs Modified: source/trunk/CronosControl/Libraries/BusinessLogic/ProjectUser/ProjectUserManager.cs =================================================================== --- source/trunk/CronosControl/Libraries/BusinessLogic/ProjectUser/ProjectUserManager.cs 2010-02-19 15:01:32 UTC (rev 35) +++ source/trunk/CronosControl/Libraries/BusinessLogic/ProjectUser/ProjectUserManager.cs 2010-02-19 23:36:14 UTC (rev 36) @@ -215,7 +215,7 @@ List<string> userProjectRoles = (from upr in cronosControlEntities.UserProjectRole join ro in cronosControlEntities.Role on new { upr.Role.IdRole } equals new { ro.IdRole } - where (upr.User.IdUser == user.IdUser && upr.Project.IdProject == 2/*project.IdProject*/) + where (upr.User.IdUser == user.IdUser && upr.Project.IdProject == project.IdProject) select ro.Name).ToList<string>(); string[] result = new string[userProjectRoles.Count]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2010-02-19 15:01:43
|
Revision: 35 http://cronoscontrol.svn.sourceforge.net/cronoscontrol/?rev=35&view=rev Author: marioarce Date: 2010-02-19 15:01:32 +0000 (Fri, 19 Feb 2010) Log Message: ----------- * recompiled to apply the recreated the ADO.NET Entity Data Model changes ( r32 ) Modified Paths: -------------- source/trunk/CronosControl/Libraries/BusinessLogic/bin/Debug/CronosControl.BusinessLogic.dll source/trunk/CronosControl/Libraries/BusinessLogic/bin/Debug/CronosControl.BusinessLogic.pdb source/trunk/CronosControl/Libraries/BusinessLogic/bin/Debug/CronosControl.Common.dll source/trunk/CronosControl/Libraries/BusinessLogic/bin/Debug/CronosControl.Common.pdb source/trunk/CronosControl/Libraries/BusinessLogic/bin/Debug/CronosControlBusinessClassLibrary.dll source/trunk/CronosControl/Libraries/BusinessLogic/bin/Debug/CronosControlBusinessClassLibrary.pdb source/trunk/CronosControl/Libraries/BusinessLogic/bin/Debug/CronosControlClassLibrary.dll source/trunk/CronosControl/Libraries/BusinessLogic/bin/Debug/CronosControlClassLibrary.pdb source/trunk/CronosControl/Libraries/BusinessLogic/obj/Debug/BusinessLogic.csproj.FileListAbsolute.txt source/trunk/CronosControl/Libraries/BusinessLogic/obj/Debug/CronosControl.BusinessLogic.dll source/trunk/CronosControl/Libraries/BusinessLogic/obj/Debug/CronosControl.BusinessLogic.pdb source/trunk/CronosControl/Libraries/Common/bin/Debug/CronosControl.Common.dll source/trunk/CronosControl/Libraries/Common/bin/Debug/CronosControl.Common.pdb source/trunk/CronosControl/Libraries/Common/obj/Debug/CronosControl.Common.dll source/trunk/CronosControl/Libraries/Common/obj/Debug/CronosControl.Common.pdb Modified: source/trunk/CronosControl/Libraries/BusinessLogic/bin/Debug/CronosControl.BusinessLogic.dll =================================================================== (Binary files differ) Modified: source/trunk/CronosControl/Libraries/BusinessLogic/bin/Debug/CronosControl.BusinessLogic.pdb =================================================================== (Binary files differ) Modified: source/trunk/CronosControl/Libraries/BusinessLogic/bin/Debug/CronosControl.Common.dll =================================================================== (Binary files differ) Modified: source/trunk/CronosControl/Libraries/BusinessLogic/bin/Debug/CronosControl.Common.pdb =================================================================== (Binary files differ) Modified: source/trunk/CronosControl/Libraries/BusinessLogic/bin/Debug/CronosControlBusinessClassLibrary.dll =================================================================== (Binary files differ) Modified: source/trunk/CronosControl/Libraries/BusinessLogic/bin/Debug/CronosControlBusinessClassLibrary.pdb =================================================================== (Binary files differ) Modified: source/trunk/CronosControl/Libraries/BusinessLogic/bin/Debug/CronosControlClassLibrary.dll =================================================================== (Binary files differ) Modified: source/trunk/CronosControl/Libraries/BusinessLogic/bin/Debug/CronosControlClassLibrary.pdb =================================================================== (Binary files differ) Modified: source/trunk/CronosControl/Libraries/BusinessLogic/obj/Debug/BusinessLogic.csproj.FileListAbsolute.txt =================================================================== --- source/trunk/CronosControl/Libraries/BusinessLogic/obj/Debug/BusinessLogic.csproj.FileListAbsolute.txt 2010-02-19 14:57:16 UTC (rev 34) +++ source/trunk/CronosControl/Libraries/BusinessLogic/obj/Debug/BusinessLogic.csproj.FileListAbsolute.txt 2010-02-19 15:01:32 UTC (rev 35) @@ -1,3 +1,4 @@ +G:\Mario\developer-SVN\Cronos Control\source\trunk\CronosControl\Libraries\BusinessLogic\obj\Debug\ResolveAssemblyReference.cache G:\Mario\developer-SVN\Cronos Control\source\trunk\CronosControl\Libraries\BusinessLogic\bin\Debug\CronosControl.BusinessLogic.dll G:\Mario\developer-SVN\Cronos Control\source\trunk\CronosControl\Libraries\BusinessLogic\bin\Debug\CronosControl.BusinessLogic.pdb G:\Mario\developer-SVN\Cronos Control\source\trunk\CronosControl\Libraries\BusinessLogic\bin\Debug\CronosControl.Common.dll @@ -12,6 +13,5 @@ G:\Mario\developer-SVN\Cronos Control\source\trunk\CronosControl\Libraries\BusinessLogic\bin\Debug\CronosControlClassLibrary.pdb G:\Mario\developer-SVN\Cronos Control\source\trunk\CronosControl\Libraries\BusinessLogic\bin\Debug\CronosControl.Common.pdb G:\Mario\developer-SVN\Cronos Control\source\trunk\CronosControl\Libraries\BusinessLogic\bin\Debug\Microsoft.Practices.EnterpriseLibrary.Common.xml -G:\Mario\developer-SVN\Cronos Control\source\trunk\CronosControl\Libraries\BusinessLogic\obj\Debug\ResolveAssemblyReference.cache G:\Mario\developer-SVN\Cronos Control\source\trunk\CronosControl\Libraries\BusinessLogic\obj\Debug\CronosControl.BusinessLogic.dll G:\Mario\developer-SVN\Cronos Control\source\trunk\CronosControl\Libraries\BusinessLogic\obj\Debug\CronosControl.BusinessLogic.pdb Modified: source/trunk/CronosControl/Libraries/BusinessLogic/obj/Debug/CronosControl.BusinessLogic.dll =================================================================== (Binary files differ) Modified: source/trunk/CronosControl/Libraries/BusinessLogic/obj/Debug/CronosControl.BusinessLogic.pdb =================================================================== (Binary files differ) Modified: source/trunk/CronosControl/Libraries/Common/bin/Debug/CronosControl.Common.dll =================================================================== (Binary files differ) Modified: source/trunk/CronosControl/Libraries/Common/bin/Debug/CronosControl.Common.pdb =================================================================== (Binary files differ) Modified: source/trunk/CronosControl/Libraries/Common/obj/Debug/CronosControl.Common.dll =================================================================== (Binary files differ) Modified: source/trunk/CronosControl/Libraries/Common/obj/Debug/CronosControl.Common.pdb =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2010-02-19 14:57:45
|
Revision: 34 http://cronoscontrol.svn.sourceforge.net/cronoscontrol/?rev=34&view=rev Author: marioarce Date: 2010-02-19 14:57:16 +0000 (Fri, 19 Feb 2010) Log Message: ----------- * modified to use CronosControlContext.Current.ObjectContext in order to get the shared CronosControlEntities instance ( r33 ) * modified according with the recreated the ADO.NET Entity Data Model changes ( r32 ) Modified Paths: -------------- source/trunk/CronosControl/Libraries/BusinessLogic/ProjectUser/ProjectUserManager.cs Modified: source/trunk/CronosControl/Libraries/BusinessLogic/ProjectUser/ProjectUserManager.cs =================================================================== --- source/trunk/CronosControl/Libraries/BusinessLogic/ProjectUser/ProjectUserManager.cs 2010-02-19 14:50:23 UTC (rev 33) +++ source/trunk/CronosControl/Libraries/BusinessLogic/ProjectUser/ProjectUserManager.cs 2010-02-19 14:57:16 UTC (rev 34) @@ -111,7 +111,8 @@ foreach (var roleName in roleNames) { - CronosControlEntities cronosControlEntities = new CronosControlEntities(); + CronosControlEntities cronosControlEntities = CronosControlContext.Current.ObjectContext; + // get Role Role role = (from r in cronosControlEntities.Role where r.Name.Equals(roleName) @@ -123,7 +124,7 @@ UserProjectRole userProjectRole = new UserProjectRole(); userProjectRole.Role = role; userProjectRole.Project = project; - userProjectRole.IdUser = user.IdUser; + userProjectRole.User = user; cronosControlEntities.AddToUserProjectRole(userProjectRole); cronosControlEntities.SaveChanges(); @@ -206,7 +207,7 @@ return new string[] { }; } - CronosControlEntities cronosControlEntities = new CronosControlEntities(); + CronosControlEntities cronosControlEntities = CronosControlContext.Current.ObjectContext; Project project = CronosControlContext.Current.CurrentProject; @@ -214,7 +215,7 @@ List<string> userProjectRoles = (from upr in cronosControlEntities.UserProjectRole join ro in cronosControlEntities.Role on new { upr.Role.IdRole } equals new { ro.IdRole } - where (upr.IdUser == user.IdUser && upr.Project.IdProject == project.IdProject) + where (upr.User.IdUser == user.IdUser && upr.Project.IdProject == 2/*project.IdProject*/) select ro.Name).ToList<string>(); string[] result = new string[userProjectRoles.Count]; @@ -237,7 +238,7 @@ if (!CommonHelper.IsValidEmail(email)) return null; - CronosControlEntities cronosControlEntities = new CronosControlEntities(); + CronosControlEntities cronosControlEntities = CronosControlContext.Current.ObjectContext; User user = (from u in cronosControlEntities.User where u.Email.Equals(email) select u).First<User>(); @@ -255,7 +256,7 @@ if (projectUserID == 0) return null; - CronosControlEntities cronosControlEntities = new CronosControlEntities(); + CronosControlEntities cronosControlEntities = CronosControlContext.Current.ObjectContext; User user = (from u in cronosControlEntities.User where u.IdUser.Equals(projectUserID) select u).First<User>(); @@ -274,7 +275,7 @@ return null; User user; - CronosControlEntities cronosControlEntities = new CronosControlEntities(); + CronosControlEntities cronosControlEntities = CronosControlContext.Current.ObjectContext; try { user = (from u in cronosControlEntities.User @@ -304,9 +305,9 @@ User user = GetProjectUserByUsername(username); - CronosControlEntities cronosControlEntities = new CronosControlEntities(); + CronosControlEntities cronosControlEntities = CronosControlContext.Current.ObjectContext; int result = (from upr in cronosControlEntities.UserProjectRole - where (upr.IdUser == 1 && upr.Role.Name.Equals(roleName)) + where (upr.User.IdUser == user.IdUser && upr.Role.Name.Equals(roleName)) select upr).Count<UserProjectRole>(); return (result == 1); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2010-02-19 14:51:02
|
Revision: 33 http://cronoscontrol.svn.sourceforge.net/cronoscontrol/?rev=33&view=rev Author: marioarce Date: 2010-02-19 14:50:23 +0000 (Fri, 19 Feb 2010) Log Message: ----------- Ticket #5 added the property CronosControlEntities ObjectContext that gets a shared CronosControlEntities instance, created in order to have one shared CronosControlEntities instance per HTTP request see http://dotnetslackers.com/articles/ado_net/Managing-Entity-Framework-ObjectContext-lifespan-and-scope-in-n-layered-ASP-NET-applications.aspx Modified Paths: -------------- source/trunk/CronosControl/Libraries/BusinessLogic/CronosControlContext.cs Modified: source/trunk/CronosControl/Libraries/BusinessLogic/CronosControlContext.cs =================================================================== --- source/trunk/CronosControl/Libraries/BusinessLogic/CronosControlContext.cs 2010-02-19 14:45:32 UTC (rev 32) +++ source/trunk/CronosControl/Libraries/BusinessLogic/CronosControlContext.cs 2010-02-19 14:50:23 UTC (rev 33) @@ -123,6 +123,16 @@ application.Response.Cookies.Remove(key); application.Response.Cookies.Add(cookie); } + + /// <summary> + /// Sets the CultureInfo + /// </summary> + /// <param name="culture">Culture</param> + public void SetCulture(CultureInfo culture) + { + Thread.CurrentThread.CurrentCulture = culture; + Thread.CurrentThread.CurrentUICulture = Thread.CurrentThread.CurrentCulture; + } #endregion #region Properties @@ -147,21 +157,6 @@ } /// <summary> - /// Gets or sets a value indicating whether the context is running in admin-mode - /// </summary> - public bool IsAdmin - { - get - { - return isAdmin; - } - set - { - isAdmin = value; - } - } - - /// <summary> /// Gets or sets an object item in the context by the specified key. /// </summary> /// <param name="key">The key of the value to get.</param> @@ -193,73 +188,96 @@ } /// <summary> - /// Gets or sets the current session + /// Gets or sets the current project /// </summary> - public ProjectUserSession Session + public Project CurrentProject { get { - return this.GetSession(false); + return this.currentProject; } set { - Current[CONST_PROJECTUSERSESSION] = value; + this.currentProject = value; } } /// <summary> - /// Gets or sets the current user + /// Gets or sets the current company /// </summary> - public User User + public Company CurrentCompany { get { - return this.currentProjectUser; + return this.currentCompany; } set { - this.currentProjectUser = value; + this.currentCompany = value; } } /// <summary> - /// Gets or sets the current project + /// Gets or sets a value indicating whether the context is running in admin-mode /// </summary> - public Project CurrentProject + public bool IsAdmin { get { - return this.currentProject; + return isAdmin; } set { - this.currentProject = value; + isAdmin = value; } } /// <summary> - /// Gets or sets the current company + /// Gets a shared CronosControlEntities instance /// </summary> - public Company CurrentCompany + public CronosControlEntities ObjectContext { get { - return this.currentCompany; + string objectContextKey = "cronosControlObjectContext_" + HttpContext.Current.GetHashCode().ToString("x"); + if (!HttpContext.Current.Items.Contains(objectContextKey)) + { + HttpContext.Current.Items.Add(objectContextKey, new CronosControlEntities()); + } + // one shared CronosControlEntities instance per HTTP request + // see http://dotnetslackers.com/articles/ado_net/Managing-Entity-Framework-ObjectContext-lifespan-and-scope-in-n-layered-ASP-NET-applications.aspx + return HttpContext.Current.Items[objectContextKey] as CronosControlEntities; } + } + + /// <summary> + /// Gets or sets the current session + /// </summary> + public ProjectUserSession Session + { + get + { + return this.GetSession(false); + } set { - this.currentCompany = value; + Current[CONST_PROJECTUSERSESSION] = value; } } /// <summary> - /// Sets the CultureInfo + /// Gets or sets the current user /// </summary> - /// <param name="culture">Culture</param> - public void SetCulture(CultureInfo culture) + public User User { - Thread.CurrentThread.CurrentCulture = culture; - Thread.CurrentThread.CurrentUICulture = Thread.CurrentThread.CurrentCulture; + get + { + return this.currentProjectUser; + } + set + { + this.currentProjectUser = value; + } } #endregion } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2010-02-19 14:45:57
|
Revision: 32 http://cronoscontrol.svn.sourceforge.net/cronoscontrol/?rev=32&view=rev Author: marioarce Date: 2010-02-19 14:45:32 +0000 (Fri, 19 Feb 2010) Log Message: ----------- Ticket #1 recreated the ADO.NET Entity Data Model due to inconsistencies between the model and the database Modified Paths: -------------- source/trunk/CronosControl/CronosControlBusinessClassLibrary/CronosControlBusinessClassLibrary.csproj source/trunk/CronosControl/CronosControlClassLibrary/CronosControlModel.Designer.cs source/trunk/CronosControl/CronosControlClassLibrary/CronosControlModel.edmx source/trunk/CronosControl/CronosControlClassLibrary/app.config Modified: source/trunk/CronosControl/CronosControlBusinessClassLibrary/CronosControlBusinessClassLibrary.csproj =================================================================== --- source/trunk/CronosControl/CronosControlBusinessClassLibrary/CronosControlBusinessClassLibrary.csproj 2010-02-13 21:26:47 UTC (rev 31) +++ source/trunk/CronosControl/CronosControlBusinessClassLibrary/CronosControlBusinessClassLibrary.csproj 2010-02-19 14:45:32 UTC (rev 32) @@ -79,14 +79,14 @@ <Compile Include="Properties\AssemblyInfo.cs" /> </ItemGroup> <ItemGroup> + <None Include="App.config" /> + </ItemGroup> + <ItemGroup> <ProjectReference Include="..\CronosControlClassLibrary\CronosControlDataAccessClassLibrary.csproj"> <Project>{7191E8B4-4497-40E8-BD9A-04CD4EF802FC}</Project> <Name>CronosControlDataAccessClassLibrary</Name> </ProjectReference> </ItemGroup> - <ItemGroup> - <None Include="App.config" /> - </ItemGroup> <Import Project="$(MSBuildToolsPath)\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. Modified: source/trunk/CronosControl/CronosControlClassLibrary/CronosControlModel.Designer.cs =================================================================== --- source/trunk/CronosControl/CronosControlClassLibrary/CronosControlModel.Designer.cs 2010-02-13 21:26:47 UTC (rev 31) +++ source/trunk/CronosControl/CronosControlClassLibrary/CronosControlModel.Designer.cs 2010-02-19 14:45:32 UTC (rev 32) @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. -// Runtime Version:2.0.50727.3603 +// Runtime Version:2.0.50727.3053 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -9,34 +9,37 @@ //------------------------------------------------------------------------------ [assembly: global::System.Data.Objects.DataClasses.EdmSchemaAttribute()] -[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("CronosControlModel", "FK_Calendar_Company", "Company", global::System.Data.Metadata.Edm.RelationshipMultiplicity.One, typeof(CronosControl.Model.Company), "Calendar", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(CronosControl.Model.Calendar))] -[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("CronosControlModel", "FK_Holiday_Calendar", "Calendar", global::System.Data.Metadata.Edm.RelationshipMultiplicity.One, typeof(CronosControl.Model.Calendar), "Holiday", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(CronosControl.Model.Holiday))] -[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("CronosControlModel", "FK_Client_Company", "Company", global::System.Data.Metadata.Edm.RelationshipMultiplicity.One, typeof(CronosControl.Model.Company), "Client", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(CronosControl.Model.Client))] -[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("CronosControlModel", "FK_Project_Client", "Client", global::System.Data.Metadata.Edm.RelationshipMultiplicity.One, typeof(CronosControl.Model.Client), "Project", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(CronosControl.Model.Project))] -[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("CronosControlModel", "FK_Role_Company", "Company", global::System.Data.Metadata.Edm.RelationshipMultiplicity.One, typeof(CronosControl.Model.Company), "Role", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(CronosControl.Model.Role))] -[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("CronosControlModel", "FK_TimeCategory_Company", "Company", global::System.Data.Metadata.Edm.RelationshipMultiplicity.One, typeof(CronosControl.Model.Company), "TimeCategory", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(CronosControl.Model.TimeCategory))] -[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("CronosControlModel", "FK_ProjectCostCenter_CostCenter", "CostCenter", global::System.Data.Metadata.Edm.RelationshipMultiplicity.One, typeof(CronosControl.Model.CostCenter), "ProjectCostCenter", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(CronosControl.Model.ProjectCostCenter))] -[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("CronosControlModel", "FK_TimeSheetCostCenter_CostCenter", "CostCenter", global::System.Data.Metadata.Edm.RelationshipMultiplicity.One, typeof(CronosControl.Model.CostCenter), "TimeSheetCostCenter", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(CronosControl.Model.TimeSheetCostCenter))] -[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("CronosControlModel", "FK_IdUserProjectRoleDocument_Document", "Document", global::System.Data.Metadata.Edm.RelationshipMultiplicity.One, typeof(CronosControl.Model.Document), "UserProjectRoleDocument", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(CronosControl.Model.UserProjectRoleDocument))] -[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("CronosControlModel", "FK_ProjectDocument_Document", "Document", global::System.Data.Metadata.Edm.RelationshipMultiplicity.One, typeof(CronosControl.Model.Document), "ProjectDocument", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(CronosControl.Model.ProjectDocument))] -[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("CronosControlModel", "FK_Project_User", "User", global::System.Data.Metadata.Edm.RelationshipMultiplicity.ZeroOrOne, typeof(CronosControl.Model.User), "Project", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(CronosControl.Model.Project))] -[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("CronosControlModel", "FK_ProjectCostCenter_Project", "Project", global::System.Data.Metadata.Edm.RelationshipMultiplicity.One, typeof(CronosControl.Model.Project), "ProjectCostCenter", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(CronosControl.Model.ProjectCostCenter))] -[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("CronosControlModel", "FK_ProjectDocument_Project", "Project", global::System.Data.Metadata.Edm.RelationshipMultiplicity.One, typeof(CronosControl.Model.Project), "ProjectDocument", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(CronosControl.Model.ProjectDocument))] -[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("CronosControlModel", "FK_Tasks_Project", "Project", global::System.Data.Metadata.Edm.RelationshipMultiplicity.One, typeof(CronosControl.Model.Project), "Task", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(CronosControl.Model.Task))] -[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("CronosControlModel", "FK_TimeSheet_Project", "Project", global::System.Data.Metadata.Edm.RelationshipMultiplicity.ZeroOrOne, typeof(CronosControl.Model.Project), "TimeSheet", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(CronosControl.Model.TimeSheet))] -[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("CronosControlModel", "FK_UserProjectRole_Project", "Project", global::System.Data.Metadata.Edm.RelationshipMultiplicity.One, typeof(CronosControl.Model.Project), "UserProjectRole", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(CronosControl.Model.UserProjectRole))] -[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("CronosControlModel", "FK_UserProjectRole_Role", "Role", global::System.Data.Metadata.Edm.RelationshipMultiplicity.One, typeof(CronosControl.Model.Role), "UserProjectRole", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(CronosControl.Model.UserProjectRole))] -[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("CronosControlModel", "FK_TimeSheetHour_Tasks", "Task", global::System.Data.Metadata.Edm.RelationshipMultiplicity.ZeroOrOne, typeof(CronosControl.Model.Task), "TimeSheetHour", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(CronosControl.Model.TimeSheetHour))] -[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("CronosControlModel", "FK_TimeSheetHourTimeCategory_TimeCategory", "TimeCategory", global::System.Data.Metadata.Edm.RelationshipMultiplicity.One, typeof(CronosControl.Model.TimeCategory), "TimeSheetHourTimeCategory", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(CronosControl.Model.TimeSheetHourTimeCategory))] -[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("CronosControlModel", "FK_TimeSheet_User", "User", global::System.Data.Metadata.Edm.RelationshipMultiplicity.One, typeof(CronosControl.Model.User), "TimeSheet", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(CronosControl.Model.TimeSheet))] -[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("CronosControlModel", "FK_TimeSheetCostCenter_TimeSheet", "TimeSheet", global::System.Data.Metadata.Edm.RelationshipMultiplicity.One, typeof(CronosControl.Model.TimeSheet), "TimeSheetCostCenter", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(CronosControl.Model.TimeSheetCostCenter))] -[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("CronosControlModel", "FK_TimeSheetHour_TimeSheet", "TimeSheet", global::System.Data.Metadata.Edm.RelationshipMultiplicity.One, typeof(CronosControl.Model.TimeSheet), "TimeSheetHour", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(CronosControl.Model.TimeSheetHour))] -[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("CronosControlModel", "FK_TimeSheetHour_User", "User", global::System.Data.Metadata.Edm.RelationshipMultiplicity.One, typeof(CronosControl.Model.User), "TimeSheetHour", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(CronosControl.Model.TimeSheetHour))] -[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("CronosControlModel", "FK_TimeSheetHourTimeCategory_TimeSheetHour", "TimeSheetHour", global::System.Data.Metadata.Edm.RelationshipMultiplicity.One, typeof(CronosControl.Model.TimeSheetHour), "TimeSheetHourTimeCategory", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(CronosControl.Model.TimeSheetHourTimeCategory))] -[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("CronosControlModel", "FK_IdUserProjectRoleDocument_UserProjectRole", "UserProjectRole", global::System.Data.Metadata.Edm.RelationshipMultiplicity.One, typeof(CronosControl.Model.UserProjectRole), "UserProjectRoleDocument", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(CronosControl.Model.UserProjectRoleDocument))] +[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("CronosControl.Model", "FK_Calendar_Company", "Company", global::System.Data.Metadata.Edm.RelationshipMultiplicity.One, typeof(CronosControl.Model.Company), "Calendar", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(CronosControl.Model.Calendar))] +[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("CronosControl.Model", "FK_Holiday_Calendar", "Calendar", global::System.Data.Metadata.Edm.RelationshipMultiplicity.One, typeof(CronosControl.Model.Calendar), "Holiday", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(CronosControl.Model.Holiday))] +[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("CronosControl.Model", "FK_Client_Company", "Company", global::System.Data.Metadata.Edm.RelationshipMultiplicity.One, typeof(CronosControl.Model.Company), "Client", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(CronosControl.Model.Client))] +[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("CronosControl.Model", "FK_Project_Client", "Client", global::System.Data.Metadata.Edm.RelationshipMultiplicity.One, typeof(CronosControl.Model.Client), "Project", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(CronosControl.Model.Project))] +[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("CronosControl.Model", "FK_Role_Company", "Company", global::System.Data.Metadata.Edm.RelationshipMultiplicity.One, typeof(CronosControl.Model.Company), "Role", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(CronosControl.Model.Role))] +[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("CronosControl.Model", "FK_TimeCategory_Company", "Company", global::System.Data.Metadata.Edm.RelationshipMultiplicity.One, typeof(CronosControl.Model.Company), "TimeCategory", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(CronosControl.Model.TimeCategory))] +[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("CronosControl.Model", "FK_ProjectCostCenter_CostCenter", "CostCenter", global::System.Data.Metadata.Edm.RelationshipMultiplicity.One, typeof(CronosControl.Model.CostCenter), "ProjectCostCenter", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(CronosControl.Model.ProjectCostCenter))] +[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("CronosControl.Model", "FK_TimeSheetCostCenter_CostCenter", "CostCenter", global::System.Data.Metadata.Edm.RelationshipMultiplicity.One, typeof(CronosControl.Model.CostCenter), "TimeSheetCostCenter", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(CronosControl.Model.TimeSheetCostCenter))] +[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("CronosControl.Model", "FK_IdUserProjectRoleDocument_Document", "Document", global::System.Data.Metadata.Edm.RelationshipMultiplicity.One, typeof(CronosControl.Model.Document), "UserProjectRoleDocument", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(CronosControl.Model.UserProjectRoleDocument))] +[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("CronosControl.Model", "FK_ProjectDocument_Document", "Document", global::System.Data.Metadata.Edm.RelationshipMultiplicity.One, typeof(CronosControl.Model.Document), "ProjectDocument", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(CronosControl.Model.ProjectDocument))] +[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("CronosControl.Model", "FK_Project_User", "User", global::System.Data.Metadata.Edm.RelationshipMultiplicity.ZeroOrOne, typeof(CronosControl.Model.User), "Project", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(CronosControl.Model.Project))] +[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("CronosControl.Model", "FK_ProjectCostCenter_Project", "Project", global::System.Data.Metadata.Edm.RelationshipMultiplicity.One, typeof(CronosControl.Model.Project), "ProjectCostCenter", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(CronosControl.Model.ProjectCostCenter))] +[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("CronosControl.Model", "FK_ProjectDocument_Project", "Project", global::System.Data.Metadata.Edm.RelationshipMultiplicity.One, typeof(CronosControl.Model.Project), "ProjectDocument", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(CronosControl.Model.ProjectDocument))] +[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("CronosControl.Model", "FK_Tasks_Project", "Project", global::System.Data.Metadata.Edm.RelationshipMultiplicity.One, typeof(CronosControl.Model.Project), "Task", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(CronosControl.Model.Task))] +[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("CronosControl.Model", "FK_TimeSheet_Project", "Project", global::System.Data.Metadata.Edm.RelationshipMultiplicity.ZeroOrOne, typeof(CronosControl.Model.Project), "TimeSheet", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(CronosControl.Model.TimeSheet))] +[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("CronosControl.Model", "FK_UserProjectRole_Project", "Project", global::System.Data.Metadata.Edm.RelationshipMultiplicity.One, typeof(CronosControl.Model.Project), "UserProjectRole", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(CronosControl.Model.UserProjectRole))] +[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("CronosControl.Model", "FK_UserProjectRole_Role", "Role", global::System.Data.Metadata.Edm.RelationshipMultiplicity.One, typeof(CronosControl.Model.Role), "UserProjectRole", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(CronosControl.Model.UserProjectRole))] +[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("CronosControl.Model", "FK_TimeSheetHour_Tasks", "Task", global::System.Data.Metadata.Edm.RelationshipMultiplicity.ZeroOrOne, typeof(CronosControl.Model.Task), "TimeSheetHour", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(CronosControl.Model.TimeSheetHour))] +[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("CronosControl.Model", "FK_TimeSheetHour_TimeCategory", "TimeCategory", global::System.Data.Metadata.Edm.RelationshipMultiplicity.One, typeof(CronosControl.Model.TimeCategory), "TimeSheetHour", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(CronosControl.Model.TimeSheetHour))] +[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("CronosControl.Model", "FK_TimeSheetHourTimeCategory_TimeCategory", "TimeCategory", global::System.Data.Metadata.Edm.RelationshipMultiplicity.One, typeof(CronosControl.Model.TimeCategory), "TimeSheetHourTimeCategory", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(CronosControl.Model.TimeSheetHourTimeCategory))] +[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("CronosControl.Model", "FK_TimeSheet_User", "User", global::System.Data.Metadata.Edm.RelationshipMultiplicity.One, typeof(CronosControl.Model.User), "TimeSheet", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(CronosControl.Model.TimeSheet))] +[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("CronosControl.Model", "FK_TimeSheetCostCenter_TimeSheet", "TimeSheet", global::System.Data.Metadata.Edm.RelationshipMultiplicity.One, typeof(CronosControl.Model.TimeSheet), "TimeSheetCostCenter", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(CronosControl.Model.TimeSheetCostCenter))] +[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("CronosControl.Model", "FK_TimeSheetHour_TimeSheet", "TimeSheet", global::System.Data.Metadata.Edm.RelationshipMultiplicity.One, typeof(CronosControl.Model.TimeSheet), "TimeSheetHour", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(CronosControl.Model.TimeSheetHour))] +[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("CronosControl.Model", "FK_TimeSheetHour_User", "User", global::System.Data.Metadata.Edm.RelationshipMultiplicity.One, typeof(CronosControl.Model.User), "TimeSheetHour", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(CronosControl.Model.TimeSheetHour))] +[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("CronosControl.Model", "FK_TimeSheetHourTimeCategory_TimeSheetHour", "TimeSheetHour", global::System.Data.Metadata.Edm.RelationshipMultiplicity.One, typeof(CronosControl.Model.TimeSheetHour), "TimeSheetHourTimeCategory", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(CronosControl.Model.TimeSheetHourTimeCategory))] +[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("CronosControl.Model", "FK_UserProjectRole_User", "User", global::System.Data.Metadata.Edm.RelationshipMultiplicity.One, typeof(CronosControl.Model.User), "UserProjectRole", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(CronosControl.Model.UserProjectRole))] +[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("CronosControl.Model", "FK_UserSession_User", "User", global::System.Data.Metadata.Edm.RelationshipMultiplicity.One, typeof(CronosControl.Model.User), "UserSession", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(CronosControl.Model.UserSession))] +[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("CronosControl.Model", "FK_IdUserProjectRoleDocument_UserProjectRole", "UserProjectRole", global::System.Data.Metadata.Edm.RelationshipMultiplicity.One, typeof(CronosControl.Model.UserProjectRole), "UserProjectRoleDocument", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(CronosControl.Model.UserProjectRoleDocument))] // Original file name: -// Generation date: 11/20/2009 4:28:23 PM +// Generation date: 2/15/2010 5:38:48 PM namespace CronosControl.Model { @@ -356,6 +359,21 @@ } private global::System.Data.Objects.ObjectQuery<UserProjectRoleDocument> _UserProjectRoleDocument; /// <summary> + /// There are no comments for UserSession in the schema. + /// </summary> + public global::System.Data.Objects.ObjectQuery<UserSession> UserSession + { + get + { + if ((this._UserSession == null)) + { + this._UserSession = base.CreateQuery<UserSession>("[UserSession]"); + } + return this._UserSession; + } + } + private global::System.Data.Objects.ObjectQuery<UserSession> _UserSession; + /// <summary> /// There are no comments for Calendar in the schema. /// </summary> public void AddToCalendar(Calendar calendar) @@ -488,14 +506,21 @@ { base.AddObject("UserProjectRoleDocument", userProjectRoleDocument); } + /// <summary> + /// There are no comments for UserSession in the schema. + /// </summary> + public void AddToUserSession(UserSession userSession) + { + base.AddObject("UserSession", userSession); + } } /// <summary> - /// There are no comments for CronosControlModel.Calendar in the schema. + /// There are no comments for CronosControl.Model.Calendar in the schema. /// </summary> /// <KeyProperties> /// IdCalendar /// </KeyProperties> - [global::System.Data.Objects.DataClasses.EdmEntityTypeAttribute(NamespaceName="CronosControlModel", Name="Calendar")] + [global::System.Data.Objects.DataClasses.EdmEntityTypeAttribute(NamespaceName="CronosControl.Model", Name="Calendar")] [global::System.Runtime.Serialization.DataContractAttribute(IsReference=true)] [global::System.Serializable()] public partial class Calendar : global::System.Data.Objects.DataClasses.EntityObject @@ -619,7 +644,7 @@ { return this._CreatedAt; } - private set + set { this.OnCreatedAtChanging(value); this.ReportPropertyChanging("CreatedAt"); @@ -680,7 +705,7 @@ /// <summary> /// There are no comments for Company in the schema. /// </summary> - [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("CronosControlModel", "FK_Calendar_Company", "Company")] + [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("CronosControl.Model", "FK_Calendar_Company", "Company")] [global::System.Xml.Serialization.XmlIgnoreAttribute()] [global::System.Xml.Serialization.SoapIgnoreAttribute()] [global::System.Runtime.Serialization.DataMemberAttribute()] @@ -688,11 +713,11 @@ { get { - return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<Company>("CronosControlModel.FK_Calendar_Company", "Company").Value; + return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<Company>("CronosControl.Model.FK_Calendar_Company", "Company").Value; } set { - ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<Company>("CronosControlModel.FK_Calendar_Company", "Company").Value = value; + ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<Company>("CronosControl.Model.FK_Calendar_Company", "Company").Value = value; } } /// <summary> @@ -704,20 +729,20 @@ { get { - return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<Company>("CronosControlModel.FK_Calendar_Company", "Company"); + return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<Company>("CronosControl.Model.FK_Calendar_Company", "Company"); } set { if ((value != null)) { - ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedReference<Company>("CronosControlModel.FK_Calendar_Company", "Company", value); + ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedReference<Company>("CronosControl.Model.FK_Calendar_Company", "Company", value); } } } /// <summary> /// There are no comments for Holiday in the schema. /// </summary> - [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("CronosControlModel", "FK_Holiday_Calendar", "Holiday")] + [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("CronosControl.Model", "FK_Holiday_Calendar", "Holiday")] [global::System.Xml.Serialization.XmlIgnoreAttribute()] [global::System.Xml.Serialization.SoapIgnoreAttribute()] [global::System.Runtime.Serialization.DataMemberAttribute()] @@ -725,24 +750,24 @@ { get { - return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedCollection<Holiday>("CronosControlModel.FK_Holiday_Calendar", "Holiday"); + return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedCollection<Holiday>("CronosControl.Model.FK_Holiday_Calendar", "Holiday"); } set { if ((value != null)) { - ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedCollection<Holiday>("CronosControlModel.FK_Holiday_Calendar", "Holiday", value); + ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedCollection<Holiday>("CronosControl.Model.FK_Holiday_Calendar", "Holiday", value); } } } } /// <summary> - /// There are no comments for CronosControlModel.Client in the schema. + /// There are no comments for CronosControl.Model.Client in the schema. /// </summary> /// <KeyProperties> /// IdClient /// </KeyProperties> - [global::System.Data.Objects.DataClasses.EdmEntityTypeAttribute(NamespaceName="CronosControlModel", Name="Client")] + [global::System.Data.Objects.DataClasses.EdmEntityTypeAttribute(NamespaceName="CronosControl.Model", Name="Client")] [global::System.Runtime.Serialization.DataContractAttribute(IsReference=true)] [global::System.Serializable()] public partial class Client : global::System.Data.Objects.DataClasses.EntityObject @@ -843,7 +868,7 @@ { return this._CreatedAt; } - private set + set { this.OnCreatedAtChanging(value); this.ReportPropertyChanging("CreatedAt"); @@ -904,7 +929,7 @@ /// <summary> /// There are no comments for Company in the schema. /// </summary> - [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("CronosControlModel", "FK_Client_Company", "Company")] + [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("CronosControl.Model", "FK_Client_Company", "Company")] [global::System.Xml.Serialization.XmlIgnoreAttribute()] [global::System.Xml.Serialization.SoapIgnoreAttribute()] [global::System.Runtime.Serialization.DataMemberAttribute()] @@ -912,11 +937,11 @@ { get { - return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<Company>("CronosControlModel.FK_Client_Company", "Company").Value; + return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<Company>("CronosControl.Model.FK_Client_Company", "Company").Value; } set { - ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<Company>("CronosControlModel.FK_Client_Company", "Company").Value = value; + ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<Company>("CronosControl.Model.FK_Client_Company", "Company").Value = value; } } /// <summary> @@ -928,20 +953,20 @@ { get { - return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<Company>("CronosControlModel.FK_Client_Company", "Company"); + return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<Company>("CronosControl.Model.FK_Client_Company", "Company"); } set { if ((value != null)) { - ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedReference<Company>("CronosControlModel.FK_Client_Company", "Company", value); + ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedReference<Company>("CronosControl.Model.FK_Client_Company", "Company", value); } } } /// <summary> /// There are no comments for Project in the schema. /// </summary> - [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("CronosControlModel", "FK_Project_Client", "Project")] + [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("CronosControl.Model", "FK_Project_Client", "Project")] [global::System.Xml.Serialization.XmlIgnoreAttribute()] [global::System.Xml.Serialization.SoapIgnoreAttribute()] [global::System.Runtime.Serialization.DataMemberAttribute()] @@ -949,24 +974,24 @@ { get { - return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedCollection<Project>("CronosControlModel.FK_Project_Client", "Project"); + return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedCollection<Project>("CronosControl.Model.FK_Project_Client", "Project"); } set { if ((value != null)) { - ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedCollection<Project>("CronosControlModel.FK_Project_Client", "Project", value); + ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedCollection<Project>("CronosControl.Model.FK_Project_Client", "Project", value); } } } } /// <summary> - /// There are no comments for CronosControlModel.Company in the schema. + /// There are no comments for CronosControl.Model.Company in the schema. /// </summary> /// <KeyProperties> /// IdCompany /// </KeyProperties> - [global::System.Data.Objects.DataClasses.EdmEntityTypeAttribute(NamespaceName="CronosControlModel", Name="Company")] + [global::System.Data.Objects.DataClasses.EdmEntityTypeAttribute(NamespaceName="CronosControl.Model", Name="Company")] [global::System.Runtime.Serialization.DataContractAttribute(IsReference=true)] [global::System.Serializable()] public partial class Company : global::System.Data.Objects.DataClasses.EntityObject @@ -1067,7 +1092,7 @@ { return this._CreatedAt; } - private set + set { this.OnCreatedAtChanging(value); this.ReportPropertyChanging("CreatedAt"); @@ -1128,7 +1153,7 @@ /// <summary> /// There are no comments for Calendar in the schema. /// </summary> - [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("CronosControlModel", "FK_Calendar_Company", "Calendar")] + [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("CronosControl.Model", "FK_Calendar_Company", "Calendar")] [global::System.Xml.Serialization.XmlIgnoreAttribute()] [global::System.Xml.Serialization.SoapIgnoreAttribute()] [global::System.Runtime.Serialization.DataMemberAttribute()] @@ -1136,20 +1161,20 @@ { get { - return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedCollection<Calendar>("CronosControlModel.FK_Calendar_Company", "Calendar"); + return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedCollection<Calendar>("CronosControl.Model.FK_Calendar_Company", "Calendar"); } set { if ((value != null)) { - ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedCollection<Calendar>("CronosControlModel.FK_Calendar_Company", "Calendar", value); + ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedCollection<Calendar>("CronosControl.Model.FK_Calendar_Company", "Calendar", value); } } } /// <summary> /// There are no comments for Client in the schema. /// </summary> - [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("CronosControlModel", "FK_Client_Company", "Client")] + [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("CronosControl.Model", "FK_Client_Company", "Client")] [global::System.Xml.Serialization.XmlIgnoreAttribute()] [global::System.Xml.Serialization.SoapIgnoreAttribute()] [global::System.Runtime.Serialization.DataMemberAttribute()] @@ -1157,20 +1182,20 @@ { get { - return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedCollection<Client>("CronosControlModel.FK_Client_Company", "Client"); + return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedCollection<Client>("CronosControl.Model.FK_Client_Company", "Client"); } set { if ((value != null)) { - ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedCollection<Client>("CronosControlModel.FK_Client_Company", "Client", value); + ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedCollection<Client>("CronosControl.Model.FK_Client_Company", "Client", value); } } } /// <summary> /// There are no comments for Role in the schema. /// </summary> - [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("CronosControlModel", "FK_Role_Company", "Role")] + [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("CronosControl.Model", "FK_Role_Company", "Role")] [global::System.Xml.Serialization.XmlIgnoreAttribute()] [global::System.Xml.Serialization.SoapIgnoreAttribute()] [global::System.Runtime.Serialization.DataMemberAttribute()] @@ -1178,20 +1203,20 @@ { get { - return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedCollection<Role>("CronosControlModel.FK_Role_Company", "Role"); + return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedCollection<Role>("CronosControl.Model.FK_Role_Company", "Role"); } set { if ((value != null)) { - ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedCollection<Role>("CronosControlModel.FK_Role_Company", "Role", value); + ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedCollection<Role>("CronosControl.Model.FK_Role_Company", "Role", value); } } } /// <summary> /// There are no comments for TimeCategory in the schema. /// </summary> - [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("CronosControlModel", "FK_TimeCategory_Company", "TimeCategory")] + [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("CronosControl.Model", "FK_TimeCategory_Company", "TimeCategory")] [global::System.Xml.Serialization.XmlIgnoreAttribute()] [global::System.Xml.Serialization.SoapIgnoreAttribute()] [global::System.Runtime.Serialization.DataMemberAttribute()] @@ -1199,24 +1224,24 @@ { get { - return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedCollection<TimeCategory>("CronosControlModel.FK_TimeCategory_Company", "TimeCategory"); + return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedCollection<TimeCategory>("CronosControl.Model.FK_TimeCategory_Company", "TimeCategory"); } set { if ((value != null)) { - ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedCollection<TimeCategory>("CronosControlModel.FK_TimeCategory_Company", "TimeCategory", value); + ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedCollection<TimeCategory>("CronosControl.Model.FK_TimeCategory_Company", "TimeCategory", value); } } } } /// <summary> - /// There are no comments for CronosControlModel.CostCenter in the schema. + /// There are no comments for CronosControl.Model.CostCenter in the schema. /// </summary> /// <KeyProperties> /// IdCostCenter /// </KeyProperties> - [global::System.Data.Objects.DataClasses.EdmEntityTypeAttribute(NamespaceName="CronosControlModel", Name="CostCenter")] + [global::System.Data.Objects.DataClasses.EdmEntityTypeAttribute(NamespaceName="CronosControl.Model", Name="CostCenter")] [global::System.Runtime.Serialization.DataContractAttribute(IsReference=true)] [global::System.Serializable()] public partial class CostCenter : global::System.Data.Objects.DataClasses.EntityObject @@ -1317,7 +1342,7 @@ { return this._CreatedAt; } - private set + set { this.OnCreatedAtChanging(value); this.ReportPropertyChanging("CreatedAt"); @@ -1378,7 +1403,7 @@ /// <summary> /// There are no comments for ProjectCostCenter in the schema. /// </summary> - [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("CronosControlModel", "FK_ProjectCostCenter_CostCenter", "ProjectCostCenter")] + [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("CronosControl.Model", "FK_ProjectCostCenter_CostCenter", "ProjectCostCenter")] [global::System.Xml.Serialization.XmlIgnoreAttribute()] [global::System.Xml.Serialization.SoapIgnoreAttribute()] [global::System.Runtime.Serialization.DataMemberAttribute()] @@ -1386,20 +1411,20 @@ { get { - return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedCollection<ProjectCostCenter>("CronosControlModel.FK_ProjectCostCenter_CostCenter", "ProjectCostCenter"); + return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedCollection<ProjectCostCenter>("CronosControl.Model.FK_ProjectCostCenter_CostCenter", "ProjectCostCenter"); } set { if ((value != null)) { - ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedCollection<ProjectCostCenter>("CronosControlModel.FK_ProjectCostCenter_CostCenter", "ProjectCostCenter", value); + ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedCollection<ProjectCostCenter>("CronosControl.Model.FK_ProjectCostCenter_CostCenter", "ProjectCostCenter", value); } } } /// <summary> /// There are no comments for TimeSheetCostCenter in the schema. /// </summary> - [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("CronosControlModel", "FK_TimeSheetCostCenter_CostCenter", "TimeSheetCostCenter")] + [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("CronosControl.Model", "FK_TimeSheetCostCenter_CostCenter", "TimeSheetCostCenter")] [global::System.Xml.Serialization.XmlIgnoreAttribute()] [global::System.Xml.Serialization.SoapIgnoreAttribute()] [global::System.Runtime.Serialization.DataMemberAttribute()] @@ -1407,24 +1432,24 @@ { get { - return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedCollection<TimeSheetCostCenter>("CronosControlModel.FK_TimeSheetCostCenter_CostCenter", "TimeSheetCostCenter"); + return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedCollection<TimeSheetCostCenter>("CronosControl.Model.FK_TimeSheetCostCenter_CostCenter", "TimeSheetCostCenter"); } set { if ((value != null)) { - ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedCollection<TimeSheetCostCenter>("CronosControlModel.FK_TimeSheetCostCenter_CostCenter", "TimeSheetCostCenter", value); + ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedCollection<TimeSheetCostCenter>("CronosControl.Model.FK_TimeSheetCostCenter_CostCenter", "TimeSheetCostCenter", value); } } } } /// <summary> - /// There are no comments for CronosControlModel.Document in the schema. + /// There are no comments for CronosControl.Model.Document in the schema. /// </summary> /// <KeyProperties> /// IdDocument /// </KeyProperties> - [global::System.Data.Objects.DataClasses.EdmEntityTypeAttribute(NamespaceName="CronosControlModel", Name="Document")] + [global::System.Data.Objects.DataClasses.EdmEntityTypeAttribute(NamespaceName="CronosControl.Model", Name="Document")] [global::System.Runtime.Serialization.DataContractAttribute(IsReference=true)] [global::System.Serializable()] public partial class Document : global::System.Data.Objects.DataClasses.EntityObject @@ -1594,7 +1619,7 @@ { return this._CreatedAt; } - private set + set { this.OnCreatedAtChanging(value); this.ReportPropertyChanging("CreatedAt"); @@ -1655,7 +1680,7 @@ /// <summary> /// There are no comments for UserProjectRoleDocument in the schema. /// </summary> - [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("CronosControlModel", "FK_IdUserProjectRoleDocument_Document", "UserProjectRoleDocument")] + [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("CronosControl.Model", "FK_IdUserProjectRoleDocument_Document", "UserProjectRoleDocument")] [global::System.Xml.Serialization.XmlIgnoreAttribute()] [global::System.Xml.Serialization.SoapIgnoreAttribute()] [global::System.Runtime.Serialization.DataMemberAttribute()] @@ -1663,20 +1688,20 @@ { get { - return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedCollection<UserProjectRoleDocument>("CronosControlModel.FK_IdUserProjectRoleDocument_Document", "UserProjectRoleDocument"); + return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedCollection<UserProjectRoleDocument>("CronosControl.Model.FK_IdUserProjectRoleDocument_Document", "UserProjectRoleDocument"); } set { if ((value != null)) { - ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedCollection<UserProjectRoleDocument>("CronosControlModel.FK_IdUserProjectRoleDocument_Document", "UserProjectRoleDocument", value); + ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedCollection<UserProjectRoleDocument>("CronosControl.Model.FK_IdUserProjectRoleDocument_Document", "UserProjectRoleDocument", value); } } } /// <summary> /// There are no comments for ProjectDocument in the schema. /// </summary> - [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("CronosControlModel", "FK_ProjectDocument_Document", "ProjectDocument")] + [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("CronosControl.Model", "FK_ProjectDocument_Document", "ProjectDocument")] [global::System.Xml.Serialization.XmlIgnoreAttribute()] [global::System.Xml.Serialization.SoapIgnoreAttribute()] [global::System.Runtime.Serialization.DataMemberAttribute()] @@ -1684,24 +1709,24 @@ { get { - return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedCollection<ProjectDocument>("CronosControlModel.FK_ProjectDocument_Document", "ProjectDocument"); + return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedCollection<ProjectDocument>("CronosControl.Model.FK_ProjectDocument_Document", "ProjectDocument"); } set { if ((value != null)) { - ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedCollection<ProjectDocument>("CronosControlModel.FK_ProjectDocument_Document", "ProjectDocument", value); + ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedCollection<ProjectDocument>("CronosControl.Model.FK_ProjectDocument_Document", "ProjectDocument", value); } } } } /// <summary> - /// There are no comments for CronosControlModel.Holiday in the schema. + /// There are no comments for CronosControl.Model.Holiday in the schema. /// </summary> /// <KeyProperties> /// IdHoliday /// </KeyProperties> - [global::System.Data.Objects.DataClasses.EdmEntityTypeAttribute(NamespaceName="CronosControlModel", Name="Holiday")] + [global::System.Data.Objects.DataClasses.EdmEntityTypeAttribute(NamespaceName="CronosControl.Model", Name="Holiday")] [global::System.Runtime.Serialization.DataContractAttribute(IsReference=true)] [global::System.Serializable()] public partial class Holiday : global::System.Data.Objects.DataClasses.EntityObject @@ -1829,7 +1854,7 @@ { return this._CreatedAt; } - private set + set { this.OnCreatedAtChanging(value); this.ReportPropertyChanging("CreatedAt"); @@ -1890,7 +1915,7 @@ /// <summary> /// There are no comments for Calendar in the schema. /// </summary> - [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("CronosControlModel", "FK_Holiday_Calendar", "Calendar")] + [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("CronosControl.Model", "FK_Holiday_Calendar", "Calendar")] [global::System.Xml.Serialization.XmlIgnoreAttribute()] [global::System.Xml.Serialization.SoapIgnoreAttribute()] [global::System.Runtime.Serialization.DataMemberAttribute()] @@ -1898,11 +1923,11 @@ { get { - return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<Calendar>("CronosControlModel.FK_Holiday_Calendar", "Calendar").Value; + return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<Calendar>("CronosControl.Model.FK_Holiday_Calendar", "Calendar").Value; } set { - ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<Calendar>("CronosControlModel.FK_Holiday_Calendar", "Calendar").Value = value; + ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<Calendar>("CronosControl.Model.FK_Holiday_Calendar", "Calendar").Value = value; } } /// <summary> @@ -1914,24 +1939,24 @@ { get { - return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<Calendar>("CronosControlModel.FK_Holiday_Calendar", "Calendar"); + return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<Calendar>("CronosControl.Model.FK_Holiday_Calendar", "Calendar"); } set { if ((value != null)) { - ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedReference<Calendar>("CronosControlModel.FK_Holiday_Calendar", "Calendar", value); + ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedReference<Calendar>("CronosControl.Model.FK_Holiday_Calendar", "Calendar", value); } } } } /// <summary> - /// There are no comments for CronosControlModel.Project in the schema. + /// There are no comments for CronosControl.Model.Project in the schema. /// </summary> /// <KeyProperties> /// IdProject /// </KeyProperties> - [global::System.Data.Objects.DataClasses.EdmEntityTypeAttribute(NamespaceName="CronosControlModel", Name="Project")] + [global::System.Data.Objects.DataClasses.EdmEntityTypeAttribute(NamespaceName="CronosControl.Model", Name="Project")] [global::System.Runtime.Serialization.DataContractAttribute(IsReference=true)] [global::System.Serializable()] public partial class Project : global::System.Data.Objects.DataClasses.EntityObject @@ -2078,7 +2103,7 @@ { return this._CreatedAt; } - private set + set { this.OnCreatedAtChanging(value); this.ReportPropertyChanging("CreatedAt"); @@ -2139,7 +2164,7 @@ /// <summary> /// There are no comments for Client in the schema. /// </summary> - [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("CronosControlModel", "FK_Project_Client", "Client")] + [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("CronosControl.Model", "FK_Project_Client", "Client")] [global::System.Xml.Serialization.XmlIgnoreAttribute()] [global::System.Xml.Serialization.SoapIgnoreAttribute()] [global::System.Runtime.Serialization.DataMemberAttribute()] @@ -2147,11 +2172,11 @@ { get { - return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<Client>("CronosControlModel.FK_Project_Client", "Client").Value; + return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<Client>("CronosControl.Model.FK_Project_Client", "Client").Value; } set { - ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<Client>("CronosControlModel.FK_Project_Client", "Client").Value = value; + ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<Client>("CronosControl.Model.FK_Project_Client", "Client").Value = value; } } /// <summary> @@ -2163,20 +2188,20 @@ { get { - return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<Client>("CronosControlModel.FK_Project_Client", "Client"); + return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<Client>("CronosControl.Model.FK_Project_Client", "Client"); } set { if ((value != null)) { - ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedReference<Client>("CronosControlModel.FK_Project_Client", "Client", value); + ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedReference<Client>("CronosControl.Model.FK_Project_Client", "Client", value); } } } /// <summary> /// There are no comments for User in the schema. /// </summary> - [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("CronosControlModel", "FK_Project_User", "User")] + [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("CronosControl.Model", "FK_Project_User", "User")] [global::System.Xml.Serialization.XmlIgnoreAttribute()] [global::System.Xml.Serialization.SoapIgnoreAttribute()] [global::System.Runtime.Serialization.DataMemberAttribute()] @@ -2184,11 +2209,11 @@ { get { - return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<User>("CronosControlModel.FK_Project_User", "User").Value; + return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<User>("CronosControl.Model.FK_Project_User", "User").Value; } set { - ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<User>("CronosControlModel.FK_Project_User", "User").Value = value; + ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<User>("CronosControl.Model.FK_Project_User", "User").Value = value; } } /// <summary> @@ -2200,20 +2225,20 @@ { get { - return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<User>("CronosControlModel.FK_Project_User", "User"); + return ((global::System.Data.Objects.DataClasses.IEntityWithRelationship... [truncated message content] |
From: <mar...@us...> - 2010-02-13 21:26:55
|
Revision: 31 http://cronoscontrol.svn.sourceforge.net/cronoscontrol/?rev=31&view=rev Author: marioarce Date: 2010-02-13 21:26:47 +0000 (Sat, 13 Feb 2010) Log Message: ----------- Ticket #5 compiled classes with the modification: renamed concept from 'Tracker' to 'Project User'. Project User includes a 'project manager', a 'project team members', and any other project stakeholder Modified Paths: -------------- source/trunk/CronosControl/Libraries/BusinessLogic/bin/Debug/CronosControl.BusinessLogic.dll source/trunk/CronosControl/Libraries/BusinessLogic/bin/Debug/CronosControl.BusinessLogic.pdb source/trunk/CronosControl/Libraries/BusinessLogic/bin/Debug/CronosControl.Common.dll source/trunk/CronosControl/Libraries/BusinessLogic/bin/Debug/CronosControl.Common.pdb source/trunk/CronosControl/Libraries/BusinessLogic/bin/Debug/CronosControlBusinessClassLibrary.dll source/trunk/CronosControl/Libraries/BusinessLogic/bin/Debug/CronosControlBusinessClassLibrary.pdb source/trunk/CronosControl/Libraries/BusinessLogic/bin/Debug/CronosControlClassLibrary.dll source/trunk/CronosControl/Libraries/BusinessLogic/bin/Debug/CronosControlClassLibrary.pdb source/trunk/CronosControl/Libraries/BusinessLogic/obj/Debug/CronosControl.BusinessLogic.dll source/trunk/CronosControl/Libraries/BusinessLogic/obj/Debug/CronosControl.BusinessLogic.pdb source/trunk/CronosControl/Libraries/Common/bin/Debug/CronosControl.Common.dll source/trunk/CronosControl/Libraries/Common/bin/Debug/CronosControl.Common.pdb source/trunk/CronosControl/Libraries/Common/obj/Debug/CronosControl.Common.dll source/trunk/CronosControl/Libraries/Common/obj/Debug/CronosControl.Common.pdb Modified: source/trunk/CronosControl/Libraries/BusinessLogic/bin/Debug/CronosControl.BusinessLogic.dll =================================================================== (Binary files differ) Modified: source/trunk/CronosControl/Libraries/BusinessLogic/bin/Debug/CronosControl.BusinessLogic.pdb =================================================================== (Binary files differ) Modified: source/trunk/CronosControl/Libraries/BusinessLogic/bin/Debug/CronosControl.Common.dll =================================================================== (Binary files differ) Modified: source/trunk/CronosControl/Libraries/BusinessLogic/bin/Debug/CronosControl.Common.pdb =================================================================== (Binary files differ) Modified: source/trunk/CronosControl/Libraries/BusinessLogic/bin/Debug/CronosControlBusinessClassLibrary.dll =================================================================== (Binary files differ) Modified: source/trunk/CronosControl/Libraries/BusinessLogic/bin/Debug/CronosControlBusinessClassLibrary.pdb =================================================================== (Binary files differ) Modified: source/trunk/CronosControl/Libraries/BusinessLogic/bin/Debug/CronosControlClassLibrary.dll =================================================================== (Binary files differ) Modified: source/trunk/CronosControl/Libraries/BusinessLogic/bin/Debug/CronosControlClassLibrary.pdb =================================================================== (Binary files differ) Modified: source/trunk/CronosControl/Libraries/BusinessLogic/obj/Debug/CronosControl.BusinessLogic.dll =================================================================== (Binary files differ) Modified: source/trunk/CronosControl/Libraries/BusinessLogic/obj/Debug/CronosControl.BusinessLogic.pdb =================================================================== (Binary files differ) Modified: source/trunk/CronosControl/Libraries/Common/bin/Debug/CronosControl.Common.dll =================================================================== (Binary files differ) Modified: source/trunk/CronosControl/Libraries/Common/bin/Debug/CronosControl.Common.pdb =================================================================== (Binary files differ) Modified: source/trunk/CronosControl/Libraries/Common/obj/Debug/CronosControl.Common.dll =================================================================== (Binary files differ) Modified: source/trunk/CronosControl/Libraries/Common/obj/Debug/CronosControl.Common.pdb =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2010-02-13 21:24:59
|
Revision: 30 http://cronoscontrol.svn.sourceforge.net/cronoscontrol/?rev=30&view=rev Author: marioarce Date: 2010-02-13 21:24:52 +0000 (Sat, 13 Feb 2010) Log Message: ----------- Ticket #5 renamed concept from 'Tracker' to 'Project User'. Project User includes a 'project manager', a 'project team members', and any other project stakeholder The following are examples of project stakeholders: * Project manager * Project team members * Upper management * Project customer * Resource Managers * Product user group * Project testers * Sponsor Added Paths: ----------- source/trunk/CronosControl/Libraries/BusinessLogic/ProjectUser/ source/trunk/CronosControl/Libraries/BusinessLogic/ProjectUser/ProjectUserManager.cs source/trunk/CronosControl/Libraries/BusinessLogic/ProjectUser/ProjectUserSession.cs Added: source/trunk/CronosControl/Libraries/BusinessLogic/ProjectUser/ProjectUserManager.cs =================================================================== --- source/trunk/CronosControl/Libraries/BusinessLogic/ProjectUser/ProjectUserManager.cs (rev 0) +++ source/trunk/CronosControl/Libraries/BusinessLogic/ProjectUser/ProjectUserManager.cs 2010-02-13 21:24:52 UTC (rev 30) @@ -0,0 +1,339 @@ +//------------------------------------------------------------------------------ +// The contents of this file are subject to the GNU General Public License Version 3.0 ("License"); you may not use this file except in compliance with the License. +// You may obtain a copy of the License at http://www.cronoscontrol.net/license.html. +// +// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. +// See the License for the specific language governing rights and limitations under the License. +// +// The Original Code is CronosControl. +// The Initial Developer of the Original Code is WebImageConsulting http://www.wicnow.com/. +// All Rights Reserved. +// +// Contributor(s): Mario Alberto Arce, _______. +//------------------------------------------------------------------------------ + +using System; +using System.Linq; +using System.Text; +using System.Web.Security; +using System.Collections.Generic; +using System.Configuration.Provider; +using System.Security.Cryptography; +using CronosControl.Model; +using CronosControl.Business; +using CronosControl.Common.Utils; +using CronosControl.BusinessLogic.Configuration.Settings; + +namespace CronosControl.BusinessLogic.ProjectUser +{ + /// <summary> + /// Project User manager + /// </summary> + public partial class ProjectUserManager + { + #region Methods + /// <summary> + /// Adds a project user + /// </summary> + /// <param name="Email">The email</param> + /// <param name="Username">The username</param> + /// <param name="Password">The password</param> + /// <param name="Name">A value indicating whether the name of the project user</param> + /// <param name="Lastname">A value indicating whether the lastname of the project user</param> + /// <param name="Enabled">A value indicating whether the project user is active</param> + /// <param name="status">Status</param> + /// <returns>A project user</returns> + public static User AddProjectUser(string email, string username, string password, + string name, string lastname, + bool enabled, out MembershipCreateStatus status) + { + string saltKey = string.Empty; + string passwordHash = string.Empty; + status = MembershipCreateStatus.UserRejected; + + // duplicated UserName ? + //status = MembershipCreateStatus.DuplicateUserName; + + // invalid UserName ? + //status = MembershipCreateStatus.InvalidUserName; + + // duplicated email ? + //status = MembershipCreateStatus.DuplicateEmail; + + // invalid email ? + if (!CommonHelper.IsValidEmail(email)) + status = MembershipCreateStatus.InvalidEmail; + + + int idCompany = CronosControlContext.Current.CurrentCompany.IdCompany; + passwordHash = CreatePasswordMd5Hash(password); + + User userEntity = new User(); + userEntity.Name = name; + userEntity.Lastname = lastname; + userEntity.Username = username; + userEntity.Password = passwordHash; + userEntity.Email = email; + userEntity.IdCompany = idCompany; + userEntity.CreatedAt = DateTimeHelper.ConvertToUtcTime(DateTime.Now); + userEntity.Enabled = enabled; + + try + { + Users users = new Users(); + users.Save(userEntity); + } + catch + { + status = MembershipCreateStatus.ProviderError; + } + + status = MembershipCreateStatus.Success; + return userEntity; + } + + /// <summary> + /// Adds the specified user names to the specified roles for the configured applicationName + /// </summary> + /// <param name="usernames">A string array of user names to be added to the specified roles.</param> + /// <param name="roleNames">A string array of the role names to add the specified user names to.</param> + public static void AddUsersToRoles(string[] usernames, string[] roleNames) + { + foreach (string username in usernames) + { + // get User + User user = GetProjectUserByUsername(username); + if (user == null) + { + // user not found!, continue... + continue; + } + + foreach (var roleName in roleNames) + { + CronosControlEntities cronosControlEntities = new CronosControlEntities(); + // get Role + Role role = (from r in cronosControlEntities.Role + where r.Name.Equals(roleName) + select r).First<Role>(); + + Project project = CronosControlContext.Current.CurrentProject; + + // assign role to the user + UserProjectRole userProjectRole = new UserProjectRole(); + userProjectRole.Role = role; + userProjectRole.Project = project; + userProjectRole.IdUser = user.IdUser; + + cronosControlEntities.AddToUserProjectRole(userProjectRole); + cronosControlEntities.SaveChanges(); + } + } + } + + /// <summary> + /// Creates a salt + /// </summary> + /// <param name="size">A salt size</param> + /// <returns>A salt</returns> + private static string CreateSalt(int size) + { + RNGCryptoServiceProvider provider = new RNGCryptoServiceProvider(); + byte[] data = new byte[size]; + provider.GetBytes(data); + return Convert.ToBase64String(data); + } + + /// <summary> + /// Creates a password hash + /// </summary> + /// <param name="Password">Password</param> + /// <param name="Salt">Salt</param> + /// <returns>Password hash</returns> + private static string CreatePasswordHash(string Password, string Salt) + { + //MD5, SHA1 + string passwordFormat = SettingManager.Current["Security", "PasswordFormat"]; + if (String.IsNullOrEmpty(passwordFormat)) + passwordFormat = "SHA1"; + + return FormsAuthentication.HashPasswordForStoringInConfigFile(Password + Salt, passwordFormat); + } + + /// <summary> + /// Creates a password Md5 hash + /// </summary> + /// <param name="Password">Password</param> + /// <returns>Password hash</returns> + private static string CreatePasswordMd5Hash(string password) + { + if (string.IsNullOrEmpty(password)) + return string.Empty; + + // Create a new instance of the MD5CryptoServiceProvider object. + MD5CryptoServiceProvider md5Hasher = new MD5CryptoServiceProvider(); + + // Convert the input string to a byte array and compute the hash. + byte[] data = md5Hasher.ComputeHash(Encoding.Default.GetBytes(password)); + + // Create a new Stringbuilder to collect the bytes + // and create a string. + StringBuilder sBuilder = new StringBuilder(); + + // Loop through each byte of the hashed data + // and format each one as a hexadecimal string. + for (int i = 0; i < data.Length; i++) + { + sBuilder.Append(data[i].ToString("x2")); + } + + // Return the hexadecimal string. + return sBuilder.ToString(); + } + + /// <summary> + /// Gets a list of the roles that a specified user is in for the configured applicationName. + /// </summary> + /// <param name="username">The user to return a list of roles for.</param> + /// <returns>A string array containing the names of all the roles that the specified user is in for the configured applicationName.</returns> + public static string[] GetRolesForUser(string username) + { + // get User + User user = GetProjectUserByUsername(username); + if (user == null) + { + // user not found! + return new string[] { }; + } + + CronosControlEntities cronosControlEntities = new CronosControlEntities(); + + Project project = CronosControlContext.Current.CurrentProject; + + // get UserProjectRole + List<string> userProjectRoles = (from upr in cronosControlEntities.UserProjectRole + join ro in cronosControlEntities.Role + on new { upr.Role.IdRole } equals new { ro.IdRole } + where (upr.IdUser == user.IdUser && upr.Project.IdProject == project.IdProject) + select ro.Name).ToList<string>(); + + string[] result = new string[userProjectRoles.Count]; + for (int i = 0; i < userProjectRoles.Count; i++) + { + result[i] = userProjectRoles[i]; + } + return result; + } + + /// <summary> + /// Gets a tracket by email + /// </summary> + /// <param name="Username">Project user email</param> + /// <returns>A project user</returns> + public static User GetProjectUserByEmail(string email) + { + if (string.IsNullOrEmpty(email)) + return null; + if (!CommonHelper.IsValidEmail(email)) + return null; + + CronosControlEntities cronosControlEntities = new CronosControlEntities(); + User user = (from u in cronosControlEntities.User + where u.Email.Equals(email) + select u).First<User>(); + + return user; + } + + /// <summary> + /// Gets a tracket + /// </summary> + /// <param name="Username">Project user identifier</param> + /// <returns>A project user</returns> + public static User GetProjectUserByID(int projectUserID) + { + if (projectUserID == 0) + return null; + + CronosControlEntities cronosControlEntities = new CronosControlEntities(); + User user = (from u in cronosControlEntities.User + where u.IdUser.Equals(projectUserID) + select u).First<User>(); + + return user; + } + + /// <summary> + /// Gets a tracket by username + /// </summary> + /// <param name="Username">Project user username</param> + /// <returns>A project user</returns> + public static User GetProjectUserByUsername(string username) + { + if (string.IsNullOrEmpty(username)) + return null; + + User user; + CronosControlEntities cronosControlEntities = new CronosControlEntities(); + try + { + user = (from u in cronosControlEntities.User + where u.Username.Equals(username) + select u).First<User>(); + } + catch + { + return null; + } + + return user; + } + + /// <summary> + /// Gets a value indicating whether the specified user is in the specified role for the configured applicationName. + /// </summary> + /// <param name="username">The user name to search for.</param> + /// <param name="roleName">The role to search in.</param> + /// <returns>true if the specified user is in the specified role for the configured applicationName; otherwise, false.</returns> + public static bool IsUserInRole(string username, string roleName) + { + if (string.IsNullOrEmpty(username)) + return false; + if (string.IsNullOrEmpty(roleName)) + return false; + + User user = GetProjectUserByUsername(username); + + CronosControlEntities cronosControlEntities = new CronosControlEntities(); + int result = (from upr in cronosControlEntities.UserProjectRole + where (upr.IdUser == 1 && upr.Role.Name.Equals(roleName)) + select upr).Count<UserProjectRole>(); + + return (result == 1); + } + + /// <summary> + /// Login a project user + /// </summary> + /// <param name="Email">A project user username</param> + /// <param name="Password">Password</param> + /// <returns>Result</returns> + public static bool Login(string username, string password) + { + User user = GetProjectUserByUsername(username); + + if (user == null) + return false; + if (!user.Enabled) + return false; + + string passwordHash = CreatePasswordMd5Hash(password); + bool result = user.Password.Equals(passwordHash); + + // any session stuff here ... + + return result; + } + #endregion + } +} Added: source/trunk/CronosControl/Libraries/BusinessLogic/ProjectUser/ProjectUserSession.cs =================================================================== --- source/trunk/CronosControl/Libraries/BusinessLogic/ProjectUser/ProjectUserSession.cs (rev 0) +++ source/trunk/CronosControl/Libraries/BusinessLogic/ProjectUser/ProjectUserSession.cs 2010-02-13 21:24:52 UTC (rev 30) @@ -0,0 +1,75 @@ +//------------------------------------------------------------------------------ +// The contents of this file are subject to the GNU General Public License Version 3.0 ("License"); you may not use this file except in compliance with the License. +// You may obtain a copy of the License at http://www.cronoscontrol.net/license.html. +// +// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. +// See the License for the specific language governing rights and limitations under the License. +// +// The Original Code is CronosControl. +// The Initial Developer of the Original Code is WebImageConsulting http://www.wicnow.com/. +// All Rights Reserved. +// +// Contributor(s): Mario Alberto Arce, _______. +//------------------------------------------------------------------------------ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.Specialized; +using System.Text; +using System.Web; +using System.Xml; +using CronosControl.Model; + +namespace CronosControl.BusinessLogic.ProjectUser +{ + /// <summary> + /// Represents a project user session + /// </summary> + public partial class ProjectUserSession : BaseEntity + { + #region Constructor + /// <summary> + /// Creates a new instance of the ProjectUserSession class + /// </summary> + public ProjectUserSession() + { + } + #endregion + + #region Properties + /// <summary> + /// Gets or sets the project user session identifier + /// </summary> + public Guid ProjectUserSessionGUID { get; set; } + + /// <summary> + /// Gets or sets the project user identifier + /// </summary> + public int ProjectUserID { get; set; } + + /// <summary> + /// Gets or sets the last accessed date and time + /// </summary> + public DateTime LastAccessed { get; set; } + + /// <summary> + /// Gets or sets a value indicating whether the project user session is expired + /// </summary> + public bool IsExpired { get; set; } + #endregion + + #region Custom Properties + /// <summary> + /// Gets or sets the project user + /// </summary> + public User User + { + get + { + return ProjectUserManager.GetProjectUserByID(ProjectUserID); + } + } + #endregion + } +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2010-02-13 21:22:07
|
Revision: 29 http://cronoscontrol.svn.sourceforge.net/cronoscontrol/?rev=29&view=rev Author: marioarce Date: 2010-02-13 21:22:01 +0000 (Sat, 13 Feb 2010) Log Message: ----------- Ticket #5 renamed concept from 'Tracker' to 'Project User'. Project User includes a 'project manager', a 'project team members', and any other project stakeholder The following are examples of project stakeholders: * Project manager * Project team members * Upper management * Project customer * Resource Managers * Product user group * Project testers * Sponsor Modified Paths: -------------- source/trunk/CronosControl/Libraries/BusinessLogic/BusinessLogic.csproj source/trunk/CronosControl/Libraries/BusinessLogic/CronosControlContext.cs source/trunk/CronosControl/Libraries/BusinessLogic/Profile/CronosControlMembershipProvider.cs source/trunk/CronosControl/Libraries/BusinessLogic/Profile/CronosControlRoleProvider.cs source/trunk/CronosControl/Libraries/BusinessLogic/bin/Debug/CronosControl.BusinessLogic.dll source/trunk/CronosControl/Libraries/BusinessLogic/bin/Debug/CronosControl.BusinessLogic.pdb source/trunk/CronosControl/Libraries/BusinessLogic/bin/Debug/CronosControl.Common.dll source/trunk/CronosControl/Libraries/BusinessLogic/bin/Debug/CronosControl.Common.pdb source/trunk/CronosControl/Libraries/BusinessLogic/bin/Debug/CronosControlBusinessClassLibrary.dll source/trunk/CronosControl/Libraries/BusinessLogic/bin/Debug/CronosControlBusinessClassLibrary.pdb source/trunk/CronosControl/Libraries/BusinessLogic/bin/Debug/CronosControlClassLibrary.dll source/trunk/CronosControl/Libraries/BusinessLogic/bin/Debug/CronosControlClassLibrary.pdb source/trunk/CronosControl/Libraries/BusinessLogic/obj/Debug/CronosControl.BusinessLogic.dll source/trunk/CronosControl/Libraries/BusinessLogic/obj/Debug/CronosControl.BusinessLogic.pdb Modified: source/trunk/CronosControl/Libraries/BusinessLogic/BusinessLogic.csproj =================================================================== --- source/trunk/CronosControl/Libraries/BusinessLogic/BusinessLogic.csproj 2010-02-13 21:18:21 UTC (rev 28) +++ source/trunk/CronosControl/Libraries/BusinessLogic/BusinessLogic.csproj 2010-02-13 21:22:01 UTC (rev 29) @@ -62,9 +62,9 @@ <Compile Include="CronosControlContext.cs" /> <Compile Include="Profile\CronosControlMembershipProvider.cs" /> <Compile Include="Profile\CronosControlRoleProvider.cs" /> + <Compile Include="ProjectUser\ProjectUserManager.cs" /> + <Compile Include="ProjectUser\ProjectUserSession.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> - <Compile Include="Tracker\TrackerManager.cs" /> - <Compile Include="Tracker\TrackerSession.cs" /> </ItemGroup> <ItemGroup> <ProjectReference Include="..\..\CronosControlBusinessClassLibrary\CronosControlBusinessClassLibrary.csproj"> Modified: source/trunk/CronosControl/Libraries/BusinessLogic/CronosControlContext.cs =================================================================== --- source/trunk/CronosControl/Libraries/BusinessLogic/CronosControlContext.cs 2010-02-13 21:18:21 UTC (rev 28) +++ source/trunk/CronosControl/Libraries/BusinessLogic/CronosControlContext.cs 2010-02-13 21:22:01 UTC (rev 29) @@ -17,7 +17,7 @@ using System.Threading; using System.Web; using CronosControl.Model; -using CronosControl.BusinessLogic.Tracker; +using CronosControl.BusinessLogic.ProjectUser; using CronosControl.BusinessLogic.Configuration.Settings; namespace CronosControl.BusinessLogic @@ -28,12 +28,12 @@ public partial class CronosControlContext { #region Constants - private const string CONST_TRACKERSESSION = "CronosControl.TrackerSession"; - private const string CONST_TRACKERSESSIONCOOKIE = "CronosControl.TrackerSessionGUIDCookie"; + private const string CONST_PROJECTUSERSESSION = "CronosControl.ProjectUserSession"; + private const string CONST_PROJECTUSERSESSIONCOOKIE = "CronosControl.ProjectUserSessionGUIDCookie"; #endregion #region Fields - private User currentTracker; + private User currentProjectUser; private bool isAdmin; private HttpContext context = HttpContext.Current; private Project currentProject; @@ -52,31 +52,31 @@ #region Methods /// <summary> - /// Save tracker session to data source + /// Save project user session to data source /// </summary> - /// <returns>Saved tracker session</returns> - private TrackerSession SaveSessionToDatabase() + /// <returns>Saved project user session</returns> + private ProjectUserSession SaveSessionToDatabase() { return null; } /// <summary> - /// Gets tracker session + /// Gets project user session /// </summary> /// <param name="createInDatabase">Create session in database if no one exists</param> - /// <returns>Tracker session</returns> - public TrackerSession GetSession(bool createInDatabase) + /// <returns>Project User session</returns> + public ProjectUserSession GetSession(bool createInDatabase) { return this.GetSession(createInDatabase, null); } /// <summary> - /// Gets tracker session + /// Gets project user session /// </summary> /// <param name="createInDatabase">Create session in database if no one exists</param> /// <param name="sessionId">Session identifier</param> - /// <returns>Tracker session</returns> - public TrackerSession GetSession(bool createInDatabase, Guid? sessionId) + /// <returns>Project user session</returns> + public ProjectUserSession GetSession(bool createInDatabase, Guid? sessionId) { return null; } @@ -87,16 +87,16 @@ public void SessionSaveToClient() { if (HttpContext.Current != null && this.Session != null) - SetCookie(HttpContext.Current.ApplicationInstance, CONST_TRACKERSESSIONCOOKIE, this.Session.TrackerSessionGUID.ToString()); + SetCookie(HttpContext.Current.ApplicationInstance, CONST_PROJECTUSERSESSIONCOOKIE, this.Session.ProjectUserSessionGUID.ToString()); } /// <summary> - /// Reset tracker session + /// Reset project user session /// </summary> public void ResetSession() { if (HttpContext.Current != null) - SetCookie(HttpContext.Current.ApplicationInstance, CONST_TRACKERSESSIONCOOKIE, string.Empty); + SetCookie(HttpContext.Current.ApplicationInstance, CONST_PROJECTUSERSESSIONCOOKIE, string.Empty); this.Session = null; this.User = null; this["CronosControl.SessionReseted"] = true; @@ -195,7 +195,7 @@ /// <summary> /// Gets or sets the current session /// </summary> - public TrackerSession Session + public ProjectUserSession Session { get { @@ -203,7 +203,7 @@ } set { - Current[CONST_TRACKERSESSION] = value; + Current[CONST_PROJECTUSERSESSION] = value; } } @@ -214,11 +214,11 @@ { get { - return this.currentTracker; + return this.currentProjectUser; } set { - this.currentTracker = value; + this.currentProjectUser = value; } } Modified: source/trunk/CronosControl/Libraries/BusinessLogic/Profile/CronosControlMembershipProvider.cs =================================================================== --- source/trunk/CronosControl/Libraries/BusinessLogic/Profile/CronosControlMembershipProvider.cs 2010-02-13 21:18:21 UTC (rev 28) +++ source/trunk/CronosControl/Libraries/BusinessLogic/Profile/CronosControlMembershipProvider.cs 2010-02-13 21:22:01 UTC (rev 29) @@ -20,7 +20,7 @@ using System.Collections.Generic; using System.Collections.Specialized; using CronosControl.Common.Utils; -using CronosControl.BusinessLogic.Tracker; +using CronosControl.BusinessLogic.ProjectUser; using CronosControl.Model; namespace CronosControl.BusinessLogic.Profile @@ -85,8 +85,8 @@ { MembershipUser user = null; - // add tracker - TrackerManager.AddTracker(email, username, password, username, "-", isApproved, out status); + // add project user + ProjectUserManager.AddProjectUser(email, username, password, username, "-", isApproved, out status); // user key string userKey = string.Empty; @@ -185,7 +185,7 @@ /// <returns>A MembershipUser object populated with the specified user's information from the data source.</returns> public override MembershipUser GetUser(string username, bool userIsOnline) { - User user = TrackerManager.GetTrackerByUsername(username); + User user = ProjectUserManager.GetProjectUserByUsername(username); if (user == null) return null; @@ -212,7 +212,7 @@ /// <returns>The user name associated with the specified e-mail address. If no match is found, return null.</returns> public override string GetUserNameByEmail(string email) { - User user = TrackerManager.GetTrackerByEmail(email); + User user = ProjectUserManager.GetProjectUserByEmail(email); if (user == null) return null; return user.Username; @@ -345,8 +345,8 @@ /// <returns>true if the specified username and password are valid; otherwise, false.</returns> public override bool ValidateUser(string username, string password) { - User user = TrackerManager.GetTrackerByUsername(username); - return TrackerManager.Login(username, password); + User user = ProjectUserManager.GetProjectUserByUsername(username); + return ProjectUserManager.Login(username, password); } #endregion Modified: source/trunk/CronosControl/Libraries/BusinessLogic/Profile/CronosControlRoleProvider.cs =================================================================== --- source/trunk/CronosControl/Libraries/BusinessLogic/Profile/CronosControlRoleProvider.cs 2010-02-13 21:18:21 UTC (rev 28) +++ source/trunk/CronosControl/Libraries/BusinessLogic/Profile/CronosControlRoleProvider.cs 2010-02-13 21:22:01 UTC (rev 29) @@ -20,7 +20,7 @@ using System.Collections.Specialized; using System.Configuration.Provider; using CronosControl.Model; -using CronosControl.BusinessLogic.Tracker; +using CronosControl.BusinessLogic.ProjectUser; namespace CronosControl.BusinessLogic.Profile { @@ -43,7 +43,7 @@ { try { - TrackerManager.AddUsersToRoles(usernames, roleNames); + ProjectUserManager.AddUsersToRoles(usernames, roleNames); } catch (Exception ex) { @@ -98,11 +98,11 @@ /// <returns>A string array containing the names of all the roles that the specified user is in for the configured applicationName.</returns> public override string[] GetRolesForUser(string username) { - User user = TrackerManager.GetTrackerByUsername(username); + User user = ProjectUserManager.GetProjectUserByUsername(username); if (user == null) return new string[] { }; - return TrackerManager.GetRolesForUser(username); + return ProjectUserManager.GetRolesForUser(username); } /// <summary> @@ -172,11 +172,11 @@ /// <returns>true if the specified user is in the specified role for the configured applicationName; otherwise, false.</returns> public override bool IsUserInRole(string username, string roleName) { - User user = TrackerManager.GetTrackerByUsername(username); + User user = ProjectUserManager.GetProjectUserByUsername(username); if (user == null) return false; - return TrackerManager.IsUserInRole(username, roleName); + return ProjectUserManager.IsUserInRole(username, roleName); } /// <summary> Modified: source/trunk/CronosControl/Libraries/BusinessLogic/bin/Debug/CronosControl.BusinessLogic.dll =================================================================== (Binary files differ) Modified: source/trunk/CronosControl/Libraries/BusinessLogic/bin/Debug/CronosControl.BusinessLogic.pdb =================================================================== (Binary files differ) Modified: source/trunk/CronosControl/Libraries/BusinessLogic/bin/Debug/CronosControl.Common.dll =================================================================== (Binary files differ) Modified: source/trunk/CronosControl/Libraries/BusinessLogic/bin/Debug/CronosControl.Common.pdb =================================================================== (Binary files differ) Modified: source/trunk/CronosControl/Libraries/BusinessLogic/bin/Debug/CronosControlBusinessClassLibrary.dll =================================================================== (Binary files differ) Modified: source/trunk/CronosControl/Libraries/BusinessLogic/bin/Debug/CronosControlBusinessClassLibrary.pdb =================================================================== (Binary files differ) Modified: source/trunk/CronosControl/Libraries/BusinessLogic/bin/Debug/CronosControlClassLibrary.dll =================================================================== (Binary files differ) Modified: source/trunk/CronosControl/Libraries/BusinessLogic/bin/Debug/CronosControlClassLibrary.pdb =================================================================== (Binary files differ) Modified: source/trunk/CronosControl/Libraries/BusinessLogic/obj/Debug/CronosControl.BusinessLogic.dll =================================================================== (Binary files differ) Modified: source/trunk/CronosControl/Libraries/BusinessLogic/obj/Debug/CronosControl.BusinessLogic.pdb =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2010-02-13 21:18:30
|
Revision: 28 http://cronoscontrol.svn.sourceforge.net/cronoscontrol/?rev=28&view=rev Author: marioarce Date: 2010-02-13 21:18:21 +0000 (Sat, 13 Feb 2010) Log Message: ----------- Ticket #5 renamed concept from 'Tracker' to 'Project User'. Project User includes a 'project manager', a 'project team members', and any other project stakeholder The following are examples of project stakeholders: * Project manager * Project team members * Upper management * Project customer * Resource Managers * Product user group * Project testers * Sponsor Removed Paths: ------------- source/trunk/CronosControl/Libraries/BusinessLogic/Tracker/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2010-02-13 20:54:01
|
Revision: 27 http://cronoscontrol.svn.sourceforge.net/cronoscontrol/?rev=27&view=rev Author: marioarce Date: 2010-02-13 20:53:54 +0000 (Sat, 13 Feb 2010) Log Message: ----------- registered the configuration file Config.xml Added Paths: ----------- source/trunk/CronosControl/CronosControlWeb/Config.xml.oficial Added: source/trunk/CronosControl/CronosControlWeb/Config.xml.oficial =================================================================== --- source/trunk/CronosControl/CronosControlWeb/Config.xml.oficial (rev 0) +++ source/trunk/CronosControl/CronosControlWeb/Config.xml.oficial 2010-02-13 20:53:54 UTC (rev 27) @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="utf-8"?> +<cronosControl> + <base /> +</cronosControl> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2010-02-13 20:53:10
|
Revision: 26 http://cronoscontrol.svn.sourceforge.net/cronoscontrol/?rev=26&view=rev Author: marioarce Date: 2010-02-13 20:53:04 +0000 (Sat, 13 Feb 2010) Log Message: ----------- Ticket #6 website project modified to use the Custom Membership Provider for CronosControl Modified Paths: -------------- source/trunk/CronosControl/CronosControlWeb/Web.config Modified: source/trunk/CronosControl/CronosControlWeb/Web.config =================================================================== --- source/trunk/CronosControl/CronosControlWeb/Web.config 2010-02-13 20:51:46 UTC (rev 25) +++ source/trunk/CronosControl/CronosControlWeb/Web.config 2010-02-13 20:53:04 UTC (rev 26) @@ -72,12 +72,13 @@ <add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="ApplicationServices" applicationName="/"/> </providers> </profile> - <roleManager enabled="false"> - <providers> - <clear/> - <add connectionStringName="ApplicationServices" applicationName="/" name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/> - <add applicationName="/" name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/> - </providers> + <roleManager enabled="true" defaultProvider="CronosControlRoleProvider"> + <providers> + <clear/> + <add name="CronosControlRoleProvider" type="CronosControl.BusinessLogic.Profile.CronosControlRoleProvider, CronosControl.BusinessLogic" connectionStringName="CronosControlEntities" applicationName="CronosControl" /> + <!--<add connectionStringName="ApplicationServices" applicationName="/" name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>--> + <!--<add applicationName="/" name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>--> + </providers> </roleManager> <!-- The <customErrors> section enables configuration This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2010-02-13 20:51:53
|
Revision: 25 http://cronoscontrol.svn.sourceforge.net/cronoscontrol/?rev=25&view=rev Author: marioarce Date: 2010-02-13 20:51:46 +0000 (Sat, 13 Feb 2010) Log Message: ----------- Ticket #5 adding classes related with: * Custom Role Provider ( ticket #6 ) * User authentication and session ( ticket #7 ) Modified Paths: -------------- source/trunk/CronosControl/Libraries/BusinessLogic/BusinessLogic.csproj source/trunk/CronosControl/Libraries/BusinessLogic/bin/Debug/CronosControl.BusinessLogic.dll source/trunk/CronosControl/Libraries/BusinessLogic/bin/Debug/CronosControl.BusinessLogic.pdb source/trunk/CronosControl/Libraries/BusinessLogic/bin/Debug/CronosControl.Common.dll source/trunk/CronosControl/Libraries/BusinessLogic/bin/Debug/CronosControl.Common.pdb source/trunk/CronosControl/Libraries/BusinessLogic/bin/Debug/CronosControlBusinessClassLibrary.dll source/trunk/CronosControl/Libraries/BusinessLogic/bin/Debug/CronosControlBusinessClassLibrary.pdb source/trunk/CronosControl/Libraries/BusinessLogic/bin/Debug/CronosControlClassLibrary.dll source/trunk/CronosControl/Libraries/BusinessLogic/bin/Debug/CronosControlClassLibrary.pdb source/trunk/CronosControl/Libraries/BusinessLogic/obj/Debug/CronosControl.BusinessLogic.dll source/trunk/CronosControl/Libraries/BusinessLogic/obj/Debug/CronosControl.BusinessLogic.pdb source/trunk/CronosControl/Libraries/Common/bin/Debug/CronosControl.Common.dll source/trunk/CronosControl/Libraries/Common/bin/Debug/CronosControl.Common.pdb source/trunk/CronosControl/Libraries/Common/obj/Debug/CronosControl.Common.dll source/trunk/CronosControl/Libraries/Common/obj/Debug/CronosControl.Common.pdb Modified: source/trunk/CronosControl/Libraries/BusinessLogic/BusinessLogic.csproj =================================================================== --- source/trunk/CronosControl/Libraries/BusinessLogic/BusinessLogic.csproj 2010-02-13 20:48:59 UTC (rev 24) +++ source/trunk/CronosControl/Libraries/BusinessLogic/BusinessLogic.csproj 2010-02-13 20:51:46 UTC (rev 25) @@ -39,7 +39,14 @@ <Reference Include="System.Data.Entity"> <RequiredTargetFramework>3.5</RequiredTargetFramework> </Reference> + <Reference Include="System.Design" /> <Reference Include="System.Web" /> + <Reference Include="System.Web.Extensions"> + <RequiredTargetFramework>3.5</RequiredTargetFramework> + </Reference> + <Reference Include="System.Web.Extensions.Design"> + <RequiredTargetFramework>3.5</RequiredTargetFramework> + </Reference> <Reference Include="System.Xml.Linq"> <RequiredTargetFramework>3.5</RequiredTargetFramework> </Reference> @@ -50,10 +57,14 @@ <Reference Include="System.Xml" /> </ItemGroup> <ItemGroup> + <Compile Include="BaseEntity.cs" /> <Compile Include="Configuration\Settings\SettingManager.cs" /> + <Compile Include="CronosControlContext.cs" /> <Compile Include="Profile\CronosControlMembershipProvider.cs" /> + <Compile Include="Profile\CronosControlRoleProvider.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Tracker\TrackerManager.cs" /> + <Compile Include="Tracker\TrackerSession.cs" /> </ItemGroup> <ItemGroup> <ProjectReference Include="..\..\CronosControlBusinessClassLibrary\CronosControlBusinessClassLibrary.csproj"> Modified: source/trunk/CronosControl/Libraries/BusinessLogic/bin/Debug/CronosControl.BusinessLogic.dll =================================================================== (Binary files differ) Modified: source/trunk/CronosControl/Libraries/BusinessLogic/bin/Debug/CronosControl.BusinessLogic.pdb =================================================================== (Binary files differ) Modified: source/trunk/CronosControl/Libraries/BusinessLogic/bin/Debug/CronosControl.Common.dll =================================================================== (Binary files differ) Modified: source/trunk/CronosControl/Libraries/BusinessLogic/bin/Debug/CronosControl.Common.pdb =================================================================== (Binary files differ) Modified: source/trunk/CronosControl/Libraries/BusinessLogic/bin/Debug/CronosControlBusinessClassLibrary.dll =================================================================== (Binary files differ) Modified: source/trunk/CronosControl/Libraries/BusinessLogic/bin/Debug/CronosControlBusinessClassLibrary.pdb =================================================================== (Binary files differ) Modified: source/trunk/CronosControl/Libraries/BusinessLogic/bin/Debug/CronosControlClassLibrary.dll =================================================================== (Binary files differ) Modified: source/trunk/CronosControl/Libraries/BusinessLogic/bin/Debug/CronosControlClassLibrary.pdb =================================================================== (Binary files differ) Modified: source/trunk/CronosControl/Libraries/BusinessLogic/obj/Debug/CronosControl.BusinessLogic.dll =================================================================== (Binary files differ) Modified: source/trunk/CronosControl/Libraries/BusinessLogic/obj/Debug/CronosControl.BusinessLogic.pdb =================================================================== (Binary files differ) Modified: source/trunk/CronosControl/Libraries/Common/bin/Debug/CronosControl.Common.dll =================================================================== (Binary files differ) Modified: source/trunk/CronosControl/Libraries/Common/bin/Debug/CronosControl.Common.pdb =================================================================== (Binary files differ) Modified: source/trunk/CronosControl/Libraries/Common/obj/Debug/CronosControl.Common.dll =================================================================== (Binary files differ) Modified: source/trunk/CronosControl/Libraries/Common/obj/Debug/CronosControl.Common.pdb =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2010-02-13 20:49:06
|
Revision: 24 http://cronoscontrol.svn.sourceforge.net/cronoscontrol/?rev=24&view=rev Author: marioarce Date: 2010-02-13 20:48:59 +0000 (Sat, 13 Feb 2010) Log Message: ----------- added some comments ... Modified Paths: -------------- source/trunk/CronosControl/Libraries/BusinessLogic/Profile/CronosControlMembershipProvider.cs Modified: source/trunk/CronosControl/Libraries/BusinessLogic/Profile/CronosControlMembershipProvider.cs =================================================================== --- source/trunk/CronosControl/Libraries/BusinessLogic/Profile/CronosControlMembershipProvider.cs 2010-02-13 20:47:40 UTC (rev 23) +++ source/trunk/CronosControl/Libraries/BusinessLogic/Profile/CronosControlMembershipProvider.cs 2010-02-13 20:48:59 UTC (rev 24) @@ -25,6 +25,9 @@ namespace CronosControl.BusinessLogic.Profile { + /// <summary> + /// Manages storage of membership information for Cronos Control in a data source + /// </summary> public class CronosControlMembershipProvider : MembershipProvider { #region Fields This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2010-02-13 20:47:47
|
Revision: 23 http://cronoscontrol.svn.sourceforge.net/cronoscontrol/?rev=23&view=rev Author: marioarce Date: 2010-02-13 20:47:40 +0000 (Sat, 13 Feb 2010) Log Message: ----------- Ticket #7 Implementing user authentication and session Classes /CronosControlContext.cs * represents a CronosControl Context , added some base methods to manage current session, current context objects, values and properties, and to manage cookies and culture Classes /Tracker/TrackerSession.cs * represents a tracker session object Added Paths: ----------- source/trunk/CronosControl/Libraries/BusinessLogic/BaseEntity.cs source/trunk/CronosControl/Libraries/BusinessLogic/CronosControlContext.cs source/trunk/CronosControl/Libraries/BusinessLogic/Tracker/TrackerSession.cs Added: source/trunk/CronosControl/Libraries/BusinessLogic/BaseEntity.cs =================================================================== --- source/trunk/CronosControl/Libraries/BusinessLogic/BaseEntity.cs (rev 0) +++ source/trunk/CronosControl/Libraries/BusinessLogic/BaseEntity.cs 2010-02-13 20:47:40 UTC (rev 23) @@ -0,0 +1,28 @@ +//------------------------------------------------------------------------------ +// The contents of this file are subject to the GNU General Public License Version 3.0 ("License"); you may not use this file except in compliance with the License. +// You may obtain a copy of the License at http://www.cronoscontrol.net/license.html. +// +// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. +// See the License for the specific language governing rights and limitations under the License. +// +// The Original Code is CronosControl. +// The Initial Developer of the Original Code is WebImageConsulting http://www.wicnow.com/. +// All Rights Reserved. +// +// Contributor(s): Mario Alberto Arce, _______. +//------------------------------------------------------------------------------ + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace CronosControl.BusinessLogic +{ + /// <summary> + /// Provides a base class for entities + /// </summary> + public abstract partial class BaseEntity + { + } +} Added: source/trunk/CronosControl/Libraries/BusinessLogic/CronosControlContext.cs =================================================================== --- source/trunk/CronosControl/Libraries/BusinessLogic/CronosControlContext.cs (rev 0) +++ source/trunk/CronosControl/Libraries/BusinessLogic/CronosControlContext.cs 2010-02-13 20:47:40 UTC (rev 23) @@ -0,0 +1,266 @@ +//------------------------------------------------------------------------------ +// The contents of this file are subject to the GNU General Public License Version 3.0 ("License"); you may not use this file except in compliance with the License. +// You may obtain a copy of the License at http://www.cronoscontrol.net/license.html. +// +// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. +// See the License for the specific language governing rights and limitations under the License. +// +// The Original Code is CronosControl. +// The Initial Developer of the Original Code is WebImageConsulting http://www.wicnow.com/. +// All Rights Reserved. +// +// Contributor(s): Mario Alberto Arce, _______. +//------------------------------------------------------------------------------ + +using System; +using System.Globalization; +using System.Threading; +using System.Web; +using CronosControl.Model; +using CronosControl.BusinessLogic.Tracker; +using CronosControl.BusinessLogic.Configuration.Settings; + +namespace CronosControl.BusinessLogic +{ + /// <summary> + /// Represents a CronosControlContext + /// </summary> + public partial class CronosControlContext + { + #region Constants + private const string CONST_TRACKERSESSION = "CronosControl.TrackerSession"; + private const string CONST_TRACKERSESSIONCOOKIE = "CronosControl.TrackerSessionGUIDCookie"; + #endregion + + #region Fields + private User currentTracker; + private bool isAdmin; + private HttpContext context = HttpContext.Current; + private Project currentProject; + private Company currentCompany; + #endregion + + #region Constructor + /// <summary> + /// Creates a new instance of the CronosControlContext class + /// </summary> + private CronosControlContext() + { + + } + #endregion + + #region Methods + /// <summary> + /// Save tracker session to data source + /// </summary> + /// <returns>Saved tracker session</returns> + private TrackerSession SaveSessionToDatabase() + { + return null; + } + + /// <summary> + /// Gets tracker session + /// </summary> + /// <param name="createInDatabase">Create session in database if no one exists</param> + /// <returns>Tracker session</returns> + public TrackerSession GetSession(bool createInDatabase) + { + return this.GetSession(createInDatabase, null); + } + + /// <summary> + /// Gets tracker session + /// </summary> + /// <param name="createInDatabase">Create session in database if no one exists</param> + /// <param name="sessionId">Session identifier</param> + /// <returns>Tracker session</returns> + public TrackerSession GetSession(bool createInDatabase, Guid? sessionId) + { + return null; + } + + /// <summary> + /// Saves current session to client + /// </summary> + public void SessionSaveToClient() + { + if (HttpContext.Current != null && this.Session != null) + SetCookie(HttpContext.Current.ApplicationInstance, CONST_TRACKERSESSIONCOOKIE, this.Session.TrackerSessionGUID.ToString()); + } + + /// <summary> + /// Reset tracker session + /// </summary> + public void ResetSession() + { + if (HttpContext.Current != null) + SetCookie(HttpContext.Current.ApplicationInstance, CONST_TRACKERSESSIONCOOKIE, string.Empty); + this.Session = null; + this.User = null; + this["CronosControl.SessionReseted"] = true; + } + + /// <summary> + /// Sets cookie + /// </summary> + /// <param name="application">Application</param> + /// <param name="key">Key</param> + /// <param name="val">Value</param> + private static void SetCookie(HttpApplication application, string key, string val) + { + HttpCookie cookie = new HttpCookie(key); + cookie.Value = val; + if (string.IsNullOrEmpty(val)) + { + cookie.Expires = DateTime.Now.AddMonths(-1); + } + else + { + cookie.Expires = DateTime.Now.AddHours(Convert.ToDouble(SettingManager.Current["base", "cookieExpires"])); + } + application.Response.Cookies.Remove(key); + application.Response.Cookies.Add(cookie); + } + #endregion + + #region Properties + /// <summary> + /// Gets an instance of the CronosControlContext, which can be used to retrieve information about current context. + /// </summary> + public static CronosControlContext Current + { + get + { + if (HttpContext.Current == null) + return null; + + if (HttpContext.Current.Items["CronosControlContext"] == null) + { + CronosControlContext context2 = new CronosControlContext(); + HttpContext.Current.Items.Add("CronosControlContext", context2); + return context2; + } + return (CronosControlContext)HttpContext.Current.Items["CronosControlContext"]; + } + } + + /// <summary> + /// Gets or sets a value indicating whether the context is running in admin-mode + /// </summary> + public bool IsAdmin + { + get + { + return isAdmin; + } + set + { + isAdmin = value; + } + } + + /// <summary> + /// Gets or sets an object item in the context by the specified key. + /// </summary> + /// <param name="key">The key of the value to get.</param> + /// <returns>The value associated with the specified key.</returns> + public object this[string key] + { + get + { + if (this.context == null) + { + return null; + } + + if (this.context.Items[key] != null) + { + return this.context.Items[key]; + } + return null; + } + set + { + if (this.context != null) + { + this.context.Items.Remove(key); + this.context.Items.Add(key, value); + + } + } + } + + /// <summary> + /// Gets or sets the current session + /// </summary> + public TrackerSession Session + { + get + { + return this.GetSession(false); + } + set + { + Current[CONST_TRACKERSESSION] = value; + } + } + + /// <summary> + /// Gets or sets the current user + /// </summary> + public User User + { + get + { + return this.currentTracker; + } + set + { + this.currentTracker = value; + } + } + + /// <summary> + /// Gets or sets the current project + /// </summary> + public Project CurrentProject + { + get + { + return this.currentProject; + } + set + { + this.currentProject = value; + } + } + + /// <summary> + /// Gets or sets the current company + /// </summary> + public Company CurrentCompany + { + get + { + return this.currentCompany; + } + set + { + this.currentCompany = value; + } + } + + /// <summary> + /// Sets the CultureInfo + /// </summary> + /// <param name="culture">Culture</param> + public void SetCulture(CultureInfo culture) + { + Thread.CurrentThread.CurrentCulture = culture; + Thread.CurrentThread.CurrentUICulture = Thread.CurrentThread.CurrentCulture; + } + #endregion + } +} Added: source/trunk/CronosControl/Libraries/BusinessLogic/Tracker/TrackerSession.cs =================================================================== --- source/trunk/CronosControl/Libraries/BusinessLogic/Tracker/TrackerSession.cs (rev 0) +++ source/trunk/CronosControl/Libraries/BusinessLogic/Tracker/TrackerSession.cs 2010-02-13 20:47:40 UTC (rev 23) @@ -0,0 +1,75 @@ +//------------------------------------------------------------------------------ +// The contents of this file are subject to the GNU General Public License Version 3.0 ("License"); you may not use this file except in compliance with the License. +// You may obtain a copy of the License at http://www.cronoscontrol.net/license.html. +// +// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. +// See the License for the specific language governing rights and limitations under the License. +// +// The Original Code is CronosControl. +// The Initial Developer of the Original Code is WebImageConsulting http://www.wicnow.com/. +// All Rights Reserved. +// +// Contributor(s): Mario Alberto Arce, _______. +//------------------------------------------------------------------------------ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.Specialized; +using System.Text; +using System.Web; +using System.Xml; +using CronosControl.Model; + +namespace CronosControl.BusinessLogic.Tracker +{ + /// <summary> + /// Represents a tracker session + /// </summary> + public partial class TrackerSession : BaseEntity + { + #region Constructor + /// <summary> + /// Creates a new instance of the TrackerSession class + /// </summary> + public TrackerSession() + { + } + #endregion + + #region Properties + /// <summary> + /// Gets or sets the tracker session identifier + /// </summary> + public Guid TrackerSessionGUID { get; set; } + + /// <summary> + /// Gets or sets the tracker identifier + /// </summary> + public int TrackerID { get; set; } + + /// <summary> + /// Gets or sets the last accessed date and time + /// </summary> + public DateTime LastAccessed { get; set; } + + /// <summary> + /// Gets or sets a value indicating whether the tracker session is expired + /// </summary> + public bool IsExpired { get; set; } + #endregion + + #region Custom Properties + /// <summary> + /// Gets or sets the tracker + /// </summary> + public User User + { + get + { + return TrackerManager.GetTrackerByID(TrackerID); + } + } + #endregion + } +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2010-02-13 20:41:29
|
Revision: 22 http://cronoscontrol.svn.sourceforge.net/cronoscontrol/?rev=22&view=rev Author: marioarce Date: 2010-02-13 20:41:22 +0000 (Sat, 13 Feb 2010) Log Message: ----------- Ticket #6 Custom Role Provider for CronosControl * Implements the methods of RoleProvider to provide the ASP.NET role services for CronosControl TrackerManager.cs * Added the methods AddUsersToRoles(), GetRolesForUser(), IsUserInRole() that supports the Custom Role Provider for CronosControl * Modified the method AddTracker() in order to use the CronosControlContext instead of SettingManager Modified Paths: -------------- source/trunk/CronosControl/Libraries/BusinessLogic/Tracker/TrackerManager.cs Added Paths: ----------- source/trunk/CronosControl/Libraries/BusinessLogic/Profile/CronosControlRoleProvider.cs Added: source/trunk/CronosControl/Libraries/BusinessLogic/Profile/CronosControlRoleProvider.cs =================================================================== --- source/trunk/CronosControl/Libraries/BusinessLogic/Profile/CronosControlRoleProvider.cs (rev 0) +++ source/trunk/CronosControl/Libraries/BusinessLogic/Profile/CronosControlRoleProvider.cs 2010-02-13 20:41:22 UTC (rev 22) @@ -0,0 +1,220 @@ +//------------------------------------------------------------------------------ +// The contents of this file are subject to the GNU General Public License Version 3.0 ("License"); you may not use this file except in compliance with the License. +// You may obtain a copy of the License at http://www.cronoscontrol.net/license.html. +// +// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. +// See the License for the specific language governing rights and limitations under the License. +// +// The Original Code is CronosControl. +// The Initial Developer of the Original Code is WebImageConsulting http://www.wicnow.com/. +// All Rights Reserved. +// +// Contributor(s): Mario Alberto Arce, _______. +//------------------------------------------------------------------------------ + +using System; +using System.Linq; +using System.Text; +using System.Web.Security; +using System.Collections.Generic; +using System.Collections.Specialized; +using System.Configuration.Provider; +using CronosControl.Model; +using CronosControl.BusinessLogic.Tracker; + +namespace CronosControl.BusinessLogic.Profile +{ + /// <summary> + /// Manages storage of role membership information for Cronos Control in a data source. + /// </summary> + public class CronosControlRoleProvider : RoleProvider + { + #region Fields + private string _AppName; + #endregion + + #region Methods + /// <summary> + /// Adds the specified user names to the specified roles for the configured applicationName + /// </summary> + /// <param name="usernames">A string array of user names to be added to the specified roles.</param> + /// <param name="roleNames">A string array of the role names to add the specified user names to.</param> + public override void AddUsersToRoles(string[] usernames, string[] roleNames) + { + try + { + TrackerManager.AddUsersToRoles(usernames, roleNames); + } + catch (Exception ex) + { + throw new ProviderException(ex.Message, ex); + } + } + + /// <summary> + /// Adds a new role to the data source for the configured applicationName. + /// </summary> + /// <param name="roleName">The name of the role to create.</param> + public override void CreateRole(string roleName) + { + throw new NotImplementedException(); + } + + /// <summary> + /// Removes a role from the data source for the configured applicationName. + /// </summary> + /// <param name="roleName">The name of the role to delete.</param> + /// <param name="throwOnPopulatedRole">If true, throw an exception if roleName has one or more members and do not delete roleName.</param> + /// <returns>true if the role was successfully deleted; otherwise, false.</returns> + public override bool DeleteRole(string roleName, bool throwOnPopulatedRole) + { + throw new NotImplementedException(); + } + + /// <summary> + /// Gets an array of user names in a role where the user name contains the specified user name to match. + /// </summary> + /// <param name="roleName">The role to search in.</param> + /// <param name="usernameToMatch">The user name to search for.</param> + /// <returns>A string array containing the names of all the users where the user name matches usernameToMatch and the user is a member of the specified role.</returns> + public override string[] FindUsersInRole(string roleName, string usernameToMatch) + { + throw new NotImplementedException(); + } + + /// <summary> + /// Gets a list of all the roles for the configured applicationName. + /// </summary> + /// <returns>A string array containing the names of all the roles stored in the data source for the configured applicationName.</returns> + public override string[] GetAllRoles() + { + throw new NotImplementedException(); + } + + /// <summary> + /// Gets a list of the roles that a specified user is in for the configured applicationName. + /// </summary> + /// <param name="username">The user to return a list of roles for.</param> + /// <returns>A string array containing the names of all the roles that the specified user is in for the configured applicationName.</returns> + public override string[] GetRolesForUser(string username) + { + User user = TrackerManager.GetTrackerByUsername(username); + if (user == null) + return new string[] { }; + + return TrackerManager.GetRolesForUser(username); + } + + /// <summary> + /// Gets a list of users in the specified role for the configured applicationName. + /// </summary> + /// <param name="roleName">The name of the role to get the list of users for.</param> + /// <returns>A string array containing the names of all the users who are members of the specified role for the configured applicationName.</returns> + public override string[] GetUsersInRole(string roleName) + { + throw new NotImplementedException(); + } + + /// <summary> + /// Initializes the provider. + /// </summary> + /// <param name="name">The friendly name of the provider.</param> + /// <param name="config">A collection of the name/value pairs representing the provider-specific attributes specified in the configuration for this provider.</param> + public override void Initialize(string name, NameValueCollection config) + { + if (config == null) + { + throw new ArgumentNullException("config"); + } + if (string.IsNullOrEmpty(name)) + { + name = "StoreRoleProvider"; + } + if (string.IsNullOrEmpty(config["description"])) + { + config.Remove("description"); + config.Add("description", "Roles Provider"); + } + base.Initialize(name, config); + this._AppName = config["applicationName"]; + if (string.IsNullOrEmpty(this._AppName)) + { + this._AppName = "CronosControl"; + } + if (this._AppName.Length > 0x100) + { + throw new ProviderException("Provider application name too long"); + } + config.Remove("applicationName"); + + string connectionStringName = config["connectionStringName"]; + if (string.IsNullOrEmpty(connectionStringName)) + { + this._AppName = "CronosControlEntities"; + } + config.Remove("connectionStringName"); + + if (config.Count > 0) + { + string text2 = config.GetKey(0); + if (!string.IsNullOrEmpty(text2)) + { + throw new ProviderException(string.Format("Provider unrecognized attribute {0}", text2)); + } + } + } + + /// <summary> + /// Gets a value indicating whether the specified user is in the specified role for the configured applicationName. + /// </summary> + /// <param name="username">The user name to search for.</param> + /// <param name="roleName">The role to search in.</param> + /// <returns>true if the specified user is in the specified role for the configured applicationName; otherwise, false.</returns> + public override bool IsUserInRole(string username, string roleName) + { + User user = TrackerManager.GetTrackerByUsername(username); + if (user == null) + return false; + + return TrackerManager.IsUserInRole(username, roleName); + } + + /// <summary> + /// Removes the specified user names from the specified roles for the configured applicationName. + /// </summary> + /// <param name="usernames">A string array of user names to be removed from the specified roles.</param> + /// <param name="roleNames">A string array of role names to remove the specified user names from.</param> + public override void RemoveUsersFromRoles(string[] usernames, string[] roleNames) + { + throw new NotImplementedException(); + } + + /// <summary> + /// Gets a value indicating whether the specified role name already exists in the role data source for the configured applicationName. + /// </summary> + /// <param name="roleName">The name of the role to search for in the data source.</param> + /// <returns>true if the role name already exists in the data source for the configured applicationName; otherwise, false.</returns> + public override bool RoleExists(string roleName) + { + throw new NotImplementedException(); + } + #endregion + + #region Properties + /// <summary> + /// Gets or sets the name of the application to store and retrieve role information for. + /// </summary> + public override string ApplicationName + { + get + { + return this._AppName; + } + set + { + this._AppName = value; + } + } + #endregion + } +} Modified: source/trunk/CronosControl/Libraries/BusinessLogic/Tracker/TrackerManager.cs =================================================================== --- source/trunk/CronosControl/Libraries/BusinessLogic/Tracker/TrackerManager.cs 2010-02-10 04:00:26 UTC (rev 21) +++ source/trunk/CronosControl/Libraries/BusinessLogic/Tracker/TrackerManager.cs 2010-02-13 20:41:22 UTC (rev 22) @@ -17,11 +17,12 @@ using System.Text; using System.Web.Security; using System.Collections.Generic; +using System.Configuration.Provider; using System.Security.Cryptography; using CronosControl.Model; -using CronosControl.BusinessLogic.Configuration.Settings; using CronosControl.Business; using CronosControl.Common.Utils; +using CronosControl.BusinessLogic.Configuration.Settings; namespace CronosControl.BusinessLogic.Tracker { @@ -64,7 +65,7 @@ status = MembershipCreateStatus.InvalidEmail; - int idCompany = Convert.ToInt32(SettingManager.Current["base", "idCompany"]); + int idCompany = CronosControlContext.Current.CurrentCompany.IdCompany; passwordHash = CreatePasswordMd5Hash(password); User userEntity = new User(); @@ -92,6 +93,45 @@ } /// <summary> + /// Adds the specified user names to the specified roles for the configured applicationName + /// </summary> + /// <param name="usernames">A string array of user names to be added to the specified roles.</param> + /// <param name="roleNames">A string array of the role names to add the specified user names to.</param> + public static void AddUsersToRoles(string[] usernames, string[] roleNames) + { + foreach (string username in usernames) + { + // get User + User user = GetTrackerByUsername(username); + if (user == null) + { + // user not found!, continue... + continue; + } + + foreach (var roleName in roleNames) + { + CronosControlEntities cronosControlEntities = new CronosControlEntities(); + // get Role + Role role = (from r in cronosControlEntities.Role + where r.Name.Equals(roleName) + select r).First<Role>(); + + Project project = CronosControlContext.Current.CurrentProject; + + // assign role to the user + UserProjectRole userProjectRole = new UserProjectRole(); + userProjectRole.Role = role; + userProjectRole.Project = project; + userProjectRole.IdUser = user.IdUser; + + cronosControlEntities.AddToUserProjectRole(userProjectRole); + cronosControlEntities.SaveChanges(); + } + } + } + + /// <summary> /// Creates a salt /// </summary> /// <param name="size">A salt size</param> @@ -152,6 +192,40 @@ } /// <summary> + /// Gets a list of the roles that a specified user is in for the configured applicationName. + /// </summary> + /// <param name="username">The user to return a list of roles for.</param> + /// <returns>A string array containing the names of all the roles that the specified user is in for the configured applicationName.</returns> + public static string[] GetRolesForUser(string username) + { + // get User + User user = GetTrackerByUsername(username); + if (user == null) + { + // user not found! + return new string[] { }; + } + + CronosControlEntities cronosControlEntities = new CronosControlEntities(); + + Project project = CronosControlContext.Current.CurrentProject; + + // get UserProjectRole + List<string> userProjectRoles = (from upr in cronosControlEntities.UserProjectRole + join ro in cronosControlEntities.Role + on new { upr.Role.IdRole } equals new { ro.IdRole } + where (upr.IdUser == user.IdUser && upr.Project.IdProject == project.IdProject) + select ro.Name).ToList<string>(); + + string[] result = new string[userProjectRoles.Count]; + for (int i = 0; i < userProjectRoles.Count; i++) + { + result[i] = userProjectRoles[i]; + } + return result; + } + + /// <summary> /// Gets a tracket by email /// </summary> /// <param name="Username">Tracker email</param> @@ -199,15 +273,46 @@ if (string.IsNullOrEmpty(username)) return null; + User user; CronosControlEntities cronosControlEntities = new CronosControlEntities(); - User user = (from u in cronosControlEntities.User - where u.Username.Equals(username) - select u).First<User>(); + try + { + user = (from u in cronosControlEntities.User + where u.Username.Equals(username) + select u).First<User>(); + } + catch + { + return null; + } return user; } /// <summary> + /// Gets a value indicating whether the specified user is in the specified role for the configured applicationName. + /// </summary> + /// <param name="username">The user name to search for.</param> + /// <param name="roleName">The role to search in.</param> + /// <returns>true if the specified user is in the specified role for the configured applicationName; otherwise, false.</returns> + public static bool IsUserInRole(string username, string roleName) + { + if (string.IsNullOrEmpty(username)) + return false; + if (string.IsNullOrEmpty(roleName)) + return false; + + User user = GetTrackerByUsername(username); + + CronosControlEntities cronosControlEntities = new CronosControlEntities(); + int result = (from upr in cronosControlEntities.UserProjectRole + where (upr.IdUser == 1 && upr.Role.Name.Equals(roleName)) + select upr).Count<UserProjectRole>(); + + return (result == 1); + } + + /// <summary> /// Login a tracker /// </summary> /// <param name="Email">A tracker username</param> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2010-02-10 04:00:33
|
Revision: 21 http://cronoscontrol.svn.sourceforge.net/cronoscontrol/?rev=21&view=rev Author: marioarce Date: 2010-02-10 04:00:26 +0000 (Wed, 10 Feb 2010) Log Message: ----------- Ticket #1 fixed foreign key constraint "FK_UserProjectRole_User" Modified Paths: -------------- source/trunk/CronosControl/CronosControlWeb/App_Data/CronosControl.mdf source/trunk/CronosControl/CronosControlWeb/App_Data/CronosControl_log.ldf Modified: source/trunk/CronosControl/CronosControlWeb/App_Data/CronosControl.mdf =================================================================== (Binary files differ) Modified: source/trunk/CronosControl/CronosControlWeb/App_Data/CronosControl_log.ldf =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2010-02-06 23:47:47
|
Revision: 20 http://cronoscontrol.svn.sourceforge.net/cronoscontrol/?rev=20&view=rev Author: marioarce Date: 2010-02-06 23:47:36 +0000 (Sat, 06 Feb 2010) Log Message: ----------- Ticket #3 website project modified to use the Custom Membership Provider for CronosControl also: registered the configuration file Config.xml Modified Paths: -------------- source/trunk/CronosControl/CronosControlWeb/Controllers/AccountController.cs source/trunk/CronosControl/CronosControlWeb/CronosControlWeb.csproj source/trunk/CronosControl/CronosControlWeb/Views/Shared/LogOnUserControl.ascx source/trunk/CronosControl/CronosControlWeb/Views/Shared/Site.Master source/trunk/CronosControl/CronosControlWeb/Web.config Modified: source/trunk/CronosControl/CronosControlWeb/Controllers/AccountController.cs =================================================================== --- source/trunk/CronosControl/CronosControlWeb/Controllers/AccountController.cs 2010-02-06 23:44:10 UTC (rev 19) +++ source/trunk/CronosControl/CronosControlWeb/Controllers/AccountController.cs 2010-02-06 23:47:36 UTC (rev 20) @@ -97,7 +97,8 @@ if (ValidateRegistration(userName, email, password, confirmPassword)) { // Attempt to register the user - MembershipCreateStatus createStatus = MembershipService.CreateUser(userName, password, email); + MembershipCreateStatus createStatus = + MembershipService.CreateUser(userName, password, email, string.Empty, string.Empty, true); if (createStatus == MembershipCreateStatus.Success) { @@ -304,7 +305,7 @@ int MinPasswordLength { get; } bool ValidateUser(string userName, string password); - MembershipCreateStatus CreateUser(string userName, string password, string email); + MembershipCreateStatus CreateUser(string userName, string password, string email, string passwordQuestion, string passwordAnswer, bool isApproved); bool ChangePassword(string userName, string oldPassword, string newPassword); } @@ -335,10 +336,10 @@ return _provider.ValidateUser(userName, password); } - public MembershipCreateStatus CreateUser(string userName, string password, string email) + public MembershipCreateStatus CreateUser(string userName, string password, string email, string passwordQuestion, string passwordAnswer, bool isApproved) { MembershipCreateStatus status; - _provider.CreateUser(userName, password, email, null, null, true, null, out status); + _provider.CreateUser(userName, password, email, passwordQuestion, passwordAnswer, isApproved, null, out status); return status; } Modified: source/trunk/CronosControl/CronosControlWeb/CronosControlWeb.csproj =================================================================== --- source/trunk/CronosControl/CronosControlWeb/CronosControlWeb.csproj 2010-02-06 23:44:10 UTC (rev 19) +++ source/trunk/CronosControl/CronosControlWeb/CronosControlWeb.csproj 2010-02-06 23:47:36 UTC (rev 20) @@ -76,6 +76,7 @@ <Content Include="App_Data\CronosControl_log.ldf"> <DependentUpon>CronosControl.mdf</DependentUpon> </Content> + <Content Include="Config.xml" /> <Content Include="Content\images\bottom.gif" /> <Content Include="Content\images\dot.gif" /> <Content Include="Content\images\logo.png" /> @@ -123,6 +124,14 @@ <Project>{7191E8B4-4497-40E8-BD9A-04CD4EF802FC}</Project> <Name>CronosControlDataAccessClassLibrary</Name> </ProjectReference> + <ProjectReference Include="..\Libraries\BusinessLogic\BusinessLogic.csproj"> + <Project>{2981718C-6614-46DF-96A5-77C016AE23A7}</Project> + <Name>BusinessLogic</Name> + </ProjectReference> + <ProjectReference Include="..\Libraries\Common\Common.csproj"> + <Project>{D3EBAC29-E2B4-4E13-97B2-B09FD3F04254}</Project> + <Name>Common</Name> + </ProjectReference> </ItemGroup> <ItemGroup> <Folder Include="Models\" /> Modified: source/trunk/CronosControl/CronosControlWeb/Views/Shared/LogOnUserControl.ascx =================================================================== --- source/trunk/CronosControl/CronosControlWeb/Views/Shared/LogOnUserControl.ascx 2010-02-06 23:44:10 UTC (rev 19) +++ source/trunk/CronosControl/CronosControlWeb/Views/Shared/LogOnUserControl.ascx 2010-02-06 23:47:36 UTC (rev 20) @@ -2,13 +2,12 @@ <% if (Request.IsAuthenticated) { %> - Welcome <b><%= Html.Encode(Page.User.Identity.Name) %></b>! - [ <%= Html.ActionLink("Log Off", "LogOff", "Account") %> ] + Welcome <b><%= Html.Encode(Page.User.Identity.Name) %></b>! <%= Html.ActionLink("Log Off", "LogOff", "Account") %> <% } else { %> - [ <%= Html.ActionLink("Log On", "LogOn", "Account") %> ] + <%= Html.ActionLink("Log On", "LogOn", "Account") %> <% } %> Modified: source/trunk/CronosControl/CronosControlWeb/Views/Shared/Site.Master =================================================================== --- source/trunk/CronosControl/CronosControlWeb/Views/Shared/Site.Master 2010-02-06 23:44:10 UTC (rev 19) +++ source/trunk/CronosControl/CronosControlWeb/Views/Shared/Site.Master 2010-02-06 23:47:36 UTC (rev 20) @@ -19,7 +19,7 @@ <div class="clear"> <div id="logo"> <a href="/Default.aspx"> - <img src="../../Content/images/logo.png" alt="Cronos Control time tracker open source project" /></a></div> + <img src="/Content/images/logo.png" alt="Cronos Control time tracker open source project" /></a></div> <div id="menu"> <ul class="menuitems"> <!-- menu items --> @@ -28,6 +28,8 @@ <li> <%= Html.ActionLink("Projects", "Index", "Projects")%></li> <!-- end menu items --> + <li> + <% Html.RenderPartial("LogOnUserControl"); %></li> </ul> </div> </div> Modified: source/trunk/CronosControl/CronosControlWeb/Web.config =================================================================== --- source/trunk/CronosControl/CronosControlWeb/Web.config 2010-02-06 23:44:10 UTC (rev 19) +++ source/trunk/CronosControl/CronosControlWeb/Web.config 2010-02-06 23:47:36 UTC (rev 20) @@ -21,7 +21,10 @@ </sectionGroup> </sectionGroup> </configSections> - <appSettings/> + <appSettings> + <add key="CronosControl.Web.Configuration.RootElement" value="/cronosControl"/> + <add key="CronosControl.Web.Configuration.FileName" value="Config.xml"/> + </appSettings> <connectionStrings> <!--<add name="ApplicationServices" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient"/>--> <!--<add name="CronosControlEntities" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|CronosControl.mdf;User Instance=true" providerName="System.Data.SqlClient"/>--> @@ -56,10 +59,11 @@ <authentication mode="Forms"> <forms loginUrl="~/Account/LogOn" timeout="2880"/> </authentication> - <membership> + <membership defaultProvider="CronosControlMembershipSqlProvider"> <providers> <clear/> - <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="ApplicationServices" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" passwordFormat="Hashed" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" passwordStrengthRegularExpression="" applicationName="/"/> + <add name="CronosControlMembershipSqlProvider" type="CronosControl.BusinessLogic.Profile.CronosControlMembershipProvider, CronosControl.BusinessLogic" connectionStringName="CronosControlEntities" enablePasswordReset="true" requiresQuestionAndAnswer="false" applicationName="CronosControl" requiresUniqueEmail="true" enablePasswordRetrieval="true"/> + <!--<add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="ApplicationServices" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" passwordFormat="Hashed" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" passwordStrengthRegularExpression="" applicationName="/"/>--> </providers> </membership> <profile> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2010-02-06 23:44:17
|
Revision: 19 http://cronoscontrol.svn.sourceforge.net/cronoscontrol/?rev=19&view=rev Author: marioarce Date: 2010-02-06 23:44:10 +0000 (Sat, 06 Feb 2010) Log Message: ----------- Ticket #5 added Libraries projects to the solution Modified Paths: -------------- source/trunk/CronosControl/CronosControl.sln Modified: source/trunk/CronosControl/CronosControl.sln =================================================================== --- source/trunk/CronosControl/CronosControl.sln 2010-02-06 23:19:47 UTC (rev 18) +++ source/trunk/CronosControl/CronosControl.sln 2010-02-06 23:44:10 UTC (rev 19) @@ -3,8 +3,6 @@ # Visual Studio 2008 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CronosControlDataAccessClassLibrary", "CronosControlClassLibrary\CronosControlDataAccessClassLibrary.csproj", "{7191E8B4-4497-40E8-BD9A-04CD4EF802FC}" EndProject -Project("{4F174C21-8C12-11D0-8340-0000F80270F8}") = "CronosControlDatabase", "CronosControlDatabase\CronosControlDatabase.dbp", "{D7DAE07A-C1B2-4EFF-B2C2-834DA1F4E940}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CronosControlBusinessClassLibrary", "CronosControlBusinessClassLibrary\CronosControlBusinessClassLibrary.csproj", "{2D8FF602-961B-470C-AECF-817AFF0C4E9C}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{A476650C-6685-4050-A3F2-1F911CA5791A}" @@ -17,6 +15,12 @@ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CronosControlWeb.Tests", "CronosControlWeb.Tests\CronosControlWeb.Tests.csproj", "{9CC0D375-D6BD-418D-87EB-079A4114D8FB}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Libraries", "Libraries", "{A2DA6824-5982-48E6-8B18-C9B3D46C26A1}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BusinessLogic", "Libraries\BusinessLogic\BusinessLogic.csproj", "{2981718C-6614-46DF-96A5-77C016AE23A7}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Common", "Libraries\Common\Common.csproj", "{D3EBAC29-E2B4-4E13-97B2-B09FD3F04254}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|.NET = Debug|.NET @@ -67,8 +71,32 @@ {9CC0D375-D6BD-418D-87EB-079A4114D8FB}.Release|Any CPU.Build.0 = Release|Any CPU {9CC0D375-D6BD-418D-87EB-079A4114D8FB}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU {9CC0D375-D6BD-418D-87EB-079A4114D8FB}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {2981718C-6614-46DF-96A5-77C016AE23A7}.Debug|.NET.ActiveCfg = Debug|Any CPU + {2981718C-6614-46DF-96A5-77C016AE23A7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2981718C-6614-46DF-96A5-77C016AE23A7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2981718C-6614-46DF-96A5-77C016AE23A7}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {2981718C-6614-46DF-96A5-77C016AE23A7}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {2981718C-6614-46DF-96A5-77C016AE23A7}.Release|.NET.ActiveCfg = Release|Any CPU + {2981718C-6614-46DF-96A5-77C016AE23A7}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2981718C-6614-46DF-96A5-77C016AE23A7}.Release|Any CPU.Build.0 = Release|Any CPU + {2981718C-6614-46DF-96A5-77C016AE23A7}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {2981718C-6614-46DF-96A5-77C016AE23A7}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {D3EBAC29-E2B4-4E13-97B2-B09FD3F04254}.Debug|.NET.ActiveCfg = Debug|Any CPU + {D3EBAC29-E2B4-4E13-97B2-B09FD3F04254}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D3EBAC29-E2B4-4E13-97B2-B09FD3F04254}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D3EBAC29-E2B4-4E13-97B2-B09FD3F04254}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {D3EBAC29-E2B4-4E13-97B2-B09FD3F04254}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {D3EBAC29-E2B4-4E13-97B2-B09FD3F04254}.Release|.NET.ActiveCfg = Release|Any CPU + {D3EBAC29-E2B4-4E13-97B2-B09FD3F04254}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D3EBAC29-E2B4-4E13-97B2-B09FD3F04254}.Release|Any CPU.Build.0 = Release|Any CPU + {D3EBAC29-E2B4-4E13-97B2-B09FD3F04254}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {D3EBAC29-E2B4-4E13-97B2-B09FD3F04254}.Release|Mixed Platforms.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {2981718C-6614-46DF-96A5-77C016AE23A7} = {A2DA6824-5982-48E6-8B18-C9B3D46C26A1} + {D3EBAC29-E2B4-4E13-97B2-B09FD3F04254} = {A2DA6824-5982-48E6-8B18-C9B3D46C26A1} + EndGlobalSection EndGlobal This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2010-02-06 23:19:54
|
Revision: 18 http://cronoscontrol.svn.sourceforge.net/cronoscontrol/?rev=18&view=rev Author: marioarce Date: 2010-02-06 23:19:47 +0000 (Sat, 06 Feb 2010) Log Message: ----------- Ticket #3 Custom Membership Provider for CronosControl Implements the methods of MembershipProvider to provide the ASP.NET membership services for CronosControl TrackerManager.cs This class implements the methods necessary for maintaining users with rol 'Tracker' in CronosControl using the database schema, mdf file and entity mappings of CronosControl. Added Paths: ----------- source/trunk/CronosControl/Libraries/BusinessLogic/Profile/ source/trunk/CronosControl/Libraries/BusinessLogic/Profile/CronosControlMembershipProvider.cs source/trunk/CronosControl/Libraries/BusinessLogic/Tracker/ source/trunk/CronosControl/Libraries/BusinessLogic/Tracker/TrackerManager.cs Added: source/trunk/CronosControl/Libraries/BusinessLogic/Profile/CronosControlMembershipProvider.cs =================================================================== --- source/trunk/CronosControl/Libraries/BusinessLogic/Profile/CronosControlMembershipProvider.cs (rev 0) +++ source/trunk/CronosControl/Libraries/BusinessLogic/Profile/CronosControlMembershipProvider.cs 2010-02-06 23:19:47 UTC (rev 18) @@ -0,0 +1,477 @@ +//------------------------------------------------------------------------------ +// The contents of this file are subject to the GNU General Public License Version 3.0 ("License"); you may not use this file except in compliance with the License. +// You may obtain a copy of the License at http://www.cronoscontrol.net/license.html. +// +// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. +// See the License for the specific language governing rights and limitations under the License. +// +// The Original Code is CronosControl. +// The Initial Developer of the Original Code is WebImageConsulting http://www.wicnow.com/. +// All Rights Reserved. +// +// Contributor(s): Mario Alberto Arce, _______. +//------------------------------------------------------------------------------ + +using System; +using System.Web; +using System.Web.Security; +using System.Text.RegularExpressions; +using System.Configuration.Provider; +using System.Collections.Generic; +using System.Collections.Specialized; +using CronosControl.Common.Utils; +using CronosControl.BusinessLogic.Tracker; +using CronosControl.Model; + +namespace CronosControl.BusinessLogic.Profile +{ + public class CronosControlMembershipProvider : MembershipProvider + { + #region Fields + private string _AppName; + private bool _EnablePasswordReset; + private bool _EnablePasswordRetrieval; + private int _MaxInvalidPasswordAttempts; + private int _MinRequiredNonalphanumericCharacters; + private int _MinRequiredPasswordLength; + private int _PasswordAttemptWindow; + private string _PasswordStrengthRegularExpression; + private bool _RequiresQuestionAndAnswer; + private bool _RequiresUniqueEmail; + #endregion + + #region Methods + /// <summary> + /// Processes a request to update the password for a membership user. + /// </summary> + /// <param name="username">The user to update the password for. </param> + /// <param name="oldPassword">The current password for the specified user.</param> + /// <param name="newPassword">The new password for the specified user.</param> + /// <returns>true if the password was updated successfully; otherwise, false.</returns> + public override bool ChangePassword(string username, string oldPassword, string newPassword) + { + throw new NotImplementedException(); + } + + /// <summary> + /// Processes a request to update the password question and answer for a membership user. + /// </summary> + /// <param name="username">The user to change the password question and answer for.</param> + /// <param name="password">The password for the specified user.</param> + /// <param name="newPasswordQuestion">The new password question for the specified user.</param> + /// <param name="newPasswordAnswer">The new password answer for the specified user.</param> + /// <returns>true if the password question and answer are updated successfully; otherwise, false.</returns> + public override bool ChangePasswordQuestionAndAnswer(string username, string password, string newPasswordQuestion, string newPasswordAnswer) + { + throw new NotImplementedException(); + } + + /// <summary> + /// Adds a new membership user to the data source. + /// </summary> + /// <param name="username">The user name for the new user.</param> + /// <param name="password">The password for the new user.</param> + /// <param name="email">The e-mail address for the new user.</param> + /// <param name="passwordQuestion">The password question for the new user.</param> + /// <param name="passwordAnswer">The password answer for the new user.</param> + /// <param name="isApproved">Whether or not the new user is approved to be validated.</param> + /// <param name="providerUserKey">The unique identifier from the membership data source for the user.</param> + /// <param name="status">A MembershipCreateStatus enumeration value indicating whether the user was created successfully.</param> + /// <returns>A MembershipUser object populated with the information for the newly created user.</returns> + public override MembershipUser CreateUser(string username, string password, string email, string passwordQuestion, string passwordAnswer, bool isApproved, object providerUserKey, out MembershipCreateStatus status) + { + MembershipUser user = null; + + // add tracker + TrackerManager.AddTracker(email, username, password, username, "-", isApproved, out status); + + // user key + string userKey = string.Empty; + if (providerUserKey == null) + { + userKey = Guid.NewGuid().ToString(); + } + else + { + userKey = providerUserKey.ToString(); + } + + if (status == MembershipCreateStatus.Success) + { + // create membership user + DateTime dt = DateTimeHelper.ConvertToUtcTime(DateTime.Now); + user = new MembershipUser(this.Name, username, null, email, string.Empty, null, true, false, dt, dt, dt, dt, dt); + } + return user; + } + + /// <summary> + /// Removes a user from the membership data source. + /// </summary> + /// <param name="username">The name of the user to delete.</param> + /// <param name="deleteAllRelatedData">true to delete data related to the user from the database; false to leave data related to the user in the database.</param> + /// <returns>true if the user was successfully deleted; otherwise, false.</returns> + public override bool DeleteUser(string username, bool deleteAllRelatedData) + { + throw new NotImplementedException(); + } + + /// <summary> + /// Gets a collection of membership users where the e-mail address contains the specified e-mail address to match. + /// </summary> + /// <param name="EmailToMatch">The e-mail address to search for.</param> + /// <param name="pageIndex">The index of the page of results to return. pageIndex is zero-based.</param> + /// <param name="pageSize">The size of the page of results to return.</param> + /// <param name="totalRecords">The total number of matched users.</param> + /// <returns>A MembershipUserCollection collection that contains a page of pageSizeMembershipUser objects beginning at the page specified by pageIndex.</returns> + public override MembershipUserCollection FindUsersByEmail(string emailToMatch, int pageIndex, int pageSize, out int totalRecords) + { + throw new NotImplementedException(); + } + + /// <summary> + /// Gets a collection of membership users where the user name contains the specified user name to match. + /// </summary> + /// <param name="usernameToMatch">The user name to search for.</param> + /// <param name="pageIndex">The index of the page of results to return. pageIndex is zero-based.</param> + /// <param name="pageSize">The size of the page of results to return.</param> + /// <param name="totalRecords">The total number of matched users.</param> + /// <returns>A MembershipUserCollection collection that contains a page of pageSizeMembershipUser objects beginning at the page specified by pageIndex.</returns> + public override MembershipUserCollection FindUsersByName(string usernameToMatch, int pageIndex, int pageSize, out int totalRecords) + { + throw new NotImplementedException(); + } + + /// <summary> + /// Gets a collection of all the users in the data source in pages of data. + /// </summary> + /// <param name="pageIndex">The index of the page of results to return. pageIndex is zero-based.</param> + /// <param name="pageSize">The size of the page of results to return.</param> + /// <param name="totalRecords">The total number of matched users.</param> + /// <returns>A MembershipUserCollection collection that contains a page of pageSizeMembershipUser objects beginning at the page specified by pageIndex.</returns> + public override MembershipUserCollection GetAllUsers(int pageIndex, int pageSize, out int totalRecords) + { + throw new NotImplementedException(); + } + + /// <summary> + /// Gets the number of users currently accessing the application. + /// </summary> + /// <returns>The number of users currently accessing the application.</returns> + public override int GetNumberOfUsersOnline() + { + throw new NotImplementedException(); + } + + /// <summary> + /// Gets the password for the specified user name from the data source. + /// </summary> + /// <param name="username">The user to retrieve the password for.</param> + /// <param name="answer">The password answer for the user.</param> + /// <returns>The password for the specified user name.</returns> + public override string GetPassword(string username, string answer) + { + throw new NotImplementedException(); + } + + /// <summary> + /// Gets information from the data source for a user. Provides an option to update the last-activity date/time stamp for the user. + /// </summary> + /// <param name="username">The name of the user to get information for.</param> + /// <param name="userIsOnline">true to update the last-activity date/time stamp for the user; false to return user information without updating the last-activity date/time stamp for the user.</param> + /// <returns>A MembershipUser object populated with the specified user's information from the data source.</returns> + public override MembershipUser GetUser(string username, bool userIsOnline) + { + User user = TrackerManager.GetTrackerByUsername(username); + + if (user == null) + return null; + DateTime dt = DateTimeHelper.ConvertToUtcTime(DateTime.Now); + + return new MembershipUser(this.Name, username, user.IdUser, user.Email, string.Empty, null, true, false, dt, dt, dt, dt, dt); + } + + /// <summary> + /// Gets user information from the data source based on the unique identifier for the membership user. Provides an option to update the last-activity date/time stamp for the user. + /// </summary> + /// <param name="providerUserKey">The unique identifier for the membership user to get information for.</param> + /// <param name="userIsOnline">true to update the last-activity date/time stamp for the user; false to return user information without updating the last-activity date/time stamp for the user.</param> + /// <returns>A MembershipUser object populated with the specified user's information from the data source.</returns> + public override MembershipUser GetUser(object providerUserKey, bool userIsOnline) + { + throw new NotImplementedException(); + } + + /// <summary> + /// Gets the user name associated with the specified e-mail address. + /// </summary> + /// <param name="email">The e-mail address to search for.</param> + /// <returns>The user name associated with the specified e-mail address. If no match is found, return null.</returns> + public override string GetUserNameByEmail(string email) + { + User user = TrackerManager.GetTrackerByEmail(email); + if (user == null) + return null; + return user.Username; + } + + /// <summary> + /// Initializes the provider. + /// </summary> + /// <param name="name">The friendly name of the provider.</param> + /// <param name="config">A collection of the name/value pairs representing the provider-specific attributes specified in the configuration for this provider.</param> + public override void Initialize(string name, NameValueCollection config) + { + if (config == null) + { + throw new ArgumentNullException("config"); + } + if (string.IsNullOrEmpty(name)) + { + name = "CronosControlMembershipProvider"; + } + if (string.IsNullOrEmpty(config["description"])) + { + config.Remove("description"); + config.Add("description", "Membership Provider for CronosControl"); + } + base.Initialize(name, config); + this._EnablePasswordReset = CommonHelper.ConfigGetBooleanValue(config, "enablePasswordReset", true); + this._EnablePasswordRetrieval = CommonHelper.ConfigGetBooleanValue(config, "enablePasswordRetrieval", true); + this._RequiresQuestionAndAnswer = CommonHelper.ConfigGetBooleanValue(config, "requiresQuestionAndAnswer", true); + this._RequiresUniqueEmail = CommonHelper.ConfigGetBooleanValue(config, "requiresUniqueEmail", true); + this._MaxInvalidPasswordAttempts = CommonHelper.ConfigGetIntValue(config, "maxInvalidPasswordAttempts", 5, false, 0); + this._PasswordAttemptWindow = CommonHelper.ConfigGetIntValue(config, "passwordAttemptWindow", 10, false, 0); + this._MinRequiredPasswordLength = CommonHelper.ConfigGetIntValue(config, "minRequiredPasswordLength", 7, false, 0x80); + this._MinRequiredNonalphanumericCharacters = CommonHelper.ConfigGetIntValue(config, "minRequiredNonalphanumericCharacters", 1, true, 0x80); + this._PasswordStrengthRegularExpression = config["passwordStrengthRegularExpression"]; + if (this._PasswordStrengthRegularExpression != null) + { + this._PasswordStrengthRegularExpression = this._PasswordStrengthRegularExpression.Trim(); + if (this._PasswordStrengthRegularExpression.Length != 0) + { + try + { + new Regex(this._PasswordStrengthRegularExpression); + } + catch (ArgumentException ex) + { + throw new ProviderException(ex.Message, ex); + } + } + } + this._PasswordStrengthRegularExpression = string.Empty; + if (this._MinRequiredNonalphanumericCharacters > this._MinRequiredPasswordLength) + { + throw new HttpException("MinRequiredNonalphanumericCharacters can not be more than MinRequiredPasswordLength"); + } + this._AppName = config["applicationName"]; + if (string.IsNullOrEmpty(this._AppName)) + { + this._AppName = "CronosControl"; + } + if (this._AppName.Length > 0x100) + { + throw new ProviderException("Provider application name too long"); + } + + string connectionStringName = config["connectionStringName"]; + if (string.IsNullOrEmpty(connectionStringName)) + { + this._AppName = "CronosControlEntities"; + } + + config.Remove("enablePasswordReset"); + config.Remove("enablePasswordRetrieval"); + config.Remove("requiresQuestionAndAnswer"); + config.Remove("applicationName"); + config.Remove("requiresUniqueEmail"); + config.Remove("maxInvalidPasswordAttempts"); + config.Remove("passwordAttemptWindow"); + config.Remove("commandTimeout"); + config.Remove("name"); + config.Remove("minRequiredPasswordLength"); + config.Remove("minRequiredNonalphanumericCharacters"); + config.Remove("passwordStrengthRegularExpression"); + config.Remove("connectionStringName"); + if (config.Count > 0) + { + string key = config.GetKey(0); + if (!string.IsNullOrEmpty(key)) + { + throw new ProviderException(string.Format("Provider unrecognized attribute {0}", key)); + } + } + } + + /// <summary> + /// Resets a user's password to a new, automatically generated password. + /// </summary> + /// <param name="username">The user to reset the password for.</param> + /// <param name="answer">The password answer for the specified user.</param> + /// <returns>The new password for the specified user.</returns> + public override string ResetPassword(string username, string answer) + { + throw new NotImplementedException(); + } + + /// <summary> + /// Clears a lock so that the membership user can be validated. + /// </summary> + /// <param name="userName">The membership user whose lock status you want to clear.</param> + /// <returns>true if the membership user was successfully unlocked; otherwise, false.</returns> + public override bool UnlockUser(string userName) + { + throw new NotImplementedException(); + } + + /// <summary> + /// Updates information about a user in the data source. + /// </summary> + /// <param name="user">A MembershipUser object that represents the user to update and the updated information for the user.</param> + public override void UpdateUser(MembershipUser user) + { + throw new NotImplementedException(); + } + + /// <summary> + /// Verifies that the specified user name and password exist in the data source. + /// </summary> + /// <param name="username">The name of the user to validate.</param> + /// <param name="password">The password for the specified user.</param> + /// <returns>true if the specified username and password are valid; otherwise, false.</returns> + public override bool ValidateUser(string username, string password) + { + User user = TrackerManager.GetTrackerByUsername(username); + return TrackerManager.Login(username, password); + } + #endregion + + #region Properties + /// <summary> + /// The name of the application using the custom membership provider. + /// </summary> + public override string ApplicationName + { + get + { + return this._AppName; + } + set + { + this._AppName = value; + } + } + + /// <summary> + /// Indicates whether the membership provider is configured to allow users to reset their passwords. + /// </summary> + public override bool EnablePasswordReset + { + get + { + return this._EnablePasswordReset; + } + } + + /// <summary> + /// Gets the number of invalid password or password-answer attempts allowed before the membership user is locked out. + /// </summary> + public override int MaxInvalidPasswordAttempts + { + get + { + return this._MaxInvalidPasswordAttempts; + } + } + + /// <summary> + /// Gets the minimum number of special characters that must be present in a valid password. + /// </summary> + public override int MinRequiredNonAlphanumericCharacters + { + get + { + return this._MinRequiredNonalphanumericCharacters; + } + } + + /// <summary> + /// Gets the minimum length required for a password. + /// </summary> + public override int MinRequiredPasswordLength + { + get + { + return this._MinRequiredPasswordLength; + } + } + + /// <summary> + /// Gets the number of minutes in which a maximum number of invalid password or password-answer attempts are allowed before the membership user is locked out. + /// </summary> + public override int PasswordAttemptWindow + { + get + { + return this._PasswordAttemptWindow; + } + } + + /// <summary> + /// Gets the regular expression used to evaluate a password. + /// </summary> + public override string PasswordStrengthRegularExpression + { + get + { + return this._PasswordStrengthRegularExpression; + } + } + + /// <summary> + /// Gets a value indicating whether the membership provider is configured to require the user to answer a password question for password reset and retrieval. + /// </summary> + public override bool RequiresQuestionAndAnswer + { + get + { + return this._RequiresQuestionAndAnswer; + } + } + + /// <summary> + /// Gets a value indicating whether the membership provider is configured to require a unique e-mail address for each user name. + /// </summary> + public override bool RequiresUniqueEmail + { + get + { + return this._RequiresUniqueEmail; + } + } + + /// <summary> + /// Indicates whether the membership provider is configured to allow users to retrieve their passwords. + /// </summary> + public override bool EnablePasswordRetrieval + { + get + { + return _EnablePasswordRetrieval; + } + } + + /// <summary> + /// Gets a value indicating the format for storing passwords in the membership data store. + /// </summary> + public override MembershipPasswordFormat PasswordFormat + { + get + { + return MembershipPasswordFormat.Hashed; + } + } + #endregion + } +} Added: source/trunk/CronosControl/Libraries/BusinessLogic/Tracker/TrackerManager.cs =================================================================== --- source/trunk/CronosControl/Libraries/BusinessLogic/Tracker/TrackerManager.cs (rev 0) +++ source/trunk/CronosControl/Libraries/BusinessLogic/Tracker/TrackerManager.cs 2010-02-06 23:19:47 UTC (rev 18) @@ -0,0 +1,234 @@ +//------------------------------------------------------------------------------ +// The contents of this file are subject to the GNU General Public License Version 3.0 ("License"); you may not use this file except in compliance with the License. +// You may obtain a copy of the License at http://www.cronoscontrol.net/license.html. +// +// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. +// See the License for the specific language governing rights and limitations under the License. +// +// The Original Code is CronosControl. +// The Initial Developer of the Original Code is WebImageConsulting http://www.wicnow.com/. +// All Rights Reserved. +// +// Contributor(s): Mario Alberto Arce, _______. +//------------------------------------------------------------------------------ + +using System; +using System.Linq; +using System.Text; +using System.Web.Security; +using System.Collections.Generic; +using System.Security.Cryptography; +using CronosControl.Model; +using CronosControl.BusinessLogic.Configuration.Settings; +using CronosControl.Business; +using CronosControl.Common.Utils; + +namespace CronosControl.BusinessLogic.Tracker +{ + /// <summary> + /// Tracker manager + /// </summary> + public partial class TrackerManager + { + #region Methods + /// <summary> + /// Adds a tracker + /// </summary> + /// <param name="Email">The email</param> + /// <param name="Username">The username</param> + /// <param name="Password">The password</param> + /// <param name="Name">A value indicating whether the name of the tracker</param> + /// <param name="Lastname">A value indicating whether the lastname of the tracker</param> + /// <param name="Enabled">A value indicating whether the tracker is active</param> + /// <param name="status">Status</param> + /// <returns>A tracker</returns> + public static User AddTracker(string email, string username, string password, + string name, string lastname, + bool enabled, out MembershipCreateStatus status) + { + string saltKey = string.Empty; + string passwordHash = string.Empty; + status = MembershipCreateStatus.UserRejected; + + // duplicated UserName ? + //status = MembershipCreateStatus.DuplicateUserName; + + // invalid UserName ? + //status = MembershipCreateStatus.InvalidUserName; + + // duplicated email ? + //status = MembershipCreateStatus.DuplicateEmail; + + // invalid email ? + if (!CommonHelper.IsValidEmail(email)) + status = MembershipCreateStatus.InvalidEmail; + + + int idCompany = Convert.ToInt32(SettingManager.Current["base", "idCompany"]); + passwordHash = CreatePasswordMd5Hash(password); + + User userEntity = new User(); + userEntity.Name = name; + userEntity.Lastname = lastname; + userEntity.Username = username; + userEntity.Password = passwordHash; + userEntity.Email = email; + userEntity.IdCompany = idCompany; + userEntity.CreatedAt = DateTimeHelper.ConvertToUtcTime(DateTime.Now); + userEntity.Enabled = enabled; + + try + { + Users users = new Users(); + users.Save(userEntity); + } + catch + { + status = MembershipCreateStatus.ProviderError; + } + + status = MembershipCreateStatus.Success; + return userEntity; + } + + /// <summary> + /// Creates a salt + /// </summary> + /// <param name="size">A salt size</param> + /// <returns>A salt</returns> + private static string CreateSalt(int size) + { + RNGCryptoServiceProvider provider = new RNGCryptoServiceProvider(); + byte[] data = new byte[size]; + provider.GetBytes(data); + return Convert.ToBase64String(data); + } + + /// <summary> + /// Creates a password hash + /// </summary> + /// <param name="Password">Password</param> + /// <param name="Salt">Salt</param> + /// <returns>Password hash</returns> + private static string CreatePasswordHash(string Password, string Salt) + { + //MD5, SHA1 + string passwordFormat = SettingManager.Current["Security", "PasswordFormat"]; + if (String.IsNullOrEmpty(passwordFormat)) + passwordFormat = "SHA1"; + + return FormsAuthentication.HashPasswordForStoringInConfigFile(Password + Salt, passwordFormat); + } + + /// <summary> + /// Creates a password Md5 hash + /// </summary> + /// <param name="Password">Password</param> + /// <returns>Password hash</returns> + private static string CreatePasswordMd5Hash(string password) + { + if (string.IsNullOrEmpty(password)) + return string.Empty; + + // Create a new instance of the MD5CryptoServiceProvider object. + MD5CryptoServiceProvider md5Hasher = new MD5CryptoServiceProvider(); + + // Convert the input string to a byte array and compute the hash. + byte[] data = md5Hasher.ComputeHash(Encoding.Default.GetBytes(password)); + + // Create a new Stringbuilder to collect the bytes + // and create a string. + StringBuilder sBuilder = new StringBuilder(); + + // Loop through each byte of the hashed data + // and format each one as a hexadecimal string. + for (int i = 0; i < data.Length; i++) + { + sBuilder.Append(data[i].ToString("x2")); + } + + // Return the hexadecimal string. + return sBuilder.ToString(); + } + + /// <summary> + /// Gets a tracket by email + /// </summary> + /// <param name="Username">Tracker email</param> + /// <returns>A tracker</returns> + public static User GetTrackerByEmail(string email) + { + if (string.IsNullOrEmpty(email)) + return null; + if (!CommonHelper.IsValidEmail(email)) + return null; + + CronosControlEntities cronosControlEntities = new CronosControlEntities(); + User user = (from u in cronosControlEntities.User + where u.Email.Equals(email) + select u).First<User>(); + + return user; + } + + /// <summary> + /// Gets a tracket + /// </summary> + /// <param name="Username">Tracker identifier</param> + /// <returns>A tracker</returns> + public static User GetTrackerByID(int trackerID) + { + if (trackerID == 0) + return null; + + CronosControlEntities cronosControlEntities = new CronosControlEntities(); + User user = (from u in cronosControlEntities.User + where u.IdUser.Equals(trackerID) + select u).First<User>(); + + return user; + } + + /// <summary> + /// Gets a tracket by username + /// </summary> + /// <param name="Username">Tracker username</param> + /// <returns>A tracker</returns> + public static User GetTrackerByUsername(string username) + { + if (string.IsNullOrEmpty(username)) + return null; + + CronosControlEntities cronosControlEntities = new CronosControlEntities(); + User user = (from u in cronosControlEntities.User + where u.Username.Equals(username) + select u).First<User>(); + + return user; + } + + /// <summary> + /// Login a tracker + /// </summary> + /// <param name="Email">A tracker username</param> + /// <param name="Password">Password</param> + /// <returns>Result</returns> + public static bool Login(string username, string password) + { + User user = GetTrackerByUsername(username); + + if (user == null) + return false; + if (!user.Enabled) + return false; + + string passwordHash = CreatePasswordMd5Hash(password); + bool result = user.Password.Equals(passwordHash); + + // any session stuff here ... + + return result; + } + #endregion + } +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2010-02-06 23:11:13
|
Revision: 17 http://cronoscontrol.svn.sourceforge.net/cronoscontrol/?rev=17&view=rev Author: marioarce Date: 2010-02-06 23:11:07 +0000 (Sat, 06 Feb 2010) Log Message: ----------- Ticket #4 Setting Manager class Implemented a class that manages an application configuration XML file Added Paths: ----------- source/trunk/CronosControl/Libraries/BusinessLogic/Configuration/ source/trunk/CronosControl/Libraries/BusinessLogic/Configuration/Settings/ source/trunk/CronosControl/Libraries/BusinessLogic/Configuration/Settings/SettingManager.cs Added: source/trunk/CronosControl/Libraries/BusinessLogic/Configuration/Settings/SettingManager.cs =================================================================== --- source/trunk/CronosControl/Libraries/BusinessLogic/Configuration/Settings/SettingManager.cs (rev 0) +++ source/trunk/CronosControl/Libraries/BusinessLogic/Configuration/Settings/SettingManager.cs 2010-02-06 23:11:07 UTC (rev 17) @@ -0,0 +1,575 @@ +//------------------------------------------------------------------------------ +// The contents of this file are subject to the GNU General Public License Version 3.0 ("License"); you may not use this file except in compliance with the License. +// You may obtain a copy of the License at http://www.cronoscontrol.net/license.html. +// +// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. +// See the License for the specific language governing rights and limitations under the License. +// +// The Original Code is CronosControl. +// The Initial Developer of the Original Code is WebImageConsulting http://www.wicnow.com/. +// All Rights Reserved. +// +// Contributor(s): Mario Alberto Arce, _______. +//------------------------------------------------------------------------------ + +using System; +using System.IO; +using System.Xml; +using System.Linq; +using System.Text; +using System.Threading; +using System.Configuration; +using System.Collections.Generic; + +namespace CronosControl.BusinessLogic.Configuration.Settings +{ + /// <summary> + /// Setting manager + /// Manages an application configuration XML file + /// </summary> + /// <example> + /// <strong>SettingManager.Current["mail/smtpPort"]</strong><br /> + /// <strong>SettingManager.Current["viewport/width"] = "800"</strong> + /// <strong>SettingManager.Current["viewport/background@red_element"] = "F6"</strong> + /// </example> + /// <remarks> + /// Setting values to non-existing nodes in xml configuration file is not supported + /// </remarks> + /// <seealso href="http://www.w3.org/TR/xpath"/> + public partial class SettingManager + { + #region Constants + /// <summary> + /// Name of the default configuration file to read if not specified in constructor + /// </summary> + private const string DEFAULT_CONFIGURATION_FILENAME = "Config.xml"; + + /// <summary> + /// Name of the default XML element which acts as the configuration root + /// </summary> + private const string DEFAULT_CONFIG_ROOT = "/configuration"; + + /// <summary> + /// Indicates a default value to determine if the configuration is cached or not + /// </summary> + private const bool DEFAULT_IS_CONFIG_CACHEABLE = true; + + /// <summary> + /// Indicates a default value to determine if setting values automatically flush the config to disk + /// </summary> + private const bool DEFAULT_AUTO_FLUSH_ON_SET = true; + + /// <summary> + /// Indicates a default value to use in case NULL replacement was set to 'true' + /// </summary> + private const string DEFAULT_VALUE_IF_NOT_EXISTS = null; + + /// <summary> + /// Indicates if non-existent nodes should return a custom value (e.g.: null, "") + /// </summary> + private const bool DEFAULT_USE_REPLACEMENT_IF_NULL = false; + #endregion + + #region Constructors + /// <summary> + /// Initializes a new instance of the <see cref="SettingManager"/> class. + /// </summary> + private SettingManager() + : this(null, null) + { + } + + /// <summary> + /// Initializes a new instance of the <see cref="SettingManager"/> class. + /// </summary> + /// <param name="configurationFilePath">The configuration file path.</param> + private SettingManager(string configurationFilePath) + : this(configurationFilePath, null) + { + } + + /// <summary> + /// Initializes a new instance of the <see cref="SettingManager"/> class. + /// </summary> + /// <param name="configurationFilePath">The configuration file path.</param> + /// <param name="rootElement">The root element.</param> + private SettingManager(string configurationFilePath, string rootElement) + { + if (configurationFilePath == null) + { + // Determines if to use configuration-specified SettingManager fileName, or use default + string fileName = DEFAULT_CONFIGURATION_FILENAME; + if (!String.IsNullOrEmpty(ConfigurationManager.AppSettings["CronosControl.Web.Configuration.FileName"])) + { + fileName = ConfigurationManager.AppSettings["CronosControl.Web.Configuration.FileName"]; + } + + // Determines the base dir to construct the full path + string baseDir = Thread.GetDomain().BaseDirectory; + if (System.Web.HttpContext.Current != null) + { + try + { + baseDir = System.Web.HttpContext.Current.Request.PhysicalApplicationPath; + } + catch + { + // sometimes during the executing HttpContext.Current.Request would not be initialized, + // not even going to be null, but trying to get this value + // the application raise an exception, this is reason of this try-catch + } + } + baseDir = baseDir.Replace("/", "\\"); + configurationFilePath = _ConfigurationFileName = Path.Combine(baseDir, fileName); + } + + this._ConfigurationFileName = configurationFilePath; + + if (rootElement == null) + { + // Determines if to use configuration-specified SettingManager rootElement, or use default + if (!String.IsNullOrEmpty(ConfigurationManager.AppSettings["CronosControl.Web.Configuration.RootElement"])) + { + rootElement = ConfigurationManager.AppSettings["CronosControl.Web.Configuration.RootElement"]; + } + else + { + rootElement = DEFAULT_CONFIG_ROOT; + } + } + this._ConfigurationRoot = rootElement; + + // Determines if configuration is going to be cached in ram, or load it from disk upon each access + if (!String.IsNullOrEmpty(ConfigurationManager.AppSettings["CronosControl.Web.Configuration.UseCache"])) + { + _UseCache = ConfigurationManager.AppSettings["CronosControl.Web.Configuration.RootElement"] == "true"; + } + else + { + _UseCache = DEFAULT_IS_CONFIG_CACHEABLE; + } + } + #endregion + + #region Properties + private static SettingManager _Current = null; + /// <summary> + /// Gets the singleton instance of configuration. + /// </summary> + /// <value>The current.</value> + public static SettingManager Current + { + get + { + if (_Current == null) + { + //NOTE: Not using 'lock' or 'Syncronized' since static variables in .NET now are thread-safe + if (_Current == null) + { + _Current = new SettingManager(); + } + } + return _Current; + } + } + + private bool _UseCache = DEFAULT_IS_CONFIG_CACHEABLE; + /// <summary> + /// Gets or sets a value indicating whether [use cache]. + /// </summary> + /// <value><c>true</c> if [use cache]; otherwise, <c>false</c>.</value> + private bool UseCache + { + get + { + return _UseCache; + } + set + { + _UseCache = value; + } + } + + private bool _FlushOnSet = DEFAULT_AUTO_FLUSH_ON_SET; + /// <summary> + /// Gets or sets a value indicating whether [to flush] when setting values. + /// </summary> + /// <value><c>true</c> if [flush on set]; otherwise, <c>false</c>.</value> + public bool FlushOnSet + { + get + { + return _FlushOnSet; + } + set + { + _FlushOnSet = value; + } + } + + private bool _UseValueIfNotExists = DEFAULT_USE_REPLACEMENT_IF_NULL; + /// <summary> + /// Gets or sets a value indicating whether [use value if not exists], instead of throwing an exception. + /// </summary> + /// <value> + /// <c>true</c> if [use value if not exists]; otherwise, <c>false</c>. + /// </value> + public bool UseValueIfNotExists + { + get + { + return _UseValueIfNotExists; + } + set + { + _UseValueIfNotExists = value; + } + } + + private string _ValueIfNotExists = DEFAULT_VALUE_IF_NOT_EXISTS; + /// <summary> + /// Gets or sets the value that is used if <strong>UseValueIfNotExists</strong> is [true] and a non-existent node was found + /// </summary> + /// <value>The value if not exists.</value> + public string ValueIfNotExists + { + get + { + return _ValueIfNotExists; + } + set + { + _ValueIfNotExists = value; + } + } + + private XmlDocument _ConfigurationDocument = null; + /// <summary> + /// Gets the configuration document. + /// </summary> + /// <value>The configuration document.</value> + private XmlDocument ConfigurationDocument + { + get + { + if (_ConfigurationDocument == null) + { + Reload(); + } + return _ConfigurationDocument; + } + } + + private string _ConfigurationRoot; + /// <summary> + /// Gets the configuration root. + /// </summary> + /// <value>The configuration root.</value> + private string ConfigurationRoot + { + get + { + if (String.IsNullOrEmpty(_ConfigurationRoot)) + { + _ConfigurationRoot = DEFAULT_CONFIG_ROOT; + } + return _ConfigurationRoot; + } + } + + private string _ConfigurationFileName = null; + /// <summary> + /// Gets the name of the configuration file. + /// </summary> + /// <value>The name of the configuration file.</value> + internal string ConfigurationFileName + { + get + { + return _ConfigurationFileName; + } + } + + /// <summary> + /// Gets or sets the <see cref="System.String"/> with the specified branch. + /// </summary> + /// <value></value> + public string this[string branch, string key] + { + get + { + return GetValue(branch + "/" + key); + } + set + { + SetValue(branch + "/" + key, value); + } + } + + /// <summary> + /// Gets or sets the <see cref="System.String"/> with the specified expression. + /// </summary> + /// <value></value> + public string this[string expression] + { + get + { + return GetValue(expression); + } + set + { + SetValue(expression, value); + } + } + #endregion + + #region Methods + /// <summary> + /// Gets the configuration for a specific filename + /// </summary> + /// <param name="filename">The filename.</param> + /// <returns></returns> + public static SettingManager GetConfiguration(string filename) + { + return new SettingManager(filename); + } + + /// <summary> + /// Gets the configuration for a specific file and root name + /// </summary> + /// <param name="filename">The filename.</param> + /// <param name="rootElement">The root element.</param> + /// <returns></returns> + public static SettingManager GetConfiguration(string filename, string rootElement) + { + return new SettingManager(filename, rootElement); + } + + /// <summary> + /// Gets the configuration from the current file name, but for a particular node + /// </summary> + /// <param name="rootElement">The root element.</param> + /// <returns></returns> + public static SettingManager GetConfigurationFromCurrent(string rootElement) + { + return new SettingManager(Current.ConfigurationFileName, rootElement); + } + + /// <summary> + /// Reloads configuration + /// </summary> + public void Reload() + { + try + { + _ConfigurationDocument = new XmlDocument(); + _ConfigurationDocument.Load(ConfigurationFileName); + } + catch (Exception ex) + { + throw new SettingManagerException("Unable to load configuration", ex, this); + } + } + + /// <summary> + /// Gets the value. + /// </summary> + /// <param name="expression">The expression.</param> + /// <returns></returns> + public string GetValue(string expression) + { + if (!UseCache) + { + Reload(); + } + + XmlNode node = ConfigurationDocument.SelectSingleNode(ConfigurationRoot + "/" + expression); + if (node == null) + { + if (UseValueIfNotExists) + { + return ValueIfNotExists; + } + + throw new SettingManagerException( + "Configuration node '" + expression + "' was not found", + this + ); + } + else if (node is XmlElement) + { + return node.InnerText; + } + else if (node is XmlAttribute) + { + return node.Value; + } + else + { + return node.InnerXml; + } + } + + /// <summary> + /// Sets the value. + /// </summary> + /// <param name="expression">The expression.</param> + /// <param name="value">The value.</param> + public void SetValue(string expression, string value) + { + XmlNode selectedNode = ConfigurationDocument.SelectSingleNode(ConfigurationRoot + "/" + expression); + if (selectedNode == null) + { + throw new SettingManagerException("Selected node not found. Setting values on non-existent nodes is not supported yet", this); + } + else if (selectedNode is XmlElement) + { + (selectedNode as XmlElement).InnerText = value; + } + else if (selectedNode is XmlAttribute) + { + (selectedNode as XmlAttribute).Value = value; + } + else + { + throw new SettingManagerException("The type of configuration node specified is not supported", this); + } + + if (FlushOnSet) + { + try + { + Flush(); + } + catch (Exception ex) + { + throw new SettingManagerException( + "Unable to save changes to disk. Check the configuration file exists and write access is allowed", + ex, this + ); + } + } + } + + /// <summary> + /// Flushes current configuration to disk. + /// </summary> + public void Flush() + { + + try + { + ConfigurationDocument.Save(ConfigurationFileName); + } + catch (Exception ex) + { + throw new SettingManagerException( + "Unable to save changes to disk. Check the configuration file exists and write access is allowed", + ex, this + ); + } + } + + /// <summary> + /// Gets a value specifying a branch and key name, where the branch is the parent element of the key element + /// </summary> + /// <param name="branch">The branch.</param> + /// <param name="nodeName">Name of the node.</param> + /// <returns></returns> + [Obsolete( + "Use instead" + + " 'SettingManager.Current[\"xpathExpression\"]' or " + + " 'SettingManager.Current[\"branch\", \"key\"]'", false + )] + public string GetNodeValue(string branch, string nodeName) + { + return GetValue(branch + "/" + nodeName); + } + + /// <summary> + /// Gets the node value. + /// </summary> + /// <param name="branch">The branch.</param> + /// <param name="nodeName">Name of the node.</param> + /// <param name="handleException">if set to <c>true</c> [handle exception].</param> + /// <returns></returns> + [Obsolete( + "Use instead" + + " 'SettingManager.Current[\"xpathExpression\"]' or " + + " 'SettingManager.Current[\"branch\", \"key\"]'", false + )] + public string GetNodeValue(string branch, string nodeName, bool handleException) + { + try + { + return GetValue(branch + "/" + nodeName); + } + catch (Exception e) + { + if (handleException) + { + e.Data.Add("branch", branch); + } + else + { + throw new SettingManagerException( + "Unable to get configuration value for key '" + nodeName + "'", + e, this + ); + } + return null; + } + } + #endregion + } + + /// <summary> + /// Wraps configuration exceptions + /// </summary> + public class SettingManagerException : ApplicationException + { + private SettingManager targetConfiguration = null; + + /// <summary> + /// Initializes a new instance of the <see cref="SettingManagerException"/> class. + /// </summary> + /// <param name="message">The message.</param> + public SettingManagerException(string message) + : base(message) + { + } + + /// <summary> + /// Initializes a new instance of the <see cref="SettingManagerException"/> class. + /// </summary> + /// <param name="message">The message.</param> + /// <param name="ex">The ex.</param> + public SettingManagerException(string message, Exception ex) + : base(message) + { + } + + /// <summary> + /// Initializes a new instance of the <see cref="SettingManagerException"/> class. + /// </summary> + /// <param name="message">The message.</param> + /// <param name="cfg">The CFG.</param> + public SettingManagerException(string message, SettingManager cfg) + : base(message) + { + targetConfiguration = cfg; + } + + /// <summary> + /// Initializes a new instance of the <see cref="SettingManagerException"/> class. + /// </summary> + /// <param name="message">The message.</param> + /// <param name="ex">The exception.</param> + /// <param name="configuration">The configuration.</param> + public SettingManagerException(string message, Exception ex, SettingManager configuration) + : base(message, ex) + { + targetConfiguration = configuration; + } + } +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2010-02-06 23:07:01
|
Revision: 16 http://cronoscontrol.svn.sourceforge.net/cronoscontrol/?rev=16&view=rev Author: marioarce Date: 2010-02-06 23:06:55 +0000 (Sat, 06 Feb 2010) Log Message: ----------- Ticket #5 added DateTimeHelper.cs class that implements some methods for processing of dates and times Added Paths: ----------- source/trunk/CronosControl/Libraries/Common/Utils/DateTimeHelper.cs Added: source/trunk/CronosControl/Libraries/Common/Utils/DateTimeHelper.cs =================================================================== --- source/trunk/CronosControl/Libraries/Common/Utils/DateTimeHelper.cs (rev 0) +++ source/trunk/CronosControl/Libraries/Common/Utils/DateTimeHelper.cs 2010-02-06 23:06:55 UTC (rev 16) @@ -0,0 +1,138 @@ +//------------------------------------------------------------------------------ +// The contents of this file are subject to the GNU General Public License Version 3.0 ("License"); you may not use this file except in compliance with the License. +// You may obtain a copy of the License at http://www.cronoscontrol.net/license.html. +// +// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. +// See the License for the specific language governing rights and limitations under the License. +// +// The Original Code is CronosControl. +// The Initial Developer of the Original Code is WebImageConsulting http://www.wicnow.com/. +// All Rights Reserved. +// +// Contributor(s): Mario Alberto Arce, _______. +//------------------------------------------------------------------------------ + +using System; +using System.Linq; +using System.Text; +using System.Collections.Generic; +using System.Collections.ObjectModel; + +namespace CronosControl.Common.Utils +{ + /// <summary> + /// Represents a datetime helper + /// </summary> + public partial class DateTimeHelper + { + #region Methods + /// <summary> + /// Retrieves a System.TimeZoneInfo object from the registry based on its identifier. + /// </summary> + /// <param name="id">The time zone identifier, which corresponds to the System.TimeZoneInfo.Id property.</param> + /// <returns>A System.TimeZoneInfo object whose identifier is the value of the id parameter.</returns> + public static TimeZoneInfo FindTimeZoneById(string id) + { + return TimeZoneInfo.FindSystemTimeZoneById(id); + } + + /// <summary> + /// Returns a sorted collection of all the time zones + /// </summary> + /// <returns>A read-only collection of System.TimeZoneInfo objects.</returns> + public static ReadOnlyCollection<TimeZoneInfo> GetSystemTimeZones() + { + return TimeZoneInfo.GetSystemTimeZones(); + } + + /// <summary> + /// Converts the date and time to current user date and time + /// </summary> + /// <param name="dt">The date and time (respesents local system time or UTC time) to convert.</param> + /// <returns>A DateTime value that represents time that corresponds to the dateTime parameter in customer time zone.</returns> + public static DateTime ConvertToUserTime(DateTime dt) + { + TimeZoneInfo currentUserTimeZoneInfo = DateTimeHelper.CurrentTimeZone; + return TimeZoneInfo.ConvertTime(dt, currentUserTimeZoneInfo); + } + + /// <summary> + /// Converts the date and time to current user date and time + /// </summary> + /// <param name="dt">The date and time to convert.</param> + /// <param name="sourceTimeZone">The time zone of dateTime.</param> + /// <returns>A DateTime value that represents time that corresponds to the dateTime parameter in customer time zone.</returns> + public static DateTime ConvertToUserTime(DateTime dt, TimeZoneInfo sourceTimeZone) + { + TimeZoneInfo currentUserTimeZoneInfo = DateTimeHelper.CurrentTimeZone; + return TimeZoneInfo.ConvertTime(dt, sourceTimeZone, currentUserTimeZoneInfo); + } + + /// <summary> + /// Converts the date and time to Coordinated Universal Time (UTC) + /// </summary> + /// <param name="dt">The date and time (respesents local system time or UTC time) to convert.</param> + /// <returns>A DateTime value that represents the Coordinated Universal Time (UTC) that corresponds to the dateTime parameter. The DateTime value's Kind property is always set to DateTimeKind.Utc.</returns> + public static DateTime ConvertToUtcTime(DateTime dt) + { + return TimeZoneInfo.ConvertTimeToUtc(dt); + } + + /// <summary> + /// Converts the date and time to Coordinated Universal Time (UTC) + /// </summary> + /// <param name="dt">The date and time to convert.</param> + /// <param name="sourceTimeZone">The time zone of dateTime.</param> + /// <returns>A DateTime value that represents the Coordinated Universal Time (UTC) that corresponds to the dateTime parameter. The DateTime value's Kind property is always set to DateTimeKind.Utc.</returns> + public static DateTime ConvertToUtcTime(DateTime dt, TimeZoneInfo sourceTimeZone) + { + return TimeZoneInfo.ConvertTimeToUtc(dt, sourceTimeZone); + } + #endregion + + #region Properties + /// <summary> + /// Gets or sets a default store time zone + /// </summary> + private static TimeZoneInfo _defaultStoreTimeZone = null; + public static TimeZoneInfo DefaultStoreTimeZone + { + get + { + if (_defaultStoreTimeZone == null) + _defaultStoreTimeZone = TimeZoneInfo.Local; + return _defaultStoreTimeZone; + } + set + { + if (value != null) + { + _defaultStoreTimeZone = value; + } + } + } + + /// <summary> + /// Gets or sets the current user time zone + /// </summary> + private static TimeZoneInfo _currentTimeZone = null; + public static TimeZoneInfo CurrentTimeZone + { + get + { + if (_currentTimeZone == null) + _currentTimeZone = DateTimeHelper.DefaultStoreTimeZone; + + return _currentTimeZone; + } + set + { + if (value != null) + { + _currentTimeZone = value; + } + } + } + #endregion + } +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2010-02-06 23:06:26
|
Revision: 15 http://cronoscontrol.svn.sourceforge.net/cronoscontrol/?rev=15&view=rev Author: marioarce Date: 2010-02-06 23:06:19 +0000 (Sat, 06 Feb 2010) Log Message: ----------- Ticket #5 added CommonHelper.cs class that implements some misc functionality and basic methods for use in libraries and the website Added Paths: ----------- source/trunk/CronosControl/Libraries/Common/Utils/CommonHelper.cs Added: source/trunk/CronosControl/Libraries/Common/Utils/CommonHelper.cs =================================================================== --- source/trunk/CronosControl/Libraries/Common/Utils/CommonHelper.cs (rev 0) +++ source/trunk/CronosControl/Libraries/Common/Utils/CommonHelper.cs 2010-02-06 23:06:19 UTC (rev 15) @@ -0,0 +1,548 @@ +//------------------------------------------------------------------------------ +// The contents of this file are subject to the GNU General Public License Version 3.0 ("License"); you may not use this file except in compliance with the License. +// You may obtain a copy of the License at http://www.cronoscontrol.net/license.html. +// +// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. +// See the License for the specific language governing rights and limitations under the License. +// +// The Original Code is CronosControl. +// The Initial Developer of the Original Code is WebImageConsulting http://www.wicnow.com/. +// All Rights Reserved. +// +// Contributor(s): Mario Alberto Arce, _______. +//------------------------------------------------------------------------------ + +using System; +using System.Web; +using System.Xml; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Diagnostics; +using System.Web.UI.WebControls; +using System.Collections.Generic; +using System.Collections.Specialized; + +namespace CronosControl.Common.Utils +{ + /// <summary> + /// Represents a common helper + /// </summary> + public partial class CommonHelper + { + #region Methods + /// <summary> + /// Verifies that a string is in valid e-mail format + /// </summary> + /// <param name="Email">Email to verify</param> + /// <returns>true if the string is a valid e-mail address and false if it's not</returns> + public static bool IsValidEmail(string Email) + { + if (String.IsNullOrEmpty(Email)) + return false; + return Regex.IsMatch(Email, @"^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$"); + } + + /// <summary> + /// Gets query string value by name + /// </summary> + /// <param name="Name">Parameter name</param> + /// <returns>Query string value</returns> + public static string QueryString(string Name) + { + string result = string.Empty; + if (HttpContext.Current != null && HttpContext.Current.Request.QueryString[Name] != null) + result = HttpContext.Current.Request.QueryString[Name].ToString(); + return result; + } + + /// <summary> + /// Gets boolean value from query string + /// </summary> + /// <param name="Name">Parameter name</param> + /// <returns>Query string value</returns> + public static bool QueryStringBool(string Name) + { + string resultStr = QueryString(Name).ToUpperInvariant(); + return (resultStr == "YES" || resultStr == "TRUE" || resultStr == "1"); + } + + /// <summary> + /// Gets integer value from query string + /// </summary> + /// <param name="Name">Parameter name</param> + /// <returns>Query string value</returns> + public static int QueryStringInt(string Name) + { + string resultStr = QueryString(Name).ToUpperInvariant(); + int result; + Int32.TryParse(resultStr, out result); + return result; + } + + /// <summary> + /// Gets integer value from query string + /// </summary> + /// <param name="Name">Parameter name</param> + /// <param name="DefaultValue">Default value</param> + /// <returns>Query string value</returns> + public static int QueryStringInt(string Name, int DefaultValue) + { + string resultStr = QueryString(Name).ToUpperInvariant(); + if (resultStr.Length > 0) + { + return Int32.Parse(resultStr); + } + return DefaultValue; + } + + /// <summary> + /// Gets GUID value from query string + /// </summary> + /// <param name="Name">Parameter name</param> + /// <returns>Query string value</returns> + public static Guid? QueryStringGUID(string Name) + { + string resultStr = QueryString(Name).ToUpperInvariant(); + Guid? result = null; + try + { + result = new Guid(resultStr); + } + catch + { + } + return result; + } + + /// <summary> + /// Selects item + /// </summary> + /// <param name="List">List</param> + /// <param name="Value">Value to select</param> + public static void SelectListItem(DropDownList List, object Value) + { + if (List.Items.Count != 0) + { + ListItem selectedItem = List.SelectedItem; + if (selectedItem != null) + selectedItem.Selected = false; + if (Value != null) + { + selectedItem = List.Items.FindByValue(Value.ToString()); + if (selectedItem != null) + selectedItem.Selected = true; + } + } + } + + /// <summary> + /// Gets server variable by name + /// </summary> + /// <param name="Name">Name</param> + /// <returns>Server variable</returns> + public static string ServerVariables(string Name) + { + string tmpS = String.Empty; + try + { + if (HttpContext.Current.Request.ServerVariables[Name] != null) + { + + tmpS = HttpContext.Current.Request.ServerVariables[Name].ToString(); + + } + } + catch + { + tmpS = String.Empty; + } + return tmpS; + } + + /// <summary> + /// Modifies query string + /// </summary> + /// <param name="url">Url to modify</param> + /// <param name="queryStringModification">Query string modification</param> + /// <param name="targetLocationModification">Target location modification</param> + /// <returns>New url</returns> + public static string ModifyQueryString(string url, string queryStringModification, string targetLocationModification) + { + string str = string.Empty; + string str2 = string.Empty; + if (url.Contains("#")) + { + str2 = url.Substring(url.IndexOf("#") + 1); + url = url.Substring(0, url.IndexOf("#")); + } + if (url.Contains("?")) + { + str = url.Substring(url.IndexOf("?") + 1); + url = url.Substring(0, url.IndexOf("?")); + } + if (!string.IsNullOrEmpty(queryStringModification)) + { + if (!string.IsNullOrEmpty(str)) + { + Dictionary<string, string> dictionary = new Dictionary<string, string>(); + foreach (string str3 in str.Split(new char[] { '&' })) + { + if (!string.IsNullOrEmpty(str3)) + { + string[] strArray = str3.Split(new char[] { '=' }); + if (strArray.Length == 2) + { + dictionary[strArray[0]] = strArray[1]; + } + else + { + dictionary[str3] = null; + } + } + } + foreach (string str4 in queryStringModification.Split(new char[] { '&' })) + { + if (!string.IsNullOrEmpty(str4)) + { + string[] strArray2 = str4.Split(new char[] { '=' }); + if (strArray2.Length == 2) + { + dictionary[strArray2[0]] = strArray2[1]; + } + else + { + dictionary[str4] = null; + } + } + } + StringBuilder builder = new StringBuilder(); + foreach (string str5 in dictionary.Keys) + { + if (builder.Length > 0) + { + builder.Append("&"); + } + builder.Append(str5); + if (dictionary[str5] != null) + { + builder.Append("="); + builder.Append(dictionary[str5]); + } + } + str = builder.ToString(); + } + else + { + str = queryStringModification; + } + } + if (!string.IsNullOrEmpty(targetLocationModification)) + { + str2 = targetLocationModification; + } + return (url + (string.IsNullOrEmpty(str) ? "" : ("?" + str)) + (string.IsNullOrEmpty(str2) ? "" : ("#" + str2))); + } + + /// <summary> + /// Remove query string from url + /// </summary> + /// <param name="url">Url to modify</param> + /// <param name="queryString">Query string to remove</param> + /// <returns>New url</returns> + public static string RemoveQueryString(string url, string queryString) + { + string str = string.Empty; + if (url.Contains("?")) + { + str = url.Substring(url.IndexOf("?") + 1); + url = url.Substring(0, url.IndexOf("?")); + } + if (!string.IsNullOrEmpty(queryString)) + { + if (!string.IsNullOrEmpty(str)) + { + Dictionary<string, string> dictionary = new Dictionary<string, string>(); + foreach (string str3 in str.Split(new char[] { '&' })) + { + if (!string.IsNullOrEmpty(str3)) + { + string[] strArray = str3.Split(new char[] { '=' }); + if (strArray.Length == 2) + { + dictionary[strArray[0]] = strArray[1]; + } + else + { + dictionary[str3] = null; + } + } + } + dictionary.Remove(queryString); + + StringBuilder builder = new StringBuilder(); + foreach (string str5 in dictionary.Keys) + { + if (builder.Length > 0) + { + builder.Append("&"); + } + builder.Append(str5); + if (dictionary[str5] != null) + { + builder.Append("="); + builder.Append(dictionary[str5]); + } + } + str = builder.ToString(); + } + } + return (url + (string.IsNullOrEmpty(str) ? "" : ("?" + str))); + } + + /// <summary> + /// Sets cookie + /// </summary> + /// <param name="cookieName">Cookie name</param> + /// <param name="cookieValue">Cookie value</param> + /// <param name="ts">Timespan</param> + public static void SetCookie(String cookieName, string cookieValue, TimeSpan ts) + { + try + { + HttpCookie cookie = new HttpCookie(cookieName); + cookie.Value = HttpContext.Current.Server.UrlEncode(cookieValue); + DateTime dt = DateTime.Now; + cookie.Expires = dt.Add(ts); + HttpContext.Current.Response.Cookies.Add(cookie); + } + catch (Exception exc) + { + Debug.WriteLine(exc.Message); + } + } + + /// <summary> + /// Gets cookie string + /// </summary> + /// <param name="cookieName">Cookie name</param> + /// <param name="decode">Decode cookie</param> + /// <returns>Cookie string</returns> + public static String GetCookieString(String cookieName, bool decode) + { + if (HttpContext.Current.Request.Cookies[cookieName] == null) + { + return String.Empty; + } + try + { + string tmp = HttpContext.Current.Request.Cookies[cookieName].Value.ToString(); + if (decode) + tmp = HttpContext.Current.Server.UrlDecode(tmp); + return tmp; + } + catch + { + return String.Empty; + } + } + + /// <summary> + /// Gets boolean value from cookie + /// </summary> + /// <param name="cookieName">Cookie name</param> + /// <returns>Result</returns> + public static bool GetCookieBool(String cookieName) + { + string str1 = GetCookieString(cookieName, true).ToUpperInvariant(); + return (str1 == "TRUE" || str1 == "YES" || str1 == "1"); + } + + /// <summary> + /// Gets integer value from cookie + /// </summary> + /// <param name="cookieName">Cookie name</param> + /// <returns>Result</returns> + public static int GetCookieInt(String cookieName) + { + string str1 = GetCookieString(cookieName, true); + if (!String.IsNullOrEmpty(str1)) + return Convert.ToInt32(str1); + else + return 0; + } + + /// <summary> + /// Gets boolean value from NameValue collection + /// </summary> + /// <param name="config">NameValue collection</param> + /// <param name="valueName">Name</param> + /// <param name="defaultValue">Default value</param> + /// <returns>Result</returns> + public static bool ConfigGetBooleanValue(NameValueCollection config, string valueName, bool defaultValue) + { + bool result; + string str1 = config[valueName]; + if (str1 == null) + return defaultValue; + if (!bool.TryParse(str1, out result)) + throw new Exception(string.Format("Value must be boolean {0}", valueName)); + return result; + } + + /// <summary> + /// Gets integer value from NameValue collection + /// </summary> + /// <param name="config">NameValue collection</param> + /// <param name="valueName">Name</param> + /// <param name="defaultValue">Default value</param> + /// <param name="zeroAllowed">Zero allowed</param> + /// <param name="maxValueAllowed">Max value allowed</param> + /// <returns>Result</returns> + public static int ConfigGetIntValue(NameValueCollection config, string valueName, int defaultValue, bool zeroAllowed, int maxValueAllowed) + { + int result; + string str1 = config[valueName]; + if (str1 == null) + return defaultValue; + if (!int.TryParse(str1, out result)) + { + if (zeroAllowed) + { + throw new Exception(string.Format("Value must be non negative integer {0}", valueName)); + } + throw new Exception(string.Format("Value must be positive integer {0}", valueName)); + } + if (zeroAllowed && (result < 0)) + throw new Exception(string.Format("Value must be non negative integer {0}", valueName)); + if (!zeroAllowed && (result <= 0)) + throw new Exception(string.Format("Value must be positive integer {0}", valueName)); + if ((maxValueAllowed > 0) && (result > maxValueAllowed)) + throw new Exception(string.Format("Value too big {0}", valueName)); + return result; + } + + /// <summary> + /// Write XML to response + /// </summary> + /// <param name="xml">XML</param> + /// <param name="Filename">Filename</param> + public static void WriteResponseXML(string xml, string Filename) + { + if (!String.IsNullOrEmpty(xml)) + { + XmlDocument document = new XmlDocument(); + document.LoadXml(xml); + ((XmlDeclaration)document.FirstChild).Encoding = "utf-8"; + HttpResponse response = HttpContext.Current.Response; + response.Clear(); + response.Charset = "utf-8"; + response.ContentType = "text/xml"; + response.AddHeader("content-disposition", string.Format("attachment; filename={0}", Filename)); + response.BinaryWrite(Encoding.UTF8.GetBytes(document.InnerXml)); + response.End(); + } + } + + /// <summary> + /// Write XLS file to response + /// </summary> + /// <param name="filePath">File path</param> + /// <param name="targetFileName">Target file name</param> + public static void WriteResponseXLS(string filePath, string targetFileName) + { + if (!String.IsNullOrEmpty(filePath)) + { + HttpResponse response = HttpContext.Current.Response; + response.Clear(); + response.Charset = "utf-8"; + response.ContentType = "text/xls"; + response.AddHeader("content-disposition", string.Format("attachment; filename={0}", targetFileName)); + response.BinaryWrite(File.ReadAllBytes(filePath)); + response.End(); + } + } + + /// <summary> + /// Write PDF file to response + /// </summary> + /// <param name="filePath">File napathme</param> + /// <param name="targetFileName">Target file name</param> + /// <remarks>For BeatyStore project</remarks> + public static void WriteResponsePDF(string filePath, string targetFileName) + { + if (!String.IsNullOrEmpty(filePath)) + { + HttpResponse response = HttpContext.Current.Response; + response.Clear(); + response.Charset = "utf-8"; + response.ContentType = "text/pdf"; + response.AddHeader("content-disposition", string.Format("attachment; filename={0}", targetFileName)); + response.BinaryWrite(File.ReadAllBytes(filePath)); + response.End(); + } + } + + /// <summary> + /// Generate random digit code + /// </summary> + /// <param name="Length">Length</param> + /// <returns>Result string</returns> + public static string GenerateRandomDigitCode(int Length) + { + Random random = new Random(); + string s = ""; + for (int i = 0; i < Length; i++) + s = String.Concat(s, random.Next(10).ToString()); + return s; + } + + /// <summary> + /// Convert enum for front-end + /// </summary> + /// <param name="s">Input string</param> + /// <returns>Covnerted string</returns> + public static string ConvertEnum(string s) + { + string result = string.Empty; + char[] letters = s.ToCharArray(); + foreach (char c in letters) + if (c.ToString() != c.ToString().ToLower()) + result += " " + c.ToString(); + else + result += c.ToString(); + return result; + } + + /// <summary> + /// Fills drop down list with values of enumaration + /// </summary> + /// <param name="List">Dropdownlist</param> + /// <param name="enumType">Enumeration</param> + public static void FillDropDownWithEnum(DropDownList List, Type enumType) + { + if (List == null) + { + throw new ArgumentNullException("List"); + } + if (enumType == null) + { + throw new ArgumentNullException("enumType"); + } + if (!enumType.IsEnum) + { + throw new ArgumentException("enumType must be enum type"); + } + + List.Items.Clear(); + string[] strArray = Enum.GetNames(enumType); + foreach (string str2 in strArray) + { + int enumValue = (int)Enum.Parse(enumType, str2, true); + ListItem ddlItem = new ListItem(CommonHelper.ConvertEnum(str2), enumValue.ToString()); + List.Items.Add(ddlItem); + } + } + #endregion + } +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2010-02-06 23:05:22
|
Revision: 14 http://cronoscontrol.svn.sourceforge.net/cronoscontrol/?rev=14&view=rev Author: marioarce Date: 2010-02-06 23:05:15 +0000 (Sat, 06 Feb 2010) Log Message: ----------- Ticket #5 BusinessLogic library: added base files and structure This Library is created to implement business logic, units and modules to solve system requirements Added Paths: ----------- source/trunk/CronosControl/Libraries/BusinessLogic/BusinessLogic.csproj source/trunk/CronosControl/Libraries/BusinessLogic/Properties/ source/trunk/CronosControl/Libraries/BusinessLogic/Properties/AssemblyInfo.cs source/trunk/CronosControl/Libraries/BusinessLogic/bin/ source/trunk/CronosControl/Libraries/BusinessLogic/bin/Debug/ source/trunk/CronosControl/Libraries/BusinessLogic/bin/Debug/CronosControl.BusinessLogic.dll source/trunk/CronosControl/Libraries/BusinessLogic/bin/Debug/CronosControl.BusinessLogic.pdb source/trunk/CronosControl/Libraries/BusinessLogic/bin/Debug/CronosControl.Common.dll source/trunk/CronosControl/Libraries/BusinessLogic/bin/Debug/CronosControl.Common.pdb source/trunk/CronosControl/Libraries/BusinessLogic/bin/Debug/CronosControlBusinessClassLibrary.dll source/trunk/CronosControl/Libraries/BusinessLogic/bin/Debug/CronosControlBusinessClassLibrary.pdb source/trunk/CronosControl/Libraries/BusinessLogic/bin/Debug/CronosControlClassLibrary.dll source/trunk/CronosControl/Libraries/BusinessLogic/bin/Debug/CronosControlClassLibrary.pdb source/trunk/CronosControl/Libraries/BusinessLogic/bin/Debug/Microsoft.Practices.EnterpriseLibrary.Common.dll source/trunk/CronosControl/Libraries/BusinessLogic/bin/Debug/Microsoft.Practices.EnterpriseLibrary.Common.xml source/trunk/CronosControl/Libraries/BusinessLogic/bin/Debug/Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.dll source/trunk/CronosControl/Libraries/BusinessLogic/bin/Debug/Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.xml source/trunk/CronosControl/Libraries/BusinessLogic/bin/Debug/Microsoft.Practices.ObjectBuilder2.dll source/trunk/CronosControl/Libraries/BusinessLogic/bin/Debug/Microsoft.Practices.Unity.dll source/trunk/CronosControl/Libraries/BusinessLogic/obj/ source/trunk/CronosControl/Libraries/BusinessLogic/obj/Debug/ source/trunk/CronosControl/Libraries/BusinessLogic/obj/Debug/BusinessLogic.csproj.FileListAbsolute.txt source/trunk/CronosControl/Libraries/BusinessLogic/obj/Debug/CronosControl.BusinessLogic.dll source/trunk/CronosControl/Libraries/BusinessLogic/obj/Debug/CronosControl.BusinessLogic.pdb source/trunk/CronosControl/Libraries/BusinessLogic/obj/Debug/TempPE/ Added: source/trunk/CronosControl/Libraries/BusinessLogic/BusinessLogic.csproj =================================================================== --- source/trunk/CronosControl/Libraries/BusinessLogic/BusinessLogic.csproj (rev 0) +++ source/trunk/CronosControl/Libraries/BusinessLogic/BusinessLogic.csproj 2010-02-06 23:05:15 UTC (rev 14) @@ -0,0 +1,80 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProductVersion>9.0.30729</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{2981718C-6614-46DF-96A5-77C016AE23A7}</ProjectGuid> + <OutputType>Library</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>CronosControl.BusinessLogic</RootNamespace> + <AssemblyName>CronosControl.BusinessLogic</AssemblyName> + <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> + <FileAlignment>512</FileAlignment> + </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="System" /> + <Reference Include="System.configuration" /> + <Reference Include="System.Core"> + <RequiredTargetFramework>3.5</RequiredTargetFramework> + </Reference> + <Reference Include="System.Data.Entity"> + <RequiredTargetFramework>3.5</RequiredTargetFramework> + </Reference> + <Reference Include="System.Web" /> + <Reference Include="System.Xml.Linq"> + <RequiredTargetFramework>3.5</RequiredTargetFramework> + </Reference> + <Reference Include="System.Data.DataSetExtensions"> + <RequiredTargetFramework>3.5</RequiredTargetFramework> + </Reference> + <Reference Include="System.Data" /> + <Reference Include="System.Xml" /> + </ItemGroup> + <ItemGroup> + <Compile Include="Configuration\Settings\SettingManager.cs" /> + <Compile Include="Profile\CronosControlMembershipProvider.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + <Compile Include="Tracker\TrackerManager.cs" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\..\CronosControlBusinessClassLibrary\CronosControlBusinessClassLibrary.csproj"> + <Project>{2D8FF602-961B-470C-AECF-817AFF0C4E9C}</Project> + <Name>CronosControlBusinessClassLibrary</Name> + </ProjectReference> + <ProjectReference Include="..\..\CronosControlClassLibrary\CronosControlDataAccessClassLibrary.csproj"> + <Project>{7191E8B4-4497-40E8-BD9A-04CD4EF802FC}</Project> + <Name>CronosControlDataAccessClassLibrary</Name> + </ProjectReference> + <ProjectReference Include="..\Common\Common.csproj"> + <Project>{D3EBAC29-E2B4-4E13-97B2-B09FD3F04254}</Project> + <Name>Common</Name> + </ProjectReference> + </ItemGroup> + <Import Project="$(MSBuildToolsPath)\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> \ No newline at end of file Added: source/trunk/CronosControl/Libraries/BusinessLogic/Properties/AssemblyInfo.cs =================================================================== --- source/trunk/CronosControl/Libraries/BusinessLogic/Properties/AssemblyInfo.cs (rev 0) +++ source/trunk/CronosControl/Libraries/BusinessLogic/Properties/AssemblyInfo.cs 2010-02-06 23:05:15 UTC (rev 14) @@ -0,0 +1,36 @@ +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("CronosControl.BusinessLogic")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("CronosControl.BusinessLogic")] +[assembly: AssemblyCopyright("Copyright © 2010")] +[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("d83cab61-73e5-46df-ae70-5cb8a3b98704")] + +// 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 Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] Added: source/trunk/CronosControl/Libraries/BusinessLogic/bin/Debug/CronosControl.BusinessLogic.dll =================================================================== (Binary files differ) Property changes on: source/trunk/CronosControl/Libraries/BusinessLogic/bin/Debug/CronosControl.BusinessLogic.dll ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: source/trunk/CronosControl/Libraries/BusinessLogic/bin/Debug/CronosControl.BusinessLogic.pdb =================================================================== (Binary files differ) Property changes on: source/trunk/CronosControl/Libraries/BusinessLogic/bin/Debug/CronosControl.BusinessLogic.pdb ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: source/trunk/CronosControl/Libraries/BusinessLogic/bin/Debug/CronosControl.Common.dll =================================================================== (Binary files differ) Property changes on: source/trunk/CronosControl/Libraries/BusinessLogic/bin/Debug/CronosControl.Common.dll ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: source/trunk/CronosControl/Libraries/BusinessLogic/bin/Debug/CronosControl.Common.pdb =================================================================== (Binary files differ) Property changes on: source/trunk/CronosControl/Libraries/BusinessLogic/bin/Debug/CronosControl.Common.pdb ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: source/trunk/CronosControl/Libraries/BusinessLogic/bin/Debug/CronosControlBusinessClassLibrary.dll =================================================================== (Binary files differ) Property changes on: source/trunk/CronosControl/Libraries/BusinessLogic/bin/Debug/CronosControlBusinessClassLibrary.dll ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: source/trunk/CronosControl/Libraries/BusinessLogic/bin/Debug/CronosControlBusinessClassLibrary.pdb =================================================================== (Binary files differ) Property changes on: source/trunk/CronosControl/Libraries/BusinessLogic/bin/Debug/CronosControlBusinessClassLibrary.pdb ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: source/trunk/CronosControl/Libraries/BusinessLogic/bin/Debug/CronosControlClassLibrary.dll =================================================================== (Binary files differ) Property changes on: source/trunk/CronosControl/Libraries/BusinessLogic/bin/Debug/CronosControlClassLibrary.dll ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: source/trunk/CronosControl/Libraries/BusinessLogic/bin/Debug/CronosControlClassLibrary.pdb =================================================================== (Binary files differ) Property changes on: source/trunk/CronosControl/Libraries/BusinessLogic/bin/Debug/CronosControlClassLibrary.pdb ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: source/trunk/CronosControl/Libraries/BusinessLogic/bin/Debug/Microsoft.Practices.EnterpriseLibrary.Common.dll =================================================================== (Binary files differ) Property changes on: source/trunk/CronosControl/Libraries/BusinessLogic/bin/Debug/Microsoft.Practices.EnterpriseLibrary.Common.dll ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: source/trunk/CronosControl/Libraries/BusinessLogic/bin/Debug/Microsoft.Practices.EnterpriseLibrary.Common.xml =================================================================== --- source/trunk/CronosControl/Libraries/BusinessLogic/bin/Debug/Microsoft.Practices.EnterpriseLibrary.Common.xml (rev 0) +++ source/trunk/CronosControl/Libraries/BusinessLogic/bin/Debug/Microsoft.Practices.EnterpriseLibrary.Common.xml 2010-02-06 23:05:15 UTC (rev 14) @@ -0,0 +1,7434 @@ +<?xml version="1.0"?> +<doc> + <assembly> + <name>Microsoft.Practices.EnterpriseLibrary.Common</name> + </assembly> + <members> + <member name="T:Microsoft.Practices.EnterpriseLibrary.Common.Instrumentation.AppDomainNameFormatter"> + <summary> + Provides the friendly name of the app domain as the prefix in formatting a + particular instance of a performance counter. + </summary> + </member> + <member name="T:Microsoft.Practices.EnterpriseLibrary.Common.Instrumentation.IPerformanceCounterNameFormatter"> + <summary> + Provides a pluggable way to format the name given to a particular instance of a performance counter. + Each instance of a performance counter in Enterprise Library is given a name of the format + "Name prefix - counter name" + </summary> + </member> + <member name="M:Microsoft.Practices.EnterpriseLibrary.Common.Instrumentation.IPerformanceCounterNameFormatter.CreateName(System.String)"> + <summary> + Creates the formatted instance name for a performance counter, providing the prefix for the + instance. + </summary> + <param name="nameSuffix">Performance counter name, as defined during installation of the counter</param> + <returns>Formatted instance name in form of "prefix - nameSuffix"</returns> + </member> + <member name="M:Microsoft.Practices.EnterpriseLibrary.Common.Instrumentation.AppDomainNameFormatter.#ctor"> + <summary> + Creates an instance of the <see cref="T:Microsoft.Practices.EnterpriseLibrary.Common.Instrumentation.AppDomainNameFormatter"/> + </summary> + </member> + <member name="M:Microsoft.Practices.EnterpriseLibrary.Common.Instrumentation.AppDomainNameFormatter.#ctor(System.String)"> + <summary> + Creates an instance of the <see cref="T:Microsoft.Practices.EnterpriseLibrary.Common.Instrumentation.AppDomainNameFormatter"/> with an Application Instance Name + </summary> + <param name="applicationInstanceName"></param> + </member> + <member name="M:Microsoft.Practices.EnterpriseLibrary.Common.Instrumentation.AppDomainNameFormatter.CreateName(System.String)"> + <summary> + Creates the formatted instance name for a performance counter, providing the Application + Domain friendly name for the prefix for the instance. + </summary> + <param name="nameSuffix">Performance counter name, as defined during installation of the counter</param> + <returns>Formatted instance name in form of "appDomainFriendlyName - nameSuffix"</returns> + </member> + <member name="T:Microsoft.Practices.EnterpriseLibrary.Common.Instrumentation.EnterpriseLibraryPerformanceCounter"> + <summary> + Provides a virtual PerformanceCounter interface that allows an application to maintain both individually + named counter instances and a single counter total instance. + </summary> + </member> + <member name="M:Microsoft.Practices.EnterpriseLibrary.Common.Instrumentation.EnterpriseLibraryPerformanceCounter.#ctor(System.String,System.String)"> + <summary> + Initializes a single performance counter instance named "Total" + </summary> + <param name="counterCategoryName">Performance counter category name, as defined during installation</param> + <param name="counterName">Performance counter name, as defined during installation</param> + </member> + <member name="M:Microsoft.Practices.EnterpriseLibrary.Common.Instrumentation.EnterpriseLibraryPerformanceCounter.#ctor(System.String,System.String,System.String[])"> + <summary> + Initializes multiple instances of performance counters to be managed by this object. + </summary> + <param name="counterCategoryName">Performance counter category name, as defined during installation</param> + <param name="counterName">Performance counter name, as defined during installation</param> + <param name="instanceNames">Param array of instance names to be managed</param> + </member> + <member name="M:Microsoft.Practices.EnterpriseLibrary.Common.Instrumentation.EnterpriseLibraryPerformanceCounter.#ctor(System.Diagnostics.PerformanceCounter[])"> + <summary> + Initializes this object with performance counters created externally. It is the responsibility of the external + counter factory to create an instance for the "Total" counter. + </summary> + <param name="counters">Param array of already initialized <see cref="T:System.Diagnostics.PerformanceCounter"></see>s to be managed + by this instance.</param> + </member> + <member name="M:Microsoft.Practices.EnterpriseLibrary.Common.Instrumentation.EnterpriseLibraryPerformanceCounter.Clear"> + <summary> + Clears the raw count associated with all managed performance counters + </summary> + </member> + <member name="M:Microsoft.Practices.EnterpriseLibrary.Common.Instrumentation.EnterpriseLibraryPerformanceCounter.Increment"> + <summary> + Increments each performance counter managed by this instance. + </summary> + </member> + <member name="M:Microsoft.Practices.EnterpriseLibrary.Common.Instrumentation.EnterpriseLibraryPerformanceCounter.IncrementBy(System.Int64)"> + <summary> + Increments by the given <paramref name="value"></paramref> each performance counter managed by this instance. + </summary> + <param name="value">Amount by which to increment each counter</param> + </member> + <member name="M:Microsoft.Practices.EnterpriseLibrary.Common.Instrumentation.EnterpriseLibraryPerformanceCounter.GetValueFor(System.String)"> + <summary> + Gets the current value of the given performance counter instance. + </summary> + <param name="instanceName">Instance name of counter for which to get value.</param> + <returns>Value of the given performance counter.</returns> + </member> + <member name="M:Microsoft.Practices.EnterpriseLibrary.Common.Instrumentation.EnterpriseLibraryPerformanceCounter.SetValueFor(System.String,System.Int64)"> + <summary> + Sets the value of the given performance counter instance. + </summary> + <param name="instanceName">Instance name of counter for which to set the value.</param> + <param name="value">Value to which the given instance should be set.</param> + </member> + <member name="M:Microsoft.Practices.EnterpriseLibrary.Common.Instrumentation.EnterpriseLibraryPerformanceCounter.InstantiateCounter(System.String)"> + <summary> + Instantiates a performance counter, giving it the specified <paramref name="instanceName"></paramref>. + </summary> + <param name="instanceName">Instance name to be given to the instantiated <see cref="T:System.Diagnostics.PerformanceCounter"></see></param>. + <returns>Initialized <see cref="T:System.Diagnostics.PerformanceCounter"></see></returns>. + </member> + <member name="P:Microsoft.Practices.EnterpriseLibrary.Common.Instrumentation.EnterpriseLibraryPerformanceCounter.Counters"> + <summary> + Gets the list of performance counter instances managed by this object. + </summary> + </member> + <member name="P:Microsoft.Practices.EnterpriseLibrary.Common.Instrumentation.EnterpriseLibraryPerformanceCounter.Value"> + <summary> + This method supports the Enterprise Library infrastructure and is not intended to be used directly from your code. + </summary> + </member> + <member name="T:Microsoft.Practices.EnterpriseLibrary.Common.Instrumentation.EventBinder"> + <summary> + Binds an event source to an event handler. + </summary> + </member> + <member name="M:Microsoft.Practices.EnterpriseLibrary.Common.Instrumentation.EventBinder.#ctor(System.Object,System.Object)"> + <summary> + Initializes this object with the source and listener objects to be bound together. + </summary> + <param name="source">Object owning the event that will be bound to</param> + <param name="listener">Object owning the method that will be added as a handler for specified event.</param> + </member> + <member name="M:Microsoft.Practices.EnterpriseLibrary.Common.Instrumentation.EventBinder.Bind(System.Reflection.EventInfo,System.Reflection.MethodInfo)"> + <summary> + Adds specified <paramref name="listenerMethod"></paramref> as an event handler for + the <paramref name="sourceEvent"></paramref>. + </summary> + <param name="sourceEvent">Event on source object to which <paramref name="listenerMethod"></paramref> will be added.</param> + <param name="listenerMethod">Method to be added as event handler for <paramref name="listenerMethod"></paramref>.</param> + </member> + <member name="T:Microsoft.Practices.EnterpriseLibrary.Common.Instrumentation.InstrumentationBaseAttribute"> + <summary> + Base class for attributes used to identify instrumentation producers or consumers. + </summary> + </member> + <member name="M:Microsoft.Practices.EnterpriseLibrary.Common.Instrumentation.InstrumentationBaseAttribute.#ctor(System.String)"> + <summary> + Initializes this instance with the instrumentation subject name. + </summary> + <param name="subjectName">Subject name being produced or consumed</param> + </member> + <member name="P:Microsoft.Practices.EnterpriseLibrary.Common.Instrumentation.InstrumentationBaseAttribute.SubjectName"> + <summary> + Gets the subject name + </summary> + </member> + <member name="T:Microsoft.Practices.EnterpriseLibrary.Common.Instrumentation.InstrumentationConsumerAttribute"> + <summary> + Defines methods that are consuming instrumentation events. + </summary> + </member> + <member name="M:Microsoft.Practices.EnterpriseLibrary.Common.Instrumentation.InstrumentationConsumerAttribute.#ctor(System.String)"> + <summary> + Initializes this instance with the instrumentation subject name being consumed. + </summary> + <param name="subjectName">Subject name of the event being consumed.</param> + </member> + <member name="T:Microsoft.Practices.EnterpriseLibrary.Common.Instrumentation.InstrumentationListenerAttribute"> + <summary> + Defines a class that will listen for instrumentation events broadcast by other classes + and report them to system services. This attribute is placed on the class that is to be + listened to to define the class that will listen to it. + </summary> + </member> + <member name="M:Microsoft.Practices.EnterpriseLibrary.Common.Instrumentation.InstrumentationListenerAttribute.#ctor(System.Type)"> + <overloads> + Initializes attribute with given <paramref name="listenerType"></paramref>. + </overloads> + <summary> + Initializes attribute with given <paramref name="listenerType"></paramref>. + </summary> + <param name="listenerType">Instrumentation listener type to instantiate.</param> + </member> + <member name="M:Microsoft.Practices.EnterpriseLibrary.Common.Instrumentation.InstrumentationListenerAttribute.#ctor(System.Type,System.Type)"> + <summary> + Initializes attribute with given <paramref name="listenerType"></paramref>. Use when + you need to specify an explicit binder class. + </summary> + <param name="listenerType">Instrumentation listener type to instantiate.</param> + <param name="listenerBinderType">Instrumentation binder listener type to instantiate.</param> + </member> + <member name="P:Microsoft.Practices.EnterpriseLibrary.Common.Instrumentation.InstrumentationListenerAttribute.ListenerType"> + <summary> + Gets type of class to instantiate to listen for events. + </summary> + </member> + <member name="P:Microsoft.Practices.EnterpriseLibrary.Common.Instrumentation.InstrumentationListenerAttribute.ListenerBinderType"> + <summary> + Gets type of class to use to bind an instance of the attributed class to + an instance of the listener class + </summary> + </member> + <member name="T:Microsoft.Practices.EnterpriseLibrary.Common.Instrumentation.InstrumentationProviderAttribute"> + <summary> + Defines events that are producing instrumentation events. + </summary> + </member> + <member name="M:Microsoft.Practices.EnterpriseLibrary.Common.Instrumentation.InstrumentationProviderAttribute.#ctor(System.String)"> + <summary> + Initializes this object with the instrumentation subject name being produced. + </summary> + <param name="subjectName">Subect name of event being produced.</param> + </member> + <member name="T:Microsoft.Practices.EnterpriseLibrary.Common.Instrumentation.HasInstallableResourcesAttribute"> + <summary> + Defines those classes and structs that have some sort of resources that need to be installed. + </summary> + </member> + <member name="T:Microsoft.Practices.EnterpriseLibrary.Common.Instrumentation.PerformanceCounterAttribute"> + <summary> + Defines a <see cref="T:System.Diagnostics.PerformanceCounter"></see>. Used by the reflection-based installers to + prepare a performance counter for installation. + </summary> + </member> + <member name="M:Microsoft.Practices.EnterpriseLibrary.Common.Instrumentation.PerformanceCounterAttribute.#ctor(System.String,System.String,System.Diagnostics.PerformanceCounterType)"> + <summary> + Initializes this object with all data needed to install a <see cref="T:System.Diagnostics.PerformanceCounter"></see>. + </summary> + <param name="counterName">Performance counter name.</param> + <param name="counterHelp">Name of Help resource string. This is not the help text itself, + but is the resource name used to look up the internationalized help text at install-time.</param> + <param name="counterType">Performance Counter type.</param> + </member> + <member name="M:Microsoft.Practices.EnterpriseLibrary.Common.Instrumentation.PerformanceCounterAttribute.HasBaseCounter"> + <summary> + Used to determine if the counter being installed has a base counter associated with it. + </summary> + <returns>True if counter being installed has a base counter associated with it.</returns> + </member> + <member name="P:Microsoft.Practices.EnterpriseLibrary.Common.Instrumentation.PerformanceCounterAttribute.CounterType"> + <summary> + Gets the <see cref="T:System.Diagnostics.PerformanceCounter"></see> type. + </summary> + </member> + <member name="P:Microsoft.Practices.EnterpriseLibrary.Common.Instrumentation.PerformanceCounterAttribute.CounterHelp"> + <summary> + Get the name of Help resource string. This is not the help text itself, + but is the resource name used to look up the internationalized help text at install-time. + </summary> + </member> + <member name="P:Microsoft.Practices.EnterpriseLibrary.Common.Instrumentation.PerformanceCounterAttribute.CounterName"> + <summary> + Gets the <see cref="T:System.Diagnostics.PerformanceCounter"></see> name. + </summary> + </member> + <member name="P:Microsoft.Practices.EnterpriseLibrary.Common.Instrumentation.PerformanceCounterAttribute.BaseCounterType"> + <summary> + Gets and sets the base <see cref="T:System.Diagnostics.PerformanceCounter"></see> type. This is an optional + property used when the counter being defined requires a base counter to operate, such as for + averages, etc. + </summary> + </member> + <member name="P:Microsoft.Practices.EnterpriseLibrary.Common.Instrumentation.PerformanceCounterAttribute.BaseCounterHelp"> + <summary> + Gets and sets the base <see cref="T:System.Diagnostics.PerformanceCounter"></see> help resource name. + This is not the help text itself, + but is the resource name used to look up the internationalized help text at install-time. + This is an optional + property used when the counter being defined requires a base counter to operate, such as for + averages, etc. + </summary> + </member> + <member name="P:Microsoft.Practices.EnterpriseLibrary.Common.Instrumentation.PerformanceCounterAttribute.BaseCounterName"> + <summary> + Gets and sets the base <see cref="T:System.Diagnostics.PerformanceCounter"></see> name. This is an optional + property used when the counter being defined requires a base counter to operate, such as for + averages, etc. + </summary> + </member> + <member name="T:Microsoft.Practices.EnterpriseLibrary.Common.Instrumentation.ReflectionInstrumentationBinder"> + <summary> + Binds together source events and listener handler methods through reflection. + </summary> + </member> + <member name="M:Microsoft.Practices.EnterpriseLibrary.Common.Instrumentation.ReflectionInstrumentationBinder.Bind(System.Object,System.Object)"> + <summary> + Binds together source events and listener handler methods through reflection. + </summary> + <param name="eventSource">Object containing events attributed with <see cref="T:Microsoft.Practices.EnterpriseLibrary.Common.Instrumentation.InstrumentationProviderAttribute"></see>.</param> + <param name="eventListener">Object containing handler methods attribute with <see cref="T:Microsoft.Practices.EnterpriseLibrary.Common.Instrumentation.InstrumentationConsumerAttribute"></see>.</param> + </member> + <member name="T:Microsoft.Practices.EnterpriseLibrary.Common.Instrumentation.NoPrefixNameFormatter"> + <summary> + Provides a pluggable way to format the name given to a particular instance of a performance counter. + This class does no formatting, returning the provided name suffix as the counter name. + </summary> + </member> + <member name="M:Microsoft.Practices.EnterpriseLibrary.Common.Instrumentation.NoPrefixNameFormatter.CreateName(System.String)"> + <summary> + Returns the given <paramref name="nameSuffix"></paramref> as the created name. + </summary> + <param name="nameSuffix">Performance counter name, as defined during installation of the counter</param> + <returns>Formatted instance name in form of "nameSuffix"</returns> + </member> + <member name="T:Microsoft.Practices.EnterpriseLibrary.Common.Properties.Resources"> + <summary> + A strongly-typed resource class, for looking up localized strings, etc. + </summary> + </member> + <member name="P:Microsoft.Practices.EnterpriseLibrary.Common.Properties.Resources.ResourceManager"> + <summary> + Returns the cached ResourceManager instance used by this class. + </summary> + </member> + <member name="P:Microsoft.Practices.EnterpriseLibrary.Common.Properties.Resources.Culture"> + <summary> + Overrides the current thread's CurrentUICulture property for all + resource lookups using this strongly typed resource class. + </summary> + </member> + <member name="P:Microsoft.Practices.EnterpriseLibrary.Common.Properties.Resources.EventLogEntryExceptionTemplate"> + <summary> + Looks up a localized string similar to The exception that occured was: {0}. + </summary> + </member> + <member name="P:Microsoft.Practices.EnterpriseLibrary.Common.Properties.Resources.EventLogEntryHeaderTemplate"> + <summary> + Looks up a localized string similar to An error occurred in application {0} in the {1}.. + </summary> + </member> + <member name="P:Microsoft.Practices.EnterpriseLibrary.Common.Properties.Resources.ExceptionArgumentShouldDeriveFromIDictionary"> + <summary> + Looks up a localized string similar to The type '{0}' does not derive from IDictionary.. + </summary> + </member> + <member name="P:Microsoft.Practices.EnterpriseLibrary.Common.Properties.Resources.ExceptionArgumentShouldDeriveFromIList"> + <summary> + Looks up a localized string similar to The type '{0}' does not derive from IList.. + </summary> + </member> + <member name="P:Microsoft.Practices.EnterpriseLibrary.Common.Properties.Resources.ExceptionAssemblerAttributeNotSet"> + <summary> + Looks up a localized string similar to The [Assembler] attribute is not set in the configuration object type {0}.. + </summary> + </member> + <member name="P:Microsoft.Practices.EnterpriseLibrary.Common.Properties.Resources.ExceptionAssemblerTypeNotCompatible"> + <summary> + Looks up a localized string similar to The assembler configured for type {0} has type {2} which is not compatible with type {1}.. + </summary> + </member> + <member name="P:Microsoft.Practices.EnterpriseLibrary.Common.Properties.Resources.ExceptionBaseConfigurationSourceElementIsInvalid"> + <summary> + Looks up a localized string similar to The base ConfigurationSourceElement configuration type can not be used as a concrete configuration element.. + </summary> + </member> + <member name="P:Microsoft.Practices.EnterpriseLibrary.Common.Properties.Resources.ExceptionCannotAddParametersAfterDispose"> + <summary> + Looks up a localized string similar to Cannot add new paramters after Finish() or Dispose().. + </summary> + </member> + <member name="P:Microsoft.Practices.EnterpriseLibrary.Common.Properties.Resources.ExceptionCanNotConvertType"> + <summary> + Looks up a localized string similar to The AssemblyQualifiedTypeNameConverter can only convert values of type '{0}'.. + </summary> + </member> + <member name="P:Microsoft.Practices.EnterpriseLibrary.Common.Properties.Resources.ExceptionCannotFinish"> + <summary> + Looks up a localized string similar to Builder has already added policies.. + </summary> + </member> + <member name="P:Microsoft.Practices.EnterpriseLibrary.Common.Properties.Resources.ExceptionConfigurationFileNotFound"> + <summary> + Looks up a localized string similar to The section {0} could not be saved because the file does not exist.. + </summary> + </member> + <member name="P:Microsoft.Practices.EnterpriseLibrary.Common.Properties.Resources.ExceptionConfigurationLoadFileNotFound"> + <summary> + Looks up a localized string similar to The configuration file {0} could not be found.. + </summary> + </member> + <member name="P:Microsoft.Practices.EnterpriseLibrary.Common.Properties.Resources.ExceptionConfigurationObjectIsNotCustomProviderData"> + <summary> + Looks up a localized string similar to The configuration object for type '{0}' with name '{1}' has type '{2}' which is does not implement ICustomProviderData.. + </summary> + </member> + <member name="P:Microsoft.Practices.EnterpriseLibrary.Common.Properties.Resources.ExceptionConfigurationObjectWithTypeDoesNotHaveTypeSet"> + <summary> + Looks up a localized string similar to The concrete type for polymorphic object named '{1}' in hierarchy {2} is not defined in configuration object {0}.. + </summary> + </member> + <member name="P:Microsoft.Practices.EnterpriseLibrary.Common.Properties.Resources.ExceptionConfigurationSourceSectionNotFound"> + <summary> + Looks up a localized string similar to The configuration source section is not found in the application configuration file.. + </summary> + </member> + <member name="P:Microsoft.Practices.EnterpriseLibrary.Common.Properties.Resources.ExceptionContainerPolicyCreatorAttributeNotPresent"> + <summary> + Looks up a localized string similar to The required "ContainerPolicyCreatorAttribute" is not present in the supplied type "{0}".. + </summary> + </member> + <member name="P:Microsoft.Practices.EnterpriseLibrary.Common.Properties.Resources.ExceptionCustomFactoryAttributeNotFound"> + <summary> + Looks up a localized string similar to The [CustomFactory] attribute was not found on type {0} while processing request for id '{1}'.. + </summary> + </member> + <member name="P:Microsoft.Practices.EnterpriseLibrary.Common.Properties.Resources.ExceptionCustomProviderTypeDoesNotHaveTheRequiredConstructor"> + <summary> + Looks up a localized string similar to Type '{0}' specified as a custom provider does not have the required public constructor with a single NameValueCollection parameter.. + </summary> + </member> + <member name="P:Microsoft.Practices.EnterpriseLibrary.Common.Properties.Resources.ExceptionEventRaisingFailed"> + <summary> + Looks up a localized string similar to There was an error raising an event in . + </summary> + </member> + <member name="P:Microsoft.Practices.EnterpriseLibrary.Common.Properties.Resources.ExceptionFactoryMethodHasInvalidReturnType"> + <summary> + Looks up a localized string similar to The method with signature {0} is not a valid factory method to build type {1}.. + </summary> + </member> + <member name="P:Microsoft.Practices.EnterpriseLibrary.Common.Properties.Resources.ExceptionInvalidType"> + <summary> + Looks up a localized string similar to The type '{0}' cannot be resolved. Please verify the spelling is correct or that the full type name is provided.. + </summary> + </member> + <member name="P:Microsoft.Practices.EnterpriseLibrary.Common.Properties.Resources.ExceptionMustBeNameTypeConfigurationElement"> + <summary> + Looks up a localized string similar to The supplied configuration object has type '{0}', which is not a descendant of 'NameTypeConfigurationElement' as required.. + </summary> + </member> + <member name="P:Microsoft.Practices.EnterpriseLibrary.Common.Properties.Resources.ExceptionMustHaveNoArgsConstructor"> + <summary> + Looks up a localized string similar to The required zero argument constructor is not available for the supplied type "{0}".. + </summary> + </member> + <member name="P:Microsoft.Practices.EnterpriseLibrary.Common.Properties.Resources.ExceptionMustImplementIContainerPolicyCreator"> + <summary> + Looks up a localized string similar to The required interface "IContainerPolicyCreator" is not implemented by the supplied type "{0}".. + </summary> + </member> + <member name="P:Microsoft.Practices.EnterpriseLibrary.Common.Properties.Resources.ExceptionNamedConfigurationNotFound"> + <summary> + Looks up a localized string similar to The configuration could not be found for name '{0}' in factory {1}.. + </summary> + </member> + <member name="P:Microsoft.Practices.EnterpriseLibrary.Common.Properties.Resources.ExceptionNoConfigurationElementAttribute"> + <summary> + Looks up a localized string similar to The type {0} does not contain the ConfigurationElementTypeAttribute.. + </summary> + </member> + <member name="P:Microsoft.Practices.EnterpriseLibrary.Common.Properties.Resources.ExceptionNoConfigurationObjectPolicySet"> + <summary> + Looks up a localized string similar to No policy specifying the configuration source for the container has been set. The EnterpriseLibraryCoreExtension is probably missing.. + </summary> + </member> + <member name="P:Microsoft.Practices.EnterpriseLibrary.Common.Properties.Resources.ExceptionNoMatchingConstructorFound"> + <summary> + Looks up a localized string similar to No public constructor with {1} arguments was found for type "{0}".. + </summary> + </member> + <member name="P:Microsoft.Practices.EnterpriseLibrary.Common.Properties.Resources.ExceptionNoMethodAnnotatedForInjectionFound"> + <summary> + Looks up a localized string similar to The type {0} does not have a public method annotated as an injection target as required by the use of injection.. + </summary> + </member> + <member name="P:Microsoft.Practices.EnterpriseLibrary.Common.Properties.Resources.ExceptionNoSuitableFactoryMethodFound"> + <summary> + Looks up a localized string similar to The type {0} does not have a static method with a TargetConstructorAttribuite suitable to create an object of type {1}.. + </summary> + </member> + <member name="P:Microsoft.Practices.EnterpriseLibrary.Common.Properties.Resources.ExceptionNoTypeAttribute"> + <summary> + Looks up a localized string similar to The type attribute does not exist on the element {0}.. + </summary> + </member> + <member name="P:Microsoft.Practices.EnterpriseLibrary.Common.Properties.Resources.ExceptionParameterNotAnnotatedForInjection"> + <summary> + Looks up a localized string similar to The parameter '{0}' for injection target '{1}' in type '{2}' is missing the injection interpretation attribute.. + </summary> + </member> + <member name="P:Microsoft.Practices.EnterpriseLibrary.Common.Properties.Resources.ExceptionPerformanceCounterRedefined"> + <summary> + Looks up a localized string similar to The performance counter '{0}' in category '{1}' is redefined in type {2} with a different configuration.. + </summary> + </member> + <member name="P:Microsoft.Practices.EnterpriseLibrary.Common.Properties.Resources.ExceptionPolicyBuilderFinished"> + <summary> + Looks up a localized string similar to Attempt to continue working with a PolicyBuilder after the policies have been added to a policy list for type '{1}' with key '{0}'.. + </summary> + </member> + <member name="P:Microsoft.Practices.EnterpriseLibrary.Common.Properties.Resources.ExceptionPolicyBuilderStillWaitingForPropertyPolicy"> + <summary> + Looks up a localized string similar to The specified policies cannot be added: a property policy mapping is still taking place.. + </summary> + </member> + <member name="P:Microsoft.Practices.EnterpriseLibrary.Common.Properties.Resources.ExceptionPropertyAccessExpressionNotPropertyAccess"> + <summary> + Looks up a localized string similar to The supplied expression is not a valid property access expression: '{0}'.. + </summary> + </member> + <member name="P:Microsoft.Practices.EnterpriseLibrary.Common.Properties.Resources.ExceptionPropertyNotFound"> + <summary> + Looks up a localized string similar to e {2}.. + </summary> + </member> + <member name="P:Microsoft.Practices.EnterpriseLibrary.Common.Properties.Resources.ExceptionRetrievalAttributeNotFound"> + <summary> + Looks up a localized string similar to The type {0} does not contain the ConfigurationDataRetrievalAttribute required to resolve named references.. + </summary> + </member> + <member name="P:Microsoft.Practices.EnterpriseLibrary.Common.Properties.Resources.ExceptionSourcePropertyDoesNotExist"> + <summary> + Looks up a localized string similar to Could not retrieve parameter value. The property {0} does not exist for type {1}.. + </summary> + </member> + <member name="P:Microsoft.Practices.EnterpriseLibrary.Common.Properties.Resources.ExceptionStringNullOrEmpty"> + <summary> + Looks up a localized string similar to The value can not be null or string or empty.. + </summary> + </member> + <member name="P:Microsoft.Practices.EnterpriseLibrary.Common.Properties.Resources.ExceptionSuppliedCreationExpressionIsNotNewExpression"> + <summary> + Looks up a localized string similar to A creation expression must be a constructor call, but the supplied expression was '{0}'.. + </summary> + </member> + <member name="P:Microsoft.Practices.EnterpriseLibrary.Common.Properties.Resources.ExceptionSystemSourceNotDefined"> + <summary> + Looks up a localized string similar to The system configuration source is not defined in the configuration file.. + </summary> + </member> + <member name="P:Microsoft.Practices.EnterpriseLibrary.Common.Properties.Resources.ExceptionTheSpecifiedDefaultProviderDoesNotExistInConfiguration"> + <summary> + Looks up a localized string similar to The configuration object for default provider named '{0}' for type '{1}' was not found in the supplied list.. + </summary> + </member> + <member name="P:Microsoft.Practices.EnterpriseLibrary.Common.Properties.Resources.ExceptionTypeCouldNotBeCreated"> + <summary> + Looks up a localized string similar to The type {0} from configuration could not be created.. + </summary> + </member> + <member name="P:Microsoft.Practices.EnterpriseLibrary.Common.Properties.Resources.ExceptionTypeNotCustomFactory"> + <summary> + Looks up a localized string similar to Type {0} is not an implementation of ICustomFactory for CustomFactoryAttribute.. + </summary> + </member> + <member name="P:Microsoft.Practices.EnterpriseLibrary.Common.Properties.Resources.ExceptionTypeNotNameMapper"> + <summary> + Looks up a localized string similar to Type {0} is not an implementation of IConfigurationNameMapper for ConfigurationNameMapperAttribute.. + </summary> + </member> + <member name="P:Microsoft.Practices.EnterpriseLibrary.Common.Properties.Resources.ExceptionTypeNotRetriever"> + <summary> + Looks up a localized string similar to Type {0} is not an implementation of IConfigurationDataRetriever for ConfigurationDataRetrievalAttribute.. + </summary> + </member> + <member name="P:Microsoft.Practices.EnterpriseLibrary.Common.Properties.Resources.ExceptionUnableToMatchConstructorToConfigurationObject"> + <summary> + Looks up a localized string similar to Default policy creation failed: The properties in the supplied configuration object of type {0} cannot be matched to any constructor on type {1}.. + </summary> + </member> + <member name="P:Microsoft.Practices.EnterpriseLibrary.Common.Properties.Resources.ExceptionUnexpectedType"> + <summary> + Looks up a localized string similar to The expected type '{0}' was not provided.. + </summary> + </member> + <member name="P:Microsoft.Practices.EnterpriseLibrary.Common.Properties.Resources.ExceptionUnknownResolveMethod"> + <summary> + Looks up a localized string similar to An call to an unknown method named '{0}' in the Resolve class was found in the supplied argument expression: '{1}'. Cannot create policies for this expression.. + </summary> + </member> + <member name="P:Microsoft.Practices.EnterpriseLibrary.Common.Properties.Resources.FileConfigurationSourceName"> + <summary> + Looks up a localized string similar to File Configuration Source. + </summary> + </member> + <member name="P:Microsoft.Practices.EnterpriseLibrary.Common.Properties.Resources.SystemConfigurationSourceName"> + <summary> + Looks up a localized string similar to System Configuration Source. + </summary> + </member> + <member name="T:Microsoft.Practices.EnterpriseLibrary.Common.Configuration.AssemblyQualifiedTypeNameConverter"> + <summary> + Represents a configuration converter that converts a string to <see cref="T:System.Type"/> based on a fully qualified name. + </summary> + </member> + <member name="M:Microsoft.Practices.EnterpriseLibrary.Common.Configuration.AssemblyQualifiedTypeNameConverter.ConvertTo(System.ComponentModel.ITypeDescriptorContext,System.Globalization.CultureInfo,System.Object,System.Type)"> + <summary> + Returns the assembly qualified name for the passed in Type. + </summary> + <param name="context">The container representing this System.ComponentModel.TypeDescriptor.</param> + <param name="culture">Culture info for assembly</param> + <param name="value">Value to convert.</param> + <param name="destinationType">Type to convert to.</param> + <returns>Assembly Qualified Name as a string</returns> + </member> + <member name="M:Microsoft.Practices.EnterpriseLibrary.Common.Configuration.AssemblyQualifiedTypeNameConverter.ConvertFrom(System.ComponentModel.ITypeDescriptorContext,System.Globalization.CultureInfo,System.Object)"> + <summary> + Returns a type based on the assembly qualified name passed in as data. + </summary> + <param name="context">The container representing this System.ComponentModel.TypeDescriptor.</param> + <param name="culture">Culture info for assembly.</param> + <param name="value">Data to convert.</param> + <returns>Type of the data</returns> + </member> + <member name="T:Microsoft.Practices.EnterpriseLibrary.Common.Configuration.BaseFileConfigurationSourceImplementation"> + <summary> + This type supports the Enterprise Library infrastructure and is not intended to be used directly from your code. + Represents the implementation details for file-based configuration sources. + </summary> + <remarks> + This implementation deals with setting up the watcher over the configuration files to detect changes and update + the configuration representation. It also manages the change notification features provided by the file based + configuration sources. + </remarks> + </member> + <member name="F:Microsoft.Practices.EnterpriseLibrary.Common.Configuration.BaseFileConfigurationSourceImplementation.NullConfigSource"> + <summary> + This field supports the Enterprise Library infrastructure and is not intended to be used directly from your code. + ConfigSource value for sections that existed in configuration but were later removed. + </summary> + </member> + <member name="M:Microsoft.Practices.EnterpriseLibrary.Common.Configuration.BaseFileConfigurationSourceImplementation.#ctor(System.String,System.Boolean)"> + <summary> + This method supports the Enterprise Library infrastructure and is not intended to be used directly from your code. + Initializes a new instance of the <see cref="T:Microsoft.Practices.EnterpriseLibrary.Common.Configuration.FileConfigurationSourceImplementation"/> class. + </summary> + <param name="configurationFilepath">The path for the main configuration file.</param> + <param name="refresh"><b>true</b>if runtime changes should be refreshed, <b>false</b> otherwise.</param> + </member> + <member name="M:Microsoft.Practices.EnterpriseLibrary.Common.Configuration.BaseFileConfigurationSourceImplementation.#ctor(System.String)"> + <summary> + This method supports the Enterprise Library infrastructure and is not intended to be used directly from your code. + Initializes a new instance of the <see cref="T:Microsoft.Practices.EnterpriseLibrary.Common.Configuration.FileConfigurationSourceImplementation"/> class. + </summary> + <param name="configurationFilepath">The path for the main configuration file.</param> + </member> + <member name="M:Microsoft.Practices.EnterpriseLibrary.Common.Configuration.BaseFileConfigurationSourceImplementation.AddSectionChangeHandler(System.String,Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ConfigurationChangedEventHandler)"> + <summary> + This method supports the Enterprise Library infrastructure and is not intended to be used directly from your code. + Adds a handler to be called when changes to section <code>sectionName</code> are detected. + </summary> + <param name="sectionName">The name of the section to watch for.</param> + <param name="handler">The handler.</param> + </member> + <member name="M:Microsoft.Practices.EnterpriseLibrary.Common.Configuration.BaseFileConfigurationSourceImplementation.ConfigSourceChanged(System.String)"> + <summary> + This method supports the Enterprise Library infrastructure and is not intended to be used directly from your code. + </summary> + <param name="configSource">The name of the updated configuration source.</param> + <devdoc> + Only needs to deal with concurrency to get the current sections and to update the watchers. + + Rationale: + - Sections' are only added or updated. + - For this notification, all sections in the config file must be updated, and sections in external + files must be refreshed only if the config source changed. + - why not check after the original set of sections is retrieved? + -- Sections might have been added to the listener set after the original set is retrieved, but... + -- If they were added after the original set was retrieved, then they are up to date. + --- For this to happen, they couldn't have been read before the o.s., otherwise they would be a listener for them. + --- So, the retrieved information must be fresh (checked this with a test). + -- What about other changes? + --- Erased sections: only tested in the config file watching thread, because the meta configuration + is kept in the configuration file. + ---- Even if the external file an external is deleted because of the deletion, and this change is processed + before the config file change, the refresh for the external section will refresh all the sections for the file and + notify a change, without need for checking the change. The change would later be picked up by the config file watcher + which will notify again. This shouldn't be a problem. + --- External sections with changed sources. If they existed before, they must have been in the config file and there + was an entry in the bookeeping data structures. + - Concurrent updates for sections values should be handled by the system.config fx + </devdoc> + </member> + <member name="M:Microsoft.Practices.EnterpriseLibrary.Common.Configuration.BaseFileConfigurationSourceImplementation.Dispose"> + <summary> + Releases the resources used by the change watchers. + </summary> + </member> + <member name="M:Microsoft.Practices.EnterpriseLibrary.Common.Configuration.BaseFileConfigurationSourceImplementation.ExternalConfigSourceChanged(System.String)"> + <summary> + This method supports the Enterprise Library infrastructure and is not intended to be used directly from your code. + </summary> + <param name="configSource">The name of the updated configuration source.</param> + </member> + <member name="M:Microsoft.Practices.EnterpriseLibrary.Common.Configuration.BaseFileConfigurationSourceImplementation.GetSection(System.String)"> + <summary> + This method supports the Enterprise Library infrastructure and is not intended to be used directly from your code. + Retrieves the specified <see cref="T:System.Configuration.ConfigurationSection"/> from the configuration file, and starts watching for + its changes if not watching already. + </summary> + <param name="sectionName">The section name.</param> + <returns>The section, or <see langword="null"/> if it doesn't exist.</returns> + </member> + <member name="M:Microsoft.Practices.EnterpriseLibrary.Common.Configuration.BaseFileConfigurationSourceImplementation.RefreshAndValidateSections(System.Collections.Generic.IDictionary{System.String,System.String},System.Collections.Generic.IDictionary{System.String,System.String},System.Collections.Generic.ICollection{System.String}@,System.Collections.Generic.IDictionary{System.String,System.String}@)"> + <summary> + ... [truncated message content] |