files tree made better.

This commit is contained in:
Paul Schneider 2019-01-01 16:28:47 +00:00
commit ccc91bbf19
1630 changed files with 18209 additions and 41860 deletions

View file

@ -0,0 +1,480 @@
using System;
using System.Threading.Tasks;
using System.Collections.Generic;
using System.Net;
using System.Text;
using GetUsernameAsyncFunc=System.Func<System.Collections.Generic.IDictionary<string,string>, System.Threading.Tasks.Task<string>>;
using System.IO;
using Newtonsoft.Json;
namespace Yavsc.Authentication
{
public class OAuthenticator
{
public OAuthenticator()
{
}
string clientId;
string clientSecret;
string scope;
Uri authorizeUrl;
Uri accessTokenUrl;
Uri redirectUrl;
GetUsernameAsyncFunc getUsernameAsync;
string requestState;
bool reportedForgery = false;
/// <summary>
/// Gets the client identifier.
/// </summary>
/// <value>The client identifier.</value>
public string ClientId
{
get { return this.clientId; }
}
/// <summary>
/// Gets the client secret.
/// </summary>
/// <value>The client secret.</value>
public string ClientSecret
{
get { return this.clientSecret; }
}
/// <summary>
/// Gets the authorization scope.
/// </summary>
/// <value>The authorization scope.</value>
public string Scope
{
get { return this.scope; }
}
/// <summary>
/// Gets the authorize URL.
/// </summary>
/// <value>The authorize URL.</value>
public Uri AuthorizeUrl
{
get { return this.authorizeUrl; }
}
/// <summary>
/// Gets the access token URL.
/// </summary>
/// <value>The URL used to request access tokens after an authorization code was received.</value>
public Uri AccessTokenUrl
{
get { return this.accessTokenUrl; }
}
/// <summary>
/// Redirect Url
/// </summary>
public Uri RedirectUrl
{
get { return this.redirectUrl; }
}
/// <summary>
/// Initializes a new <see cref="ZicMoove.Droid.OAuth.YaOAuth2WebAuthenticator"/>
/// that authenticates using implicit granting (token).
/// </summary>
/// <param name='clientId'>
/// Client identifier.
/// </param>
/// <param name='scope'>
/// Authorization scope.
/// </param>
/// <param name='authorizeUrl'>
/// Authorize URL.
/// </param>
/// <param name='redirectUrl'>
/// Redirect URL.
/// </param>
/// <param name='getUsernameAsync'>
/// Method used to fetch the username of an account
/// after it has been successfully authenticated.
/// </param>
public OAuthenticator(string clientId, string scope, Uri authorizeUrl, Uri redirectUrl, GetUsernameAsyncFunc getUsernameAsync = null)
: this(redirectUrl)
{
if (string.IsNullOrEmpty(clientId))
{
throw new ArgumentException("clientId must be provided", "clientId");
}
if (authorizeUrl==null)
throw new ArgumentNullException("authorizeUrl");
this.clientId = clientId;
this.scope = scope ?? "";
this.authorizeUrl = authorizeUrl ;
this.getUsernameAsync = getUsernameAsync;
this.accessTokenUrl = null;
}
/// <summary>
/// Initializes a new instance <see cref="ZicMoove.Droid.OAuth.YaOAuth2WebAuthenticator"/>
/// that authenticates using authorization codes (code).
/// </summary>
/// <param name='clientId'>
/// Client identifier.
/// </param>
/// <param name='clientSecret'>
/// Client secret.
/// </param>
/// <param name='scope'>
/// Authorization scope.
/// </param>
/// <param name='authorizeUrl'>
/// Authorize URL.
/// </param>
/// <param name='redirectUrl'>
/// Redirect URL.
/// </param>
/// <param name='accessTokenUrl'>
/// URL used to request access tokens after an authorization code was received.
/// </param>
/// <param name='getUsernameAsync'>
/// Method used to fetch the username of an account
/// after it has been successfully authenticated.
/// </param>
public OAuthenticator(string clientId, string clientSecret, string scope, Uri authorizeUrl, Uri redirectUrl, Uri accessTokenUrl, GetUsernameAsyncFunc getUsernameAsync = null)
: this(redirectUrl, clientSecret, accessTokenUrl)
{
if (string.IsNullOrEmpty(clientId))
{
throw new ArgumentException("clientId must be provided", "clientId");
}
this.clientId = clientId;
if (string.IsNullOrEmpty(clientSecret))
{
throw new ArgumentException("clientSecret must be provided", "clientSecret");
}
this.clientSecret = clientSecret;
this.scope = scope ?? "";
if (authorizeUrl == null)
{
throw new ArgumentNullException("authorizeUrl");
}
this.authorizeUrl = authorizeUrl;
if (accessTokenUrl == null)
{
throw new ArgumentNullException("accessTokenUrl");
}
this.accessTokenUrl = accessTokenUrl;
if (redirectUrl == null)
throw new Exception("redirectUrl is null");
this.redirectUrl = redirectUrl;
this.getUsernameAsync = getUsernameAsync;
}
OAuthenticator(Uri redirectUrl, string clientSecret = null, Uri accessTokenUrl = null)
{
this.redirectUrl = redirectUrl;
this.clientSecret = clientSecret;
this.accessTokenUrl = accessTokenUrl;
//
// Generate a unique state string to check for forgeries
//
var chars = new char[16];
var rand = new Random();
for (var i = 0; i < chars.Length; i++)
{
chars[i] = (char)rand.Next((int)'a', (int)'z' + 1);
}
this.requestState = new string(chars);
}
bool IsImplicit { get { return accessTokenUrl == null; } }
/// <summary>
/// Method that returns the initial URL to be displayed in the web browser.
/// </summary>
/// <returns>
/// A task that will return the initial URL.
/// </returns>
public Task<Uri> GetInitialUrlAsync()
{
var url = new Uri(string.Format(
"{0}?client_id={1}&redirect_uri={2}&response_type={3}&scope={4}&state={5}",
authorizeUrl.AbsoluteUri,
Uri.EscapeDataString(clientId),
Uri.EscapeDataString(RedirectUrl.AbsoluteUri),
IsImplicit ? "token" : "code",
Uri.EscapeDataString(scope),
Uri.EscapeDataString(requestState)));
var tcs = new TaskCompletionSource<Uri>();
tcs.SetResult(url);
return tcs.Task;
}
/// <summary>
/// Raised when a new page has been loaded.
/// </summary>
/// <param name='url'>
/// URL of the page.
/// </param>
/// <param name='query'>
/// The parsed query of the URL.
/// </param>
/// <param name='fragment'>
/// The parsed fragment of the URL.
/// </param>
protected void OnPageEncountered(Uri url, IDictionary<string, string> query, IDictionary<string, string> fragment)
{
if (url.AbsoluteUri.StartsWith(this.redirectUrl.AbsoluteUri))
{
// if (!this.redirectUrl.Equals(url)) {
// this is not our redirect page,
// but perhaps one one the third party identity providers
// One don't check for a state here.
//
/* if (fragment.ContainsKey("continue")) {
var cont = fragment["continue"];
// TODO continue browsing this address
var tcs = new TaskCompletionSource<Uri>();
tcs.SetResult(new Uri(cont));
tcs.Task.RunSynchronously();
}
return;*/
// }
var all = new Dictionary<string, string>(query);
foreach (var kv in fragment)
all[kv.Key] = kv.Value;
//
// Check for forgeries
//
if (all.ContainsKey("state"))
{
if (all["state"] != requestState && !reportedForgery)
{
reportedForgery = true;
OnError("Invalid state from server. Possible forgery!");
return;
}
}
}
}
private void OnError(string v)
{
throw new NotImplementedException();
}
private void OnError(AggregateException ex)
{
throw new NotImplementedException();
}
/// <summary>
/// Raised when a new page has been loaded.
/// </summary>
/// <param name='url'>
/// URL of the page.
/// </param>
/// <param name='query'>
/// The parsed query string of the URL.
/// </param>
/// <param name='fragment'>
/// The parsed fragment of the URL.
/// </param>
protected void OnRedirectPageLoaded(Uri url, IDictionary<string, string> query, IDictionary<string, string> fragment)
{
//
// Look for the access_token
//
if (fragment.ContainsKey("access_token"))
{
//
// We found an access_token
//
OnRetrievedAccountProperties(fragment);
}
else if (!IsImplicit)
{
//
// Look for the code
//
if (query.ContainsKey("code"))
{
var code = query["code"];
RequestAccessTokenAsync(code).ContinueWith(task =>
{
if (task.IsFaulted)
{
OnError(task.Exception);
}
else
{
OnRetrievedAccountProperties(task.Result);
}
}, TaskScheduler.FromCurrentSynchronizationContext());
}
else
{
OnError("Expected code in response, but did not receive one.");
return;
}
}
else
{
OnError("Expected access_token in response, but did not receive one.");
return;
}
}
/// <summary>
/// Asynchronously requests an access token with an authorization <paramref name="code"/>.
/// </summary>
/// <returns>
/// A dictionary of data returned from the authorization request.
/// </returns>
/// <param name='code'>The authorization code.</param>
/// <remarks>Implements: http://tools.ietf.org/html/rfc6749#section-4.1</remarks>
Task<IDictionary<string, string>> RequestAccessTokenAsync(string code)
{
var queryValues = new Dictionary<string, string> {
{ "grant_type", "authorization_code" },
{ "code", code },
{ "redirect_uri", RedirectUrl.AbsoluteUri },
{ "client_id", clientId }
};
if (!string.IsNullOrEmpty(clientSecret))
{
queryValues["client_secret"] = clientSecret;
}
return RequestAccessTokenAsync(queryValues);
}
/// <summary>
/// Asynchronously makes a request to the access token URL with the given parameters.
/// </summary>
/// <param name="queryValues">The parameters to make the request with.</param>
/// <returns>The data provided in the response to the access token request.</returns>
public async Task<IDictionary<string, string>> RequestAccessTokenAsync(IDictionary<string, string> queryValues)
{
StringBuilder postData = new StringBuilder();
if (!queryValues.ContainsKey("client_id"))
{
postData.Append("client_id="+Uri.EscapeDataString($"{this.clientId}")+"&");
}
if (!queryValues.ContainsKey("client_secret"))
{
postData.Append("client_secret="+Uri.EscapeDataString($"{this.clientSecret}")+"&");
}
if (!queryValues.ContainsKey("scope"))
{
postData.Append("scope="+Uri.EscapeDataString($"{this.scope}")+"&");
}
foreach (string key in queryValues.Keys)
{
postData.Append($"{key}="+Uri.EscapeDataString($"{queryValues[key]}")+"&");
}
var req = WebRequest.Create(accessTokenUrl);
(req as HttpWebRequest).Accept = "application/json";
req.Method = "POST";
var body = Encoding.UTF8.GetBytes(postData.ToString());
req.ContentLength = body.Length;
req.ContentType = "application/x-www-form-urlencoded";
var s = req.GetRequestStream();
s.Write(body, 0, body.Length);
var auth = await req.GetResponseAsync();
var repstream = auth.GetResponseStream();
var respReader = new StreamReader(repstream);
var text = await respReader.ReadToEndAsync();
req.Abort();
// Parse the response
var data = text.Contains("{") ? JsonDecode(text) : FormDecode(text);
if (data.ContainsKey("error"))
{
OnError("Error authenticating: " + data["error"]);
}
else if (data.ContainsKey("access_token"))
{
return data;
}
else
{
OnError("Expected access_token in access token response, but did not receive one.");
}
return data;
}
private IDictionary<string,string> FormDecode(string text)
{
throw new NotImplementedException();
}
private IDictionary<string,string> JsonDecode(string text)
{
return JsonConvert.DeserializeObject<Dictionary<string,string>>(text);
}
/// <summary>
/// Event handler that is fired when an access token has been retreived.
/// </summary>
/// <param name='accountProperties'>
/// The retrieved account properties
/// </param>
protected virtual void OnRetrievedAccountProperties(IDictionary<string, string> accountProperties)
{
//
// Now we just need a username for the account
//
if (getUsernameAsync != null)
{
getUsernameAsync(accountProperties).ContinueWith(task =>
{
if (task.IsFaulted)
{
OnError(task.Exception);
}
else
{
OnSucceeded(task.Result, accountProperties);
}
}, TaskScheduler.FromCurrentSynchronizationContext());
}
else
{
OnSucceeded("", accountProperties);
}
}
private void OnSucceeded(string v, IDictionary<string, string> accountProperties)
{
throw new NotImplementedException();
}
}
}

View file

@ -0,0 +1,10 @@
namespace Yavsc.Models.Billing
{
public static class BillingCodes
{
public const string Rdv = "Rdv";
public const string MBrush = "MBrush";
public const string Brush = "Brush";
}
}

View file

@ -0,0 +1,9 @@
namespace Yavsc
{
public interface IAccountBalance
{
long ContactCredits { get; set; }
decimal Credits { get; set; }
string UserId { get; set; }
}
}

View file

@ -0,0 +1,14 @@
namespace Yavsc.Billing
{
public interface IBillItem {
string Name { get; set; }
string Description { get; set; }
int Count { get; set; }
decimal UnitaryCost { get; set; }
string Currency { get; set; }
string Reference { get; }
}
}

View file

@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using Yavsc.Services;
namespace Yavsc.Billing
{
public interface IBillable {
string Description { get; }
List<IBillItem> GetBillItems();
long Id { get; set; }
string ActivityCode { get; set; }
string PerformerId { get; set; }
string ClientId { get; set; }
/// <summary>
/// Date de validation de la demande par le client
/// </summary>
/// <returns></returns>
DateTime? ValidationDate { get; }
bool GetIsAcquitted ();
string GetFileBaseName (IBillingService service);
}
}

View file

@ -0,0 +1,8 @@
namespace Yavsc.Billing
{
public interface IBillingImpacter { 
decimal Impact(decimal orgValue);
}
}

View file

@ -0,0 +1,13 @@
namespace Yavsc.Billing
{
public interface ICommandLine : IBillItem
{
// FIXME too hard: no such generic name in any interface
long Id { get; set; }
// FIXME too far: perhaps no existing estimate
long EstimateId { get; set; }
}
}

View file

@ -0,0 +1,18 @@
namespace Yavsc
{
using System.Collections.Generic;
public interface IEstimate
{
List<string> AttachedFiles { get; set; }
List<string> AttachedGraphics { get; }
string ClientId { get; set; }
long? CommandId { get; set; }
string CommandType { get; set; }
string Description { get; set; }
long Id { get; set; }
string OwnerId { get; set; }
string Title { get; set; }
}
}

View file

@ -0,0 +1,13 @@

namespace Yavsc
{
public interface IBlogPost : IBaseTrackedEntity, IIdentified<long>, IRating<long>, ITitle
{
string AuthorId { get; set; }
string Content { get; set; }
string Photo { get; set; }
bool Visible { get; set; }
}
}

View file

@ -0,0 +1,63 @@
using System.IO;
using System.Linq;
using System.Security.Claims;
using System.Text;
using Yavsc.ViewModels.UserFiles;
namespace Yavsc.Abstract.FileSystem
{
public static class AbstractFileSystemHelpers
{
public static string UserBillsDirName { set; get; }
public static string UserFilesDirName { set; get; }
public static bool IsValidYavscPath(this string path)
{
if (string.IsNullOrEmpty(path)) return true;
foreach (var name in path.Split(Path.DirectorySeparatorChar))
{
if (!IsValidDirectoryName(name) || name.Equals("..") || name.Equals("."))
return false;
}
if (path[path.Length-1]==FileSystemConstants.RemoteDirectorySeparator) return false;
return true;
}
public static bool IsValidDirectoryName(this string name)
{
return !name.Any(c => !FileSystemConstants.ValidFileNameChars.Contains(c));
}
// Ensure this path is canonical,
// No "dirto/./this", neither "dirt/to/that/"
// no .. and each char must be listed as valid in constants
public static string FilterFileName(string fileName)
{
if (fileName==null) return null;
StringBuilder sb = new StringBuilder();
foreach (var c in fileName)
{
if (FileSystemConstants.ValidFileNameChars.Contains(c))
sb.Append(c);
else sb.Append('_');
}
return sb.ToString();
}
public static UserDirectoryInfo GetUserFiles(this ClaimsPrincipal user, string subdir)
{
UserDirectoryInfo di = new UserDirectoryInfo(UserFilesDirName, user.Identity.Name, subdir);
return di;
}
}
public static class FileSystemConstants
{
public const char RemoteDirectorySeparator = '/';
public static char[] ValidFileNameChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-=_~. ".ToCharArray();
}
}

View file

@ -0,0 +1,8 @@
namespace Yavsc.Abstract.FileSystem {
public interface IDirectoryShortInfo
{
string Name { get; set; }
bool IsEmpty { get; set; }
}
}

View file

@ -0,0 +1,15 @@
namespace Yavsc.Abstract.FileSystem
{
public interface IFileRecievedInfo
{
string MimeType { get; set; }
string DestDir { get; set; }
string FileName { get; set; }
bool Overriden { get; set; }
bool QuotaOffensed { get; set; }
}
}

View file

@ -0,0 +1,57 @@
using System;
using System.IO;
using System.Linq;
using Yavsc.Abstract.FileSystem;
namespace Yavsc.ViewModels.UserFiles
{
public class UserDirectoryInfo
{
public string UserName { get; set; }
public string SubPath { get; set; }
public RemoteFileInfo [] Files {
get; set;
}
public DirectoryShortInfo [] SubDirectories { 
get; set;
}
private DirectoryInfo dInfo;
// for deserialization
public UserDirectoryInfo()
{
}
public UserDirectoryInfo(string userReposPath, string username, string path)
{
if (string.IsNullOrWhiteSpace(username))
throw new NotSupportedException("No user name, no user dir.");
UserName = username;
var finalPath = username;
if (!finalPath.IsValidYavscPath())
throw new InvalidOperationException(
$"File name contains invalid chars ({finalPath})");
dInfo = new DirectoryInfo(
userReposPath+Path.DirectorySeparatorChar+finalPath);
if (dInfo.Exists) {
Files = dInfo.GetFiles().Select
( entry => new RemoteFileInfo { Name = entry.Name, Size = entry.Length,
CreationTime = entry.CreationTime, LastModified = entry.LastWriteTime }).ToArray();
SubDirectories = dInfo.GetDirectories().Select
( d=> new DirectoryShortInfo { Name= d.Name, IsEmpty=false } ).ToArray();
}
else {
// don't return null, but empty arrays
Files = new RemoteFileInfo[0];
SubDirectories = new DirectoryShortInfo[0];
}
}
}
public class DirectoryShortInfo: IDirectoryShortInfo {
public string Name { get; set; }
public bool IsEmpty { get; set; }
}
}

View file

@ -0,0 +1,18 @@
using System;
namespace Yavsc.ViewModels
{
public class RemoteFileInfo
{
public string Name { get; set; }
public long Size { get; set; }
public DateTime CreationTime { get; set; }
public DateTime LastModified { get; set; }
}
}

View file

@ -0,0 +1,46 @@
//
// CalendarEventList.cs
//
// Author:
// Paul Schneider <paulschneider@free.fr>
//
// Copyright (c) 2015 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.Models.Google
{
/// <summary>
/// Calendar event list.
/// </summary>
[Obsolete("use GoogleUse.Apis")]
public class CalendarEventList
{
/// <summary>
/// The next page token.
/// </summary>
public string nextPageToken;
/// <summary>
/// The next sync token.
/// </summary>
public string nextSyncToken;
/// <summary>
/// The items.
/// </summary>
public Resource [] items ;
}
}

View file

@ -0,0 +1,56 @@
//
// CalendarList.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.Models.Google.Calendar
{
/// <summary>
/// Calendar list.
/// </summary>
[Obsolete("use Google.Apis")]
public class CalendarList {
/// <summary>
/// Gets or sets the kind.
/// </summary>
/// <value>The kind.</value>
public string kind { get; set;}
/// <summary>
/// Gets or sets the etag.
/// </summary>
/// <value>The etag.</value>
public string etag { get; set; }
/// <summary>
/// Gets or sets the next sync token.
/// </summary>
/// <value>The next sync token.</value>
public string description { get; set; }
public string summpary { get; set; }
public string nextSyncToken { get; set; }
/// <summary>
/// Gets or sets the items.
/// </summary>
/// <value>The items.</value>
public CalendarListEntry[] items { get; set; }
}
}

View file

@ -0,0 +1,114 @@
//
// CalendarListEntry.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.Models.Google.Calendar
{
/// <summary>
/// Calendar list entry.
/// </summary>
///
[Obsolete("use GoogleUse.Apis")]
public class CalendarListEntry {
/// <summary>
/// Gets or sets the kind.
/// </summary>
/// <value>The kind.</value>
public string kind { get; set;}
/// <summary>
/// Gets or sets the etag.
/// </summary>
/// <value>The etag.</value>
public string etag { get; set; }
/// <summary>
/// Gets or sets the identifier.
/// </summary>
/// <value>The identifier.</value>
public string id { get; set; }
/// <summary>
/// Gets or sets the summary.
/// </summary>
/// <value>The summary.</value>
public string summary { get; set; }
/// <summary>
/// Gets or sets the description.
/// </summary>
/// <value>The description.</value>
public string description { get; set; }
/// <summary>
/// Gets or sets the time zone.
/// </summary>
/// <value>The time zone.</value>
public string timeZone { get; set; }
/// <summary>
/// Gets or sets the color identifier.
/// </summary>
/// <value>The color identifier.</value>
public string colorId { get; set; }
/// <summary>
/// Gets or sets the color of the background.
/// </summary>
/// <value>The color of the background.</value>
public string backgroundColor { get; set; }
/// <summary>
/// Gets or sets the color of the foreground.
/// </summary>
/// <value>The color of the foreground.</value>
public string foregroundColor { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this <see cref="Yavsc.Model.Google.CalendarListEntry"/> is selected.
/// </summary>
/// <value><c>true</c> if selected; otherwise, <c>false</c>.</value>
public bool selected { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this <see cref="Yavsc.Model.Google.CalendarListEntry"/> is primary.
/// </summary>
/// <value><c>true</c> if primary; otherwise, <c>false</c>.</value>
public bool primary { get; set; }
/// <summary>
/// Gets or sets the access role.
/// </summary>
/// <value>The access role.</value>
public string accessRole { get; set; }
/// <summary>
/// Reminder.
/// </summary>
/// <summary>
/// Gets or sets the default reminders.
/// </summary>
/// <value>The default reminders.</value>
public Reminder[] defaultReminders { get; set; }
/* "notificationSettings": { "notifications":
[ { "type": "eventCreation", "method": "email" },
{ "type": "eventChange", "method": "email" },
{ "type": "eventCancellation", "method": "email" },
{ "type": "eventResponse", "method": "email" } ] }, "primary": true },
*/
}
/// <summary>
/// Reminder.
/// </summary>
}

View file

@ -0,0 +1,18 @@
using System;
namespace Yavsc.Models.Google.Calendar
{
[Obsolete("use GoogleUse.Apis")]
public class Reminder {
/// <summary>
/// Gets or sets the method.
/// </summary>
/// <value>The method.</value>
public string method { get; set; }
/// <summary>
/// Gets or sets the minutes.
/// </summary>
/// <value>The minutes.</value>
public int minutes { get; set; }
}
}

View file

@ -0,0 +1,43 @@
//
// GDate.cs
//
// Author:
// Paul Schneider <paulschneider@free.fr>
//
// Copyright (c) 2015 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.Models.Google
{
/// <summary>
/// G date.
/// </summary>
public class GDate {
/// <summary>
/// The date.
/// </summary>
public DateTime? date;
/// <summary>
/// The datetime.
/// </summary>
public DateTime? datetime;
/// <summary>
/// The time zone.
/// </summary>
public string timeZone;
}
}

View file

@ -0,0 +1,78 @@
//
// MessageWithPayLoad.cs
//
// Author:
// paul <>
//
// Copyright (c) 2015 paul
//
// 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 Yavsc.Models.Messaging;
namespace Yavsc.Models.Google.Messaging
{
// https://gcm-http.googleapis.com/gcm/send
/// <summary>
/// Message with payload.
/// </summary>
public class MessageWithPayload<T> {
/// <summary>
/// To.
/// </summary>
public string to;
/// <summary>
/// The registration identifiers.
/// </summary>
public string [] registration_ids;
/// <summary>
/// The data.
/// </summary>
public T data ;
/// <summary>
/// The notification.
/// </summary>
public Notification notification;
/// <summary>
/// The collapse key.
/// </summary>
public string collapse_key; // in order to collapse ...
/// <summary>
/// The priority.
/// </summary>
public int priority; // between 0 and 10, 10 is the lowest!
/// <summary>
/// The content available.
/// </summary>
public bool content_available;
/// <summary>
/// The delay while idle.
/// </summary>
public bool delay_while_idle;
/// <summary>
/// The time to live.
/// </summary>
public int time_to_live; // seconds
/// <summary>
/// The name of the restricted package.
/// </summary>
public string restricted_package_name;
/// <summary>
/// The dry run.
/// </summary>
public bool dry_run;
}
}

View file

@ -0,0 +1,69 @@
//
// MessageWithPayloadResponse.cs
//
// Author:
// paul <paul@pschneider.fr>
//
// Copyright (c) 2015 paul
//
// 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/>.
namespace Yavsc.Models.Google.Messaging
{
// https://gcm-http.googleapis.com/gcm/send
/// <summary>
/// Message with payload response.
/// </summary>
public class MessageWithPayloadResponse {
/// <summary>
/// The multicast identifier.
/// </summary>
public string multicast_id;
/// <summary>
/// The success count.
/// </summary>
public int success;
/// <summary>
/// The failure count.
/// </summary>
public int failure;
/// <summary>
/// The canonical identifiers... ?!?
/// </summary>
public string canonical_ids;
/// <summary>
/// Detailled result.
/// </summary>
public class Result {
/// <summary>
/// The message identifier.
/// </summary>
public string message_id;
/// <summary>
/// The registration identifier.
/// </summary>
public string registration_id;
/// <summary>
/// The error.
/// </summary>
public string error;
}
/// <summary>
/// The results.
/// </summary>
public Result [] results;
}
}

View file

@ -0,0 +1,165 @@
//
// 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/>.
namespace Yavsc.Models.Google
{
/// <summary>
/// People.
/// </summary>
public class People {
/// <summary>
/// Gets or sets the kind.
/// </summary>
/// <value>The kind.</value>
public string kind { get; set; }
/// <summary>
/// Gets or sets the etag.
/// </summary>
/// <value>The etag.</value>
public string etag { get; set; }
/// <summary>
/// Gets or sets the gender.
/// </summary>
/// <value>The gender.</value>
public string gender { get; set; }
/// <summary>
/// E mail.
/// </summary>
public class EMail{
/// <summary>
/// Gets or sets the value.
/// </summary>
/// <value>The value.</value>
public string value { get; set; }
/// <summary>
/// Gets or sets the type.
/// </summary>
/// <value>The type.</value>
public string type { get; set; }
}
/// <summary>
/// Gets or sets the emails.
/// </summary>
/// <value>The emails.</value>
public EMail[] emails { get; set; }
/// <summary>
/// Gets or sets the type of the object.
/// </summary>
/// <value>The type of the object.</value>
public string objectType { get; set; }
/// <summary>
/// Gets or sets the identifier.
/// </summary>
/// <value>The identifier.</value>
public string id { get; set; }
/// <summary>
/// Gets or sets the display name.
/// </summary>
/// <value>The display name.</value>
public string displayName { get; set; }
/// <summary>
/// Name.
/// </summary>
public class Name {
/// <summary>
/// Gets or sets the name of the family.
/// </summary>
/// <value>The name of the family.</value>
public string familyName { get; set; }
/// <summary>
/// Gets or sets the name of the given.
/// </summary>
/// <value>The name of the given.</value>
public string givenName { get; set; }
}
/// <summary>
/// Gets or sets the name.
/// </summary>
/// <value>The name.</value>
public Name name { get; set;}
/// <summary>
/// Gets or sets the URL.
/// </summary>
/// <value>The URL.</value>
public string url { get; set; }
/// <summary>
/// Image.
/// </summary>
public class Image {
/// <summary>
/// Gets or sets the URL.
/// </summary>
/// <value>The URL.</value>
public string url { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this <see cref="Yavsc.Model.Google.People.Image"/> is default.
/// </summary>
/// <value><c>true</c> if is default; otherwise, <c>false</c>.</value>
public bool isDefault { get; set; }
}
/// <summary>
/// Gets or sets the image.
/// </summary>
/// <value>The image.</value>
public Image image { get; set; }
/// <summary>
/// Place.
/// </summary>
public class Place {
/// <summary>
/// Gets or sets the value.
/// </summary>
/// <value>The value.</value>
public string value { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this <see cref="Yavsc.Model.Google.People.Place"/> is primary.
/// </summary>
/// <value><c>true</c> if primary; otherwise, <c>false</c>.</value>
public bool primary { get; set; }
}
/// <summary>
/// Gets or sets the places lived.
/// </summary>
/// <value>The places lived.</value>
public Place[] placesLived { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this <see cref="Yavsc.Model.Google.People"/> is plus user.
/// </summary>
/// <value><c>true</c> if is plus user; otherwise, <c>false</c>.</value>
public bool isPlusUser { get; set; }
/// <summary>
/// Gets or sets the language.
/// </summary>
/// <value>The language.</value>
public string language { get; set; }
/// <summary>
/// Gets or sets the circled by count.
/// </summary>
/// <value>The circled by count.</value>
public int circledByCount { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this <see cref="Yavsc.Model.Google.People"/> is verified.
/// </summary>
/// <value><c>true</c> if verified; otherwise, <c>false</c>.</value>
public bool verified { get; set; }
}
}

View file

@ -0,0 +1,45 @@
//
// Resource.cs
//
// Author:
// Paul Schneider <paulschneider@free.fr>
//
// Copyright (c) 2015 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/>.
namespace Yavsc.Models.Google
{
/// <summary>
/// Resource.
/// </summary>
public class Resource {
public string id;
public string location;
public string status;
public GDate start;
public GDate end;
public string recurence;
public string description;
public string summary;
/// <summary>
/// Available <=> transparency == "transparent"
/// </summary>
public string transparency;
}
}

View file

@ -0,0 +1,47 @@
//
// Entity.cs
//
// Author:
// Paul Schneider <paulschneider@free.fr>
//
// Copyright (c) 2015 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/>.
namespace Yavsc.Models.Google
{
/// <summary>
/// Entity.
/// </summary>
public class Entity
{
/// <summary>
/// The I.
/// </summary>
public string ID;
/// <summary>
/// The name.
/// </summary>
public string Name;
/// <summary>
/// The type: AUTOMOBILE: A car or passenger vehicle.
/// * TRUCK: A truck or cargo vehicle.
/// * WATERCRAFT: A boat or other waterborne vehicle.
/// * PERSON: A person.
/// </summary>
public string Type;
}
}

View file

@ -0,0 +1,37 @@
//
// EntityQuery.cs
//
// Author:
// Paul Schneider <paulschneider@free.fr>
//
// Copyright (c) 2015 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/>.
namespace Yavsc.Models.Google
{
/// <summary>
/// Entity query.
/// </summary>
public class EntityQuery {
/// <summary>
/// The entity identifiers.
/// </summary>
public string [] EntityIds;
/// <summary>
/// The minimum identifier.
/// </summary>
public string MinId;
}
}

View file

@ -0,0 +1,12 @@
using System;
namespace Yavsc
{
public interface IBaseTrackedEntity
{
DateTime DateCreated { get; set; }
string UserCreated { get; set; }
DateTime DateModified { get; set; }
string UserModified { get; set; }
}
}

View file

@ -0,0 +1,36 @@
//
// IIdentified.cs
//
// Author:
// Paul Schneider <paul@pschneider.fr>
//
// Copyright (c) 2015 GNU GPL
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
namespace Yavsc
{
/// <summary>
/// I identified.
/// </summary>
public interface IIdentified<T>
{
/// <summary>
/// Gets or sets the identifier.
/// </summary>
/// <value>The identifier.</value>
T Id { get; set; }
}
}

View file

@ -0,0 +1,98 @@
using System;
using System.Collections;
using System.Collections.Generic;
namespace Yavsc.Abstract.IT
{
public class CharArray : List<char>, IEnumerable<char>, IList<char>
{
public CharArray (char [] charArray) : base (charArray)
{
}
public CharArray (IList<char> word): base(word) {
}
public CharArray (IEnumerable<char> word): base(word) {
}
public IList<char> Aggregate(char other)
{
this.Add(other);
return this;
}
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
}
public class CodeFromChars : List<CharArray>, ICode<char>
{
public void AddLetter(IEnumerable<char> letter)
{
var candide = new CharArray(letter);
// TODO build new denied letters: compute the automate
// and check it is determinised
// Automate a = new Automate();
Add(candide);
}
public bool Validate()
{
// this is a n*n task
throw new NotImplementedException();
}
IEnumerator<IEnumerable<char>> IEnumerable<IEnumerable<char>>.GetEnumerator()
{
return GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
private class Automate
{
int State { get; set; }
Dictionary<int, Dictionary<int,int>> Transitions { get; set; }
CodeFromChars Code { get; set; }
void Compute(CharArray chars)
{
if (!Code.Contains(chars)) {
State = -1;
return;
}
if (!Transitions.ContainsKey(State)) {
State = -2;
return;
}
var states = Transitions[State];
int letter = Code.IndexOf(chars);
if (!states.ContainsKey(letter))
{
State = -3;
return;
}
State = states[letter];
}
}
}
}

View file

@ -0,0 +1,24 @@
using System.Collections.Generic;
namespace Yavsc.Abstract.IT
{
// un code est, parmis les ensembles de suites de signes,
// ceux qui n'ont qu'une seule suite de suites pouvant représenter toute suite de suite de signes
public interface ICode<TSign> : IEnumerable<IEnumerable<TSign>>
{
/// <summary>
/// Checks false that a letter list combinaison correspond to another one
/// </summary>
/// <returns></returns>
bool Validate();
/// <summary>
/// Defines a new letter in this code,
/// as an enumerable of <c>TLetter</c>
/// </summary>
/// <param name="letter"></param>
/// <returns></returns>
void AddLetter(IEnumerable<TSign> letter);
}
}

View file

@ -0,0 +1,14 @@
using System.Collections.Generic;
namespace Yavsc.Abstract.IT
{
public interface IProject
{
long Id { get; set ; }
string OwnerId { get; set; }
string Name { get; set; }
string Version { get; set; }
IEnumerable<string> GetConfigurations();
}
}

View file

@ -0,0 +1,28 @@
//
// ITitle.cs
//
// Author:
// Paul Schneider <paul@pschneider.fr>
//
// Copyright (c) 2015 GNU GPL
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
namespace Yavsc
{
public interface ITitle
{
string Title { get; set; }
}
}

View file

@ -0,0 +1,56 @@
//
// 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/>.
namespace Yavsc.Abstract.Identity
{
/// <summary>
/// Auth token, as they are received.
/// </summary>
public class AuthToken {
/// <summary>
/// Gets or sets the access token.
/// </summary>
/// <value>The access token.</value>
public string access_token { get; set; }
/// <summary>
/// Gets or sets the identifier token.
/// </summary>
/// <value>The identifier token.</value>
public string id_token { get; set; }
/// <summary>
/// Gets or sets the type of the token.
/// </summary>
/// <value>The type of the token.</value>
public string token_type { get; set ; }
/// <summary>
/// Gets or sets the refresh token.
/// </summary>
/// <value>The refresh token.</value>
public string refresh_token { get; set; }
/// <summary>
/// Gets or sets the expires in.
/// </summary>
/// <value>The expires in.</value>
public int expires_in { get; set; }
}
}

View file

@ -0,0 +1,16 @@
using System.ComponentModel.DataAnnotations;
namespace Yavsc.Abstract.Identity
{
public class ClientProviderInfo
{
public string UserName { get; set; }
public string Avatar { get; set; }
[Key]
public string UserId { get; set; }
public string EMail { get; set; }
public string Phone { get; set; }
public long BillingAddressId { get; set; }
}
}

View file

@ -0,0 +1,12 @@
namespace Yavsc.Abstract.Identity
{
public interface IApplicationUser
{
string Id { get; set; }
string UserName { get; set; }
string Avatar { get ; set; }
IAccountBalance AccountBalance { get; set; }
string DedicatedGoogleCalendar { get; set; }
ILocation PostalAddress { get; set; }
}
}

View file

@ -0,0 +1,9 @@
namespace Yavsc.Abstract.Identity {
public class Me : UserInfo
{
public AuthToken Token {
get;
set;
}
}
}

View file

@ -0,0 +1,8 @@
namespace Yavsc.Abstract.Identity.Security
{
public interface ICircleAuthorization
{
long CircleId { get; set; }
}
}

View file

@ -0,0 +1,11 @@
namespace Yavsc.Abstract.Identity.Security
{
public interface ICircleAuthorized
{
long Id { get; set; }
string GetOwnerId ();
bool AuthorizeCircle(long circleId);
ICircleAuthorization [] GetACL();
}
}

View file

@ -0,0 +1,13 @@
using System;
namespace Yavsc.Abstract.Identity
{
public class TokenInfo
{
public string AccessToken { get; set; }
public string RefreshToken { get; set; }
public int ExpiresIn { set; get; }
public DateTime Received { get; set; }
public string TokenType { get; set; }
}
}

View file

@ -0,0 +1,21 @@
namespace Yavsc.Abstract.Identity
{
public class UserInfo {
public UserInfo()
{
}
public UserInfo(string userId, string userName, string avatar)
{
UserId = userId;
UserName = userName;
Avatar = avatar;
}
public string UserId { get; set; }
public string UserName { get; set; }
public string Avatar { get; set; }
}
}

View file

@ -0,0 +1,7 @@
namespace Yavsc.Services
{
public interface IBankInterface
{
}
}

View file

@ -0,0 +1,13 @@
using System;
namespace Yavsc.Abstract.Interfaces
{
public interface IBatch<TInput, TOutput>
{
string WorkingDir { get; set; }
Action<TOutput> ResultHandler { get; }
void Launch(TInput Input);
string LogPath { get; set; }
}
}

View file

@ -0,0 +1,47 @@
namespace Yavsc.Services
{
using System.Linq;
using System.Threading.Tasks;
using System.Collections.Generic;
using Yavsc.Abstract.Workflow;
public interface IBillingService
{
// TODO ensure a default value at using this:
/// <summary>
/// maps a command type name to a bolling code, used to get bill assets
/// </summary>
/// <returns></returns>
Dictionary<string,string> BillingMap { get; }
/// <summary>
/// Renvoye la facture associée à une clé de facturation,
/// à partir du couple suivant :
///
/// * un code de facturation
/// (identifiant associé à un type de demande du client)
/// * un entier long identifiant la demande du client
/// (à une demande, on associe au maximum une seule facture)
/// </summary>
/// <param name="billingCode">Identifiant du type de facturation</param>
/// <param name="queryId">Identifiant de la demande du client</param>
/// <returns>La facture</returns>
Task<IDecidableQuery> GetBillAsync(string billingCode, long queryId);
/// <summary>
/// All performer setting in this activity
/// </summary>
/// <param name="activityCode"></param>
/// <returns></returns>
Task<IQueryable<ISpecializationSettings>> GetPerformersSettingsAsync(string activityCode);
/// <summary>
/// Perfomer settings for the specified performer in the activity
/// </summary>
/// <param name="activityCode">activityCode</param>
/// <param name="userId">performer uid</param>
/// <returns></returns>
Task<ISpecializationSettings> GetPerformerSettingsAsync(string activityCode, string userId);
}
}

View file

@ -0,0 +1,19 @@
using System.Threading.Tasks;
using Yavsc.Abstract.Manage;
namespace Yavsc.Services
{
public interface IEmailSender
{
/// <summary>
/// Sends en email.
/// </summary>
/// <param name="username">user name in database</param>
/// <param name="email">user's email</param>
/// <param name="subject">email subject</param>
/// <param name="message">message</param>
/// <returns>the message id</returns>
Task<EmailSentViewModel> SendEmailAsync(string username, string email, string subject, string message);
}
}

View file

@ -0,0 +1,10 @@
using Yavsc.Abstract.Identity;
namespace Yavsc.Interfaces
{
public interface ICircleMember: IIdentified<long>
{
ICircle Circle { get; set; }
IApplicationUser Member { get; set; }
}
}

View file

@ -0,0 +1,10 @@
namespace Yavsc.Interfaces
{
public interface IComment<T> : IIdentified<T>
{
T GetReceiverId();
void SetReceiverId(T rid);
string Content { get; set; }
}
}

View file

@ -0,0 +1,21 @@

using Yavsc.Abstract.Identity;
namespace Yavsc.Interfaces
{
public interface IGCMDeclaration
{
string DeviceId { get; set; }
string GCMRegistrationId { get; set; }
string Model { get; set; }
string Platform { get; set; }
string Version { get; set; }
}
public interface IGoogleCloudMobileDeclaration: IGCMDeclaration
{
IApplicationUser DeviceOwner { get; set; }
string DeviceOwnerId { get; set; }
}
}

View file

@ -0,0 +1,8 @@
namespace Yavsc.Interfaces
{
public interface ILocation
{
string Address { get; set; }
long Id { get; set; }
}
}

View file

@ -0,0 +1,7 @@
namespace Yavsc.Interfaces
{
public interface INamedObject
{
string Name { get; set; }
}
}

View file

@ -0,0 +1,7 @@
namespace Yavsc.Interfaces
{
public interface IOwned
{
string OwnerId { get; }
}
}

View file

@ -0,0 +1,8 @@
namespace Yavsc.Interfaces
{
public interface IPosition
{
double Latitude { get; set; }
double Longitude { get; set; }
}
}

View file

@ -0,0 +1,9 @@
namespace Yavsc.Interfaces
{
public interface ITaggable<K>
{
string [] GetTags();
K Id { get; }
}
}

View file

@ -0,0 +1,9 @@
using Yavsc.Billing;
namespace Yavsc.Models.Billing {
public interface IBillingClause { 
string Description {get; set;}
IBillingImpacter Impacter { get; }
}
}

View file

@ -0,0 +1,14 @@
using System;
using Yavsc.Abstract.Identity;
namespace Yavsc.Interfaces
{
public interface IBookQueryData
{
ClientProviderInfo Client { get; set; }
DateTime EventDate { get; set; }
long Id { get; set; }
ILocation Location { get; set; }
decimal? Previsionnal { get; set; }
}
}

View file

@ -0,0 +1,8 @@
namespace Yavsc.Interfaces
{
public interface IContact
{
string OwnerId { get; set; }
string UserId { get; set; }
}
}

View file

@ -0,0 +1,7 @@
SOURCE_DIR=$(HOME)/workspace/yavsc
MAKEFILE_DIR=$(SOURCE_DIR)/scripts/build/make
include $(MAKEFILE_DIR)/versioning.mk
include $(MAKEFILE_DIR)/dnx.mk
all: $(BINTARGETPATH)

View file

@ -0,0 +1,10 @@
namespace Yavsc.Abstract.Manage
{
public class EmailSentViewModel
{
public string EMail { get; set; }
public string MessageId { get; set; }
public bool Sent { get; set; }
public string ErrorMessage { get; set; }
}
}

View file

@ -0,0 +1 @@


View file

@ -0,0 +1,64 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Yavsc.Models.Messaging
{
/// <summary>
/// A Notification, that mocks the one sent to Google,
/// since it fits my needs
/// </summary>
public class Notification
{
[Key, DatabaseGeneratedAttribute(DatabaseGeneratedOption.Identity)]
public long Id { get; set; }
/// <summary>
/// The title.
/// </summary>
[Required, Display(Name = "Titre")]
public string title { get; set; }
/// <summary>
/// The body.
/// </summary>
[Required, Display(Name = "Corps")]
public string body { get; set; }
/// <summary>
/// The icon.
/// </summary>
[Display(Name = "Icône")]
public string icon { get; set; }
/// <summary>
/// The sound.
/// </summary>
[Display(Name = "Son")]
public string sound { get; set; }
/// <summary>
/// The tag.
/// </summary>
[Display(Name = "Tag")]
public string tag { get; set; }
/// <summary>
/// The color.
/// </summary>
[Display(Name = "Couleur")]
public string color { get; set; }
/// <summary>
/// The click action.
/// </summary>
[Required, Display(Name = "Label du click")]
public string click_action { get; set; }
/// <summary>
/// When null, this must be seen by everynone.
/// <c>user/{UserId}<c> : it's for this user, and only this one, specified by ID,
/// <c>pub/cga</c> : the public "cga" topic
/// <c>administration</c> : for admins ...
/// </summary>
/// <returns></returns>
public string Target { get; set; }
public Notification()
{
icon = "exclam";
}
}
}

View file

@ -0,0 +1,23 @@
using System;
using Yavsc.Abstract.Identity;
namespace Yavsc.Models
{
public class RdvQueryProviderInfo
{
public ClientProviderInfo Client { get; set; }
public ILocation Location { get; set; }
public long Id { get; set; }
public DateTime? EventDate { get; set; }
public decimal? Previsional { get; set; }
public string Reason { get; set; }
public string ActivityCode { get; set; }
public string BillingCode { get; set; }
}
}

View file

@ -0,0 +1,9 @@
namespace Yavsc.Abstract.Messaging
{
public static class MessagingConstants {
public static readonly string TopicGeneral = "/topic/general";
public static readonly string TopicRdvQuery = "/topic/RdvQuery";
public static readonly string TopicEstimation = "/topic/Estimation";
public static readonly string TopicHairCutQuery = "/topic/HairCutQuery";
}
}

View file

@ -0,0 +1,11 @@
using System.Resources;
using System.Reflection;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyCopyright("Copyright © 2014-2018")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("fr")]

View file

@ -0,0 +1,8 @@
namespace Yavsc.Abstract.Streaming
{
public enum ChatRoomUsageLevel: int {
User=0,
HalfOp,
Op
}
}

View file

@ -0,0 +1,10 @@
using System.Collections.Generic;
namespace Yavsc.Abstract.Streaming
{
public interface IChatConnection<T> : IConnection where T: IChatRoomUsage
{
List<T> Rooms { get; }
}
}

View file

@ -0,0 +1,11 @@
using System.Collections.Generic;
namespace Yavsc.Abstract.Streaming
{
public interface IChatRoom<TUsage> where TUsage : IChatRoomUsage
{
string Name { get; set; }
string Topic { get ; set; }
List<TUsage> UserList { get; }
}
}

View file

@ -0,0 +1,12 @@
namespace Yavsc.Abstract.Streaming
{
public interface IChatRoomUsage {
string ChannelName { get; set; }
string ChatUserConnectionId { get; set; }
ChatRoomUsageLevel Level { get; set; }
}
}

View file

@ -0,0 +1,15 @@
namespace Yavsc.Abstract.Streaming
{
public interface IChatUserInfo
{
IConnection[] Connections { get; set; }
string UserId { get; set; }
string UserName { get; set; }
string Avatar { get; set; }
string[] Roles { get; set; }
}
}

View file

@ -0,0 +1,10 @@
namespace Yavsc.Abstract.Streaming
{
public interface IConnection
{
string ConnectionId { get; set; }
string UserAgent { get; set; }
bool Connected { get; set; }
}
}

View file

@ -0,0 +1,33 @@
using System.Text;
using System.Threading.Tasks;
namespace Yavsc.Abstract.Templates
{
/// <summary>
/// A CSharp Razor template.
/// </summary>
public abstract class Template
{
StringBuilder _buffer ;
public virtual void Write(object value)
{ WriteLiteral(value); }
public virtual void WriteLiteral(object value)
{ _buffer.Append(value); }
public string GeneratedText {
get {
return _buffer.ToString();
}
}
public virtual void Init() {
_buffer = new StringBuilder();
}
public abstract Task ExecuteAsync();
}
}

View file

@ -0,0 +1,35 @@
using System;
namespace Yavsc
{
public interface IActivity
{
string Code { get; set; }
string Name { get; set; }
string ParentCode { get; set; }
string Photo { get; set; }
string Description { get; set; }
string ModeratorGroupName { get; set; }
int Rate { get; set; }
string SettingsClassName { get; set; }
DateTime DateCreated
{
get; set;
}
string UserCreated
{
get; set;
}
DateTime DateModified
{
get; set;
}
string UserModified
{
get; set;
}
}
}

View file

@ -0,0 +1,9 @@
namespace Yavsc.Models
{
public interface IBlackListed
{
long Id { get; set; }
string UserId { get; set; }
string OwnerId { get; set; }
}
}

View file

@ -0,0 +1,9 @@
namespace Yavsc.Interfaces
{
public interface ICircle
{
long Id { get; set; }
string Name { get; set; }
string OwnerId { get; set; }
}
}

View file

@ -0,0 +1,10 @@
namespace Yavsc
{
public interface ICoWorking
{
long Id {get; set; }
string PerformerId { get; set; }
string WorkingForId { get; set; }
}
}

View file

@ -0,0 +1,11 @@
namespace Yavsc
{
public interface ICommandForm
{
long Id { get; set; }
string ActionName { get; set; }
string Title { get; set; }
string ActivityCode { get; set; }
}
}

View file

@ -0,0 +1,10 @@
namespace Yavsc
{
using Abstract.Identity;
public interface IContact
{
IApplicationUser Owner { get; set; }
string OwnerId { get; set; }
string UserId { get; set; }
}
}

View file

@ -0,0 +1,19 @@
namespace Yavsc.Interfaces.Workflow {
public interface IEvent {
/// <summary>
/// <c>/topic/(bookquery|estimate)</c>
/// </summary>
/// <returns></returns>
string Topic { get; }
/// <summary>
/// Should be the user's name
/// </summary>
/// <returns></returns>
string Sender { get; set ; }
string CreateBody();
}
}

View file

@ -0,0 +1,39 @@
// Copyright (C) 2016 Paul Schneider
//
// This file is part of yavsc.
//
// yavsc is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 2 of the License, or
// (at your option) any later version.
//
// yavsc 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 General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with yavsc. If not, see <http://www.gnu.org/licenses/>.
//
using System;
using Yavsc.Abstract.Identity;
namespace Yavsc
{
public interface IGCMDeclaration
{
string DeviceId { get; set; }
string GCMRegistrationId { get; set; }
string Model { get; set; }
string Platform { get; set; }
string Version { get; set; }
DateTime? LatestActivityUpdate { get; set; }
}
public interface IGoogleCloudMobileDeclaration: IGCMDeclaration
{
IApplicationUser DeviceOwner { get; set; }
string DeviceOwnerId { get; set; }
}
}

View file

@ -0,0 +1,8 @@
namespace Yavsc
{
public interface ILocation : IPosition
{
string Address { get; set; }
long Id { get; set; }
}
}

View file

@ -0,0 +1,10 @@
using System;
namespace Yavsc.Abstract.Workflow
{
public interface IDecidableQuery: IQuery
{
bool Rejected { get; set; }
DateTime RejectedAt { get; set; }
}
}

View file

@ -0,0 +1,17 @@
namespace Yavsc.Workflow
{
public interface IPerformerProfile
{
string PerformerId { get; set; }
string SIREN { get; set; }
bool AcceptNotifications { get; set; }
long OrganizationAddressId { get; set; }
bool AcceptPublicContact { get; set; }
bool UseGeoLocalizationToReduceDistanceWithClients { get; set; }
string WebSite { get; set; }
bool Active { get; set; }
int? MaxDailyCost { get; set; }
int? MinDailyCost { get; set; }
int Rate { get; set; }
}
}

View file

@ -0,0 +1,8 @@
namespace Yavsc
{
public interface IPosition
{
double Latitude { get; set; }
double Longitude { get; set; }
}
}

View file

@ -0,0 +1,11 @@
namespace Yavsc.Abstract.Workflow
{
using Yavsc;
using Yavsc.Billing;
public interface IQuery: IBaseTrackedEntity, IBillable
{
QueryStatus Status { get; set; }
string PaymentId { get; set; }
}
}

View file

@ -0,0 +1,37 @@
//
// IIdentified.cs
//
// Author:
// Paul Schneider <paul@pschneider.fr>
//
// Copyright (c) 2015 GNU GPL
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
namespace Yavsc
{
/// <summary>
/// I rating.
/// </summary>
public interface IRating<TK>: IIdentified<TK>
{
/// <summary>
/// Gets or sets the rate.
/// </summary>
/// <value>The rate.</value>
int Rate { get; set; }
}
}

View file

@ -0,0 +1,7 @@
namespace Yavsc
{
public interface ISpecializationSettings
{
string UserId { get ; set ; }
}
}

View file

@ -0,0 +1,16 @@
using System.Collections.Generic;
namespace Yavsc.Models.Process
{
public class Conjonction : List<IRequisition>, IRequisition
{
public bool Eval()
{
foreach (var req in this)
if (!req.Eval())
return false;
return true;
}
}
}

View file

@ -0,0 +1,16 @@
using System.Collections.Generic;
namespace Yavsc.Models.Process
{
public class Disjonction : List<IRequisition>, IRequisition
{
public bool Eval()
{
foreach (var req in this)
if (req.Eval())
return true;
return false;
}
}
}

View file

@ -0,0 +1,12 @@
namespace Yavsc.Models.Process
{
public class ConstInputValue : NamedRequisition
{
public bool Value { get; set; }
public override bool Eval()
{
return Value;
}
}
}

View file

@ -0,0 +1,10 @@
using Yavsc.Interfaces;
namespace Yavsc.Models.Process
{
public abstract class NamedRequisition : IRequisition, INamedObject
{
public string Name { get; set; }
public abstract bool Eval();
}
}

View file

@ -0,0 +1,16 @@
namespace Yavsc.Models.Process
{
public class Negation<Exp> : IRequisition where Exp : IRequisition
{
Exp _expression;
public Negation(Exp expression)
{
_expression = expression;
}
public bool Eval()
{
return !_expression.Eval();
}
}
}

View file

@ -0,0 +1,34 @@
using System.ComponentModel.DataAnnotations;
namespace Yavsc.Models.Process
{
/// <summary>
/// An abstract, identified rule
/// </summary>
public abstract class Rule<TResult,TInput>
{
[Key]
public string Id { get; set; }
/// <summary>
/// Left part for this class of rule, a conjonction.
/// All of these requisitions must be true
/// in order to begin any related process.
/// </summary>
/// <returns></returns>
public Conjonction Left { get; set; }
/// <summary>
/// Right part of this rule, a disjonction.
/// That is, only one of these post requisitions
/// has to be true in order for this rule
/// to expose a success.
/// </summary>
/// <returns></returns>
public Disjonction Right { get; set; }
public string Description { get; set; }
public abstract TResult Execute(TInput inputData);
}
}

View file

@ -0,0 +1,22 @@
namespace Yavsc
{
/// <summary>
/// Status,
/// should be associated to any
/// client user query to a provider user or
/// other external entity.
/// </summary>
public enum QueryStatus: int
{
Inserted,
OwnerValidated,
Visited,
Rejected,
Accepted,
InProgress,
// final states
Failed,
Success
}
}

View file

@ -0,0 +1,17 @@
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Yavsc.Abstract.Workflow
{
public interface IExecutionData
{
Task Payload { get; }
ITaskMetaData MetaData { get; }
string [] Args { get; }
IList<IMayBeFixable> Faults { get; }
}
}

View file

@ -0,0 +1,9 @@
namespace Yavsc.Abstract.Workflow
{
public interface IMayBeFixable
{
bool Fixable { get; }
void TryAndFix();
}
}

View file

@ -0,0 +1,7 @@
namespace Yavsc.Models
{
public interface IRequisition
{
bool Eval();
}
}

View file

@ -0,0 +1,11 @@
using System.Collections.Generic;
using Yavsc.Models;
namespace Yavsc.Abstract.Workflow
{
public interface ITaskMetaData
{
string TaskName { get; }
IEnumerable <IRequisition> Prerequisites { get; }
}
}

View file

@ -0,0 +1,7 @@
namespace Yavsc.Abstract.Workflow
{
public interface ITaskRunner
{
IExecutionData Run( ITaskMetaData taskMetaData, string [] args);
}
}

View file

@ -0,0 +1,8 @@
namespace Yavsc.Abstract.Workflow
{
public interface ITaskRunnerProvider
{
ITaskRunner[] FindRunner(string runnerName);
}
}

View file

@ -0,0 +1,20 @@
using System.Collections.Generic;
using System.Linq;
namespace Yavsc.Abstract.Workflow
{
public class TaskManager : ITaskRunnerProvider
{
List<ITaskRunner> runners = new List<ITaskRunner>();
public void Register(ITaskRunner runner)
{
runners.Add(runner);
}
public ITaskRunner[] FindRunner(string runnerName)
{
if (string.IsNullOrWhiteSpace(runnerName))
return runners.ToArray();
return runners.Where(r => r.GetType().Name.IndexOf(runnerName.Trim())>=0).ToArray();
}
}
}

View file

@ -0,0 +1,24 @@
<?xml version="1.0"?>
<package xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<metadata xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<id>Yavsc.Abstract</id>
<title>Yavsc:Abstract</title>
<version>$version$</version>
<authors>Paul Schneider</authors>
<owners>Paul Schneider</owners>
<licenseUrl>https://github.com/pazof/yavsc/blob/vnext/Yavsc/License.md</licenseUrl>
<projectUrl>https://github.com/pazof/yavsc/README.md</projectUrl>
<iconUrl>https://github.com/pazof/yavsc/blob/vnext/Yavsc/wwwroot/images/yavsc.png</iconUrl>
<requireLicenseAcceptance>true</requireLicenseAcceptance>
<description>
A shared model for a little client/server app, dealing about establishing some contract, between some human client and provider.
</description>
<summary>
</summary>
<tags>yavsc</tags>
</metadata>
<files>
<file src="bin/$config$/dnx451/Yavsc.Abstract.dll" target="lib/dnx451" />
<file src="bin/$config$/net451/Yavsc.Abstract.dll" target="lib/portable-net45+win8+wp8+wpa81+Xamarin.Mac+MonoAndroid10+MonoTouch10+Xamarin.iOS10" />
</files>
</package>

View file

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

View file

@ -0,0 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
</packages>

Some files were not shown because too many files have changed in this diff Show more