* InputCircle.cs: An input control specialized for circle selection
* UserCard.cs: Displays user informations on a little div * Estim.cs: * WebControls.csproj: * CircleInfo.cs: * CircleProvider.cs: * CircleApiController.cs: * BasketApiController.cs: * ITContentProvider.csproj: * CalendarApiController.cs: * WorkFlowApiController.cs: * NpgsqlCircleProvider.cs: * FrontOfficeApiController.cs: * InputUserName.cs: Fixes the ToolBoxData attribute * Web.csproj: * Circle.cs: refactoring * instdbws.sql: Foreign keys are cascading updates and deletions * Estim.tt: * Profile.cs: User's profile does not contain anymore the main e-mail address, it conflicts with registration informations, it is not part of the profile data
This commit is contained in:
@ -1,3 +1,7 @@
|
||||
2015-06-10 Paul Schneider <paul@pschneider.fr>
|
||||
|
||||
* ITContentProvider.csproj:
|
||||
|
||||
2015-06-09 Paul Schneider <paul@pschneider.fr>
|
||||
|
||||
* ITContentProvider.csproj: Helps to fix packaging, and cleans
|
||||
|
@ -66,7 +66,9 @@
|
||||
<Folder Include="Views\Modules\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Views\Modules\IT\Index.aspx" />
|
||||
<Content Include="Views\Modules\IT\Index.aspx">
|
||||
<DeployService-Deploy>True</DeployService-Deploy>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
|
@ -1,3 +1,7 @@
|
||||
2015-06-10 Paul Schneider <paul@pschneider.fr>
|
||||
|
||||
* NpgsqlCircleProvider.cs:
|
||||
|
||||
2015-06-10 Paul Schneider <paul@pschneider.fr>
|
||||
|
||||
* NpgsqlCircleProvider.cs: implements a Circle provider
|
||||
|
@ -22,6 +22,9 @@ using System;
|
||||
using Yavsc.Model.Circles;
|
||||
using System.Collections.Specialized;
|
||||
using System.Configuration;
|
||||
using Npgsql;
|
||||
using NpgsqlTypes;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace WorkFlowProvider
|
||||
{
|
||||
@ -38,45 +41,172 @@ namespace WorkFlowProvider
|
||||
}
|
||||
|
||||
#region implemented abstract members of CircleProvider
|
||||
|
||||
/// <summary>
|
||||
/// Add the specified user.
|
||||
/// </summary>
|
||||
/// <param name="id">circle Identifier.</param>
|
||||
/// <param name="username">User name.</param>
|
||||
public override void Add (long id, string username)
|
||||
{
|
||||
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString))
|
||||
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
|
||||
cmd.CommandText = "insert into circle_members (circle_id, member) values (:cid,:uname)";
|
||||
cmd.Parameters.AddWithValue("cid",id);
|
||||
cmd.Parameters.AddWithValue("uname",username);
|
||||
cnx.Open ();
|
||||
cmd.ExecuteNonQuery ();
|
||||
cnx.Close ();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Remove the specified user.
|
||||
/// </summary>
|
||||
/// <param name="id">circle Identifier.</param>
|
||||
/// <param name="username">User name.</param>
|
||||
public override void Remove (long id, string username)
|
||||
{
|
||||
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString))
|
||||
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
|
||||
cmd.CommandText = "delete from circle_members where circle_id = :cid and username = :uname";
|
||||
cmd.Parameters.AddWithValue("cid",id);
|
||||
cmd.Parameters.AddWithValue("uname",username);
|
||||
cnx.Open ();
|
||||
cmd.ExecuteNonQuery ();
|
||||
cnx.Close ();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the specified id.
|
||||
/// </summary>
|
||||
/// <param name="id">Identifier.</param>
|
||||
public override Circle Get (long id)
|
||||
{
|
||||
Circle circ=null;
|
||||
|
||||
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString)) {
|
||||
cnx.Open ();
|
||||
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
|
||||
cmd.CommandText = "select title, owner from circle where _id = :cid";
|
||||
cmd.Parameters.AddWithValue ("cid", id);
|
||||
using (NpgsqlDataReader dr = cmd.ExecuteReader ()) {
|
||||
if (dr.Read ()) {
|
||||
circ = new Circle ();
|
||||
circ.Id = id;
|
||||
circ.Title = dr.GetString (
|
||||
dr.GetOrdinal ("title"));
|
||||
circ.Owner = dr.GetString (
|
||||
dr.GetOrdinal ("owner"));
|
||||
}
|
||||
dr.Close ();
|
||||
}
|
||||
}
|
||||
|
||||
if (circ != null) {
|
||||
|
||||
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
|
||||
cmd.CommandText = "select member from circle_members where circle_id = :cid";
|
||||
cmd.Parameters.AddWithValue ("cid", id);
|
||||
cmd.Prepare ();
|
||||
List<string> members = new List<string> ();
|
||||
using (NpgsqlDataReader dr = cmd.ExecuteReader ()) {
|
||||
while (dr.Read ())
|
||||
members.Add (dr.GetString (0));
|
||||
dr.Close ();
|
||||
circ.Members = members.ToArray ();
|
||||
}
|
||||
}
|
||||
}
|
||||
cnx.Close ();
|
||||
}
|
||||
return circ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add the specified owner, title and users.
|
||||
/// </summary>
|
||||
/// <param name="owner">Owner.</param>
|
||||
/// <param name="title">Title.</param>
|
||||
/// <param name="users">Users.</param>
|
||||
public override void Add (string owner, string title, string[] users)
|
||||
public override long Create (string owner, string title, string[] users)
|
||||
{
|
||||
long id = 0;
|
||||
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString)) {
|
||||
cnx.Open ();
|
||||
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
|
||||
cmd.CommandText = "insert into circle (owner,title,applicationname) values (:wnr,:tit,:app) returning _id";
|
||||
cmd.Parameters.AddWithValue ("wnr", owner);
|
||||
cmd.Parameters.AddWithValue ("tit", title);
|
||||
cmd.Parameters.AddWithValue ("app", applicationName);
|
||||
id = (long)cmd.ExecuteScalar ();
|
||||
}
|
||||
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
|
||||
cmd.CommandText = "insert into circle_members (circle_id,member) values (@cid,@mbr)";
|
||||
cmd.Parameters.AddWithValue ("cid", id);
|
||||
cmd.Parameters.Add ("mbr", NpgsqlDbType.Varchar);
|
||||
cmd.Prepare ();
|
||||
foreach (string user in users) {
|
||||
cmd.Parameters[1].Value = user;
|
||||
cmd.ExecuteNonQuery ();
|
||||
}
|
||||
}
|
||||
cnx.Close ();
|
||||
}
|
||||
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Delete the specified owner and title.
|
||||
/// </summary>
|
||||
/// <param name="owner">Owner.</param>
|
||||
/// <param name="title">Title.</param>
|
||||
public override void Delete (string owner, string title)
|
||||
/// <param name="id">Identifier.</param>
|
||||
public override void Delete (long id)
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString))
|
||||
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
|
||||
cmd.CommandText = "delete from circle where _id = @cid";
|
||||
cmd.Parameters.AddWithValue("cid",id);
|
||||
cnx.Open ();
|
||||
cmd.ExecuteNonQuery ();
|
||||
cnx.Close ();
|
||||
}
|
||||
/// <summary>
|
||||
/// Get the specified owner and title.
|
||||
/// </summary>
|
||||
/// <param name="owner">Owner.</param>
|
||||
/// <param name="title">Title.</param>
|
||||
public override Circle Get (string owner, string title)
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// List this instance.
|
||||
/// List user's circles.
|
||||
/// </summary>
|
||||
public override CircleInfoCollection List ()
|
||||
/// <param name="user">User.</param>
|
||||
public override CircleInfoCollection List (string user)
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
CircleInfoCollection cc = null;
|
||||
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString))
|
||||
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
|
||||
cmd.CommandText = "select _id, title from circle where owner = :wnr";
|
||||
cmd.Parameters.AddWithValue("wnr",user);
|
||||
cnx.Open ();
|
||||
cmd.Prepare ();
|
||||
using (NpgsqlDataReader rdr = cmd.ExecuteReader ()) {
|
||||
if (rdr.HasRows) {
|
||||
cc = new CircleInfoCollection ();
|
||||
while (rdr.Read ())
|
||||
cc.Add(
|
||||
new CircleInfo (
|
||||
rdr.GetInt64 (0),
|
||||
rdr.GetString (1)));
|
||||
}
|
||||
rdr.Close ();
|
||||
}
|
||||
cnx.Close ();
|
||||
|
||||
}
|
||||
return cc;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
string cnxstr = null;
|
||||
string connectionString = null;
|
||||
string applicationName = null;
|
||||
/// <summary>
|
||||
/// Initialize this object using the specified name and config.
|
||||
@ -88,7 +218,7 @@ namespace WorkFlowProvider
|
||||
if ( string.IsNullOrWhiteSpace(config ["connectionStringName"]))
|
||||
throw new ConfigurationErrorsException ("No name for Npgsql connection string found");
|
||||
|
||||
cnxstr = ConfigurationManager.ConnectionStrings [config ["connectionStringName"]].ConnectionString;
|
||||
connectionString = ConfigurationManager.ConnectionStrings [config ["connectionStringName"]].ConnectionString;
|
||||
applicationName = config["applicationName"] ?? "/";
|
||||
}
|
||||
|
||||
|
11
WebControls/ChangeLog
Normal file
11
WebControls/ChangeLog
Normal file
@ -0,0 +1,11 @@
|
||||
2015-06-10 Paul Schneider <paul@pschneider.fr>
|
||||
|
||||
* InputCircle.cs: An input control specialized for circle
|
||||
selection
|
||||
|
||||
* UserCard.cs: Displays user informations on a little div
|
||||
|
||||
* InputUserName.cs: Fixes the ToolBoxData attribute
|
||||
|
||||
* WebControls.csproj:
|
||||
|
163
WebControls/InputCircle.cs
Normal file
163
WebControls/InputCircle.cs
Normal file
@ -0,0 +1,163 @@
|
||||
//
|
||||
// InputCircle.cs
|
||||
//
|
||||
// Author:
|
||||
// Paul Schneider <paul@pschneider.fr>
|
||||
//
|
||||
// Copyright (c) 2015 GNU GPL
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Lesser General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
using System;
|
||||
using System.Web;
|
||||
using System.Security.Permissions;
|
||||
using System.Web.UI;
|
||||
using System.ComponentModel;
|
||||
using System.Web.UI.WebControls;
|
||||
using Yavsc.Model.Circles;
|
||||
using System.Web.Security;
|
||||
|
||||
namespace WebControls
|
||||
{
|
||||
/// <summary>
|
||||
/// Input circle.
|
||||
/// </summary>
|
||||
[
|
||||
AspNetHostingPermission (SecurityAction.Demand,
|
||||
Level = AspNetHostingPermissionLevel.Minimal),
|
||||
AspNetHostingPermission (SecurityAction.InheritanceDemand,
|
||||
Level = AspNetHostingPermissionLevel.Minimal),
|
||||
ParseChildren (true),
|
||||
DefaultProperty ("Name"),
|
||||
ToolboxData ("<{0}:InputCircle runat=\"server\"> </{0}:InputCircle>")
|
||||
]
|
||||
public class InputCircle: WebControl
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="WebControls.InputCircle"/> class.
|
||||
/// </summary>
|
||||
public InputCircle ()
|
||||
{
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets or sets the name.
|
||||
/// </summary>
|
||||
/// <value>The name.</value>
|
||||
[Bindable (true), DefaultValue(""), Localizable(true)]
|
||||
public string Name {
|
||||
get {
|
||||
return (string) ViewState["Name"];
|
||||
}
|
||||
set {
|
||||
ViewState ["Name"] = value;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets or sets the value.
|
||||
/// </summary>
|
||||
/// <value>The value.</value>
|
||||
[Bindable (true), DefaultValue(""), Localizable(true)]
|
||||
public string Value {
|
||||
get {
|
||||
return (string) ViewState["Value"];
|
||||
}
|
||||
set {
|
||||
ViewState ["Value"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the on change.
|
||||
/// </summary>
|
||||
/// <value>The on change.</value>
|
||||
[Bindable (true), DefaultValue(""), Localizable(false)]
|
||||
public string OnChange {
|
||||
get {
|
||||
return (string) ViewState["OnChange"];
|
||||
}
|
||||
set {
|
||||
ViewState ["OnChange"] = value;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether this <see cref="Yavsc.WebControls.InputUserName"/> is multiple.
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if multiple; otherwise, <c>false</c>.</value>
|
||||
[Bindable (true), DefaultValue(false)]
|
||||
public bool Multiple {
|
||||
get {
|
||||
|
||||
return (bool) ViewState["Multiple"];
|
||||
}
|
||||
set {
|
||||
ViewState ["Multiple"] = value;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the empty value.
|
||||
/// </summary>
|
||||
/// <value>The empty value.</value>
|
||||
[Bindable (true), DefaultValue(null)]
|
||||
public string EmptyValue {
|
||||
get {
|
||||
return (string) ViewState["EmptyValue"];
|
||||
}
|
||||
set {
|
||||
ViewState ["EmptyValue"] = value;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Renders the contents.
|
||||
/// </summary>
|
||||
/// <param name="writer">Writer.</param>
|
||||
protected override void RenderContents (HtmlTextWriter writer)
|
||||
{
|
||||
writer.AddAttribute ("id", ID);
|
||||
writer.AddAttribute ("name", Name);
|
||||
writer.AddAttribute ("class", CssClass);
|
||||
if (!string.IsNullOrWhiteSpace(OnChange))
|
||||
writer.AddAttribute ("onchange", OnChange);
|
||||
if (Multiple)
|
||||
writer.AddAttribute ("multiple","true");
|
||||
writer.RenderBeginTag ("select");
|
||||
string[] selected = null;
|
||||
if (!string.IsNullOrWhiteSpace (Value)) {
|
||||
selected = Value.Split (',');
|
||||
}
|
||||
if (EmptyValue!=null) {
|
||||
writer.AddAttribute ("value", "");
|
||||
writer.RenderBeginTag ("option");
|
||||
writer.Write (EmptyValue);
|
||||
writer.RenderEndTag ();
|
||||
}
|
||||
var u = Membership.GetUser ();
|
||||
if (u != null) {
|
||||
foreach (CircleInfo ci in CircleManager.DefaultProvider.List(u.UserName)) {
|
||||
if (selected != null)
|
||||
if (Array.Exists (selected, x => x == ci.Id.ToString ()))
|
||||
writer.AddAttribute ("selected", null);
|
||||
writer.AddAttribute ("value", ci.Id.ToString ());
|
||||
writer.RenderBeginTag ("option");
|
||||
writer.Write (ci.Title);
|
||||
writer.RenderEndTag ();
|
||||
}
|
||||
}
|
||||
writer.RenderEndTag ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ namespace Yavsc.WebControls
|
||||
Level = AspNetHostingPermissionLevel.Minimal),
|
||||
ParseChildren (true),
|
||||
DefaultProperty ("Name"),
|
||||
ToolboxData ("<{0}:ResultPages runat=\"server\"> </{0}:ResultPages>")
|
||||
ToolboxData ("<{0}:InputUserName runat=\"server\"> </{0}:InputUserName>")
|
||||
]
|
||||
public class InputUserName: WebControl
|
||||
{
|
||||
@ -70,9 +70,7 @@ namespace Yavsc.WebControls
|
||||
/// Gets or sets the value.
|
||||
/// </summary>
|
||||
/// <value>The value.</value>
|
||||
[Bindable (true)]
|
||||
[DefaultValue("")]
|
||||
[Localizable(true)]
|
||||
[Bindable (true),DefaultValue(""),Localizable(true)]
|
||||
public string Value {
|
||||
get {
|
||||
return (string) ViewState["Value"];
|
||||
@ -82,9 +80,11 @@ namespace Yavsc.WebControls
|
||||
}
|
||||
}
|
||||
|
||||
[Bindable (true)]
|
||||
[DefaultValue("")]
|
||||
[Localizable(false)]
|
||||
/// <summary>
|
||||
/// Gets or sets the client side action on change.
|
||||
/// </summary>
|
||||
/// <value>The on change.</value>
|
||||
[Bindable (true),DefaultValue(""),Localizable(false)]
|
||||
public string OnChange {
|
||||
get {
|
||||
return (string) ViewState["OnChange"];
|
||||
@ -99,9 +99,7 @@ namespace Yavsc.WebControls
|
||||
/// Gets or sets the in role.
|
||||
/// </summary>
|
||||
/// <value>The in role.</value>
|
||||
[Bindable (true)]
|
||||
[DefaultValue("")]
|
||||
[Localizable(true)]
|
||||
[Bindable (true),DefaultValue(""),Localizable(true)]
|
||||
public string InRole {
|
||||
get {
|
||||
return (string) ViewState["InRole"];
|
||||
@ -115,8 +113,7 @@ namespace Yavsc.WebControls
|
||||
/// Gets or sets a value indicating whether this <see cref="Yavsc.WebControls.InputUserName"/> is multiple.
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if multiple; otherwise, <c>false</c>.</value>
|
||||
[Bindable (true)]
|
||||
[DefaultValue(false)]
|
||||
[Bindable (true), DefaultValue(false)]
|
||||
public bool Multiple {
|
||||
get {
|
||||
|
||||
@ -128,9 +125,11 @@ namespace Yavsc.WebControls
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Bindable (true)]
|
||||
[DefaultValue(null)]
|
||||
/// <summary>
|
||||
/// Gets or sets the empty value.
|
||||
/// </summary>
|
||||
/// <value>The empty value.</value>
|
||||
[Bindable (true), DefaultValue(null)]
|
||||
public string EmptyValue {
|
||||
get {
|
||||
return (string) ViewState["EmptyValue"];
|
||||
|
81
WebControls/UserCard.cs
Normal file
81
WebControls/UserCard.cs
Normal file
@ -0,0 +1,81 @@
|
||||
//
|
||||
// UserCard.cs
|
||||
//
|
||||
// Author:
|
||||
// Paul Schneider <paul@pschneider.fr>
|
||||
//
|
||||
// Copyright (c) 2015 GNU GPL
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Lesser General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
using System;
|
||||
using System.Web.UI.WebControls;
|
||||
using System.Web;
|
||||
using System.Security.Permissions;
|
||||
using System.Web.UI;
|
||||
using System.ComponentModel;
|
||||
using System.Web.Security;
|
||||
|
||||
namespace WebControls
|
||||
{
|
||||
[
|
||||
AspNetHostingPermission (SecurityAction.Demand,
|
||||
Level = AspNetHostingPermissionLevel.Minimal),
|
||||
AspNetHostingPermission (SecurityAction.InheritanceDemand,
|
||||
Level = AspNetHostingPermissionLevel.Minimal),
|
||||
ParseChildren (true),
|
||||
DefaultProperty ("Name"),
|
||||
ToolboxData ("<{0}:UserCard runat=\"server\"> </{0}:UserCard>")
|
||||
]
|
||||
/// <summary>
|
||||
/// User card.
|
||||
/// </summary>
|
||||
public class UserCard: WebControl
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="WebControls.UserCard"/> class.
|
||||
/// </summary>
|
||||
public UserCard ()
|
||||
{
|
||||
}
|
||||
|
||||
[Bindable (true), DefaultValue(""), Localizable(false)]
|
||||
string UserName { get; set; }
|
||||
|
||||
[Bindable (true), DefaultValue("(<a href=\"/Account/Profile\">You</a>)"), Localizable(true)]
|
||||
string yourTag { get; set; }
|
||||
/// <summary>
|
||||
/// Renders the contents.
|
||||
/// </summary>
|
||||
/// <param name="writer">Writer.</param>
|
||||
protected override void RenderContents (HtmlTextWriter writer)
|
||||
{
|
||||
if (UserName != null) {
|
||||
// icon, stats
|
||||
|
||||
writer.AddAttribute ("id", ID);
|
||||
writer.AddAttribute ("class", CssClass);
|
||||
writer.RenderBeginTag ("div");
|
||||
writer.Write (UserName+" ");
|
||||
var vuser = Membership.GetUser();
|
||||
if (vuser != null)
|
||||
if (vuser.UserName == UserName)
|
||||
writer.Write (yourTag);
|
||||
writer.RenderEndTag ();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -39,11 +39,20 @@
|
||||
<Reference Include="System.Web.Mvc" />
|
||||
<Reference Include="System.Web.Http" />
|
||||
<Reference Include="System.Web.ApplicationServices" />
|
||||
<Reference Include="System.Configuration" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="ResultPages.cs" />
|
||||
<Compile Include="InputUserName.cs" />
|
||||
<Compile Include="InputCircle.cs" />
|
||||
<Compile Include="UserCard.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\yavscModel\YavscModel.csproj">
|
||||
<Project>{68F5B80A-616E-4C3C-91A0-828AA40000BD}</Project>
|
||||
<Name>YavscModel</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
</Project>
|
@ -15,7 +15,7 @@ namespace Yavsc.ApiControllers
|
||||
/// Maintains a collection of articles
|
||||
/// qualified with name value pairs
|
||||
/// </summary>
|
||||
public class BasketController : ApiController
|
||||
public class BasketApiController : ApiController
|
||||
{
|
||||
/// <summary>
|
||||
/// The wfmgr.
|
@ -34,7 +34,7 @@ namespace Yavsc.ApiControllers
|
||||
/// <summary>
|
||||
/// Night flash controller.
|
||||
/// </summary>
|
||||
public class CalendarController: ApiController
|
||||
public class CalendarApiController: ApiController
|
||||
{
|
||||
YaEvent[] getTestList()
|
||||
{
|
@ -30,50 +30,71 @@ namespace Yavsc.ApiControllers
|
||||
/// <summary>
|
||||
/// Circle controller.
|
||||
/// </summary>
|
||||
public class CircleController : ApiController
|
||||
public class CircleApiController : ApiController
|
||||
{
|
||||
/// <summary>
|
||||
/// Add the specified id and users.
|
||||
/// Creates the specified circle using the given title and user list.
|
||||
/// </summary>
|
||||
/// <param name="id">Identifier.</param>
|
||||
/// <param name="title">Title.</param>
|
||||
/// <param name="title">Identifier.</param>
|
||||
/// <param name="users">Users.</param>
|
||||
[Authorize]
|
||||
public void Add(string id, string [] users)
|
||||
public long Create(string title, string [] users)
|
||||
{
|
||||
string user = Membership.GetUser ().UserName;
|
||||
CircleManager.DefaultProvider.Add (user, id, users);
|
||||
}
|
||||
/// <summary>
|
||||
/// Delete the specified id.
|
||||
/// </summary>
|
||||
/// <param name="id">Identifier.</param>
|
||||
[Authorize] public void Delete(string id)
|
||||
{
|
||||
string user = Membership.GetUser ().UserName;
|
||||
CircleManager.DefaultProvider.Delete (user, id);
|
||||
return CircleManager.DefaultProvider.Create (user, title, users);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the specified id.
|
||||
/// Add the specified users to the circle.
|
||||
/// </summary>
|
||||
/// <param name="id">Circle Identifier.</param>
|
||||
/// <param name="username">username.</param>
|
||||
[Authorize]
|
||||
public void Add(long id, string username)
|
||||
{
|
||||
checkIsOwner (CircleManager.DefaultProvider.Get (id));
|
||||
CircleManager.DefaultProvider.Add (id, username);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Delete the circle specified by id.
|
||||
/// </summary>
|
||||
/// <param name="id">Identifier.</param>
|
||||
[Authorize] public void Delete(long id)
|
||||
{
|
||||
checkIsOwner (CircleManager.DefaultProvider.Get(id));
|
||||
CircleManager.DefaultProvider.Delete (id);
|
||||
}
|
||||
|
||||
private void checkIsOwner(Circle c)
|
||||
{
|
||||
string user = Membership.GetUser ().UserName;
|
||||
if (c.Owner != user)
|
||||
throw new AccessViolationException ("You're not owner of this circle");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the circle specified id.
|
||||
/// </summary>
|
||||
/// <param name="id">Identifier.</param>
|
||||
[Authorize]
|
||||
public Circle Get(string id)
|
||||
public Circle Get(long id)
|
||||
{
|
||||
string user = Membership.GetUser ().UserName;
|
||||
return CircleManager.DefaultProvider.Get (user, id);
|
||||
var c = CircleManager.DefaultProvider.Get (id);
|
||||
checkIsOwner (c);
|
||||
return c;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// List this instance.
|
||||
/// List the circles
|
||||
/// </summary>
|
||||
[Authorize]
|
||||
public CircleInfoCollection List()
|
||||
{
|
||||
string user = Membership.GetUser ().UserName;
|
||||
return CircleManager.DefaultProvider.List ();
|
||||
return CircleManager.DefaultProvider.List (user);
|
||||
}
|
||||
}
|
||||
}
|
@ -100,7 +100,6 @@ namespace Yavsc.ApiControllers
|
||||
Estimate e = wfmgr.GetEstimate (estimid);
|
||||
tmpe.Session = new Dictionary<string,object> ();
|
||||
tmpe.Session.Add ("estim", e);
|
||||
|
||||
Profile prpro = new Profile (ProfileBase.Create (e.Responsible));
|
||||
if (!prpro.HasBankAccount)
|
||||
throw new TemplateException ("NotBankable:" + e.Responsible);
|
||||
@ -114,6 +113,8 @@ namespace Yavsc.ApiControllers
|
||||
|
||||
tmpe.Session.Add ("from", prpro);
|
||||
tmpe.Session.Add ("to", prcli);
|
||||
tmpe.Session.Add ("efrom", Membership.GetUser (e.Responsible).Email);
|
||||
tmpe.Session.Add ("efrom", Membership.GetUser (e.Client).Email);
|
||||
tmpe.Init ();
|
||||
return tmpe.TransformText ();
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ namespace Yavsc.ApiControllers
|
||||
/// <summary>
|
||||
/// Work flow controller.
|
||||
/// </summary>
|
||||
public class WorkFlowController : ApiController
|
||||
public class WorkFlowApiController : ApiController
|
||||
{
|
||||
string adminRoleName="Admin";
|
||||
/// <summary>
|
@ -1,3 +1,21 @@
|
||||
2015-06-10 Paul Schneider <paul@pschneider.fr>
|
||||
|
||||
* Estim.cs:
|
||||
* BasketApiController.cs:
|
||||
* CircleApiController.cs:
|
||||
* CalendarApiController.cs:
|
||||
* WorkFlowApiController.cs:
|
||||
* FrontOfficeApiController.cs:
|
||||
|
||||
* Web.csproj: refactoring
|
||||
|
||||
* instdbws.sql: Foreign keys are cascading updates and
|
||||
deletions
|
||||
|
||||
* Estim.tt: User's profile does not contain anymore the main
|
||||
e-mail address, it conflicts with registration informations,
|
||||
it is not part of the profile data
|
||||
|
||||
2015-06-10 Paul Schneider <paul@pschneider.fr>
|
||||
|
||||
* CalendarController.cs: refactoring
|
||||
|
@ -126,6 +126,7 @@
|
||||
<Folder Include="Views\PayPal\" />
|
||||
<Folder Include="ApiControllers\" />
|
||||
<Folder Include="Views\Modules\" />
|
||||
<Folder Include="Views\Circle\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Controllers\HomeController.cs" />
|
||||
@ -173,21 +174,21 @@
|
||||
<Compile Include="Formatters\ErrorHtmlFormatter.cs" />
|
||||
<Compile Include="Formatters\RssFeedsFormatter.cs" />
|
||||
<Compile Include="Formatters\TexToPdfFormatter.cs" />
|
||||
<Compile Include="ApiControllers\BasketController.cs" />
|
||||
<Compile Include="ApiControllers\BlogsApiController.cs" />
|
||||
<Compile Include="ApiControllers\FrontOfficeApiController.cs" />
|
||||
<Compile Include="ApiControllers\PaypalApiController.cs" />
|
||||
<Compile Include="WebApiConfig.cs" />
|
||||
<Compile Include="ApiControllers\WorkFlowController.cs" />
|
||||
<Compile Include="IValueProvider.cs" />
|
||||
<Compile Include="Formatters\EstimToPdfFormatter.MSAN.cs" />
|
||||
<Compile Include="Helpers\TemplateException.cs" />
|
||||
<Compile Include="Helpers\MarkdownHelper.cs" />
|
||||
<Compile Include="ApiControllers\CalendarController.cs" />
|
||||
<Compile Include="Formatters\FormatterException.cs" />
|
||||
<Compile Include="NUnitTestClass.cs" />
|
||||
<Compile Include="TestExec.cs" />
|
||||
<Compile Include="ApiControllers\CircleController.cs" />
|
||||
<Compile Include="ApiControllers\CircleApiController.cs" />
|
||||
<Compile Include="ApiControllers\BasketApiController.cs" />
|
||||
<Compile Include="ApiControllers\CalendarApiController.cs" />
|
||||
<Compile Include="ApiControllers\WorkFlowApiController.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Views\Web.config" />
|
||||
|
@ -256,10 +256,10 @@ CREATE TABLE comment
|
||||
CONSTRAINT comment_pkey PRIMARY KEY (_id),
|
||||
CONSTRAINT fkey_blog FOREIGN KEY (postid)
|
||||
REFERENCES blog (_id) MATCH SIMPLE
|
||||
ON UPDATE NO ACTION ON DELETE NO ACTION,
|
||||
ON UPDATE CASCADE ON DELETE ,
|
||||
CONSTRAINT fkey_users FOREIGN KEY (username, applicationname)
|
||||
REFERENCES users (username, applicationname) MATCH SIMPLE
|
||||
ON UPDATE NO ACTION ON DELETE NO ACTION
|
||||
ON UPDATE CASCADE ON DELETE CASCADE
|
||||
)
|
||||
WITH (
|
||||
OIDS=FALSE
|
||||
@ -342,7 +342,7 @@ CREATE TABLE histoestim
|
||||
ON UPDATE CASCADE ON DELETE CASCADE,
|
||||
CONSTRAINT histoestim_username_fkey FOREIGN KEY (username, applicationname)
|
||||
REFERENCES users (username, applicationname) MATCH SIMPLE
|
||||
ON UPDATE NO ACTION ON DELETE NO ACTION
|
||||
ON UPDATE CASCADE ON DELETE CASCADE
|
||||
)
|
||||
WITH (
|
||||
OIDS=FALSE
|
||||
@ -401,7 +401,7 @@ CREATE TABLE projet
|
||||
CONSTRAINT projet_pk_new PRIMARY KEY (id),
|
||||
CONSTRAINT pk_project_manager FOREIGN KEY (managerid, "ApplicationName")
|
||||
REFERENCES users (username, applicationname) MATCH SIMPLE
|
||||
ON UPDATE NO ACTION ON DELETE NO ACTION
|
||||
ON UPDATE CASCADE ON DELETE CASCADE
|
||||
)
|
||||
WITH (
|
||||
OIDS=FALSE
|
||||
@ -427,7 +427,7 @@ CREATE TABLE stocksymbols
|
||||
stocksymbol character varying(10),
|
||||
CONSTRAINT fkprofiles1 FOREIGN KEY (uniqueid)
|
||||
REFERENCES profiles (uniqueid) MATCH SIMPLE
|
||||
ON UPDATE NO ACTION ON DELETE NO ACTION
|
||||
ON UPDATE CASCADE ON DELETE CASCADE
|
||||
)
|
||||
WITH (
|
||||
OIDS=FALSE
|
||||
@ -489,7 +489,7 @@ CREATE TABLE tasks
|
||||
CONSTRAINT tasks_pk_new PRIMARY KEY (id),
|
||||
CONSTRAINT tasks_fk_new FOREIGN KEY (prid)
|
||||
REFERENCES projet (id) MATCH SIMPLE
|
||||
ON UPDATE NO ACTION ON DELETE NO ACTION
|
||||
ON UPDATE CASCADE ON DELETE CASCADE
|
||||
)
|
||||
WITH (
|
||||
OIDS=FALSE
|
||||
@ -507,10 +507,10 @@ CREATE TABLE taskdeps
|
||||
CONSTRAINT pk_tasks_deps PRIMARY KEY ("taskId", deptask),
|
||||
CONSTRAINT pk_foreign_dep FOREIGN KEY (deptask)
|
||||
REFERENCES tasks (id) MATCH SIMPLE
|
||||
ON UPDATE NO ACTION ON DELETE NO ACTION,
|
||||
ON UPDATE CASCADE ON DELETE CASCADE,
|
||||
CONSTRAINT pk_foreign_task FOREIGN KEY ("taskId")
|
||||
REFERENCES tasks (id) MATCH SIMPLE
|
||||
ON UPDATE NO ACTION ON DELETE NO ACTION
|
||||
ON UPDATE CASCADE ON DELETE CASCADE
|
||||
)
|
||||
WITH (
|
||||
OIDS=FALSE
|
||||
@ -583,10 +583,10 @@ CREATE TABLE wrtags
|
||||
CONSTRAINT wrtags_pkey1 PRIMARY KEY (wrid, tagid),
|
||||
CONSTRAINT cstwrtagsref FOREIGN KEY (tagid)
|
||||
REFERENCES tag (_id) MATCH SIMPLE
|
||||
ON UPDATE NO ACTION ON DELETE NO ACTION,
|
||||
ON UPDATE CASCADE ON DELETE CASCADE,
|
||||
CONSTRAINT wrtags_wrid_fkey1 FOREIGN KEY (wrid)
|
||||
REFERENCES writtings (_id) MATCH SIMPLE
|
||||
ON UPDATE NO ACTION ON DELETE NO ACTION
|
||||
ON UPDATE CASCADE ON DELETE CASCADE
|
||||
)
|
||||
WITH (
|
||||
OIDS=FALSE
|
||||
@ -640,7 +640,7 @@ CREATE TABLE histowritting
|
||||
CONSTRAINT histowritting_pkey PRIMARY KEY (_id),
|
||||
CONSTRAINT histowritting_username_fkey FOREIGN KEY (username, applicationname)
|
||||
REFERENCES users (username, applicationname) MATCH SIMPLE
|
||||
ON UPDATE NO ACTION ON DELETE NO ACTION,
|
||||
ON UPDATE CASCADE ON DELETE CASCADE,
|
||||
CONSTRAINT histowritting_wrtid_fkey FOREIGN KEY (wrtid)
|
||||
REFERENCES writtings (_id) MATCH SIMPLE
|
||||
ON UPDATE CASCADE ON DELETE CASCADE
|
||||
@ -648,3 +648,44 @@ CREATE TABLE histowritting
|
||||
WITH (
|
||||
OIDS=FALSE
|
||||
);
|
||||
|
||||
-- Table: circle
|
||||
|
||||
-- DROP TABLE circle;
|
||||
|
||||
CREATE TABLE circle
|
||||
(
|
||||
_id serial NOT NULL, -- Circle identifier
|
||||
owner character varying(255), -- creator of this circle
|
||||
applicationname character varying(255), -- Application name
|
||||
CONSTRAINT circle_pkey PRIMARY KEY (_id),
|
||||
CONSTRAINT circle_owner_fkey FOREIGN KEY (owner, applicationname)
|
||||
REFERENCES users (username, applicationname) MATCH SIMPLE
|
||||
ON UPDATE CASCADE ON DELETE CASCADE
|
||||
)
|
||||
WITH (
|
||||
OIDS=FALSE
|
||||
);
|
||||
|
||||
COMMENT ON COLUMN circle._id IS 'Circle identifier';
|
||||
COMMENT ON COLUMN circle.owner IS 'creator of this circle';
|
||||
COMMENT ON COLUMN circle.applicationname IS 'Application name';
|
||||
|
||||
-- Table: circle_members
|
||||
|
||||
-- DROP TABLE circle_members;
|
||||
|
||||
CREATE TABLE circle_members
|
||||
(
|
||||
circle_id bigint NOT NULL,
|
||||
member character varying NOT NULL,
|
||||
CONSTRAINT circle_members_pkey PRIMARY KEY (circle_id, member),
|
||||
CONSTRAINT circle_members_member_fkey FOREIGN KEY (member)
|
||||
REFERENCES users (pkid) MATCH SIMPLE
|
||||
ON UPDATE CASCADE ON DELETE CASCADE
|
||||
)
|
||||
WITH (
|
||||
OIDS=FALSE
|
||||
);
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -11,6 +11,8 @@
|
||||
<#@ parameter type="Estimate" name="estim" #>
|
||||
<#@ parameter type="Profile" name="from" #>
|
||||
<#@ parameter type="Profile" name="to" #>
|
||||
<#@ parameter type="String" name="efrom" #>
|
||||
<#@ parameter type="String" name="eto" #>
|
||||
|
||||
\documentclass[french,11pt]{article}
|
||||
\usepackage{babel}
|
||||
@ -93,8 +95,8 @@
|
||||
<# if (!string.IsNullOrWhiteSpace(to.Mobile)) { #>
|
||||
Mobile: <#= to.Mobile #>\\
|
||||
<# } #>
|
||||
<# if (!string.IsNullOrWhiteSpace(to.Email)) { #>
|
||||
E-mail: <#= to.Email #><# } #>
|
||||
<# if (!string.IsNullOrWhiteSpace(eto)) { #>
|
||||
E-mail: <#= eto #><# } #>
|
||||
}
|
||||
|
||||
% Liste des produits facturés : Désignation, prix
|
||||
@ -120,7 +122,7 @@
|
||||
<# if (!string.IsNullOrWhiteSpace(from.Address)) { #> - <#= from.Address #><# } #>
|
||||
<# if (!string.IsNullOrWhiteSpace(from.CityAndState)) { #> - <#= from.CityAndState #><# } #> \newline
|
||||
\small{
|
||||
<# if (!string.IsNullOrWhiteSpace(from.Email)) { #>E-mail: <#= from.Email #><# } #>
|
||||
<# if (!string.IsNullOrWhiteSpace(efrom)) { #>E-mail: <#= efrom #><# } #>
|
||||
<# if (!string.IsNullOrWhiteSpace(from.Mobile)) { #> - Téléphone mobile: <#= from.Mobile #><# } #>
|
||||
<# if (!string.IsNullOrWhiteSpace(from.Phone)) { #> - Téléphone fixe: <#= from.Phone #><# } #>
|
||||
}
|
||||
|
@ -1,3 +1,14 @@
|
||||
2015-06-10 Paul Schneider <paul@pschneider.fr>
|
||||
|
||||
* Circle.cs: refactoring
|
||||
|
||||
* CircleInfo.cs:
|
||||
* CircleProvider.cs:
|
||||
|
||||
* Profile.cs: User's profile does not contain anymore the main
|
||||
e-mail address, it conflicts with registration informations,
|
||||
it is not part of the profile data
|
||||
|
||||
2015-06-10 Paul Schneider <paul@pschneider.fr>
|
||||
|
||||
* CircleManager.cs: initializes the default provider
|
||||
|
@ -23,7 +23,6 @@ using System.Collections.Generic;
|
||||
|
||||
namespace Yavsc.Model.Circles
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Circle.
|
||||
/// </summary>
|
||||
@ -40,11 +39,17 @@ namespace Yavsc.Model.Circles
|
||||
/// <value>The title.</value>
|
||||
public string Title { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the owner.
|
||||
/// </summary>
|
||||
/// <value>The owner.</value>
|
||||
public string Owner { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the users.
|
||||
/// </summary>
|
||||
/// <value>The users.</value>
|
||||
public string [] Users { get; set; }
|
||||
public string [] Members { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Union the specified that.
|
||||
@ -54,7 +59,7 @@ namespace Yavsc.Model.Circles
|
||||
{
|
||||
List<string> content = new List<string>();
|
||||
foreach (Circle c in those) {
|
||||
foreach (string user_name in c.Users) {
|
||||
foreach (string user_name in c.Members) {
|
||||
if (!content.Contains (user_name))
|
||||
content.Add (user_name);
|
||||
}
|
||||
|
@ -30,13 +30,19 @@ namespace Yavsc.Model.Circles
|
||||
/// </summary>
|
||||
public class CircleInfo
|
||||
{
|
||||
long Id { get; set; }
|
||||
string Title { get; set; }
|
||||
CircleInfo(Circle c)
|
||||
public long Id { get; set; }
|
||||
public string Title { get; set; }
|
||||
public CircleInfo(Circle c)
|
||||
{
|
||||
Id = c.Id;
|
||||
Title = c.Title;
|
||||
}
|
||||
public CircleInfo(long id, string title)
|
||||
{
|
||||
Id = id;
|
||||
Title = title;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -39,27 +39,38 @@ namespace Yavsc.Model.Circles
|
||||
/// <param name="owner">Owner.</param>
|
||||
/// <param name="title">Title.</param>
|
||||
/// <param name="users">Users.</param>
|
||||
public abstract void Add(string owner, string title, string [] users);
|
||||
public abstract long Create(string owner, string title, string [] users);
|
||||
|
||||
/// <summary>
|
||||
/// Delete the specified owner and title.
|
||||
/// Add the specified user.
|
||||
/// </summary>
|
||||
/// <param name="owner">Owner.</param>
|
||||
/// <param name="title">Title.</param>
|
||||
public abstract void Delete(string owner, string title) ;
|
||||
/// <param name="id">circle Identifier.</param>
|
||||
/// <param name="username">User name.</param>
|
||||
public abstract void Add(long id, string username);
|
||||
|
||||
/// <summary>
|
||||
/// Get the specified owner and title.
|
||||
/// Remove the specified user.
|
||||
/// </summary>
|
||||
/// <param name="owner">Owner.</param>
|
||||
/// <param name="title">Title.</param>
|
||||
public abstract Circle Get(string owner, string title);
|
||||
/// <param name="id">circle Identifier.</param>
|
||||
/// <param name="username">User name.</param>
|
||||
public abstract void Remove(long id, string username);
|
||||
|
||||
/// <summary>
|
||||
/// Delete the specified id.
|
||||
/// </summary>
|
||||
/// <param name="id">Identifier.</param>
|
||||
public abstract void Delete(long id) ;
|
||||
|
||||
/// <summary>
|
||||
/// Get the specified id.
|
||||
/// </summary>
|
||||
/// <param name="id">Identifier.</param>
|
||||
public abstract Circle Get(long id);
|
||||
|
||||
/// <summary>
|
||||
/// List this instance.
|
||||
/// </summary>
|
||||
public abstract CircleInfoCollection List();
|
||||
public abstract CircleInfoCollection List(string user);
|
||||
|
||||
}
|
||||
|
||||
|
@ -13,8 +13,6 @@ namespace Yavsc.Model.RolesAndMembers
|
||||
/// </summary>
|
||||
public class Profile
|
||||
{
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the name.
|
||||
/// </summary>
|
||||
@ -107,14 +105,6 @@ namespace Yavsc.Model.RolesAndMembers
|
||||
[StringLength (15)]
|
||||
public string Mobile { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the email.
|
||||
/// </summary>
|
||||
/// <value>The email.</value>
|
||||
[DisplayName ("E-mail")]
|
||||
[StringLength (1024)]
|
||||
public string Email { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the BI.
|
||||
/// </summary>
|
||||
@ -187,7 +177,10 @@ namespace Yavsc.Model.RolesAndMembers
|
||||
( string.IsNullOrWhiteSpace (BIC)
|
||||
|| string.IsNullOrWhiteSpace (IBAN))
|
||||
); } }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether this instance has postal address.
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if this instance has postal address; otherwise, <c>false</c>.</value>
|
||||
public bool HasPostalAddress {
|
||||
get {
|
||||
return !string.IsNullOrWhiteSpace (Address)
|
||||
@ -206,23 +199,24 @@ namespace Yavsc.Model.RolesAndMembers
|
||||
/// <value><c>true</c> if this instance is billable; otherwise, <c>false</c>.</value>
|
||||
public bool IsBillable {
|
||||
get {
|
||||
// true if
|
||||
// true if has a name and, either a postal address, an email, or a Mobile phone number
|
||||
// Name is not null and
|
||||
// (
|
||||
// (Address and CityAndState and ZipCode)
|
||||
// or Email or Phone or Mobile
|
||||
// )
|
||||
return !string.IsNullOrWhiteSpace (Name)
|
||||
&& !( (
|
||||
string.IsNullOrWhiteSpace (Address)
|
||||
&& !( (string.IsNullOrWhiteSpace (Address)
|
||||
|| string.IsNullOrWhiteSpace (CityAndState)
|
||||
|| string.IsNullOrWhiteSpace (ZipCode))
|
||||
&& string.IsNullOrWhiteSpace (Email)
|
||||
&& string.IsNullOrWhiteSpace (Phone)
|
||||
&& string.IsNullOrWhiteSpace (Mobile));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the name of the user.
|
||||
/// </summary>
|
||||
/// <value>The name of the user.</value>
|
||||
public string UserName { get ; set; }
|
||||
|
||||
public Profile () : base ()
|
||||
@ -276,9 +270,6 @@ namespace Yavsc.Model.RolesAndMembers
|
||||
|
||||
UserName = profile.UserName;
|
||||
|
||||
MembershipUser u = Membership.GetUser (profile.UserName);
|
||||
Email = u.Email;
|
||||
|
||||
s = profile.GetPropertyValue ("BankCode");
|
||||
BankCode = (s is DBNull) ? null : (string)s;
|
||||
|
||||
|
Reference in New Issue
Block a user