diff --git a/ITContentProvider/ChangeLog b/ITContentProvider/ChangeLog index db3b2e84..cdbd3bfd 100644 --- a/ITContentProvider/ChangeLog +++ b/ITContentProvider/ChangeLog @@ -1,3 +1,7 @@ +2015-06-10 Paul Schneider + + * ITContentProvider.csproj: + 2015-06-09 Paul Schneider * ITContentProvider.csproj: Helps to fix packaging, and cleans diff --git a/ITContentProvider/ITContentProvider.csproj b/ITContentProvider/ITContentProvider.csproj index 5dc3f566..5142ac83 100644 --- a/ITContentProvider/ITContentProvider.csproj +++ b/ITContentProvider/ITContentProvider.csproj @@ -66,7 +66,9 @@ - + + True + diff --git a/NpgsqlContentProvider/ChangeLog b/NpgsqlContentProvider/ChangeLog index b0b46312..fe0a3d5b 100644 --- a/NpgsqlContentProvider/ChangeLog +++ b/NpgsqlContentProvider/ChangeLog @@ -1,3 +1,7 @@ +2015-06-10 Paul Schneider + + * NpgsqlCircleProvider.cs: + 2015-06-10 Paul Schneider * NpgsqlCircleProvider.cs: implements a Circle provider diff --git a/NpgsqlContentProvider/NpgsqlCircleProvider.cs b/NpgsqlContentProvider/NpgsqlCircleProvider.cs index 6ae3bb02..1240b592 100644 --- a/NpgsqlContentProvider/NpgsqlCircleProvider.cs +++ b/NpgsqlContentProvider/NpgsqlCircleProvider.cs @@ -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 + + /// + /// Add the specified user. + /// + /// circle Identifier. + /// User name. + 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 (); + } + } + + /// + /// Remove the specified user. + /// + /// circle Identifier. + /// User name. + 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 (); + } + } + + /// + /// Get the specified id. + /// + /// Identifier. + 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 members = new List (); + using (NpgsqlDataReader dr = cmd.ExecuteReader ()) { + while (dr.Read ()) + members.Add (dr.GetString (0)); + dr.Close (); + circ.Members = members.ToArray (); + } + } + } + cnx.Close (); + } + return circ; + } + /// /// Add the specified owner, title and users. /// /// Owner. /// Title. /// Users. - 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 (); } + /// /// Delete the specified owner and title. /// - /// Owner. - /// Title. - public override void Delete (string owner, string title) + /// Identifier. + 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 (); + } } + /// - /// Get the specified owner and title. + /// List user's circles. /// - /// Owner. - /// Title. - public override Circle Get (string owner, string title) + /// User. + public override CircleInfoCollection List (string user) { - throw new NotImplementedException (); - } - /// - /// List this instance. - /// - public override CircleInfoCollection List () - { - 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; /// /// 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"] ?? "/"; } diff --git a/WebControls/ChangeLog b/WebControls/ChangeLog new file mode 100644 index 00000000..5ffcf544 --- /dev/null +++ b/WebControls/ChangeLog @@ -0,0 +1,11 @@ +2015-06-10 Paul Schneider + + * 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: + diff --git a/WebControls/InputCircle.cs b/WebControls/InputCircle.cs new file mode 100644 index 00000000..226340b4 --- /dev/null +++ b/WebControls/InputCircle.cs @@ -0,0 +1,163 @@ +// +// InputCircle.cs +// +// Author: +// Paul Schneider +// +// 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 . +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 +{ + /// + /// Input circle. + /// + [ + AspNetHostingPermission (SecurityAction.Demand, + Level = AspNetHostingPermissionLevel.Minimal), + AspNetHostingPermission (SecurityAction.InheritanceDemand, + Level = AspNetHostingPermissionLevel.Minimal), + ParseChildren (true), + DefaultProperty ("Name"), + ToolboxData ("<{0}:InputCircle runat=\"server\"> ") + ] + public class InputCircle: WebControl + { + /// + /// Initializes a new instance of the class. + /// + public InputCircle () + { + } + /// + /// Gets or sets the name. + /// + /// The name. + [Bindable (true), DefaultValue(""), Localizable(true)] + public string Name { + get { + return (string) ViewState["Name"]; + } + set { + ViewState ["Name"] = value; + } + } + /// + /// Gets or sets the value. + /// + /// The value. + [Bindable (true), DefaultValue(""), Localizable(true)] + public string Value { + get { + return (string) ViewState["Value"]; + } + set { + ViewState ["Value"] = value; + } + } + + /// + /// Gets or sets the on change. + /// + /// The on change. + [Bindable (true), DefaultValue(""), Localizable(false)] + public string OnChange { + get { + return (string) ViewState["OnChange"]; + } + set { + ViewState ["OnChange"] = value; + } + } + /// + /// Gets or sets a value indicating whether this is multiple. + /// + /// true if multiple; otherwise, false. + [Bindable (true), DefaultValue(false)] + public bool Multiple { + get { + + return (bool) ViewState["Multiple"]; + } + set { + ViewState ["Multiple"] = value; + + } + } + + /// + /// Gets or sets the empty value. + /// + /// The empty value. + [Bindable (true), DefaultValue(null)] + public string EmptyValue { + get { + return (string) ViewState["EmptyValue"]; + } + set { + ViewState ["EmptyValue"] = value; + + } + } + + /// + /// Renders the contents. + /// + /// Writer. + 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 (); + } + } +} + diff --git a/WebControls/InputUserName.cs b/WebControls/InputUserName.cs index 5d121655..d7903883 100644 --- a/WebControls/InputUserName.cs +++ b/WebControls/InputUserName.cs @@ -39,7 +39,7 @@ namespace Yavsc.WebControls Level = AspNetHostingPermissionLevel.Minimal), ParseChildren (true), DefaultProperty ("Name"), - ToolboxData ("<{0}:ResultPages runat=\"server\"> ") + ToolboxData ("<{0}:InputUserName runat=\"server\"> ") ] public class InputUserName: WebControl { @@ -70,9 +70,7 @@ namespace Yavsc.WebControls /// Gets or sets the value. /// /// The 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)] + /// + /// Gets or sets the client side action on change. + /// + /// The on change. + [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. /// /// The in role. - [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 is multiple. /// /// true if multiple; otherwise, false. - [Bindable (true)] - [DefaultValue(false)] + [Bindable (true), DefaultValue(false)] public bool Multiple { get { @@ -128,9 +125,11 @@ namespace Yavsc.WebControls } } - - [Bindable (true)] - [DefaultValue(null)] + /// + /// Gets or sets the empty value. + /// + /// The empty value. + [Bindable (true), DefaultValue(null)] public string EmptyValue { get { return (string) ViewState["EmptyValue"]; diff --git a/WebControls/UserCard.cs b/WebControls/UserCard.cs new file mode 100644 index 00000000..da54a952 --- /dev/null +++ b/WebControls/UserCard.cs @@ -0,0 +1,81 @@ +// +// UserCard.cs +// +// Author: +// Paul Schneider +// +// 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 . +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\"> ") + ] + /// + /// User card. + /// + public class UserCard: WebControl + { + /// + /// Initializes a new instance of the class. + /// + public UserCard () + { + } + + [Bindable (true), DefaultValue(""), Localizable(false)] + string UserName { get; set; } + + [Bindable (true), DefaultValue("(You)"), Localizable(true)] + string yourTag { get; set; } + /// + /// Renders the contents. + /// + /// Writer. + 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 (); + } + } + + + } +} + diff --git a/WebControls/WebControls.csproj b/WebControls/WebControls.csproj index 2405ce2f..a91aa59c 100644 --- a/WebControls/WebControls.csproj +++ b/WebControls/WebControls.csproj @@ -39,11 +39,20 @@ + + + + + + {68F5B80A-616E-4C3C-91A0-828AA40000BD} + YavscModel + + \ No newline at end of file diff --git a/web/ApiControllers/BasketController.cs b/web/ApiControllers/BasketApiController.cs similarity index 97% rename from web/ApiControllers/BasketController.cs rename to web/ApiControllers/BasketApiController.cs index b31cc91d..f424cad9 100644 --- a/web/ApiControllers/BasketController.cs +++ b/web/ApiControllers/BasketApiController.cs @@ -15,7 +15,7 @@ namespace Yavsc.ApiControllers /// Maintains a collection of articles /// qualified with name value pairs /// - public class BasketController : ApiController + public class BasketApiController : ApiController { /// /// The wfmgr. diff --git a/web/ApiControllers/CalendarController.cs b/web/ApiControllers/CalendarApiController.cs similarity index 99% rename from web/ApiControllers/CalendarController.cs rename to web/ApiControllers/CalendarApiController.cs index 0825e015..a7ca4c8c 100644 --- a/web/ApiControllers/CalendarController.cs +++ b/web/ApiControllers/CalendarApiController.cs @@ -34,7 +34,7 @@ namespace Yavsc.ApiControllers /// /// Night flash controller. /// - public class CalendarController: ApiController + public class CalendarApiController: ApiController { YaEvent[] getTestList() { diff --git a/web/ApiControllers/CircleController.cs b/web/ApiControllers/CircleApiController.cs similarity index 56% rename from web/ApiControllers/CircleController.cs rename to web/ApiControllers/CircleApiController.cs index 5a994c78..a6932402 100644 --- a/web/ApiControllers/CircleController.cs +++ b/web/ApiControllers/CircleApiController.cs @@ -30,50 +30,71 @@ namespace Yavsc.ApiControllers /// /// Circle controller. /// - public class CircleController : ApiController + public class CircleApiController : ApiController { /// - /// Add the specified id and users. + /// Creates the specified circle using the given title and user list. /// - /// Identifier. - /// Title. + /// Identifier. /// Users. [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); - } - /// - /// Delete the specified id. - /// - /// Identifier. - [Authorize] public void Delete(string id) - { - string user = Membership.GetUser ().UserName; - CircleManager.DefaultProvider.Delete (user, id); + return CircleManager.DefaultProvider.Create (user, title, users); } /// - /// Get the specified id. + /// Add the specified users to the circle. + /// + /// Circle Identifier. + /// username. + [Authorize] + public void Add(long id, string username) + { + checkIsOwner (CircleManager.DefaultProvider.Get (id)); + CircleManager.DefaultProvider.Add (id, username); + } + + + /// + /// Delete the circle specified by id. + /// + /// Identifier. + [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"); + } + + /// + /// Get the circle specified id. /// /// Identifier. [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; } /// - /// List this instance. + /// List the circles /// [Authorize] public CircleInfoCollection List() { string user = Membership.GetUser ().UserName; - return CircleManager.DefaultProvider.List (); + return CircleManager.DefaultProvider.List (user); } } } diff --git a/web/ApiControllers/FrontOfficeApiController.cs b/web/ApiControllers/FrontOfficeApiController.cs index 47fc8615..3e056d77 100644 --- a/web/ApiControllers/FrontOfficeApiController.cs +++ b/web/ApiControllers/FrontOfficeApiController.cs @@ -100,7 +100,6 @@ namespace Yavsc.ApiControllers Estimate e = wfmgr.GetEstimate (estimid); tmpe.Session = new Dictionary (); 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 (); } diff --git a/web/ApiControllers/WorkFlowController.cs b/web/ApiControllers/WorkFlowApiController.cs similarity index 98% rename from web/ApiControllers/WorkFlowController.cs rename to web/ApiControllers/WorkFlowApiController.cs index 872dc15c..bf8ed396 100644 --- a/web/ApiControllers/WorkFlowController.cs +++ b/web/ApiControllers/WorkFlowApiController.cs @@ -17,7 +17,7 @@ namespace Yavsc.ApiControllers /// /// Work flow controller. /// - public class WorkFlowController : ApiController + public class WorkFlowApiController : ApiController { string adminRoleName="Admin"; /// diff --git a/web/ChangeLog b/web/ChangeLog index f2571238..0d2da9a6 100644 --- a/web/ChangeLog +++ b/web/ChangeLog @@ -1,3 +1,21 @@ +2015-06-10 Paul Schneider + + * 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 * CalendarController.cs: refactoring diff --git a/web/Web.csproj b/web/Web.csproj index 8c1271b1..a80c1db7 100644 --- a/web/Web.csproj +++ b/web/Web.csproj @@ -126,6 +126,7 @@ + @@ -173,21 +174,21 @@ - - - - + + + + diff --git a/web/instdbws.sql b/web/instdbws.sql index d4846184..a6f92817 100644 --- a/web/instdbws.sql +++ b/web/instdbws.sql @@ -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,11 +640,52 @@ 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 ) WITH ( OIDS=FALSE -); \ No newline at end of file +); + +-- 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 +); + + \ No newline at end of file diff --git a/web/templates/Estim.cs b/web/templates/Estim.cs index 184e4e07..3c973e6f 100644 --- a/web/templates/Estim.cs +++ b/web/templates/Estim.cs @@ -37,6 +37,18 @@ namespace Yavsc.templates { return this._toField; } } + private String _efromField; + public String efrom { + get { + return this._efromField; + } + } + private String _etoField; + public String eto { + get { + return this._etoField; + } + } public virtual string TransformText() { @@ -48,168 +60,132 @@ namespace Yavsc.templates { #line default #line hidden - #line 14 "" + #line 16 "" this.Write("\n\\documentclass[french,11pt]{article}\n\\usepackage{babel}\n\\usepackage[T1]{fontenc}\n\\usepackage[utf8]{inputenc}\n\\usepackage[a4paper]{geometry}\n\\usepackage{units}\n\\usepackage{bera}\n\\usepackage{graphicx}\n\\usepackage{fancyhdr}\n\\usepackage{fp}\n\n\\def\\TVA{20} % Taux de la TVA\n\n\\def\\TotalHT{0}\n\\def\\TotalTVA{0}\n\n\\newcommand{\\AjouterService}[3]{% Arguments : Désignation, quantité, prix\n \\FPround{\\prix}{#3}{2}\n \\FPeval{\\montant}{#2 * #3}\n \\FPround{\\montant}{\\montant}{2}\n \\FPadd{\\TotalHT}{\\TotalHT}{\\montant}\n \n \\eaddto\\ListeProduits{#1 & \\prix & #2 & \\montant \\cr}\n}\n\n\n\\newcommand{\\AfficheResultat}{%\n \\ListeProduits\n \n \\FPeval{\\TotalTVA}{\\TotalHT * \\TVA / 100}\n \\FPadd{\\TotalTTC}{\\TotalHT}{\\TotalTVA}\n \\FPround{\\TotalHT}{\\TotalHT}{2}\n \\FPround{\\TotalTVA}{\\TotalTVA}{2}\n \\FPround{\\TotalTTC}{\\TotalTTC}{2}\n \\global\\let\\TotalHT\\TotalHT\n \\global\\let\\TotalTVA\\TotalTVA\n \\global\\let\\TotalTTC\\TotalTTC\n \n\n \\cr \n \\hline\n \\textbf{Total} & & & \\TotalHT\n}\n\n\\newcommand*\\eaddto[2]{% version développée de \\addto\n \\edef\\tmp{#2}%\n \\expandafter\\addto\n \\expandafter#1%\n \\expandafter{\\tmp}%\n}\n\n\\newcommand{\\ListeProduits}{}\n\n\n\n\n%%%%%%%%%%%%%%%%%%%%% A MODIFIER DANS LA FACTURE %%%%%%%%%%%%%%%%%%%%%\n\n\\def\\FactureNum {"); #line default #line hidden - #line 73 "" + #line 75 "" this.Write(this.ToStringHelper.ToStringWithCulture( estim.Id.ToString() )); #line default #line hidden - #line 73 "" + #line 75 "" this.Write("} % Numéro de facture\n\\def\\FactureAcquittee {non} % Facture acquittée : oui/non\n\\def\\FactureLieu {"); #line default #line hidden - #line 75 "" + #line 77 "" this.Write(this.ToStringHelper.ToStringWithCulture( from.CityAndState )); #line default #line hidden - #line 75 "" + #line 77 "" this.Write("} % Lieu de l'édition de la facture\n\\def\\FactureObjet {Facture : "); #line default #line hidden - #line 76 "" + #line 78 "" this.Write(this.ToStringHelper.ToStringWithCulture( estim.Title )); #line default #line hidden - #line 76 "" + #line 78 "" this.Write("} % Objet du document\n% Description de la facture\n\\def\\FactureDescr {%\n "); #line default #line hidden - #line 79 "" + #line 81 "" this.Write(this.ToStringHelper.ToStringWithCulture( estim.Description )); #line default #line hidden - #line 79 "" + #line 81 "" this.Write("\n}\n\n% Infos Client\n\\def\\ClientNom{"); #line default #line hidden - #line 83 "" + #line 85 "" this.Write(this.ToStringHelper.ToStringWithCulture( to.Name )); #line default #line hidden - #line 83 "" + #line 85 "" this.Write("} % Nom du client\n\\def\\ClientAdresse{% % Adresse du client\n "); #line default #line hidden - #line 85 "" + #line 87 "" if (!string.IsNullOrWhiteSpace(to.Address)) { #line default #line hidden - #line 86 "" + #line 88 "" this.Write(" "); #line default #line hidden - #line 86 "" + #line 88 "" this.Write(this.ToStringHelper.ToStringWithCulture( to.Address )); #line default #line hidden - #line 86 "" + #line 88 "" this.Write("\\\\\n "); #line default #line hidden - #line 87 "" + #line 89 "" } #line default #line hidden - #line 88 "" + #line 90 "" this.Write(" "); #line default #line hidden - #line 88 "" + #line 90 "" if (!string.IsNullOrWhiteSpace(to.ZipCode)) { #line default #line hidden - #line 89 "" + #line 91 "" this.Write(" "); #line default #line hidden - #line 89 "" + #line 91 "" this.Write(this.ToStringHelper.ToStringWithCulture( to.ZipCode )); #line default #line hidden - #line 89 "" + #line 91 "" this.Write(" "); #line default #line hidden - #line 89 "" - } - - #line default - #line hidden - - #line 90 "" - this.Write(" "); - - #line default - #line hidden - - #line 90 "" - if (!string.IsNullOrWhiteSpace(to.ZipCode)) { - - #line default - #line hidden - - #line 91 "" - this.Write(" "); - - #line default - #line hidden - - #line 91 "" - this.Write(this.ToStringHelper.ToStringWithCulture( to.CityAndState )); - - #line default - #line hidden - - #line 91 "" - this.Write("\\\\ "); - - #line default - #line hidden - #line 91 "" } @@ -217,91 +193,97 @@ namespace Yavsc.templates { #line hidden #line 92 "" - this.Write(" \n"); + this.Write(" "); + + #line default + #line hidden + + #line 92 "" + if (!string.IsNullOrWhiteSpace(to.ZipCode)) { #line default #line hidden #line 93 "" - if (!string.IsNullOrWhiteSpace(to.Phone)) { + this.Write(" "); + + #line default + #line hidden + + #line 93 "" + this.Write(this.ToStringHelper.ToStringWithCulture( to.CityAndState )); + + #line default + #line hidden + + #line 93 "" + this.Write("\\\\ "); + + #line default + #line hidden + + #line 93 "" + } #line default #line hidden #line 94 "" - this.Write(" Téléphone fixe: "); - - #line default - #line hidden - - #line 94 "" - this.Write(this.ToStringHelper.ToStringWithCulture( to.Phone )); - - #line default - #line hidden - - #line 94 "" - this.Write("\\\\\n"); + this.Write(" \n"); #line default #line hidden #line 95 "" - } + if (!string.IsNullOrWhiteSpace(to.Phone)) { #line default #line hidden #line 96 "" - if (!string.IsNullOrWhiteSpace(to.Mobile)) { + this.Write(" Téléphone fixe: "); #line default #line hidden - #line 97 "" - this.Write(" Mobile: "); + #line 96 "" + this.Write(this.ToStringHelper.ToStringWithCulture( to.Phone )); #line default #line hidden - #line 97 "" - this.Write(this.ToStringHelper.ToStringWithCulture( to.Mobile )); - - #line default - #line hidden - - #line 97 "" + #line 96 "" this.Write("\\\\\n"); #line default #line hidden - #line 98 "" + #line 97 "" } #line default #line hidden - #line 99 "" - this.Write(" "); + #line 98 "" + if (!string.IsNullOrWhiteSpace(to.Mobile)) { #line default #line hidden #line 99 "" - if (!string.IsNullOrWhiteSpace(to.Email)) { + this.Write(" Mobile: "); #line default #line hidden - #line 100 "" - this.Write(" E-mail: "); + #line 99 "" + this.Write(this.ToStringHelper.ToStringWithCulture( to.Mobile )); #line default #line hidden - #line 100 "" - this.Write(this.ToStringHelper.ToStringWithCulture( to.Email )); + #line 99 "" + this.Write("\\\\\n"); #line default #line hidden @@ -313,91 +295,85 @@ namespace Yavsc.templates { #line hidden #line 101 "" - this.Write("}\n\n% Liste des produits facturés : Désignation, prix\n\n "); - - #line default - #line hidden - - #line 105 "" - foreach (Writting wr in estim.Lines) { - - #line default - #line hidden - - #line 106 "" - this.Write("\\AjouterService {"); - - #line default - #line hidden - - #line 106 "" - this.Write(this.ToStringHelper.ToStringWithCulture(wr.Description)); - - #line default - #line hidden - - #line 106 "" this.Write(" "); #line default #line hidden - #line 106 "" - if (!string.IsNullOrWhiteSpace(wr.ProductReference)) { + #line 101 "" + if (!string.IsNullOrWhiteSpace(eto)) { #line default #line hidden - #line 107 "" - this.Write(" ("); + #line 102 "" + this.Write(" E-mail: "); #line default #line hidden - #line 107 "" - this.Write(this.ToStringHelper.ToStringWithCulture(wr.ProductReference)); + #line 102 "" + this.Write(this.ToStringHelper.ToStringWithCulture( eto )); #line default #line hidden - #line 107 "" - this.Write(")"); - - #line default - #line hidden - - #line 107 "" + #line 102 "" } #line default #line hidden - #line 108 "" - this.Write("} {"); + #line 103 "" + this.Write("}\n\n% Liste des produits facturés : Désignation, prix\n\n "); + + #line default + #line hidden + + #line 107 "" + foreach (Writting wr in estim.Lines) { #line default #line hidden #line 108 "" - this.Write(this.ToStringHelper.ToStringWithCulture(wr.Count)); + this.Write("\\AjouterService {"); #line default #line hidden #line 108 "" - this.Write("} {"); + this.Write(this.ToStringHelper.ToStringWithCulture(wr.Description)); #line default #line hidden #line 108 "" - this.Write(this.ToStringHelper.ToStringWithCulture(wr.UnitaryCost)); + this.Write(" "); #line default #line hidden #line 108 "" - this.Write("} \n "); + if (!string.IsNullOrWhiteSpace(wr.ProductReference)) { + + #line default + #line hidden + + #line 109 "" + this.Write(" ("); + + #line default + #line hidden + + #line 109 "" + this.Write(this.ToStringHelper.ToStringWithCulture(wr.ProductReference)); + + #line default + #line hidden + + #line 109 "" + this.Write(")"); #line default #line hidden @@ -409,49 +385,55 @@ namespace Yavsc.templates { #line hidden #line 110 "" - this.Write("\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n\n\\geometry{verbose,tmargin=4em,bmargin=8em,lmargin=6em,rmargin=6em}\n\\setlength{\\parindent}{0pt}\n\\setlength{\\parskip}{1ex plus 0.5ex minus 0.2ex}\n\n\\thispagestyle{fancy}\n\\pagestyle{fancy}\n\\setlength{\\parindent}{0pt}\n\n\\renewcommand{\\headrulewidth}{0pt}\n\\cfoot{\n "); + this.Write("} {"); #line default #line hidden - #line 123 "" - if (!string.IsNullOrWhiteSpace(from.Name)) { + #line 110 "" + this.Write(this.ToStringHelper.ToStringWithCulture(wr.Count)); #line default #line hidden - #line 124 "" - this.Write(this.ToStringHelper.ToStringWithCulture( from.Name )); + #line 110 "" + this.Write("} {"); #line default #line hidden - #line 124 "" + #line 110 "" + this.Write(this.ToStringHelper.ToStringWithCulture(wr.UnitaryCost)); + + #line default + #line hidden + + #line 110 "" + this.Write("} \n "); + + #line default + #line hidden + + #line 111 "" } #line default #line hidden - #line 125 "" - this.Write(" "); + #line 112 "" + this.Write("\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n\n\\geometry{verbose,tmargin=4em,bmargin=8em,lmargin=6em,rmargin=6em}\n\\setlength{\\parindent}{0pt}\n\\setlength{\\parskip}{1ex plus 0.5ex minus 0.2ex}\n\n\\thispagestyle{fancy}\n\\pagestyle{fancy}\n\\setlength{\\parindent}{0pt}\n\n\\renewcommand{\\headrulewidth}{0pt}\n\\cfoot{\n "); #line default #line hidden #line 125 "" - if (!string.IsNullOrWhiteSpace(from.Address)) { + if (!string.IsNullOrWhiteSpace(from.Name)) { #line default #line hidden #line 126 "" - this.Write(" - "); - - #line default - #line hidden - - #line 126 "" - this.Write(this.ToStringHelper.ToStringWithCulture( from.Address )); + this.Write(this.ToStringHelper.ToStringWithCulture( from.Name )); #line default #line hidden @@ -463,119 +445,119 @@ namespace Yavsc.templates { #line hidden #line 127 "" - this.Write(" \n "); + this.Write(" "); + + #line default + #line hidden + + #line 127 "" + if (!string.IsNullOrWhiteSpace(from.Address)) { #line default #line hidden #line 128 "" - if (!string.IsNullOrWhiteSpace(from.CityAndState)) { - - #line default - #line hidden - - #line 129 "" this.Write(" - "); #line default #line hidden - #line 129 "" - this.Write(this.ToStringHelper.ToStringWithCulture( from.CityAndState )); + #line 128 "" + this.Write(this.ToStringHelper.ToStringWithCulture( from.Address )); + + #line default + #line hidden + + #line 128 "" + } #line default #line hidden #line 129 "" - } + this.Write(" \n "); #line default #line hidden #line 130 "" - this.Write(" \\newline\n \\small{\n "); + if (!string.IsNullOrWhiteSpace(from.CityAndState)) { + + #line default + #line hidden + + #line 131 "" + this.Write(" - "); + + #line default + #line hidden + + #line 131 "" + this.Write(this.ToStringHelper.ToStringWithCulture( from.CityAndState )); + + #line default + #line hidden + + #line 131 "" + } #line default #line hidden #line 132 "" - if (!string.IsNullOrWhiteSpace(from.Email)) { + this.Write(" \\newline\n \\small{\n "); #line default #line hidden - #line 133 "" + #line 134 "" + if (!string.IsNullOrWhiteSpace(efrom)) { + + #line default + #line hidden + + #line 135 "" this.Write("E-mail: "); #line default #line hidden - #line 133 "" - this.Write(this.ToStringHelper.ToStringWithCulture( from.Email )); + #line 135 "" + this.Write(this.ToStringHelper.ToStringWithCulture( efrom )); #line default #line hidden - #line 133 "" + #line 135 "" } #line default #line hidden - #line 134 "" + #line 136 "" this.Write(" "); #line default #line hidden - #line 134 "" + #line 136 "" if (!string.IsNullOrWhiteSpace(from.Mobile)) { #line default #line hidden - #line 135 "" + #line 137 "" this.Write(" - Téléphone mobile: "); #line default #line hidden - #line 135 "" + #line 137 "" this.Write(this.ToStringHelper.ToStringWithCulture( from.Mobile )); #line default #line hidden - #line 135 "" - } - - #line default - #line hidden - - #line 136 "" - this.Write(" "); - - #line default - #line hidden - - #line 136 "" - if (!string.IsNullOrWhiteSpace(from.Phone)) { - - #line default - #line hidden - - #line 137 "" - this.Write(" - Téléphone fixe: "); - - #line default - #line hidden - - #line 137 "" - this.Write(this.ToStringHelper.ToStringWithCulture( from.Phone )); - - #line default - #line hidden - #line 137 "" } @@ -583,164 +565,194 @@ namespace Yavsc.templates { #line hidden #line 138 "" + this.Write(" "); + + #line default + #line hidden + + #line 138 "" + if (!string.IsNullOrWhiteSpace(from.Phone)) { + + #line default + #line hidden + + #line 139 "" + this.Write(" - Téléphone fixe: "); + + #line default + #line hidden + + #line 139 "" + this.Write(this.ToStringHelper.ToStringWithCulture( from.Phone )); + + #line default + #line hidden + + #line 139 "" + } + + #line default + #line hidden + + #line 140 "" this.Write(" }\n}\n\n\\begin{document}\n\n% Logo de la société\n%\\includegraphics{logo.jpg}\n\n% Nom et adresse de la société\n"); #line default #line hidden - #line 147 "" + #line 149 "" this.Write(this.ToStringHelper.ToStringWithCulture( from.Name )); #line default #line hidden - #line 147 "" + #line 149 "" this.Write("\\\\\n"); #line default #line hidden - #line 148 "" + #line 150 "" this.Write(this.ToStringHelper.ToStringWithCulture( from.Address )); #line default #line hidden - #line 148 "" + #line 150 "" this.Write("\\\\\n"); #line default #line hidden - #line 149 "" + #line 151 "" this.Write(this.ToStringHelper.ToStringWithCulture(from.ZipCode )); #line default #line hidden - #line 149 "" + #line 151 "" this.Write(" "); #line default #line hidden - #line 149 "" + #line 151 "" this.Write(this.ToStringHelper.ToStringWithCulture(from.CityAndState)); #line default #line hidden - #line 149 "" + #line 151 "" this.Write("\\\\\n\nFacture n°\\FactureNum\n\n\n{\\addtolength{\\leftskip}{10.5cm} %in ERT\n \\textbf{\\ClientNom} \\\\\n \\ClientAdresse \\\\\n\n} %in ERT\n\n\n\\hspace*{10.5cm}\n\\FactureLieu, le \\today\n\n~\\\\~\\\\\n\n\\textbf{Objet : \\FactureObjet \\\\}\n\n\\textnormal{\\FactureDescr}\n\n~\\\\\n\n\\begin{center}\n \\begin{tabular}{lrrr}\n \\textbf{Désignation ~~~~~~} & \\textbf{Prix unitaire} & \\textbf{Quantité} & \\textbf{Montant (EUR)} \\\\\n \\hline\n \\AfficheResultat{}\n \\end{tabular}\n\\end{center}\n\n\\begin{flushright}\n\\textit{Auto entreprise en franchise de TVA}\\\\\n\n\\end{flushright}\n~\\\\\n\n\\ifthenelse{\\equal{\\FactureAcquittee}{oui}}{\n Facture acquittée.\n}{\n\n À régler par chèque ou par virement bancaire :\n\n \\begin{center}\n \\begin{tabular}{|c c c c|}\n "); #line default #line hidden - #line 194 "" + #line 196 "" if (!string.IsNullOrWhiteSpace(from.BankCode) && !string.IsNullOrWhiteSpace(from.WicketCode) && !string.IsNullOrWhiteSpace(from.AccountNumber) ) { #line default #line hidden - #line 196 "" + #line 198 "" this.Write(" \\hline \\textbf{Code banque} & \\textbf{Code guichet} & \\textbf{N° de Compte} & \\textbf{Clé RIB} \\\\\n "); #line default #line hidden - #line 197 "" + #line 199 "" this.Write(this.ToStringHelper.ToStringWithCulture( from.BankCode )); #line default #line hidden - #line 197 "" + #line 199 "" this.Write(" & "); #line default #line hidden - #line 197 "" + #line 199 "" this.Write(this.ToStringHelper.ToStringWithCulture( from.WicketCode )); #line default #line hidden - #line 197 "" + #line 199 "" this.Write(" & "); #line default #line hidden - #line 197 "" + #line 199 "" this.Write(this.ToStringHelper.ToStringWithCulture(from.AccountNumber )); #line default #line hidden - #line 197 "" + #line 199 "" this.Write(" & "); #line default #line hidden - #line 197 "" + #line 199 "" this.Write(this.ToStringHelper.ToStringWithCulture(from.BankedKey)); #line default #line hidden - #line 197 "" + #line 199 "" this.Write(" \\\\\n "); #line default #line hidden - #line 198 "" + #line 200 "" } if (!string.IsNullOrWhiteSpace(from.IBAN) && !string.IsNullOrWhiteSpace(from.BIC)) { #line default #line hidden - #line 200 "" + #line 202 "" this.Write(" \\hline \\textbf{IBAN N°} & \\multicolumn{3}{|l|}{ "); #line default #line hidden - #line 200 "" + #line 202 "" this.Write(this.ToStringHelper.ToStringWithCulture( from.IBAN )); #line default #line hidden - #line 200 "" + #line 202 "" this.Write(" } \\\\\n \\hline \\textbf{Code BIC} & \\multicolumn{3}{|l|}{ "); #line default #line hidden - #line 201 "" + #line 203 "" this.Write(this.ToStringHelper.ToStringWithCulture( from.BIC )); #line default #line hidden - #line 201 "" + #line 203 "" this.Write(" }\n "); #line default #line hidden - #line 202 "" + #line 204 "" } #line default #line hidden - #line 203 "" + #line 205 "" this.Write(" \\\\\n \\hline\n \\end{tabular}\n \\end{center}\n}\n\\end{document}\n"); #line default @@ -819,6 +831,52 @@ namespace Yavsc.templates { } } } + bool _efromAcquired = false; + if (((this.Session != null) && this.Session.ContainsKey("efrom"))) { + object data = this.Session["efrom"]; + if (typeof(String).IsAssignableFrom(data.GetType())) { + this._efromField = ((String)(data)); + _efromAcquired = true; + } + else { + this.Error("The type 'String' of the parameter 'efrom' did not match the type passed to the template"); + } + } + if ((_efromAcquired == false)) { + object data = System.Runtime.Remoting.Messaging.CallContext.LogicalGetData("efrom"); + if ((data != null)) { + if (typeof(String).IsAssignableFrom(data.GetType())) { + this._efromField = ((String)(data)); + _efromAcquired = true; + } + else { + this.Error("The type 'String' of the parameter 'efrom' did not match the type passed to the template"); + } + } + } + bool _etoAcquired = false; + if (((this.Session != null) && this.Session.ContainsKey("eto"))) { + object data = this.Session["eto"]; + if (typeof(String).IsAssignableFrom(data.GetType())) { + this._etoField = ((String)(data)); + _etoAcquired = true; + } + else { + this.Error("The type 'String' of the parameter 'eto' did not match the type passed to the template"); + } + } + if ((_etoAcquired == false)) { + object data = System.Runtime.Remoting.Messaging.CallContext.LogicalGetData("eto"); + if ((data != null)) { + if (typeof(String).IsAssignableFrom(data.GetType())) { + this._etoField = ((String)(data)); + _etoAcquired = true; + } + else { + this.Error("The type 'String' of the parameter 'eto' did not match the type passed to the template"); + } + } + } } } diff --git a/web/templates/Estim.tt b/web/templates/Estim.tt index 5a2b5a63..3629333e 100644 --- a/web/templates/Estim.tt +++ b/web/templates/Estim.tt @@ -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 #><# } #> } diff --git a/yavscModel/ChangeLog b/yavscModel/ChangeLog index 78f6d602..87a260ad 100644 --- a/yavscModel/ChangeLog +++ b/yavscModel/ChangeLog @@ -1,3 +1,14 @@ +2015-06-10 Paul Schneider + + * 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 * CircleManager.cs: initializes the default provider diff --git a/yavscModel/Circles/Circle.cs b/yavscModel/Circles/Circle.cs index 4cc5e326..199d4da5 100644 --- a/yavscModel/Circles/Circle.cs +++ b/yavscModel/Circles/Circle.cs @@ -23,7 +23,6 @@ using System.Collections.Generic; namespace Yavsc.Model.Circles { - /// /// Circle. /// @@ -40,11 +39,17 @@ namespace Yavsc.Model.Circles /// The title. public string Title { get; set; } + /// + /// Gets or sets the owner. + /// + /// The owner. + public string Owner { get; set; } + /// /// Gets or sets the users. /// /// The users. - public string [] Users { get; set; } + public string [] Members { get; set; } /// /// Union the specified that. @@ -54,7 +59,7 @@ namespace Yavsc.Model.Circles { List content = new List(); 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); } diff --git a/yavscModel/Circles/CircleInfo.cs b/yavscModel/Circles/CircleInfo.cs index 410ddc83..d1378de6 100644 --- a/yavscModel/Circles/CircleInfo.cs +++ b/yavscModel/Circles/CircleInfo.cs @@ -30,13 +30,19 @@ namespace Yavsc.Model.Circles /// 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; + } + } } diff --git a/yavscModel/Circles/CircleProvider.cs b/yavscModel/Circles/CircleProvider.cs index 07687806..ff5ed3fc 100644 --- a/yavscModel/Circles/CircleProvider.cs +++ b/yavscModel/Circles/CircleProvider.cs @@ -39,27 +39,38 @@ namespace Yavsc.Model.Circles /// Owner. /// Title. /// Users. - public abstract void Add(string owner, string title, string [] users); + public abstract long Create(string owner, string title, string [] users); /// - /// Delete the specified owner and title. + /// Add the specified user. /// - /// Owner. - /// Title. - public abstract void Delete(string owner, string title) ; + /// circle Identifier. + /// User name. + public abstract void Add(long id, string username); /// - /// Get the specified owner and title. + /// Remove the specified user. /// - /// Owner. - /// Title. - public abstract Circle Get(string owner, string title); + /// circle Identifier. + /// User name. + public abstract void Remove(long id, string username); + /// + /// Delete the specified id. + /// + /// Identifier. + public abstract void Delete(long id) ; + + /// + /// Get the specified id. + /// + /// Identifier. + public abstract Circle Get(long id); /// /// List this instance. /// - public abstract CircleInfoCollection List(); + public abstract CircleInfoCollection List(string user); } diff --git a/yavscModel/RolesAndMemebers/Profile.cs b/yavscModel/RolesAndMemebers/Profile.cs index a6e3cb14..8efd5dc9 100644 --- a/yavscModel/RolesAndMemebers/Profile.cs +++ b/yavscModel/RolesAndMemebers/Profile.cs @@ -13,8 +13,6 @@ namespace Yavsc.Model.RolesAndMembers /// public class Profile { - - /// /// Gets or sets the name. /// @@ -107,14 +105,6 @@ namespace Yavsc.Model.RolesAndMembers [StringLength (15)] public string Mobile { get; set; } - /// - /// Gets or sets the email. - /// - /// The email. - [DisplayName ("E-mail")] - [StringLength (1024)] - public string Email { get; set; } - /// /// Gets or sets the BI. /// @@ -187,7 +177,10 @@ namespace Yavsc.Model.RolesAndMembers ( string.IsNullOrWhiteSpace (BIC) || string.IsNullOrWhiteSpace (IBAN)) ); } } - + /// + /// Gets a value indicating whether this instance has postal address. + /// + /// true if this instance has postal address; otherwise, false. public bool HasPostalAddress { get { return !string.IsNullOrWhiteSpace (Address) @@ -206,23 +199,24 @@ namespace Yavsc.Model.RolesAndMembers /// true if this instance is billable; otherwise, false. 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)); } } - + /// + /// Gets or sets the name of the user. + /// + /// The name of the user. 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;