* avatar, username, city from Google profile

* refactoring
vnext
Paul Schneider 10 years ago
parent edd160ae75
commit c7f81699a4
55 changed files with 706 additions and 351 deletions

@ -9,6 +9,7 @@
<OutputType>Library</OutputType> <OutputType>Library</OutputType>
<RootNamespace>ITContentProvider</RootNamespace> <RootNamespace>ITContentProvider</RootNamespace>
<AssemblyName>ITContentProvider</AssemblyName> <AssemblyName>ITContentProvider</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>

@ -24,7 +24,7 @@ clean:
rm -rf $(DESTDIR) rm -rf $(DESTDIR)
rsync-preprod: deploy rsync-preprod: deploy
rsync -ravu build/web/$(CONFIG)/ root@lavieille.localdomain:/srv/httpd/luapre rsync -ravu build/web/$(CONFIG)/ root@lua.localdomain:/srv/httpd/luapre
rsync-local: rsync-local:
rsync -ravu build/web/$(CONFIG)/ root@localhost:/srv/www/yavsc rsync -ravu build/web/$(CONFIG)/ root@localhost:/srv/www/yavsc

@ -9,6 +9,7 @@
<OutputType>Library</OutputType> <OutputType>Library</OutputType>
<RootNamespace>Npgsql.Web.Blog</RootNamespace> <RootNamespace>Npgsql.Web.Blog</RootNamespace>
<AssemblyName>NpgsqlBlogProvider</AssemblyName> <AssemblyName>NpgsqlBlogProvider</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>

@ -1172,10 +1172,13 @@ namespace Npgsql.Web
{ {
MembershipUserCollection users = new MembershipUserCollection (); MembershipUserCollection users = new MembershipUserCollection ();
using (NpgsqlConnection conn = new NpgsqlConnection (connectionString)) { using (NpgsqlConnection conn = new NpgsqlConnection (connectionString)) {
conn.Open ();
using (NpgsqlCommand cmd = new NpgsqlCommand ("SELECT count(*) " + using (NpgsqlCommand cmd = new NpgsqlCommand ("SELECT count(*) " +
" FROM Users " + " FROM Users " +
" WHERE Email LIKE @EmailSearch AND ApplicationName = @ApplicationName ", conn)) { " WHERE Email LIKE @EmailSearch AND ApplicationName = @appname ", conn)) {
totalRecords = (int)cmd.ExecuteScalar (); cmd.Parameters.Add ("@EmailSearch", emailToMatch);
cmd.Parameters.Add ("@appname", this.ApplicationName);
totalRecords = (int)(long)cmd.ExecuteScalar ();
} }
using (NpgsqlCommand cmd = new NpgsqlCommand ("SELECT PKID, Username, Email, PasswordQuestion," + using (NpgsqlCommand cmd = new NpgsqlCommand ("SELECT PKID, Username, Email, PasswordQuestion," +
@ -1186,7 +1189,6 @@ namespace Npgsql.Web
" ORDER BY Username Asc", conn)) { " ORDER BY Username Asc", conn)) {
cmd.Parameters.Add ("@EmailSearch", NpgsqlDbType.Varchar, 255).Value = emailToMatch; cmd.Parameters.Add ("@EmailSearch", NpgsqlDbType.Varchar, 255).Value = emailToMatch;
cmd.Parameters.Add ("@ApplicationName", NpgsqlDbType.Varchar, 255).Value = ApplicationName; cmd.Parameters.Add ("@ApplicationName", NpgsqlDbType.Varchar, 255).Value = ApplicationName;
conn.Open ();
using (NpgsqlDataReader reader = cmd.ExecuteReader ()) { using (NpgsqlDataReader reader = cmd.ExecuteReader ()) {
int counter = 0; int counter = 0;
int startIndex = pageSize * pageIndex; int startIndex = pageSize * pageIndex;
@ -1204,8 +1206,9 @@ namespace Npgsql.Web
} }
reader.Close (); reader.Close ();
} }
conn.Close ();
} }
conn.Close ();
} }
return users; return users;
} }

@ -9,6 +9,7 @@
<OutputType>Library</OutputType> <OutputType>Library</OutputType>
<RootNamespace>SalesCatalog</RootNamespace> <RootNamespace>SalesCatalog</RootNamespace>
<AssemblyName>SalesCatalog</AssemblyName> <AssemblyName>SalesCatalog</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
@ -31,12 +32,9 @@
<ItemGroup> <ItemGroup>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
<Reference Include="nunit.framework, Version=2.6.0.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77">
<Package>nunit</Package>
</Reference>
<Reference Include="System.ComponentModel.DataAnnotations" /> <Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Configuration" /> <Reference Include="System.Configuration" />
<Reference Include="System.Web.WebPages, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" /> <Reference Include="System.Web.WebPages" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="AssemblyInfo.cs" /> <Compile Include="AssemblyInfo.cs" />

@ -9,6 +9,7 @@
<OutputType>Library</OutputType> <OutputType>Library</OutputType>
<RootNamespace>WebControls</RootNamespace> <RootNamespace>WebControls</RootNamespace>
<AssemblyName>Yavsc.WebControls</AssemblyName> <AssemblyName>Yavsc.WebControls</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
@ -30,12 +31,12 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<Reference Include="System.Web.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<Reference Include="System.Web.Extensions" /> <Reference Include="System.Web.Extensions" />
<Reference Include="System.Web.DynamicData" /> <Reference Include="System.Web.DynamicData" />
<Reference Include="System.Web" /> <Reference Include="System.Web" />
<Reference Include="System.Web.Abstractions" /> <Reference Include="System.Web.Abstractions" />
<Reference Include="System.Web.Mvc" />
<Reference Include="System.Web.Http" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />

@ -9,6 +9,7 @@
<OutputType>Library</OutputType> <OutputType>Library</OutputType>
<RootNamespace>WorkFlowProvider</RootNamespace> <RootNamespace>WorkFlowProvider</RootNamespace>
<AssemblyName>WorkFlowProvider</AssemblyName> <AssemblyName>WorkFlowProvider</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
@ -33,7 +34,7 @@
<Reference Include="Npgsql" /> <Reference Include="Npgsql" />
<Reference Include="System.Configuration" /> <Reference Include="System.Configuration" />
<Reference Include="System.Data" /> <Reference Include="System.Data" />
<Reference Include="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" /> <Reference Include="System.Web.Mvc" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />

@ -1,9 +1,18 @@
using System; using System;
using Yavsc.Model; using Yavsc.Model;
using System.Configuration; using System.Configuration;
using System.Text;
using System.Web.Mvc;
using System.Collections.Generic;
namespace fortune namespace fortune
{ {
public class Entry {
public string Message{ get; set; }
public string Author{ get; set; }
public string Body{ get; set; }
}
public class MyClass : IModule public class MyClass : IModule
{ {
public MyClass () public MyClass ()
@ -11,45 +20,47 @@ namespace fortune
} }
#region IModule implementation #region IModule implementation
string tblname = "fortune";
public void Install (System.Data.IDbConnection cnx) public void Install (System.Data.IDbConnection cnx)
{ {
throw new NotImplementedException (); using (var cmd = cnx.CreateCommand())
{
StringBuilder strb = new StringBuilder (string.Format("create table {0} ",tblname));
strb.Append ( "( author character varying (1024) not null, \n");
strb.Append ( "body character varying (65536) not null," +
"CONSTRAINT uniqueid PRIMARY KEY (uniqueid)," +
"uniqueid bigserial NOT NULL ) WITH (\n OIDS=FALSE\n);"
+string.Format("CREATE INDEX fki_cst{0}ref\n ON wrtags\n USING btree\n (tagid);",
tblname));
cmd.CommandText = strb.ToString ();
cmd.ExecuteNonQuery ();
}
} }
public void Uninstall (System.Data.IDbConnection cnx, bool removeConfig) public void Uninstall (System.Data.IDbConnection cnx, bool removeConfig)
{ {
throw new NotImplementedException (); using (var cmd = cnx.CreateCommand ()) {
cmd.CommandText = string.Format ("drop table {0};", tblname);
cmd.ExecuteNonQuery ();
}
} }
public ConfigurationSection DefaultConfig (string appName, string cnxStr)
{
throw new NotImplementedException ();
}
public void Initialize (string name, System.Collections.Specialized.NameValueCollection config) public void Initialize (string name, System.Collections.Specialized.NameValueCollection config)
{ {
throw new NotImplementedException ();
} }
/*
public bool Active { public class Discovery {
get { IServiceProvider[] Provider;
throw new NotImplementedException (); ISettingsProviderService[] SettingsBase;
}
set {
throw new NotImplementedException ();
}
} }
public string ApplicationName { public Discovery GetServices() {
get { throw new NotImplementedException ();
throw new NotImplementedException ();
}
set {
throw new NotImplementedException ();
}
} }
*/
#endregion #endregion
} }
} }

@ -9,6 +9,7 @@
<OutputType>Library</OutputType> <OutputType>Library</OutputType>
<RootNamespace>fortune</RootNamespace> <RootNamespace>fortune</RootNamespace>
<AssemblyName>fortune</AssemblyName> <AssemblyName>fortune</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
@ -32,6 +33,7 @@
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Configuration" /> <Reference Include="System.Configuration" />
<Reference Include="System.Data" /> <Reference Include="System.Data" />
<Reference Include="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="MyClass.cs" /> <Compile Include="MyClass.cs" />

@ -21,7 +21,13 @@ namespace Yavsc.Controllers
WebConfigurationManager.AppSettings ["RegistrationMessage"]; WebConfigurationManager.AppSettings ["RegistrationMessage"];
string avatarDir = "~/avatars"; string avatarDir = "~/avatars";
/// <summary>
/// Gets or sets the avatar dir.
/// This value is past to <c>Server.MapPath</c>,
/// it should start with </c>~/</c>, and we assume it
/// to be relative to the application path.
/// </summary>
/// <value>The avatar dir.</value>
public string AvatarDir { public string AvatarDir {
get { return avatarDir; } get { return avatarDir; }
set { avatarDir = value; } set { avatarDir = value; }
@ -159,6 +165,17 @@ namespace Yavsc.Controllers
return View(); return View();
} }
[Authorize]
public ActionResult Unregister(bool confirmed=false)
{
if (!confirmed)
return View ();
Membership.DeleteUser (
Membership.GetUser ().UserName);
return RedirectToAction ("Index","Home");
}
[Authorize] [Authorize]
[HttpPost] [HttpPost]
public ActionResult ChangePassword (ChangePasswordModel model) public ActionResult ChangePassword (ChangePasswordModel model)
@ -173,6 +190,7 @@ namespace Yavsc.Controllers
if (users.Count > 0) { if (users.Count > 0) {
MembershipUser user = Membership.GetUser (model.Username,true); MembershipUser user = Membership.GetUser (model.Username,true);
changePasswordSucceeded = user.ChangePassword (model.OldPassword, model.NewPassword); changePasswordSucceeded = user.ChangePassword (model.OldPassword, model.NewPassword);
} else { } else {
changePasswordSucceeded = false; changePasswordSucceeded = false;
@ -213,13 +231,15 @@ namespace Yavsc.Controllers
if (AvatarFile != null) { if (AvatarFile != null) {
if (AvatarFile.ContentType == "image/png") { if (AvatarFile.ContentType == "image/png") {
// byte[] img = new byte[AvatarFile.ContentLength];
// AvatarFile.InputStream.Read (img, 0, AvatarFile.ContentLength);
// model.Avatar = img;
string avdir=Server.MapPath (AvatarDir); string avdir=Server.MapPath (AvatarDir);
string avpath=Path.Combine(avdir,username+".png"); string avpath=Path.Combine(avdir,username+".png");
AvatarFile.SaveAs (avpath); AvatarFile.SaveAs (avpath);
string avuri = avpath.Substring(
AppDomain.CurrentDomain.BaseDirectory.Length);
avuri = avuri.Replace (" ", "+");
avuri = Request.Url.Scheme + "://" + Request.Url.Authority + "/" + avuri;
HttpContext.Profile.SetPropertyValue ("avatar", avuri );
HttpContext.Profile.Save ();
} else } else
ModelState.AddModelError ("Avatar", ModelState.AddModelError ("Avatar",
string.Format ("Image type {0} is not supported (suported formats : {1})", string.Format ("Image type {0} is not supported (suported formats : {1})",

@ -11,6 +11,12 @@ namespace Yavsc.ApiControllers
// TODO should mostly be an API Controller // TODO should mostly be an API Controller
public class BasketController : ApiController public class BasketController : ApiController
{ {
protected WorkFlowManager wfmgr = null;
protected override void Initialize (System.Web.Http.Controllers.HttpControllerContext controllerContext)
{
base.Initialize (controllerContext);
wfmgr = new WorkFlowManager ();
}
/// <summary> /// <summary>
/// Validates the order. /// Validates the order.
/// ///
@ -42,7 +48,7 @@ namespace Yavsc.ApiControllers
[Authorize] [Authorize]
public Estimate[] YourEstimates() public Estimate[] YourEstimates()
{ {
return WorkFlowManager.GetEstimates ( return wfmgr.GetEstimates (
Membership.GetUser().UserName); Membership.GetUser().UserName);
} }

@ -18,6 +18,7 @@ using Yavsc.Model;
using Yavsc.Model.Blogs; using Yavsc.Model.Blogs;
using Yavsc.ApiControllers; using Yavsc.ApiControllers;
using Yavsc.Model.RolesAndMembers; using Yavsc.Model.RolesAndMembers;
using System.Net;
namespace Yavsc.Controllers namespace Yavsc.Controllers
{ {
@ -234,12 +235,19 @@ namespace Yavsc.Controllers
[AcceptVerbs (HttpVerbs.Get)] [AcceptVerbs (HttpVerbs.Get)]
public ActionResult Avatar (string user) public ActionResult Avatar (string user)
{ {
string avpath = Path.Combine ( ProfileBase pr = ProfileBase.Create (user);
Server.MapPath (AvatarDir), user + ".png");
FileInfo fia = new FileInfo (avpath); string avpath = (string) pr.GetPropertyValue ("avatar");
if (!fia.Exists) if (avpath == null) {
fia = new FileInfo (Server.MapPath (defaultAvatar)); FileInfo fia = new FileInfo (Server.MapPath (defaultAvatar));
return File (fia.OpenRead (), defaultAvatarMimetype); return File (fia.OpenRead (), defaultAvatarMimetype);
}
WebRequest wr = WebRequest.Create(avpath);
using (WebResponse resp = wr.GetResponse ()) {
using (Stream str = resp.GetResponseStream ()) {
return File (str, resp.ContentType);
}
}
} }
/// <summary> /// <summary>

@ -29,6 +29,14 @@ namespace Yavsc.ApiControllers
public class FrontOfficeController : ApiController public class FrontOfficeController : ApiController
{ {
protected WorkFlowManager wfmgr = null;
protected override void Initialize (System.Web.Http.Controllers.HttpControllerContext controllerContext)
{
base.Initialize (controllerContext);
wfmgr = new WorkFlowManager ();
}
[AcceptVerbs("GET")] [AcceptVerbs("GET")]
public Catalog Catalog () public Catalog Catalog ()
{ {
@ -87,7 +95,7 @@ namespace Yavsc.ApiControllers
/// <param name="estid">Estid.</param> /// <param name="estid">Estid.</param>
public Estimate GetEstimate (long Id) public Estimate GetEstimate (long Id)
{ {
Estimate est = WorkFlowManager.ContentProvider.GetEstimate (Id); Estimate est = wfmgr.ContentProvider.GetEstimate (Id);
return est; return est;
} }
@ -107,7 +115,7 @@ namespace Yavsc.ApiControllers
private string getEstimTex(long estimid) private string getEstimTex(long estimid)
{ {
Yavsc.templates.Estim tmpe = new Yavsc.templates.Estim(); Yavsc.templates.Estim tmpe = new Yavsc.templates.Estim();
Estimate e = WorkFlowManager.GetEstimate (estimid); Estimate e = wfmgr.GetEstimate (estimid);
tmpe.Session = new Dictionary<string,object>(); tmpe.Session = new Dictionary<string,object>();
tmpe.Session.Add ("estim", e); tmpe.Session.Add ("estim", e);
@ -132,7 +140,7 @@ namespace Yavsc.ApiControllers
/// <param name="estimid">Estimid.</param> /// <param name="estimid">Estimid.</param>
public HttpResponseMessage GetEstimPdf(long estimid) public HttpResponseMessage GetEstimPdf(long estimid)
{ {
Estimate estim = WorkFlowManager.GetEstimate (estimid); Estimate estim = wfmgr.GetEstimate (estimid);
//TODO better with pro.IsBankable && cli.IsBillable //TODO better with pro.IsBankable && cli.IsBillable
return new HttpResponseMessage () { return new HttpResponseMessage () {

@ -8,6 +8,7 @@ using System.Text.RegularExpressions;
using System.IO; using System.IO;
using Yavsc.Controllers; using Yavsc.Controllers;
using System.Collections.Generic; using System.Collections.Generic;
using Yavsc.Model;
using Yavsc.Model.WorkFlow; using Yavsc.Model.WorkFlow;
using WorkFlowProvider; using WorkFlowProvider;
using System.Web.Security; using System.Web.Security;
@ -21,14 +22,20 @@ namespace Yavsc.Controllers
/// </summary> /// </summary>
public class FrontOfficeController : Controller public class FrontOfficeController : Controller
{ {
/* protected WorkFlowManager wfmgr = null;
protected override void Initialize (System.Web.Routing.RequestContext requestContext)
{
base.Initialize (requestContext);
wfmgr = new WorkFlowManager ();
}
*/
[Authorize] [Authorize]
public ActionResult Estimates () public ActionResult Estimates ()
{ {
string username = Membership.GetUser ().UserName; string username = Membership.GetUser ().UserName;
return View(WorkFlowManager.GetEstimates (username));
return View(wfmgr.GetEstimates (username));
} }
[Authorize] [Authorize]
@ -38,7 +45,7 @@ namespace Yavsc.Controllers
ViewData ["WABASEWF"] = ViewData ["WebApiBase"] + "/WorkFlow"; ViewData ["WABASEWF"] = ViewData ["WebApiBase"] + "/WorkFlow";
if (submit == null) { if (submit == null) {
if (model.Id > 0) { if (model.Id > 0) {
Estimate f = WorkFlowManager.GetEstimate (model.Id); Estimate f = wfmgr.GetEstimate (model.Id);
if (f == null) { if (f == null) {
ModelState.AddModelError ("Id", "Wrong Id"); ModelState.AddModelError ("Id", "Wrong Id");
return View (model); return View (model);
@ -64,12 +71,12 @@ namespace Yavsc.Controllers
throw new UnauthorizedAccessException ("You're not allowed to modify this estimate"); throw new UnauthorizedAccessException ("You're not allowed to modify this estimate");
if (model.Id == 0) if (model.Id == 0)
model = WorkFlowManager.CreateEstimate ( model = wfmgr.CreateEstimate (
username, username,
model.Client, model.Title, model.Description); model.Client, model.Title, model.Description);
else { else {
WorkFlowManager.UpdateEstimate (model); wfmgr.UpdateEstimate (model);
model = WorkFlowManager.GetEstimate (model.Id); model = wfmgr.GetEstimate (model.Id);
} }
} }
} }

@ -12,27 +12,27 @@ using System.Net;
using System.IO; using System.IO;
using Yavsc.Model; using Yavsc.Model;
using Newtonsoft.Json; using Newtonsoft.Json;
using Yavsc.Model.Google;
using Yavsc.Model.RolesAndMembers;
using System.Web.Security;
using System.Web.Profile;
namespace Yavsc.Controllers namespace Yavsc.Controllers
{ {
public class TokenResult {
public string access_token { get; set; }
public string id_token { get; set; }
public int expires_in { get; set; }
public string token_type { get; set ; }
public string refresh_token { get; set; }
}
public class GoogleController : Controller public class GoogleController : Controller
{ {
private string API_KEY="AIzaSyBV_LQHb22nGgjNvFzZwnQHjao3Q7IewRw"; // private string API_KEY="AIzaSyBV_LQHb22nGgjNvFzZwnQHjao3Q7IewRw";
private string getPeopleUri = "https://www.googleapis.com/plus/v1/people";
private string CLIENT_ID="325408689282-6bekh7p3guj4k0f3301a6frf025cnrk1.apps.googleusercontent.com"; private string CLIENT_ID="325408689282-6bekh7p3guj4k0f3301a6frf025cnrk1.apps.googleusercontent.com";
private string CLIENT_SECRET="MaxYcvJJCs2gDGvaELZbzwfL"; private string CLIENT_SECRET="MaxYcvJJCs2gDGvaELZbzwfL";
string [] SCOPES = { string [] SCOPES = {
"openid" ,
"profile", "profile",
"email" "email"
} ; } ;
@ -40,43 +40,37 @@ namespace Yavsc.Controllers
string tokenUri = "https://accounts.google.com/o/oauth2/token"; string tokenUri = "https://accounts.google.com/o/oauth2/token";
string authUri = "https://accounts.google.com/o/oauth2/auth"; string authUri = "https://accounts.google.com/o/oauth2/auth";
public void Login() public void Login(string returnUrl)
{ {
if (string.IsNullOrWhiteSpace (returnUrl))
returnUrl = "/";
Random rand = new Random (); Random rand = new Random ();
string state = "security_token"+rand.Next (100000).ToString()+rand.Next (100000).ToString(); string state = "security_token"+rand.Next (100000).ToString()+rand.Next (100000).ToString();
Session ["state"] = state; Session ["state"] = state;
Session ["returnUrl"] = returnUrl;
string redirectUri = Request.Url.Scheme + "://" + Request.Url.Authority + "/Google/Auth"; string redirectUri = Request.Url.Scheme + "://" + Request.Url.Authority + "/Google/Auth";
string prms = String.Format("response_type=code&" + string prms = String.Format("response_type=code&client_id={0}&redirect_uri={1}&scope={2}&state={3}&access_type=offline&include_granted_scopes=false",
"client_id={0}&" + CLIENT_ID, redirectUri, string.Join("%20",SCOPES), state);
"redirect_uri={1}&" +
"scope={2}&" +
"state={3}&" +
"access_type=offline&" +
"include_granted_scopes=false",
CLIENT_ID,
redirectUri,
string.Join("%20",SCOPES),
state
);
WebRequest wr = WebRequest.Create(authUri+"?"+prms); WebRequest wr = WebRequest.Create(authUri+"?"+prms);
wr.Method = "GET"; wr.Method = "GET";
// Get the response. // Get the response.
try {
WebResponse response = wr.GetResponse(); WebResponse response = wr.GetResponse();
string resQuery = response.ResponseUri.Query; string resQuery = response.ResponseUri.Query;
string cont = HttpUtility.ParseQueryString(resQuery)["continue"]; string cont = HttpUtility.ParseQueryString(resQuery)["continue"];
Response.Redirect (cont); Response.Redirect (cont);
}
catch (WebException we) {
Response.Redirect(we.Response.ResponseUri.AbsoluteUri);
}
} }
public void Auth() {
[HttpGet]
public ActionResult Auth()
{
string returnUrl = (string) Session ["returnUrl"];
string redirectUri = Request.Url.Scheme + "://" + Request.Url.Authority + "/Google/Auth"; string redirectUri = Request.Url.Scheme + "://" + Request.Url.Authority + "/Google/Auth";
string code = Request.Params ["code"]; string code = Request.Params ["code"];
string error = Request.Params ["error"]; string error = Request.Params ["error"];
@ -84,13 +78,13 @@ namespace Yavsc.Controllers
ViewData ["Message"] = ViewData ["Message"] =
string.Format(LocalizedText.Google_error, string.Format(LocalizedText.Google_error,
LocalizedText.ResourceManager.GetString(error)); LocalizedText.ResourceManager.GetString(error));
return; return View();
} }
string state = Request.Params ["state"]; string state = Request.Params ["state"];
if (state!=null && string.Compare((string)Session ["state"],state)!=0) { if (state!=null && string.Compare((string)Session ["state"],state)!=0) {
ViewData ["Message"] = ViewData ["Message"] =
LocalizedText.ResourceManager.GetString("invalid request state"); LocalizedText.ResourceManager.GetString("invalid request state");
return; return View();
} }
string postdata = string postdata =
@ -112,17 +106,113 @@ namespace Yavsc.Controllers
}; };
using (WebResponse response = webreq.GetResponse ()) { using (WebResponse response = webreq.GetResponse ()) {
using (Stream responseStream = response.GetResponseStream ()) { using (Stream responseStream = response.GetResponseStream ()) {
using (StreamReader readStream = new StreamReader (responseStream, Encoding.ASCII)) { using (StreamReader readStream = new StreamReader (responseStream, Encoding.UTF8)) {
string responseStr = readStream.ReadToEnd (); string responseStr = readStream.ReadToEnd ();
TokenResult res = JsonConvert.DeserializeObject<TokenResult>(responseStr); AuthToken gat = JsonConvert.DeserializeObject<AuthToken>(responseStr);
Session ["GoogleAuthToken"] = gat;
SignIn regmod = new SignIn ();
HttpWebRequest webreppro = WebRequest.CreateHttp (getPeopleUri+"/me");
webreppro.ContentType = "application/http";
webreppro.Headers.Add (HttpRequestHeader.Authorization, gat.token_type + " " + gat.access_token);
webreppro.Method = "GET";
using (WebResponse proresp = webreppro.GetResponse ()) {
using (Stream prresponseStream = proresp.GetResponseStream ()) {
using (StreamReader readproresp = new StreamReader (prresponseStream, Encoding.UTF8)) {
string prresponseStr = readproresp.ReadToEnd ();
People me = JsonConvert.DeserializeObject<People> (prresponseStr);
// TODO use me.id to retreive an existing user
string accEmail = me.emails.Where (x => x.type == "account").First().value;
MembershipUserCollection mbrs = Membership.FindUsersByEmail (accEmail);
if (mbrs.Count == 1) {
// TODO check the google id
// just set this user as logged on
FormsAuthentication.SetAuthCookie (me.displayName, true);
Session ["returnUrl"] = null;
return Redirect (returnUrl);
}
// else create the account
regmod.Email = accEmail;
regmod.UserName = me.displayName;
Session ["me"] = me;
return Auth(regmod);
}
}
}
}
}
}
}
/// <summary>
/// Creates an account using the Google authentification.
/// </summary>
/// <param name="regmod">Regmod.</param>
[HttpPost]
public ActionResult Auth(SignIn regmod)
{
if (ModelState.IsValid) {
if (Membership.GetUser (regmod.UserName) != null) {
ModelState.AddModelError ("UserName", "This user name already is in use");
return View ();
}
string returnUrl = (string)Session ["returnUrl"];
AuthToken gat = (AuthToken)Session ["GoogleAuthToken"];
People me = (People)Session ["me"];
if (gat == null || me == null)
throw new InvalidDataException ();
Random rand = new Random ();
string passwd = rand.Next (100000).ToString () + rand.Next (100000).ToString ();
MembershipCreateStatus mcs;
Membership.CreateUser (
regmod.UserName,
passwd,
regmod.Email,
null,
null,
true,
out mcs);
switch (mcs) {
case MembershipCreateStatus.DuplicateEmail:
ModelState.AddModelError ("Email", "Cette adresse e-mail correspond " +
"à un compte utilisateur existant");
return View (regmod);
case MembershipCreateStatus.DuplicateUserName:
ModelState.AddModelError ("UserName", "Ce nom d'utilisateur est " +
"déjà enregistré");
return View (regmod);
case MembershipCreateStatus.Success:
Membership.ValidateUser (regmod.UserName, passwd);
FormsAuthentication.SetAuthCookie (regmod.UserName, true);
HttpContext.Profile.Initialize (regmod.UserName, true);
HttpContext.Profile.SetPropertyValue ("gtoken", gat.access_token);
HttpContext.Profile.SetPropertyValue ("Name", me.displayName);
// TODO use image
if (me.image != null) {
HttpContext.Profile.SetPropertyValue ("avatar", me.image.url);
}
if (me.placesLived != null) {
People.Place pplace = me.placesLived.Where (x => x.primary).First ();
if (pplace != null)
HttpContext.Profile.SetPropertyValue ("Address", pplace.value);
} }
if (me.url != null)
HttpContext.Profile.SetPropertyValue ("WebSite", me.url);
HttpContext.Profile.Save ();
return Redirect (returnUrl);
} }
ViewData ["returnUrl"] = returnUrl;
} }
return View (regmod);
} }
public void ChooseCalendar()
{
throw new NotImplementedException();
}
} }
} }

@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Yavsc.Model;
using System.Configuration;
namespace Yavsc.Controllers
{
public class ModuleController : Controller
{
protected override void Initialize (System.Web.Routing.RequestContext requestContext)
{
base.Initialize (requestContext);
ConfigurationManager.GetSection ("ymodules");
}
// List<IModule> modules = new List<IModule> ();
public ActionResult Index()
{
return View ();
}
}
}

@ -15,7 +15,7 @@ namespace Yavsc.ApiControllers
public class WorkFlowController : ApiController public class WorkFlowController : ApiController
{ {
string adminRoleName="Admin"; string adminRoleName="Admin";
protected WorkFlowManager wfmgr = null;
protected override void Initialize (HttpControllerContext controllerContext) protected override void Initialize (HttpControllerContext controllerContext)
{ {
// TODO move it in a module initialization // TODO move it in a module initialization
@ -23,13 +23,14 @@ namespace Yavsc.ApiControllers
if (!Roles.RoleExists (adminRoleName)) { if (!Roles.RoleExists (adminRoleName)) {
Roles.CreateRole (adminRoleName); Roles.CreateRole (adminRoleName);
} }
wfmgr = new WorkFlowManager ();
} }
[HttpGet] [HttpGet]
[Authorize] [Authorize]
public Estimate CreateEstimate (string title,string client,string description) public Estimate CreateEstimate (string title,string client,string description)
{ {
return WorkFlowManager.CreateEstimate ( return wfmgr.CreateEstimate (
Membership.GetUser().UserName,client,title,description); Membership.GetUser().UserName,client,title,description);
} }
@ -37,7 +38,7 @@ namespace Yavsc.ApiControllers
[Authorize] [Authorize]
public void DropWritting(long wrid) public void DropWritting(long wrid)
{ {
WorkFlowManager.DropWritting (wrid); wfmgr.DropWritting (wrid);
} }
@ -46,13 +47,13 @@ namespace Yavsc.ApiControllers
[Authorize] [Authorize]
public void DropEstimate(long estid) public void DropEstimate(long estid)
{ {
WorkFlowManager.DropEstimate (estid); wfmgr.DropEstimate (estid);
} }
[HttpGet] [HttpGet]
[Authorize] [Authorize]
public object Index() public object Index()
{ {
// TODO inform user on its roles and alerts // TODO inform user on its roles and alerts
string username = Membership.GetUser ().UserName; string username = Membership.GetUser ().UserName;
return new { test=string.Format("Hello {0}!",username) }; return new { test=string.Format("Hello {0}!",username) };
@ -75,7 +76,7 @@ namespace Yavsc.ApiControllers
[ValidateAjax] [ValidateAjax]
public HttpResponseMessage UpdateWritting([FromBody] Writting wr) public HttpResponseMessage UpdateWritting([FromBody] Writting wr)
{ {
WorkFlowManager.UpdateWritting (wr); wfmgr.UpdateWritting (wr);
return Request.CreateResponse (System.Net.HttpStatusCode.OK); return Request.CreateResponse (System.Net.HttpStatusCode.OK);
} }
@ -95,7 +96,7 @@ namespace Yavsc.ApiControllers
} }
try { try {
return Request.CreateResponse(System.Net.HttpStatusCode.OK, return Request.CreateResponse(System.Net.HttpStatusCode.OK,
WorkFlowManager.Write(estid, wr.Description, wfmgr.Write(estid, wr.Description,
wr.UnitaryCost, wr.Count, wr.ProductReference)); wr.UnitaryCost, wr.Count, wr.ProductReference));
} }
catch (Exception ex) { catch (Exception ex) {

@ -17,9 +17,8 @@ namespace Yavsc
{ {
routes.IgnoreRoute ("{resource}.axd/{*pathInfo}"); routes.IgnoreRoute ("{resource}.axd/{*pathInfo}");
routes.IgnoreRoute ("js/{*pathInfo}"); routes.IgnoreRoute ("Scripts/{*pathInfo}");
routes.IgnoreRoute ("Theme/{*pathInfo}"); routes.IgnoreRoute ("Theme/{*pathInfo}");
routes.IgnoreRoute ("css/{*pathInfo}");
routes.IgnoreRoute ("images/{*pathInfo}"); routes.IgnoreRoute ("images/{*pathInfo}");
routes.MapRoute ( routes.MapRoute (
@ -44,7 +43,6 @@ namespace Yavsc
protected void Application_Start () protected void Application_Start ()
{ {
AreaRegistration.RegisterAllAreas (); AreaRegistration.RegisterAllAreas ();
// add formatters : GlobalConfiguration.Configuration.Formatters.Add (new ZeroFormatter ());
GlobalConfiguration.Configuration.Routes.MapHttpRoute( GlobalConfiguration.Configuration.Routes.MapHttpRoute(
name: "DefaultApi", name: "DefaultApi",
routeTemplate: "api/{controller}/{action}/{*id}", routeTemplate: "api/{controller}/{action}/{*id}",

@ -43,6 +43,10 @@
<span class="hidcom"> Page d'accueil </span> <span class="hidcom"> Page d'accueil </span>
<%= Html.ActionLink("Login", "Login", "Account", new { returnUrl=Request.Url.PathAndQuery }, new { @class="actionlink" } ) %> <%= Html.ActionLink("Login", "Login", "Account", new { returnUrl=Request.Url.PathAndQuery }, new { @class="actionlink" } ) %>
<span class="hidcom">Pour pouvoir poster ou commenter</span> <span class="hidcom">Pour pouvoir poster ou commenter</span>
<a href="<%=Request.Url.Scheme + "://" + Request.Url.Authority + "/Google/Login"%>?returnUrl=<%=ViewData["returnUrl"]%>" class="actionlink">
<img src="/images/sign-in-with-google.png" style="max-height:1.5em; max-width:6em;" alt="Google sign in">
</a>
<span class="hidcom">S'authentifier avec son compte Google+</span>
<% } else { %> <% } else { %>
<%= Html.ActionLink(HttpContext.Current.User.Identity.Name, "Profile", "Account", null, new { @class="actionlink" }) %> <%= Html.ActionLink(HttpContext.Current.User.Identity.Name, "Profile", "Account", null, new { @class="actionlink" }) %>
<span class="hidcom"> &Eacute;dition de votre profile </span> <span class="hidcom"> &Eacute;dition de votre profile </span>

@ -0,0 +1,50 @@
//
// ModuleConfigurationElement.cs
//
// Author:
// Paul Schneider <paulschneider@free.fr>
//
// Copyright (c) 2014 Paul Schneider
//
// 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.Configuration;
namespace Yavsc.Settings
{
public class ModuleConfigurationElement : ConfigurationElement
{
public ModuleConfigurationElement ()
{
}
[ConfigurationProperty("name", IsKey=true, IsRequired=true)]
public string Name {
get {
return (string) base ["name"];
}
set { base ["name"] = value; }
}
[ConfigurationProperty("name", IsKey=true, IsRequired=true)]
public string ClassName {
get {
return (string) base ["classname"];
}
set { base ["classname"] = value; }
}
}
}

@ -0,0 +1,47 @@
//
// ModuleConfigurationElementCollection.cs
//
// Author:
// Paul Schneider <paulschneider@free.fr>
//
// Copyright (c) 2014 Paul Schneider
//
// 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.Configuration;
namespace Yavsc.Settings
{
public class ModuleConfigurationElementCollection : ConfigurationElementCollection
{
public ModuleConfigurationElementCollection ()
{
}
#region implemented abstract members of ConfigurationElementCollection
protected override ConfigurationElement CreateNewElement ()
{
throw new NotImplementedException ();
}
protected override object GetElementKey (ConfigurationElement element)
{
throw new NotImplementedException ();
}
#endregion
}
}

@ -0,0 +1,33 @@
//
// ModulesConfigurationSection.cs
//
// Author:
// Paul Schneider <paulschneider@free.fr>
//
// Copyright (c) 2014 Paul Schneider
//
// 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.Configuration;
namespace Yavsc.Settings
{
public class ModulesConfigurationSection : ConfigurationSection
{
public ModulesConfigurationSection ()
{
}
}
}

@ -1,22 +0,0 @@
using System;
using System.Configuration;
namespace Yavsc
{
public class ThanksConfigurationCollection : ConfigurationElementCollection
{
protected override object GetElementKey (ConfigurationElement element)
{
return ((ThanksConfigurationElement) element).Name;
}
protected override ConfigurationElement CreateNewElement ()
{
return new ThanksConfigurationElement();
}
public ThanksConfigurationElement GetElement (string name)
{
return this.BaseGet(name) as ThanksConfigurationElement;
}
}
}

@ -1,48 +0,0 @@
using System;
using System.Configuration;
namespace Yavsc
{
public class ThanksConfigurationElement : ConfigurationElement
{
[ConfigurationProperty("name", IsKey=true, IsRequired=true)]
public string Name {
get {
return (string) base ["name"];
}
set { base ["name"] = value; }
}
[ConfigurationProperty("url")]
public string Url {
get {
return (string) base ["url"];
}
set { base ["url"] = value; }
}
[ConfigurationProperty("image")]
public string Image {
get {
return (string) base ["image"];
}
set { base ["image"] = value; }
}
/// <summary>
/// Gets or sets the display.
/// </summary>
/// <value>
/// The displaied text when no image is provided and we
/// don't want use the name attribute.
/// </value>
[ConfigurationProperty("display")]
public string Display {
get {
return (string) base ["display"];
}
set { base ["display"] = value; }
}
}
}

@ -1,39 +0,0 @@
using System;
using System.Configuration;
namespace Yavsc
{
public class ThanksConfigurationSection : ConfigurationSection
{
[ConfigurationProperty("to")]
public ThanksConfigurationCollection To {
get {
return (ThanksConfigurationCollection) this["to"];
}
set {
this ["to"] = value;
}
}
[ConfigurationProperty("html_class")]
public string HtmlClass {
get {
return (string)this ["html_class"];
}
set {
this ["html_class"] = value;
}
}
[ConfigurationProperty("title_format")]
public string TitleFormat {
get {
return (string)this ["title_format"];
}
set {
this ["title_format"] = value;
}
}
}
}

@ -1,43 +0,0 @@
using System;
using System.Configuration;
using System.Collections.Generic;
namespace Yavsc
{
public static class ThanksHelper {
static private ThanksConfigurationSection configurationSection=null;
static public ThanksConfigurationSection ConfigurationSection {
get {
if (configurationSection==null)
configurationSection = (ThanksConfigurationSection) ConfigurationManager.GetSection ("system.web/thanks");
return configurationSection;
}
}
public static string[] Links ()
{
List<string> result = new List<string>() ;
if (ConfigurationSection == null) return result.ToArray();
if (ConfigurationSection.To == null) return result.ToArray();
foreach (ThanksConfigurationElement e in ConfigurationSection.To) {
string link = "";
if (!string.IsNullOrEmpty(e.Url))
link = string.Format("<a href=\"{0}\">",e.Url);
string dsp = (string.IsNullOrEmpty(e.Display))?e.Name:e.Display;
if (!string.IsNullOrEmpty(e.Image)) {
string ttl = (string.IsNullOrEmpty(ConfigurationSection.TitleFormat))?"Go and see the website ({0})":ConfigurationSection.TitleFormat;
ttl = string.Format(ttl,dsp);
link += string.Format(
"<img src=\"{1}\" alt=\"{0}\" title=\"{2}\"/>",
dsp,e.Image,ttl);
}
else link += dsp;
if (e.Url!=null)
link += "</a> ";
result.Add (link);
}
return result.ToArray();
}
}
}

@ -3,4 +3,4 @@
<h2>Comptes utilisteur</h2> <h2>Comptes utilisteur</h2>
</asp:Content> </asp:Content>
<asp:Content ContentPlaceHolderID="MainContent" ID="MainContentContent" runat="server"> <asp:Content ContentPlaceHolderID="MainContent" ID="MainContentContent" runat="server">
</asp:Content> </asp:Content>

@ -19,5 +19,5 @@
<input type="submit"/> <input type="submit"/>
<% } %> <% } %>
<%= Html.ActionLink("S'enregistrer","Register",new {returnUrl=ViewData["returnUrl"]}) %> <%= Html.ActionLink("S'enregistrer","Register",new {returnUrl=ViewData["returnUrl"]}, new { @class="actionlink" }) %>
</asp:Content> </asp:Content>

@ -1,10 +0,0 @@
<%@ Page Title="Login" Language="C#" Inherits="System.Web.Mvc.ViewPage" MasterPageFile="~/Models/App.master" %>
<asp:Content ContentPlaceHolderID="MainContent" ID="MainContentContent" runat="server">
<%= Html.ValidationSummary("Ouverture de session avec OpenID") %>
<% using(Html.BeginForm("OpenIDLogOn", "Account")) %>
<% { %>
<label for="loginIdentifier"/>
<%= Html.TextBox( "loginIdentifier" ) %>
<%= Html.ValidationMessage("loginIdentifier", "*") %>
<% } %>
</asp:Content>

@ -52,10 +52,16 @@
<%= Html.TextBox("BlogTitle") %> <%= Html.TextBox("BlogTitle") %>
<%= Html.ValidationMessage("BlogTitle", "*") %></td></tr> <%= Html.ValidationMessage("BlogTitle", "*") %></td></tr>
<tr><td align="right"> <tr><td align="right">
Avatar </td><td> <img class="avatar" src="/Blogs/Avatar?user=<%=ViewData["UserName"]%>" alt=""/> Avatar </td><td> <img class="avatar" src="<%=Model.avatar%>" alt=""/>
<input type="file" id="AvatarFile" name="AvatarFile"/> <input type="file" id="AvatarFile" name="AvatarFile"/>
<%= Html.ValidationMessage("AvatarFile", "*") %></td></tr> <%= Html.ValidationMessage("AvatarFile", "*") %></td></tr>
<tr><td align="right">
<%= Html.LabelFor(model => model.GoogleCalendar) %>
</td>
<td>
</td>
</tr>
</table> </table>
<h2>Informations de facturation</h2> <h2>Informations de facturation</h2>
@ -132,8 +138,6 @@ Avatar </td><td> <img class="avatar" src="/Blogs/Avatar?user=<%=ViewData["User
Bankable:<%= Model.IsBankable %>, Billable:<%=Model.IsBillable%> Bankable:<%= Model.IsBankable %>, Billable:<%=Model.IsBillable%>
<% } %> <% } %>
<%= Html.ActionLink("Changer de mot de passe","ChangePassword", "Account")%> <%= Html.ActionLink("Changer de mot de passe","ChangePassword", "Account",null, new { @class="actionlink" })%>
<%= Html.ActionLink("Désincription","Unregister", "Account",null, new { @class="actionlink" })%>
</asp:Content>
</asp:Content>

@ -0,0 +1,11 @@

<%@ Page Title="Unregister" Language="C#" Inherits="System.Web.Mvc.ViewPage" MasterPageFile="~/Models/App.master" %>
<asp:Content ContentPlaceHolderID="MainContent" ID="MainContentContent" runat="server">
Warning: This will delete all of your data here, your profile, your posts and other data.
<% using(Html.BeginForm("Unregister", "Account")) { %>
<label for="confirmed">Unregister</label>
<%=Html.CheckBox("confirmed")%>
<input type="submit"/>
<% } %>
</asp:Content>

@ -1,7 +1,7 @@
<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<BlogEditEntryModel>" MasterPageFile="~/Models/App.master"%> <%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<BlogEditEntryModel>" MasterPageFile="~/Models/App.master"%>
<asp:Content ContentPlaceHolderID="head" ID="head1" runat="server" > <asp:Content ContentPlaceHolderID="head" ID="head1" runat="server" >
<script type="text/javascript" src="/js/jquery-latest.js"></script> <script type="text/javascript" src="/Scripts/jquery-2.1.1.js"></script>
<script type="text/javascript" src="/js/rangyinputs-jquery-1.1.2.js"></script> <script type="text/javascript" src="/Scripts/rangyinputs-jquery-1.1.2.js"></script>
</asp:Content> </asp:Content>
<asp:Content ContentPlaceHolderID="overHeaderOne" ID="headerContent" runat="server"> <asp:Content ContentPlaceHolderID="overHeaderOne" ID="headerContent" runat="server">
<h1 class="blogtitle"> <h1 class="blogtitle">

@ -1,10 +1,10 @@
<%@ Page Title="Devis" Language="C#" Inherits="System.Web.Mvc.ViewPage<Estimate>" MasterPageFile="~/Models/App.master" %> <%@ Page Title="Devis" Language="C#" Inherits="System.Web.Mvc.ViewPage<Estimate>" MasterPageFile="~/Models/App.master" %>
<asp:Content ContentPlaceHolderID="head" ID="head1" runat="server" > <asp:Content ContentPlaceHolderID="head" ID="head1" runat="server" >
<script type="text/javascript" src="<%=Url.Content("~/js/jquery-latest.js")%>"></script> <script type="text/javascript" src="<%=Url.Content("~/Scripts/jquery-2.1.1.js")%>"></script>
<script type="text/javascript" src="<%=Url.Content("~/js/jquery.tablesorter.js")%>"></script> <script type="text/javascript" src="<%=Url.Content("~/Scripts/jquery.tablesorter.js")%>"></script>
<script type="text/javascript" src="<%=Url.Content("~/js/jquery.validate.js")%>"></script> <script type="text/javascript" src="<%=Url.Content("~/Scripts/jquery.validate.js")%>"></script>
<script type="text/javascript" src="<%=Url.Content("~/js/jquery.validate.unobtrusive.js")%>"></script> <script type="text/javascript" src="<%=Url.Content("~/Scripts/jquery.validate.unobtrusive.js")%>"></script>
<link rel="stylesheet" href="<%=Url.Content("~/Theme/dark/style.css")%>" type="text/css" media="print, projection, screen" /> <link rel="stylesheet" href="<%=Url.Content("~/Theme/dark/style.css")%>" type="text/css" media="print, projection, screen" />
</asp:Content> </asp:Content>

@ -79,21 +79,22 @@ http://msdn2.microsoft.com/en-us/library/b5ysx397.aspx
<add assembly="Mono.Security, Version=4.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" /> <add assembly="Mono.Security, Version=4.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" />
<add assembly="Npgsql, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5d8b90d52f46fda7" /> <add assembly="Npgsql, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5d8b90d52f46fda7" />
<add assembly="System.Security, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> <add assembly="System.Security, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<add assembly="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<add assembly="System.Web.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<add assembly="Mono.Posix, Version=4.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" /> <add assembly="Mono.Posix, Version=4.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" />
<add assembly="System.ServiceModel.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" /> <add assembly="System.ServiceModel.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<add assembly="System.ServiceModel.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" /> <add assembly="System.ServiceModel.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<add assembly="System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> <add assembly="System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<add assembly="System.Net.Http.WebRequest, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> <add assembly="System.Net.Http.WebRequest, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<add assembly="System.Configuration.Install, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> <add assembly="System.Configuration.Install, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<add assembly="System.Web.WebPages, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<add assembly="System.Web.WebPages.Deployment, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<add assembly="System.Web.Http.WebHost, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<add assembly="System.Net.Http.Formatting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<add assembly="Microsoft.Build.Tasks.v12.0, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> <add assembly="Microsoft.Build.Tasks.v12.0, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<add assembly="Microsoft.Build.Utilities.v12.0, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> <add assembly="Microsoft.Build.Utilities.v12.0, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<add assembly="Microsoft.Build, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> <add assembly="Microsoft.Build, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<add assembly="System.Net, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<add assembly="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<add assembly="System.Web.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<add assembly="System.Net.Http.Formatting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<add assembly="System.Web.Http.WebHost, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<add assembly="System.Json, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<add assembly="System.Web.WebPages, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</assemblies> </assemblies>
</compilation> </compilation>
<customErrors mode="Off" /> <customErrors mode="Off" />
@ -173,6 +174,11 @@ http://msdn2.microsoft.com/en-us/library/b5ysx397.aspx
<add name="WicketCode" /> <add name="WicketCode" />
<add name="AccountNumber" /> <add name="AccountNumber" />
<add name="BankedKey" /> <add name="BankedKey" />
<add name="gtoken" />
<add name="grefreshtoken" />
<add name="gtokentype" />
<add name="gtokenexpir" />
<add name="avatar" />
</properties> </properties>
</profile> </profile>
<blog defaultProvider="NpgsqlBlogProvider"> <blog defaultProvider="NpgsqlBlogProvider">

@ -9,7 +9,7 @@
<ProjectTypeGuids>{349C5851-65DF-11DA-9384-00065B846F21};{603C0E0B-DB56-11DC-BE95-000D561079B0};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> <ProjectTypeGuids>{349C5851-65DF-11DA-9384-00065B846F21};{603C0E0B-DB56-11DC-BE95-000D561079B0};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<OutputType>Library</OutputType> <OutputType>Library</OutputType>
<RootNamespace>Yavsc</RootNamespace> <RootNamespace>Yavsc</RootNamespace>
<TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion> <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
@ -78,12 +78,6 @@
<Reference Include="Microsoft.Build.Tasks.v12.0, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> <Reference Include="Microsoft.Build.Tasks.v12.0, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<Reference Include="Microsoft.Build.Utilities.v12.0, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> <Reference Include="Microsoft.Build.Utilities.v12.0, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<Reference Include="Microsoft.Build, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> <Reference Include="Microsoft.Build, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<Reference Include="System.Web.Http.WebHost">
<HintPath>..\..\..\..\..\usr\lib\mono\4.5\System.Web.Http.WebHost.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http.Formatting">
<HintPath>..\..\..\..\..\usr\lib\mono\4.5\System.Net.Http.Formatting.dll</HintPath>
</Reference>
<Reference Include="System.Net" /> <Reference Include="System.Net" />
<Reference Include="log4net"> <Reference Include="log4net">
<HintPath>..\packages\log4net.2.0.3\lib\net40-full\log4net.dll</HintPath> <HintPath>..\packages\log4net.2.0.3\lib\net40-full\log4net.dll</HintPath>
@ -92,15 +86,16 @@
<Reference Include="System.Net.Http.WebRequest" /> <Reference Include="System.Net.Http.WebRequest" />
<Reference Include="System.Web.Mvc" /> <Reference Include="System.Web.Mvc" />
<Reference Include="System.Web.Http" /> <Reference Include="System.Web.Http" />
<Reference Include="System.Net.Http.Formatting" />
<Reference Include="System.Web.Http.WebHost" />
<Reference Include="System.Json" />
<Reference Include="System.Web.WebPages" /> <Reference Include="System.Web.WebPages" />
<Reference Include="System.Web.WebPages.Deployment" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Folder Include="Models\" /> <Folder Include="Models\" />
<Folder Include="Scripts\" /> <Folder Include="Scripts\" />
<Folder Include="Views\Account\" /> <Folder Include="Views\Account\" />
<Folder Include="images\" /> <Folder Include="images\" />
<Folder Include="Thanks\" />
<Folder Include="Views\Blogs\" /> <Folder Include="Views\Blogs\" />
<Folder Include="Helpers\" /> <Folder Include="Helpers\" />
<Folder Include="Views\FrontOffice\" /> <Folder Include="Views\FrontOffice\" />
@ -112,7 +107,6 @@
<Folder Include="CatExts\" /> <Folder Include="CatExts\" />
<Folder Include="Views\WorkFlow\" /> <Folder Include="Views\WorkFlow\" />
<Folder Include="Views\Admin\" /> <Folder Include="Views\Admin\" />
<Folder Include="js\" />
<Folder Include="Theme\" /> <Folder Include="Theme\" />
<Folder Include="Theme\green\" /> <Folder Include="Theme\green\" />
<Folder Include="Theme\blue\" /> <Folder Include="Theme\blue\" />
@ -122,6 +116,7 @@
<Folder Include="install\" /> <Folder Include="install\" />
<Folder Include="App_GlobalResources\" /> <Folder Include="App_GlobalResources\" />
<Folder Include="Views\Google\" /> <Folder Include="Views\Google\" />
<Folder Include="Settings\" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Controllers\HomeController.cs" /> <Compile Include="Controllers\HomeController.cs" />
@ -129,10 +124,6 @@
<DependentUpon>Global.asax</DependentUpon> <DependentUpon>Global.asax</DependentUpon>
</Compile> </Compile>
<Compile Include="Controllers\AccountController.cs" /> <Compile Include="Controllers\AccountController.cs" />
<Compile Include="Thanks\ThanksConfigurationSection.cs" />
<Compile Include="Thanks\ThanksConfigurationCollection.cs" />
<Compile Include="Thanks\ThanksConfigurationElement.cs" />
<Compile Include="Thanks\ThanksHelper.cs" />
<Compile Include="Controllers\BlogsController.cs" /> <Compile Include="Controllers\BlogsController.cs" />
<Compile Include="Views\RegisterPage.cs" /> <Compile Include="Views\RegisterPage.cs" />
<Compile Include="AssemblyInfo.cs" /> <Compile Include="AssemblyInfo.cs" />
@ -165,6 +156,14 @@
<Compile Include="Controllers\FormInputValue.cs" /> <Compile Include="Controllers\FormInputValue.cs" />
<Compile Include="Controllers\IValueProvider.cs" /> <Compile Include="Controllers\IValueProvider.cs" />
<Compile Include="Controllers\GoogleController.cs" /> <Compile Include="Controllers\GoogleController.cs" />
<Compile Include="Controllers\ModuleController.cs" />
<Compile Include="Settings\ThanksConfigurationSection.cs" />
<Compile Include="Settings\ThanksConfigurationCollection.cs" />
<Compile Include="Settings\ThanksConfigurationElement.cs" />
<Compile Include="Settings\ThanksHelper.cs" />
<Compile Include="Settings\ModulesConfigurationSection.cs" />
<Compile Include="Settings\ModuleConfigurationElementCollection.cs" />
<Compile Include="Settings\ModuleConfigurationElement.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Content Include="Views\Web.config" /> <Content Include="Views\Web.config" />
@ -223,10 +222,6 @@
<Content Include="Views\Admin\Restored.aspx" /> <Content Include="Views\Admin\Restored.aspx" />
<Content Include="Views\Admin\Index.aspx" /> <Content Include="Views\Admin\Index.aspx" />
<Content Include="Views\FrontOffice\Estimate.aspx" /> <Content Include="Views\FrontOffice\Estimate.aspx" />
<Content Include="js\jquery.metadata.js" />
<Content Include="js\jquery.tablesorter.js" />
<Content Include="js\jquery.tablesorter.min.js" />
<Content Include="js\jquery-latest.js" />
<Content Include="Theme\style.css" /> <Content Include="Theme\style.css" />
<Content Include="Theme\green\asc.png" /> <Content Include="Theme\green\asc.png" />
<Content Include="Theme\green\bg.png" /> <Content Include="Theme\green\bg.png" />
@ -243,19 +238,23 @@
<Content Include="Views\FrontOffice\Estimates.aspx" /> <Content Include="Views\FrontOffice\Estimates.aspx" />
<Content Include="images\pgsql.png" /> <Content Include="images\pgsql.png" />
<Content Include="Views\Home\ReferencedAssemblies.aspx" /> <Content Include="Views\Home\ReferencedAssemblies.aspx" />
<Content Include="js\rangyinputs-jquery-1.1.2.js" />
<Content Include="Catalog.xml" /> <Content Include="Catalog.xml" />
<Content Include="RegistrationMail.txt" /> <Content Include="RegistrationMail.txt" />
<Content Include="instdbws.sql" /> <Content Include="instdbws.sql" />
<Content Include="Views\FrontOffice\Writting.ascx" /> <Content Include="Views\FrontOffice\Writting.ascx" />
<Content Include="packages.config" /> <Content Include="packages.config" />
<Content Include="Views\Account\OpenIDLogOn.aspx" />
<Content Include="Views\Google\Calendar.aspx" /> <Content Include="Views\Google\Calendar.aspx" />
<Content Include="Views\Google\Login.aspx" /> <Content Include="Views\Google\Login.aspx" />
<Content Include="Scripts\jquery-2.1.1-vsdoc.js" /> <Content Include="Scripts\jquery-2.1.1-vsdoc.js" />
<Content Include="Scripts\jquery-2.1.1.js" /> <Content Include="Scripts\jquery-2.1.1.js" />
<Content Include="Scripts\jquery-2.1.1.min.js" /> <Content Include="Scripts\jquery-2.1.1.min.js" />
<Content Include="Views\Google\Auth.aspx" /> <Content Include="Views\Google\Auth.aspx" />
<Content Include="Scripts\jquery.metadata.js" />
<Content Include="Scripts\jquery.tablesorter.js" />
<Content Include="Scripts\jquery.tablesorter.min.js" />
<Content Include="Scripts\rangyinputs-jquery-1.1.2.js" />
<Content Include="images\sign-in-with-google.png" />
<Content Include="Views\Account\Unregister.aspx" />
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" /> <Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
@ -272,7 +271,6 @@
</ProjectExtensions> </ProjectExtensions>
<ItemGroup> <ItemGroup>
<None Include="README" /> <None Include="README" />
<None Include="uninstdb.sql" />
<None Include="uninstdbws.sql" /> <None Include="uninstdbws.sql" />
<None Include="templates\Estim.tt"> <None Include="templates\Estim.tt">
<Generator>TextTemplatingFilePreprocessor</Generator> <Generator>TextTemplatingFilePreprocessor</Generator>

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

@ -249,8 +249,13 @@ CREATE TABLE profiledata
wicketcode character varying(5), wicketcode character varying(5),
iban character varying(33), iban character varying(33),
bic character varying(15), bic character varying(15),
gcode character varying(512), gtoken character varying(512),
CONSTRAINT fkprofiles2 FOREIGN KEY (uniqueid) grefreshtoken character varying(512), -- Google refresh token
gtokentype character varying(256), -- Google access token type
gcalid character varying(255),
gtokenexpir timestamp with time zone, -- Google access token expiration date
avatar character varying(512), -- url for an avatar
CONSTRAINT fkprofiles2 FOREIGN KEY (uniqueid)
REFERENCES profiles (uniqueid) MATCH SIMPLE REFERENCES profiles (uniqueid) MATCH SIMPLE
ON UPDATE CASCADE ON DELETE CASCADE ON UPDATE CASCADE ON DELETE CASCADE
) )
@ -264,9 +269,14 @@ COMMENT ON COLUMN profiledata.hasavatar IS 'True when user has specified an imag
COMMENT ON COLUMN profiledata.accountnumber IS 'Numero de compte'; COMMENT ON COLUMN profiledata.accountnumber IS 'Numero de compte';
COMMENT ON COLUMN profiledata.bankedkey IS 'clé RIB'; COMMENT ON COLUMN profiledata.bankedkey IS 'clé RIB';
COMMENT ON COLUMN profiledata.bankcode IS 'Code banque'; COMMENT ON COLUMN profiledata.bankcode IS 'Code banque';
COMMENT ON COLUMN profiledata.gtoken IS 'Google authentification token';
COMMENT ON COLUMN profiledata.gcalid IS 'Google calendar identifier';
-- Index: fki_fkprofiles2 COMMENT ON COLUMN profiledata.gtokentype IS 'Google access token type';
COMMENT ON COLUMN profiledata.grefreshtoken IS 'Google refresh token';
COMMENT ON COLUMN profiledata.gtokenexpir IS 'Google access token expiration date';
COMMENT ON COLUMN profiledata.avatar IS 'url for an avatar';
-- Index: fki_fkprofiles2
-- DROP INDEX fki_fkprofiles2; -- DROP INDEX fki_fkprofiles2;

File diff suppressed because one or more lines are too long

@ -1,6 +0,0 @@
DROP TABLE hr;
DROP TABLE taskdeps;
DROP TABLE tasks;
DROP TABLE projet;

@ -0,0 +1,64 @@
//
// GoogleAuthToken.cs
//
// Author:
// Paul Schneider <paulschneider@free.fr>
//
// Copyright (c) 2014 Paul Schneider
//
// 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.Collections.Generic;
using System.Linq;
using System.Web;
using System.Threading;
using System.Web.Mvc;
using System.Configuration;
using System.Threading.Tasks;
using System.Text;
using System.Net;
using System.IO;
using Yavsc.Model;
namespace Yavsc.Model.Google
{
/*
"url": "https://plus.google.com/111395572362177872801",
"image": {
"url": "https://lh6.googleusercontent.com/-JqDVMPqafdA/AAAAAAAAAAI/AAAAAAAAADY/FamseW6_nl4/photo.jpg?sz=50",
"isDefault": false
},
"placesLived": [
{
"value": "Suresnes, France",
"primary": true
}
],
"isPlusUser": true,
"language": "fr",
"circledByCount": 0,
"verified": false
}
*/
public class AuthToken {
public string access_token { get; set; }
public string id_token { get; set; }
public int expires_in { get; set; }
public string token_type { get; set ; }
public string refresh_token { get; set; }
}
}

@ -0,0 +1,70 @@
//
// People.cs
//
// Author:
// Paul Schneider <paulschneider@free.fr>
//
// Copyright (c) 2014 Paul Schneider
//
// 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.Collections.Generic;
using System.Linq;
using System.Web;
using System.Threading;
using System.Web.Mvc;
using System.Configuration;
using System.Threading.Tasks;
using System.Text;
using System.Net;
using System.IO;
using Yavsc.Model;
namespace Yavsc.Model.Google
{
public class People {
public string kind { get; set; }
public string etag { get; set; }
public string gender { get; set; }
public class EMail{
public string value { get; set; }
public string type { get; set; }
}
public EMail[] emails { get; set; }
public string objectType { get; set; }
public string id { get; set; }
public string displayName { get; set; }
public class Name {
public string familyName { get; set; }
public string givenName { get; set; }
}
public Name name { get; set;}
public string url { get; set; }
public class Image {
public string url { get; set; }
public bool isDefault { get; set; }
}
public Image image { get; set; }
public class Place {
public string value { get; set; }
public bool primary { get; set; }
}
public Place[] placesLived { get; set; }
public bool isPlusUser { get; set; }
public string language { get; set; }
public int circledByCount { get; set; }
public bool verified { get; set; }
}
}

@ -0,0 +1,35 @@
//
// SignIn.cs
//
// Author:
// Paul Schneider <paulschneider@free.fr>
//
// Copyright (c) 2014 Paul Schneider
//
// 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;
namespace Yavsc.Model.Google
{
public class SignIn
{
public string UserName { get; set; }
public string Email { get; set; }
public SignIn ()
{
}
}
}

@ -2,6 +2,7 @@
using System.Configuration; using System.Configuration;
using System.Collections.Specialized; using System.Collections.Specialized;
using System.Data; using System.Data;
using System.Web.Mvc;
namespace Yavsc.Model namespace Yavsc.Model
{ {
@ -19,18 +20,14 @@ namespace Yavsc.Model
/// <param name="cnx">Cnx.</param> /// <param name="cnx">Cnx.</param>
/// <param name="removeConfig">If set to <c>true</c> remove config.</param> /// <param name="removeConfig">If set to <c>true</c> remove config.</param>
void Uninstall(IDbConnection cnx,bool removeConfig); void Uninstall(IDbConnection cnx,bool removeConfig);
ConfigurationSection DefaultConfig (string appName, string cnxStr);
/// <summary>
/// Gets or sets a value indicating whether this <see cref="Yavsc.Model.IModule"/> is active.
/// </summary>
/// <value><c>true</c> if active; otherwise, <c>false</c>.</value>
bool Active { get; set; }
/// <summary>
/// Gets or sets the name of the application.
/// </summary>
/// <value>The name of the application.</value>
string ApplicationName { get; set; }
void Initialize (string name, NameValueCollection config); void Initialize (string name, NameValueCollection config);
} }
public interface IRenderer {
// Should set ViewData["Message|Author|Body"]
object Get(Controller c);
string Template { get; }
string Name { get; set; }
}
} }

@ -112,6 +112,12 @@ namespace Yavsc.Model {
} }
} }
public static string UserName {
get {
return ResourceManager.GetString("UserName", resourceCulture);
}
}
public static string Offline { public static string Offline {
get { get {
return ResourceManager.GetString("Offline", resourceCulture); return ResourceManager.GetString("Offline", resourceCulture);

@ -32,4 +32,5 @@
<data name="User_name"><value>Nom d'utilisateur</value></data> <data name="User_name"><value>Nom d'utilisateur</value></data>
<data name="Google_error"><value>Erreur Google : {0}</value></data> <data name="Google_error"><value>Erreur Google : {0}</value></data>
<data name="access_denied"><value>Accès refusé</value></data> <data name="access_denied"><value>Accès refusé</value></data>
<data name="UserName"><value>Nom d'utilisateur</value></data>
</root> </root>

@ -32,4 +32,5 @@
<data name="User_name"><value>User name</value></data> <data name="User_name"><value>User name</value></data>
<data name="Google_error"><value>Google error : {0}</value></data> <data name="Google_error"><value>Google error : {0}</value></data>
<data name="access_denied"><value>Access denied</value></data> <data name="access_denied"><value>Access denied</value></data>
<data name="UserName"><value>User name</value></data>
</root> </root>

@ -12,6 +12,9 @@ namespace Yavsc.Model.RolesAndMembers
[StringLength (1024)] [StringLength (1024)]
public string Name { get; set; } public string Name { get; set; }
[DisplayName("Avatar")]
public string avatar { get; set; }
[DisplayName ("Adresse")] [DisplayName ("Adresse")]
[StringLength (2047)] [StringLength (2047)]
public string Address { get; set; } public string Address { get; set; }
@ -75,6 +78,9 @@ namespace Yavsc.Model.RolesAndMembers
[DisplayName ("Clé RIB")] [DisplayName ("Clé RIB")]
public int BankedKey { get; set; } public int BankedKey { get; set; }
[Display(Name="Google Calendar")]
public string GoogleCalendar { get; set; }
public bool IsBankable { get { public bool IsBankable { get {
return IsBillable return IsBillable
&& !string.IsNullOrWhiteSpace (BankCode) && !string.IsNullOrWhiteSpace (BankCode)
@ -108,6 +114,9 @@ namespace Yavsc.Model.RolesAndMembers
object s = profile.GetPropertyValue ("BlogTitle"); object s = profile.GetPropertyValue ("BlogTitle");
BlogTitle = (s is DBNull) ? null : (string)s; BlogTitle = (s is DBNull) ? null : (string)s;
s = profile.GetPropertyValue ("avatar");
avatar = (s is DBNull) ? null : (string)s;
s = profile.GetPropertyValue ("Address"); s = profile.GetPropertyValue ("Address");
Address = (s is DBNull) ? null : (string)s; Address = (s is DBNull) ? null : (string)s;

@ -7,7 +7,6 @@ namespace Yavsc.Model.RolesAndMembers
public class RegisterViewModel public class RegisterViewModel
{ {
[Localizable(true)] [Localizable(true)]
[Display(Name="User name")]
[Required(ErrorMessage = "S'il vous plait, entrez un nom d'utilisateur")] [Required(ErrorMessage = "S'il vous plait, entrez un nom d'utilisateur")]
public string UserName { get; set; } public string UserName { get; set; }

@ -12,44 +12,41 @@ namespace Yavsc.Model.WorkFlow
/// It takes orders store them and raise some events for modules /// It takes orders store them and raise some events for modules
/// It publishes estimates and invoices /// It publishes estimates and invoices
/// </summary> /// </summary>
public static class WorkFlowManager public class WorkFlowManager
{ {
public static Catalog Catalog { get; set; } public static Catalog Catalog { get; set; }
public void UpdateEstimate (Estimate estim)
public static void UpdateEstimate (Estimate estim)
{ {
ContentProvider.UpdateEstimate (estim); ContentProvider.UpdateEstimate (estim);
} }
public static event EventHandler NewOrder; public Estimate GetEstimate (long estid)
public static Estimate GetEstimate (long estid)
{ {
return ContentProvider.GetEstimate (estid); return ContentProvider.GetEstimate (estid);
} }
public static Estimate [] GetEstimates (string client) public Estimate [] GetEstimates (string client)
{ {
return ContentProvider.GetEstimates (client); return ContentProvider.GetEstimates (client);
} }
public static void UpdateWritting (Writting wr) public void UpdateWritting (Writting wr)
{ {
ContentProvider.UpdateWritting (wr); ContentProvider.UpdateWritting (wr);
} }
public static void DropWritting (long wrid) public void DropWritting (long wrid)
{ {
ContentProvider.DropWritting (wrid); ContentProvider.DropWritting (wrid);
} }
public static void DropEstimate (long estid) public void DropEstimate (long estid)
{ {
ContentProvider.DropEstimate(estid); ContentProvider.DropEstimate(estid);
} }
static IContentProvider contentProvider; IContentProvider contentProvider;
public static IContentProvider ContentProvider { public IContentProvider ContentProvider {
get { get {
WorkflowConfiguration c = (WorkflowConfiguration) ConfigurationManager.GetSection ("system.web/workflow"); WorkflowConfiguration c = (WorkflowConfiguration) ConfigurationManager.GetSection ("system.web/workflow");
if (c == null) if (c == null)
@ -75,8 +72,6 @@ namespace Yavsc.Model.WorkFlow
System.Reflection.ConstructorInfo ci =cpt.GetConstructor (System.Type.EmptyTypes); System.Reflection.ConstructorInfo ci =cpt.GetConstructor (System.Type.EmptyTypes);
contentProvider = (IContentProvider)ci.Invoke (System.Type.EmptyTypes); contentProvider = (IContentProvider)ci.Invoke (System.Type.EmptyTypes);
} }
contentProvider.ApplicationName = confprov.ApplicationName;
NameValueCollection config = new NameValueCollection (); NameValueCollection config = new NameValueCollection ();
config.Add ("name", confprov.Name); config.Add ("name", confprov.Name);
@ -96,15 +91,13 @@ namespace Yavsc.Model.WorkFlow
/// <returns>The estimate identifier.</returns> /// <returns>The estimate identifier.</returns>
/// <param name="title">Title.</param> /// <param name="title">Title.</param>
public static Estimate CreateEstimate(string responsible, string client, string title, string description) public Estimate CreateEstimate(string responsible, string client, string title, string description)
{ {
Estimate created = ContentProvider.CreateEstimate (responsible, client, title, description); Estimate created = ContentProvider.CreateEstimate (responsible, client, title, description);
if (NewOrder != null)
NewOrder.Invoke(ContentProvider, new NewEstimateEvenArgs(created));
return created; return created;
} }
public static long Write(long estid, string desc, decimal ucost, int count, string productid) public long Write(long estid, string desc, decimal ucost, int count, string productid)
{ {
if (!string.IsNullOrWhiteSpace(productid)) { if (!string.IsNullOrWhiteSpace(productid)) {
if (Catalog == null) if (Catalog == null)
@ -112,12 +105,14 @@ namespace Yavsc.Model.WorkFlow
if (Catalog == null) if (Catalog == null)
throw new Exception ("No catalog"); throw new Exception ("No catalog");
Product p = Catalog.FindProduct (productid); Product p = Catalog.FindProduct (productid);
if (p == null)
throw new Exception ("Product not found");
// TODO new EstimateChange Event // TODO new EstimateChange Event
} }
return ContentProvider.Write(estid, desc, ucost, count, productid); return ContentProvider.Write(estid, desc, ucost, count, productid);
} }
public static void SetEstimateStatus(long estid, int status, string username) public void SetEstimateStatus(long estid, int status, string username)
{ {
ContentProvider.SetEstimateStatus (estid, status, username); ContentProvider.SetEstimateStatus (estid, status, username);
} }

@ -9,6 +9,7 @@
<OutputType>Library</OutputType> <OutputType>Library</OutputType>
<RootNamespace>Yavsc.Model</RootNamespace> <RootNamespace>Yavsc.Model</RootNamespace>
<AssemblyName>YavscModel</AssemblyName> <AssemblyName>YavscModel</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
@ -32,10 +33,10 @@
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.ComponentModel.DataAnnotations" /> <Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Web" /> <Reference Include="System.Web" />
<Reference Include="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<Reference Include="System.Configuration" /> <Reference Include="System.Configuration" />
<Reference Include="System.Data" /> <Reference Include="System.Data" />
<Reference Include="System.Web.ApplicationServices" /> <Reference Include="System.Web.ApplicationServices" />
<Reference Include="System.Web.Mvc" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
@ -84,6 +85,9 @@
<Compile Include="LocalizedText.Designer.cs"> <Compile Include="LocalizedText.Designer.cs">
<DependentUpon>LocalizedText.resx</DependentUpon> <DependentUpon>LocalizedText.resx</DependentUpon>
</Compile> </Compile>
<Compile Include="Google\People.cs" />
<Compile Include="Google\AuthToken.cs" />
<Compile Include="Google\SignIn.cs" />
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup> <ItemGroup>
@ -92,6 +96,7 @@
<Folder Include="Blogs\" /> <Folder Include="Blogs\" />
<Folder Include="Admin\" /> <Folder Include="Admin\" />
<Folder Include="FileSystem\" /> <Folder Include="FileSystem\" />
<Folder Include="Google\" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\SalesCatalog\SalesCatalog.csproj"> <ProjectReference Include="..\SalesCatalog\SalesCatalog.csproj">

@ -37,7 +37,6 @@
<Reference Include="System.ServiceModel.Activation" /> <Reference Include="System.ServiceModel.Activation" />
<Reference Include="System.Net.Http.Formatting"> <Reference Include="System.Net.Http.Formatting">
<HintPath>..\..\..\..\..\usr\lib\mono\4.5\System.Net.Http.Formatting.dll</HintPath> <HintPath>..\..\..\..\..\usr\lib\mono\4.5\System.Net.Http.Formatting.dll</HintPath>
<Private>False</Private>
</Reference> </Reference>
<Reference Include="Mono.Posix" /> <Reference Include="Mono.Posix" />
</ItemGroup> </ItemGroup>

Loading…